String source = document.get();
CharStream stream =
new NoCaseStringStream(source);
ToolSQLLexer lexer = new ToolSQLLexer(stream);
TokenStream tokens = new CommonTokenStream(lexer);
ForteParser parser = new ForteParser(tokens);
// parser.setErrorReporter(this);
parser.setTreeAdaptor(new CommonTreeAdaptor(){
public Object create(Token payload){
return new CommonTree(payload);
}
});
cursorDeclaration_return result = parser.cursorDeclaration();
if (parser.getNumberOfSyntaxErrors() > 0){
ToolModelActivator.showError(parser.getNumberOfSyntaxErrors() + " Syntax error in cursor " + getFile().getName() + "\n"
+ this.parseErrors.toString(), null);
} else {
CommonTree tree = (CommonTree) result.getTree();
System.out.println(tree.toStringTree());
CommonTreeNodeStream nodes = new CommonTreeNodeStream(tree);