Search in sources :

Example 61 with NoViableAltException

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

the class JavaParser method synpred115_Java_fragment.

// $ANTLR end synpred103_Java
// $ANTLR start synpred115_Java
public final void synpred115_Java_fragment() throws RecognitionException {
    // /home/langera/dev/freud/trunk/src/grammar/Java.g:810:9: ( modifierList type ( IDENT LPAREN RPAREN ( annotationDefaultValue )? SEMI | classFieldDeclaratorList SEMI ) )
    // /home/langera/dev/freud/trunk/src/grammar/Java.g:810:9: modifierList type ( IDENT LPAREN RPAREN ( annotationDefaultValue )? SEMI | classFieldDeclaratorList SEMI )
    {
        pushFollow(FOLLOW_modifierList_in_synpred115_Java8256);
        modifierList();
        state._fsp--;
        if (state.failed) {
            return;
        }
        pushFollow(FOLLOW_type_in_synpred115_Java8258);
        type();
        state._fsp--;
        if (state.failed) {
            return;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:811:9: ( IDENT LPAREN RPAREN ( annotationDefaultValue )? SEMI | classFieldDeclaratorList SEMI )
        int alt198 = 2;
        int LA198_0 = input.LA(1);
        if ((LA198_0 == IDENT)) {
            int LA198_1 = input.LA(2);
            if ((LA198_1 == LPAREN)) {
                alt198 = 1;
            } else if ((LA198_1 == ASSIGN || LA198_1 == COMMA || LA198_1 == LBRACK || LA198_1 == SEMI)) {
                alt198 = 2;
            } else {
                if (state.backtracking > 0) {
                    state.failed = true;
                    return;
                }
                NoViableAltException nvae = new NoViableAltException("", 198, 1, input);
                throw nvae;
            }
        } else {
            if (state.backtracking > 0) {
                state.failed = true;
                return;
            }
            NoViableAltException nvae = new NoViableAltException("", 198, 0, input);
            throw nvae;
        }
        switch(alt198) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:811:13: IDENT LPAREN RPAREN ( annotationDefaultValue )? SEMI
                {
                    match(input, IDENT, FOLLOW_IDENT_in_synpred115_Java8272);
                    if (state.failed) {
                        return;
                    }
                    match(input, LPAREN, FOLLOW_LPAREN_in_synpred115_Java8274);
                    if (state.failed) {
                        return;
                    }
                    match(input, RPAREN, FOLLOW_RPAREN_in_synpred115_Java8276);
                    if (state.failed) {
                        return;
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:811:33: ( annotationDefaultValue )?
                    int alt197 = 2;
                    int LA197_0 = input.LA(1);
                    if ((LA197_0 == DEFAULT)) {
                        alt197 = 1;
                    }
                    switch(alt197) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: annotationDefaultValue
                            {
                                pushFollow(FOLLOW_annotationDefaultValue_in_synpred115_Java8278);
                                annotationDefaultValue();
                                state._fsp--;
                                if (state.failed) {
                                    return;
                                }
                            }
                            break;
                    }
                    match(input, SEMI, FOLLOW_SEMI_in_synpred115_Java8281);
                    if (state.failed) {
                        return;
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:813:13: classFieldDeclaratorList SEMI
                {
                    pushFollow(FOLLOW_classFieldDeclaratorList_in_synpred115_Java8323);
                    classFieldDeclaratorList();
                    state._fsp--;
                    if (state.failed) {
                        return;
                    }
                    match(input, SEMI, FOLLOW_SEMI_in_synpred115_Java8325);
                    if (state.failed) {
                        return;
                    }
                }
                break;
        }
    }
}
Also used : NoViableAltException(org.antlr.runtime.NoViableAltException)

Example 62 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 63 with NoViableAltException

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

the class JavaParser method synpred228_Java_fragment.

// $ANTLR end synpred220_Java
// $ANTLR start synpred228_Java
public final void synpred228_Java_fragment() throws RecognitionException {
    Token outerDot = null;
    Token Super = null;
    Token innerDot = null;
    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1114:13: (outerDot= DOT ( CLASS | genericTypeArgumentListSimplified (Super= SUPER arguments | SUPER innerDot= DOT IDENT arguments | IDENT arguments ) | THIS | Super= SUPER arguments | innerNewExpression ) )
    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1114:13: outerDot= DOT ( CLASS | genericTypeArgumentListSimplified (Super= SUPER arguments | SUPER innerDot= DOT IDENT arguments | IDENT arguments ) | THIS | Super= SUPER arguments | innerNewExpression )
    {
        outerDot = (Token) match(input, DOT, FOLLOW_DOT_in_synpred228_Java13556);
        if (state.failed) {
            return;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1115:13: ( CLASS | genericTypeArgumentListSimplified (Super= SUPER arguments | SUPER innerDot= DOT IDENT arguments | IDENT arguments ) | THIS | Super= SUPER arguments | innerNewExpression )
        int alt224 = 5;
        switch(input.LA(1)) {
            case CLASS:
                {
                    alt224 = 1;
                }
                break;
            case LESS_THAN:
                {
                    alt224 = 2;
                }
                break;
            case THIS:
                {
                    alt224 = 3;
                }
                break;
            case SUPER:
                {
                    alt224 = 4;
                }
                break;
            case NEW:
                {
                    alt224 = 5;
                }
                break;
            default:
                if (state.backtracking > 0) {
                    state.failed = true;
                    return;
                }
                NoViableAltException nvae = new NoViableAltException("", 224, 0, input);
                throw nvae;
        }
        switch(alt224) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1115:17: CLASS
                {
                    match(input, CLASS, FOLLOW_CLASS_in_synpred228_Java13574);
                    if (state.failed) {
                        return;
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1116:17: genericTypeArgumentListSimplified (Super= SUPER arguments | SUPER innerDot= DOT IDENT arguments | IDENT arguments )
                {
                    pushFollow(FOLLOW_genericTypeArgumentListSimplified_in_synpred228_Java13637);
                    genericTypeArgumentListSimplified();
                    state._fsp--;
                    if (state.failed) {
                        return;
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1117:17: (Super= SUPER arguments | SUPER innerDot= DOT IDENT arguments | IDENT arguments )
                    int alt223 = 3;
                    int LA223_0 = input.LA(1);
                    if ((LA223_0 == SUPER)) {
                        int LA223_1 = input.LA(2);
                        if ((LA223_1 == DOT)) {
                            alt223 = 2;
                        } else if ((LA223_1 == LPAREN)) {
                            alt223 = 1;
                        } else {
                            if (state.backtracking > 0) {
                                state.failed = true;
                                return;
                            }
                            NoViableAltException nvae = new NoViableAltException("", 223, 1, input);
                            throw nvae;
                        }
                    } else if ((LA223_0 == IDENT)) {
                        alt223 = 3;
                    } else {
                        if (state.backtracking > 0) {
                            state.failed = true;
                            return;
                        }
                        NoViableAltException nvae = new NoViableAltException("", 223, 0, input);
                        throw nvae;
                    }
                    switch(alt223) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1117:21: Super= SUPER arguments
                            {
                                Super = (Token) match(input, SUPER, FOLLOW_SUPER_in_synpred228_Java13661);
                                if (state.failed) {
                                    return;
                                }
                                pushFollow(FOLLOW_arguments_in_synpred228_Java13663);
                                arguments();
                                state._fsp--;
                                if (state.failed) {
                                    return;
                                }
                            }
                            break;
                        case 2:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1118:21: SUPER innerDot= DOT IDENT arguments
                            {
                                match(input, SUPER, FOLLOW_SUPER_in_synpred228_Java13713);
                                if (state.failed) {
                                    return;
                                }
                                innerDot = (Token) match(input, DOT, FOLLOW_DOT_in_synpred228_Java13717);
                                if (state.failed) {
                                    return;
                                }
                                match(input, IDENT, FOLLOW_IDENT_in_synpred228_Java13719);
                                if (state.failed) {
                                    return;
                                }
                                pushFollow(FOLLOW_arguments_in_synpred228_Java13721);
                                arguments();
                                state._fsp--;
                                if (state.failed) {
                                    return;
                                }
                            }
                            break;
                        case 3:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1119:21: IDENT arguments
                            {
                                match(input, IDENT, FOLLOW_IDENT_in_synpred228_Java13771);
                                if (state.failed) {
                                    return;
                                }
                                pushFollow(FOLLOW_arguments_in_synpred228_Java13773);
                                arguments();
                                state._fsp--;
                                if (state.failed) {
                                    return;
                                }
                            }
                            break;
                    }
                }
                break;
            case 3:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1121:17: THIS
                {
                    match(input, THIS, FOLLOW_THIS_in_synpred228_Java13848);
                    if (state.failed) {
                        return;
                    }
                }
                break;
            case 4:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1122:17: Super= SUPER arguments
                {
                    Super = (Token) match(input, SUPER, FOLLOW_SUPER_in_synpred228_Java13914);
                    if (state.failed) {
                        return;
                    }
                    pushFollow(FOLLOW_arguments_in_synpred228_Java13916);
                    arguments();
                    state._fsp--;
                    if (state.failed) {
                        return;
                    }
                }
                break;
            case 5:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1123:17: innerNewExpression
                {
                    pushFollow(FOLLOW_innerNewExpression_in_synpred228_Java13964);
                    innerNewExpression();
                    state._fsp--;
                    if (state.failed) {
                        return;
                    }
                }
                break;
        }
    }
}
Also used : NoViableAltException(org.antlr.runtime.NoViableAltException) Token(org.antlr.runtime.Token)

Example 64 with NoViableAltException

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

the class JavaLexer method mBLOCK_COMMENT.

// $ANTLR end "WS"
// $ANTLR start "BLOCK_COMMENT"
public final void mBLOCK_COMMENT() throws RecognitionException {
    try {
        int _type = BLOCK_COMMENT;
        int _channel = DEFAULT_TOKEN_CHANNEL;
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1263:5: ( ( '/*' ~ '*' ( options {greedy=false; } : . )* '*/' | '/**/' ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1263:9: ( '/*' ~ '*' ( options {greedy=false; } : . )* '*/' | '/**/' )
        {
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1263:9: ( '/*' ~ '*' ( options {greedy=false; } : . )* '*/' | '/**/' )
            int alt26 = 2;
            int LA26_0 = input.LA(1);
            if ((LA26_0 == '/')) {
                int LA26_1 = input.LA(2);
                if ((LA26_1 == '*')) {
                    int LA26_2 = input.LA(3);
                    if (((LA26_2 >= '\u0000' && LA26_2 <= ')') || (LA26_2 >= '+' && LA26_2 <= '\uFFFF'))) {
                        alt26 = 1;
                    } else if ((LA26_2 == '*')) {
                        alt26 = 2;
                    } else {
                        NoViableAltException nvae = new NoViableAltException("", 26, 2, input);
                        throw nvae;
                    }
                } else {
                    NoViableAltException nvae = new NoViableAltException("", 26, 1, input);
                    throw nvae;
                }
            } else {
                NoViableAltException nvae = new NoViableAltException("", 26, 0, input);
                throw nvae;
            }
            switch(alt26) {
                case 1:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1263:13: '/*' ~ '*' ( options {greedy=false; } : . )* '*/'
                    {
                        match("/*");
                        if ((input.LA(1) >= '\u0000' && input.LA(1) <= ')') || (input.LA(1) >= '+' && input.LA(1) <= '\uFFFF')) {
                            input.consume();
                        } else {
                            MismatchedSetException mse = new MismatchedSetException(null, input);
                            recover(mse);
                            throw mse;
                        }
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1263:23: ( options {greedy=false; } : . )*
                        loop25: do {
                            int alt25 = 2;
                            int LA25_0 = input.LA(1);
                            if ((LA25_0 == '*')) {
                                int LA25_1 = input.LA(2);
                                if ((LA25_1 == '/')) {
                                    alt25 = 2;
                                } else if (((LA25_1 >= '\u0000' && LA25_1 <= '.') || (LA25_1 >= '0' && LA25_1 <= '\uFFFF'))) {
                                    alt25 = 1;
                                }
                            } else if (((LA25_0 >= '\u0000' && LA25_0 <= ')') || (LA25_0 >= '+' && LA25_0 <= '\uFFFF'))) {
                                alt25 = 1;
                            }
                            switch(alt25) {
                                case 1:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1263:51: .
                                    {
                                        matchAny();
                                    }
                                    break;
                                default:
                                    break loop25;
                            }
                        } while (true);
                        match("*/");
                    }
                    break;
                case 2:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1264:13: '/**/'
                    {
                        match("/**/");
                    }
                    break;
            }
            if (!mPreserveBlockComments) {
                skip();
            } else {
                _channel = HIDDEN;
            }
        }
        state.type = _type;
        state.channel = _channel;
    } finally {
    }
}
Also used : MismatchedSetException(org.antlr.runtime.MismatchedSetException) NoViableAltException(org.antlr.runtime.NoViableAltException)

Example 65 with NoViableAltException

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

the class CssParser method attribRelate.

// $ANTLR start "attribRelate"
// /home/langera/dev/freud/src/grammar/Css.g:97:1: attribRelate : ( '=' -> ATTRIBEQUAL | '~=' -> HASVALUE | '|=' -> BEGINSWITH );
public final CssParser.attribRelate_return attribRelate() throws RecognitionException {
    CssParser.attribRelate_return retval = new CssParser.attribRelate_return();
    retval.start = input.LT(1);
    CommonTree root_0 = null;
    Token char_literal51 = null;
    Token string_literal52 = null;
    Token string_literal53 = null;
    CommonTree char_literal51_tree = null;
    CommonTree string_literal52_tree = null;
    CommonTree string_literal53_tree = null;
    RewriteRuleTokenStream stream_43 = new RewriteRuleTokenStream(adaptor, "token 43");
    RewriteRuleTokenStream stream_44 = new RewriteRuleTokenStream(adaptor, "token 44");
    RewriteRuleTokenStream stream_42 = new RewriteRuleTokenStream(adaptor, "token 42");
    try {
        // /home/langera/dev/freud/src/grammar/Css.g:98:2: ( '=' -> ATTRIBEQUAL | '~=' -> HASVALUE | '|=' -> BEGINSWITH )
        int alt22 = 3;
        switch(input.LA(1)) {
            case 42:
                {
                    alt22 = 1;
                }
                break;
            case 43:
                {
                    alt22 = 2;
                }
                break;
            case 44:
                {
                    alt22 = 3;
                }
                break;
            default:
                NoViableAltException nvae = new NoViableAltException("", 22, 0, input);
                throw nvae;
        }
        switch(alt22) {
            case 1:
                // /home/langera/dev/freud/src/grammar/Css.g:98:4: '='
                {
                    char_literal51 = (Token) match(input, 42, FOLLOW_42_in_attribRelate581);
                    stream_42.add(char_literal51);
                    // AST REWRITE
                    // elements:
                    // 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();
                    // 98:9: -> ATTRIBEQUAL
                    {
                        adaptor.addChild(root_0, (CommonTree) adaptor.create(ATTRIBEQUAL, "ATTRIBEQUAL"));
                    }
                    retval.tree = root_0;
                }
                break;
            case 2:
                // /home/langera/dev/freud/src/grammar/Css.g:99:4: '~='
                {
                    string_literal52 = (Token) match(input, 43, FOLLOW_43_in_attribRelate591);
                    stream_43.add(string_literal52);
                    // AST REWRITE
                    // elements:
                    // 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();
                    // 99:9: -> HASVALUE
                    {
                        adaptor.addChild(root_0, (CommonTree) adaptor.create(HASVALUE, "HASVALUE"));
                    }
                    retval.tree = root_0;
                }
                break;
            case 3:
                // /home/langera/dev/freud/src/grammar/Css.g:100:4: '|='
                {
                    string_literal53 = (Token) match(input, 44, FOLLOW_44_in_attribRelate600);
                    stream_44.add(string_literal53);
                    // AST REWRITE
                    // elements:
                    // 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();
                    // 100:9: -> BEGINSWITH
                    {
                        adaptor.addChild(root_0, (CommonTree) adaptor.create(BEGINSWITH, "BEGINSWITH"));
                    }
                    retval.tree = root_0;
                }
                break;
        }
        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