[antlr-interest] How do you Output a String Literal?

Johannes Luber jaluber at gmx.de
Fri Aug 22 15:15:51 PDT 2008


titech at metaorb.com schrieb:
> I'm trying to output a string literal based on an imaginary token in an AST.
> 
> If I use "$TOKEN.text", I get the expected string literal for tokens used in the parser rule, but for imaginary tokens, I just get the token (e.g. all caps).
> 
> Is there a way to get the string literal (or the matched text) back from the token?
> 
> Thanks,
> --Mike

Do you create imaginary tokens like this?

IMAGINARY[REAL]

With that syntax the
IMAGINARY token receives all attributes of the REAL token.

Johannes
> 
> 
> Mike Allbright
> DLP Products
> Texas Instruments,
> Inc.
> 
> 
> 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