Search in sources :

Example 21 with NoViableAltForCharException

use of antlr.NoViableAltForCharException in project ili2db by claeis.

the class SqlLexer method mNUMBER.

public final void mNUMBER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype;
    Token _token = null;
    int _begin = text.length();
    _ttype = NUMBER;
    int _saveIndex;
    {
        switch(LA(1)) {
            case '+':
                {
                    _saveIndex = text.length();
                    match('+');
                    text.setLength(_saveIndex);
                    break;
                }
            case '-':
                {
                    match('-');
                    break;
                }
            case '0':
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
                {
                    break;
                }
            default:
                {
                    throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
                }
        }
    }
    mPOSINT(false);
    if (_createToken && _token == null && _ttype != Token.SKIP) {
        _token = makeToken(_ttype);
        _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
    }
    _returnToken = _token;
}
Also used : NoViableAltForCharException(antlr.NoViableAltForCharException) Token(antlr.Token) CommonToken(antlr.CommonToken) ANTLRHashString(antlr.ANTLRHashString)

Example 22 with NoViableAltForCharException

use of antlr.NoViableAltForCharException in project cxf by apache.

the class IDLLexer method mINT.

public final void mINT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype;
    Token _token = null;
    int _begin = text.length();
    _ttype = INT;
    int _saveIndex;
    mNONZERODIGIT(false);
    {
        _loop364: do {
            if (((LA(1) >= '0' && LA(1) <= '9'))) {
                mDIGIT(false);
            } else {
                break _loop364;
            }
        } while (true);
    }
    {
        switch(LA(1)) {
            case '.':
                {
                    match('.');
                    {
                        _loop367: do {
                            if (((LA(1) >= '0' && LA(1) <= '9'))) {
                                mDIGIT(false);
                            } else {
                                break _loop367;
                            }
                        } while (true);
                    }
                    {
                        switch(LA(1)) {
                            case 'E':
                            case 'e':
                                {
                                    {
                                        {
                                            switch(LA(1)) {
                                                case 'e':
                                                    {
                                                        match('e');
                                                        break;
                                                    }
                                                case 'E':
                                                    {
                                                        match('E');
                                                        break;
                                                    }
                                                default:
                                                    {
                                                        throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
                                                    }
                                            }
                                        }
                                        {
                                            switch(LA(1)) {
                                                case '+':
                                                    {
                                                        match('+');
                                                        break;
                                                    }
                                                case '-':
                                                    {
                                                        match('-');
                                                        break;
                                                    }
                                                case '0':
                                                case '1':
                                                case '2':
                                                case '3':
                                                case '4':
                                                case '5':
                                                case '6':
                                                case '7':
                                                case '8':
                                                case '9':
                                                    {
                                                        break;
                                                    }
                                                default:
                                                    {
                                                        throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
                                                    }
                                            }
                                        }
                                        {
                                            int _cnt373 = 0;
                                            _loop373: do {
                                                if (((LA(1) >= '0' && LA(1) <= '9'))) {
                                                    mDIGIT(false);
                                                } else {
                                                    if (_cnt373 >= 1) {
                                                        break _loop373;
                                                    }
                                                    throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
                                                }
                                                _cnt373++;
                                            } while (true);
                                        }
                                    }
                                    _ttype = FLOAT;
                                    break;
                                }
                            case 'D':
                            case 'd':
                                {
                                    {
                                        switch(LA(1)) {
                                            case 'd':
                                                {
                                                    match('d');
                                                    break;
                                                }
                                            case 'D':
                                                {
                                                    match('D');
                                                    break;
                                                }
                                            default:
                                                {
                                                    throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
                                                }
                                        }
                                    }
                                    _ttype = FIXED;
                                    break;
                                }
                            default:
                                {
                                    _ttype = FLOAT;
                                }
                        }
                    }
                    break;
                }
            case 'E':
            case 'e':
                {
                    {
                        switch(LA(1)) {
                            case 'e':
                                {
                                    match('e');
                                    break;
                                }
                            case 'E':
                                {
                                    match('E');
                                    break;
                                }
                            default:
                                {
                                    throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
                                }
                        }
                    }
                    {
                        switch(LA(1)) {
                            case '+':
                                {
                                    match('+');
                                    break;
                                }
                            case '-':
                                {
                                    match('-');
                                    break;
                                }
                            case '0':
                            case '1':
                            case '2':
                            case '3':
                            case '4':
                            case '5':
                            case '6':
                            case '7':
                            case '8':
                            case '9':
                                {
                                    break;
                                }
                            default:
                                {
                                    throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
                                }
                        }
                    }
                    {
                        int _cnt378 = 0;
                        _loop378: do {
                            if (((LA(1) >= '0' && LA(1) <= '9'))) {
                                mDIGIT(false);
                            } else {
                                if (_cnt378 >= 1) {
                                    break _loop378;
                                }
                                throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
                            }
                            _cnt378++;
                        } while (true);
                    }
                    _ttype = FLOAT;
                    break;
                }
            case 'D':
            case 'd':
                {
                    {
                        switch(LA(1)) {
                            case 'd':
                                {
                                    match('d');
                                    break;
                                }
                            case 'D':
                                {
                                    match('D');
                                    break;
                                }
                            default:
                                {
                                    throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
                                }
                        }
                    }
                    _ttype = FIXED;
                    break;
                }
            default:
                {
                }
        }
    }
    if (_createToken && _token == null && _ttype != Token.SKIP) {
        _token = makeToken(_ttype);
        _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
    }
    _returnToken = _token;
}
Also used : NoViableAltForCharException(antlr.NoViableAltForCharException) Token(antlr.Token) CommonToken(antlr.CommonToken) ANTLRHashString(antlr.ANTLRHashString)

Example 23 with NoViableAltForCharException

use of antlr.NoViableAltForCharException in project cxf by apache.

the class IDLLexer method mOCTAL.

public final void mOCTAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype;
    Token _token = null;
    int _begin = text.length();
    _ttype = OCTAL;
    int _saveIndex;
    match('0');
    {
        switch(LA(1)) {
            case '0':
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
                {
                    {
                        int _cnt383 = 0;
                        _loop383: do {
                            if (((LA(1) >= '0' && LA(1) <= '9'))) {
                                mDIGIT(false);
                            } else {
                                if (_cnt383 >= 1) {
                                    break _loop383;
                                }
                                throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
                            }
                            _cnt383++;
                        } while (true);
                    }
                    break;
                }
            case '.':
                {
                    mFLOAT(false);
                    _ttype = FLOAT;
                    break;
                }
            case 'D':
            case 'd':
                {
                    {
                        switch(LA(1)) {
                            case 'd':
                                {
                                    match('d');
                                    break;
                                }
                            case 'D':
                                {
                                    match('D');
                                    break;
                                }
                            default:
                                {
                                    throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
                                }
                        }
                    }
                    _ttype = FIXED;
                    break;
                }
            default:
                {
                    _ttype = INT;
                }
        }
    }
    if (_createToken && _token == null && _ttype != Token.SKIP) {
        _token = makeToken(_ttype);
        _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
    }
    _returnToken = _token;
}
Also used : NoViableAltForCharException(antlr.NoViableAltForCharException) Token(antlr.Token) CommonToken(antlr.CommonToken) ANTLRHashString(antlr.ANTLRHashString)

Example 24 with NoViableAltForCharException

use of antlr.NoViableAltForCharException in project cxf by apache.

the class IDLLexer method nextToken.

