// $ANTLR 2.7.4: "Tests.g" -> "TestsLexer.java"$ package cz.muni.fi.bronchus.antlrparsers; import java.io.InputStream; import antlr.TokenStreamException; import antlr.TokenStreamIOException; import antlr.TokenStreamRecognitionException; import antlr.CharStreamException; import antlr.CharStreamIOException; import antlr.ANTLRException; import java.io.Reader; import java.util.Hashtable; import antlr.CharScanner; import antlr.InputBuffer; import antlr.ByteBuffer; import antlr.CharBuffer; import antlr.Token; import antlr.CommonToken; import antlr.RecognitionException; import antlr.NoViableAltForCharException; import antlr.MismatchedCharException; import antlr.TokenStream; import antlr.ANTLRHashString; import antlr.LexerSharedInputState; import antlr.collections.impl.BitSet; import antlr.SemanticException; public class TestsLexer extends antlr.CharScanner implements TestsParserTokenTypes, TokenStream { public TestsLexer(InputStream in) { this(new ByteBuffer(in)); } public TestsLexer(Reader in) { this(new CharBuffer(in)); } public TestsLexer(InputBuffer ib) { this(new LexerSharedInputState(ib)); } public TestsLexer(LexerSharedInputState state) { super(state); caseSensitiveLiterals = true; setCaseSensitive(true); literals = new Hashtable(); } 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 '(': { mLPAREN(true); theRetToken=_returnToken; break; } case ')': { mRPAREN(true); theRetToken=_returnToken; break; } case '|': { mOR(true); theRetToken=_returnToken; break; } case '=': { mEQUAL(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': { mLETTER(true); theRetToken=_returnToken; break; } case 't': { mTRUE_LIT(true); theRetToken=_returnToken; break; } case 'f': { mFALSE_LIT(true); theRetToken=_returnToken; break; } case '#': { mORDER_INT_CONST(true); theRetToken=_returnToken; break; } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { mINT_CONST(true); theRetToken=_returnToken; break; } case '"': { mSTR_CONST(true); theRetToken=_returnToken; break; } case '\t': case '\n': case '\u000c': case '\r': case ' ': { mWS(true); theRetToken=_returnToken; break; } default: if ((LA(1)=='&') && (LA(2)=='&')) { mAND(true); theRetToken=_returnToken; } else if ((LA(1)=='!') && (LA(2)=='=')) { mNOTEQUAL(true); theRetToken=_returnToken; } else if ((LA(1)=='<') && (LA(2)=='=')) { mLE(true); theRetToken=_returnToken; } else if ((LA(1)=='>') && (LA(2)=='=')) { mGE(true); theRetToken=_returnToken; } else if ((LA(1)=='&') && (LA(2)=='b')) { mBINARY_INTEGER(true); theRetToken=_returnToken; } else if ((LA(1)=='&') && (LA(2)=='o')) { mOCTAL_INTEGER(true); theRetToken=_returnToken; } else if ((LA(1)=='&') && (LA(2)=='h')) { mHEXADECIMAL_INTEGER(true); theRetToken=_returnToken; } else if ((LA(1)=='!') && (true)) { mNOT(true); theRetToken=_returnToken; } else if ((LA(1)=='<') && (true)) { mLT(true); theRetToken=_returnToken; } else if ((LA(1)=='>') && (true)) { mGT(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());} } } if ( _returnToken==null ) continue tryAgain; // found SKIP token _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()); } } } } public final void mSEMI(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = SEMI; int _saveIndex; match(';'); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mLPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = LPAREN; int _saveIndex; match('('); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mRPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = RPAREN; int _saveIndex; match(')'); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mAND(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = AND; int _saveIndex; match("&&"); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = OR; int _saveIndex; match("||"); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mNOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = NOT; int _saveIndex; match('!'); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mEQUAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = EQUAL; int _saveIndex; match("=="); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mNOTEQUAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = NOTEQUAL; int _saveIndex; match("!="); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mLT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = LT; int _saveIndex; match('<'); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mGT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = GT; int _saveIndex; match('>'); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = LE; int _saveIndex; match("<="); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mGE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = GE; int _saveIndex; match(">="); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mLETTER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = LETTER; int _saveIndex; matchRange('A','Z'); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mTRUE_LIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = TRUE_LIT; int _saveIndex; match("true"); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mFALSE_LIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = FALSE_LIT; int _saveIndex; match("false"); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mBINARY_INTEGER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = BINARY_INTEGER; int _saveIndex; match("&b"); { int _cnt37=0; _loop37: do { switch ( LA(1)) { case '0': { match('0'); break; } case '1': { match('1'); break; } default: { if ( _cnt37>=1 ) { break _loop37; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} } } _cnt37++; } while (true); } if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mOCTAL_INTEGER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = OCTAL_INTEGER; int _saveIndex; match("&o"); { int _cnt40=0; _loop40: do { if (((LA(1) >= '0' && LA(1) <= '7'))) { matchRange('0','7'); } else { if ( _cnt40>=1 ) { break _loop40; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} } _cnt40++; } while (true); } if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mHEXADECIMAL_INTEGER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = HEXADECIMAL_INTEGER; int _saveIndex; match("&h"); { int _cnt43=0; _loop43: do { switch ( LA(1)) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { matchRange('0','9'); break; } case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': { matchRange('a','f'); break; } default: { if ( _cnt43>=1 ) { break _loop43; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} } } _cnt43++; } while (true); } if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mORDER_INT_CONST(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = ORDER_INT_CONST; int _saveIndex; match('#'); { switch ( LA(1)) { case '3': { match('3'); break; } case '4': { match('4'); break; } case '5': { match('5'); break; } case '6': { match('6'); break; } case '7': { match('7'); break; } case '8': { match('8'); break; } case '9': { match('9'); break; } default: if ((LA(1)=='1') && (LA(2)=='0')) { match("10"); } else if ((LA(1)=='1') && (LA(2)=='1')) { match("11"); } else if ((LA(1)=='1') && (LA(2)=='2')) { match("12"); } else if ((LA(1)=='1') && (LA(2)=='3')) { match("13"); } else if ((LA(1)=='1') && (LA(2)=='4')) { match("14"); } else if ((LA(1)=='1') && (LA(2)=='5')) { match("15"); } else if ((LA(1)=='1') && (LA(2)=='6')) { match("16"); } else if ((LA(1)=='1') && (LA(2)=='7')) { match("17"); } else if ((LA(1)=='1') && (LA(2)=='8')) { match("18"); } else if ((LA(1)=='1') && (LA(2)=='9')) { match("19"); } else if ((LA(1)=='2') && (LA(2)=='0')) { match("20"); } else if ((LA(1)=='2') && (LA(2)=='1')) { match("21"); } else if ((LA(1)=='2') && (LA(2)=='2')) { match("22"); } else if ((LA(1)=='2') && (LA(2)=='3')) { match("23"); } else if ((LA(1)=='2') && (LA(2)=='4')) { match("24"); } else if ((LA(1)=='2') && (LA(2)=='5')) { match("25"); } else if ((LA(1)=='2') && (LA(2)=='6')) { match("26"); } else if ((LA(1)=='1') && (true)) { match('1'); } else if ((LA(1)=='2') && (true)) { match('2'); } else { 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; } public final void mINT_CONST(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = INT_CONST; int _saveIndex; boolean isDecimal=false; { switch ( LA(1)) { case '0': { match('0'); isDecimal = true; break; } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { { matchRange('1','9'); } { _loop50: do { if (((LA(1) >= '0' && LA(1) <= '9'))) { matchRange('0','9'); } else { break _loop50; } } while (true); } isDecimal=true; break; } default: { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); } } } { if ((LA(1)=='l')) { { match('l'); } } else if (((LA(1)=='.'||LA(1)=='e'))&&(isDecimal==true)) { { switch ( LA(1)) { case '.': { match('.'); { int _cnt55=0; _loop55: do { if (((LA(1) >= '0' && LA(1) <= '9'))) { matchRange('0','9'); } else { if ( _cnt55>=1 ) { break _loop55; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} } _cnt55++; } while (true); } { if ((LA(1)=='e')) { mEXPONENT(false); } else { } } break; } case 'e': { mEXPONENT(false); break; } default: { throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); } } } _ttype = FLT_CONST; } else { } } if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } protected final void mEXPONENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = EXPONENT; int _saveIndex; { match('e'); } { 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((char)LA(1), getFilename(), getLine(), getColumn()); } } } { int _cnt61=0; _loop61: do { if (((LA(1) >= '0' && LA(1) <= '9'))) { matchRange('0','9'); } else { if ( _cnt61>=1 ) { break _loop61; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} } _cnt61++; } while (true); } if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mSTR_CONST(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = STR_CONST; int _saveIndex; match('"'); { _loop64: do { if ((_tokenSet_0.member(LA(1)))) { matchNot('"'); } else { break _loop64; } } while (true); } match('"'); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; } public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = WS; int _saveIndex; { int _cnt67=0; _loop67: do { switch ( LA(1)) { case ' ': { match(' '); break; } case '\t': { match('\t'); break; } case '\u000c': { match('\f'); break; } case '\r': { match('\r'); break; } case '\n': { match('\n'); break; } default: { if ( _cnt67>=1 ) { break _loop67; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} } } _cnt67++; } 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; } private static final long[] mk_tokenSet_0() { long[] data = new long[2048]; data[0]=-17179869185L; for (int i = 1; i<=1022; i++) { data[i]=-1L; } data[1023]=9223372036854775807L; return data; } public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); }