[antlr-interest] [C target] [3.1.1] Deriving imaginary nodes from real tokens

Jim Idle jimi at temporal-wave.com
Thu Dec 11 08:25:34 PST 2008


On Thu, 2008-12-11 at 15:17 +0100, Sven Van Echelpoel wrote:

> Hi,
> 
> According to the book you can derive imaginary nodes from real tokens to
> take over attributes (such as line number) from the latter. The syntax
> for this is :
> 
> foo : b='bar' -> ^( BAR[ $b ] )
>     ;
> 
> However, when you do this with the C target, no line numbers or anything
> gets set. After some sleuthing I found the templates in AST.stg that

...

> 
> It can be made to work by passing the second argument (the text), even
> though I have no use for that.
> 
> foo : b='bar' -> ^( BAR[ $b, "" ] )
>     ;
> 
> Am I missing something, or should that normally work as advertised? 
> 

I'll take a look - does that snippet of code above reproduce it? What
options {} have you got set etc? If you have the time, then a small, but
complete, grammar would be helpful :-)

Jim

> Sven
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081211/8756609c/attachment.html 


More information about the antlr-interest mailing list