Reputation: 31
I have a scannerless security markings conversion grammar that generates code correctly and runs fine using antlr-4.4-complete.jar. But when I upgrade to antlr4-4.6-complete.jar or newer, code generation fails with "error(50): <.g4 file path>::: syntax error: mismatched character ':' expecting '{'" and other errors.
What changed in ANTLR v4.6 (or possibly v4.5 as I haven't tried that version) that would cause its lexer to err on grammars recognized by v4.4?
Sorry I can't provide a grammar snippit here, but access to the code is restricted.
Upvotes: 0
Views: 147
Reputation: 31
Turns out newer versions of ANTLR (v4.5 and beyond) will choke on lexing a user-defined rule named channels containing a semantic predicate. ANTLR v4.4 was perfectly happy to lex, parse and generate valid Java code for same. I changed my rule name to channelz, and the grammar now produces code with all ANTLR versions through the 4.9.3 snapshot. Unfortunately, the parser code generated by ANTLR v4.7 and beyond contains numerous other errors which are still to be addressed.
Upvotes: 1
Reputation: 170138
You can view the changes by opening the page https://github.com/antlr/antlr4/releases/tag/VERSION
, where VERSION
is the version number you're interested in.
So for 4.5
that'd be: https://github.com/antlr/antlr4/releases/tag/4.5
Upvotes: 0