use of antlr.NoViableAltForCharException in project sonar-java by SonarSource.
the class ValidWhenLexer 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 '\r':
case ' ':
{
mWS(true);
theRetToken = _returnToken;
break;
}
case '-':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
{
mDECIMAL_LITERAL(true);
theRetToken = _returnToken;
break;
}
case '"':
case '\'':
{
mSTRING_LITERAL(true);
theRetToken = _returnToken;
break;
}
case '[':
{
mLBRACKET(true);
theRetToken = _returnToken;
break;
}
case ']':
{
mRBRACKET(true);
theRetToken = _returnToken;
break;
}
case '(':
{
mLPAREN(true);
theRetToken = _returnToken;
break;
}
case ')':
{
mRPAREN(true);
theRetToken = _returnToken;
break;
}
case '*':
{
mTHIS(true);
theRetToken = _returnToken;
break;
}
case '.':
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':
{
mIDENTIFIER(true);
theRetToken = _returnToken;
break;
}
case '=':
{
mEQUALSIGN(true);
theRetToken = _returnToken;
break;
}
case '!':
{
mNOTEQUALSIGN(true);
theRetToken = _returnToken;
break;
}
default:
if ((LA(1) == '0') && (LA(2) == 'x')) {
mHEX_LITERAL(true);
theRetToken = _returnToken;
} else if ((LA(1) == '<') && (LA(2) == '=')) {
mLESSEQUALSIGN(true);
theRetToken = _returnToken;
} else if ((LA(1) == '>') && (LA(2) == '=')) {
mGREATEREQUALSIGN(true);
theRetToken = _returnToken;
} else if ((LA(1) == '0') && (true)) {
mOCTAL_LITERAL(true);
theRetToken = _returnToken;
} else if ((LA(1) == '<') && (true)) {
mLESSTHANSIGN(true);
theRetToken = _returnToken;
} else if ((LA(1) == '>') && (true)) {
mGREATERTHANSIGN(true);
theRetToken = _returnToken;
} else {
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();
_ttype = testLiteralsTable(_ttype);
_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());
}
}
}
}
use of antlr.NoViableAltForCharException in project ili2db by claeis.
the class SqlLexer method mHEXDIGIT.
protected final void mHEXDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype;
Token _token = null;
int _begin = text.length();
_ttype = HEXDIGIT;
int _saveIndex;
switch(LA(1)) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
{
mDIGIT(false);
break;
}
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
{
matchRange('a', 'f');
break;
}
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
{
matchRange('A', 'F');
break;
}
default:
{
throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
}
}
if (_createToken && _token == null && _ttype != Token.SKIP) {
_token = makeToken(_ttype);
_token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
_returnToken = _token;
}
use of antlr.NoViableAltForCharException in project ili2db by claeis.
the class SqlLexer method mLETTER.
protected final void mLETTER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype;
Token _token = null;
int _begin = text.length();
_ttype = LETTER;
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((char) LA(1), getFilename(), getLine(), getColumn());
}
}
if (_createToken && _token == null && _ttype != Token.SKIP) {
_token = makeToken(_ttype);
_token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
_returnToken = _token;
}
use of antlr.NoViableAltForCharException in project ili2db by claeis.
the class SqlLexer method mPOSINT.
protected final void mPOSINT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype;
Token _token = null;
int _begin = text.length();
_ttype = POSINT;
int _saveIndex;
{
int _cnt174 = 0;
_loop174: do {
if (((LA(1) >= '0' && LA(1) <= '9'))) {
mDIGIT(false);
} else {
if (_cnt174 >= 1) {
break _loop174;
} else {
throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
}
}
_cnt174++;
} while (true);
}
if (_createToken && _token == null && _ttype != Token.SKIP) {
_token = makeToken(_ttype);
_token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
_returnToken = _token;
}
use of antlr.NoViableAltForCharException in project ili2db by claeis.
the class SqlLexer method mNAME.
public final void mNAME(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype;
Token _token = null;
int _begin = text.length();
_ttype = NAME;
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':
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':
{
mLETTER(false);
break;
}
case '_':
{
match('_');
break;
}
default:
{
throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
}
}
}
{
_loop180: 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':
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':
{
mLETTER(false);
break;
}
case '_':
{
match('_');
break;
}
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
{
mDIGIT(false);
break;
}
default:
{
break _loop180;
}
}
} 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;
}
Aggregations