Search in sources :

Example 46 with NoViableAltException

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

the class JavaParser method synpred51_Java_fragment.

// $ANTLR end synpred45_Java
// $ANTLR start synpred51_Java
public final void synpred51_Java_fragment() throws RecognitionException {
    // /home/langera/dev/freud/trunk/src/grammar/Java.g:556:13: ( ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? SEMI | VOID IDENT formalParameterList ( throwsClause )? SEMI ) )
    // /home/langera/dev/freud/trunk/src/grammar/Java.g:556:13: ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? SEMI | VOID IDENT formalParameterList ( throwsClause )? SEMI )
    {
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:556:13: ( genericTypeParameterList )?
        int alt179 = 2;
        int LA179_0 = input.LA(1);
        if ((LA179_0 == LESS_THAN)) {
            alt179 = 1;
        }
        switch(alt179) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: genericTypeParameterList
                {
                    pushFollow(FOLLOW_genericTypeParameterList_in_synpred51_Java5985);
                    genericTypeParameterList();
                    state._fsp--;
                    if (state.failed) {
                        return;
                    }
                }
                break;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:557:13: ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? SEMI | VOID IDENT formalParameterList ( throwsClause )? SEMI )
        int alt183 = 2;
        int LA183_0 = input.LA(1);
        if ((LA183_0 == BOOLEAN || LA183_0 == BYTE || LA183_0 == CHAR || LA183_0 == DOUBLE || LA183_0 == FLOAT || (LA183_0 >= INT && LA183_0 <= LONG) || LA183_0 == SHORT || LA183_0 == IDENT)) {
            alt183 = 1;
        } else if ((LA183_0 == VOID)) {
            alt183 = 2;
        } else {
            if (state.backtracking > 0) {
                state.failed = true;
                return;
            }
            NoViableAltException nvae = new NoViableAltException("", 183, 0, input);
            throw nvae;
        }
        switch(alt183) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:557:17: type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? SEMI
                {
                    pushFollow(FOLLOW_type_in_synpred51_Java6004);
                    type();
                    state._fsp--;
                    if (state.failed) {
                        return;
                    }
                    match(input, IDENT, FOLLOW_IDENT_in_synpred51_Java6006);
                    if (state.failed) {
                        return;
                    }
                    pushFollow(FOLLOW_formalParameterList_in_synpred51_Java6008);
                    formalParameterList();
                    state._fsp--;
                    if (state.failed) {
                        return;
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:557:48: ( arrayDeclaratorList )?
                    int alt180 = 2;
                    int LA180_0 = input.LA(1);
                    if ((LA180_0 == LBRACK)) {
                        alt180 = 1;
                    }
                    switch(alt180) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: arrayDeclaratorList
                            {
                                pushFollow(FOLLOW_arrayDeclaratorList_in_synpred51_Java6010);
                                arrayDeclaratorList();
                                state._fsp--;
                                if (state.failed) {
                                    return;
                                }
                            }
                            break;
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:557:69: ( throwsClause )?
                    int alt181 = 2;
                    int LA181_0 = input.LA(1);
                    if ((LA181_0 == THROWS)) {
                        alt181 = 1;
                    }
                    switch(alt181) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: throwsClause
                            {
                                pushFollow(FOLLOW_throwsClause_in_synpred51_Java6013);
                                throwsClause();
                                state._fsp--;
                                if (state.failed) {
                                    return;
                                }
                            }
                            break;
                    }
                    match(input, SEMI, FOLLOW_SEMI_in_synpred51_Java6016);
                    if (state.failed) {
                        return;
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:559:17: VOID IDENT formalParameterList ( throwsClause )? SEMI
                {
                    match(input, VOID, FOLLOW_VOID_in_synpred51_Java6074);
                    if (state.failed) {
                        return;
                    }
                    match(input, IDENT, FOLLOW_IDENT_in_synpred51_Java6076);
                    if (state.failed) {
                        return;
                    }
                    pushFollow(FOLLOW_formalParameterList_in_synpred51_Java6078);
                    formalParameterList();
                    state._fsp--;
                    if (state.failed) {
                        return;
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:559:48: ( throwsClause )?
                    int alt182 = 2;
                    int LA182_0 = input.LA(1);
                    if ((LA182_0 == THROWS)) {
                        alt182 = 1;
                    }
                    switch(alt182) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: throwsClause
                            {
                                pushFollow(FOLLOW_throwsClause_in_synpred51_Java6080);
                                throwsClause();
                                state._fsp--;
                                if (state.failed) {
                                    return;
                                }
                            }
                            break;
                    }
                    match(input, SEMI, FOLLOW_SEMI_in_synpred51_Java6083);
                    if (state.failed) {
                        return;
                    }
                }
                break;
        }
    }
}
Also used : NoViableAltException(org.antlr.runtime.NoViableAltException)

Example 47 with NoViableAltException

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

the class JavaParser method synpred43_Java_fragment.

// $ANTLR end synpred33_Java
// $ANTLR start synpred43_Java
public final void synpred43_Java_fragment() throws RecognitionException {
    Token ident = null;
    // /home/langera/dev/freud/trunk/src/grammar/Java.g:539:13: ( ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI ) | VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI ) | ident= IDENT formalParameterList ( throwsClause )? block ) )
    // /home/langera/dev/freud/trunk/src/grammar/Java.g:539:13: ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI ) | VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI ) | ident= IDENT formalParameterList ( throwsClause )? block )
    {
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:539:13: ( genericTypeParameterList )?
        int alt160 = 2;
        int LA160_0 = input.LA(1);
        if ((LA160_0 == LESS_THAN)) {
            alt160 = 1;
        }
        switch(alt160) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: genericTypeParameterList
                {
                    pushFollow(FOLLOW_genericTypeParameterList_in_synpred43_Java5650);
                    genericTypeParameterList();
                    state._fsp--;
                    if (state.failed) {
                        return;
                    }
                }
                break;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:540:13: ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI ) | VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI ) | ident= IDENT formalParameterList ( throwsClause )? block )
        int alt167 = 3;
        switch(input.LA(1)) {
            case BOOLEAN:
            case BYTE:
            case CHAR:
            case DOUBLE:
            case FLOAT:
            case INT:
            case LONG:
            case SHORT:
                {
                    alt167 = 1;
                }
                break;
            case IDENT:
                {
                    int LA167_2 = input.LA(2);
                    if ((LA167_2 == DOT || LA167_2 == LBRACK || LA167_2 == LESS_THAN || LA167_2 == IDENT)) {
                        alt167 = 1;
                    } else if ((LA167_2 == LPAREN)) {
                        alt167 = 3;
                    } else {
                        if (state.backtracking > 0) {
                            state.failed = true;
                            return;
                        }
                        NoViableAltException nvae = new NoViableAltException("", 167, 2, input);
                        throw nvae;
                    }
                }
                break;
            case VOID:
                {
                    alt167 = 2;
                }
                break;
            default:
                if (state.backtracking > 0) {
                    state.failed = true;
                    return;
                }
                NoViableAltException nvae = new NoViableAltException("", 167, 0, input);
                throw nvae;
        }
        switch(alt167) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:540:17: type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI )
                {
                    pushFollow(FOLLOW_type_in_synpred43_Java5669);
                    type();
                    state._fsp--;
                    if (state.failed) {
                        return;
                    }
                    match(input, IDENT, FOLLOW_IDENT_in_synpred43_Java5671);
                    if (state.failed) {
                        return;
                    }
                    pushFollow(FOLLOW_formalParameterList_in_synpred43_Java5673);
                    formalParameterList();
                    state._fsp--;
                    if (state.failed) {
                        return;
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:540:48: ( arrayDeclaratorList )?
                    int alt161 = 2;
                    int LA161_0 = input.LA(1);
                    if ((LA161_0 == LBRACK)) {
                        alt161 = 1;
                    }
                    switch(alt161) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: arrayDeclaratorList
                            {
                                pushFollow(FOLLOW_arrayDeclaratorList_in_synpred43_Java5675);
                                arrayDeclaratorList();
                                state._fsp--;
                                if (state.failed) {
                                    return;
                                }
                            }
                            break;
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:540:69: ( throwsClause )?
                    int alt162 = 2;
                    int LA162_0 = input.LA(1);
                    if ((LA162_0 == THROWS)) {
                        alt162 = 1;
                    }
                    switch(alt162) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: throwsClause
                            {
                                pushFollow(FOLLOW_throwsClause_in_synpred43_Java5678);
                                throwsClause();
                                state._fsp--;
                                if (state.failed) {
                                    return;
                                }
                            }
                            break;
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:540:83: ( block | SEMI )
                    int alt163 = 2;
                    int LA163_0 = input.LA(1);
                    if ((LA163_0 == LCURLY)) {
                        alt163 = 1;
                    } else if ((LA163_0 == SEMI)) {
                        alt163 = 2;
                    } else {
                        if (state.backtracking > 0) {
                            state.failed = true;
                            return;
                        }
                        NoViableAltException nvae = new NoViableAltException("", 163, 0, input);
                        throw nvae;
                    }
                    switch(alt163) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:540:84: block
                            {
                                pushFollow(FOLLOW_block_in_synpred43_Java5682);
                                block();
                                state._fsp--;
                                if (state.failed) {
                                    return;
                                }
                            }
                            break;
                        case 2:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:540:92: SEMI
                            {
                                match(input, SEMI, FOLLOW_SEMI_in_synpred43_Java5686);
                                if (state.failed) {
                                    return;
                                }
                            }
                            break;
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:542:17: VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI )
                {
                    match(input, VOID, FOLLOW_VOID_in_synpred43_Java5748);
                    if (state.failed) {
                        return;
                    }
                    match(input, IDENT, FOLLOW_IDENT_in_synpred43_Java5750);
                    if (state.failed) {
                        return;
                    }
                    pushFollow(FOLLOW_formalParameterList_in_synpred43_Java5752);
                    formalParameterList();
                    state._fsp--;
                    if (state.failed) {
                        return;
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:542:48: ( throwsClause )?
                    int alt164 = 2;
                    int LA164_0 = input.LA(1);
                    if ((LA164_0 == THROWS)) {
                        alt164 = 1;
                    }
                    switch(alt164) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: throwsClause
                            {
                                pushFollow(FOLLOW_throwsClause_in_synpred43_Java5754);
                                throwsClause();
                                state._fsp--;
                                if (state.failed) {
                                    return;
                                }
                            }
                            break;
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:542:62: ( block | SEMI )
                    int alt165 = 2;
                    int LA165_0 = input.LA(1);
                    if ((LA165_0 == LCURLY)) {
                        alt165 = 1;
                    } else if ((LA165_0 == SEMI)) {
                        alt165 = 2;
                    } else {
                        if (state.backtracking > 0) {
                            state.failed = true;
                            return;
                        }
                        NoViableAltException nvae = new NoViableAltException("", 165, 0, input);
                        throw nvae;
                    }
                    switch(alt165) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:542:63: block
                            {
                                pushFollow(FOLLOW_block_in_synpred43_Java5758);
                                block();
                                state._fsp--;
                                if (state.failed) {
                                    return;
                                }
                            }
                            break;
                        case 2:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:542:71: SEMI
                            {
                                match(input, SEMI, FOLLOW_SEMI_in_synpred43_Java5762);
                                if (state.failed) {
                                    return;
                                }
                            }
                            break;
                    }
                }
                break;
            case 3:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:544:17: ident= IDENT formalParameterList ( throwsClause )? block
                {
                    ident = (Token) match(input, IDENT, FOLLOW_IDENT_in_synpred43_Java5821);
                    if (state.failed) {
                        return;
                    }
                    pushFollow(FOLLOW_formalParameterList_in_synpred43_Java5823);
                    formalParameterList();
                    state._fsp--;
                    if (state.failed) {
                        return;
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:544:49: ( throwsClause )?
                    int alt166 = 2;
                    int LA166_0 = input.LA(1);
                    if ((LA166_0 == THROWS)) {
                        alt166 = 1;
                    }
                    switch(alt166) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: throwsClause
                            {
                                pushFollow(FOLLOW_throwsClause_in_synpred43_Java5825);
                                throwsClause();
                                state._fsp--;
                                if (state.failed) {
                                    return;
                                }
                            }
                            break;
                    }
                    pushFollow(FOLLOW_block_in_synpred43_Java5828);
                    block();
                    state._fsp--;
                    if (state.failed) {
                        return;
                    }
                }
                break;
        }
    }
}
Also used : NoViableAltException(org.antlr.runtime.NoViableAltException) Token(org.antlr.runtime.Token)

Example 48 with NoViableAltException

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

the class JavaParser method shiftExpression.

// $ANTLR start "shiftExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1000:1: shiftExpression : additiveExpression ( ( BIT_SHIFT_RIGHT | SHIFT_RIGHT | SHIFT_LEFT ) additiveExpression )* ;
public final JavaParser.shiftExpression_return shiftExpression() throws RecognitionException {
    JavaParser.shiftExpression_return retval = new JavaParser.shiftExpression_return();
    retval.start = input.LT(1);
    int shiftExpression_StartIndex = input.index();
    CommonTree root_0 = null;
    Token BIT_SHIFT_RIGHT414 = null;
    Token SHIFT_RIGHT415 = null;
    Token SHIFT_LEFT416 = null;
    JavaParser.additiveExpression_return additiveExpression413 = null;
    JavaParser.additiveExpression_return additiveExpression417 = null;
    CommonTree BIT_SHIFT_RIGHT414_tree = null;
    CommonTree SHIFT_RIGHT415_tree = null;
    CommonTree SHIFT_LEFT416_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 99)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1001:5: ( additiveExpression ( ( BIT_SHIFT_RIGHT | SHIFT_RIGHT | SHIFT_LEFT ) additiveExpression )* )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1001:9: additiveExpression ( ( BIT_SHIFT_RIGHT | SHIFT_RIGHT | SHIFT_LEFT ) additiveExpression )*
        {
            root_0 = (CommonTree) adaptor.nil();
            pushFollow(FOLLOW_additiveExpression_in_shiftExpression10945);
            additiveExpression413 = additiveExpression();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                adaptor.addChild(root_0, additiveExpression413.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1002:9: ( ( BIT_SHIFT_RIGHT | SHIFT_RIGHT | SHIFT_LEFT ) additiveExpression )*
            loop122: do {
                int alt122 = 2;
                int LA122_0 = input.LA(1);
                if ((LA122_0 == BIT_SHIFT_RIGHT || LA122_0 == SHIFT_LEFT || LA122_0 == SHIFT_RIGHT)) {
                    alt122 = 1;
                }
                switch(alt122) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1002:13: ( BIT_SHIFT_RIGHT | SHIFT_RIGHT | SHIFT_LEFT ) additiveExpression
                        {
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1002:13: ( BIT_SHIFT_RIGHT | SHIFT_RIGHT | SHIFT_LEFT )
                            int alt121 = 3;
                            switch(input.LA(1)) {
                                case BIT_SHIFT_RIGHT:
                                    {
                                        alt121 = 1;
                                    }
                                    break;
                                case SHIFT_RIGHT:
                                    {
                                        alt121 = 2;
                                    }
                                    break;
                                case SHIFT_LEFT:
                                    {
                                        alt121 = 3;
                                    }
                                    break;
                                default:
                                    if (state.backtracking > 0) {
                                        state.failed = true;
                                        return retval;
                                    }
                                    NoViableAltException nvae = new NoViableAltException("", 121, 0, input);
                                    throw nvae;
                            }
                            switch(alt121) {
                                case 1:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1002:17: BIT_SHIFT_RIGHT
                                    {
                                        BIT_SHIFT_RIGHT414 = (Token) match(input, BIT_SHIFT_RIGHT, FOLLOW_BIT_SHIFT_RIGHT_in_shiftExpression10963);
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            BIT_SHIFT_RIGHT414_tree = (CommonTree) adaptor.create(BIT_SHIFT_RIGHT414);
                                            root_0 = (CommonTree) adaptor.becomeRoot(BIT_SHIFT_RIGHT414_tree, root_0);
                                        }
                                    }
                                    break;
                                case 2:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1003:17: SHIFT_RIGHT
                                    {
                                        SHIFT_RIGHT415 = (Token) match(input, SHIFT_RIGHT, FOLLOW_SHIFT_RIGHT_in_shiftExpression10982);
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            SHIFT_RIGHT415_tree = (CommonTree) adaptor.create(SHIFT_RIGHT415);
                                            root_0 = (CommonTree) adaptor.becomeRoot(SHIFT_RIGHT415_tree, root_0);
                                        }
                                    }
                                    break;
                                case 3:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1004:17: SHIFT_LEFT
                                    {
                                        SHIFT_LEFT416 = (Token) match(input, SHIFT_LEFT, FOLLOW_SHIFT_LEFT_in_shiftExpression11001);
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            SHIFT_LEFT416_tree = (CommonTree) adaptor.create(SHIFT_LEFT416);
                                            root_0 = (CommonTree) adaptor.becomeRoot(SHIFT_LEFT416_tree, root_0);
                                        }
                                    }
                                    break;
                            }
                            pushFollow(FOLLOW_additiveExpression_in_shiftExpression11030);
                            additiveExpression417 = additiveExpression();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                adaptor.addChild(root_0, additiveExpression417.getTree());
                            }
                        }
                        break;
                    default:
                        break loop122;
                }
            } 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, 99, shiftExpression_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 49 with NoViableAltException

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

the class JavaParser method localModifier.

// $ANTLR start "localModifier"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:642:1: localModifier : ( FINAL | annotation );
public final JavaParser.localModifier_return localModifier() throws RecognitionException {
    JavaParser.localModifier_return retval = new JavaParser.localModifier_return();
    retval.start = input.LT(1);
    int localModifier_StartIndex = input.index();
    CommonTree root_0 = null;
    Token FINAL164 = null;
    JavaParser.annotation_return annotation165 = null;
    CommonTree FINAL164_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 40)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:643:5: ( FINAL | annotation )
        int alt57 = 2;
        int LA57_0 = input.LA(1);
        if ((LA57_0 == FINAL)) {
            alt57 = 1;
        } else if ((LA57_0 == AT)) {
            alt57 = 2;
        } else {
            if (state.backtracking > 0) {
                state.failed = true;
                return retval;
            }
            NoViableAltException nvae = new NoViableAltException("", 57, 0, input);
            throw nvae;
        }
        switch(alt57) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:643:9: FINAL
                {
                    root_0 = (CommonTree) adaptor.nil();
                    FINAL164 = (Token) match(input, FINAL, FOLLOW_FINAL_in_localModifier6815);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        FINAL164_tree = (CommonTree) adaptor.create(FINAL164);
                        adaptor.addChild(root_0, FINAL164_tree);
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:644:9: annotation
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_annotation_in_localModifier6825);
                    annotation165 = annotation();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, annotation165.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, 40, localModifier_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 50 with NoViableAltException

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

