Search in sources :

Example 36 with NoViableAltException

use of org.antlr.runtime.NoViableAltException in project freud by LMAX-Exchange.

the class JavaParser method typeDecls.

// $ANTLR start "typeDecls"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:422:1: typeDecls : ( typeDeclaration | SEMI );
public final JavaParser.typeDecls_return typeDecls() throws RecognitionException {
    JavaParser.typeDecls_return retval = new JavaParser.typeDecls_return();
    retval.start = input.LT(1);
    int typeDecls_StartIndex = input.index();
    CommonTree root_0 = null;
    Token SEMI7 = null;
    JavaParser.typeDeclaration_return typeDeclaration6 = null;
    CommonTree SEMI7_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 3)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:423:5: ( typeDeclaration | SEMI )
        int alt4 = 2;
        int LA4_0 = input.LA(1);
        if ((LA4_0 == AT || LA4_0 == LESS_THAN || LA4_0 == ABSTRACT || LA4_0 == BOOLEAN || LA4_0 == BYTE || (LA4_0 >= CHAR && LA4_0 <= CLASS) || LA4_0 == DOUBLE || LA4_0 == ENUM || LA4_0 == FINAL || LA4_0 == FLOAT || LA4_0 == INTERFACE || (LA4_0 >= INT && LA4_0 <= NATIVE) || (LA4_0 >= PRIVATE && LA4_0 <= PUBLIC) || (LA4_0 >= SHORT && LA4_0 <= STRICTFP) || LA4_0 == SYNCHRONIZED || LA4_0 == TRANSIENT || (LA4_0 >= VOID && LA4_0 <= VOLATILE) || LA4_0 == IDENT)) {
            alt4 = 1;
        } else if ((LA4_0 == SEMI)) {
            alt4 = 2;
        } else {
            if (state.backtracking > 0) {
                state.failed = true;
                return retval;
            }
            NoViableAltException nvae = new NoViableAltException("", 4, 0, input);
            throw nvae;
        }
        switch(alt4) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:423:9: typeDeclaration
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_typeDeclaration_in_typeDecls4578);
                    typeDeclaration6 = typeDeclaration();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, typeDeclaration6.getTree());
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:424:9: SEMI
                {
                    root_0 = (CommonTree) adaptor.nil();
                    SEMI7 = (Token) match(input, SEMI, FOLLOW_SEMI_in_typeDecls4588);
                    if (state.failed) {
                        return retval;
                    }
                }
                break;
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 3, typeDecls_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) NoViableAltException(org.antlr.runtime.NoViableAltException) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 37 with NoViableAltException

use of org.antlr.runtime.NoViableAltException in project freud by LMAX-Exchange.

the class JavaParser method type.

// $ANTLR start "type"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:647:1: type : ( simpleType | objectType );
public final JavaParser.type_return type() throws RecognitionException {
    JavaParser.type_return retval = new JavaParser.type_return();
    retval.start = input.LT(1);
    int type_StartIndex = input.index();
    CommonTree root_0 = null;
    JavaParser.simpleType_return simpleType166 = null;
    JavaParser.objectType_return objectType167 = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 41)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:648:5: ( simpleType | objectType )
        int alt58 = 2;
        int LA58_0 = input.LA(1);
        if ((LA58_0 == BOOLEAN || LA58_0 == BYTE || LA58_0 == CHAR || LA58_0 == DOUBLE || LA58_0 == FLOAT || (LA58_0 >= INT && LA58_0 <= LONG) || LA58_0 == SHORT)) {
            alt58 = 1;
        } else if ((LA58_0 == IDENT)) {
            alt58 = 2;
        } else {
            if (state.backtracking > 0) {
                state.failed = true;
                return retval;
            }
            NoViableAltException nvae = new NoViableAltException("", 58, 0, input);
            throw nvae;
        }
        switch(alt58) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:648:9: simpleType
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_simpleType_in_type6844);
                    simpleType166 = simpleType();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, simpleType166.getTree());
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:649:9: objectType
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_objectType_in_type6854);
                    objectType167 = objectType();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, objectType167.getTree());
                    }
                }
                break;
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 41, type_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) NoViableAltException(org.antlr.runtime.NoViableAltException) RecognitionException(org.antlr.runtime.RecognitionException)

Example 38 with NoViableAltException

use of org.antlr.runtime.NoViableAltException in project freud by LMAX-Exchange.

the class JavaParser method equalityExpression.

// $ANTLR start "equalityExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:976:1: equalityExpression : instanceOfExpression ( ( EQUAL | NOT_EQUAL ) instanceOfExpression )* ;
public final JavaParser.equalityExpression_return equalityExpression() throws RecognitionException {
    JavaParser.equalityExpression_return retval = new JavaParser.equalityExpression_return();
    retval.start = input.LT(1);
    int equalityExpression_StartIndex = input.index();
    CommonTree root_0 = null;
    Token EQUAL401 = null;
    Token NOT_EQUAL402 = null;
    JavaParser.instanceOfExpression_return instanceOfExpression400 = null;
    JavaParser.instanceOfExpression_return instanceOfExpression403 = null;
    CommonTree EQUAL401_tree = null;
    CommonTree NOT_EQUAL402_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 96)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:977:5: ( instanceOfExpression ( ( EQUAL | NOT_EQUAL ) instanceOfExpression )* )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:977:9: instanceOfExpression ( ( EQUAL | NOT_EQUAL ) instanceOfExpression )*
        {
            root_0 = (CommonTree) adaptor.nil();
            pushFollow(FOLLOW_instanceOfExpression_in_equalityExpression10688);
            instanceOfExpression400 = instanceOfExpression();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                adaptor.addChild(root_0, instanceOfExpression400.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:978:9: ( ( EQUAL | NOT_EQUAL ) instanceOfExpression )*
            loop117: do {
                int alt117 = 2;
                int LA117_0 = input.LA(1);
                if ((LA117_0 == EQUAL || LA117_0 == NOT_EQUAL)) {
                    alt117 = 1;
                }
                switch(alt117) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:978:13: ( EQUAL | NOT_EQUAL ) instanceOfExpression
                        {
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:978:13: ( EQUAL | NOT_EQUAL )
                            int alt116 = 2;
                            int LA116_0 = input.LA(1);
                            if ((LA116_0 == EQUAL)) {
                                alt116 = 1;
                            } else if ((LA116_0 == NOT_EQUAL)) {
                                alt116 = 2;
                            } else {
                                if (state.backtracking > 0) {
                                    state.failed = true;
                                    return retval;
                                }
                                NoViableAltException nvae = new NoViableAltException("", 116, 0, input);
                                throw nvae;
                            }
                            switch(alt116) {
                                case 1:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:978:17: EQUAL
                                    {
                                        EQUAL401 = (Token) match(input, EQUAL, FOLLOW_EQUAL_in_equalityExpression10706);
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            EQUAL401_tree = (CommonTree) adaptor.create(EQUAL401);
                                            root_0 = (CommonTree) adaptor.becomeRoot(EQUAL401_tree, root_0);
                                        }
                                    }
                                    break;
                                case 2:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:979:17: NOT_EQUAL
                                    {
                                        NOT_EQUAL402 = (Token) match(input, NOT_EQUAL, FOLLOW_NOT_EQUAL_in_equalityExpression10725);
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            NOT_EQUAL402_tree = (CommonTree) adaptor.create(NOT_EQUAL402);
                                            root_0 = (CommonTree) adaptor.becomeRoot(NOT_EQUAL402_tree, root_0);
                                        }
                                    }
                                    break;
                            }
                            pushFollow(FOLLOW_instanceOfExpression_in_equalityExpression10754);
                            instanceOfExpression403 = instanceOfExpression();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                adaptor.addChild(root_0, instanceOfExpression403.getTree());
                            }
                        }
                        break;
                    default:
                        break loop117;
                }
            } while (true);
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 96, equalityExpression_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) NoViableAltException(org.antlr.runtime.NoViableAltException) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 39 with NoViableAltException

use of org.antlr.runtime.NoViableAltException in project freud by LMAX-Exchange.

the class JavaParser method annotationElementValue.

// $ANTLR start "annotationElementValue"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:783:1: annotationElementValue : ( annotationElementValueExpression | annotation | annotationElementValueArrayInitializer );
public final JavaParser.annotationElementValue_return annotationElementValue() throws RecognitionException {
    JavaParser.annotationElementValue_return retval = new JavaParser.annotationElementValue_return();
    retval.start = input.LT(1);
    int annotationElementValue_StartIndex = input.index();
    CommonTree root_0 = null;
    JavaParser.annotationElementValueExpression_return annotationElementValueExpression236 = null;
    JavaParser.annotation_return annotation237 = null;
    JavaParser.annotationElementValueArrayInitializer_return annotationElementValueArrayInitializer238 = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 65)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:784:5: ( annotationElementValueExpression | annotation | annotationElementValueArrayInitializer )
        int alt80 = 3;
        switch(input.LA(1)) {
            case DEC:
            case INC:
            case LESS_THAN:
            case LOGICAL_NOT:
            case LPAREN:
            case MINUS:
            case NOT:
            case PLUS:
            case BOOLEAN:
            case BYTE:
            case CHAR:
            case DOUBLE:
            case FALSE:
            case FLOAT:
            case INT:
            case LONG:
            case NEW:
            case NULL:
            case SHORT:
            case SUPER:
            case THIS:
            case TRUE:
            case VOID:
            case IDENT:
            case HEX_LITERAL:
            case OCTAL_LITERAL:
            case DECIMAL_LITERAL:
            case FLOATING_POINT_LITERAL:
            case CHARACTER_LITERAL:
            case STRING_LITERAL:
                {
                    alt80 = 1;
                }
                break;
            case AT:
                {
                    alt80 = 2;
                }
                break;
            case LCURLY:
                {
                    alt80 = 3;
                }
                break;
            default:
                if (state.backtracking > 0) {
                    state.failed = true;
                    return retval;
                }
                NoViableAltException nvae = new NoViableAltException("", 80, 0, input);
                throw nvae;
        }
        switch(alt80) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:784:9: annotationElementValueExpression
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_annotationElementValueExpression_in_annotationElementValue8035);
                    annotationElementValueExpression236 = annotationElementValueExpression();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, annotationElementValueExpression236.getTree());
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:785:9: annotation
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_annotation_in_annotationElementValue8045);
                    annotation237 = annotation();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, annotation237.getTree());
                    }
                }
                break;
            case 3:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:786:9: annotationElementValueArrayInitializer
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_annotationElementValueArrayInitializer_in_annotationElementValue8055);
                    annotationElementValueArrayInitializer238 = annotationElementValueArrayInitializer();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, annotationElementValueArrayInitializer238.getTree());
                    }
                }
                break;
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 65, annotationElementValue_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) NoViableAltException(org.antlr.runtime.NoViableAltException) RecognitionException(org.antlr.runtime.RecognitionException)

Example 40 with NoViableAltException

use of org.antlr.runtime.NoViableAltException in project freud by LMAX-Exchange.

the class CssParser method importRule.

