[antlr-interest] Reading rule modifiers from common tree
Matt Palmer
mattpalms at gmail.com
Wed Jul 14 12:51:21 PDT 2010
Selim,
I may have misunderstood your problem, but fragment rules don't form tokens
in the output. They are just convenient patterns to re-use in other, actual
tokens.
Regards,
Matt
On 14 July 2010 17:28, Selim Ciraci <ciraci at gmail.com> wrote:
> 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
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
More information about the antlr-interest
mailing list