KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > script > el > parser > NetUIELParserTokenManager


1 /*
2  * Copyright 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  * $Header:$
17  */

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