public Token nextToken() throws TokenStreamException {
    Token theRetToken = null;
    tryAgain: for (; ; ) {
        Token _token = null;
        int _ttype = Token.INVALID_TYPE;
        resetText();
        try {
            // for char stream error handling
            try {
                // for lexical error handling
                switch(LA(1)) {
                    case ';':
                        {
                            mSEMI(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '?':
                        {
                            mQUESTION(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '(':
                        {
                            mLPAREN(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case ')':
                        {
                            mRPAREN(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '[':
                        {
                            mLBRACK(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case ']':
                        {
                            mRBRACK(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '{':
                        {
                            mLCURLY(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '}':
                        {
                            mRCURLY(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '|':
                        {
                            mOR(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '^':
                        {
                            mXOR(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '&':
                        {
                            mAND(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case ',':
                        {
                            mCOMMA(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '=':
                        {
                            mASSIGN(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '!':
                        {
                            mNOT(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '+':
                        {
                            mPLUS(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '-':
                        {
                            mMINUS(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '~':
                        {
                            mTILDE(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '*':
                        {
                            mSTAR(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '%':
                        {
                            mMOD(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '\t':
                    case '\n':
                    case '\r':
                    case ' ':
                        {
                            mWS(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '#':
                        {
                            mPREPROC_DIRECTIVE(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '\'':
                        {
                            mCHAR_LITERAL(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '"':
                        {
                            mSTRING_LITERAL(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '1':
                    case '2':
                    case '3':
                    case '4':
                    case '5':
                    case '6':
                    case '7':
                    case '8':
                    case '9':
                        {
                            mINT(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '_':
                        {
                            mESCAPED_IDENT(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    default:
                        if ((LA(1) == '<') && (LA(2) == '<')) {
                            mLSHIFT(true);
                            theRetToken = _returnToken;
                        } else if ((LA(1) == '>') && (LA(2) == '>')) {
                            mRSHIFT(true);
                            theRetToken = _returnToken;
                        } else if ((LA(1) == ':') && (LA(2) == ':')) {
                            mSCOPEOP(true);
                            theRetToken = _returnToken;
                        } else if ((LA(1) == '/') && (LA(2) == '/')) {
                            mSL_COMMENT(true);
                            theRetToken = _returnToken;
                        } else if ((LA(1) == '/') && (LA(2) == '*')) {
                            mML_COMMENT(true);
                            theRetToken = _returnToken;
                        } else if ((LA(1) == 'L') && (LA(2) == '\'')) {
                            mWIDE_CHAR_LITERAL(true);
                            theRetToken = _returnToken;
                        } else if ((LA(1) == 'L') && (LA(2) == '"')) {
                            mWIDE_STRING_LITERAL(true);
                            theRetToken = _returnToken;
                        } else if ((LA(1) == '0') && (LA(2) == 'X' || LA(2) == 'x')) {
                            mHEX(true);
                            theRetToken = _returnToken;
                        } else if ((LA(1) == '.') && ((LA(2) >= '0' && LA(2) <= '9'))) {
                            mFLOAT(true);
                            theRetToken = _returnToken;
                        } else if (LA(1) == ':') {
                            mCOLON(true);
                            theRetToken = _returnToken;
                        } else if (LA(1) == '.') {
                            mDOT(true);
                            theRetToken = _returnToken;
                        } else if (LA(1) == '<') {
                            mLT(true);
                            theRetToken = _returnToken;
                        } else if (LA(1) == '>') {
                            mGT(true);
                            theRetToken = _returnToken;
                        } else if (LA(1) == '/') {
                            mDIV(true);
                            theRetToken = _returnToken;
                        } else if (LA(1) == '0') {
                            mOCTAL(true);
                            theRetToken = _returnToken;
                        } else if (_tokenSet_0.member(LA(1))) {
                            mIDENT(true);
                            theRetToken = _returnToken;
                        } else {
                            if (LA(1) == EOF_CHAR) {
                                uponEOF();
                                _returnToken = makeToken(Token.EOF_TYPE);
                            } else {
                                throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
                            }
                        }
                }
                // found SKIP token
                if (_returnToken == null)
                    continue tryAgain;
                _ttype = _returnToken.getType();
                _returnToken.setType(_ttype);
                return _returnToken;
            } catch (RecognitionException e) {
                throw new TokenStreamRecognitionException(e);
            }
        } catch (CharStreamException cse) {
            if (cse instanceof CharStreamIOException) {
                throw new TokenStreamIOException(((CharStreamIOException) cse).io);
            }
            throw new TokenStreamException(cse.getMessage());
        }
    }
}
Also used : TokenStreamException(antlr.TokenStreamException) TokenStreamRecognitionException(antlr.TokenStreamRecognitionException) NoViableAltForCharException(antlr.NoViableAltForCharException) CharStreamException(antlr.CharStreamException) CharStreamIOException(antlr.CharStreamIOException) Token(antlr.Token) CommonToken(antlr.CommonToken) TokenStreamIOException(antlr.TokenStreamIOException) TokenStreamRecognitionException(antlr.TokenStreamRecognitionException) RecognitionException(antlr.RecognitionException)

Example 25 with NoViableAltForCharException

use of antlr.NoViableAltForCharException in project cxf by apache.

the class IDLLexer method mHEX.

public final void mHEX(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype;
    Token _token = null;
    int _begin = text.length();
    _ttype = HEX;
    int _saveIndex;
    {
        if ((LA(1) == '0') && (LA(2) == 'x')) {
            match("0x");
        } else if ((LA(1) == '0') && (LA(2) == 'X')) {
            match("0X");
        } else {
            throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
        }
    }
    {
        int _cnt361 = 0;
        _loop361: do {
            if ((_tokenSet_6.member(LA(1)))) {
                mHEXDIGIT(false);
            } else {
                if (_cnt361 >= 1) {
                    break _loop361;
                }
                throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
            }
            _cnt361++;
        } while (true);
    }
    if (_createToken && _token == null && _ttype != Token.SKIP) {
        _token = makeToken(_ttype);
        _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
    }
    _returnToken = _token;
}
Also used : NoViableAltForCharException(antlr.NoViableAltForCharException) Token(antlr.Token) CommonToken(antlr.CommonToken) ANTLRHashString(antlr.ANTLRHashString)

Aggregations

NoViableAltForCharException (antlr.NoViableAltForCharException)55 Token (antlr.Token)53 ANTLRHashString (antlr.ANTLRHashString)47 CommonToken (antlr.CommonToken)44 RecognitionException (antlr.RecognitionException)7 TokenStreamRecognitionException (antlr.TokenStreamRecognitionException)7 CharStreamException (antlr.CharStreamException)6 CharStreamIOException (antlr.CharStreamIOException)6 TokenStreamException (antlr.TokenStreamException)6 TokenStreamIOException (antlr.TokenStreamIOException)6 MismatchedCharException (antlr.MismatchedCharException)2 MismatchedTokenException (antlr.MismatchedTokenException)2 NoViableAltException (antlr.NoViableAltException)2 Message (org.codehaus.groovy.control.messages.Message)2 SimpleMessage (org.codehaus.groovy.control.messages.SimpleMessage)2 SyntaxErrorMessage (org.codehaus.groovy.control.messages.SyntaxErrorMessage)2