KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > xpointer > parser > XPointerFrameworkParserTokenManager


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.components.xpointer.parser;
17
18 public class XPointerFrameworkParserTokenManager
19     implements XPointerFrameworkParserConstants {
20     public java.io.PrintStream JavaDoc debugStream = System.out;
21     public void setDebugStream(java.io.PrintStream JavaDoc ds) {
22         debugStream = ds;
23     }
24     private final int jjStopAtPos(int pos, int kind) {
25         jjmatchedKind = kind;
26         jjmatchedPos = pos;
27         return pos + 1;
28     }
29     private final int jjMoveStringLiteralDfa0_0() {
30         switch (curChar) {
31             case 40 :
32                 return jjStopAtPos(0, 10);
33             case 41 :
34                 return jjStopAtPos(0, 11);
35             default :
36                 return jjMoveNfa_0(0, 0);
37         }
38     }
39     private final void jjCheckNAdd(int state) {
40         if (jjrounds[state] != jjround) {
41             jjstateSet[jjnewStateCnt++] = state;
42             jjrounds[state] = jjround;
43         }
44     }
45     private final void jjAddStates(int start, int end) {
46         do {
47             jjstateSet[jjnewStateCnt++] = jjnextStates[start];
48         } while (start++ != end);
49     }
50     private final void jjCheckNAddTwoStates(int state1, int state2) {
51         jjCheckNAdd(state1);
52         jjCheckNAdd(state2);
53     }
54     private final void jjCheckNAddStates(int start, int end) {
55         do {
56             jjCheckNAdd(jjnextStates[start]);
57         } while (start++ != end);
58     }
59     static final long[] jjbitVec0 =
60         { 0x0L, 0xffffffffffffc000L, 0xfffff0007fffffffL, 0x7fffffL };
61     static final long[] jjbitVec2 = { 0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL };
62     static final long[] jjbitVec3 =
63         {
64             0x7ff3ffffffffffffL,
65             0x7ffffffffffffdfeL,
66             0xffffffffffffffffL,
67             0xfc31ffffffffe00fL };
68     static final long[] jjbitVec4 =
69         { 0xffffffL, 0xffffffffffff0000L, 0xf80001ffffffffffL, 0x3L };
70     static final long[] jjbitVec5 =
71         { 0x0L, 0x0L, 0xfffffffbffffd740L, 0xffffd547f7fffL };
72     static final long[] jjbitVec6 =
73         {
74             0xffffffffffffdffeL,
75             0xffffffffdffeffffL,
76             0xffffffffffff0003L,
77             0x33fcfffffff199fL };
78     static final long[] jjbitVec7 =
79         { 0xfffe000000000000L, 0xfffffffe027fffffL, 0x7fL, 0x707ffffff0000L };
80     static final long[] jjbitVec8 =
81         {
82             0x7fffffe00000000L,
83             0xfffe0000000007feL,
84             0x7cffffffffffffffL,
85             0x60002f7fffL };
86     static final long[] jjbitVec9 =
87         {
88             0x23ffffffffffffe0L,
89             0x3ff000000L,
90             0x3c5fdfffff99fe0L,
91             0x30003b0000000L };
92     static final long[] jjbitVec10 =
93         {
94             0x36dfdfffff987e0L,
95             0x1c00005e000000L,
96             0x23edfdfffffbafe0L,
97             0x100000000L };
98     static final long[] jjbitVec11 =
99         { 0x23cdfdfffff99fe0L, 0x3b0000000L, 0x3bfc718d63dc7e0L, 0x0L };
100     static final long[] jjbitVec12 =
101         { 0x3effdfffffddfe0L, 0x300000000L, 0x3effdfffffddfe0L, 0x340000000L };
102     static final long[] jjbitVec13 =
103         { 0x3fffdfffffddfe0L, 0x300000000L, 0x0L, 0x0L };
104     static final long[] jjbitVec14 =
105         { 0xd7ffffffffffeL, 0x3fL, 0x200d6caefef02596L, 0x1fL };
106     static final long[] jjbitVec15 = { 0x0L, 0x3fffffffeffL, 0x0L, 0x0L };
107     static final long[] jjbitVec16 =
108         { 0x0L, 0x0L, 0xffffffff00000000L, 0x7fffffffff003fL };
109     static final long[] jjbitVec17 =
110         {
111             0x500000000007daedL,
112             0x2c62ab82315001L,
113             0xf580c90040000000L,
114             0x201080000000007L };
115     static final long[] jjbitVec18 =
116         {
117             0xffffffffffffffffL,
118             0xffffffffffffffffL,
119             0xffffffff0fffffffL,
120             0x3ffffffffffffffL };
121     static final long[] jjbitVec19 =
122         {
123             0xffffffff3f3fffffL,
124             0x3fffffffaaff3f3fL,
125             0x5fdfffffffffffffL,
126             0x1fdc1fff0fcf1fdcL };
127     static final long[] jjbitVec20 = { 0x4c4000000000L, 0x0L, 0x7L, 0x0L };
128     static final long[] jjbitVec21 =
129         {
130             0x3fe00000080L,
131             0xfffffffffffffffeL,
132             0xfffffffe001fffffL,
133             0x7ffffffffffffffL };
134     static final long[] jjbitVec22 = { 0x1fffffffffe0L, 0x0L, 0x0L, 0x0L };
135     static final long[] jjbitVec23 =
136         { 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffL, 0x0L };
137     static final long[] jjbitVec24 =
138         { 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffL, 0x0L };
139     static final long[] jjbitVec25 =
140         { 0x0L, 0x0L, 0x80000000000000L, 0xff7fffffff7fffffL };
141     static final long[] jjbitVec26 =
142         { 0xffffffL, 0xffffffffffff0000L, 0xf80001ffffffffffL, 0x30003L };
143     static final long[] jjbitVec27 =
144         {
145             0xffffffffffffffffL,
146             0x30000003fL,
147             0xfffffffbffffd7c0L,
148             0xffffd547f7fffL };
149     static final long[] jjbitVec28 =
150         {
151             0xffffffffffffdffeL,
152             0xffffffffdffeffffL,
153             0xffffffffffff007bL,
154             0x33fcfffffff199fL };
155     static final long[] jjbitVec29 =
156         {
157             0xfffe000000000000L,
158             0xfffffffe027fffffL,
159             0xbbfffffbfffe007fL,
160             0x707ffffff0016L };
161     static final long[] jjbitVec30 =
162         {
163             0x7fffffe00000000L,
164             0xffff03ff0007ffffL,
165             0x7cffffffffffffffL,
166             0x3ff3dffffef7fffL };
167     static final long[] jjbitVec31 =
168         {
169             0xf3ffffffffffffeeL,
170             0xffcfff1e3fffL,
171             0xd3c5fdfffff99feeL,
172             0x3ffcfb080399fL };
173     static final long[] jjbitVec32 =
174         {
175             0xd36dfdfffff987e4L,
176             0x1fffc05e003987L,
177             0xf3edfdfffffbafeeL,
178             0xffc100003bbfL };
179     static final long[] jjbitVec33 =
180         {
181             0xf3cdfdfffff99feeL,
182             0xffc3b0c0398fL,
183             0xc3bfc718d63dc7ecL,
184             0xff8000803dc7L };
185     static final long[] jjbitVec34 =
186         {
187             0xc3effdfffffddfeeL,
188             0xffc300603ddfL,
189             0xc3effdfffffddfecL,
190             0xffc340603ddfL };
191     static final long[] jjbitVec35 =
192         { 0xc3fffdfffffddfecL, 0xffc300803dcfL, 0x0L, 0x0L };
193     static final long[] jjbitVec36 =
194         { 0x7ff7ffffffffffeL, 0x3ff7fffL, 0x3bff6caefef02596L, 0x3ff3f5fL };
195     static final long[] jjbitVec37 =
196         { 0xc2a003ff03000000L, 0xfffe03fffffffeffL, 0x2fe3ffffebf0fdfL, 0x0L };
197     static final long[] jjbitVec38 = { 0x0L, 0x0L, 0x0L, 0x21fff0000L };
198     static final long[] jjbitVec39 =
199         {
200             0x3efffe000000a0L,
201             0xfffffffffffffffeL,
202             0xfffffffe661fffffL,
203             0x77ffffffffffffffL };
204     private final int jjMoveNfa_0(int startState, int curPos) {
205         int startsAt = 0;
206         jjnewStateCnt = 7;
207         int i = 1;
208         jjstateSet[0] = startState;
209         int kind = 0x7fffffff;
210         for (;;) {
211             if (++jjround == 0x7fffffff)
212                 ReInitRounds();
213             if (curChar < 64) {
214                 long l = 1L << curChar;
215                 MatchLoop : do {
216                     switch (jjstateSet[--i]) {
217                         case 0 :
218                             if ((0x100002600L & l) != 0L)
219                                 kind = 8;
220                             break;
221                         case 2 :
222                             if ((0x3ff600000000000L & l) == 0L)
223                                 break;
224                             if (kind > 7)
225                                 kind = 7;
226                             jjstateSet[jjnewStateCnt++] = 2;
227                             break;
228                         case 3 :
229                             if ((0x3ff600000000000L & l) != 0L)
230                                 jjAddStates(0, 1);
231                             break;
232                         case 4 :
233                             if (curChar == 58)
234                                 jjstateSet[jjnewStateCnt++] = 5;
235                             break;
236                         case 6 :
237                             if ((0x3ff600000000000L & l) == 0L)
238                                 break;
239                             if (kind > 9)
240                                 kind = 9;
241                             jjstateSet[jjnewStateCnt++] = 6;
242                             break;
243                         default :
244                             break;
245                     }
246                 } while (i != startsAt);
247             } else if (curChar < 128) {
248                 long l = 1L << (curChar & 077);
249                 MatchLoop : do {
250                     switch (jjstateSet[--i]) {
251                         case 0 :
252                             if ((0x7fffffe87fffffeL & l) == 0L)
253                                 break;
254                             if (kind > 7)
255                                 kind = 7;
256                             jjCheckNAddStates(2, 5);
257                             break;
258                         case 2 :
259                             if ((0x7fffffe87fffffeL & l) == 0L)
260                                 break;
261                             if (kind > 7)
262                                 kind = 7;
263                             jjCheckNAdd(2);
264                             break;
265                         case 3 :
266                             if ((0x7fffffe87fffffeL & l) != 0L)
267                                 jjCheckNAddTwoStates(3, 4);
268                             break;
269                         case 5 :
270                         case 6 :
271                             if ((0x7fffffe87fffffeL & l) == 0L)
272                                 break;
273                             if (kind > 9)
274                                 kind = 9;
275                             jjCheckNAdd(6);
276                             break;
277                         default :
278                             break;
279                     }
280                 } while (i != startsAt);
281             } else {
282                 int hiByte = (curChar >> 8);
283                 int i1 = hiByte >> 6;
284                 long l1 = 1L << (hiByte & 077);
285                 int i2 = (curChar & 0xff) >> 6;
286                 long l2 = 1L << (curChar & 077);
287                 MatchLoop : do {
288                     switch (jjstateSet[--i]) {
289                         case 0 :
290                             if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
291                                 break;
292                             if (kind > 7)
293                                 kind = 7;
294                             jjCheckNAddStates(2, 5);
295                             break;
296                         case 2 :
297                             if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
298                                 break;
299                             if (kind > 7)
300                                 kind = 7;
301                             jjCheckNAdd(2);
302                             break;
303                         case 3 :
304                             if (jjCanMove_1(hiByte, i1, i2, l1, l2))
305                                 jjCheckNAddTwoStates(3, 4);
306                             break;
307                         case 5 :
308                             if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
309                                 break;
310                             if (kind > 9)
311                                 kind = 9;
312                             jjCheckNAdd(6);
313                             break;
314                         case 6 :
315                             if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
316                                 break;
317                             if (kind > 9)
318                                 kind = 9;
319                             jjCheckNAdd(6);
320                             break;
321                         default :
322                             break;
323                     }
324                 } while (i != startsAt);
325             }
326             if (kind != 0x7fffffff) {
327                 jjmatchedKind = kind;
328                 jjmatchedPos = curPos;
329                 kind = 0x7fffffff;
330             }
331             ++curPos;
332             if ((i = jjnewStateCnt)
333                 == (startsAt = 7 - (jjnewStateCnt = startsAt)))
334                 return curPos;
335             try {
336                 curChar = input_stream.readChar();
337             } catch (java.io.IOException JavaDoc e) {
338                 return curPos;
339             }
340         }
341     }
342     private final int jjStopStringLiteralDfa_1(int pos, long active0) {
343         switch (pos) {
344             default :
345                 return -1;
346         }
347     }
348     private final int jjStartNfa_1(int pos, long active0) {
349         return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1);
350     }
351
352     private final int jjMoveStringLiteralDfa0_1() {
353         switch (curChar) {
354             case 40 :
355                 return jjStopAtPos(0, 10);
356             case 41 :
357                 return jjStopAtPos(0, 11);
358             case 94 :
359                 return jjMoveStringLiteralDfa1_1(0x7000L);
360             default :
361                 return jjMoveNfa_1(0, 0);
362         }
363     }
364     private final int jjMoveStringLiteralDfa1_1(long active0) {
365         try {
366             curChar = input_stream.readChar();
367         } catch (java.io.IOException JavaDoc e) {
368             jjStopStringLiteralDfa_1(0, active0);
369             return 1;
370         }
371         switch (curChar) {
372             case 40 :
373                 if ((active0 & 0x1000L) != 0L)
374                     return jjStopAtPos(1, 12);
375                 break;
376             case 41 :
377                 if ((active0 & 0x2000L) != 0L)
378                     return jjStopAtPos(1, 13);
379                 break;
380             case 94 :
381                 if ((active0 & 0x4000L) != 0L)
382                     return jjStopAtPos(1, 14);
383                 break;
384             default :
385                 break;
386         }
387         return jjStartNfa_1(0, active0);
388     }
389     static final long[] jjbitVec40 =
390         {
391             0xfffffffffffffffeL,
392             0xffffffffffffffffL,
393             0xffffffffffffffffL,
394             0xffffffffffffffffL };
395     static final long[] jjbitVec41 =
396         { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL };
397     private final int jjMoveNfa_1(int startState, int curPos) {
398         int startsAt = 0;
399         jjnewStateCnt = 1;
400         int i = 1;
401         jjstateSet[0] = startState;
402         int kind = 0x7fffffff;
403         for (;;) {
404             if (++jjround == 0x7fffffff)
405                 ReInitRounds();
406             if (curChar < 64) {
407                 long l = 1L << curChar;
408                 MatchLoop : do {
409                     switch (jjstateSet[--i]) {
410                         case 0 :
411                             if ((0xfffffcffffffffffL & l) != 0L)
412                                 kind = 15;
413                             break;
414                         default :
415                             break;
416                     }
417                 } while (i != startsAt);
418             } else if (curChar < 128) {
419                 long l = 1L << (curChar & 077);
420                 MatchLoop : do {
421                     switch (jjstateSet[--i]) {
422                         case 0 :
423                             if ((0xffffffffbfffffffL & l) != 0L)
424                                 kind = 15;
425                             break;
426                         default :
427                             break;
428                     }
429                 } while (i != startsAt);
430             } else {
431                 int hiByte = (curChar >> 8);
432                 int i1 = hiByte >> 6;
433                 long l1 = 1L << (hiByte & 077);
434                 int i2 = (curChar & 0xff) >> 6;
435                 long l2 = 1L << (curChar & 077);
436                 MatchLoop : do {
437                     switch (jjstateSet[--i]) {
438                         case 0 :
439                             if (jjCanMove_2(hiByte, i1, i2, l1, l2)
440                                 && kind > 15)
441                                 kind = 15;
442                             break;
443                         default :
444                             break;
445                     }
446                 } while (i != startsAt);
447             }
448             if (kind != 0x7fffffff) {
449                 jjmatchedKind = kind;
450                 jjmatchedPos = curPos;
451                 kind = 0x7fffffff;
452             }
453             ++curPos;
454             if ((i = jjnewStateCnt)
455                 == (startsAt = 1 - (jjnewStateCnt = startsAt)))
456                 return curPos;
457             try {
458                 curChar = input_stream.readChar();
459             } catch (java.io.IOException JavaDoc e) {
460                 return curPos;
461             }
462         }
463     }
464     static final int[] jjnextStates = { 3, 4, 2, 3, 4, 6, };
465     private static final boolean jjCanMove_0(
466         int hiByte,
467         int i1,
468         int i2,
469         long l1,
470         long l2) {
471         switch (hiByte) {
472             case 0 :
473                 return ((jjbitVec2[i2] & l2) != 0L);
474             case 1 :
475                 return ((jjbitVec3[i2] & l2) != 0L);
476             case 2 :
477                 return ((jjbitVec4[i2] & l2) != 0L);
478             case 3 :
479                 return ((jjbitVec5[i2] & l2) != 0L);
480             case 4 :
481                 return ((jjbitVec6[i2] & l2) != 0L);
482             case 5 :
483                 return ((jjbitVec7[i2] & l2) != 0L);
484             case 6 :
485                 return ((jjbitVec8[i2] & l2) != 0L);
486             case 9 :
487                 return ((jjbitVec9[i2] & l2) != 0L);
488             case 10 :
489                 return ((jjbitVec10[i2] & l2) != 0L);
490             case 11 :
491                 return ((jjbitVec11[i2] & l2) != 0L);
492             case 12 :
493                 return ((jjbitVec12[i2] & l2) != 0L);
494             case 13 :
495                 return ((jjbitVec13[i2] & l2) != 0L);
496             case 14 :
497                 return ((jjbitVec14[i2] & l2) != 0L);
498             case 15 :
499                 return ((jjbitVec15[i2] & l2) != 0L);
500             case 16 :
501                 return ((jjbitVec16[i2] & l2) != 0L);
502             case 17 :
503                 return ((jjbitVec17[i2] & l2) != 0L);
504             case 30 :
505                 return ((jjbitVec18[i2] & l2) != 0L);
506             case 31 :
507                 return ((jjbitVec19[i2] & l2) != 0L);
508             case 33 :
509                 return ((jjbitVec20[i2] & l2) != 0L);
510             case 48 :
511                 return ((jjbitVec21[i2] & l2) != 0L);
512             case 49 :
513                 return ((jjbitVec22[i2] & l2) != 0L);
514             case 159 :
515                 return ((jjbitVec23[i2] & l2) != 0L);
516             case 215 :
517                 return ((jjbitVec24[i2] & l2) != 0L);
518             default :
519                 if ((jjbitVec0[i1] & l1) != 0L)
520                     return true;
521                 return false;
522         }
523     }
524     private static final boolean jjCanMove_1(
525         int hiByte,
526         int i1,
527         int i2,
528         long l1,
529         long l2) {
530         switch (hiByte) {
531             case 0 :
532                 return ((jjbitVec25[i2] & l2) != 0L);
533             case 1 :
534                 return ((jjbitVec3[i2] & l2) != 0L);
535             case 2 :
536                 return ((jjbitVec26[i2] & l2) != 0L);
537             case 3 :
538                 return ((jjbitVec27[i2] & l2) != 0L);
539             case 4 :
540                 return ((jjbitVec28[i2] & l2) != 0L);
541             case 5 :
542                 return ((jjbitVec29[i2] & l2) != 0L);
543             case 6 :
544                 return ((jjbitVec30[i2] & l2) != 0L);
545             case 9 :
546                 return ((jjbitVec31[i2] & l2) != 0L);
547             case 10 :
548                 return ((jjbitVec32[i2] & l2) != 0L);
549             case 11 :
550                 return ((jjbitVec33[i2] & l2) != 0L);
551             case 12 :
552                 return ((jjbitVec34[i2] & l2) != 0L);
553             case 13 :
554                 return ((jjbitVec35[i2] & l2) != 0L);
555             case 14 :
556                 return ((jjbitVec36[i2] & l2) != 0L);
557             case 15 :
558                 return ((jjbitVec37[i2] & l2) != 0L);
559             case 16 :
560                 return ((jjbitVec16[i2] & l2) != 0L);
561             case 17 :
562                 return ((jjbitVec17[i2] & l2) != 0L);
563             case 30 :
564                 return ((jjbitVec18[i2] & l2) != 0L);
565             case 31 :
566                 return ((jjbitVec19[i2] & l2) != 0L);
567             case 32 :
568                 return ((jjbitVec38[i2] & l2) != 0L);
569             case 33 :
570                 return ((jjbitVec20[i2] & l2) != 0L);
571             case 48 :
572                 return ((jjbitVec39[i2] & l2) != 0L);
573             case 49 :
574                 return ((jjbitVec22[i2] & l2) != 0L);
575             case 159 :
576                 return ((jjbitVec23[i2] & l2) != 0L);
577             case 215 :
578                 return ((jjbitVec24[i2] & l2) != 0L);
579             default :
580                 if ((jjbitVec0[i1] & l1) != 0L)
581                     return true;
582                 return false;
583         }
584     }
585     private static final boolean jjCanMove_2(
586         int hiByte,
587         int i1,
588         int i2,
589         long l1,
590         long l2) {
591         switch (hiByte) {
592             case 0 :
593                 return ((jjbitVec41[i2] & l2) != 0L);
594             default :
595                 if ((jjbitVec40[i1] & l1) != 0L)
596                     return true;
597                 return false;
598         }
599     }
600     public static final String JavaDoc[] jjstrLiteralImages =
601         {
602             "",
603             null,
604             null,
605             null,
606             null,
607             null,
608             null,
609             null,
610             null,
611             null,
612             "\50",
613             "\51",
614             "\136\50",
615             "\136\51",
616             "\136\136",
617             null,
618             };
619     public static final String JavaDoc[] lexStateNames = { "DEFAULT", "IN_SCHEME", };
620     public static final int[] jjnewLexState =
621         { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, };
622     protected SimpleCharStream input_stream;
623     private final int[] jjrounds = new int[7];
624     private final int[] jjstateSet = new int[14];
625     protected char curChar;
626     public XPointerFrameworkParserTokenManager(SimpleCharStream stream) {
627         if (SimpleCharStream.staticFlag)
628             throw new Error JavaDoc("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
629         input_stream = stream;
630     }
631     public XPointerFrameworkParserTokenManager(
632         SimpleCharStream stream,
633         int lexState) {
634         this(stream);
635         switchTo(lexState);
636     }
637     public void reInit(SimpleCharStream stream) {
638         jjmatchedPos = jjnewStateCnt = 0;
639         curLexState = defaultLexState;
640         input_stream = stream;
641         ReInitRounds();
642     }
643     private final void ReInitRounds() {
644         int i;
645         jjround = 0x80000001;
646         for (i = 7; i-- > 0;)
647             jjrounds[i] = 0x80000000;
648     }
649     public void reInit(SimpleCharStream stream, int lexState) {
650         reInit(stream);
651         switchTo(lexState);
652     }
653     public void switchTo(int lexState) {
654         if (lexState >= 2 || lexState < 0)
655             throw new TokenMgrError(
656                 "Error: Ignoring invalid lexical state : "
657                     + lexState
658                     + ". State unchanged.",
659                 TokenMgrError.INVALID_LEXICAL_STATE);
660         else
661             curLexState = lexState;
662     }
663
664     protected Token jjFillToken() {
665         Token t = Token.newToken(jjmatchedKind);
666         t.kind = jjmatchedKind;
667         String JavaDoc im = jjstrLiteralImages[jjmatchedKind];
668         t.image = (im == null) ? input_stream.getImage() : im;
669         t.beginLine = input_stream.getBeginLine();
670         t.beginColumn = input_stream.getBeginColumn();
671         t.endLine = input_stream.getEndLine();
672         t.endColumn = input_stream.getEndColumn();
673         return t;
674     }
675
676     int curLexState = 0;
677     int defaultLexState = 0;
678     int jjnewStateCnt;
679     int jjround;
680     int jjmatchedPos;
681     int jjmatchedKind;
682
683     public Token getNextToken() {
684         Token matchedToken;
685         int curPos = 0;
686
687         EOFLoop : for (;;) {
688             try {
689                 curChar = input_stream.beginToken();
690             } catch (java.io.IOException JavaDoc e) {
691                 jjmatchedKind = 0;
692                 matchedToken = jjFillToken();
693                 return matchedToken;
694             }
695
696             switch (curLexState) {
697                 case 0 :
698                     jjmatchedKind = 0x7fffffff;
699                     jjmatchedPos = 0;
700                     curPos = jjMoveStringLiteralDfa0_0();
701                     break;
702                 case 1 :
703                     jjmatchedKind = 0x7fffffff;
704                     jjmatchedPos = 0;
705                     curPos = jjMoveStringLiteralDfa0_1();
706                     break;
707             }
708             if (jjmatchedKind != 0x7fffffff) {
709                 if (jjmatchedPos + 1 < curPos)
710                     input_stream.backup(curPos - jjmatchedPos - 1);
711                 matchedToken = jjFillToken();
712                 if (jjnewLexState[jjmatchedKind] != -1)
713                     curLexState = jjnewLexState[jjmatchedKind];
714                 return matchedToken;
715             }
716             int error_line = input_stream.getEndLine();
717             int error_column = input_stream.getEndColumn();
718             String JavaDoc error_after = null;
719             boolean EOFSeen = false;
720             try {
721                 input_stream.readChar();
722                 input_stream.backup(1);
723             } catch (java.io.IOException JavaDoc e1) {
724                 EOFSeen = true;
725                 error_after = curPos <= 1 ? "" : input_stream.getImage();
726                 if (curChar == '\n' || curChar == '\r') {
727                     error_line++;
728                     error_column = 0;
729                 } else
730                     error_column++;
731             }
732             if (!EOFSeen) {
733                 input_stream.backup(1);
734                 error_after = curPos <= 1 ? "" : input_stream.getImage();
735             }
736             throw new TokenMgrError(
737                 EOFSeen,
738                 curLexState,
739                 error_line,
740                 error_column,
741                 error_after,
742                 curChar,
743                 TokenMgrError.LEXICAL_ERROR);
744         }
745     }
746
747 }
748
Popular Tags