[antlr-interest] Solved: Java.g4 bug? Attrib refs in lexer action
Graham Wideman
gwlist at grahamwideman.com
Thu Oct 4 00:47:55 PDT 2012
Hi Ter and all:
Regarding the bug I posted earlier, evidently ANTLR 4 requires different syntax for the attribute references in lexer actions.
In Java.g4:
----------
Change:
----------
ENUM: 'enum' {if (!enumIsKeyword) $type=Identifier;}
;
ASSERT
: 'assert' {if (!assertIsKeyword) $type=Identifier;}
;
----------
To:
----------
ENUM: 'enum' {if (!enumIsKeyword) setType(Identifier);}
;
ASSERT
: 'assert' {if (!assertIsKeyword) setType(Identifier);}
;
----------
This might apply starting only with ANTLR4.0b2, since the earlier email thread "Bug in antlr4" discussing a different problem with Java.g4 didn't mention the problem described above.
-- Graham
More information about the antlr-interest
mailing list