Hello,

I would like to add file+line+column information to code generatedfrom an
AST tree.

IE:

// in lexer
statement:
    :    'for' '(' start=expression? ';' cond=expression? ';'
next=expression? ')' body=statement
        -> ^('for' $cond $next $body $start )
    ...
    ;

// in tree
statement
    :    ^('for' cond=continuation step=continuation body=continuation
expression)    { AppendOp(Operation::ForLoop); }
    ...
    ;

My question is, how can I access file, line and column information for
tokens used by the tree parser? in the example above, how can I access the
location of the 'for' token used in the tree grammar to pass to the
AppendOp() function?

Similarly, I'd like to add debug (file+line+column) info for all generated
objects.

Thanks in advance,
Christian.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-interest@googlegroups.com
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

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

Reply via email to