Search in sources :

Example 76 with NoViableAltException

use of antlr.NoViableAltException in project ili2db by claeis.

the class SqlSyntax method statement.

public final SqlStmt statement() throws RecognitionException, TokenStreamException {
    SqlStmt c;
    c = new SqlStmt();
    switch(LA(1)) {
        case LITERAL_DELETE:
            {
                delete_statement();
                break;
            }
        case LITERAL_INSERT:
            {
                c = insert_statement();
                break;
            }
        case LITERAL_SELECT:
            {
                c = select_statement();
                break;
            }
        case LITERAL_UPDATE:
            {
                c = update_statement_ce();
                break;
            }
        default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
    }
    return c;
}
Also used : NoViableAltException(antlr.NoViableAltException)

Example 77 with NoViableAltException

use of antlr.NoViableAltException in project ili2db by claeis.

the class SqlSyntax method primary.

public final void primary() throws RecognitionException, TokenStreamException {
    if ((LA(1) == LPAREN)) {
        match(LPAREN);
        expression();
        match(RPAREN);
    } else if ((LA(1) == NAME)) {
        columnname();
    } else if ((LA(1) == NUMBER || LA(1) == STRING || LA(1) == LITERAL_DATE)) {
        literal();
    } else if ((LA(1) == NAME)) {
        function();
    } else if ((LA(1) == LPAREN)) {
        match(LPAREN);
        sub_query();
        match(RPAREN);
    } else if ((LA(1) == QUESTION)) {
        match(QUESTION);
    } else {
        throw new NoViableAltException(LT(1), getFilename());
    }
}
Also used : NoViableAltException(antlr.NoViableAltException)

Example 78 with NoViableAltException

use of antlr.NoViableAltException in project ili2db by claeis.

the class SqlSyntax method update_statement_ce.

public final UpdateStmt update_statement_ce() throws RecognitionException, TokenStreamException {
    UpdateStmt stmt;
    Token t = null;
    Token c0 = null;
    Token c1 = null;
    Token w0 = null;
    Token w1 = null;
    stmt = new UpdateStmt();
    List f = null;
    int paramIdx = 0;
    match(LITERAL_UPDATE);
    t = LT(1);
    match(NAME);
    stmt.setTableName(t.getText());
    match(LITERAL_SET);
    c0 = LT(1);
    match(NAME);
    match(EQUALS);
    match(QUESTION);
    stmt.addSet(new ColRef(c0.getText()), new Param(paramIdx++));
    {
        _loop38: do {
            if ((LA(1) == COMMA)) {
                match(COMMA);
                c1 = LT(1);
                match(NAME);
                match(EQUALS);
                match(QUESTION);
                stmt.addSet(new ColRef(c1.getText()), new Param(paramIdx++));
            } else {
                break _loop38;
            }
        } while (true);
    }
    {
        if ((LA(1) == LITERAL_WHERE)) {
            match(LITERAL_WHERE);
            w0 = LT(1);
            match(NAME);
            match(EQUALS);
            match(QUESTION);
            stmt.addCond(new ColRef(w0.getText()), new Param(paramIdx++));
            {
                _loop41: do {
                    if ((LA(1) == LITERAL_AND)) {
                        match(LITERAL_AND);
                        w1 = LT(1);
                        match(NAME);
                        match(EQUALS);
                        match(QUESTION);
                        stmt.addCond(new ColRef(w1.getText()), new Param(paramIdx++));
                    } else {
                        break _loop41;
                    }
                } while (true);
            }
        } else if ((LA(1) == EOF)) {
        } else {
            throw new NoViableAltException(LT(1), getFilename());
        }
    }
    return stmt;
}
Also used : NoViableAltException(antlr.NoViableAltException) Token(antlr.Token)

Example 79 with NoViableAltException

use of antlr.NoViableAltException in project ili2db by claeis.

the class SqlSyntax method exact_numeric_type.

public final void exact_numeric_type() throws RecognitionException, TokenStreamException {
    switch(LA(1)) {
        case LITERAL_INTEGER:
            {
                match(LITERAL_INTEGER);
                break;
            }
        case LITERAL_INT:
            {
                match(LITERAL_INT);
                break;
            }
        case LITERAL_SMALLINT:
            {
                match(LITERAL_SMALLINT);
                break;
            }
        case LITERAL_NUMERIC:
            {
                {
                    match(LITERAL_NUMERIC);
                    match(LPAREN);
                    precision();
                    {
                        if ((LA(1) == COMMA)) {
                            match(COMMA);
                            scale();
                        } else if ((LA(1) == RPAREN)) {
                        } else {
                            throw new NoViableAltException(LT(1), getFilename());
                        }
                    }
                    match(RPAREN);
                }
                break;
            }
        case LITERAL_DECIMAL:
            {
                {
                    match(LITERAL_DECIMAL);
                    match(LPAREN);
                    precision();
                    {
                        if ((LA(1) == COMMA)) {
                            match(COMMA);
                            scale();
                        } else if ((LA(1) == RPAREN)) {
                        } else {
                            throw new NoViableAltException(LT(1), getFilename());
                        }
                    }
                    match(RPAREN);
                }
                break;
            }
        default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
    }
}
Also used : NoViableAltException(antlr.NoViableAltException)

Example 80 with NoViableAltException

use of antlr.NoViableAltException in project cxf by apache.

the class IDLParser method constr_forward_decl.

public final void constr_forward_decl() throws RecognitionException, TokenStreamException {
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST constr_forward_decl_AST = null;
    try {
        // for error handling
        switch(LA(1)) {
            case LITERAL_struct:
                {
                    AST tmp129_AST = null;
                    tmp129_AST = astFactory.create(LT(1));
                    astFactory.makeASTRoot(currentAST, tmp129_AST);
                    match(LITERAL_struct);
                    identifier();
                    astFactory.addASTChild(currentAST, returnAST);
                    constr_forward_decl_AST = (AST) currentAST.root;
                    break;
                }
            case LITERAL_union:
                {
                    AST tmp130_AST = null;
                    tmp130_AST = astFactory.create(LT(1));
                    astFactory.makeASTRoot(currentAST, tmp130_AST);
                    match(LITERAL_union);
                    identifier();
                    astFactory.addASTChild(currentAST, returnAST);
                    constr_forward_decl_AST = (AST) currentAST.root;
                    break;
                }
            default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
        }
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            consume();
            consumeUntil(_tokenSet_10);
        } else {
            throw ex;
        }
    }
    returnAST = constr_forward_decl_AST;
}
Also used : ASTPair(antlr.ASTPair) AST(antlr.collections.AST) NoViableAltException(antlr.NoViableAltException) RecognitionException(antlr.RecognitionException)

Aggregations

NoViableAltException (antlr.NoViableAltException)132 RecognitionException (antlr.RecognitionException)114 ASTPair (antlr.ASTPair)68 AST (antlr.collections.AST)68 Token (antlr.Token)33 MismatchedCharException (antlr.MismatchedCharException)2 MismatchedTokenException (antlr.MismatchedTokenException)2 NoViableAltForCharException (antlr.NoViableAltForCharException)2 Message (org.codehaus.groovy.control.messages.Message)2 SimpleMessage (org.codehaus.groovy.control.messages.SimpleMessage)2 SyntaxErrorMessage (org.codehaus.groovy.control.messages.SyntaxErrorMessage)2