Search in sources :

Example 1 with Windowing2Parser

use of com.sap.hadoop.windowing.parser.Windowing2Parser in project SQLWindowing by hbutani.

the class WindowingShell method checkQuery.

public void checkQuery(String query) throws WindowingException {
    Windowing2Lexer lexer;
    CommonTokenStream tokens;
    Windowing2Parser parser = null;
    @SuppressWarnings("unused") CommonTree t;
    //		CommonTreeNodeStream nodes;
    String err;
    try {
        lexer = new Windowing2Lexer(new ANTLRStringStream(query));
        tokens = new CommonTokenStream(lexer);
        parser = new Windowing2Parser(tokens);
        parser.setTreeAdaptor(TranslateUtils.adaptor);
        t = (CommonTree) parser.query().getTree();
        err = parser.getWindowingParseErrors();
        if (err != null) {
            throw new WindowingException(err);
        }
    } catch (Throwable te) {
        err = parser.getWindowingParseErrors();
        if (err != null) {
            throw new WindowingException(err);
        }
        throw new WindowingException("Parse Error:" + te.toString(), te);
    }
}
Also used : Windowing2Lexer(com.sap.hadoop.windowing.parser.Windowing2Lexer) ANTLRStringStream(org.antlr.runtime.ANTLRStringStream) CommonTokenStream(org.antlr.runtime.CommonTokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) Windowing2Parser(com.sap.hadoop.windowing.parser.Windowing2Parser) WindowingException(com.sap.hadoop.windowing.WindowingException)

Aggregations

WindowingException (com.sap.hadoop.windowing.WindowingException)1 Windowing2Lexer (com.sap.hadoop.windowing.parser.Windowing2Lexer)1 Windowing2Parser (com.sap.hadoop.windowing.parser.Windowing2Parser)1 ANTLRStringStream (org.antlr.runtime.ANTLRStringStream)1 CommonTokenStream (org.antlr.runtime.CommonTokenStream)1 CommonTree (org.antlr.runtime.tree.CommonTree)1