[antlr-interest] Debugging tree parser antlr 2.7.5
Xue Yong Zhi
zhixueyong at hotmail.com
Mon Jan 22 08:44:18 PST 2007
>
> <AST>:0:0: unexpected end of subtree
>
> How do I debug this? I have added genHashLines = true; to both
> the regular parser as well as the tree parser, however I still get
> <AST>:0:0
> How can I pinpoint the exact location where the problem is?
The default AST node does not store line information. You can try to
replace it with the follwoing:
http://xruby.googlecode.com/svn/trunk/src/com/xruby/compiler/parser/ASTWithLineNumber.java
Then in your parser, call this:
setASTNodeClass("com.xruby.compiler.parser.ASTWithLineNumber");
Btw, println is helpful for debugging, as always:)
AST ast = parser.getAST();
System.out.println(ast.toStringList());
More information about the antlr-interest
mailing list