[antlr-interest] newline() -> parser
Monty Zukowski
monty at codetransform.com
Fri Jun 25 15:03:14 PDT 2004
What AST class are you using for your AST factory?
Monty
On Jun 25, 2004, at 2:58 PM, Kaleb Pederson wrote:
> I'm successfully calling newline in my lexer actions, and my lines and
> columns
> are getting correctly set.
>
> However, I want all the token information available to me in the
> parser. When
> I call getLine() or getColumn(), I get 0 and 0 returned.
>
> My basic structure is as follows (Java):
>
> // run
> parser.goal();
> // get AST
> antlr.CommonAST ast = (antlr.CommonAST)parser.getAST();
>
> // perform semantic analysis
> Semant sem = new Semant(ast);
> if (sem.validate()) {
> // valid
> }
> ...
>
> The getLine and getColumn never return anything useful to my validate
> function, so I'm having a hard time getting good error information.
> I'm
> calling them as follows:
>
> System.out.println("Undefined symbol " + name + " at " +
> ((CommonAST)undefinedSymbols.get(name)).getLine() + ":" +
> ((CommonAST)undefinedSymbols.get(name)).getColumn());
>
> undefinedSymbols contains a HashMap of names to AST Nodes.
>
> What do I need to do to get the error information in the Lexer's token
> object
> to carry down to the token available in the AST?
>
> Thanks.
>
> --Kaleb
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit --
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html
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