Source for org.jfree.formula.parser.GeneratedFormulaParserTokenManager

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