[antlr-interest] C Target - Assigning rule info to imaginary tokens

A Z asicaddress at gmail.com
Tue May 10 07:14:38 PDT 2011


Hello all,

  I have a case where I need to assign an imaginary token the attributes of
a token inside a rule. I tried the below but as expected it does not have
the desired effect.


var_or_function :
  identifier
  (
    LPARAN arg_list RPARAN
      -> ^(I_FUNC[identifier] arg_list)
  |
      -> I_UNKN[identifier]
  );

identifier :
    SIMPLE_IDENT
  | ESCAPED_IDENT;


Is there any way to do this without merging the two lexer rules into one
token?

Thanks.


More information about the antlr-interest mailing list