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