static CommonTree parseDqlToAbstractSytntaxTree(String dql) throws RecognitionException {
ANTLRStringStream input = new ANTLRStringStream(dql);
DqlLexer lexer = new DqlLexer(input);
TokenStream tokens = new CommonTokenStream(lexer);
DqlParser parser = new DqlParser(tokens) {
@Override
public void emitErrorMessage(String msg) {
throw new DqlParseException(msg);
}
};
final TreeAdaptor adaptor = new CommonTreeAdaptor() {
@Override
public Object create(Token payload) {
return new CommonTree(payload);
}
};
parser.setTreeAdaptor(adaptor);
DqlParser.criterion_return ret = parser.criterion();
CommonTree tree = (CommonTree) ret.getTree();
return tree;
}