Search in sources :

Example 11 with TokenRewriteStream

use of org.antlr.runtime.TokenRewriteStream in project hive by apache.

the class ParseDriver method parseTriggerActionExpression.

public ASTNode parseTriggerActionExpression(String command) throws ParseException {
    HiveLexerX lexer = new HiveLexerX(new ANTLRNoCaseStringStream(command));
    TokenRewriteStream tokens = new TokenRewriteStream(lexer);
    HiveParser parser = new HiveParser(tokens);
    parser.setTreeAdaptor(adaptor);
    HiveParser_ResourcePlanParser.triggerActionExpressionStandalone_return r = null;
    try {
        r = parser.gResourcePlanParser.triggerActionExpressionStandalone();
    } catch (RecognitionException e) {
        e.printStackTrace();
        throw new ParseException(parser.errors);
    }
    if (lexer.getErrors().size() != 0) {
        throw new ParseException(lexer.getErrors());
    } else if (parser.errors.size() != 0) {
        throw new ParseException(parser.errors);
    }
    return r.getTree();
}
Also used : TokenRewriteStream(org.antlr.runtime.TokenRewriteStream) RecognitionException(org.antlr.runtime.RecognitionException)

Aggregations

TokenRewriteStream (org.antlr.runtime.TokenRewriteStream)11 RecognitionException (org.antlr.runtime.RecognitionException)7 CeylonLexer (com.redhat.ceylon.compiler.typechecker.parser.CeylonLexer)2 CeylonParser (com.redhat.ceylon.compiler.typechecker.parser.CeylonParser)2 Tree (com.redhat.ceylon.compiler.typechecker.tree.Tree)2 ANTLRFileStream (org.antlr.runtime.ANTLRFileStream)2 ImportModule (com.redhat.ceylon.compiler.typechecker.tree.Tree.ImportModule)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 PrintStream (java.io.PrintStream)1 AccessControlException (java.security.AccessControlException)1 PatternSyntaxException (java.util.regex.PatternSyntaxException)1 Path (org.apache.hadoop.fs.Path)1 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)1 LockException (org.apache.hadoop.hive.ql.lockmgr.LockException)1 HiveException (org.apache.hadoop.hive.ql.metadata.HiveException)1 InvalidTableException (org.apache.hadoop.hive.ql.metadata.InvalidTableException)1 CalciteSemanticException (org.apache.hadoop.hive.ql.optimizer.calcite.CalciteSemanticException)1 ASTNode (org.apache.hadoop.hive.ql.parse.ASTNode)1