KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > nutch > quality > dynamic > PageDescriptionTokenManager


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