[antlr-interest] How do you Output a String Literal?
titech at metaorb.com
titech at metaorb.com
Fri Aug 22 15:20:35 PDT 2008
I don't think I've seen the [] syntax.
My parser grammer looks like this:
convolution: name tapset+ -> ^(CONVOLUTION name tapset+);
...
CONVOLUTION: 'convolution';
The
only reason I made a token of the 'convolution' literal was to
facilitate the imaginary node output. I get an error if I use the
literal in the AST rule, unless the literal is also used in the parser
rule (which seems odd..).
Thanks again,
--Mike
----- Original Message ----
From: Johannes Luber <jaluber at gmx.de>
To: "titech at metaorb.com" <titech at metaorb.com>
Cc: antlr-interest at antlr.org
Sent: Friday, August 22, 2008 5:15:51 PM
Subject: Re: [antlr-interest] How do you Output a String Literal?
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