KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sablecc > sablecc > syntax3 > lexer > Lexer


1 /* This file was generated by SableCC (http://www.sablecc.org/). */
2
3 package org.sablecc.sablecc.syntax3.lexer;
4
5 import java.io.*;
6 import org.sablecc.sablecc.syntax3.node.*;
7
8 @SuppressWarnings JavaDoc("nls")
9 public class Lexer
10 {
11     protected Token token;
12     protected State state = State.INITIAL;
13
14     private PushbackReader in;
15     private int line;
16     private int pos;
17     private boolean cr;
18     private boolean eof;
19     private final StringBuffer JavaDoc text = new StringBuffer JavaDoc();
20
21     @SuppressWarnings JavaDoc("unused")
22     protected void filter() throws LexerException, IOException
23     {
24         // Do nothing
25
}
26
27     public Lexer(@SuppressWarnings JavaDoc("hiding") PushbackReader in)
28     {
29         this.in = in;
30     }
31  
32     public Token peek() throws LexerException, IOException
33     {
34         while(this.token == null)
35         {
36             this.token = getToken();
37             filter();
38         }
39
40         return this.token;
41     }
42
43     public Token next() throws LexerException, IOException
44     {
45         while(this.token == null)
46         {
47             this.token = getToken();
48             filter();
49         }
50
51         Token result = this.token;
52         this.token = null;
53         return result;
54     }
55
56     protected Token getToken() throws IOException, LexerException
57     {
58         int dfa_state = 0;
59
60         int start_pos = this.pos;
61         int start_line = this.line;
62
63         int accept_state = -1;
64         int accept_token = -1;
65         int accept_length = -1;
66         int accept_pos = -1;
67         int accept_line = -1;
68
69         @SuppressWarnings JavaDoc("hiding") int[][][] gotoTable = Lexer.gotoTable[this.state.id()];
70         @SuppressWarnings JavaDoc("hiding") int[] accept = Lexer.accept[this.state.id()];
71         this.text.setLength(0);
72
73         while(true)
74         {
75             int c = getChar();
76
77             if(c != -1)
78             {
79                 switch(c)
80                 {
81                 case 10:
82                     if(this.cr)
83                     {
84                         this.cr = false;
85                     }
86                     else
87                     {
88                         this.line++;
89                         this.pos = 0;
90                     }
91                     break;
92                 case 13:
93                     this.line++;
94                     this.pos = 0;
95                     this.cr = true;
96                     break;
97                 default:
98                     this.pos++;
99                     this.cr = false;
100                     break;
101                 }
102
103                 this.text.append((char) c);
104
105                 do
106                 {
107                     int oldState = (dfa_state < -1) ? (-2 -dfa_state) : dfa_state;
108
109                     dfa_state = -1;
110
111                     int[][] tmp1 = gotoTable[oldState];
112                     int low = 0;
113                     int high = tmp1.length - 1;
114
115                     while(low <= high)
116                     {
117                         int middle = (low + high) / 2;
118                         int[] tmp2 = tmp1[middle];
119
120                         if(c < tmp2[0])
121                         {
122                             high = middle - 1;
123                         }
124                         else if(c > tmp2[1])
125                         {
126                             low = middle + 1;
127                         }
128                         else
129                         {
130                             dfa_state = tmp2[2];
131                             break;
132                         }
133                     }
134                 }while(dfa_state < -1);
135             }
136             else
137             {
138                 dfa_state = -1;
139             }
140
141             if(dfa_state >= 0)
142             {
143                 if(accept[dfa_state] != -1)
144                 {
145                     accept_state = dfa_state;
146                     accept_token = accept[dfa_state];
147                     accept_length = this.text.length();
148                     accept_pos = this.pos;
149                     accept_line = this.line;
150                 }
151             }
152             else
153             {
154                 if(accept_state != -1)
155                 {
156                     switch(accept_token)
157                     {
158                     case 0:
159                         {
160                             @SuppressWarnings JavaDoc("hiding") Token token = new0(
161                                 start_line + 1,
162                                 start_pos + 1);
163                             pushBack(accept_length);
164                             this.pos = accept_pos;
165                             this.line = accept_line;
166                             return token;
167                         }
168                     case 1:
169                         {
170                             @SuppressWarnings JavaDoc("hiding") Token token = new1(
171                                 start_line + 1,
172                                 start_pos + 1);
173                             pushBack(accept_length);
174                             this.pos = accept_pos;
175                             this.line = accept_line;
176                             return token;
177                         }
178                     case 2:
179                         {
180                             @SuppressWarnings JavaDoc("hiding") Token token = new2(
181                                 start_line + 1,
182                                 start_pos + 1);
183                             pushBack(accept_length);
184                             this.pos = accept_pos;
185                             this.line = accept_line;
186                             return token;
187                         }
188                     case 3:
189                         {
190                             @SuppressWarnings JavaDoc("hiding") Token token = new3(
191                                 start_line + 1,
192                                 start_pos + 1);
193                             pushBack(accept_length);
194                             this.pos = accept_pos;
195                             this.line = accept_line;
196                             return token;
197                         }
198                     case 4:
199                         {
200                             @SuppressWarnings JavaDoc("hiding") Token token = new4(
201                                 start_line + 1,
202                                 start_pos + 1);
203                             pushBack(accept_length);
204                             this.pos = accept_pos;
205                             this.line = accept_line;
206                             return token;
207                         }
208                     case 5:
209                         {
210                             @SuppressWarnings JavaDoc("hiding") Token token = new5(
211                                 start_line + 1,
212                                 start_pos + 1);
213                             pushBack(accept_length);
214                             this.pos = accept_pos;
215                             this.line = accept_line;
216                             return token;
217                         }
218                     case 6:
219                         {
220                             @SuppressWarnings JavaDoc("hiding") Token token = new6(
221                                 start_line + 1,
222                                 start_pos + 1);
223                             pushBack(accept_length);
224                             this.pos = accept_pos;
225                             this.line = accept_line;
226                             return token;
227                         }
228                     case 7:
229                         {
230                             @SuppressWarnings JavaDoc("hiding") Token token = new7(
231                                 start_line + 1,
232                                 start_pos + 1);
233                             pushBack(accept_length);
234                             this.pos = accept_pos;
235                             this.line = accept_line;
236                             return token;
237                         }
238                     case 8:
239                         {
240                             @SuppressWarnings JavaDoc("hiding") Token token = new8(
241                                 start_line + 1,
242                                 start_pos + 1);
243                             pushBack(accept_length);
244                             this.pos = accept_pos;
245                             this.line = accept_line;
246                             return token;
247                         }
248                     case 9:
249                         {
250                             @SuppressWarnings JavaDoc("hiding") Token token = new9(
251                                 start_line + 1,
252                                 start_pos + 1);
253                             pushBack(accept_length);
254                             this.pos = accept_pos;
255                             this.line = accept_line;
256                             return token;
257                         }
258                     case 10:
259                         {
260                             @SuppressWarnings JavaDoc("hiding") Token token = new10(
261                                 start_line + 1,
262                                 start_pos + 1);
263                             pushBack(accept_length);
264                             this.pos = accept_pos;
265                             this.line = accept_line;
266                             return token;
267                         }
268                     case 11:
269                         {
270                             @SuppressWarnings JavaDoc("hiding") Token token = new11(
271                                 start_line + 1,
272                                 start_pos + 1);
273                             pushBack(accept_length);
274                             this.pos = accept_pos;
275                             this.line = accept_line;
276                             return token;
277                         }
278                     case 12:
279                         {
280                             @SuppressWarnings JavaDoc("hiding") Token token = new12(
281                                 start_line + 1,
282                                 start_pos + 1);
283                             pushBack(accept_length);
284                             this.pos = accept_pos;
285                             this.line = accept_line;
286                             return token;
287                         }
288                     case 13:
289                         {
290                             @SuppressWarnings JavaDoc("hiding") Token token = new13(
291                                 start_line + 1,
292                                 start_pos + 1);
293                             pushBack(accept_length);
294                             this.pos = accept_pos;
295                             this.line = accept_line;
296                             return token;
297                         }
298                     case 14:
299                         {
300                             @SuppressWarnings JavaDoc("hiding") Token token = new14(
301                                 start_line + 1,
302                                 start_pos + 1);
303                             pushBack(accept_length);
304                             this.pos = accept_pos;
305                             this.line = accept_line;
306                             return token;
307                         }
308                     case 15:
309                         {
310                             @SuppressWarnings JavaDoc("hiding") Token token = new15(
311                                 start_line + 1,
312                                 start_pos + 1);
313                             pushBack(accept_length);
314                             this.pos = accept_pos;
315                             this.line = accept_line;
316                             return token;
317                         }
318                     case 16:
319                         {
320                             @SuppressWarnings JavaDoc("hiding") Token token = new16(
321                                 start_line + 1,
322                                 start_pos + 1);
323                             pushBack(accept_length);
324                             this.pos = accept_pos;
325                             this.line = accept_line;
326                             return token;
327                         }
328                     case 17:
329                         {
330                             @SuppressWarnings JavaDoc("hiding") Token token = new17(
331                                 start_line + 1,
332                                 start_pos + 1);
333                             pushBack(accept_length);
334                             this.pos = accept_pos;
335                             this.line = accept_line;
336                             return token;
337                         }
338                     case 18:
339                         {
340                             @SuppressWarnings JavaDoc("hiding") Token token = new18(
341                                 start_line + 1,
342                                 start_pos + 1);
343                             pushBack(accept_length);
344                             this.pos = accept_pos;
345                             this.line = accept_line;
346                             return token;
347                         }
348                     case 19:
349                         {
350                             @SuppressWarnings JavaDoc("hiding") Token token = new19(
351                                 start_line + 1,
352                                 start_pos + 1);
353                             pushBack(accept_length);
354                             this.pos = accept_pos;
355                             this.line = accept_line;
356                             return token;
357                         }
358                     case 20:
359                         {
360                             @SuppressWarnings JavaDoc("hiding") Token token = new20(
361                                 start_line + 1,
362                                 start_pos + 1);
363                             pushBack(accept_length);
364                             this.pos = accept_pos;
365                             this.line = accept_line;
366                             return token;
367                         }
368                     case 21:
369                         {
370                             @SuppressWarnings JavaDoc("hiding") Token token = new21(
371                                 start_line + 1,
372                                 start_pos + 1);
373                             pushBack(accept_length);
374                             this.pos = accept_pos;
375                             this.line = accept_line;
376                             return token;
377                         }
378                     case 22:
379                         {
380                             @SuppressWarnings JavaDoc("hiding") Token token = new22(
381                                 start_line + 1,
382                                 start_pos + 1);
383                             pushBack(accept_length);
384                             this.pos = accept_pos;
385                             this.line = accept_line;
386                             return token;
387                         }
388                     case 23:
389                         {
390                             @SuppressWarnings JavaDoc("hiding") Token token = new23(
391                                 start_line + 1,
392                                 start_pos + 1);
393                             pushBack(accept_length);
394                             this.pos = accept_pos;
395                             this.line = accept_line;
396                             return token;
397                         }
398                     case 24:
399                         {
400                             @SuppressWarnings JavaDoc("hiding") Token token = new24(
401                                 start_line + 1,
402                                 start_pos + 1);
403                             pushBack(accept_length);
404                             this.pos = accept_pos;
405                             this.line = accept_line;
406                             return token;
407                         }
408                     case 25:
409                         {
410                             @SuppressWarnings JavaDoc("hiding") Token token = new25(
411                                 start_line + 1,
412                                 start_pos + 1);
413                             pushBack(accept_length);
414                             this.pos = accept_pos;
415                             this.line = accept_line;
416                             return token;
417                         }
418                     case 26:
419                         {
420                             @SuppressWarnings JavaDoc("hiding") Token token = new26(
421                                 start_line + 1,
422                                 start_pos + 1);
423                             pushBack(accept_length);
424                             this.pos = accept_pos;
425                             this.line = accept_line;
426                             return token;
427                         }
428                     case 27:
429                         {
430                             @SuppressWarnings JavaDoc("hiding") Token token = new27(
431                                 start_line + 1,
432                                 start_pos + 1);
433                             pushBack(accept_length);
434                             this.pos = accept_pos;
435                             this.line = accept_line;
436                             return token;
437                         }
438                     case 28:
439                         {
440                             @SuppressWarnings JavaDoc("hiding") Token token = new28(
441                                 start_line + 1,
442                                 start_pos + 1);
443                             pushBack(accept_length);
444                             this.pos = accept_pos;
445                             this.line = accept_line;
446                             return token;
447                         }
448                     case 29:
449                         {
450                             @SuppressWarnings JavaDoc("hiding") Token token = new29(
451                                 start_line + 1,
452                                 start_pos + 1);
453                             pushBack(accept_length);
454                             this.pos = accept_pos;
455                             this.line = accept_line;
456                             return token;
457                         }
458                     case 30:
459                         {
460                             @SuppressWarnings JavaDoc("hiding") Token token = new30(
461                                 start_line + 1,
462                                 start_pos + 1);
463                             pushBack(accept_length);
464                             this.pos = accept_pos;
465                             this.line = accept_line;
466                             return token;
467                         }
468                     case 31:
469                         {
470                             @SuppressWarnings JavaDoc("hiding") Token token = new31(
471                                 start_line + 1,
472                                 start_pos + 1);
473                             pushBack(accept_length);
474                             this.pos = accept_pos;
475                             this.line = accept_line;
476                             return token;
477                         }
478                     case 32:
479                         {
480                             @SuppressWarnings JavaDoc("hiding") Token token = new32(
481                                 start_line + 1,
482                                 start_pos + 1);
483                             pushBack(accept_length);
484                             this.pos = accept_pos;
485                             this.line = accept_line;
486                             return token;
487                         }
488                     case 33:
489                         {
490                             @SuppressWarnings JavaDoc("hiding") Token token = new33(
491                                 start_line + 1,
492                                 start_pos + 1);
493                             pushBack(accept_length);
494                             this.pos = accept_pos;
495                             this.line = accept_line;
496                             return token;
497                         }
498                     case 34:
499                         {
500                             @SuppressWarnings JavaDoc("hiding") Token token = new34(
501                                 start_line + 1,
502                                 start_pos + 1);
503                             pushBack(accept_length);
504                             this.pos = accept_pos;
505                             this.line = accept_line;
506                             return token;
507                         }
508                     case 35:
509                         {
510                             @SuppressWarnings JavaDoc("hiding") Token token = new35(
511                                 start_line + 1,
512                                 start_pos + 1);
513                             pushBack(accept_length);
514                             this.pos = accept_pos;
515                             this.line = accept_line;
516                             return token;
517                         }
518                     case 36:
519                         {
520                             @SuppressWarnings JavaDoc("hiding") Token token = new36(
521                                 start_line + 1,
522                                 start_pos + 1);
523                             pushBack(accept_length);
524                             this.pos = accept_pos;
525                             this.line = accept_line;
526                             return token;
527                         }
528                     case 37:
529                         {
530                             @SuppressWarnings JavaDoc("hiding") Token token = new37(
531                                 start_line + 1,
532                                 start_pos + 1);
533                             pushBack(accept_length);
534                             this.pos = accept_pos;
535                             this.line = accept_line;
536                             return token;
537                         }
538                     case 38:
539                         {
540                             @SuppressWarnings JavaDoc("hiding") Token token = new38(
541                                 getText(accept_length),
542                                 start_line + 1,
543                                 start_pos + 1);
544                             pushBack(accept_length);
545                             this.pos = accept_pos;
546                             this.line = accept_line;
547                             return token;
548                         }
549                     case 39:
550                         {
551                             @SuppressWarnings JavaDoc("hiding") Token token = new39(
552                                 getText(accept_length),
553                                 start_line + 1,
554                                 start_pos + 1);
555                             pushBack(accept_length);
556                             this.pos = accept_pos;
557                             this.line = accept_line;
558                             return token;
559                         }
560                     case 40:
561                         {
562                             @SuppressWarnings JavaDoc("hiding") Token token = new40(
563                                 getText(accept_length),
564                                 start_line + 1,
565                                 start_pos + 1);
566                             pushBack(accept_length);
567                             this.pos = accept_pos;
568                             this.line = accept_line;
569                             return token;
570                         }
571                     case 41:
572                         {
573                             @SuppressWarnings JavaDoc("hiding") Token token = new41(
574                                 getText(accept_length),
575                                 start_line + 1,
576                                 start_pos + 1);
577                             pushBack(accept_length);
578                             this.pos = accept_pos;
579                             this.line = accept_line;
580                             return token;
581                         }
582                     case 42:
583                         {
584                             @SuppressWarnings JavaDoc("hiding") Token token = new42(
585                                 getText(accept_length),
586                                 start_line + 1,
587                                 start_pos + 1);
588                             pushBack(accept_length);
589                             this.pos = accept_pos;
590                             this.line = accept_line;
591                             return token;
592                         }
593                     case 43:
594                         {
595                             @SuppressWarnings JavaDoc("hiding") Token token = new43(
596                                 getText(accept_length),
597                                 start_line + 1,
598                                 start_pos + 1);
599                             pushBack(accept_length);
600                             this.pos = accept_pos;
601                             this.line = accept_line;
602                             return token;
603                         }
604                     case 44:
605                         {
606                             @SuppressWarnings JavaDoc("hiding") Token token = new44(
607                                 getText(accept_length),
608                                 start_line + 1,
609                                 start_pos + 1);
610                             pushBack(accept_length);
611                             this.pos = accept_pos;
612                             this.line = accept_line;
613                             return token;
614                         }
615                     case 45:
616                         {
617                             @SuppressWarnings JavaDoc("hiding") Token token = new45(
618                                 getText(accept_length),
619                                 start_line + 1,
620                                 start_pos + 1);
621                             pushBack(accept_length);
622                             this.pos = accept_pos;
623                             this.line = accept_line;
624                             return token;
625                         }
626                     case 46:
627                         {
628                             @SuppressWarnings JavaDoc("hiding") Token token = new46(
629                                 getText(accept_length),
630                                 start_line + 1,
631                                 start_pos + 1);
632                             pushBack(accept_length);
633                             this.pos = accept_pos;
634                             this.line = accept_line;
635                             return token;
636                         }
637                     case 47:
638                         {
639                             @SuppressWarnings JavaDoc("hiding") Token token = new47(
640                                 getText(accept_length),
641                                 start_line + 1,
642                                 start_pos + 1);
643                             pushBack(accept_length);
644                             this.pos = accept_pos;
645                             this.line = accept_line;
646                             return token;
647                         }
648                     case 48:
649                         {
650                             @SuppressWarnings JavaDoc("hiding") Token token = new48(
651                                 getText(accept_length),
652                                 start_line + 1,
653                                 start_pos + 1);
654                             pushBack(accept_length);
655                             this.pos = accept_pos;
656                             this.line = accept_line;
657                             return token;
658                         }
659                     }
660                 }
661                 else
662                 {
663                     if(this.text.length() > 0)
664                     {
665                         throw new LexerException(
666                             "[" + (start_line + 1) + "," + (start_pos + 1) + "]" +
667                             " Unknown token: " + this.text);
668                     }
669
670                     @SuppressWarnings JavaDoc("hiding") EOF token = new EOF(
671                         start_line + 1,
672                         start_pos + 1);
673                     return token;
674                 }
675             }
676         }
677     }
678
679     Token new0(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TAllKeyword(line, pos); }
680     Token new1(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TAnyKeyword(line, pos); }
681     Token new2(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TBackKeyword(line, pos); }
682     Token new3(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TExceptKeyword(line, pos); }
683     Token new4(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TGroupKeyword(line, pos); }
684     Token new5(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new THelpersKeyword(line, pos); }
685     Token new6(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TIgnoredKeyword(line, pos); }
686     Token new7(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TInfiniteKeyword(line, pos); }
687     Token new8(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TInternalKeyword(line, pos); }
688     Token new9(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TIntersectionKeyword(line, pos); }
689     Token new10(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TInvestigatorsKeyword(line, pos); }
690     Token new11(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TLanguageKeyword(line, pos); }
691     Token new12(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TLookaheadKeyword(line, pos); }
692     Token new13(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TLexerKeyword(line, pos); }
693     Token new14(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TNoneKeyword(line, pos); }
694     Token new15(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TOverKeyword(line, pos); }
695     Token new16(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TPrioritiesKeyword(line, pos); }
696     Token new17(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TShortestKeyword(line, pos); }
697     Token new18(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TStateKeyword(line, pos); }
698     Token new19(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TStatesKeyword(line, pos); }
699     Token new20(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TSyntaxKeyword(line, pos); }
700     Token new21(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TTokensKeyword(line, pos); }
701     Token new22(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TTransitionsKeyword(line, pos); }
702     Token new23(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TArrow(line, pos); }
703     Token new24(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TColon(line, pos); }
704     Token new25(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TComma(line, pos); }
705     Token new26(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TSemicolon(line, pos); }
706     Token new27(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TThreeDots(line, pos); }
707     Token new28(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TTwoDots(line, pos); }
708     Token new29(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TLeftParenthesis(line, pos); }
709     Token new30(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TRightParenthesis(line, pos); }
710     Token new31(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TAssign(line, pos); }
711     Token new32(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TBar(line, pos); }
712     Token new33(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TCaret(line, pos); }
713     Token new34(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TMinus(line, pos); }
714     Token new35(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TPlus(line, pos); }
715     Token new36(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TQuestionMark(line, pos); }
716     Token new37(@SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TStar(line, pos); }
717     Token new38(@SuppressWarnings JavaDoc("hiding") String JavaDoc text, @SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TIdentifier(text, line, pos); }
718     Token new39(@SuppressWarnings JavaDoc("hiding") String JavaDoc text, @SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TErroneousIdentifier(text, line, pos); }
719     Token new40(@SuppressWarnings JavaDoc("hiding") String JavaDoc text, @SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TNumber(text, line, pos); }
720     Token new41(@SuppressWarnings JavaDoc("hiding") String JavaDoc text, @SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TDecimalCharacter(text, line, pos); }
721     Token new42(@SuppressWarnings JavaDoc("hiding") String JavaDoc text, @SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new THexadecimalCharacter(text, line, pos); }
722     Token new43(@SuppressWarnings JavaDoc("hiding") String JavaDoc text, @SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TEmptyString(text, line, pos); }
723     Token new44(@SuppressWarnings JavaDoc("hiding") String JavaDoc text, @SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TCharacterToken(text, line, pos); }
724     Token new45(@SuppressWarnings JavaDoc("hiding") String JavaDoc text, @SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TString(text, line, pos); }
725     Token new46(@SuppressWarnings JavaDoc("hiding") String JavaDoc text, @SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TLongComment(text, line, pos); }
726     Token new47(@SuppressWarnings JavaDoc("hiding") String JavaDoc text, @SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TLineComment(text, line, pos); }
727     Token new48(@SuppressWarnings JavaDoc("hiding") String JavaDoc text, @SuppressWarnings JavaDoc("hiding") int line, @SuppressWarnings JavaDoc("hiding") int pos) { return new TBlanks(text, line, pos); }
728
729     private int getChar() throws IOException
730     {
731         if(this.eof)
732         {
733             return -1;
734         }
735
736         int result = this.in.read();
737
738         if(result == -1)
739         {
740             this.eof = true;
741         }
742
743         return result;
744     }
745
746     private void pushBack(int acceptLength) throws IOException
747     {
748         int length = this.text.length();
749         for(int i = length - 1; i >= acceptLength; i--)
750         {
751             this.eof = false;
752
753             this.in.unread(this.text.charAt(i));
754         }
755     }
756
757     protected void unread(@SuppressWarnings JavaDoc("hiding") Token token) throws IOException
758     {
759         @SuppressWarnings JavaDoc("hiding") String JavaDoc text = token.getText();
760         int length = text.length();
761
762         for(int i = length - 1; i >= 0; i--)
763         {
764             this.eof = false;
765
766             this.in.unread(text.charAt(i));
767         }
768
769         this.pos = token.getPos() - 1;
770         this.line = token.getLine() - 1;
771     }
772
773     private String JavaDoc getText(int acceptLength)
774     {
775         StringBuffer JavaDoc s = new StringBuffer JavaDoc(acceptLength);
776         for(int i = 0; i < acceptLength; i++)
777         {
778             s.append(this.text.charAt(i));
779         }
780
781         return s.toString();
782     }
783
784     private static int[][][][] gotoTable;
785 /* {
786         { // INITIAL
787             {{9, 9, 1}, {10, 10, 2}, {13, 13, 3}, {32, 32, 4}, {35, 35, 5}, {39, 39, 6}, {40, 40, 7}, {41, 41, 8}, {42, 42, 9}, {43, 43, 10}, {44, 44, 11}, {45, 45, 12}, {46, 46, 13}, {47, 47, 14}, {48, 57, 15}, {58, 58, 16}, {59, 59, 17}, {61, 61, 18}, {63, 63, 19}, {65, 65, 20}, {66, 66, 21}, {67, 68, 22}, {69, 69, 23}, {70, 70, 22}, {71, 71, 24}, {72, 72, 25}, {73, 73, 26}, {74, 75, 22}, {76, 76, 27}, {77, 77, 22}, {78, 78, 28}, {79, 79, 29}, {80, 80, 30}, {81, 82, 22}, {83, 83, 31}, {84, 84, 32}, {85, 90, 22}, {94, 94, 33}, {95, 95, 34}, {97, 122, 35}, {124, 124, 36}, },
788             {{9, 32, -2}, },
789             {{9, 32, -2}, },
790             {{9, 9, 1}, {10, 10, 37}, {13, 32, -2}, },
791             {{9, 32, -2}, },
792             {{48, 57, 38}, {120, 120, 39}, },
793             {{32, 38, 40}, {39, 39, 41}, {40, 126, 40}, },
794             {},
795             {},
796             {},
797             {},
798             {},
799             {{62, 62, 42}, },
800             {{46, 46, 43}, },
801             {{42, 42, 44}, {47, 47, 45}, },
802             {{48, 57, 15}, },
803             {},
804             {},
805             {},
806             {},
807             {{48, 57, 46}, {65, 90, 47}, {95, 95, 48}, {97, 107, 49}, {108, 108, 50}, {109, 109, 49}, {110, 110, 51}, {111, 122, 49}, },
808             {{48, 95, -22}, {97, 97, 52}, {98, 122, 49}, },
809             {{48, 95, -22}, {97, 122, 49}, },
810             {{48, 95, -22}, {97, 119, 49}, {120, 120, 53}, {121, 122, 49}, },
811             {{48, 95, -22}, {97, 113, 49}, {114, 114, 54}, {115, 122, 49}, },
812             {{48, 95, -22}, {97, 100, 49}, {101, 101, 55}, {102, 122, 49}, },
813             {{48, 95, -22}, {97, 102, 49}, {103, 103, 56}, {104, 109, 49}, {110, 110, 57}, {111, 122, 49}, },
814             {{48, 95, -22}, {97, 97, 58}, {98, 100, 49}, {101, 101, 59}, {102, 110, 49}, {111, 111, 60}, {112, 122, 49}, },
815             {{48, 95, -22}, {97, 110, 49}, {111, 111, 61}, {112, 122, 49}, },
816             {{48, 95, -22}, {97, 117, 49}, {118, 118, 62}, {119, 122, 49}, },
817             {{48, 113, -26}, {114, 114, 63}, {115, 122, 49}, },
818             {{48, 95, -22}, {97, 103, 49}, {104, 104, 64}, {105, 115, 49}, {116, 116, 65}, {117, 120, 49}, {121, 121, 66}, {122, 122, 49}, },
819             {{48, 110, -30}, {111, 111, 67}, {112, 113, 49}, {114, 114, 68}, {115, 122, 49}, },
820             {},
821             {{48, 122, -24}, },
822             {{48, 57, 69}, {65, 90, 47}, {95, 95, 70}, {97, 122, 71}, },
823             {},
824             {{9, 32, -2}, },
825             {{48, 57, 38}, },
826             {{48, 57, 72}, {97, 102, 72}, },
827             {{32, 38, 73}, {39, 39, 74}, {40, 126, 73}, },
828             {{39, 39, 74}, },
829             {},
830             {{46, 46, 75}, },
831             {{0, 41, 76}, {42, 42, 77}, {43, 65535, 76}, },
832             {{0, 9, 78}, {10, 10, 79}, {11, 12, 78}, {13, 13, 80}, {14, 65535, 78}, },
833             {{48, 122, -24}, },
834             {{48, 122, -24}, },
835             {{48, 122, -24}, },
836             {{48, 122, -24}, },
837             {{48, 107, -22}, {108, 108, 81}, {109, 122, 49}, },
838             {{48, 95, -22}, {97, 120, 49}, {121, 121, 82}, {122, 122, 49}, },
839             {{48, 95, -22}, {97, 98, 49}, {99, 99, 83}, {100, 122, 49}, },
840             {{48, 98, -54}, {99, 99, 84}, {100, 122, 49}, },
841             {{48, 110, -30}, {111, 111, 85}, {112, 122, 49}, },
842             {{48, 107, -22}, {108, 108, 86}, {109, 122, 49}, },
843             {{48, 95, -22}, {97, 109, 49}, {110, 110, 87}, {111, 122, 49}, },
844             {{48, 95, -22}, {97, 101, 49}, {102, 102, 88}, {103, 115, 49}, {116, 116, 89}, {117, 117, 49}, {118, 118, 90}, {119, 122, 49}, },
845             {{48, 109, -58}, {110, 110, 91}, {111, 122, 49}, },
846             {{48, 119, -25}, {120, 120, 92}, {121, 122, 49}, },
847             {{48, 110, -30}, {111, 111, 93}, {112, 122, 49}, },
848             {{48, 109, -58}, {110, 110, 94}, {111, 122, 49}, },
849             {{48, 100, -27}, {101, 101, 95}, {102, 122, 49}, },
850             {{48, 95, -22}, {97, 104, 49}, {105, 105, 96}, {106, 122, 49}, },
851             {{48, 110, -30}, {111, 111, 97}, {112, 122, 49}, },
852             {{48, 95, -22}, {97, 97, 98}, {98, 122, 49}, },
853             {{48, 109, -58}, {110, 110, 99}, {111, 122, 49}, },
854             {{48, 95, -22}, {97, 106, 49}, {107, 107, 100}, {108, 122, 49}, },
855             {{48, 95, -22}, {97, 97, 101}, {98, 122, 49}, },
856             {{48, 122, -37}, },
857             {{48, 95, -22}, {97, 122, 102}, },
858             {{48, 122, -37}, },
859             {{48, 102, -41}, },
860             {{32, 38, 73}, {39, 39, 103}, {40, 126, 73}, },
861             {},
862             {},
863             {{0, 65535, -46}, },
864             {{0, 41, 104}, {42, 42, 77}, {43, 46, 104}, {47, 47, 105}, {48, 65535, 104}, },
865             {{0, 65535, -47}, },
866             {},
867             {{10, 10, 106}, },
868             {{48, 122, -24}, },
869             {{48, 122, -24}, },
870             {{48, 106, -69}, {107, 107, 107}, {108, 122, 49}, },
871             {{48, 100, -27}, {101, 101, 108}, {102, 122, 49}, },
872             {{48, 95, -22}, {97, 116, 49}, {117, 117, 109}, {118, 122, 49}, },
873             {{48, 95, -22}, {97, 111, 49}, {112, 112, 110}, {113, 122, 49}, },
874             {{48, 110, -30}, {111, 111, 111}, {112, 122, 49}, },
875             {{48, 104, -65}, {105, 105, 112}, {106, 122, 49}, },
876             {{48, 100, -27}, {101, 101, 113}, {102, 122, 49}, },
877             {{48, 100, -27}, {101, 101, 114}, {102, 122, 49}, },
878             {{48, 102, -28}, {103, 103, 115}, {104, 122, 49}, },
879             {{48, 100, -27}, {101, 101, 116}, {102, 122, 49}, },
880             {{48, 106, -69}, {107, 107, 117}, {108, 122, 49}, },
881             {{48, 100, -27}, {101, 101, 118}, {102, 122, 49}, },
882             {{48, 113, -26}, {114, 114, 119}, {115, 122, 49}, },
883             {{48, 110, -30}, {111, 111, 120}, {112, 122, 49}, },
884             {{48, 113, -26}, {114, 114, 121}, {115, 122, 49}, },
885             {{48, 95, -22}, {97, 115, 49}, {116, 116, 122}, {117, 122, 49}, },
886             {{48, 115, -100}, {116, 116, 123}, {117, 122, 49}, },
887             {{48, 100, -27}, {101, 101, 124}, {102, 122, 49}, },
888             {{48, 109, -58}, {110, 110, 125}, {111, 122, 49}, },
889             {{48, 57, 126}, {65, 95, -37}, {97, 122, 127}, },
890             {},
891             {{0, 41, 128}, {42, 42, 77}, {43, 65535, 128}, },
892             {},
893             {},
894             {{48, 122, -24}, },
895             {{48, 111, -88}, {112, 112, 129}, {113, 122, 49}, },
896             {{48, 111, -88}, {112, 112, 130}, {113, 122, 49}, },
897             {{48, 100, -27}, {101, 101, 131}, {102, 122, 49}, },
898             {{48, 113, -26}, {114, 114, 132}, {115, 122, 49}, },
899             {{48, 109, -58}, {110, 110, 133}, {111, 122, 49}, },
900             {{48, 113, -26}, {114, 114, 134}, {115, 122, 49}, },
901             {{48, 95, -22}, {97, 114, 49}, {115, 115, 135}, {116, 122, 49}, },
902             {{48, 116, -87}, {117, 117, 136}, {118, 122, 49}, },
903             {{48, 113, -26}, {114, 114, 137}, {115, 122, 49}, },
904             {{48, 95, -22}, {97, 97, 138}, {98, 122, 49}, },
905             {{48, 122, -24}, },
906             {{48, 122, -24}, },
907             {{48, 113, -26}, {114, 114, 139}, {115, 122, 49}, },
908             {{48, 115, -100}, {116, 116, 140}, {117, 122, 49}, },
909             {{48, 100, -27}, {101, 101, 141}, {102, 122, 49}, },
910             {{48, 95, -22}, {97, 97, 142}, {98, 122, 49}, },
911             {{48, 109, -58}, {110, 110, 143}, {111, 122, 49}, },
912             {{48, 114, -116}, {115, 115, 144}, {116, 122, 49}, },
913             {{48, 122, -104}, },
914             {{48, 122, -104}, },
915             {{0, 65535, -106}, },
916             {{48, 115, -100}, {116, 116, 145}, {117, 122, 49}, },
917             {{48, 122, -24}, },
918             {{48, 113, -26}, {114, 114, 146}, {115, 122, 49}, },
919             {{48, 100, -27}, {101, 101, 147}, {102, 122, 49}, },
920             {{48, 104, -65}, {105, 105, 148}, {106, 122, 49}, },
921             {{48, 109, -58}, {110, 110, 149}, {111, 114, 49}, {115, 115, 150}, {116, 122, 49}, },
922             {{48, 115, -100}, {116, 116, 151}, {117, 122, 49}, },
923             {{48, 95, -22}, {97, 97, 152}, {98, 122, 49}, },
924             {{48, 122, -24}, },
925             {{48, 103, -33}, {104, 104, 153}, {105, 122, 49}, },
926             {{48, 104, -65}, {105, 105, 154}, {106, 122, 49}, },
927             {{48, 100, -27}, {101, 101, 155}, {102, 122, 49}, },
928             {{48, 114, -116}, {115, 115, 156}, {116, 122, 49}, },
929             {{48, 119, -25}, {120, 120, 157}, {121, 122, 49}, },
930             {{48, 114, -116}, {115, 115, 158}, {116, 122, 49}, },
931             {{48, 104, -65}, {105, 105, 159}, {106, 122, 49}, },
932             {{48, 122, -24}, },
933             {{48, 114, -116}, {115, 115, 160}, {116, 122, 49}, },
934             {{48, 95, -22}, {97, 99, 49}, {100, 100, 161}, {101, 122, 49}, },
935             {{48, 115, -100}, {116, 116, 162}, {117, 122, 49}, },
936             {{48, 95, -22}, {97, 97, 163}, {98, 122, 49}, },
937             {{48, 100, -27}, {101, 101, 164}, {102, 122, 49}, },
938             {{48, 104, -65}, {105, 105, 165}, {106, 122, 49}, },
939             {{48, 102, -28}, {103, 103, 166}, {104, 122, 49}, },
940             {{48, 100, -27}, {101, 101, 167}, {102, 122, 49}, },
941             {{48, 115, -100}, {116, 116, 168}, {117, 122, 49}, },
942             {{48, 114, -116}, {115, 115, 169}, {116, 122, 49}, },
943             {{48, 122, -24}, },
944             {{48, 122, -24}, },
945             {{48, 122, -24}, },
946             {{48, 115, -100}, {116, 116, 170}, {117, 122, 49}, },
947             {{48, 122, -24}, },
948             {{48, 122, -24}, },
949             {{48, 100, -27}, {101, 101, 171}, {102, 122, 49}, },
950             {{48, 107, -22}, {108, 108, 172}, {109, 122, 49}, },
951             {{48, 98, -54}, {99, 99, 173}, {100, 122, 49}, },
952             {{48, 102, -28}, {103, 103, 174}, {104, 122, 49}, },
953             {{48, 100, -27}, {101, 101, 175}, {102, 122, 49}, },
954             {{48, 95, -22}, {97, 97, 176}, {98, 122, 49}, },
955             {{48, 104, -65}, {105, 105, 177}, {106, 122, 49}, },
956             {{48, 115, -100}, {116, 116, 178}, {117, 122, 49}, },
957             {{48, 104, -65}, {105, 105, 179}, {106, 122, 49}, },
958             {{48, 122, -24}, },
959             {{48, 122, -24}, },
960             {{48, 115, -100}, {116, 116, 180}, {117, 122, 49}, },
961             {{48, 95, -22}, {97, 97, 181}, {98, 122, 49}, },
962             {{48, 122, -24}, },
963             {{48, 99, -149}, {100, 100, 182}, {101, 122, 49}, },
964             {{48, 100, -27}, {101, 101, 183}, {102, 122, 49}, },
965             {{48, 122, -24}, },
966             {{48, 110, -30}, {111, 111, 184}, {112, 122, 49}, },
967             {{48, 104, -65}, {105, 105, 185}, {106, 122, 49}, },
968             {{48, 115, -100}, {116, 116, 186}, {117, 122, 49}, },
969             {{48, 122, -24}, },
970             {{48, 114, -116}, {115, 115, 187}, {116, 122, 49}, },
971             {{48, 109, -58}, {110, 110, 188}, {111, 122, 49}, },
972             {{48, 110, -30}, {111, 111, 189}, {112, 122, 49}, },
973             {{48, 110, -30}, {111, 111, 190}, {112, 122, 49}, },
974             {{48, 122, -24}, },
975             {{48, 114, -116}, {115, 115, 191}, {116, 122, 49}, },
976             {{48, 109, -58}, {110, 110, 192}, {111, 122, 49}, },
977             {{48, 113, -26}, {114, 114, 193}, {115, 122, 49}, },
978             {{48, 122, -24}, },
979             {{48, 122, -24}, },
980             {{48, 114, -116}, {115, 115, 194}, {116, 122, 49}, },
981             {{48, 122, -24}, },
982         }
983     };*/

984
985     private static int[][] accept;
986 /* {
987         // INITIAL
988         {-1, 48, 48, 48, 48, -1, -1, 29, 30, 37, 35, 25, 34, -1, -1, 40, 24, 26, 31, 36, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 33, 39, 38, 32, 48, 41, -1, -1, 43, 23, 28, -1, 47, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 38, 39, 38, 42, -1, 44, 27, -1, -1, 47, 47, 47, 0, 1, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 38, 45, -1, 46, 47, 2, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 14, 15, 39, 39, 39, 39, 39, 39, 38, 38, -1, 39, 4, 39, 39, 39, 39, 39, 39, 13, 39, 39, 39, 18, 39, 39, 39, 3, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 19, 20, 21, 39, 5, 6, 39, 39, 39, 39, 39, 39, 39, 39, 39, 7, 8, 39, 39, 11, 39, 39, 17, 39, 39, 39, 12, 39, 39, 39, 39, 16, 39, 39, 39, 22, 9, 39, 10, },
989
990     };*/

991
992     public static class State
993     {
994         public final static State INITIAL = new State(0);
995
996         private int id;
997
998         private State(@SuppressWarnings JavaDoc("hiding") int id)
999         {
1000            this.id = id;
1001        }
1002
1003        public int id()
1004        {
1005            return this.id;
1006        }
1007    }
1008
1009    static
1010    {
1011        try
1012        {
1013            DataInputStream s = new DataInputStream(
1014                new BufferedInputStream(
1015                Lexer.class.getResourceAsStream("lexer.dat")));
1016
1017            // read gotoTable
1018
int length = s.readInt();
1019            gotoTable = new int[length][][][];
1020            for(int i = 0; i < gotoTable.length; i++)
1021            {
1022                length = s.readInt();
1023                gotoTable[i] = new int[length][][];
1024                for(int j = 0; j < gotoTable[i].length; j++)
1025                {
1026                    length = s.readInt();
1027                    gotoTable[i][j] = new int[length][3];
1028                    for(int k = 0; k < gotoTable[i][j].length; k++)
1029                    {
1030                        for(int l = 0; l < 3; l++)
1031                        {
1032                            gotoTable[i][j][k][l] = s.readInt();
1033                        }
1034                    }
1035                }
1036            }
1037
1038            // read accept
1039
length = s.readInt();
1040            accept = new int[length][];
1041            for(int i = 0; i < accept.length; i++)
1042            {
1043                length = s.readInt();
1044                accept[i] = new int[length];
1045                for(int j = 0; j < accept[i].length; j++)
1046                {
1047                    accept[i][j] = s.readInt();
1048                }
1049            }
1050
1051            s.close();
1052        }
1053        catch(Exception JavaDoc e)
1054        {
1055            throw new RuntimeException JavaDoc("The file \"lexer.dat\" is either missing or corrupted.");
1056        }
1057    }
1058}
1059
Popular Tags