the class JavaParser method variableInitializer.

// $ANTLR start "variableInitializer"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:593:1: variableInitializer : ( arrayInitializer | expression );
public final JavaParser.variableInitializer_return variableInitializer() throws RecognitionException {
    JavaParser.variableInitializer_return retval = new JavaParser.variableInitializer_return();
    retval.start = input.LT(1);
    int variableInitializer_StartIndex = input.index();
    CommonTree root_0 = null;
    JavaParser.arrayInitializer_return arrayInitializer138 = null;
    JavaParser.expression_return expression139 = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 32)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:594:5: ( arrayInitializer | expression )
        int alt49 = 2;
        int LA49_0 = input.LA(1);
        if ((LA49_0 == LCURLY)) {
            alt49 = 1;
        } else if ((LA49_0 == DEC || LA49_0 == INC || LA49_0 == LESS_THAN || LA49_0 == LOGICAL_NOT || (LA49_0 >= LPAREN && LA49_0 <= MINUS) || LA49_0 == NOT || LA49_0 == PLUS || LA49_0 == BOOLEAN || LA49_0 == BYTE || LA49_0 == CHAR || LA49_0 == DOUBLE || LA49_0 == FALSE || LA49_0 == FLOAT || (LA49_0 >= INT && LA49_0 <= LONG) || (LA49_0 >= NEW && LA49_0 <= NULL) || LA49_0 == SHORT || LA49_0 == SUPER || LA49_0 == THIS || LA49_0 == TRUE || LA49_0 == VOID || (LA49_0 >= IDENT && LA49_0 <= STRING_LITERAL))) {
            alt49 = 2;
        } else {
            if (state.backtracking > 0) {
                state.failed = true;
                return retval;
            }
            NoViableAltException nvae = new NoViableAltException("", 49, 0, input);
            throw nvae;
        }
        switch(alt49) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:594:9: arrayInitializer
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_arrayInitializer_in_variableInitializer6424);
                    arrayInitializer138 = arrayInitializer();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, arrayInitializer138.getTree());
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:595:9: expression
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_expression_in_variableInitializer6434);
                    expression139 = expression();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, expression139.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, 32, variableInitializer_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) NoViableAltException(org.antlr.runtime.NoViableAltException) RecognitionException(org.antlr.runtime.RecognitionException)

Aggregations

NoViableAltException (org.antlr.runtime.NoViableAltException)50 RecognitionException (org.antlr.runtime.RecognitionException)37 Token (org.antlr.runtime.Token)36 CommonTree (org.antlr.runtime.tree.CommonTree)33 RewriteRuleSubtreeStream (org.antlr.runtime.tree.RewriteRuleSubtreeStream)20 RewriteRuleTokenStream (org.antlr.runtime.tree.RewriteRuleTokenStream)20 MismatchedSetException (org.antlr.runtime.MismatchedSetException)4 RewriteEarlyExitException (org.antlr.runtime.tree.RewriteEarlyExitException)3 EarlyExitException (org.antlr.runtime.EarlyExitException)2