Skip to content
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

<<EOF>> is silently accepted but generates a parser with compile errors #242

Closed
nthykier opened this issue Jul 13, 2020 · 0 comments
Closed

Comments

@nthykier
Copy link

Writing a grammar with the token <<EOF>> (instead of <<eof>>) is accepted without any hints of issues by the parser generator. It results in a grammar file referencing a non-existing method called EOF (instead of eof).

I would recommend that the IDEA editor would highlight this as a "likely mistake" with a suggestion to lowercase it to the expected value. I find this particular relevant as the JFlex lexer expects <<EOF>> in all caps meaning the two related languages disagree on the casing.

In the concrete case, I had:

rule ::= subrule (TOKEN_A* subrule)* TOKEN_A* (TOKEN_B|<<EOF>>)

Which should have been:

rule ::= subrule (TOKEN_A* subrule)* TOKEN_A* (TOKEN_B|<<eof>>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants