You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue is correct the example grammar does allow every ident after the first to start with a digit. The text above the example in the REAME says as much (both Today and in Oct 2021).
The following is an example of a grammar for a list of alpha-numeric identifiers where the first identifier does not start with a digit:
So I believe this issue may be closed with wont-fix.
However, I don't think the confusion is unwarranted, I can not think of a time I wanted an "identifier list but the first identifier is not like the others." Looking at git blame I can see at some point in the past the example matched the suggested grammar.
I also recall discovering https://pest.rs, copying the example into the Editor, and feeling confused as to why a _ did not return an error while _ does. After reading the book I understand it's the lack of any EOI requirement.
Also, if we are switching things around like this then
ident_list = _{ ident ~ (" " ~ ident)+ }
should be
ident_list = _{ ident ~ (" " ~ ident)* }
^
If there is interest in updating the example I would be willing to create a draft PR. Otherwise, I think this issue should be closed.
The current example grammar will allow for every
ident
after the first to start with adigit
.For instance
"a1 2b"
is a validident_list
with the current grammar.Wouldn't this make sense for the ident rule?
I'm new to PEG style grammars so maybe I'm wrong?
The text was updated successfully, but these errors were encountered: