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
For a grammar like below, the expected input is "a b c d e f". And if I the input is like "a b c", the parser will tell me if failed to parse "rule" with the cursor pointing at column 1.
However, it would be better if it tell me it failed to find the "d" in rule2, and point the cursor at column 5.
rule = _ rule1 _ rule2 _ rule3 _ eof
rule1 = _ "a" _ "b" _
rule2 = _ "c" _ "d" _
rule3 = _ "e" _ "f" _
_ = [ \t\r\n]*
eof = !.
A workaround for now would be write the rule like this, but it can explode when the grammar is more complicated.
rule = _ rule1 _ rule2 _ rule3 _ eof
rule1 = _ ("a"/#error{"Expect a"} _ ("b"/#error{"Expect b"} _
...
The text was updated successfully, but these errors were encountered:
Just a minor supplement.
If rule2 changed to _ "c" _ ("d")* _, then there can be multiple candidate token after "c". i.e., given the input "a b c", the return the error message is something like "Expect 'd' or 'e' at line 1 column 5".
For a grammar like below, the expected input is "a b c d e f". And if I the input is like "a b c", the parser will tell me if failed to parse "rule" with the cursor pointing at column 1.
However, it would be better if it tell me it failed to find the "d" in rule2, and point the cursor at column 5.
rule = _ rule1 _ rule2 _ rule3 _ eof
rule1 = _ "a" _ "b" _
rule2 = _ "c" _ "d" _
rule3 = _ "e" _ "f" _
_ = [ \t\r\n]*
eof = !.
A workaround for now would be write the rule like this, but it can explode when the grammar is more complicated.
rule = _ rule1 _ rule2 _ rule3 _ eof
rule1 = _ ("a"/#error{"Expect a"} _ ("b"/#error{"Expect b"} _
...
The text was updated successfully, but these errors were encountered: