-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ab]* 'a' couldn't derive 'aaa' #105
Comments
Related: #57.
|
The grammar actually means greedy matching in my case. pegjs will have to try alternative matches in order to derive the input, much like how regexp works: when |
@gravof: or you can rewrite it like I showed in my first comment. |
Oh, thanks. went directly to the related issue, didn't pay much attention to the grammar you suggested. It works. However, will nested repetition cause trouble? After seeing #26, I try to stay away from such pattern. |
Probably related:
couldn't derive |
Greedy matching is how PEGs work. They are not regexes. :) |
Contrary to regular expressions, Closing this issue since the described behavior is not a bug. |
I don't really know how pegjs works, but I guess the reason might be that the three
'a'
s are matched first and whenEOF
is encountered, the last'a'
in the grammar is unmatched and thus causing the failure?If trying alternatives is expensive and won't be implemented, is there any way to workaround it when such grammar is needed?
The text was updated successfully, but these errors were encountered: