Search in sources :

Example 56 with RecognitionException

use of antlr.RecognitionException in project cxf by apache.

the class IDLParser method unary_expr.

public final void unary_expr() throws RecognitionException, TokenStreamException {
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST unary_expr_AST = null;
    try {
        // for error handling
        switch(LA(1)) {
            case PLUS:
            case MINUS:
            case TILDE:
                {
                    {
                        switch(LA(1)) {
                            case MINUS:
                                {
                                    AST tmp102_AST = null;
                                    tmp102_AST = astFactory.create(LT(1));
                                    astFactory.makeASTRoot(currentAST, tmp102_AST);
                                    match(MINUS);
                                    break;
                                }
                            case PLUS:
                                {
                                    AST tmp103_AST = null;
                                    tmp103_AST = astFactory.create(LT(1));
                                    astFactory.makeASTRoot(currentAST, tmp103_AST);
                                    match(PLUS);
                                    break;
                                }
                            case TILDE:
                                {
                                    AST tmp104_AST = null;
                                    tmp104_AST = astFactory.create(LT(1));
                                    astFactory.makeASTRoot(currentAST, tmp104_AST);
                                    match(TILDE);
                                    break;
                                }
                            default:
                                {
                                    throw new NoViableAltException(LT(1), getFilename());
                                }
                        }
                    }
                    primary_expr();
                    astFactory.addASTChild(currentAST, returnAST);
                    unary_expr_AST = (AST) currentAST.root;
                    break;
                }
            case SCOPEOP:
            case IDENT:
            case LPAREN:
            case LITERAL_TRUE:
            case LITERAL_FALSE:
            case INT:
            case OCTAL:
            case HEX:
            case STRING_LITERAL:
            case WIDE_STRING_LITERAL:
            case CHAR_LITERAL:
            case WIDE_CHAR_LITERAL:
            case FIXED:
            case FLOAT:
                {
                    primary_expr();
                    astFactory.addASTChild(currentAST, returnAST);
                    unary_expr_AST = (AST) currentAST.root;
                    break;
                }
            default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
        }
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            consume();
            consumeUntil(_tokenSet_42);
        } else {
            throw ex;
        }
    }
    returnAST = unary_expr_AST;
}
Also used : ASTPair(antlr.ASTPair) AST(antlr.collections.AST) NoViableAltException(antlr.NoViableAltException) RecognitionException(antlr.RecognitionException)

Example 57 with RecognitionException

use of antlr.RecognitionException in project cxf by apache.

the class IDLParser method primary_expr.

public final void primary_expr() throws RecognitionException, TokenStreamException {
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST primary_expr_AST = null;
    try {
        // for error handling
        switch(LA(1)) {
            case SCOPEOP:
            case IDENT:
                {
                    scoped_name();
                    astFactory.addASTChild(currentAST, returnAST);
                    primary_expr_AST = (AST) currentAST.root;
                    break;
                }
            case LITERAL_TRUE:
            case LITERAL_FALSE:
            case INT:
            case OCTAL:
            case HEX:
            case STRING_LITERAL:
            case WIDE_STRING_LITERAL:
            case CHAR_LITERAL:
            case WIDE_CHAR_LITERAL:
            case FIXED:
            case FLOAT:
                {
                    literal();
                    astFactory.addASTChild(currentAST, returnAST);
                    primary_expr_AST = (AST) currentAST.root;
                    break;
                }
            case LPAREN:
                {
                    AST tmp105_AST = null;
                    tmp105_AST = astFactory.create(LT(1));
                    astFactory.makeASTRoot(currentAST, tmp105_AST);
                    match(LPAREN);
                    const_exp();
                    astFactory.addASTChild(currentAST, returnAST);
                    AST tmp106_AST = null;
                    tmp106_AST = astFactory.create(LT(1));
                    astFactory.addASTChild(currentAST, tmp106_AST);
                    match(RPAREN);
                    primary_expr_AST = (AST) currentAST.root;
                    break;
                }
            default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
        }
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            consume();
            consumeUntil(_tokenSet_42);
        } else {
            throw ex;
        }
    }
    returnAST = primary_expr_AST;
}
Also used : ASTPair(antlr.ASTPair) AST(antlr.collections.AST) NoViableAltException(antlr.NoViableAltException) RecognitionException(antlr.RecognitionException)

Example 58 with RecognitionException

use of antlr.RecognitionException in project cxf by apache.

the class IDLParser method interface_body.

