[antlr-interest] newline() -> parser
Kaleb Pederson
kibab at icehouse.net
Fri Jun 25 14:58:11 PDT 2004
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
<*> 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