pointlander / peg

Peg, Parsing Expression Grammar, is an implementation of a Packrat parser generator.
BSD 3-Clause "New" or "Revised" License
1.01k stars 120 forks source link

Meant to be non-greedy? #96

Closed rwxrob closed 4 years ago

rwxrob commented 4 years ago

Everything I have read recently -- including the C implementation on which this is based -- state that the question-mark matching is "greedy" but yet I see non-greedy behavior as illustrated in the following repo I threw together to demonstrate.

https://github.com/robmuh/peg-not-greedy

I am just curious if this was intentional. There are plenty of ways to get around this, but it might be worth mentioning in the main README that this behavior is directly opposite what someone coming from peg/leg might expect. That is, if I'm seeing everything correctly. Thanks.