While looking for a more robust test for the CDTParser, particularly a C++ one, I downloaded one and used the fparser(stand-alone) utiltity to check it out to see what sort of a DOM it created. To my surprise it aborted the parser inside the CDTParser code. The following stacktrace was produced: Exception in thread "main" java.lang.NullPointerException at org.eclipse.cdt.internal.core.parser.Parser.failParse(Parser.java:283) at org.eclipse.cdt.internal.core.parser.Parser.failParseWithErrorHandling(Parser.java:3112) at org.eclipse.cdt.internal.core.parser.Parser.translationUnit(Parser.java:3059) at org.eclipse.cdt.internal.core.parser.Parser.parse(Parser.java:2970) at frysk.dom.cparser.CDTParser.parse(CDTParser.java:176) at fparser.main(fparser.java:199) I will attach the file that caused the abort in an attachment.
Created attachment 1579 [details] test c++ file that causes the problem compile with "g++ -g -o test_cpp" and run fparser on the executable.
Fixed in Parser.java. It now checks for a null LA(1) class before attempting to access any of its methods.