[antlr-interest] Reading rule modifiers from common tree

Selim Ciraci ciraci at gmail.com
Wed Jul 14 09:28:12 PDT 2010


Hi all,

I'm trying to write a program to parse a grammar file, modify it and write
it back as a grammar file. For this I use the builtin parser:
org.antlr.grammar.v3.ANTLRv3Lexer, org.antlr.grammar.v3.ANTLRv3Parser.
Everything seems to work ok but somehow the modifier of a rule is not
visible from the rule node.
For example: I have the following rule: fragment A:('a'|'A');

When I do a toStringTree() on the rule node I get the following output
(RULE A (BLOCK (ALT (BLOCK (ALT 'a' EOA) (ALT 'A' EOA) EOB) EOA) EOB) EOR)

somehow the fragment is missing and I cannot access the modifier of the
rule. is there something I'm doing wrong here? if so how can I access the
modifier?

With kind regards,
Selim Ciraci


More information about the antlr-interest mailing list