[antlr-interest] Token as rule argument

Christian chwchw at gmx.de
Mon Nov 7 14:22:22 PST 2011


Hello,

is it possible to give a rule a token as parameter and duplicate it in
the rule's rewrite rule? To illustrate my purpose:

    t=type     typed_class_member_decl[$t]

where

    typed_class_member_decl[Token t]
      : variable_declarator (','   variable_declarator)* -> ($t
variable_declarator)+
      ;

For me, it is important that the type Token is programming
language-independent, i.e., ANTLR should be able to generate every
target language code without errors and adaptions.

Best Regards,
Christian


More information about the antlr-interest mailing list