// $ANTLR start "importRule"
// /home/langera/dev/freud/src/grammar/Css.g:44:1: importRule : ( '@import' | '@include' ) IDENT -> ^( IMPORT IDENT ) ;
public final CssParser.importRule_return importRule() throws RecognitionException {
    CssParser.importRule_return retval = new CssParser.importRule_return();
    retval.start = input.LT(1);
    CommonTree root_0 = null;
    Token string_literal4 = null;
    Token string_literal5 = null;
    Token IDENT6 = null;
    CommonTree string_literal4_tree = null;
    CommonTree string_literal5_tree = null;
    CommonTree IDENT6_tree = null;
    RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
    RewriteRuleTokenStream stream_26 = new RewriteRuleTokenStream(adaptor, "token 26");
    RewriteRuleTokenStream stream_27 = new RewriteRuleTokenStream(adaptor, "token 27");
    try {
        // /home/langera/dev/freud/src/grammar/Css.g:45:2: ( ( '@import' | '@include' ) IDENT -> ^( IMPORT IDENT ) )
        // /home/langera/dev/freud/src/grammar/Css.g:45:4: ( '@import' | '@include' ) IDENT
        {
            // /home/langera/dev/freud/src/grammar/Css.g:45:4: ( '@import' | '@include' )
            int alt3 = 2;
            int LA3_0 = input.LA(1);
            if ((LA3_0 == 26)) {
                alt3 = 1;
            } else if ((LA3_0 == 27)) {
                alt3 = 2;
            } else {
                NoViableAltException nvae = new NoViableAltException("", 3, 0, input);
                throw nvae;
            }
            switch(alt3) {
                case 1:
                    // /home/langera/dev/freud/src/grammar/Css.g:45:5: '@import'
                    {
                        string_literal4 = (Token) match(input, 26, FOLLOW_26_in_importRule153);
                        stream_26.add(string_literal4);
                    }
                    break;
                case 2:
                    // /home/langera/dev/freud/src/grammar/Css.g:45:17: '@include'
                    {
                        string_literal5 = (Token) match(input, 27, FOLLOW_27_in_importRule157);
                        stream_27.add(string_literal5);
                    }
                    break;
            }
            IDENT6 = (Token) match(input, IDENT, FOLLOW_IDENT_in_importRule161);
            stream_IDENT.add(IDENT6);
            // AST REWRITE
            // elements: IDENT
            // token labels:
            // rule labels: retval
            // token list labels:
            // rule list labels:
            // wildcard labels:
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
            root_0 = (CommonTree) adaptor.nil();
            // 45:36: -> ^( IMPORT IDENT )
            {
                // /home/langera/dev/freud/src/grammar/Css.g:45:39: ^( IMPORT IDENT )
                {
                    CommonTree root_1 = (CommonTree) adaptor.nil();
                    root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(IMPORT, "IMPORT"), root_1);
                    adaptor.addChild(root_1, stream_IDENT.nextNode());
                    adaptor.addChild(root_0, root_1);
                }
            }
            retval.tree = root_0;
        }
        retval.stop = input.LT(-1);
        retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
        adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) NoViableAltException(org.antlr.runtime.NoViableAltException) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Aggregations

NoViableAltException (org.antlr.runtime.NoViableAltException)68 RecognitionException (org.antlr.runtime.RecognitionException)50 Token (org.antlr.runtime.Token)43 CommonTree (org.antlr.runtime.tree.CommonTree)33 RewriteRuleSubtreeStream (org.antlr.runtime.tree.RewriteRuleSubtreeStream)28 RewriteRuleTokenStream (org.antlr.runtime.tree.RewriteRuleTokenStream)24 ParserRuleReturnScope (org.antlr.runtime.ParserRuleReturnScope)10 CommonToken (org.antlr.runtime.CommonToken)7 MismatchedSetException (org.antlr.runtime.MismatchedSetException)6 EarlyExitException (org.antlr.runtime.EarlyExitException)4 FailedPredicateException (org.antlr.runtime.FailedPredicateException)3 RewriteEarlyExitException (org.antlr.runtime.tree.RewriteEarlyExitException)3 ArrayList (java.util.ArrayList)2 MismatchedNotSetException (org.antlr.runtime.MismatchedNotSetException)2 MismatchedTokenException (org.antlr.runtime.MismatchedTokenException)2 MismatchedTreeNodeException (org.antlr.runtime.MismatchedTreeNodeException)2 RewriteEmptyStreamException (org.antlr.runtime.tree.RewriteEmptyStreamException)2