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
I've stripped down my example to the following grammar, expressed in English: source text can contain multiple items separated by newline or comment (double slash //), each item is identifier followed by whitespace-separated numbers.
Parse error at 6
Unexpected `2`
Unexpected `/`
Expected `whitespace`, `digit` or `newline`
Parse error at 5
Unexpected ` `
Expected `letter`
Parse error at 6
Unexpected `2`
Unexpected `/`
Expected `whitespace` or `newline`
Note in variant 1:
Two unexpected's, / is at wrong position, 2 is not the erroneous character. Looks like a bug?
Position is the position of the character after the erroneous one
Expected digit is wrong. There needs to be whitespace between (or newline, or comment which is silenced)
Note in variant 2:
Unexpected space is at a different position.
Erroneous position is (surprisingly) right
letter can't be here, note that even if I remove the outermost many (i.e. only support single item, so there are no letters possible after initial whitespace), this parser also reports letter.
Note in variant 3:
Same issues as with "variant 1" for position and "unexpected"s
"expected" set is fine
Are there any bugs, or am I misunderstanding parsers somehow? Also why there is such a difference between sep_by, repeat_until and many?
The text was updated successfully, but these errors were encountered:
I've stripped down my example to the following grammar, expressed in English: source text can contain multiple items separated by newline or comment (double slash
//
), each item is identifier followed by whitespace-separated numbers.Here are tree versions of a grammar:
The output is:
Note in variant 1:
/
is at wrong position,2
is not the erroneous character. Looks like a bug?digit
is wrong. There needs to be whitespace between (or newline, or comment which is silenced)Note in variant 2:
letter
can't be here, note that even if I remove the outermostmany
(i.e. only support single item, so there are no letters possible after initial whitespace), this parser also reportsletter
.Note in variant 3:
Are there any bugs, or am I misunderstanding parsers somehow? Also why there is such a difference between
sep_by
,repeat_until
andmany
?The text was updated successfully, but these errors were encountered: