[antlr-interest] Several different tokens for the same literal

Christian chwchw at gmx.de
Thu Oct 27 05:04:11 PDT 2011


Does nobody know a solution other than the one with rewrite rules?

Am 26.10.2011 12:43, schrieb Christian:
> Hi community,
>
> I want to use, e.g., the MINUS and the POSITIVE token for the '-'
> literal. Is there a way to write it shorter than with rewrite rules?
>
> For example, I want to replace the following
>     '-' unary_expression -> ^(NEGATIVE unary_expression);
> by
>     '-'<NEGATIVE> unary_expression;
> or
>     NEGATIVE['-'] unary_expression;
>
> I know that and why the last two aproaches do not work. But perhaps
> there is another way that I do not know so far.
>
> 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