001    // $ANTLR 2.7.5 (20050128): "../src/csheets/ext/assertion/AssertionParser.g" -> "AssertionLexer.java"$
002    package csheets.ext.assertion;
003    import java.io.InputStream;
004    import java.io.Reader;
005    import java.util.Hashtable;
006    
007    import antlr.ByteBuffer;
008    import antlr.CharBuffer;
009    import antlr.CharStreamException;
010    import antlr.CharStreamIOException;
011    import antlr.InputBuffer;
012    import antlr.LexerSharedInputState;
013    import antlr.NoViableAltForCharException;
014    import antlr.RecognitionException;
015    import antlr.Token;
016    import antlr.TokenStream;
017    import antlr.TokenStreamException;
018    import antlr.TokenStreamIOException;
019    import antlr.TokenStreamRecognitionException;
020    import antlr.collections.impl.BitSet;
021    @SuppressWarnings("all")
022    public class AssertionLexer extends antlr.CharScanner implements AssertionParserTokenTypes, TokenStream
023     {
024    
025    
026    public AssertionLexer(InputStream in) {
027            this(new ByteBuffer(in));
028    }
029    public AssertionLexer(Reader in) {
030            this(new CharBuffer(in));
031    }
032    public AssertionLexer(InputBuffer ib) {
033            this(new LexerSharedInputState(ib));
034    }
035    public AssertionLexer(LexerSharedInputState state) {
036            super(state);
037            caseSensitiveLiterals = false;
038            setCaseSensitive(false);
039            literals = new Hashtable();
040    }
041    
042    public Token nextToken() throws TokenStreamException {
043            Token theRetToken=null;
044    tryAgain:
045            for (;;) {
046                    Token _token = null;
047                    int _ttype = Token.INVALID_TYPE;
048                    resetText();
049                    try {   // for char stream error handling
050                            try {   // for lexical error handling
051                                    switch ( LA(1)) {
052                                    case '\t':  case '\n':  case '\r':  case ' ':
053                                    {
054                                            mWS(true);
055                                            theRetToken=_returnToken;
056                                            break;
057                                    }
058                                    case ',':
059                                    {
060                                            mCOMMA(true);
061                                            theRetToken=_returnToken;
062                                            break;
063                                    }
064                                    case '[':
065                                    {
066                                            mLBRACK(true);
067                                            theRetToken=_returnToken;
068                                            break;
069                                    }
070                                    case ']':
071                                    {
072                                            mRBRACK(true);
073                                            theRetToken=_returnToken;
074                                            break;
075                                    }
076                                    case '-':  case '.':  case '0':  case '1':
077                                    case '2':  case '3':  case '4':  case '5':
078                                    case '6':  case '7':  case '8':  case '9':
079                                    {
080                                            mNUMBER(true);
081                                            theRetToken=_returnToken;
082                                            break;
083                                    }
084                                    case 'e':
085                                    {
086                                            mEXCEPT(true);
087                                            theRetToken=_returnToken;
088                                            break;
089                                    }
090                                    case 'i':
091                                    {
092                                            mINTEGER(true);
093                                            theRetToken=_returnToken;
094                                            break;
095                                    }
096                                    case 'o':
097                                    {
098                                            mOR(true);
099                                            theRetToken=_returnToken;
100                                            break;
101                                    }
102                                    case 't':
103                                    {
104                                            mTO(true);
105                                            theRetToken=_returnToken;
106                                            break;
107                                    }
108                                    default:
109                                            if ((LA(1)=='>') && (LA(2)=='=')) {
110                                                    mGTEQ(true);
111                                                    theRetToken=_returnToken;
112                                            }
113                                            else if ((LA(1)=='<') && (LA(2)=='=')) {
114                                                    mLTEQ(true);
115                                                    theRetToken=_returnToken;
116                                            }
117                                            else if ((LA(1)=='>') && (true)) {
118                                                    mGT(true);
119                                                    theRetToken=_returnToken;
120                                            }
121                                            else if ((LA(1)=='<') && (true)) {
122                                                    mLT(true);
123                                                    theRetToken=_returnToken;
124                                            }
125                                    else {
126                                            if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
127                                    else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
128                                    }
129                                    }
130                                    if ( _returnToken==null ) continue tryAgain; // found SKIP token
131                                    _ttype = _returnToken.getType();
132                                    _ttype = testLiteralsTable(_ttype);
133                                    _returnToken.setType(_ttype);
134                                    return _returnToken;
135                            }
136                            catch (RecognitionException e) {
137                                    throw new TokenStreamRecognitionException(e);
138                            }
139                    }
140                    catch (CharStreamException cse) {
141                            if ( cse instanceof CharStreamIOException ) {
142                                    throw new TokenStreamIOException(((CharStreamIOException)cse).io);
143                            }
144                            else {
145                                    throw new TokenStreamException(cse.getMessage());
146                            }
147                    }
148            }
149    }
150    
151            protected final void mEOL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
152                    int _ttype; Token _token=null; int _begin=text.length();
153                    _ttype = EOL;
154                    int _saveIndex;
155                    
156                    {
157                    boolean synPredMatched22 = false;
158                    if (((LA(1)=='\r') && (LA(2)=='\n'))) {
159                            int _m22 = mark();
160                            synPredMatched22 = true;
161                            inputState.guessing++;
162                            try {
163                                    {
164                                    match("\r\n");
165                                    }
166                            }
167                            catch (RecognitionException pe) {
168                                    synPredMatched22 = false;
169                            }
170                            rewind(_m22);
171                            inputState.guessing--;
172                    }
173                    if ( synPredMatched22 ) {
174                            match("\r\n");
175                    }
176                    else if ((LA(1)=='\r') && (true)) {
177                            match('\r');
178                    }
179                    else if ((LA(1)=='\n')) {
180                            match('\n');
181                    }
182                    else {
183                            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
184                    }
185                    
186                    }
187                    if ( inputState.guessing==0 ) {
188                            newline(); text.setLength(_begin); text.append("end of line");
189                    }
190                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
191                            _token = makeToken(_ttype);
192                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
193                    }
194                    _returnToken = _token;
195            }
196            
197            public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
198                    int _ttype; Token _token=null; int _begin=text.length();
199                    _ttype = WS;
200                    int _saveIndex;
201                    
202                    {
203                    switch ( LA(1)) {
204                    case ' ':
205                    {
206                            match(' ');
207                            break;
208                    }
209                    case '\t':
210                    {
211                            match('\t');
212                            break;
213                    }
214                    case '\n':  case '\r':
215                    {
216                            mEOL(false);
217                            break;
218                    }
219                    default:
220                    {
221                            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
222                    }
223                    }
224                    }
225                    if ( inputState.guessing==0 ) {
226                            _ttype = Token.SKIP;
227                    }
228                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
229                            _token = makeToken(_ttype);
230                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
231                    }
232                    _returnToken = _token;
233            }
234            
235            public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
236                    int _ttype; Token _token=null; int _begin=text.length();
237                    _ttype = COMMA;
238                    int _saveIndex;
239                    
240                    match(',');
241                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
242                            _token = makeToken(_ttype);
243                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
244                    }
245                    _returnToken = _token;
246            }
247            
248            public final void mGT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
249                    int _ttype; Token _token=null; int _begin=text.length();
250                    _ttype = GT;
251                    int _saveIndex;
252                    
253                    match(">");
254                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
255                            _token = makeToken(_ttype);
256                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
257                    }
258                    _returnToken = _token;
259            }
260            
261            public final void mLT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
262                    int _ttype; Token _token=null; int _begin=text.length();
263                    _ttype = LT;
264                    int _saveIndex;
265                    
266                    match("<");
267                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
268                            _token = makeToken(_ttype);
269                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
270                    }
271                    _returnToken = _token;
272            }
273            
274            public final void mGTEQ(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
275                    int _ttype; Token _token=null; int _begin=text.length();
276                    _ttype = GTEQ;
277                    int _saveIndex;
278                    
279                    match(">=");
280                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
281                            _token = makeToken(_ttype);
282                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
283                    }
284                    _returnToken = _token;
285            }
286            
287            public final void mLTEQ(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
288                    int _ttype; Token _token=null; int _begin=text.length();
289                    _ttype = LTEQ;
290                    int _saveIndex;
291                    
292                    match("<=");
293                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
294                            _token = makeToken(_ttype);
295                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
296                    }
297                    _returnToken = _token;
298            }
299            
300            public final void mLBRACK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
301                    int _ttype; Token _token=null; int _begin=text.length();
302                    _ttype = LBRACK;
303                    int _saveIndex;
304                    
305                    match("[");
306                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
307                            _token = makeToken(_ttype);
308                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
309                    }
310                    _returnToken = _token;
311            }
312            
313            public final void mRBRACK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
314                    int _ttype; Token _token=null; int _begin=text.length();
315                    _ttype = RBRACK;
316                    int _saveIndex;
317                    
318                    match("]");
319                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
320                            _token = makeToken(_ttype);
321                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
322                    }
323                    _returnToken = _token;
324            }
325            
326            protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
327                    int _ttype; Token _token=null; int _begin=text.length();
328                    _ttype = DIGIT;
329                    int _saveIndex;
330                    
331                    matchRange('0','9');
332                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
333                            _token = makeToken(_ttype);
334                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
335                    }
336                    _returnToken = _token;
337            }
338            
339            public final void mNUMBER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
340                    int _ttype; Token _token=null; int _begin=text.length();
341                    _ttype = NUMBER;
342                    int _saveIndex;
343                    
344                    boolean synPredMatched38 = false;
345                    if (((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2))))) {
346                            int _m38 = mark();
347                            synPredMatched38 = true;
348                            inputState.guessing++;
349                            try {
350                                    {
351                                    {
352                                    switch ( LA(1)) {
353                                    case '-':
354                                    {
355                                            mMINUS(false);
356                                            break;
357                                    }
358                                    case '.':  case '0':  case '1':  case '2':
359                                    case '3':  case '4':  case '5':  case '6':
360                                    case '7':  case '8':  case '9':
361                                    {
362                                            break;
363                                    }
364                                    default:
365                                    {
366                                            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
367                                    }
368                                    }
369                                    }
370                                    {
371                                    _loop37:
372                                    do {
373                                            if (((LA(1) >= '0' && LA(1) <= '9'))) {
374                                                    mDIGIT(false);
375                                            }
376                                            else {
377                                                    break _loop37;
378                                            }
379                                            
380                                    } while (true);
381                                    }
382                                    match('.');
383                                    }
384                            }
385                            catch (RecognitionException pe) {
386                                    synPredMatched38 = false;
387                            }
388                            rewind(_m38);
389                            inputState.guessing--;
390                    }
391                    if ( synPredMatched38 ) {
392                            {
393                            switch ( LA(1)) {
394                            case '-':
395                            {
396                                    mMINUS(false);
397                                    break;
398                            }
399                            case '.':  case '0':  case '1':  case '2':
400                            case '3':  case '4':  case '5':  case '6':
401                            case '7':  case '8':  case '9':
402                            {
403                                    break;
404                            }
405                            default:
406                            {
407                                    throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
408                            }
409                            }
410                            }
411                            {
412                            _loop41:
413                            do {
414                                    if (((LA(1) >= '0' && LA(1) <= '9'))) {
415                                            mDIGIT(false);
416                                    }
417                                    else {
418                                            break _loop41;
419                                    }
420                                    
421                            } while (true);
422                            }
423                            match('.');
424                            {
425                            int _cnt43=0;
426                            _loop43:
427                            do {
428                                    if (((LA(1) >= '0' && LA(1) <= '9'))) {
429                                            mDIGIT(false);
430                                    }
431                                    else {
432                                            if ( _cnt43>=1 ) { break _loop43; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
433                                    }
434                                    
435                                    _cnt43++;
436                            } while (true);
437                            }
438                            {
439                            if ((LA(1)=='e')) {
440                                    mEXPONENT(false);
441                            }
442                            else {
443                            }
444                            
445                            }
446                    }
447                    else if ((_tokenSet_2.member(LA(1))) && (true)) {
448                            {
449                            switch ( LA(1)) {
450                            case '-':
451                            {
452                                    mMINUS(false);
453                                    break;
454                            }
455                            case '0':  case '1':  case '2':  case '3':
456                            case '4':  case '5':  case '6':  case '7':
457                            case '8':  case '9':
458                            {
459                                    break;
460                            }
461                            default:
462                            {
463                                    throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
464                            }
465                            }
466                            }
467                            {
468                            int _cnt47=0;
469                            _loop47:
470                            do {
471                                    if (((LA(1) >= '0' && LA(1) <= '9'))) {
472                                            mDIGIT(false);
473                                    }
474                                    else {
475                                            if ( _cnt47>=1 ) { break _loop47; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
476                                    }
477                                    
478                                    _cnt47++;
479                            } while (true);
480                            }
481                            {
482                            if ((LA(1)=='e')) {
483                                    mEXPONENT(false);
484                            }
485                            else {
486                            }
487                            
488                            }
489                    }
490                    else {
491                            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
492                    }
493                    
494                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
495                            _token = makeToken(_ttype);
496                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
497                    }
498                    _returnToken = _token;
499            }
500            
501            protected final void mMINUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
502                    int _ttype; Token _token=null; int _begin=text.length();
503                    _ttype = MINUS;
504                    int _saveIndex;
505                    
506                    match('-');
507                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
508                            _token = makeToken(_ttype);
509                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
510                    }
511                    _returnToken = _token;
512            }
513            
514            protected final void mEXPONENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
515                    int _ttype; Token _token=null; int _begin=text.length();
516                    _ttype = EXPONENT;
517                    int _saveIndex;
518                    
519                    match('e');
520                    {
521                    switch ( LA(1)) {
522                    case '+':
523                    {
524                            match('+');
525                            break;
526                    }
527                    case '-':
528                    {
529                            match('-');
530                            break;
531                    }
532                    case '0':  case '1':  case '2':  case '3':
533                    case '4':  case '5':  case '6':  case '7':
534                    case '8':  case '9':
535                    {
536                            break;
537                    }
538                    default:
539                    {
540                            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
541                    }
542                    }
543                    }
544                    {
545                    int _cnt54=0;
546                    _loop54:
547                    do {
548                            if (((LA(1) >= '0' && LA(1) <= '9'))) {
549                                    mDIGIT(false);
550                            }
551                            else {
552                                    if ( _cnt54>=1 ) { break _loop54; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
553                            }
554                            
555                            _cnt54++;
556                    } while (true);
557                    }
558                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
559                            _token = makeToken(_ttype);
560                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
561                    }
562                    _returnToken = _token;
563            }
564            
565            protected final void mPLUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
566                    int _ttype; Token _token=null; int _begin=text.length();
567                    _ttype = PLUS;
568                    int _saveIndex;
569                    
570                    match('+');
571                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
572                            _token = makeToken(_ttype);
573                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
574                    }
575                    _returnToken = _token;
576            }
577            
578            public final void mEXCEPT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
579                    int _ttype; Token _token=null; int _begin=text.length();
580                    _ttype = EXCEPT;
581                    int _saveIndex;
582                    
583                    match("except");
584                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
585                            _token = makeToken(_ttype);
586                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
587                    }
588                    _returnToken = _token;
589            }
590            
591            public final void mINTEGER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
592                    int _ttype; Token _token=null; int _begin=text.length();
593                    _ttype = INTEGER;
594                    int _saveIndex;
595                    
596                    match("integer");
597                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
598                            _token = makeToken(_ttype);
599                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
600                    }
601                    _returnToken = _token;
602            }
603            
604            public final void mOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
605                    int _ttype; Token _token=null; int _begin=text.length();
606                    _ttype = OR;
607                    int _saveIndex;
608                    
609                    match("or");
610                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
611                            _token = makeToken(_ttype);
612                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
613                    }
614                    _returnToken = _token;
615            }
616            
617            public final void mTO(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
618                    int _ttype; Token _token=null; int _begin=text.length();
619                    _ttype = TO;
620                    int _saveIndex;
621                    
622                    match("to");
623                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
624                            _token = makeToken(_ttype);
625                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
626                    }
627                    _returnToken = _token;
628            }
629            
630            
631            private static final long[] mk_tokenSet_0() {
632                    long[] data = { 288054454291267584L, 0L, 0L};
633                    return data;
634            }
635            public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
636            private static final long[] mk_tokenSet_1() {
637                    long[] data = { 288019269919178752L, 0L, 0L};
638                    return data;
639            }
640            public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
641            private static final long[] mk_tokenSet_2() {
642                    long[] data = { 287984085547089920L, 0L, 0L};
643                    return data;
644            }
645            public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
646            
647            }