[antlr-interest] Return values for fragment lexer rules

Christian chwchw at gmx.de
Sat Jan 14 05:23:43 PST 2012


I now use an extended version of CommonToken that additionally contains
a member result. In this way, I can save the result of a Token. However,
I have to set it somehow. How can I access the current token within
action code? I would like to have something like the following:

fragment Pp_expression
  : WHITESPACE? expr=Pp_or_expression WHITESPACE?
    {$this.result = $expr.result;}
  ;

Regards,
Christian

Am 13.01.2012 12:38, schrieb Christian:
> Hello community,
>
> is it right that even fragment lexer rules cannot return any value? The
> CommonToken does not provide any access to such a value.
>
> Regards,
> Christian
>
> 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