[antlr-interest] Re: Line number
micheal_jor <open.zone at virgin.net>
open.zone at virgin.net
Thu Jan 30 00:30:39 PST 2003
> Hi all,
>
> I have seen a lot of post regarding about display the line number
in the
> AST vew. However, there is no clear and example of how to do it. I
am
> currently using antlr 2-7.2.
> Could you please let me know how to get it done. Thanks.
>
> Regards,
> MiMi
If you are using Java or C# and, if by "AST view" you mean the
ASTFrame mechanism for viewing your ASTs then you can do the
following:
1. Create a subclass of the appropriate standard Common***AST class
(if you haven't already)
2. Override toString()/ToString() to print line numbers as well
3. Instruct your parser to use your new AST class with
parser.setASTNodeType(string) or by using the "ASTLableType" option
in your grammar.
Run your app as usual ;-)
Micheal
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list