KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > lucene > html > HTMLParserTokenManager


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  */

17
18 /* $Id: HTMLParserTokenManager.java 42598 2004-03-01 16:18:28Z gregor $ */
19
20 package org.apache.lenya.lucene.html;
21
22 public class HTMLParserTokenManager implements HTMLParserConstants {
23     static final long[] jjbitVec0 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL };
24     static final int[] jjnextStates = {
25         17, 18, 21, 12, 14, 5, 8, 0, 4, 6, 0, 4, 6, 5, 0, 4, 6, 12, 13,
26     };
27     public static final String JavaDoc[] jjstrLiteralImages = {
28         "", null, null, "\74\41\55\55", "\74\41", null, null, null, null, null, null, null, null,
29         "\75", null, null, "\47", "\42", null, null, null, null, null, null, "\55\55\76", null,
30         "\76",
31     };
32     public static final String JavaDoc[] lexStateNames = {
33         "DEFAULT", "WithinTag", "AfterEquals", "WithinQuote1", "WithinQuote2", "WithinComment1",
34         "WithinComment2",
35     };
36     public static final int[] jjnewLexState = {
37         -1, 1, 1, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, 2, 0, 1, 3, 4, -1, -1, 1, -1, 1, -1, 0, -1,
38         0,
39     };
40     static final long[] jjtoToken = { 0x7fbfb3fL, };
41     static final long[] jjtoSkip = { 0x40000L, };
42     public java.io.PrintStream JavaDoc debugStream = System.out;
43     private SimpleCharStream input_stream;
44     private final int[] jjrounds = new int[25];
45     private final int[] jjstateSet = new int[50];
46     protected char curChar;
47     int curLexState = 0;
48     int defaultLexState = 0;
49     int jjnewStateCnt;
50     int jjround;
51     int jjmatchedPos;
52     int jjmatchedKind;
53
54     /**
55      * Creates a new HTMLParserTokenManager object.
56      *
57      * @param stream DOCUMENT ME!
58      */

59     public HTMLParserTokenManager(SimpleCharStream stream) {
60         if (SimpleCharStream.staticFlag) {
61             throw new Error JavaDoc(
62                 "ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
63         }
64
65         input_stream = stream;
66     }
67
68     /**
69      * Creates a new HTMLParserTokenManager object.
70      *
71      * @param stream DOCUMENT ME!
72      * @param lexState DOCUMENT ME!
73      */

74     public HTMLParserTokenManager(SimpleCharStream stream, int lexState) {
75         this(stream);
76         SwitchTo(lexState);
77     }
78
79     /**
80      * DOCUMENT ME!
81      *
82      * @param ds DOCUMENT ME!
83      */

84     public void setDebugStream(java.io.PrintStream JavaDoc ds) {
85         debugStream = ds;
86     }
87
88     private final int jjStopStringLiteralDfa_0(int pos, long active0) {
89         switch (pos) {
90         case 0:
91
92             if ((active0 & 0x18L) != 0L) {
93                 return 17;
94             }
95
96             return -1;
97
98         case 1:
99
100             if ((active0 & 0x18L) != 0L) {
101                 return 22;
102             }
103
104             return -1;
105
106         default:
107             return -1;
108         }
109     }
110
111     private final int jjStartNfa_0(int pos, long active0) {
112         return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
113     }
114
115     private final int jjStopAtPos(int pos, int kind) {
116         jjmatchedKind = kind;
117         jjmatchedPos = pos;
118
119         return pos + 1;
120     }
121
122     private final int jjMoveStringLiteralDfa0_0() {
123         switch (curChar) {
124         case 60:
125             return jjMoveStringLiteralDfa1_0(0x18L);
126
127         default:
128             return jjMoveNfa_0(11, 0);
129         }
130     }
131
132     private final int jjMoveStringLiteralDfa1_0(long active0) {
133         try {
134             curChar = input_stream.readChar();
135         } catch (java.io.IOException JavaDoc e) {
136             jjStopStringLiteralDfa_0(0, active0);
137
138             return 1;
139         }
140
141         switch (curChar) {
142         case 33:
143
144             if ((active0 & 0x10L) != 0L) {
145                 jjmatchedKind = 4;
146                 jjmatchedPos = 1;
147             }
148
149             return jjMoveStringLiteralDfa2_0(active0, 0x8L);
150
151         default:
152             break;
153         }
154
155         return jjStartNfa_0(0, active0);
156     }
157
158     private final int jjMoveStringLiteralDfa2_0(long old0, long active0) {
159         if ((active0 &= old0) == 0L) {
160             return jjStartNfa_0(0, old0);
161         }
162
163         try {
164             curChar = input_stream.readChar();
165         } catch (java.io.IOException JavaDoc e) {
166             jjStopStringLiteralDfa_0(1, active0);
167
168             return 2;
169         }
170
171         switch (curChar) {
172         case 45:
173             return jjMoveStringLiteralDfa3_0(active0, 0x8L);
174
175         default:
176             break;
177         }
178
179         return jjStartNfa_0(1, active0);
180     }
181
182     private final int jjMoveStringLiteralDfa3_0(long old0, long active0) {
183         if ((active0 &= old0) == 0L) {
184             return jjStartNfa_0(1, old0);
185         }
186
187         try {
188             curChar = input_stream.readChar();
189         } catch (java.io.IOException JavaDoc e) {
190             jjStopStringLiteralDfa_0(2, active0);
191
192             return 3;
193         }
194
195         switch (curChar) {
196         case 45:
197
198             if ((active0 & 0x8L) != 0L) {
199                 return jjStopAtPos(3, 3);
200             }
201
202             break;
203
204         default:
205             break;
206         }
207
208         return jjStartNfa_0(2, active0);
209     }
210
211     private final void jjCheckNAdd(int state) {
212         if (jjrounds[state] != jjround) {
213             jjstateSet[jjnewStateCnt++] = state;
214             jjrounds[state] = jjround;
215         }
216     }
217
218     private final void jjAddStates(int start, int end) {
219         do {
220             jjstateSet[jjnewStateCnt++] = jjnextStates[start];
221         } while (start++ != end);
222     }
223
224     private final void jjCheckNAddTwoStates(int state1, int state2) {
225         jjCheckNAdd(state1);
226         jjCheckNAdd(state2);
227     }
228
229     private final void jjCheckNAddStates(int start, int end) {
230         do {
231             jjCheckNAdd(jjnextStates[start]);
232         } while (start++ != end);
233     }
234
235     private final int jjMoveNfa_0(int startState, int curPos) {
236         int startsAt = 0;
237         jjnewStateCnt = 25;
238
239         int i = 1;
240         jjstateSet[0] = startState;
241
242         int kind = 0x7fffffff;
243
244         for (;;) {
245             if (++jjround == 0x7fffffff) {
246                 ReInitRounds();
247             }
248
249             if (curChar < 64) {
250                 long l = 1L << curChar;
251 MatchLoop:
252                 do {
253                     switch (jjstateSet[--i]) {
254                     case 11:
255
256                         if ((0x3ff000000000000L & l) != 0L) {
257                             jjCheckNAddTwoStates(7, 2);
258                         } else if ((0x100002600L & l) != 0L) {
259                             if (kind > 9) {
260                                 kind = 9;
261                             }
262
263                             jjCheckNAdd(10);
264                         } else if (curChar == 60) {
265                             jjCheckNAddStates(0, 2);
266                         } else if (curChar == 38) {
267                             jjAddStates(3, 4);
268                         } else if (curChar == 36) {
269                             jjstateSet[jjnewStateCnt++] = 1;
270                         }
271
272                         if ((0x3ff000000000000L & l) != 0L) {
273                             if (kind > 5) {
274                                 kind = 5;
275                             }
276
277                             jjCheckNAddStates(5, 9);
278                         }
279
280                         break;
281
282                     case 17:
283
284                         if (curChar == 33) {
285                             jjstateSet[jjnewStateCnt++] = 22;
286                         } else if (curChar == 47) {
287                             jjCheckNAdd(18);
288                         }
289
290                         break;
291
292                     case 0:
293
294                         if (curChar == 36) {
295                             jjstateSet[jjnewStateCnt++] = 1;
296                         }
297
298                         break;
299
300                     case 1:
301
302                         if ((0x3ff000000000000L & l) != 0L) {
303                             jjCheckNAdd(2);
304                         }
305
306                         break;
307
308                     case 2:
309
310                         if ((0x500000000000L & l) != 0L) {
311                             jjstateSet[jjnewStateCnt++] = 3;
312                         }
313
314                         break;
315
316                     case 3:
317                     case 9:
318
319                         if ((0x3ff000000000000L & l) == 0L) {
320                             break;
321                         }
322
323                         if (kind > 5) {
324                             kind = 5;
325                         }
326
327                         jjCheckNAddStates(10, 12);
328
329                         break;
330
331                     case 4:
332
333                         if ((0x3ff000000000000L & l) == 0L) {
334                             break;
335                         }
336
337                         if (kind > 5) {
338                             kind = 5;
339                         }
340
341                         jjCheckNAddStates(5, 9);
342
343                         break;
344
345                     case 5:
346
347                         if ((0x880000000000L & l) == 0L) {
348                             break;
349                         }
350
351                         if (kind > 5) {
352                             kind = 5;
353                         }
354
355                         jjCheckNAddStates(13, 16);
356
357                         break;
358
359                     case 6:
360
361                         if ((0x3ff000000000000L & l) != 0L) {
362                             jjCheckNAddTwoStates(7, 2);
363                         }
364
365                         break;
366
367                     case 7:
368
369                         if (curChar != 34) {
370                             break;
371                         }
372
373                         if (kind > 5) {
374                             kind = 5;
375                         }
376
377                         jjCheckNAddStates(10, 12);
378
379                         break;
380
381                     case 8:
382
383                         if ((0x208000000000L & l) != 0L) {
384                             jjstateSet[jjnewStateCnt++] = 9;
385                         }
386
387                         break;
388
389                     case 10:
390
391                         if ((0x100002600L & l) == 0L) {
392                             break;
393                         }
394
395                         kind = 9;
396                         jjCheckNAdd(10);
397
398                         break;
399
400                     case 13:
401
402                         if ((curChar == 59) && (kind > 8)) {
403                             kind = 8;
404                         }
405
406                         break;
407
408                     case 14:
409
410                         if (curChar == 35) {
411                             jjCheckNAdd(15);
412                         }
413
414                         break;
415
416                     case 15:
417
418                         if ((0x3ff000000000000L & l) == 0L) {
419                             break;
420                         }
421
422                         if (kind > 8) {
423                             kind = 8;
424                         }
425
426                         jjCheckNAddTwoStates(15, 13);
427
428                         break;
429
430                     case 16:
431
432                         if (curChar == 60) {
433                             jjCheckNAddStates(0, 2);
434                         }
435
436                         break;
437
438                     case 19:
439
440                         if ((0x9fffff7affffd9ffL & l) == 0L) {
441                             break;
442                         }
443
444                         if (kind > 1) {
445                             kind = 1;
446                         }
447
448                         jjCheckNAdd(20);
449
450                         break;
451
452                     case 20:
453
454                         if ((0x9ffffffeffffd9ffL & l) == 0L) {
455                             break;
456                         }
457
458                         if (kind > 1) {
459                             kind = 1;
460                         }
461
462                         jjCheckNAdd(20);
463
464                         break;
465
466                     case 21:
467
468                         if (curChar == 33) {
469                             jjstateSet[jjnewStateCnt++] = 22;
470                         }
471
472                         break;
473
474                     case 23:
475
476                         if ((0x9fffff7affffd9ffL & l) == 0L) {
477                             break;
478                         }
479
480                         if (kind > 2) {
481                             kind = 2;
482                         }
483
484                         jjCheckNAdd(24);
485
486                         break;
487
488                     case 24:
489
490                         if ((0x9ffffffeffffd9ffL & l) == 0L) {
491                             break;
492                         }
493
494                         if (kind > 2) {
495                             kind = 2;
496                         }
497
498                         jjCheckNAdd(24);
499
500                         break;
501
502                     default:
503                         break;
504                     }
505                 } while (i != startsAt);
506             } else if (curChar < 128) {
507                 long l = 1L << (curChar & 077);
508 MatchLoop:
509                 do {
510                     switch (jjstateSet[--i]) {
511                     case 11:
512                     case 4:
513
514                         if ((0x7fffffe07fffffeL & l) == 0L) {
515                             break;
516                         }
517
518                         if (kind > 5) {
519                             kind = 5;
520                         }
521
522                         jjCheckNAddStates(5, 9);
523
524                         break;
525
526                     case 17:
527                     case 18:
528
529                         if ((0x7fffffe07fffffeL & l) == 0L) {
530                             break;
531                         }
532
533                         if (kind > 1) {
534                             kind = 1;
535                         }
536
537                         jjstateSet[jjnewStateCnt++] = 19;
538
539                         break;
540
541                     case 9:
542
543                         if ((0x7fffffe07fffffeL & l) == 0L) {
544                             break;
545                         }
546
547                         if (kind > 5) {
548                             kind = 5;
549                         }
550
551                         jjCheckNAddStates(10, 12);
552
553                         break;
554
555                     case 12:
556
557                         if ((0x7fffffe07fffffeL & l) == 0L) {
558                             break;
559                         }
560
561                         if (kind > 8) {
562                             kind = 8;
563                         }
564
565                         jjAddStates(17, 18);
566
567                         break;
568
569                     case 19:
570                     case 20:
571
572                         if (kind > 1) {
573                             kind = 1;
574                         }
575
576                         jjCheckNAdd(20);
577
578                         break;
579
580                     case 22:
581
582                         if ((0x7fffffe07fffffeL & l) == 0L) {
583                             break;
584                         }
585
586                         if (kind > 2) {
587                             kind = 2;
588                         }
589
590                         jjstateSet[jjnewStateCnt++] = 23;
591
592                         break;
593
594                     case 23:
595                     case 24:
596
597                         if (kind > 2) {
598                             kind = 2;
599                         }
600
601                         jjCheckNAdd(24);
602
603                         break;
604
605                     default:
606                         break;
607                     }
608                 } while (i != startsAt);
609             } else {
610                 int i2 = (curChar & 0xff) >> 6;
611                 long l2 = 1L << (curChar & 077);
612 MatchLoop:
613                 do {
614                     switch (jjstateSet[--i]) {
615                     case 19:
616                     case 20:
617
618                         if ((jjbitVec0[i2] & l2) == 0L) {
619                             break;
620                         }
621
622                         if (kind > 1) {
623                             kind = 1;
624                         }
625
626                         jjCheckNAdd(20);
627
628                         break;
629
630                     case 23:
631                     case 24:
632
633                         if ((jjbitVec0[i2] & l2) == 0L) {
634                             break;
635                         }
636
637                         if (kind > 2) {
638                             kind = 2;
639                         }
640
641                         jjCheckNAdd(24);
642
643                         break;
644
645                     default:
646                         break;
647                     }
648                 } while (i != startsAt);
649             }
650
651             if (kind != 0x7fffffff) {
652                 jjmatchedKind = kind;
653                 jjmatchedPos = curPos;
654                 kind = 0x7fffffff;
655             }
656
657             ++curPos;
658
659             if ((i = jjnewStateCnt) == (startsAt = 25 - (jjnewStateCnt = startsAt))) {
660                 return curPos;
661             }
662
663             try {
664                 curChar = input_stream.readChar();
665             } catch (java.io.IOException JavaDoc e) {
666                 return curPos;
667             }
668         }
669     }
670
671     private final int jjMoveStringLiteralDfa0_4() {
672         return jjMoveNfa_4(1, 0);
673     }
674
675     private final int jjMoveNfa_4(int startState, int curPos) {
676         int startsAt = 0;
677         jjnewStateCnt = 2;
678
679         int i = 1;
680         jjstateSet[0] = startState;
681
682         int kind = 0x7fffffff;
683
684         for (;;) {
685             if (++jjround == 0x7fffffff) {
686                 ReInitRounds();
687             }
688
689             if (curChar < 64) {
690                 long l = 1L << curChar;
691 MatchLoop:
692                 do {
693                     switch (jjstateSet[--i]) {
694                     case 1:
695
696                         if ((0xfffffffbffffffffL & l) != 0L) {
697                             if (kind > 21) {
698                                 kind = 21;
699                             }
700
701                             jjCheckNAdd(0);
702                         } else if (curChar == 34) {
703                             if (kind > 22) {
704                                 kind = 22;
705                             }
706                         }
707
708                         break;
709
710                     case 0:
711
712                         if ((0xfffffffbffffffffL & l) == 0L) {
713                             break;
714                         }
715
716                         kind = 21;
717                         jjCheckNAdd(0);
718
719                         break;
720
721                     default:
722                         break;
723                     }
724                 } while (i != startsAt);
725             } else if (curChar < 128) {
726                 long l = 1L << (curChar & 077);
727 MatchLoop:
728                 do {
729                     switch (jjstateSet[--i]) {
730                     case 1:
731                     case 0:
732                         kind = 21;
733                         jjCheckNAdd(0);
734
735                         break;
736
737                     default:
738                         break;
739                     }
740                 } while (i != startsAt);
741             } else {
742                 int i2 = (curChar & 0xff) >> 6;
743                 long l2 = 1L << (curChar & 077);
744 MatchLoop:
745                 do {
746                     switch (jjstateSet[--i]) {
747                     case 1:
748                     case 0:
749
750                         if ((jjbitVec0[i2] & l2) == 0L) {
751                             break;
752                         }
753
754                         if (kind > 21) {
755                             kind = 21;
756                         }
757
758                         jjCheckNAdd(0);
759
760                         break;
761
762                     default:
763                         break;
764                     }
765                 } while (i != startsAt);
766             }
767
768             if (kind != 0x7fffffff) {
769                 jjmatchedKind = kind;
770                 jjmatchedPos = curPos;
771                 kind = 0x7fffffff;
772             }
773
774             ++curPos;
775
776             if ((i = jjnewStateCnt) == (startsAt = 2 - (jjnewStateCnt = startsAt))) {
777                 return curPos;
778             }
779
780             try {
781                 curChar = input_stream.readChar();
782             } catch (java.io.IOException JavaDoc e) {
783                 return curPos;
784             }
785         }
786     }
787
788     private final int jjMoveStringLiteralDfa0_6() {
789         switch (curChar) {
790         case 62:
791             return jjStopAtPos(0, 26);
792
793         default:
794             return jjMoveNfa_6(0, 0);
795         }
796     }
797
798     private final int jjMoveNfa_6(int startState, int curPos) {
799         int startsAt = 0;
800         jjnewStateCnt = 1;
801
802         int i = 1;
803         jjstateSet[0] = startState;
804
805         int kind = 0x7fffffff;
806
807         for (;;) {
808             if (++jjround == 0x7fffffff) {
809                 ReInitRounds();
810             }
811
812             if (curChar < 64) {
813                 long l = 1L << curChar;
814 MatchLoop:
815                 do {
816                     switch (jjstateSet[--i]) {
817                     case 0:
818
819                         if ((0xbfffffffffffffffL & l) == 0L) {
820                             break;
821                         }
822
823                         kind = 25;
824                         jjstateSet[jjnewStateCnt++] = 0;
825
826                         break;
827
828                     default:
829                         break;
830                     }
831                 } while (i != startsAt);
832             } else if (curChar < 128) {
833                 long l = 1L << (curChar & 077);
834 MatchLoop:
835                 do {
836                     switch (jjstateSet[--i]) {
837                     case 0:
838                         kind = 25;
839                         jjstateSet[jjnewStateCnt++] = 0;
840
841                         break;
842
843                     default:
844                         break;
845                     }
846                 } while (i != startsAt);
847             } else {
848                 int i2 = (curChar & 0xff) >> 6;
849                 long l2 = 1L << (curChar & 077);
850 MatchLoop:
851                 do {
852                     switch (jjstateSet[--i]) {
853                     case 0:
854
855                         if ((jjbitVec0[i2] & l2) == 0L) {
856                             break;
857                         }
858
859                         if (kind > 25) {
860                             kind = 25;
861                         }
862
863                         jjstateSet[jjnewStateCnt++] = 0;
864
865                         break;
866
867                     default:
868                         break;
869                     }
870                 } while (i != startsAt);
871             }
872
873             if (kind != 0x7fffffff) {
874                 jjmatchedKind = kind;
875                 jjmatchedPos = curPos;
876                 kind = 0x7fffffff;
877             }
878
879             ++curPos;
880
881             if ((i = jjnewStateCnt) == (startsAt = 1 - (jjnewStateCnt = startsAt))) {
882                 return curPos;
883             }
884
885             try {
886                 curChar = input_stream.readChar();
887             } catch (java.io.IOException JavaDoc e) {
888                 return curPos;
889             }
890         }
891     }
892
893     private final int jjMoveStringLiteralDfa0_3() {
894         return jjMoveNfa_3(1, 0);
895     }
896
897     private final int jjMoveNfa_3(int startState, int curPos) {
898         int startsAt = 0;
899         jjnewStateCnt = 2;
900
901         int i = 1;
902         jjstateSet[0] = startState;
903
904         int kind = 0x7fffffff;
905
906         for (;;) {
907             if (++jjround == 0x7fffffff) {
908                 ReInitRounds();
909             }
910
911             if (curChar < 64) {
912                 long l = 1L << curChar;
913 MatchLoop:
914                 do {
915                     switch (jjstateSet[--i]) {
916                     case 1:
917
918                         if ((0xffffff7fffffffffL & l) != 0L) {
919                             if (kind > 19) {
920                                 kind = 19;
921                             }
922
923                             jjCheckNAdd(0);
924                         } else if (curChar == 39) {
925                             if (kind > 20) {
926                                 kind = 20;
927                             }
928                         }
929
930                         break;
931
932                     case 0:
933
934                         if ((0xffffff7fffffffffL & l) == 0L) {
935                             break;
936                         }
937
938                         kind = 19;
939                         jjCheckNAdd(0);
940
941                         break;
942
943                     default:
944                         break;
945                     }
946                 } while (i != startsAt);
947             } else if (curChar < 128) {
948                 long l = 1L << (curChar & 077);
949 MatchLoop:
950                 do {
951                     switch (jjstateSet[--i]) {
952                     case 1:
953                     case 0:
954                         kind = 19;
955                         jjCheckNAdd(0);
956
957                         break;
958
959                     default:
960                         break;
961                     }
962                 } while (i != startsAt);
963             } else {
964                 int i2 = (curChar & 0xff) >> 6;
965                 long l2 = 1L << (curChar & 077);
966 MatchLoop:
967                 do {
968                     switch (jjstateSet[--i]) {
969                     case 1:
970                     case 0:
971
972                         if ((jjbitVec0[i2] & l2) == 0L) {
973                             break;
974                         }
975
976                         if (kind > 19) {
977                             kind = 19;
978                         }
979
980                         jjCheckNAdd(0);
981
982                         break;
983
984                     default:
985                         break;
986                     }
987                 } while (i != startsAt);
988             }
989
990             if (kind != 0x7fffffff) {
991                 jjmatchedKind = kind;
992                 jjmatchedPos = curPos;
993                 kind = 0x7fffffff;
994             }
995
996             ++curPos;
997
998             if ((i = jjnewStateCnt) == (startsAt = 2 - (jjnewStateCnt = startsAt))) {
999                 return curPos;
1000            }
1001
1002            try {
1003                curChar = input_stream.readChar();
1004            } catch (java.io.IOException JavaDoc e) {
1005                return curPos;
1006            }
1007        }
1008    }
1009
1010    private final int jjMoveStringLiteralDfa0_2() {
1011        switch (curChar) {
1012        case 34:
1013            return jjStopAtPos(0, 17);
1014
1015        case 39:
1016            return jjStopAtPos(0, 16);
1017
1018        default:
1019            return jjMoveNfa_2(0, 0);
1020        }
1021    }
1022
1023    private final int jjMoveNfa_2(int startState, int curPos) {
1024        int startsAt = 0;
1025        jjnewStateCnt = 3;
1026
1027        int i = 1;
1028        jjstateSet[0] = startState;
1029
1030        int kind = 0x7fffffff;
1031
1032        for (;;) {
1033            if (++jjround == 0x7fffffff) {
1034                ReInitRounds();
1035            }
1036
1037            if (curChar < 64) {
1038                long l = 1L << curChar;
1039MatchLoop:
1040                do {
1041                    switch (jjstateSet[--i]) {
1042                    case 0:
1043
1044                        if ((0x9fffff7affffd9ffL & l) != 0L) {
1045                            if (kind > 15) {
1046                                kind = 15;
1047                            }
1048
1049                            jjCheckNAdd(1);
1050                        } else if ((0x100002600L & l) != 0L) {
1051                            if (kind > 18) {
1052                                kind = 18;
1053                            }
1054
1055                            jjCheckNAdd(2);
1056                        }
1057
1058                        break;
1059
1060                    case 1:
1061
1062                        if ((0xbffffffeffffd9ffL & l) == 0L) {
1063                            break;
1064                        }
1065
1066                        if (kind > 15) {
1067                            kind = 15;
1068                        }
1069
1070                        jjCheckNAdd(1);
1071
1072                        break;
1073
1074                    case 2:
1075
1076                        if ((0x100002600L & l) == 0L) {
1077                            break;
1078                        }
1079
1080                        kind = 18;
1081                        jjCheckNAdd(2);
1082
1083                        break;
1084
1085                    default:
1086                        break;
1087                    }
1088                } while (i != startsAt);
1089            } else if (curChar < 128) {
1090                long l = 1L << (curChar & 077);
1091MatchLoop:
1092                do {
1093                    switch (jjstateSet[--i]) {
1094                    case 0:
1095                    case 1:
1096
1097                        if (kind > 15) {
1098                            kind = 15;
1099                        }
1100
1101                        jjCheckNAdd(1);
1102
1103                        break;
1104
1105                    default:
1106                        break;
1107                    }
1108                } while (i != startsAt);
1109            } else {
1110                int i2 = (curChar & 0xff) >> 6;
1111                long l2 = 1L << (curChar & 077);
1112MatchLoop:
1113                do {
1114                    switch (jjstateSet[--i]) {
1115                    case 0:
1116                    case 1:
1117
1118                        if ((jjbitVec0[i2] & l2) == 0L) {
1119                            break;
1120                        }
1121
1122                        if (kind > 15) {
1123                            kind = 15;
1124                        }
1125
1126                        jjCheckNAdd(1);
1127
1128                        break;
1129
1130                    default:
1131                        break;
1132                    }
1133                } while (i != startsAt);
1134            }
1135
1136            if (kind != 0x7fffffff) {
1137                jjmatchedKind = kind;
1138                jjmatchedPos = curPos;
1139                kind = 0x7fffffff;
1140            }
1141
1142            ++curPos;
1143
1144            if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt))) {
1145                return curPos;
1146            }
1147
1148            try {
1149                curChar = input_stream.readChar();
1150            } catch (java.io.IOException JavaDoc e) {
1151                return curPos;
1152            }
1153        }
1154    }
1155
1156    private final int jjStopStringLiteralDfa_5(int pos, long active0) {
1157        switch (pos) {
1158        case 0:
1159
1160            if ((active0 & 0x1000000L) != 0L) {
1161                jjmatchedKind = 23;
1162
1163                return -1;
1164            }
1165
1166            return -1;
1167
1168        case 1:
1169
1170            if ((active0 & 0x1000000L) != 0L) {
1171                if (jjmatchedPos == 0) {
1172                    jjmatchedKind = 23;
1173                    jjmatchedPos = 0;
1174                }
1175
1176                return -1;
1177            }
1178
1179            return -1;
1180
1181        default:
1182            return -1;
1183        }
1184    }
1185
1186    private final int jjStartNfa_5(int pos, long active0) {
1187        return jjMoveNfa_5(jjStopStringLiteralDfa_5(pos, active0), pos + 1);
1188    }
1189
1190    private final int jjMoveStringLiteralDfa0_5() {
1191        switch (curChar) {
1192        case 45:
1193            return jjMoveStringLiteralDfa1_5(0x1000000L);
1194
1195        default:
1196            return jjMoveNfa_5(1, 0);
1197        }
1198    }
1199
1200    private final int jjMoveStringLiteralDfa1_5(long active0) {
1201        try {
1202            curChar = input_stream.readChar();
1203        } catch (java.io.IOException JavaDoc e) {
1204            jjStopStringLiteralDfa_5(0, active0);
1205
1206            return 1;
1207        }
1208
1209        switch (curChar) {
1210        case 45:
1211            return jjMoveStringLiteralDfa2_5(active0, 0x1000000L);
1212
1213        default:
1214            break;
1215        }
1216
1217        return jjStartNfa_5(0, active0);
1218    }
1219
1220    private final int jjMoveStringLiteralDfa2_5(long old0, long active0) {
1221        if ((active0 &= old0) == 0L) {
1222            return jjStartNfa_5(0, old0);
1223        }
1224
1225        try {
1226            curChar = input_stream.readChar();
1227        } catch (java.io.IOException JavaDoc e) {
1228            jjStopStringLiteralDfa_5(1, active0);
1229
1230            return 2;
1231        }
1232
1233        switch (curChar) {
1234        case 62:
1235
1236            if ((active0 & 0x1000000L) != 0L) {
1237                return jjStopAtPos(2, 24);
1238            }
1239
1240            break;
1241
1242        default:
1243            break;
1244        }
1245
1246        return jjStartNfa_5(1, active0);
1247    }
1248
1249    private final int jjMoveNfa_5(int startState, int curPos) {
1250        int startsAt = 0;
1251        jjnewStateCnt = 2;
1252
1253        int i = 1;
1254        jjstateSet[0] = startState;
1255
1256        int kind = 0x7fffffff;
1257
1258        for (;;) {
1259            if (++jjround == 0x7fffffff) {
1260                ReInitRounds();
1261            }
1262
1263            if (curChar < 64) {
1264                long l = 1L << curChar;
1265MatchLoop:
1266                do {
1267                    switch (jjstateSet[--i]) {
1268                    case 1:
1269
1270                        if ((0xffffdfffffffffffL & l) != 0L) {
1271                            if (kind > 23) {
1272                                kind = 23;
1273                            }
1274
1275                            jjCheckNAdd(0);
1276                        } else if (curChar == 45) {
1277                            if (kind > 23) {
1278                                kind = 23;
1279                            }
1280                        }
1281
1282                        break;
1283
1284                    case 0:
1285
1286                        if ((0xffffdfffffffffffL & l) == 0L) {
1287                            break;
1288                        }
1289
1290                        kind = 23;
1291                        jjCheckNAdd(0);
1292
1293                        break;
1294
1295                    default:
1296                        break;
1297                    }
1298                } while (i != startsAt);
1299            } else if (curChar < 128) {
1300                long l = 1L << (curChar & 077);
1301MatchLoop:
1302                do {
1303                    switch (jjstateSet[--i]) {
1304                    case 1:
1305                    case 0:
1306                        kind = 23;
1307                        jjCheckNAdd(0);
1308
1309                        break;
1310
1311                    default:
1312                        break;
1313                    }
1314                } while (i != startsAt);
1315            } else {
1316                int i2 = (curChar & 0xff) >> 6;
1317                long l2 = 1L << (curChar & 077);
1318MatchLoop:
1319                do {
1320                    switch (jjstateSet[--i]) {
1321                    case 1:
1322                    case 0:
1323
1324                        if ((jjbitVec0[i2] & l2) == 0L) {
1325                            break;
1326                        }
1327
1328                        if (kind > 23) {
1329                            kind = 23;
1330                        }
1331
1332                        jjCheckNAdd(0);
1333
1334                        break;
1335
1336                    default:
1337                        break;
1338                    }
1339                } while (i != startsAt);
1340            }
1341
1342            if (kind != 0x7fffffff) {
1343                jjmatchedKind = kind;
1344                jjmatchedPos = curPos;
1345                kind = 0x7fffffff;
1346            }
1347
1348            ++curPos;
1349
1350            if ((i = jjnewStateCnt) == (startsAt = 2 - (jjnewStateCnt = startsAt))) {
1351                return curPos;
1352            }
1353
1354            try {
1355                curChar = input_stream.readChar();
1356            } catch (java.io.IOException JavaDoc e) {
1357                return curPos;
1358            }
1359        }
1360    }
1361
1362    private final int jjStartNfaWithStates_1(int pos, int kind, int state) {
1363        jjmatchedKind = kind;
1364        jjmatchedPos = pos;
1365
1366        try {
1367            curChar = input_stream.readChar();
1368        } catch (java.io.IOException JavaDoc e) {
1369            return pos + 1;
1370        }
1371
1372        return jjMoveNfa_1(state, pos + 1);
1373    }
1374
1375    private final int jjMoveStringLiteralDfa0_1() {
1376        switch (curChar) {
1377        case 34:
1378            return jjStopAtPos(0, 17);
1379
1380        case 39:
1381            return jjStopAtPos(0, 16);
1382
1383        case 61:
1384            return jjStartNfaWithStates_1(0, 13, 3);
1385
1386        default:
1387            return jjMoveNfa_1(0, 0);
1388        }
1389    }
1390
1391    private final int jjMoveNfa_1(int startState, int curPos) {
1392        int startsAt = 0;
1393        jjnewStateCnt = 6;
1394
1395        int i = 1;
1396        jjstateSet[0] = startState;
1397
1398        int kind = 0x7fffffff;
1399
1400        for (;;) {
1401            if (++jjround == 0x7fffffff) {
1402                ReInitRounds();
1403            }
1404
1405            if (curChar < 64) {
1406                long l = 1L << curChar;
1407MatchLoop:
1408                do {
1409                    switch (jjstateSet[--i]) {
1410                    case 0:
1411
1412                        if ((0x9fffff7affffd9ffL & l) != 0L) {
1413                            if (kind > 12) {
1414                                kind = 12;
1415                            }
1416
1417                            jjCheckNAdd(1);
1418                        } else if ((0x100002600L & l) != 0L) {
1419                            if (kind > 18) {
1420                                kind = 18;
1421                            }
1422
1423                            jjCheckNAdd(5);
1424                        } else if (curChar == 61) {
1425                            jjstateSet[jjnewStateCnt++] = 3;
1426                        } else if (curChar == 62) {
1427                            if (kind > 14) {
1428                                kind = 14;
1429                            }
1430                        }
1431
1432                        break;
1433
1434                    case 1:
1435
1436                        if ((0x9ffffffeffffd9ffL & l) == 0L) {
1437                            break;
1438                        }
1439
1440                        if (kind > 12) {
1441                            kind = 12;
1442                        }
1443
1444                        jjCheckNAdd(1);
1445
1446                        break;
1447
1448                    case 2:
1449                    case 3:
1450
1451                        if ((curChar == 62) && (kind > 14)) {
1452                            kind = 14;
1453                        }
1454
1455                        break;
1456
1457                    case 4:
1458
1459                        if (curChar == 61) {
1460                            jjstateSet[jjnewStateCnt++] = 3;
1461                        }
1462
1463                        break;
1464
1465                    case 5:
1466
1467                        if ((0x100002600L & l) == 0L) {
1468                            break;
1469                        }
1470
1471                        kind = 18;
1472                        jjCheckNAdd(5);
1473
1474                        break;
1475
1476                    default:
1477                        break;
1478                    }
1479                } while (i != startsAt);
1480            } else if (curChar < 128) {
1481                long l = 1L << (curChar & 077);
1482MatchLoop:
1483                do {
1484                    switch (jjstateSet[--i]) {
1485                    case 0:
1486                    case 1:
1487
1488                        if (kind > 12) {
1489                            kind = 12;
1490                        }
1491
1492                        jjCheckNAdd(1);
1493
1494                        break;
1495
1496                    default:
1497                        break;
1498                    }
1499                } while (i != startsAt);
1500            } else {
1501                int i2 = (curChar & 0xff) >> 6;
1502                long l2 = 1L << (curChar & 077);
1503MatchLoop:
1504                do {
1505                    switch (jjstateSet[--i]) {
1506                    case 0:
1507                    case 1:
1508
1509                        if ((jjbitVec0[i2] & l2) == 0L) {
1510                            break;
1511                        }
1512
1513                        if (kind > 12) {
1514                            kind = 12;
1515                        }
1516
1517                        jjCheckNAdd(1);
1518
1519                        break;
1520
1521                    default:
1522                        break;
1523                    }
1524                } while (i != startsAt);
1525            }
1526
1527            if (kind != 0x7fffffff) {
1528                jjmatchedKind = kind;
1529                jjmatchedPos = curPos;
1530                kind = 0x7fffffff;
1531            }
1532
1533            ++curPos;
1534
1535            if ((i = jjnewStateCnt) == (startsAt = 6 - (jjnewStateCnt = startsAt))) {
1536                return curPos;
1537            }
1538
1539            try {
1540                curChar = input_stream.readChar();
1541            } catch (java.io.IOException JavaDoc e) {
1542                return curPos;
1543            }
1544        }
1545    }
1546
1547    /**
1548     * DOCUMENT ME!
1549     *
1550     * @param stream DOCUMENT ME!
1551     */

1552    public void ReInit(SimpleCharStream stream) {
1553        jjmatchedPos = jjnewStateCnt = 0;
1554        curLexState = defaultLexState;
1555        input_stream = stream;
1556        ReInitRounds();
1557    }
1558
1559    private final void ReInitRounds() {
1560        int i;
1561        jjround = 0x80000001;
1562
1563        for (i = 25; i-- > 0;)
1564            jjrounds[i] = 0x80000000;
1565    }
1566
1567    /**
1568     * DOCUMENT ME!
1569     *
1570     * @param stream DOCUMENT ME!
1571     * @param lexState DOCUMENT ME!
1572     */

1573    public void ReInit(SimpleCharStream stream, int lexState) {
1574        ReInit(stream);
1575        SwitchTo(lexState);
1576    }
1577
1578    /**
1579     * DOCUMENT ME!
1580     *
1581     * @param lexState DOCUMENT ME!
1582     */

1583    public void SwitchTo(int lexState) {
1584        if ((lexState >= 7) || (lexState < 0)) {
1585            throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState +
1586                ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
1587        } else {
1588            curLexState = lexState;
1589        }
1590    }
1591
1592    private final Token jjFillToken() {
1593        Token t = Token.newToken(jjmatchedKind);
1594        t.kind = jjmatchedKind;
1595
1596        String JavaDoc im = jjstrLiteralImages[jjmatchedKind];
1597        t.image = (im == null) ? input_stream.GetImage() : im;
1598        t.beginLine = input_stream.getBeginLine();
1599        t.beginColumn = input_stream.getBeginColumn();
1600        t.endLine = input_stream.getEndLine();
1601        t.endColumn = input_stream.getEndColumn();
1602
1603        return t;
1604    }
1605
1606    /**
1607     * DOCUMENT ME!
1608     *
1609     * @return DOCUMENT ME!
1610     */

1611    public final Token getNextToken() {
1612        Token matchedToken;
1613        int curPos = 0;
1614
1615EOFLoop:
1616        for (;;) {
1617            try {
1618                curChar = input_stream.BeginToken();
1619            } catch (java.io.IOException JavaDoc e) {
1620                jjmatchedKind = 0;
1621                matchedToken = jjFillToken();
1622
1623                return matchedToken;
1624            }
1625
1626            switch (curLexState) {
1627            case 0:
1628                jjmatchedKind = 0x7fffffff;
1629                jjmatchedPos = 0;
1630                curPos = jjMoveStringLiteralDfa0_0();
1631
1632                if ((jjmatchedPos == 0) && (jjmatchedKind > 11)) {
1633                    jjmatchedKind = 11;
1634                }
1635
1636                break;
1637
1638            case 1:
1639                jjmatchedKind = 0x7fffffff;
1640                jjmatchedPos = 0;
1641                curPos = jjMoveStringLiteralDfa0_1();
1642
1643                break;
1644
1645            case 2:
1646                jjmatchedKind = 0x7fffffff;
1647                jjmatchedPos = 0;
1648                curPos = jjMoveStringLiteralDfa0_2();
1649
1650                break;
1651
1652            case 3:
1653                jjmatchedKind = 0x7fffffff;
1654                jjmatchedPos = 0;
1655                curPos = jjMoveStringLiteralDfa0_3();
1656
1657                break;
1658
1659            case 4:
1660                jjmatchedKind = 0x7fffffff;
1661                jjmatchedPos = 0;
1662                curPos = jjMoveStringLiteralDfa0_4();
1663
1664                break;
1665
1666            case 5:
1667                jjmatchedKind = 0x7fffffff;
1668                jjmatchedPos = 0;
1669                curPos = jjMoveStringLiteralDfa0_5();
1670
1671                break;
1672
1673            case 6:
1674                jjmatchedKind = 0x7fffffff;
1675                jjmatchedPos = 0;
1676                curPos = jjMoveStringLiteralDfa0_6();
1677
1678                break;
1679            }
1680
1681            if (jjmatchedKind != 0x7fffffff) {
1682                if ((jjmatchedPos + 1) < curPos) {
1683                    input_stream.backup(curPos - jjmatchedPos - 1);
1684                }
1685
1686                if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) {
1687                    matchedToken = jjFillToken();
1688
1689                    if (jjnewLexState[jjmatchedKind] != -1) {
1690                        curLexState = jjnewLexState[jjmatchedKind];
1691                    }
1692
1693                    return matchedToken;
1694                } else {
1695                    if (jjnewLexState[jjmatchedKind] != -1) {
1696                        curLexState = jjnewLexState[jjmatchedKind];
1697                    }
1698
1699                    continue EOFLoop;
1700                }
1701            }
1702
1703            int error_line = input_stream.getEndLine();
1704            int error_column = input_stream.getEndColumn();
1705            String JavaDoc error_after = null;
1706            boolean EOFSeen = false;
1707
1708            try {
1709                input_stream.readChar();
1710                input_stream.backup(1);
1711            } catch (java.io.IOException JavaDoc e1) {
1712                EOFSeen = true;
1713                error_after = (curPos <= 1) ? "" : input_stream.GetImage();
1714
1715                if ((curChar == '\n') || (curChar == '\r')) {
1716                    error_line++;
1717                    error_column = 0;
1718                } else {
1719                    error_column++;
1720                }
1721            }
1722
1723            if (!EOFSeen) {
1724                input_stream.backup(1);
1725                error_after = (curPos <= 1) ? "" : input_stream.GetImage();
1726            }
1727
1728            throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after,
1729                curChar, TokenMgrError.LEXICAL_ERROR);
1730        }
1731    }
1732}
1733
Popular Tags