we-like-parsers / pegen

PEG parser generator for Python
https://we-like-parsers.github.io/pegen/
MIT License
150 stars 32 forks source link

Rewrite parser generator #84

Open heckad opened 1 year ago

heckad commented 1 year ago

What does this pull request do?

This pull request changes what we consider successful parsing. Now we have the not_parsed marker (the name can be changed) which mark that rule can't parse input. This solves the problem with empty collections being interpreted as parsing failure and also allows you to drag None up. Unfortunately this is a very big change. Parsers generated by the previous version will not work. However, this solves all problems.

heckad commented 1 year ago

Also, if you are using someone else's ideas or code it's nice to mention them

I don't use any another idea. I just improved my last attempt. Now None, False and any other object are correct parsing results.

heckad commented 1 year ago

@MatthieuDartiailh, please look at pull request.