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: package org.apache.cocoon.components.xpointer.parser;
018:
019: public class XPointerFrameworkParserTokenManager implements
020: XPointerFrameworkParserConstants {
021: public java.io.PrintStream debugStream = System.out;
022:
023: public void setDebugStream(java.io.PrintStream ds) {
024: debugStream = ds;
025: }
026:
027: private final int jjStopAtPos(int pos, int kind) {
028: jjmatchedKind = kind;
029: jjmatchedPos = pos;
030: return pos + 1;
031: }
032:
033: private final int jjMoveStringLiteralDfa0_0() {
034: switch (curChar) {
035: case 40:
036: return jjStopAtPos(0, 10);
037: case 41:
038: return jjStopAtPos(0, 11);
039: default:
040: return jjMoveNfa_0(0, 0);
041: }
042: }
043:
044: private final void jjCheckNAdd(int state) {
045: if (jjrounds[state] != jjround) {
046: jjstateSet[jjnewStateCnt++] = state;
047: jjrounds[state] = jjround;
048: }
049: }
050:
051: private final void jjAddStates(int start, int end) {
052: do {
053: jjstateSet[jjnewStateCnt++] = jjnextStates[start];
054: } while (start++ != end);
055: }
056:
057: private final void jjCheckNAddTwoStates(int state1, int state2) {
058: jjCheckNAdd(state1);
059: jjCheckNAdd(state2);
060: }
061:
062: private final void jjCheckNAddStates(int start, int end) {
063: do {
064: jjCheckNAdd(jjnextStates[start]);
065: } while (start++ != end);
066: }
067:
068: static final long[] jjbitVec0 = { 0x0L, 0xffffffffffffc000L,
069: 0xfffff0007fffffffL, 0x7fffffL };
070: static final long[] jjbitVec2 = { 0x0L, 0x0L, 0x0L,
071: 0xff7fffffff7fffffL };
072: static final long[] jjbitVec3 = { 0x7ff3ffffffffffffL,
073: 0x7ffffffffffffdfeL, 0xffffffffffffffffL,
074: 0xfc31ffffffffe00fL };
075: static final long[] jjbitVec4 = { 0xffffffL, 0xffffffffffff0000L,
076: 0xf80001ffffffffffL, 0x3L };
077: static final long[] jjbitVec5 = { 0x0L, 0x0L, 0xfffffffbffffd740L,
078: 0xffffd547f7fffL };
079: static final long[] jjbitVec6 = { 0xffffffffffffdffeL,
080: 0xffffffffdffeffffL, 0xffffffffffff0003L,
081: 0x33fcfffffff199fL };
082: static final long[] jjbitVec7 = { 0xfffe000000000000L,
083: 0xfffffffe027fffffL, 0x7fL, 0x707ffffff0000L };
084: static final long[] jjbitVec8 = { 0x7fffffe00000000L,
085: 0xfffe0000000007feL, 0x7cffffffffffffffL, 0x60002f7fffL };
086: static final long[] jjbitVec9 = { 0x23ffffffffffffe0L,
087: 0x3ff000000L, 0x3c5fdfffff99fe0L, 0x30003b0000000L };
088: static final long[] jjbitVec10 = { 0x36dfdfffff987e0L,
089: 0x1c00005e000000L, 0x23edfdfffffbafe0L, 0x100000000L };
090: static final long[] jjbitVec11 = { 0x23cdfdfffff99fe0L,
091: 0x3b0000000L, 0x3bfc718d63dc7e0L, 0x0L };
092: static final long[] jjbitVec12 = { 0x3effdfffffddfe0L,
093: 0x300000000L, 0x3effdfffffddfe0L, 0x340000000L };
094: static final long[] jjbitVec13 = { 0x3fffdfffffddfe0L,
095: 0x300000000L, 0x0L, 0x0L };
096: static final long[] jjbitVec14 = { 0xd7ffffffffffeL, 0x3fL,
097: 0x200d6caefef02596L, 0x1fL };
098: static final long[] jjbitVec15 = { 0x0L, 0x3fffffffeffL, 0x0L, 0x0L };
099: static final long[] jjbitVec16 = { 0x0L, 0x0L, 0xffffffff00000000L,
100: 0x7fffffffff003fL };
101: static final long[] jjbitVec17 = { 0x500000000007daedL,
102: 0x2c62ab82315001L, 0xf580c90040000000L, 0x201080000000007L };
103: static final long[] jjbitVec18 = { 0xffffffffffffffffL,
104: 0xffffffffffffffffL, 0xffffffff0fffffffL,
105: 0x3ffffffffffffffL };
106: static final long[] jjbitVec19 = { 0xffffffff3f3fffffL,
107: 0x3fffffffaaff3f3fL, 0x5fdfffffffffffffL,
108: 0x1fdc1fff0fcf1fdcL };
109: static final long[] jjbitVec20 = { 0x4c4000000000L, 0x0L, 0x7L,
110: 0x0L };
111: static final long[] jjbitVec21 = { 0x3fe00000080L,
112: 0xfffffffffffffffeL, 0xfffffffe001fffffL,
113: 0x7ffffffffffffffL };
114: static final long[] jjbitVec22 = { 0x1fffffffffe0L, 0x0L, 0x0L,
115: 0x0L };
116: static final long[] jjbitVec23 = { 0xffffffffffffffffL,
117: 0xffffffffffffffffL, 0x3fffffffffL, 0x0L };
118: static final long[] jjbitVec24 = { 0xffffffffffffffffL,
119: 0xffffffffffffffffL, 0xfffffffffL, 0x0L };
120: static final long[] jjbitVec25 = { 0x0L, 0x0L, 0x80000000000000L,
121: 0xff7fffffff7fffffL };
122: static final long[] jjbitVec26 = { 0xffffffL, 0xffffffffffff0000L,
123: 0xf80001ffffffffffL, 0x30003L };
124: static final long[] jjbitVec27 = { 0xffffffffffffffffL,
125: 0x30000003fL, 0xfffffffbffffd7c0L, 0xffffd547f7fffL };
126: static final long[] jjbitVec28 = { 0xffffffffffffdffeL,
127: 0xffffffffdffeffffL, 0xffffffffffff007bL,
128: 0x33fcfffffff199fL };
129: static final long[] jjbitVec29 = { 0xfffe000000000000L,
130: 0xfffffffe027fffffL, 0xbbfffffbfffe007fL, 0x707ffffff0016L };
131: static final long[] jjbitVec30 = { 0x7fffffe00000000L,
132: 0xffff03ff0007ffffL, 0x7cffffffffffffffL,
133: 0x3ff3dffffef7fffL };
134: static final long[] jjbitVec31 = { 0xf3ffffffffffffeeL,
135: 0xffcfff1e3fffL, 0xd3c5fdfffff99feeL, 0x3ffcfb080399fL };
136: static final long[] jjbitVec32 = { 0xd36dfdfffff987e4L,
137: 0x1fffc05e003987L, 0xf3edfdfffffbafeeL, 0xffc100003bbfL };
138: static final long[] jjbitVec33 = { 0xf3cdfdfffff99feeL,
139: 0xffc3b0c0398fL, 0xc3bfc718d63dc7ecL, 0xff8000803dc7L };
140: static final long[] jjbitVec34 = { 0xc3effdfffffddfeeL,
141: 0xffc300603ddfL, 0xc3effdfffffddfecL, 0xffc340603ddfL };
142: static final long[] jjbitVec35 = { 0xc3fffdfffffddfecL,
143: 0xffc300803dcfL, 0x0L, 0x0L };
144: static final long[] jjbitVec36 = { 0x7ff7ffffffffffeL, 0x3ff7fffL,
145: 0x3bff6caefef02596L, 0x3ff3f5fL };
146: static final long[] jjbitVec37 = { 0xc2a003ff03000000L,
147: 0xfffe03fffffffeffL, 0x2fe3ffffebf0fdfL, 0x0L };
148: static final long[] jjbitVec38 = { 0x0L, 0x0L, 0x0L, 0x21fff0000L };
149: static final long[] jjbitVec39 = { 0x3efffe000000a0L,
150: 0xfffffffffffffffeL, 0xfffffffe661fffffL,
151: 0x77ffffffffffffffL };
152:
153: private final int jjMoveNfa_0(int startState, int curPos) {
154: int startsAt = 0;
155: jjnewStateCnt = 7;
156: int i = 1;
157: jjstateSet[0] = startState;
158: int kind = 0x7fffffff;
159: for (;;) {
160: if (++jjround == 0x7fffffff)
161: ReInitRounds();
162: if (curChar < 64) {
163: long l = 1L << curChar;
164: MatchLoop: do {
165: switch (jjstateSet[--i]) {
166: case 0:
167: if ((0x100002600L & l) != 0L)
168: kind = 8;
169: break;
170: case 2:
171: if ((0x3ff600000000000L & l) == 0L)
172: break;
173: if (kind > 7)
174: kind = 7;
175: jjstateSet[jjnewStateCnt++] = 2;
176: break;
177: case 3:
178: if ((0x3ff600000000000L & l) != 0L)
179: jjAddStates(0, 1);
180: break;
181: case 4:
182: if (curChar == 58)
183: jjstateSet[jjnewStateCnt++] = 5;
184: break;
185: case 6:
186: if ((0x3ff600000000000L & l) == 0L)
187: break;
188: if (kind > 9)
189: kind = 9;
190: jjstateSet[jjnewStateCnt++] = 6;
191: break;
192: default:
193: break;
194: }
195: } while (i != startsAt);
196: } else if (curChar < 128) {
197: long l = 1L << (curChar & 077);
198: MatchLoop: do {
199: switch (jjstateSet[--i]) {
200: case 0:
201: if ((0x7fffffe87fffffeL & l) == 0L)
202: break;
203: if (kind > 7)
204: kind = 7;
205: jjCheckNAddStates(2, 5);
206: break;
207: case 2:
208: if ((0x7fffffe87fffffeL & l) == 0L)
209: break;
210: if (kind > 7)
211: kind = 7;
212: jjCheckNAdd(2);
213: break;
214: case 3:
215: if ((0x7fffffe87fffffeL & l) != 0L)
216: jjCheckNAddTwoStates(3, 4);
217: break;
218: case 5:
219: case 6:
220: if ((0x7fffffe87fffffeL & l) == 0L)
221: break;
222: if (kind > 9)
223: kind = 9;
224: jjCheckNAdd(6);
225: break;
226: default:
227: break;
228: }
229: } while (i != startsAt);
230: } else {
231: int hiByte = (curChar >> 8);
232: int i1 = hiByte >> 6;
233: long l1 = 1L << (hiByte & 077);
234: int i2 = (curChar & 0xff) >> 6;
235: long l2 = 1L << (curChar & 077);
236: MatchLoop: do {
237: switch (jjstateSet[--i]) {
238: case 0:
239: if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
240: break;
241: if (kind > 7)
242: kind = 7;
243: jjCheckNAddStates(2, 5);
244: break;
245: case 2:
246: if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
247: break;
248: if (kind > 7)
249: kind = 7;
250: jjCheckNAdd(2);
251: break;
252: case 3:
253: if (jjCanMove_1(hiByte, i1, i2, l1, l2))
254: jjCheckNAddTwoStates(3, 4);
255: break;
256: case 5:
257: if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
258: break;
259: if (kind > 9)
260: kind = 9;
261: jjCheckNAdd(6);
262: break;
263: case 6:
264: if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
265: break;
266: if (kind > 9)
267: kind = 9;
268: jjCheckNAdd(6);
269: break;
270: default:
271: break;
272: }
273: } while (i != startsAt);
274: }
275: if (kind != 0x7fffffff) {
276: jjmatchedKind = kind;
277: jjmatchedPos = curPos;
278: kind = 0x7fffffff;
279: }
280: ++curPos;
281: if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt)))
282: return curPos;
283: try {
284: curChar = input_stream.readChar();
285: } catch (java.io.IOException e) {
286: return curPos;
287: }
288: }
289: }
290:
291: private final int jjStopStringLiteralDfa_1(int pos, long active0) {
292: switch (pos) {
293: default:
294: return -1;
295: }
296: }
297:
298: private final int jjStartNfa_1(int pos, long active0) {
299: return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0),
300: pos + 1);
301: }
302:
303: private final int jjMoveStringLiteralDfa0_1() {
304: switch (curChar) {
305: case 40:
306: return jjStopAtPos(0, 10);
307: case 41:
308: return jjStopAtPos(0, 11);
309: case 94:
310: return jjMoveStringLiteralDfa1_1(0x7000L);
311: default:
312: return jjMoveNfa_1(0, 0);
313: }
314: }
315:
316: private final int jjMoveStringLiteralDfa1_1(long active0) {
317: try {
318: curChar = input_stream.readChar();
319: } catch (java.io.IOException e) {
320: jjStopStringLiteralDfa_1(0, active0);
321: return 1;
322: }
323: switch (curChar) {
324: case 40:
325: if ((active0 & 0x1000L) != 0L)
326: return jjStopAtPos(1, 12);
327: break;
328: case 41:
329: if ((active0 & 0x2000L) != 0L)
330: return jjStopAtPos(1, 13);
331: break;
332: case 94:
333: if ((active0 & 0x4000L) != 0L)
334: return jjStopAtPos(1, 14);
335: break;
336: default:
337: break;
338: }
339: return jjStartNfa_1(0, active0);
340: }
341:
342: static final long[] jjbitVec40 = { 0xfffffffffffffffeL,
343: 0xffffffffffffffffL, 0xffffffffffffffffL,
344: 0xffffffffffffffffL };
345: static final long[] jjbitVec41 = { 0x0L, 0x0L, 0xffffffffffffffffL,
346: 0xffffffffffffffffL };
347:
348: private final int jjMoveNfa_1(int startState, int curPos) {
349: int startsAt = 0;
350: jjnewStateCnt = 1;
351: int i = 1;
352: jjstateSet[0] = startState;
353: int kind = 0x7fffffff;
354: for (;;) {
355: if (++jjround == 0x7fffffff)
356: ReInitRounds();
357: if (curChar < 64) {
358: long l = 1L << curChar;
359: MatchLoop: do {
360: switch (jjstateSet[--i]) {
361: case 0:
362: if ((0xfffffcffffffffffL & l) != 0L)
363: kind = 15;
364: break;
365: default:
366: break;
367: }
368: } while (i != startsAt);
369: } else if (curChar < 128) {
370: long l = 1L << (curChar & 077);
371: MatchLoop: do {
372: switch (jjstateSet[--i]) {
373: case 0:
374: if ((0xffffffffbfffffffL & l) != 0L)
375: kind = 15;
376: break;
377: default:
378: break;
379: }
380: } while (i != startsAt);
381: } else {
382: int hiByte = (curChar >> 8);
383: int i1 = hiByte >> 6;
384: long l1 = 1L << (hiByte & 077);
385: int i2 = (curChar & 0xff) >> 6;
386: long l2 = 1L << (curChar & 077);
387: MatchLoop: do {
388: switch (jjstateSet[--i]) {
389: case 0:
390: if (jjCanMove_2(hiByte, i1, i2, l1, l2)
391: && kind > 15)
392: kind = 15;
393: break;
394: default:
395: break;
396: }
397: } while (i != startsAt);
398: }
399: if (kind != 0x7fffffff) {
400: jjmatchedKind = kind;
401: jjmatchedPos = curPos;
402: kind = 0x7fffffff;
403: }
404: ++curPos;
405: if ((i = jjnewStateCnt) == (startsAt = 1 - (jjnewStateCnt = startsAt)))
406: return curPos;
407: try {
408: curChar = input_stream.readChar();
409: } catch (java.io.IOException e) {
410: return curPos;
411: }
412: }
413: }
414:
415: static final int[] jjnextStates = { 3, 4, 2, 3, 4, 6, };
416:
417: private static final boolean jjCanMove_0(int hiByte, int i1,
418: int i2, long l1, long l2) {
419: switch (hiByte) {
420: case 0:
421: return ((jjbitVec2[i2] & l2) != 0L);
422: case 1:
423: return ((jjbitVec3[i2] & l2) != 0L);
424: case 2:
425: return ((jjbitVec4[i2] & l2) != 0L);
426: case 3:
427: return ((jjbitVec5[i2] & l2) != 0L);
428: case 4:
429: return ((jjbitVec6[i2] & l2) != 0L);
430: case 5:
431: return ((jjbitVec7[i2] & l2) != 0L);
432: case 6:
433: return ((jjbitVec8[i2] & l2) != 0L);
434: case 9:
435: return ((jjbitVec9[i2] & l2) != 0L);
436: case 10:
437: return ((jjbitVec10[i2] & l2) != 0L);
438: case 11:
439: return ((jjbitVec11[i2] & l2) != 0L);
440: case 12:
441: return ((jjbitVec12[i2] & l2) != 0L);
442: case 13:
443: return ((jjbitVec13[i2] & l2) != 0L);
444: case 14:
445: return ((jjbitVec14[i2] & l2) != 0L);
446: case 15:
447: return ((jjbitVec15[i2] & l2) != 0L);
448: case 16:
449: return ((jjbitVec16[i2] & l2) != 0L);
450: case 17:
451: return ((jjbitVec17[i2] & l2) != 0L);
452: case 30:
453: return ((jjbitVec18[i2] & l2) != 0L);
454: case 31:
455: return ((jjbitVec19[i2] & l2) != 0L);
456: case 33:
457: return ((jjbitVec20[i2] & l2) != 0L);
458: case 48:
459: return ((jjbitVec21[i2] & l2) != 0L);
460: case 49:
461: return ((jjbitVec22[i2] & l2) != 0L);
462: case 159:
463: return ((jjbitVec23[i2] & l2) != 0L);
464: case 215:
465: return ((jjbitVec24[i2] & l2) != 0L);
466: default:
467: if ((jjbitVec0[i1] & l1) != 0L)
468: return true;
469: return false;
470: }
471: }
472:
473: private static final boolean jjCanMove_1(int hiByte, int i1,
474: int i2, long l1, long l2) {
475: switch (hiByte) {
476: case 0:
477: return ((jjbitVec25[i2] & l2) != 0L);
478: case 1:
479: return ((jjbitVec3[i2] & l2) != 0L);
480: case 2:
481: return ((jjbitVec26[i2] & l2) != 0L);
482: case 3:
483: return ((jjbitVec27[i2] & l2) != 0L);
484: case 4:
485: return ((jjbitVec28[i2] & l2) != 0L);
486: case 5:
487: return ((jjbitVec29[i2] & l2) != 0L);
488: case 6:
489: return ((jjbitVec30[i2] & l2) != 0L);
490: case 9:
491: return ((jjbitVec31[i2] & l2) != 0L);
492: case 10:
493: return ((jjbitVec32[i2] & l2) != 0L);
494: case 11:
495: return ((jjbitVec33[i2] & l2) != 0L);
496: case 12:
497: return ((jjbitVec34[i2] & l2) != 0L);
498: case 13:
499: return ((jjbitVec35[i2] & l2) != 0L);
500: case 14:
501: return ((jjbitVec36[i2] & l2) != 0L);
502: case 15:
503: return ((jjbitVec37[i2] & l2) != 0L);
504: case 16:
505: return ((jjbitVec16[i2] & l2) != 0L);
506: case 17:
507: return ((jjbitVec17[i2] & l2) != 0L);
508: case 30:
509: return ((jjbitVec18[i2] & l2) != 0L);
510: case 31:
511: return ((jjbitVec19[i2] & l2) != 0L);
512: case 32:
513: return ((jjbitVec38[i2] & l2) != 0L);
514: case 33:
515: return ((jjbitVec20[i2] & l2) != 0L);
516: case 48:
517: return ((jjbitVec39[i2] & l2) != 0L);
518: case 49:
519: return ((jjbitVec22[i2] & l2) != 0L);
520: case 159:
521: return ((jjbitVec23[i2] & l2) != 0L);
522: case 215:
523: return ((jjbitVec24[i2] & l2) != 0L);
524: default:
525: if ((jjbitVec0[i1] & l1) != 0L)
526: return true;
527: return false;
528: }
529: }
530:
531: private static final boolean jjCanMove_2(int hiByte, int i1,
532: int i2, long l1, long l2) {
533: switch (hiByte) {
534: case 0:
535: return ((jjbitVec41[i2] & l2) != 0L);
536: default:
537: if ((jjbitVec40[i1] & l1) != 0L)
538: return true;
539: return false;
540: }
541: }
542:
543: public static final String[] jjstrLiteralImages = { "", null, null,
544: null, null, null, null, null, null, null, "\50", "\51",
545: "\136\50", "\136\51", "\136\136", null, };
546: public static final String[] lexStateNames = { "DEFAULT",
547: "IN_SCHEME", };
548: public static final int[] jjnewLexState = { -1, -1, -1, -1, -1, -1,
549: -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, };
550: protected SimpleCharStream input_stream;
551: private final int[] jjrounds = new int[7];
552: private final int[] jjstateSet = new int[14];
553: protected char curChar;
554:
555: public XPointerFrameworkParserTokenManager(SimpleCharStream stream) {
556: if (SimpleCharStream.staticFlag)
557: throw new Error(
558: "ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
559: input_stream = stream;
560: }
561:
562: public XPointerFrameworkParserTokenManager(SimpleCharStream stream,
563: int lexState) {
564: this (stream);
565: switchTo(lexState);
566: }
567:
568: public void reInit(SimpleCharStream stream) {
569: jjmatchedPos = jjnewStateCnt = 0;
570: curLexState = defaultLexState;
571: input_stream = stream;
572: ReInitRounds();
573: }
574:
575: private final void ReInitRounds() {
576: int i;
577: jjround = 0x80000001;
578: for (i = 7; i-- > 0;)
579: jjrounds[i] = 0x80000000;
580: }
581:
582: public void reInit(SimpleCharStream stream, int lexState) {
583: reInit(stream);
584: switchTo(lexState);
585: }
586:
587: public void switchTo(int lexState) {
588: if (lexState >= 2 || lexState < 0)
589: throw new TokenMgrError(
590: "Error: Ignoring invalid lexical state : "
591: + lexState + ". State unchanged.",
592: TokenMgrError.INVALID_LEXICAL_STATE);
593: else
594: curLexState = lexState;
595: }
596:
597: protected Token jjFillToken() {
598: Token t = Token.newToken(jjmatchedKind);
599: t.kind = jjmatchedKind;
600: String im = jjstrLiteralImages[jjmatchedKind];
601: t.image = (im == null) ? input_stream.getImage() : im;
602: t.beginLine = input_stream.getBeginLine();
603: t.beginColumn = input_stream.getBeginColumn();
604: t.endLine = input_stream.getEndLine();
605: t.endColumn = input_stream.getEndColumn();
606: return t;
607: }
608:
609: int curLexState = 0;
610: int defaultLexState = 0;
611: int jjnewStateCnt;
612: int jjround;
613: int jjmatchedPos;
614: int jjmatchedKind;
615:
616: public Token getNextToken() {
617: Token matchedToken;
618: int curPos = 0;
619:
620: EOFLoop: for (;;) {
621: try {
622: curChar = input_stream.beginToken();
623: } catch (java.io.IOException e) {
624: jjmatchedKind = 0;
625: matchedToken = jjFillToken();
626: return matchedToken;
627: }
628:
629: switch (curLexState) {
630: case 0:
631: jjmatchedKind = 0x7fffffff;
632: jjmatchedPos = 0;
633: curPos = jjMoveStringLiteralDfa0_0();
634: break;
635: case 1:
636: jjmatchedKind = 0x7fffffff;
637: jjmatchedPos = 0;
638: curPos = jjMoveStringLiteralDfa0_1();
639: break;
640: }
641: if (jjmatchedKind != 0x7fffffff) {
642: if (jjmatchedPos + 1 < curPos)
643: input_stream.backup(curPos - jjmatchedPos - 1);
644: matchedToken = jjFillToken();
645: if (jjnewLexState[jjmatchedKind] != -1)
646: curLexState = jjnewLexState[jjmatchedKind];
647: return matchedToken;
648: }
649: int error_line = input_stream.getEndLine();
650: int error_column = input_stream.getEndColumn();
651: String error_after = null;
652: boolean EOFSeen = false;
653: try {
654: input_stream.readChar();
655: input_stream.backup(1);
656: } catch (java.io.IOException e1) {
657: EOFSeen = true;
658: error_after = curPos <= 1 ? "" : input_stream
659: .getImage();
660: if (curChar == '\n' || curChar == '\r') {
661: error_line++;
662: error_column = 0;
663: } else
664: error_column++;
665: }
666: if (!EOFSeen) {
667: input_stream.backup(1);
668: error_after = curPos <= 1 ? "" : input_stream
669: .getImage();
670: }
671: throw new TokenMgrError(EOFSeen, curLexState, error_line,
672: error_column, error_after, curChar,
673: TokenMgrError.LEXICAL_ERROR);
674: }
675: }
676:
677: }
|