KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > spi > conf > util > ConfigParserTokenManager


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  */

22 package org.enhydra.spi.conf.util;
23
24 import java.io.*;
25 import java.util.*;
26
27 public class ConfigParserTokenManager implements ConfigParserConstants
28 {
29   public java.io.PrintStream JavaDoc debugStream = System.out;
30   public void setDebugStream(java.io.PrintStream JavaDoc ds) { debugStream = ds; }
31 private final int jjStopStringLiteralDfa_0(int pos, long active0)
32 {
33    switch (pos)
34    {
35       default :
36          return -1;
37    }
38 }
39 private final int jjStartNfa_0(int pos, long active0)
40 {
41    return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
42 }
43 private final int jjStopAtPos(int pos, int kind)
44 {
45    jjmatchedKind = kind;
46    jjmatchedPos = pos;
47    return pos + 1;
48 }
49 private final int jjStartNfaWithStates_0(int pos, int kind, int state)
50 {
51    jjmatchedKind = kind;
52    jjmatchedPos = pos;
53    try { curChar = input_stream.readChar(); }
54    catch(java.io.IOException JavaDoc e) { return pos + 1; }
55    return jjMoveNfa_0(state, pos + 1);
56 }
57 private final int jjMoveStringLiteralDfa0_0()
58 {
59    switch(curChar)
60    {
61       case 91:
62          return jjStopAtPos(0, 1);
63       case 93:
64          return jjStopAtPos(0, 2);
65       default :
66          return jjMoveNfa_0(17, 0);
67    }
68 }
69 private final void jjCheckNAdd(int state)
70 {
71    if (jjrounds[state] != jjround)
72    {
73       jjstateSet[jjnewStateCnt++] = state;
74       jjrounds[state] = jjround;
75    }
76 }
77 private final void jjAddStates(int start, int end)
78 {
79    do {
80       jjstateSet[jjnewStateCnt++] = jjnextStates[start];
81    } while (start++ != end);
82 }
83 private final void jjCheckNAddTwoStates(int state1, int state2)
84 {
85    jjCheckNAdd(state1);
86    jjCheckNAdd(state2);
87 }
88 private final void jjCheckNAddStates(int start, int end)
89 {
90    do {
91       jjCheckNAdd(jjnextStates[start]);
92    } while (start++ != end);
93 }
94 private final void jjCheckNAddStates(int start)
95 {
96    jjCheckNAdd(jjnextStates[start]);
97    jjCheckNAdd(jjnextStates[start + 1]);
98 }
99 static final long[] jjbitVec0 = {
100    0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
101 };
102 private final int jjMoveNfa_0(int startState, int curPos)
103 {
104    int[] nextStates;
105    int startsAt = 0;
106    jjnewStateCnt = 26;
107    int i = 1;
108    jjstateSet[0] = startState;
109    int j, kind = 0x7fffffff;
110    for (;;)
111    {
112       if (++jjround == 0x7fffffff)
113          ReInitRounds();
114       if (curChar < 64)
115       {
116          long l = 1L << curChar;
117          MatchLoop: do
118          {
119             switch(jjstateSet[--i])
120             {
121                case 17:
122                   if ((0x1ffffdbffL & l) != 0L)
123                   {
124                      if (kind > 5)
125                         kind = 5;
126                      jjCheckNAdd(16);
127                   }
128                   else if ((0xdffffff600000000L & l) != 0L)
129                   {
130                      if (kind > 4)
131                         kind = 4;
132                      jjCheckNAdd(15);
133                   }
134                   else if ((0x2400L & l) != 0L)
135                   {
136                      if (kind > 8)
137                         kind = 8;
138                   }
139                   else if (curChar == 61)
140                   {
141                      if (kind > 15)
142                         kind = 15;
143                   }
144                   else if (curChar == 35)
145                      jjCheckNAddStates(0, 2);
146                   if (curChar == 13)
147                      jjstateSet[jjnewStateCnt++] = 23;
148                   break;
149                case 0:
150                   if (curChar == 46)
151                      jjCheckNAddStates(3, 7);
152                   break;
153                case 2:
154                   if (curChar == 52)
155                      jjstateSet[jjnewStateCnt++] = 1;
156                   break;
157                case 7:
158                   if (curChar == 52)
159                      jjstateSet[jjnewStateCnt++] = 6;
160                   break;
161                case 11:
162                   if ((0xffffffffffffdbffL & l) != 0L)
163                      jjCheckNAddStates(8, 10);
164                   break;
165                case 12:
166                   if ((0x2400L & l) != 0L && kind > 3)
167                      kind = 3;
168                   break;
169                case 13:
170                   if (curChar == 10 && kind > 3)
171                      kind = 3;
172                   break;
173                case 14:
174                   if (curChar == 13)
175                      jjstateSet[jjnewStateCnt++] = 13;
176                   break;
177                case 15:
178                   if ((0xdffffff600000000L & l) == 0L)
179                      break;
180                   if (kind > 4)
181                      kind = 4;
182                   jjCheckNAdd(15);
183                   break;
184                case 16:
185                   if ((0x1ffffdbffL & l) == 0L)
186                      break;
187                   if (kind > 5)
188                      kind = 5;
189                   jjCheckNAdd(16);
190                   break;
191                case 18:
192                   if ((0xffffffffffffdbffL & l) != 0L)
193                      jjCheckNAddStates(0, 2);
194                   break;
195                case 19:
196                   if ((0x2400L & l) != 0L && kind > 6)
197                      kind = 6;
198                   break;
199                case 20:
200                   if (curChar == 10 && kind > 6)
201                      kind = 6;
202                   break;
203                case 21:
204                   if (curChar == 13)
205                      jjstateSet[jjnewStateCnt++] = 20;
206                   break;
207                case 22:
208                   if ((0x2400L & l) != 0L && kind > 8)
209                      kind = 8;
210                   break;
211                case 23:
212                   if (curChar == 10 && kind > 8)
213                      kind = 8;
214                   break;
215                case 24:
216                   if (curChar == 13)
217                      jjstateSet[jjnewStateCnt++] = 23;
218                   break;
219                case 25:
220                   if (curChar == 61 && kind > 15)
221                      kind = 15;
222                   break;
223                default : break;
224             }
225          } while(i != startsAt);
226       }
227       else if (curChar < 128)
228       {
229          long l = 1L << (curChar & 077);
230          MatchLoop: do
231          {
232             switch(jjstateSet[--i])
233             {
234                case 17:
235                   if ((0x7fffffffd7ffffffL & l) != 0L)
236                   {
237                      if (kind > 4)
238                         kind = 4;
239                      jjCheckNAdd(15);
240                   }
241                   else if (curChar == 127)
242                   {
243                      if (kind > 5)
244                         kind = 5;
245                      jjCheckNAdd(16);
246                   }
247                   if (curChar == 76)
248                      jjstateSet[jjnewStateCnt++] = 9;
249                   else if (curChar == 108)
250                      jjstateSet[jjnewStateCnt++] = 4;
251                   break;
252                case 1:
253                   if (curChar == 106)
254                      jjCheckNAdd(0);
255                   break;
256                case 3:
257                   if (curChar == 103)
258                      jjstateSet[jjnewStateCnt++] = 2;
259                   break;
260                case 4:
261                   if (curChar == 111)
262                      jjstateSet[jjnewStateCnt++] = 3;
263                   break;
264                case 5:
265                   if (curChar == 108)
266                      jjstateSet[jjnewStateCnt++] = 4;
267                   break;
268                case 6:
269                   if (curChar == 74)
270                      jjCheckNAdd(0);
271                   break;
272                case 8:
273                   if (curChar == 71)
274                      jjstateSet[jjnewStateCnt++] = 7;
275                   break;
276                case 9:
277                   if (curChar == 79)
278                      jjstateSet[jjnewStateCnt++] = 8;
279                   break;
280                case 10:
281                   if (curChar == 76)
282                      jjstateSet[jjnewStateCnt++] = 9;
283                   break;
284                case 11:
285                   jjAddStates(8, 10);
286                   break;
287                case 15:
288                   if ((0x7fffffffd7ffffffL & l) == 0L)
289                      break;
290                   if (kind > 4)
291                      kind = 4;
292                   jjCheckNAdd(15);
293                   break;
294                case 16:
295                   if (curChar != 127)
296                      break;
297                   if (kind > 5)
298                      kind = 5;
299                   jjCheckNAdd(16);
300                   break;
301                case 18:
302                   jjAddStates(0, 2);
303                   break;
304                default : break;
305             }
306          } while(i != startsAt);
307       }
308       else
309       {
310          int i2 = (curChar & 0xff) >> 6;
311          long l2 = 1L << (curChar & 077);
312          MatchLoop: do
313          {
314             switch(jjstateSet[--i])
315             {
316                case 17:
317                case 15:
318                   if ((jjbitVec0[i2] & l2) == 0L)
319                      break;
320                   if (kind > 4)
321                      kind = 4;
322                   jjCheckNAdd(15);
323                   break;
324                case 11:
325                   if ((jjbitVec0[i2] & l2) != 0L)
326                      jjAddStates(8, 10);
327                   break;
328                case 18:
329                   if ((jjbitVec0[i2] & l2) != 0L)
330                      jjAddStates(0, 2);
331                   break;
332                default : break;
333             }
334          } while(i != startsAt);
335       }
336       if (kind != 0x7fffffff)
337       {
338          jjmatchedKind = kind;
339          jjmatchedPos = curPos;
340          kind = 0x7fffffff;
341       }
342       ++curPos;
343       if ((i = jjnewStateCnt) == (startsAt = 26 - (jjnewStateCnt = startsAt)))
344          return curPos;
345       try { curChar = input_stream.readChar(); }
346       catch(java.io.IOException JavaDoc e) { return curPos; }
347    }
348 }
349 private final int jjMoveStringLiteralDfa0_1()
350 {
351    return jjMoveNfa_1(1, 0);
352 }
353 private final int jjMoveNfa_1(int startState, int curPos)
354 {
355    int[] nextStates;
356    int startsAt = 0;
357    jjnewStateCnt = 46;
358    int i = 1;
359    jjstateSet[0] = startState;
360    int j, kind = 0x7fffffff;
361    for (;;)
362    {
363       if (++jjround == 0x7fffffff)
364          ReInitRounds();
365       if (curChar < 64)
366       {
367          long l = 1L << curChar;
368          MatchLoop: do
369          {
370             switch(jjstateSet[--i])
371             {
372                case 1:
373                   if ((0x1ffffdbffL & l) != 0L)
374                   {
375                      if (kind > 5)
376                         kind = 5;
377                      jjCheckNAdd(0);
378                   }
379                   else if ((0xffffe7fa00000000L & l) != 0L)
380                   {
381                      if (kind > 10)
382                         kind = 10;
383                      jjCheckNAdd(35);
384                   }
385                   else if ((0x2400L & l) != 0L)
386                   {
387                      if (kind > 8)
388                         kind = 8;
389                   }
390                   else if (curChar == 44)
391                   {
392                      if (kind > 13)
393                         kind = 13;
394                      jjCheckNAddStates(11, 13);
395                   }
396                   else if (curChar == 43)
397                   {
398                      if (kind > 12)
399                         kind = 12;
400                      jjCheckNAddStates(14, 16);
401                   }
402                   else if (curChar == 34)
403                      jjCheckNAddStates(17, 22);
404                   if (curChar == 13)
405                      jjstateSet[jjnewStateCnt++] = 7;
406                   else if (curChar == 35)
407                      jjCheckNAddStates(23, 25);
408                   break;
409                case 0:
410                   if ((0x1ffffdbffL & l) == 0L)
411                      break;
412                   if (kind > 5)
413                      kind = 5;
414                   jjCheckNAdd(0);
415                   break;
416                case 2:
417                   if ((0xffffffffffffdbffL & l) != 0L)
418                      jjCheckNAddStates(23, 25);
419                   break;
420                case 3:
421                   if ((0x2400L & l) != 0L && kind > 6)
422                      kind = 6;
423                   break;
424                case 4:
425                   if (curChar == 10 && kind > 6)
426                      kind = 6;
427                   break;
428                case 5:
429                   if (curChar == 13)
430                      jjstateSet[jjnewStateCnt++] = 4;
431                   break;
432                case 6:
433                   if ((0x2400L & l) != 0L && kind > 8)
434                      kind = 8;
435                   break;
436                case 7:
437                   if (curChar == 10 && kind > 8)
438                      kind = 8;
439                   break;
440                case 8:
441                   if (curChar == 13)
442                      jjstateSet[jjnewStateCnt++] = 7;
443                   break;
444                case 9:
445                   if (curChar == 34)
446                      jjCheckNAddStates(17, 22);
447                   break;
448                case 10:
449                   if (curChar == 43)
450                      jjCheckNAddStates(26, 34);
451                   break;
452                case 11:
453                   if ((0x1ffffdbffL & l) != 0L)
454                      jjCheckNAddStates(26, 34);
455                   break;
456                case 12:
457                   if ((0x2400L & l) != 0L)
458                      jjCheckNAddStates(17, 22);
459                   break;
460                case 13:
461                   if (curChar == 44)
462                      jjCheckNAddStates(35, 43);
463                   break;
464                case 14:
465                   if ((0x1ffffdbffL & l) != 0L)
466                      jjCheckNAddStates(35, 43);
467                   break;
468                case 15:
469                   if (curChar == 10)
470                      jjCheckNAddStates(17, 22);
471                   break;
472                case 16:
473                   if ((0xffffe7fbffffdbffL & l) != 0L)
474                      jjCheckNAddStates(17, 22);
475                   break;
476                case 17:
477                   if (curChar == 34 && kind > 9)
478                      kind = 9;
479                   break;
480                case 19:
481                   jjCheckNAddStates(17, 22);
482                   break;
483                case 22:
484                   if ((0x3ff000000000000L & l) != 0L)
485                      jjstateSet[jjnewStateCnt++] = 23;
486                   break;
487                case 23:
488                   if ((0x3ff000000000000L & l) != 0L)
489                      jjstateSet[jjnewStateCnt++] = 24;
490                   break;
491                case 24:
492                case 27:
493                   if ((0x3ff000000000000L & l) != 0L)
494                      jjCheckNAdd(25);
495                   break;
496                case 25:
497                   if ((0x3ff000000000000L & l) != 0L)
498                      jjCheckNAddStates(17, 22);
499                   break;
500                case 28:
501                case 33:
502                case 34:
503                   if (curChar == 13)
504                      jjCheckNAdd(15);
505                   break;
506                case 29:
507                   if (curChar == 13)
508                      jjCheckNAddStates(17, 22);
509                   break;
510                case 30:
511                   if ((0xf000000000000L & l) != 0L)
512                      jjstateSet[jjnewStateCnt++] = 31;
513                   break;
514                case 31:
515                   if ((0xff000000000000L & l) != 0L)
516                      jjstateSet[jjnewStateCnt++] = 32;
517                   break;
518                case 32:
519                   if ((0xff000000000000L & l) != 0L)
520                      jjCheckNAddStates(17, 22);
521                   break;
522                case 35:
523                   if ((0xffffe7fa00000000L & l) == 0L)
524                      break;
525                   if (kind > 10)
526                      kind = 10;
527                   jjCheckNAdd(35);
528                   break;
529                case 36:
530                   if (curChar != 43)
531                      break;
532                   if (kind > 12)
533                      kind = 12;
534                   jjCheckNAddStates(14, 16);
535                   break;
536                case 37:
537                   if ((0x1ffffdbffL & l) == 0L)
538                      break;
539                   if (kind > 12)
540                      kind = 12;
541                   jjCheckNAddStates(14, 16);
542                   break;
543                case 38:
544                   if ((0x2400L & l) != 0L && kind > 12)
545                      kind = 12;
546                   break;
547                case 39:
548                   if (curChar == 10 && kind > 12)
549                      kind = 12;
550                   break;
551                case 40:
552                   if (curChar == 13)
553                      jjstateSet[jjnewStateCnt++] = 39;
554                   break;
555                case 41:
556                   if (curChar != 44)
557                      break;
558                   if (kind > 13)
559                      kind = 13;
560                   jjCheckNAddStates(11, 13);
561                   break;
562                case 42:
563                   if ((0x1ffffdbffL & l) == 0L)
564                      break;
565                   if (kind > 13)
566                      kind = 13;
567                   jjCheckNAddStates(11, 13);
568                   break;
569                case 43:
570                   if ((0x2400L & l) != 0L && kind > 13)
571                      kind = 13;
572                   break;
573                case 44:
574                   if (curChar == 10 && kind > 13)
575                      kind = 13;
576                   break;
577                case 45:
578                   if (curChar == 13)
579                      jjstateSet[jjnewStateCnt++] = 44;
580                   break;
581                default : break;
582             }
583          } while(i != startsAt);
584       }
585       else if (curChar < 128)
586       {
587          long l = 1L << (curChar & 077);
588          MatchLoop: do
589          {
590             switch(jjstateSet[--i])
591             {
592                case 1:
593                   if ((0x7fffffffffffffffL & l) != 0L)
594                   {
595                      if (kind > 10)
596                         kind = 10;
597                      jjCheckNAdd(35);
598                   }
599                   else if (curChar == 127)
600                   {
601                      if (kind > 5)
602                         kind = 5;
603                      jjCheckNAdd(0);
604                   }
605                   break;
606                case 0:
607                   if (curChar != 127)
608                      break;
609                   if (kind > 5)
610                      kind = 5;
611                   jjCheckNAdd(0);
612                   break;
613                case 2:
614                   jjAddStates(23, 25);
615                   break;
616                case 11:
617                   if (curChar == 127)
618                      jjCheckNAddStates(26, 34);
619                   break;
620                case 14:
621                   if (curChar == 127)
622                      jjCheckNAddStates(35, 43);
623                   break;
624                case 16:
625                   if ((0xffffffffefffffffL & l) != 0L)
626                      jjCheckNAddStates(17, 22);
627                   break;
628                case 18:
629                   if (curChar == 92)
630                      jjAddStates(44, 45);
631                   break;
632                case 19:
633                   jjCheckNAddStates(17, 22);
634                   break;
635                case 20:
636                   if (curChar == 92)
637                      jjAddStates(46, 50);
638                   break;
639                case 21:
640                   if (curChar == 117)
641                      jjstateSet[jjnewStateCnt++] = 22;
642                   break;
643                case 22:
644                   if ((0x7e0000007eL & l) != 0L)
645                      jjstateSet[jjnewStateCnt++] = 23;
646                   break;
647                case 23:
648                   if ((0x7e0000007eL & l) != 0L)
649                      jjstateSet[jjnewStateCnt++] = 24;
650                   break;
651                case 24:
652                case 27:
653                   if ((0x7e0000007eL & l) != 0L)
654                      jjCheckNAdd(25);
655                   break;
656                case 25:
657                   if ((0x7e0000007eL & l) != 0L)
658                      jjCheckNAddStates(17, 22);
659                   break;
660                case 26:
661                   if (curChar == 120)
662                      jjstateSet[jjnewStateCnt++] = 27;
663                   break;
664                case 35:
665                   if ((0x7fffffffffffffffL & l) == 0L)
666                      break;
667                   if (kind > 10)
668                      kind = 10;
669                   jjCheckNAdd(35);
670                   break;
671                case 37:
672                   if (curChar != 127)
673                      break;
674                   if (kind > 12)
675                      kind = 12;
676                   jjAddStates(14, 16);
677                   break;
678                case 42:
679                   if (curChar != 127)
680                      break;
681                   if (kind > 13)
682                      kind = 13;
683                   jjAddStates(11, 13);
684                   break;
685                default : break;
686             }
687          } while(i != startsAt);
688       }
689       else
690       {
691          int i2 = (curChar & 0xff) >> 6;
692          long l2 = 1L << (curChar & 077);
693          MatchLoop: do
694          {
695             switch(jjstateSet[--i])
696             {
697                case 2:
698                   if ((jjbitVec0[i2] & l2) != 0L)
699                      jjAddStates(23, 25);
700                   break;
701                case 16:
702                case 19:
703                   if ((jjbitVec0[i2] & l2) != 0L)
704                      jjCheckNAddStates(17, 22);
705                   break;
706                default : break;
707             }
708          } while(i != startsAt);
709       }
710       if (kind != 0x7fffffff)
711       {
712          jjmatchedKind = kind;
713          jjmatchedPos = curPos;
714          kind = 0x7fffffff;
715       }
716       ++curPos;
717       if ((i = jjnewStateCnt) == (startsAt = 46 - (jjnewStateCnt = startsAt)))
718          return curPos;
719       try { curChar = input_stream.readChar(); }
720       catch(java.io.IOException JavaDoc e) { return curPos; }
721    }
722 }
723 static final int[] jjnextStates = {
724    18, 19, 21, 5, 10, 11, 12, 14, 11, 12, 14, 42, 43, 45, 37, 38,
725    40, 10, 13, 16, 17, 18, 20, 2, 3, 5, 10, 11, 12, 34, 13, 16,
726    17, 18, 20, 10, 13, 14, 12, 33, 16, 17, 18, 20, 19, 30, 21, 26,
727    28, 29, 15,
728 };
729 public static final String JavaDoc[] jjstrLiteralImages = {
730 "", "\133", "\135", null, null, null, null, null, null, null, null, null, null,
731 null, null, null, };
732 public static final String JavaDoc[] lexStateNames = {
733    "DEFAULT",
734    "RHS",
735 };
736 public static final int[] jjnewLexState = {
737    -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, 1,
738 };
739 static final long[] jjtoToken = {
740    0xb777L,
741 };
742 static final long[] jjtoSkip = {
743    0x8L,
744 };
745 protected SimpleCharStream input_stream;
746 private final int[] jjrounds = new int[46];
747 private final int[] jjstateSet = new int[92];
748 protected char curChar;
749 public ConfigParserTokenManager(SimpleCharStream stream)
750 {
751    if (SimpleCharStream.staticFlag)
752       throw new Error JavaDoc("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
753    input_stream = stream;
754 }
755 public ConfigParserTokenManager(SimpleCharStream stream, int lexState)
756 {
757    this(stream);
758    SwitchTo(lexState);
759 }
760 public void ReInit(SimpleCharStream stream)
761 {
762    jjmatchedPos = jjnewStateCnt = 0;
763    curLexState = defaultLexState;
764    input_stream = stream;
765    ReInitRounds();
766 }
767 private final void ReInitRounds()
768 {
769    int i;
770    jjround = 0x80000001;
771    for (i = 46; i-- > 0;)
772       jjrounds[i] = 0x80000000;
773 }
774 public void ReInit(SimpleCharStream stream, int lexState)
775 {
776    ReInit(stream);
777    SwitchTo(lexState);
778 }
779 public void SwitchTo(int lexState)
780 {
781    if (lexState >= 2 || lexState < 0)
782       throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
783    else
784       curLexState = lexState;
785 }
786
787 protected Token jjFillToken()
788 {
789    Token t = Token.newToken(jjmatchedKind);
790    t.kind = jjmatchedKind;
791    String JavaDoc im = jjstrLiteralImages[jjmatchedKind];
792    t.image = (im == null) ? input_stream.GetImage() : im;
793    t.beginLine = input_stream.getBeginLine();
794    t.beginColumn = input_stream.getBeginColumn();
795    t.endLine = input_stream.getEndLine();
796    t.endColumn = input_stream.getEndColumn();
797    return t;
798 }
799
800 int curLexState = 0;
801 int defaultLexState = 0;
802 int jjnewStateCnt;
803 int jjround;
804 int jjmatchedPos;
805 int jjmatchedKind;
806
807 public Token getNextToken()
808 {
809   int kind;
810   Token specialToken = null;
811   Token matchedToken;
812   int curPos = 0;
813
814   EOFLoop :
815   for (;;)
816   {
817    try
818    {
819       curChar = input_stream.BeginToken();
820    }
821    catch(java.io.IOException JavaDoc e)
822    {
823       jjmatchedKind = 0;
824       matchedToken = jjFillToken();
825       return matchedToken;
826    }
827
828    switch(curLexState)
829    {
830      case 0:
831        jjmatchedKind = 0x7fffffff;
832        jjmatchedPos = 0;
833        curPos = jjMoveStringLiteralDfa0_0();
834        break;
835      case 1:
836        jjmatchedKind = 0x7fffffff;
837        jjmatchedPos = 0;
838        curPos = jjMoveStringLiteralDfa0_1();
839        break;
840    }
841      if (jjmatchedKind != 0x7fffffff)
842      {
843         if (jjmatchedPos + 1 < curPos)
844            input_stream.backup(curPos - jjmatchedPos - 1);
845         if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
846         {
847            matchedToken = jjFillToken();
848        if (jjnewLexState[jjmatchedKind] != -1)
849          curLexState = jjnewLexState[jjmatchedKind];
850            return matchedToken;
851         }
852         else
853         {
854          if (jjnewLexState[jjmatchedKind] != -1)
855            curLexState = jjnewLexState[jjmatchedKind];
856            continue EOFLoop;
857         }
858      }
859      int error_line = input_stream.getEndLine();
860      int error_column = input_stream.getEndColumn();
861      String JavaDoc error_after = null;
862      boolean EOFSeen = false;
863      try { input_stream.readChar(); input_stream.backup(1); }
864      catch (java.io.IOException JavaDoc e1) {
865         EOFSeen = true;
866         error_after = curPos <= 1 ? "" : input_stream.GetImage();
867         if (curChar == '\n' || curChar == '\r') {
868            error_line++;
869            error_column = 0;
870         }
871         else
872            error_column++;
873      }
874      if (!EOFSeen) {
875         input_stream.backup(1);
876         error_after = curPos <= 1 ? "" : input_stream.GetImage();
877      }
878      throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
879   }
880 }
881
882 }
883
Popular Tags