[antlr-interest] Line number information for Tree Parser exceptions

veekook virantha at yahoo.com
Tue Sep 30 14:03:41 PDT 2003


Is there any way to augment exceptions thrown by the tree parser (eg 
MismatchedTokenException) to maintain line numbers?  I've subclassed 
CommonAST to include line numbers in my AST, but is there a method 
for getting at the line numbers for an offending rule from a catch 
block embedded in a tree grammar rule?  The following doesn't work 
because tree exceptions don't track line numbers.

rule: #(A B C) { ... }
exception
catch [antlr::MismatchedTokenException& ex] {
		cout << "Expecting blah on line" << ex.getLine();
}
}	



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list