Search in sources :

Example 26 with MismatchedSetException

use of org.antlr.runtime.MismatchedSetException 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 >= '' && LA26_2 <= ')') || (LA26_2 >= '+' && LA26_2 <= '￿'))) {
                        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) >= '' && input.LA(1) <= ')') || (input.LA(1) >= '+' && input.LA(1) <= '￿')) {
                            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 >= '' && LA25_1 <= '.') || (LA25_1 >= '0' && LA25_1 <= '￿'))) {
                                    alt25 = 1;
                                }
                            } else if (((LA25_0 >= '' && LA25_0 <= ')') || (LA25_0 >= '+' && LA25_0 <= '￿'))) {
                                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 27 with MismatchedSetException

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

the class JavaLexer method mSTRING_LITERAL.

// $ANTLR end "CHARACTER_LITERAL"
// $ANTLR start "STRING_LITERAL"
public final void mSTRING_LITERAL() throws RecognitionException {
    try {
        int _type = STRING_LITERAL;
        int _channel = DEFAULT_TOKEN_CHANNEL;
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1203:5: ( '\"' ( ESCAPE_SEQUENCE | ~ ( '\\\\' | '\"' ) )* '\"' )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1203:8: '\"' ( ESCAPE_SEQUENCE | ~ ( '\\\\' | '\"' ) )* '\"'
        {
            match('\"');
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1203:12: ( ESCAPE_SEQUENCE | ~ ( '\\\\' | '\"' ) )*
            loop21: do {
                int alt21 = 3;
                int LA21_0 = input.LA(1);
                if ((LA21_0 == '\\')) {
                    alt21 = 1;
                } else if (((LA21_0 >= '' && LA21_0 <= '!') || (LA21_0 >= '#' && LA21_0 <= '[') || (LA21_0 >= ']' && LA21_0 <= '￿'))) {
                    alt21 = 2;
                }
                switch(alt21) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1203:14: ESCAPE_SEQUENCE
                        {
                            mESCAPE_SEQUENCE();
                        }
                        break;
                    case 2:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1203:32: ~ ( '\\\\' | '\"' )
                        {
                            if ((input.LA(1) >= '' && input.LA(1) <= '!') || (input.LA(1) >= '#' && input.LA(1) <= '[') || (input.LA(1) >= ']' && input.LA(1) <= '￿')) {
                                input.consume();
                            } else {
                                MismatchedSetException mse = new MismatchedSetException(null, input);
                                recover(mse);
                                throw mse;
                            }
                        }
                        break;
                    default:
                        break loop21;
                }
            } while (true);
            match('\"');
        }
        state.type = _type;
        state.channel = _channel;
    } finally {
    }
}
Also used : MismatchedSetException(org.antlr.runtime.MismatchedSetException)

Example 28 with MismatchedSetException

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

the class JavaParser method primitiveType.

// $ANTLR start "primitiveType"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:685:1: primitiveType : ( BOOLEAN | CHAR | BYTE | SHORT | INT | LONG | FLOAT | DOUBLE );
public final JavaParser.primitiveType_return primitiveType() throws RecognitionException {
    JavaParser.primitiveType_return retval = new JavaParser.primitiveType_return();
    retval.start = input.LT(1);
    int primitiveType_StartIndex = input.index();
    CommonTree root_0 = null;
    Token set184 = null;
    CommonTree set184_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 49)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:686:5: ( BOOLEAN | CHAR | BYTE | SHORT | INT | LONG | FLOAT | DOUBLE )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:
        {
            root_0 = (CommonTree) adaptor.nil();
            set184 = (Token) input.LT(1);
            if (input.LA(1) == BOOLEAN || input.LA(1) == BYTE || input.LA(1) == CHAR || input.LA(1) == DOUBLE || input.LA(1) == FLOAT || (input.LA(1) >= INT && input.LA(1) <= LONG) || input.LA(1) == SHORT) {
                input.consume();
                if (state.backtracking == 0) {
                    adaptor.addChild(root_0, (CommonTree) adaptor.create(set184));
                }
                state.errorRecovery = false;
                state.failed = false;
            } else {
                if (state.backtracking > 0) {
                    state.failed = true;
                    return retval;
                }
                MismatchedSetException mse = new MismatchedSetException(null, input);
                throw mse;
            }
        }
        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, 49, primitiveType_StartIndex);
        }
    }
    return retval;
}
Also used : MismatchedSetException(org.antlr.runtime.MismatchedSetException) CommonTree(org.antlr.runtime.tree.CommonTree) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Aggregations

MismatchedSetException (org.antlr.runtime.MismatchedSetException)28 RecognitionException (org.antlr.runtime.RecognitionException)8 Token (org.antlr.runtime.Token)8 EarlyExitException (org.antlr.runtime.EarlyExitException)7 NoViableAltException (org.antlr.runtime.NoViableAltException)4 CommonTree (org.antlr.runtime.tree.CommonTree)4