Search in sources :

Example 36 with NoViableAltForCharException

use of antlr.NoViableAltForCharException in project ili2db by claeis.

the class SqlLexer method mWS.

public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype;
    Token _token = null;
    int _begin = text.length();
    _ttype = WS;
    int _saveIndex;
    {
        int _cnt156 = 0;
        _loop156: do {
            switch(LA(1)) {
                case ' ':
                    {
                        match(' ');
                        break;
                    }
                case '\t':
                    {
                        match('\t');
                        break;
                    }
                case '\u000c':
                    {
                        match('\f');
                        break;
                    }
                case '\n':
                case '\r':
                    {
                        {
                            if ((LA(1) == '\r') && (LA(2) == '\n') && (true) && (true) && (true)) {
                                match("\r\n");
                            } else if ((LA(1) == '\r') && (true) && (true) && (true) && (true)) {
                                match('\r');
                            } else if ((LA(1) == '\n')) {
                                match('\n');
                            } else {
                                throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
                            }
                        }
                        newline();
                        break;
                    }
                default:
                    {
                        if (_cnt156 >= 1) {
                            break _loop156;
                        } else {
                            throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
                        }
                    }
            }
            _cnt156++;
        } while (true);
    }
    _ttype = Token.SKIP;
    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 37 with NoViableAltForCharException

use of antlr.NoViableAltForCharException in project ili2db by claeis.

the class SqlLexer 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 '\t':
                    case '\n':
                    case '\u000c':
                    case '\r':
                    case ' ':
                        {
                            mWS(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case ',':
                        {
                            mCOMMA(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '.':
                        {
                            mDOT(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '?':
                        {
                            mQUESTION(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '(':
                        {
                            mLPAREN(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case ')':
                        {
                            mRPAREN(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '=':
                        {
                            mEQUALS(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '\'':
                        {
                            mSTRING(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case '+':
                    case '-':
                    case '0':
                    case '1':
                    case '2':
                    case '3':
                    case '4':
                    case '5':
                    case '6':
                    case '7':
                    case '8':
                    case '9':
                        {
                            mNUMBER(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    case 'A':
                    case 'B':
                    case 'C':
                    case 'D':
                    case 'E':
                    case 'F':
                    case 'G':
                    case 'H':
                    case 'I':
                    case 'J':
                    case 'K':
                    case 'L':
                    case 'M':
                    case 'N':
                    case 'O':
                    case 'P':
                    case 'Q':
                    case 'R':
                    case 'S':
                    case 'T':
                    case 'U':
                    case 'V':
                    case 'W':
                    case 'X':
                    case 'Y':
                    case 'Z':
                    case '_':
                    case 'a':
                    case 'b':
                    case 'c':
                    case 'd':
                    case 'e':
                    case 'f':
                    case 'g':
                    case 'h':
                    case 'i':
                    case 'j':
                    case 'k':
                    case 'l':
                    case 'm':
                    case 'n':
                    case 'o':
                    case 'p':
                    case 'q':
                    case 'r':
                    case 's':
                    case 't':
                    case 'u':
                    case 'v':
                    case 'w':
                    case 'x':
                    case 'y':
                    case 'z':
                        {
                            mNAME(true);
                            theRetToken = _returnToken;
                            break;
                        }
                    default:
                        {
                            if (LA(1) == EOF_CHAR) {
                                uponEOF();
                                _returnToken = makeToken(Token.EOF_TYPE);
                            } else {
                                throw new NoViableAltForCharException((char) 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);
            } else {
                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 38 with NoViableAltForCharException

use of antlr.NoViableAltForCharException in project cxf by apache.

the class IDLLexer method mML_COMMENT.

public final void mML_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype;
    Token _token = null;
    int _begin = text.length();
    _ttype = ML_COMMENT;
    int _saveIndex;
    _saveIndex = text.length();
    match("/*");
    text.setLength(_saveIndex);
    {
        _loop336: do {
            if ((LA(1) == '*') && (_tokenSet_2.member(LA(2)))) {
                {
                    int _cnt332 = 0;
                    _loop332: do {
                        if ((LA(1) == '*')) {
                            match('*');
                        } else {
                            if (_cnt332 >= 1) {
                                break _loop332;
                            }
                            throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
                        }
                        _cnt332++;
                    } while (true);
                }
                {
                    if ((LA(1) == '\n')) {
                        match('\n');
                        newline();
                    } else if ((_tokenSet_3.member(LA(1)))) {
                        {
                            match(_tokenSet_3);
                        }
                    } else {
                        throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
                    }
                }
            } else if ((LA(1) == '\n')) {
                match('\n');
                newline();
            } else if ((_tokenSet_4.member(LA(1)))) {
                {
                    match(_tokenSet_4);
                }
            } else {
                break _loop336;
            }
        } while (true);
    }
    _saveIndex = text.length();
    match("*/");
    text.setLength(_saveIndex);
    _ttype = Token.SKIP;
    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 39 with NoViableAltForCharException

use of antlr.NoViableAltForCharException in project cxf by apache.

the class IDLLexer method mCHAR_LITERAL.

public final void mCHAR_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype;
    Token _token = null;
    int _begin = text.length();
    _ttype = CHAR_LITERAL;
    int _saveIndex;
    _saveIndex = text.length();
    match('\'');
    text.setLength(_saveIndex);
    {
        if ((LA(1) == '\\')) {
            mESC(false);
        } else if ((_tokenSet_5.member(LA(1)))) {
            matchNot('\'');
        } else {
            throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
        }
    }
    _saveIndex = text.length();
    match('\'');
    text.setLength(_saveIndex);
    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 40 with NoViableAltForCharException

use of antlr.NoViableAltForCharException in project cxf by apache.

the class IDLLexer method mIDENT.

public final void mIDENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype;
    Token _token = null;
    int _begin = text.length();
    _ttype = IDENT;
    int _saveIndex;
    {
        switch(LA(1)) {
            case 'a':
            case 'b':
            case 'c':
            case 'd':
            case 'e':
            case 'f':
            case 'g':
            case 'h':
            case 'i':
            case 'j':
            case 'k':
            case 'l':
            case 'm':
            case 'n':
            case 'o':
            case 'p':
            case 'q':
            case 'r':
            case 's':
            case 't':
            case 'u':
            case 'v':
            case 'w':
            case 'x':
            case 'y':
            case 'z':
                {
                    matchRange('a', 'z');
                    break;
                }
            case 'A':
            case 'B':
            case 'C':
            case 'D':
            case 'E':
            case 'F':
            case 'G':
            case 'H':
            case 'I':
            case 'J':
            case 'K':
            case 'L':
            case 'M':
            case 'N':
            case 'O':
            case 'P':
            case 'Q':
            case 'R':
            case 'S':
            case 'T':
            case 'U':
            case 'V':
            case 'W':
            case 'X':
            case 'Y':
            case 'Z':
                {
                    matchRange('A', 'Z');
                    break;
                }
            default:
                {
                    throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
                }
        }
    }
    {
        _loop397: do {
            switch(LA(1)) {
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':
                    {
                        matchRange('a', 'z');
                        break;
                    }
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                    {
                        matchRange('A', 'Z');
                        break;
                    }
                case '_':
                    {
                        match('_');
                        break;
                    }
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                    {
                        matchRange('0', '9');
                        break;
                    }
                default:
                    {
                        break _loop397;
                    }
            }
        } while (true);
    }
    _ttype = testLiteralsTable(_ttype);
    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