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