Search in sources :

Example 36 with RecognitionException

use of antlr.RecognitionException in project cxf by apache.

the class IDLParser method fixed_pt_type.

public final void fixed_pt_type() throws RecognitionException, TokenStreamException {
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST fixed_pt_type_AST = null;
    try {
        // for error handling
        AST tmp137_AST = null;
        tmp137_AST = astFactory.create(LT(1));
        astFactory.makeASTRoot(currentAST, tmp137_AST);
        match(LITERAL_fixed);
        match(LT);
        positive_int_const();
        astFactory.addASTChild(currentAST, returnAST);
        match(COMMA);
        positive_int_const();
        astFactory.addASTChild(currentAST, returnAST);
        match(GT);
        fixed_pt_type_AST = (AST) currentAST.root;
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            consume();
            consumeUntil(_tokenSet_36);
        } else {
            throw ex;
        }
    }
    returnAST = fixed_pt_type_AST;
}
Also used : ASTPair(antlr.ASTPair) AST(antlr.collections.AST) RecognitionException(antlr.RecognitionException)

Example 37 with RecognitionException

use of antlr.RecognitionException in project cxf by apache.

the class IDLParser method readonly_attr_spec.

public final void readonly_attr_spec() throws RecognitionException, TokenStreamException {
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST readonly_attr_spec_AST = null;
    try {
        // for error handling
        AST tmp163_AST = null;
        tmp163_AST = astFactory.create(LT(1));
        astFactory.addASTChild(currentAST, tmp163_AST);
        match(LITERAL_readonly);
        AST tmp164_AST = null;
        tmp164_AST = astFactory.create(LT(1));
        astFactory.makeASTRoot(currentAST, tmp164_AST);
        match(LITERAL_attribute);
        param_type_spec();
        astFactory.addASTChild(currentAST, returnAST);
        readonly_attr_declarator();
        astFactory.addASTChild(currentAST, returnAST);
        readonly_attr_spec_AST = (AST) currentAST.root;
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            consume();
            consumeUntil(_tokenSet_10);
        } else {
            throw ex;
        }
    }
    returnAST = readonly_attr_spec_AST;
}
Also used : ASTPair(antlr.ASTPair) AST(antlr.collections.AST) RecognitionException(antlr.RecognitionException)

Example 38 with RecognitionException

use of antlr.RecognitionException in project cxf by apache.

the class IDLParser method case_stmt.

public final void case_stmt() throws RecognitionException, TokenStreamException {
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST case_stmt_AST = null;
    try {
        // for error handling
        {
            int _cnt160 = 0;
            _loop160: do {
                switch(LA(1)) {
                    case LITERAL_case:
                        {
                            AST tmp154_AST = null;
                            tmp154_AST = astFactory.create(LT(1));
                            astFactory.makeASTRoot(currentAST, tmp154_AST);
                            match(LITERAL_case);
                            const_exp();
                            astFactory.addASTChild(currentAST, returnAST);
                            match(COLON);
                            break;
                        }
                    case LITERAL_default:
                        {
                            AST tmp156_AST = null;
                            tmp156_AST = astFactory.create(LT(1));
                            astFactory.makeASTRoot(currentAST, tmp156_AST);
                            match(LITERAL_default);
                            match(COLON);
                            break;
                        }
                    default:
                        {
                            if (_cnt160 >= 1) {
                                break _loop160;
                            } else {
                                throw new NoViableAltException(LT(1), getFilename());
                            }
                        }
                }
                _cnt160++;
            } while (true);
        }
        element_spec();
        astFactory.addASTChild(currentAST, returnAST);
        match(SEMI);
        case_stmt_AST = (AST) currentAST.root;
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            consume();
            consumeUntil(_tokenSet_52);
        } else {
            throw ex;
        }
    }
    returnAST = case_stmt_AST;
}
Also used : ASTPair(antlr.ASTPair) AST(antlr.collections.AST) NoViableAltException(antlr.NoViableAltException) RecognitionException(antlr.RecognitionException)

Example 39 with RecognitionException

use of antlr.RecognitionException in project cxf by apache.

the class IDLParser method xor_expr.

public final void xor_expr() throws RecognitionException, TokenStreamException {
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST xor_expr_AST = null;
    try {
        // for error handling
        and_expr();
        astFactory.addASTChild(currentAST, returnAST);
        {
            _loop90: do {
                if ((LA(1) == XOR)) {
                    AST tmp93_AST = null;
                    tmp93_AST = astFactory.create(LT(1));
                    astFactory.makeASTRoot(currentAST, tmp93_AST);
                    match(XOR);
                    and_expr();
                    astFactory.addASTChild(currentAST, returnAST);
                } else {
                    break _loop90;
                }
            } while (true);
        }
        xor_expr_AST = (AST) currentAST.root;
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            consume();
            consumeUntil(_tokenSet_37);
        } else {
            throw ex;
        }
    }
    returnAST = xor_expr_AST;
}
Also used : ASTPair(antlr.ASTPair) AST(antlr.collections.AST) RecognitionException(antlr.RecognitionException)

Example 40 with RecognitionException

use of antlr.RecognitionException in project cxf by apache.

the class IDLParser method declarator.

public final void declarator() throws RecognitionException, TokenStreamException {
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST declarator_AST = null;
    try {
        // for error handling
        if ((LA(1) == IDENT) && (LA(2) == SEMI || LA(2) == COMMA)) {
            simple_declarator();
            astFactory.addASTChild(currentAST, returnAST);
            declarator_AST = (AST) currentAST.root;
        } else if ((LA(1) == IDENT) && (LA(2) == LBRACK)) {
            complex_declarator();
            astFactory.addASTChild(currentAST, returnAST);
            declarator_AST = (AST) currentAST.root;
        } else {
            throw new NoViableAltException(LT(1), getFilename());
        }
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            consume();
            consumeUntil(_tokenSet_50);
        } else {
            throw ex;
        }
    }
    returnAST = declarator_AST;
}
Also used : ASTPair(antlr.ASTPair) AST(antlr.collections.AST) NoViableAltException(antlr.NoViableAltException) 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