public final void interface_body() throws RecognitionException, TokenStreamException {
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST interface_body_AST = null;
    try {
        // for error handling
        {
            _loop31: do {
                if ((_tokenSet_17.member(LA(1)))) {
                    export();
                    astFactory.addASTChild(currentAST, returnAST);
                } else {
                    break _loop31;
                }
            } while (true);
        }
        interface_body_AST = (AST) currentAST.root;
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            consume();
            consumeUntil(_tokenSet_15);
        } else {
            throw ex;
        }
    }
    returnAST = interface_body_AST;
}
Also used : ASTPair(antlr.ASTPair) AST(antlr.collections.AST) RecognitionException(antlr.RecognitionException)

Example 59 with RecognitionException

use of antlr.RecognitionException in project cxf by apache.

the class IDLParser method init_dcl.

public final void init_dcl() throws RecognitionException, TokenStreamException {
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST init_dcl_AST = null;
    try {
        // for error handling
        AST tmp67_AST = null;
        tmp67_AST = astFactory.create(LT(1));
        astFactory.makeASTRoot(currentAST, tmp67_AST);
        match(LITERAL_factory);
        identifier();
        astFactory.addASTChild(currentAST, returnAST);
        match(LPAREN);
        {
            switch(LA(1)) {
                case LITERAL_in:
                    {
                        init_param_decls();
                        astFactory.addASTChild(currentAST, returnAST);
                        break;
                    }
                case RPAREN:
                    {
                        break;
                    }
                default:
                    {
                        throw new NoViableAltException(LT(1), getFilename());
                    }
            }
        }
        match(RPAREN);
        {
            switch(LA(1)) {
                case LITERAL_raises:
                    {
                        raises_expr();
                        astFactory.addASTChild(currentAST, returnAST);
                        break;
                    }
                case SEMI:
                    {
                        break;
                    }
                default:
                    {
                        throw new NoViableAltException(LT(1), getFilename());
                    }
            }
        }
        match(SEMI);
        init_dcl_AST = (AST) currentAST.root;
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            consume();
            consumeUntil(_tokenSet_24);
        } else {
            throw ex;
        }
    }
    returnAST = init_dcl_AST;
}
Also used : ASTPair(antlr.ASTPair) AST(antlr.collections.AST) NoViableAltException(antlr.NoViableAltException) RecognitionException(antlr.RecognitionException)

Example 60 with RecognitionException

use of antlr.RecognitionException in project cxf by apache.

the class IDLParser method wide_character_literal.

public final void wide_character_literal() throws RecognitionException, TokenStreamException {
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST wide_character_literal_AST = null;
    try {
        // for error handling
        AST tmp113_AST = null;
        tmp113_AST = astFactory.create(LT(1));
        astFactory.addASTChild(currentAST, tmp113_AST);
        match(WIDE_CHAR_LITERAL);
        wide_character_literal_AST = (AST) currentAST.root;
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            consume();
            consumeUntil(_tokenSet_42);
        } else {
            throw ex;
        }
    }
    returnAST = wide_character_literal_AST;
}
Also used : ASTPair(antlr.ASTPair) AST(antlr.collections.AST) RecognitionException(antlr.RecognitionException)

Aggregations

RecognitionException (antlr.RecognitionException)170 AST (antlr.collections.AST)155 ASTPair (antlr.ASTPair)154 NoViableAltException (antlr.NoViableAltException)68 TokenStreamException (antlr.TokenStreamException)10 GroovyRecognizer (org.codehaus.groovy.antlr.parser.GroovyRecognizer)6 TokenStreamRecognitionException (antlr.TokenStreamRecognitionException)5 StringReader (java.io.StringReader)4 GroovyLexer (org.codehaus.groovy.antlr.parser.GroovyLexer)4 Token (antlr.Token)3 CharStreamException (antlr.CharStreamException)2 CharStreamIOException (antlr.CharStreamIOException)2 CommonToken (antlr.CommonToken)2 NoViableAltForCharException (antlr.NoViableAltForCharException)2 TokenStreamIOException (antlr.TokenStreamIOException)2 CheckstyleException (com.puppycrawl.tools.checkstyle.api.CheckstyleException)2 DetailAST (com.puppycrawl.tools.checkstyle.api.DetailAST)2 FileContents (com.puppycrawl.tools.checkstyle.api.FileContents)2 IncorrectTypeHintException (groovy.transform.stc.IncorrectTypeHintException)2 BufferedReader (java.io.BufferedReader)2