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 command node test.js 'level1' runs without errors and prints EOF.
We should expect node test.js 'level1: level2' to print EOF twice, but it prints this instead:
EOF
Parse error on line 1:
level1: level2
--------------^
Expecting 'EOF', got '1'
The reason is that the EOF token is returned only once, at the nested level. After that, the 1 token (the parser value for end-of-file) is returned. Unfortunately, we cannot reference this special token from the grammar, which makes it impossible to parse this particular language. :(
To fix it, I believe the $ (or equivalent <<EOF>>) rule should get picked up indefinitely while matching the end of file. Or else provide a way to reference the 1 token directly in the grammar.
The text was updated successfully, but these errors were encountered:
I have the following grammar:
This is the test script:
The command
node test.js 'level1'
runs without errors and printsEOF
.We should expect
node test.js 'level1: level2'
to printEOF
twice, but it prints this instead:The reason is that the
EOF
token is returned only once, at the nested level. After that, the1
token (the parser value for end-of-file) is returned. Unfortunately, we cannot reference this special token from the grammar, which makes it impossible to parse this particular language. :(To fix it, I believe the
$
(or equivalent<<EOF>>
) rule should get picked up indefinitely while matching the end of file. Or else provide a way to reference the1
token directly in the grammar.The text was updated successfully, but these errors were encountered: