001 /* Generated By:JJTree&JavaCC: Do not edit this line. JavadocParserTokenManager.java */
002 package com.javadoq.javadoc;
003 
004 /** Token Manager. */
005 public class JavadocParserTokenManager implements JavadocParserConstants
006 {
007 
008   /** Debug output. */
009   public  java.io.PrintStream debugStream = System.out;
010   /** Set debug output. */
011   public  void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
012 private int jjMoveStringLiteralDfa0_0()
013 {
014    return jjMoveNfa_0(6, 0);
015 }
016 private int jjMoveNfa_0(int startState, int curPos)
017 {
018    int startsAt = 0;
019    jjnewStateCnt = 23;
020    int i = 1;
021    jjstateSet[0] = startState;
022    int kind = 0x7fffffff;
023    for (;;)
024    {
025       if (++jjround == 0x7fffffff)
026          ReInitRounds();
027       if (curChar < 64)
028       {
029          long l = 1L << curChar;
030          do
031          {
032             switch(jjstateSet[--i])
033             {
034                case 6:
035                   if ((0x100003600L & l) != 0L)
036                   {
037                      if (kind > 4)
038                         kind = 4;
039                      jjCheckNAdd(22);
040                   }
041                   else if (curChar == 60)
042                      jjstateSet[jjnewStateCnt++] = 12;
043                   break;
044                case 1:
045                   if ((0x100000200L & l) == 0L)
046                      break;
047                   if (kind > 1)
048                      kind = 1;
049                   jjstateSet[jjnewStateCnt++] = 1;
050                   break;
051                case 8:
052                   if ((0x100000200L & l) == 0L)
053                      break;
054                   if (kind > 2)
055                      kind = 2;
056                   jjstateSet[jjnewStateCnt++] = 8;
057                   break;
058                case 13:
059                   if ((0x100000200L & l) != 0L)
060                      jjAddStates(0, 1);
061                   break;
062                case 15:
063                   if ((0x100000200L & l) != 0L)
064                      jjAddStates(2, 3);
065                   break;
066                case 16:
067                   if (curChar != 61)
068                      break;
069                   kind = 3;
070                   jjCheckNAdd(17);
071                   break;
072                case 17:
073                   if ((0x100000200L & l) == 0L)
074                      break;
075                   if (kind > 3)
076                      kind = 3;
077                   jjCheckNAdd(17);
078                   break;
079                case 21:
080                   if (curChar == 60)
081                      jjstateSet[jjnewStateCnt++] = 12;
082                   break;
083                case 22:
084                   if ((0x100003600L & l) == 0L)
085                      break;
086                   if (kind > 4)
087                      kind = 4;
088                   jjCheckNAdd(22);
089                   break;
090                default : break;
091             }
092          } while(i != startsAt);
093       }
094       else if (curChar < 128)
095       {
096          long l = 1L << (curChar & 077);
097          do
098          {
099             switch(jjstateSet[--i])
100             {
101                case 6:
102                   if (curChar == 64)
103                      jjstateSet[jjnewStateCnt++] = 10;
104                   else if (curChar == 123)
105                      jjstateSet[jjnewStateCnt++] = 5;
106                   break;
107                case 0:
108                   if ((0x80000000800L & l) != 0L)
109                      jjstateSet[jjnewStateCnt++] = 1;
110                   break;
111                case 2:
112                   if ((0x400000004000L & l) != 0L)
113                      jjstateSet[jjnewStateCnt++] = 0;
114                   break;
115                case 3:
116                   if ((0x20000000200L & l) != 0L)
117                      jjstateSet[jjnewStateCnt++] = 2;
118                   break;
119                case 4:
120                   if ((0x100000001000L & l) != 0L)
121                      jjstateSet[jjnewStateCnt++] = 3;
122                   break;
123                case 5:
124                   if (curChar == 64)
125                      jjstateSet[jjnewStateCnt++] = 4;
126                   break;
127                case 7:
128                   if ((0x2000000020L & l) != 0L)
129                      jjstateSet[jjnewStateCnt++] = 8;
130                   break;
131                case 9:
132                   if ((0x2000000020L & l) != 0L)
133                      jjstateSet[jjnewStateCnt++] = 7;
134                   break;
135                case 10:
136                   if ((0x8000000080000L & l) != 0L)
137                      jjstateSet[jjnewStateCnt++] = 9;
138                   break;
139                case 11:
140                   if (curChar == 64)
141                      jjstateSet[jjnewStateCnt++] = 10;
142                   break;
143                case 12:
144                   if ((0x200000002L & l) != 0L)
145                      jjstateSet[jjnewStateCnt++] = 13;
146                   break;
147                case 14:
148                   if ((0x4000000040L & l) != 0L)
149                      jjAddStates(2, 3);
150                   break;
151                case 18:
152                   if ((0x2000000020L & l) != 0L)
153                      jjstateSet[jjnewStateCnt++] = 14;
154                   break;
155                case 19:
156                   if ((0x4000000040000L & l) != 0L)
157                      jjstateSet[jjnewStateCnt++] = 18;
158                   break;
159                case 20:
160                   if ((0x10000000100L & l) != 0L)
161                      jjstateSet[jjnewStateCnt++] = 19;
162                   break;
163                default : break;
164             }
165          } while(i != startsAt);
166       }
167       else
168       {
169          int hiByte = (int)(curChar >> 8);
170          int i1 = hiByte >> 6;
171          long l1 = 1L << (hiByte & 077);
172          int i2 = (curChar & 0xff) >> 6;
173          long l2 = 1L << (curChar & 077);
174          do
175          {
176             switch(jjstateSet[--i])
177             {
178                default : break;
179             }
180          } while(i != startsAt);
181       }
182       if (kind != 0x7fffffff)
183       {
184          jjmatchedKind = kind;
185          jjmatchedPos = curPos;
186          kind = 0x7fffffff;
187       }
188       ++curPos;
189       if ((i = jjnewStateCnt) == (startsAt = 23 - (jjnewStateCnt = startsAt)))
190          return curPos;
191       try { curChar = input_stream.readChar(); }
192       catch(java.io.IOException e) { return curPos; }
193    }
194 }
195 private int jjMoveStringLiteralDfa0_3()
196 {
197    return jjMoveNfa_3(4, 0);
198 }
199 static final long[] jjbitVec0 = {
200    0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
201 };
202 static final long[] jjbitVec2 = {
203    0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
204 };
205 private int jjMoveNfa_3(int startState, int curPos)
206 {
207    int startsAt = 0;
208    jjnewStateCnt = 4;
209    int i = 1;
210    jjstateSet[0] = startState;
211    int kind = 0x7fffffff;
212    for (;;)
213    {
214       if (++jjround == 0x7fffffff)
215          ReInitRounds();
216       if (curChar < 64)
217       {
218          long l = 1L << curChar;
219          do
220          {
221             switch(jjstateSet[--i])
222             {
223                case 4:
224                   if ((0xbffffffeffffc9ffL & l) != 0L)
225                   {
226                      if (kind > 11)
227                         kind = 11;
228                      jjCheckNAdd(0);
229                   }
230                   else if ((0x100000200L & l) != 0L)
231                      jjCheckNAddStates(4, 6);
232                   else if (curChar == 62)
233                   {
234                      if (kind > 12)
235                         kind = 12;
236                   }
237                   break;
238                case 0:
239                   if ((0xbffffffeffffc9ffL & l) == 0L)
240                      break;
241                   if (kind > 11)
242                      kind = 11;
243                   jjCheckNAdd(0);
244                   break;
245                case 1:
246                   if (curChar == 62)
247                      kind = 12;
248                   break;
249                case 2:
250                   if ((0x100000200L & l) != 0L)
251                      jjCheckNAddStates(4, 6);
252                   break;
253                case 3:
254                   if ((0xbfffffffffffffffL & l) != 0L)
255                      jjCheckNAddTwoStates(3, 1);
256                   break;
257                default : break;
258             }
259          } while(i != startsAt);
260       }
261       else if (curChar < 128)
262       {
263          long l = 1L << (curChar & 077);
264          do
265          {
266             switch(jjstateSet[--i])
267             {
268                case 4:
269                case 0:
270                   if (kind > 11)
271                      kind = 11;
272                   jjCheckNAdd(0);
273                   break;
274                case 3:
275                   jjAddStates(7, 8);
276                   break;
277                default : break;
278             }
279          } while(i != startsAt);
280       }
281       else
282       {
283          int hiByte = (int)(curChar >> 8);
284          int i1 = hiByte >> 6;
285          long l1 = 1L << (hiByte & 077);
286          int i2 = (curChar & 0xff) >> 6;
287          long l2 = 1L << (curChar & 077);
288          do
289          {
290             switch(jjstateSet[--i])
291             {
292                case 4:
293                case 0:
294                   if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
295                      break;
296                   if (kind > 11)
297                      kind = 11;
298                   jjCheckNAdd(0);
299                   break;
300                case 3:
301                   if (jjCanMove_0(hiByte, i1, i2, l1, l2))
302                      jjAddStates(7, 8);
303                   break;
304                default : break;
305             }
306          } while(i != startsAt);
307       }
308       if (kind != 0x7fffffff)
309       {
310          jjmatchedKind = kind;
311          jjmatchedPos = curPos;
312          kind = 0x7fffffff;
313       }
314       ++curPos;
315       if ((i = jjnewStateCnt) == (startsAt = 4 - (jjnewStateCnt = startsAt)))
316          return curPos;
317       try { curChar = input_stream.readChar(); }
318       catch(java.io.IOException e) { return curPos; }
319    }
320 }
321 private int jjMoveStringLiteralDfa0_2()
322 {
323    return jjMoveNfa_2(1, 0);
324 }
325 private int jjMoveNfa_2(int startState, int curPos)
326 {
327    int startsAt = 0;
328    jjnewStateCnt = 5;
329    int i = 1;
330    jjstateSet[0] = startState;
331    int kind = 0x7fffffff;
332    for (;;)
333    {
334       if (++jjround == 0x7fffffff)
335          ReInitRounds();
336       if (curChar < 64)
337       {
338          long l = 1L << curChar;
339          do
340          {
341             switch(jjstateSet[--i])
342             {
343                case 1:
344                   if ((0xaffffcfeffffc9ffL & l) != 0L)
345                   {
346                      if (kind > 9)
347                         kind = 9;
348                      jjCheckNAdd(0);
349                   }
350                   else if ((0x100003600L & l) != 0L)
351                   {
352                      if (kind > 10)
353                         kind = 10;
354                      jjCheckNAdd(4);
355                   }
356                   else if (curChar == 40)
357                      jjCheckNAddTwoStates(2, 3);
358                   break;
359                case 0:
360                   if ((0xaffffcfeffffc9ffL & l) == 0L)
361                      break;
362                   if (kind > 9)
363                      kind = 9;
364                   jjCheckNAdd(0);
365                   break;
366                case 2:
367                   if ((0xfffffcffffffffffL & l) != 0L)
368                      jjCheckNAddTwoStates(2, 3);
369                   break;
370                case 3:
371                   if (curChar == 41)
372                      jjCheckNAdd(4);
373                   break;
374                case 4:
375                   if ((0x100003600L & l) == 0L)
376                      break;
377                   if (kind > 10)
378                      kind = 10;
379                   jjCheckNAdd(4);
380                   break;
381                default : break;
382             }
383          } while(i != startsAt);
384       }
385       else if (curChar < 128)
386       {
387          long l = 1L << (curChar & 077);
388          do
389          {
390             switch(jjstateSet[--i])
391             {
392                case 1:
393                case 0:
394                   if ((0xd7ffffffffffffffL & l) == 0L)
395                      break;
396                   if (kind > 9)
397                      kind = 9;
398                   jjCheckNAdd(0);
399                   break;
400                case 2:
401                   jjAddStates(9, 10);
402                   break;
403                default : break;
404             }
405          } while(i != startsAt);
406       }
407       else
408       {
409          int hiByte = (int)(curChar >> 8);
410          int i1 = hiByte >> 6;
411          long l1 = 1L << (hiByte & 077);
412          int i2 = (curChar & 0xff) >> 6;
413          long l2 = 1L << (curChar & 077);
414          do
415          {
416             switch(jjstateSet[--i])
417             {
418                case 1:
419                case 0:
420                   if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
421                      break;
422                   if (kind > 9)
423                      kind = 9;
424                   jjCheckNAdd(0);
425                   break;
426                case 2:
427                   if (jjCanMove_0(hiByte, i1, i2, l1, l2))
428                      jjAddStates(9, 10);
429                   break;
430                default : break;
431             }
432          } while(i != startsAt);
433       }
434       if (kind != 0x7fffffff)
435       {
436          jjmatchedKind = kind;
437          jjmatchedPos = curPos;
438          kind = 0x7fffffff;
439       }
440       ++curPos;
441       if ((i = jjnewStateCnt) == (startsAt = 5 - (jjnewStateCnt = startsAt)))
442          return curPos;
443       try { curChar = input_stream.readChar(); }
444       catch(java.io.IOException e) { return curPos; }
445    }
446 }
447 private int jjMoveStringLiteralDfa0_1()
448 {
449    return jjMoveNfa_1(1, 0);
450 }
451 private int jjMoveNfa_1(int startState, int curPos)
452 {
453    int startsAt = 0;
454    jjnewStateCnt = 6;
455    int i = 1;
456    jjstateSet[0] = startState;
457    int kind = 0x7fffffff;
458    for (;;)
459    {
460       if (++jjround == 0x7fffffff)
461          ReInitRounds();
462       if (curChar < 64)
463       {
464          long l = 1L << curChar;
465          do
466          {
467             switch(jjstateSet[--i])
468             {
469                case 1:
470                   if ((0xaffffcfeffffc9ffL & l) != 0L)
471                   {
472                      if (kind > 7)
473                         kind = 7;
474                      jjCheckNAdd(0);
475                   }
476                   else if ((0x100000200L & l) != 0L)
477                      jjCheckNAddTwoStates(4, 5);
478                   else if (curChar == 40)
479                      jjCheckNAddTwoStates(2, 3);
480                   break;
481                case 0:
482                   if ((0xaffffcfeffffc9ffL & l) == 0L)
483                      break;
484                   if (kind > 7)
485                      kind = 7;
486                   jjCheckNAdd(0);
487                   break;
488                case 2:
489                   if ((0xfffffcffffffffffL & l) != 0L)
490                      jjCheckNAddTwoStates(2, 3);
491                   break;
492                case 3:
493                   if (curChar == 41)
494                      jjCheckNAddTwoStates(4, 5);
495                   break;
496                case 4:
497                   if ((0x100000200L & l) != 0L)
498                      jjCheckNAddTwoStates(4, 5);
499                   break;
500                default : break;
501             }
502          } while(i != startsAt);
503       }
504       else if (curChar < 128)
505       {
506          long l = 1L << (curChar & 077);
507          do
508          {
509             switch(jjstateSet[--i])
510             {
511                case 1:
512                   if ((0xd7ffffffffffffffL & l) != 0L)
513                   {
514                      if (kind > 7)
515                         kind = 7;
516                      jjCheckNAdd(0);
517                   }
518                   else if (curChar == 125)
519                   {
520                      if (kind > 8)
521                         kind = 8;
522                   }
523                   break;
524                case 0:
525                   if ((0xd7ffffffffffffffL & l) == 0L)
526                      break;
527                   if (kind > 7)
528                      kind = 7;
529                   jjCheckNAdd(0);
530                   break;
531                case 2:
532                   jjAddStates(9, 10);
533                   break;
534                case 5:
535                   if (curChar == 125 && kind > 8)
536                      kind = 8;
537                   break;
538                default : break;
539             }
540          } while(i != startsAt);
541       }
542       else
543       {
544          int hiByte = (int)(curChar >> 8);
545          int i1 = hiByte >> 6;
546          long l1 = 1L << (hiByte & 077);
547          int i2 = (curChar & 0xff) >> 6;
548          long l2 = 1L << (curChar & 077);
549          do
550          {
551             switch(jjstateSet[--i])
552             {
553                case 1:
554                case 0:
555                   if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
556                      break;
557                   if (kind > 7)
558                      kind = 7;
559                   jjCheckNAdd(0);
560                   break;
561                case 2:
562                   if (jjCanMove_0(hiByte, i1, i2, l1, l2))
563                      jjAddStates(9, 10);
564                   break;
565                default : break;
566             }
567          } while(i != startsAt);
568       }
569       if (kind != 0x7fffffff)
570       {
571          jjmatchedKind = kind;
572          jjmatchedPos = curPos;
573          kind = 0x7fffffff;
574       }
575       ++curPos;
576       if ((i = jjnewStateCnt) == (startsAt = 6 - (jjnewStateCnt = startsAt)))
577          return curPos;
578       try { curChar = input_stream.readChar(); }
579       catch(java.io.IOException e) { return curPos; }
580    }
581 }
582 static final int[] jjnextStates = {
583    13, 20, 15, 16, 2, 3, 1, 3, 1, 2, 3, 
584 };
585 private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
586 {
587    switch(hiByte)
588    {
589       case 0:
590          return ((jjbitVec2[i2] & l2) != 0L);
591       default :
592          if ((jjbitVec0[i1] & l1) != 0L)
593             return true;
594          return false;
595    }
596 }
597 
598 /** Token literal values. */
599 public static final String[] jjstrLiteralImages = {
600 "", null, null, null, null, null, null, null, null, null, null, null, null, };
601 
602 /** Lexer state names. */
603 public static final String[] lexStateNames = {
604    "DEFAULT",
605    "IN_LINK_START",
606    "IN_SEE_START",
607    "IN_ANCHOR_START",
608 };
609 
610 /** Lex State array. */
611 public static final int[] jjnewLexState = {
612    -1, 1, 2, 3, -1, -1, -1, -1, 0, -1, 0, -1, 0, 
613 };
614 protected JavaCharStream input_stream;
615 private final int[] jjrounds = new int[23];
616 private final int[] jjstateSet = new int[46];
617 protected char curChar;
618 /** Constructor. */
619 public JavadocParserTokenManager(JavaCharStream stream){
620    if (JavaCharStream.staticFlag)
621       throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
622    input_stream = stream;
623 }
624 
625 /** Constructor. */
626 public JavadocParserTokenManager(JavaCharStream stream, int lexState){
627    this(stream);
628    SwitchTo(lexState);
629 }
630 
631 /** Reinitialise parser. */
632 public void ReInit(JavaCharStream stream)
633 {
634    jjmatchedPos = jjnewStateCnt = 0;
635    curLexState = defaultLexState;
636    input_stream = stream;
637    ReInitRounds();
638 }
639 private void ReInitRounds()
640 {
641    int i;
642    jjround = 0x80000001;
643    for (i = 23; i-- > 0;)
644       jjrounds[i] = 0x80000000;
645 }
646 
647 /** Reinitialise parser. */
648 public void ReInit(JavaCharStream stream, int lexState)
649 {
650    ReInit(stream);
651    SwitchTo(lexState);
652 }
653 
654 /** Switch to specified lex state. */
655 public void SwitchTo(int lexState)
656 {
657    if (lexState >= 4 || lexState < 0)
658       throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
659    else
660       curLexState = lexState;
661 }
662 
663 protected Token jjFillToken()
664 {
665    final Token t;
666    final String curTokenImage;
667    final int beginLine;
668    final int endLine;
669    final int beginColumn;
670    final int endColumn;
671    String im = jjstrLiteralImages[jjmatchedKind];
672    curTokenImage = (im == null) ? input_stream.GetImage() : im;
673    beginLine = input_stream.getBeginLine();
674    beginColumn = input_stream.getBeginColumn();
675    endLine = input_stream.getEndLine();
676    endColumn = input_stream.getEndColumn();
677    t = Token.newToken(jjmatchedKind, curTokenImage);
678 
679    t.beginLine = beginLine;
680    t.endLine = endLine;
681    t.beginColumn = beginColumn;
682    t.endColumn = endColumn;
683 
684    return t;
685 }
686 
687 int curLexState = 0;
688 int defaultLexState = 0;
689 int jjnewStateCnt;
690 int jjround;
691 int jjmatchedPos;
692 int jjmatchedKind;
693 
694 /** Get the next Token. */
695 public Token getNextToken() 
696 {
697   Token matchedToken;
698   int curPos = 0;
699 
700   EOFLoop :
701   for (;;)
702   {
703    try
704    {
705       curChar = input_stream.BeginToken();
706    }
707    catch(java.io.IOException e)
708    {
709       jjmatchedKind = 0;
710       matchedToken = jjFillToken();
711       return matchedToken;
712    }
713 
714    switch(curLexState)
715    {
716      case 0:
717        jjmatchedKind = 0x7fffffff;
718        jjmatchedPos = 0;
719        curPos = jjMoveStringLiteralDfa0_0();
720        if (jjmatchedPos == 0 && jjmatchedKind > 6)
721        {
722           jjmatchedKind = 6;
723        }
724        break;
725      case 1:
726        jjmatchedKind = 0x7fffffff;
727        jjmatchedPos = 0;
728        curPos = jjMoveStringLiteralDfa0_1();
729        break;
730      case 2:
731        jjmatchedKind = 0x7fffffff;
732        jjmatchedPos = 0;
733        curPos = jjMoveStringLiteralDfa0_2();
734        break;
735      case 3:
736        jjmatchedKind = 0x7fffffff;
737        jjmatchedPos = 0;
738        curPos = jjMoveStringLiteralDfa0_3();
739        break;
740    }
741      if (jjmatchedKind != 0x7fffffff)
742      {
743         if (jjmatchedPos + 1 < curPos)
744            input_stream.backup(curPos - jjmatchedPos - 1);
745            matchedToken = jjFillToken();
746        if (jjnewLexState[jjmatchedKind] != -1)
747          curLexState = jjnewLexState[jjmatchedKind];
748            return matchedToken;
749      }
750      int error_line = input_stream.getEndLine();
751      int error_column = input_stream.getEndColumn();
752      String error_after = null;
753      boolean EOFSeen = false;
754      try { input_stream.readChar(); input_stream.backup(1); }
755      catch (java.io.IOException e1) {
756         EOFSeen = true;
757         error_after = curPos <= 1 ? "" : input_stream.GetImage();
758         if (curChar == '\n' || curChar == '\r') {
759            error_line++;
760            error_column = 0;
761         }
762         else
763            error_column++;
764      }
765      if (!EOFSeen) {
766         input_stream.backup(1);
767         error_after = curPos <= 1 ? "" : input_stream.GetImage();
768      }
769      throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
770   }
771 }
772 
773 private void jjCheckNAdd(int state)
774 {
775    if (jjrounds[state] != jjround)
776    {
777       jjstateSet[jjnewStateCnt++] = state;
778       jjrounds[state] = jjround;
779    }
780 }
781 private void jjAddStates(int start, int end)
782 {
783    do {
784       jjstateSet[jjnewStateCnt++] = jjnextStates[start];
785    } while (start++ != end);
786 }
787 private void jjCheckNAddTwoStates(int state1, int state2)
788 {
789    jjCheckNAdd(state1);
790    jjCheckNAdd(state2);
791 }
792 
793 private void jjCheckNAddStates(int start, int end)
794 {
795    do {
796       jjCheckNAdd(jjnextStates[start]);
797    } while (start++ != end);
798 }
799 
800 }