[antlr-interest] Re: Line number information
Eric Mahurin
eric_mahurin at yahoo.com
Wed Aug 11 17:40:01 PDT 2004
It looks like the generated code makes AST nodes by calling the
initialize method using a Token. I'm not sure why the other
initialize/constructor methods are even there as they aren't as
flexible. You should be able to just make an AST class that either a)
subclasses CommonAST, add line/column ints, and have initialize set
those, or b) subclass BaseAST and put a whole token in there.
You'll find multiple examples of overriding the default AST in the
antlr examples directories.
--- In antlr-interest at yahoogroups.com, "npettersson" <plsk_9 at h...> wrote:
> Hi
>
> I'm a new user of ANTLR and have been working with it for a few month
> now.
>
> I've been parsing C#-code and generating AST's but I don't know how to
> get the row numbers included as nodes in the AST?
>
> Can someone show me a simple example on how to do this?
>
> kind regards/ Niklas
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list