001: /* Generated By:JavaCC: Do not edit this line. JSONParserTokenManager.java */
002: package de.schlund.pfixcore.webservice.json.parser;
003:
004: public class JSONParserTokenManager implements JSONParserConstants {
005: public java.io.PrintStream debugStream = System.out;
006:
007: public void setDebugStream(java.io.PrintStream ds) {
008: debugStream = ds;
009: }
010:
011: private final int jjStopStringLiteralDfa_0(int pos, long active0) {
012: switch (pos) {
013: case 0:
014: if ((active0 & 0x4000L) != 0L)
015: return 47;
016: return -1;
017: default:
018: return -1;
019: }
020: }
021:
022: private final int jjStartNfa_0(int pos, long active0) {
023: return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0),
024: pos + 1);
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 44:
036: return jjStopAtPos(0, 11);
037: case 58:
038: return jjStopAtPos(0, 10);
039: case 91:
040: return jjStopAtPos(0, 8);
041: case 93:
042: return jjStopAtPos(0, 9);
043: case 102:
044: return jjMoveStringLiteralDfa1_0(0x2000L);
045: case 110:
046: return jjMoveStringLiteralDfa1_0(0x4000L);
047: case 116:
048: return jjMoveStringLiteralDfa1_0(0x1000L);
049: case 123:
050: return jjStopAtPos(0, 6);
051: case 125:
052: return jjStopAtPos(0, 7);
053: default:
054: return jjMoveNfa_0(0, 0);
055: }
056: }
057:
058: private final int jjMoveStringLiteralDfa1_0(long active0) {
059: try {
060: curChar = input_stream.readChar();
061: } catch (java.io.IOException e) {
062: jjStopStringLiteralDfa_0(0, active0);
063: return 1;
064: }
065: switch (curChar) {
066: case 97:
067: return jjMoveStringLiteralDfa2_0(active0, 0x2000L);
068: case 114:
069: return jjMoveStringLiteralDfa2_0(active0, 0x1000L);
070: case 117:
071: return jjMoveStringLiteralDfa2_0(active0, 0x4000L);
072: default:
073: break;
074: }
075: return jjStartNfa_0(0, active0);
076: }
077:
078: private final int jjMoveStringLiteralDfa2_0(long old0, long active0) {
079: if (((active0 &= old0)) == 0L)
080: return jjStartNfa_0(0, old0);
081: try {
082: curChar = input_stream.readChar();
083: } catch (java.io.IOException e) {
084: jjStopStringLiteralDfa_0(1, active0);
085: return 2;
086: }
087: switch (curChar) {
088: case 108:
089: return jjMoveStringLiteralDfa3_0(active0, 0x6000L);
090: case 117:
091: return jjMoveStringLiteralDfa3_0(active0, 0x1000L);
092: default:
093: break;
094: }
095: return jjStartNfa_0(1, active0);
096: }
097:
098: private final int jjMoveStringLiteralDfa3_0(long old0, long active0) {
099: if (((active0 &= old0)) == 0L)
100: return jjStartNfa_0(1, old0);
101: try {
102: curChar = input_stream.readChar();
103: } catch (java.io.IOException e) {
104: jjStopStringLiteralDfa_0(2, active0);
105: return 3;
106: }
107: switch (curChar) {
108: case 101:
109: if ((active0 & 0x1000L) != 0L)
110: return jjStopAtPos(3, 12);
111: break;
112: case 108:
113: if ((active0 & 0x4000L) != 0L)
114: return jjStopAtPos(3, 14);
115: break;
116: case 115:
117: return jjMoveStringLiteralDfa4_0(active0, 0x2000L);
118: default:
119: break;
120: }
121: return jjStartNfa_0(2, active0);
122: }
123:
124: private final int jjMoveStringLiteralDfa4_0(long old0, long active0) {
125: if (((active0 &= old0)) == 0L)
126: return jjStartNfa_0(2, old0);
127: try {
128: curChar = input_stream.readChar();
129: } catch (java.io.IOException e) {
130: jjStopStringLiteralDfa_0(3, active0);
131: return 4;
132: }
133: switch (curChar) {
134: case 101:
135: if ((active0 & 0x2000L) != 0L)
136: return jjStopAtPos(4, 13);
137: break;
138: default:
139: break;
140: }
141: return jjStartNfa_0(3, active0);
142: }
143:
144: private final void jjCheckNAdd(int state) {
145: if (jjrounds[state] != jjround) {
146: jjstateSet[jjnewStateCnt++] = state;
147: jjrounds[state] = jjround;
148: }
149: }
150:
151: private final void jjAddStates(int start, int end) {
152: do {
153: jjstateSet[jjnewStateCnt++] = jjnextStates[start];
154: } while (start++ != end);
155: }
156:
157: private final void jjCheckNAddTwoStates(int state1, int state2) {
158: jjCheckNAdd(state1);
159: jjCheckNAdd(state2);
160: }
161:
162: private final void jjCheckNAddStates(int start, int end) {
163: do {
164: jjCheckNAdd(jjnextStates[start]);
165: } while (start++ != end);
166: }
167:
168: static final long[] jjbitVec0 = { 0xfffffffffffffffeL,
169: 0xffffffffffffffffL, 0xffffffffffffffffL,
170: 0xffffffffffffffffL };
171: static final long[] jjbitVec2 = { 0x0L, 0x0L, 0xffffffffffffffffL,
172: 0xffffffffffffffffL };
173:
174: @SuppressWarnings("unused")
175: private final int jjMoveNfa_0(int startState, int curPos) {
176: int[] nextStates;
177: int startsAt = 0;
178: jjnewStateCnt = 49;
179: int i = 1;
180: jjstateSet[0] = startState;
181: int j, kind = 0x7fffffff;
182: for (;;) {
183: if (++jjround == 0x7fffffff)
184: ReInitRounds();
185: if (curChar < 64) {
186: long l = 1L << curChar;
187: MatchLoop: do {
188: switch (jjstateSet[--i]) {
189: case 0:
190: if ((0x3fe000000000000L & l) != 0L) {
191: if (kind > 17)
192: kind = 17;
193: jjCheckNAddStates(0, 2);
194: } else if (curChar == 48) {
195: if (kind > 17)
196: kind = 17;
197: jjCheckNAddTwoStates(12, 14);
198: } else if (curChar == 45)
199: jjAddStates(3, 4);
200: else if (curChar == 34)
201: jjCheckNAddStates(5, 7);
202: break;
203: case 1:
204: if ((0xfffffffb00000000L & l) != 0L)
205: jjCheckNAddStates(5, 7);
206: break;
207: case 3:
208: if (curChar == 34)
209: jjCheckNAddStates(5, 7);
210: break;
211: case 4:
212: if (curChar == 34 && kind > 15)
213: kind = 15;
214: break;
215: case 6:
216: if ((0x3ff000000000000L & l) != 0L)
217: jjstateSet[jjnewStateCnt++] = 7;
218: break;
219: case 7:
220: if ((0x3ff000000000000L & l) != 0L)
221: jjstateSet[jjnewStateCnt++] = 8;
222: break;
223: case 8:
224: if ((0x3ff000000000000L & l) != 0L)
225: jjstateSet[jjnewStateCnt++] = 9;
226: break;
227: case 9:
228: if ((0x3ff000000000000L & l) != 0L)
229: jjCheckNAddStates(5, 7);
230: break;
231: case 10:
232: if (curChar == 45)
233: jjAddStates(3, 4);
234: break;
235: case 11:
236: if (curChar != 48)
237: break;
238: if (kind > 17)
239: kind = 17;
240: jjCheckNAddTwoStates(12, 14);
241: break;
242: case 12:
243: if (curChar == 46)
244: jjCheckNAdd(13);
245: break;
246: case 13:
247: if ((0x3ff000000000000L & l) == 0L)
248: break;
249: if (kind > 17)
250: kind = 17;
251: jjCheckNAddTwoStates(13, 14);
252: break;
253: case 15:
254: if ((0x280000000000L & l) != 0L)
255: jjCheckNAdd(16);
256: break;
257: case 16:
258: if ((0x3ff000000000000L & l) == 0L)
259: break;
260: if (kind > 17)
261: kind = 17;
262: jjCheckNAdd(16);
263: break;
264: case 17:
265: if ((0x3fe000000000000L & l) == 0L)
266: break;
267: if (kind > 17)
268: kind = 17;
269: jjCheckNAddStates(0, 2);
270: break;
271: case 18:
272: if ((0x3ff000000000000L & l) == 0L)
273: break;
274: if (kind > 17)
275: kind = 17;
276: jjCheckNAddStates(0, 2);
277: break;
278: case 19:
279: if (curChar == 40)
280: jjCheckNAddStates(8, 11);
281: break;
282: case 20:
283: if (curChar == 45)
284: jjCheckNAddTwoStates(21, 23);
285: break;
286: case 21:
287: if (curChar == 48)
288: jjCheckNAdd(22);
289: break;
290: case 22:
291: if (curChar == 41 && kind > 18)
292: kind = 18;
293: break;
294: case 23:
295: if ((0x3fe000000000000L & l) != 0L)
296: jjCheckNAddTwoStates(24, 22);
297: break;
298: case 24:
299: if ((0x3ff000000000000L & l) != 0L)
300: jjCheckNAddTwoStates(24, 22);
301: break;
302: case 25:
303: if (curChar == 40)
304: jjCheckNAddTwoStates(26, 31);
305: break;
306: case 26:
307: if (curChar == 48)
308: jjCheckNAddTwoStates(27, 30);
309: break;
310: case 27:
311: if (curChar == 44)
312: jjCheckNAddTwoStates(26, 28);
313: break;
314: case 28:
315: if ((0x3fe000000000000L & l) != 0L)
316: jjCheckNAddStates(12, 14);
317: break;
318: case 29:
319: if ((0x3ff000000000000L & l) != 0L)
320: jjCheckNAddStates(12, 14);
321: break;
322: case 30:
323: if (curChar == 41)
324: jjCheckNAdd(22);
325: break;
326: case 31:
327: if ((0x3fe000000000000L & l) != 0L)
328: jjCheckNAddStates(15, 17);
329: break;
330: case 32:
331: if ((0x3ff000000000000L & l) != 0L)
332: jjCheckNAddStates(15, 17);
333: break;
334: case 36:
335: if (curChar == 46)
336: jjstateSet[jjnewStateCnt++] = 35;
337: break;
338: case 45:
339: if (curChar == 32)
340: jjstateSet[jjnewStateCnt++] = 44;
341: break;
342: default:
343: break;
344: }
345: } while (i != startsAt);
346: } else if (curChar < 128) {
347: long l = 1L << (curChar & 077);
348: MatchLoop: do {
349: switch (jjstateSet[--i]) {
350: case 0:
351: if (curChar == 110)
352: jjstateSet[jjnewStateCnt++] = 47;
353: break;
354: case 1:
355: if ((0xffffffffefffffffL & l) != 0L)
356: jjCheckNAddStates(5, 7);
357: break;
358: case 2:
359: if (curChar == 92)
360: jjAddStates(18, 19);
361: break;
362: case 3:
363: if ((0x14404410000000L & l) != 0L)
364: jjCheckNAddStates(5, 7);
365: break;
366: case 5:
367: if (curChar == 117)
368: jjstateSet[jjnewStateCnt++] = 6;
369: break;
370: case 6:
371: if ((0x7e0000007eL & l) != 0L)
372: jjstateSet[jjnewStateCnt++] = 7;
373: break;
374: case 7:
375: if ((0x7e0000007eL & l) != 0L)
376: jjstateSet[jjnewStateCnt++] = 8;
377: break;
378: case 8:
379: if ((0x7e0000007eL & l) != 0L)
380: jjstateSet[jjnewStateCnt++] = 9;
381: break;
382: case 9:
383: if ((0x7e0000007eL & l) != 0L)
384: jjCheckNAddStates(5, 7);
385: break;
386: case 14:
387: if ((0x2000000020L & l) != 0L)
388: jjAddStates(20, 21);
389: break;
390: case 33:
391: if (curChar == 67)
392: jjstateSet[jjnewStateCnt++] = 25;
393: break;
394: case 34:
395: if (curChar == 84)
396: jjstateSet[jjnewStateCnt++] = 33;
397: break;
398: case 35:
399: if (curChar == 85)
400: jjstateSet[jjnewStateCnt++] = 34;
401: break;
402: case 37:
403: if (curChar == 101)
404: jjstateSet[jjnewStateCnt++] = 36;
405: break;
406: case 38:
407: if (curChar == 116)
408: jjstateSet[jjnewStateCnt++] = 37;
409: break;
410: case 39:
411: if (curChar == 97)
412: jjstateSet[jjnewStateCnt++] = 38;
413: break;
414: case 40:
415: if (curChar == 68)
416: jjstateSet[jjnewStateCnt++] = 39;
417: break;
418: case 41:
419: if (curChar == 101)
420: jjstateSet[jjnewStateCnt++] = 19;
421: break;
422: case 42:
423: if (curChar == 116)
424: jjstateSet[jjnewStateCnt++] = 41;
425: break;
426: case 43:
427: if (curChar == 97)
428: jjstateSet[jjnewStateCnt++] = 42;
429: break;
430: case 44:
431: if (curChar == 68)
432: jjstateSet[jjnewStateCnt++] = 43;
433: break;
434: case 46:
435: if (curChar == 119)
436: jjstateSet[jjnewStateCnt++] = 45;
437: break;
438: case 47:
439: if (curChar == 101)
440: jjstateSet[jjnewStateCnt++] = 46;
441: break;
442: default:
443: break;
444: }
445: } while (i != startsAt);
446: } else {
447: int hiByte = (int) (curChar >> 8);
448: int i1 = hiByte >> 6;
449: long l1 = 1L << (hiByte & 077);
450: int i2 = (curChar & 0xff) >> 6;
451: long l2 = 1L << (curChar & 077);
452: MatchLoop: do {
453: switch (jjstateSet[--i]) {
454: case 1:
455: if (jjCanMove_0(hiByte, i1, i2, l1, l2))
456: jjAddStates(5, 7);
457: break;
458: default:
459: break;
460: }
461: } while (i != startsAt);
462: }
463: if (kind != 0x7fffffff) {
464: jjmatchedKind = kind;
465: jjmatchedPos = curPos;
466: kind = 0x7fffffff;
467: }
468: ++curPos;
469: if ((i = jjnewStateCnt) == (startsAt = 49 - (jjnewStateCnt = startsAt)))
470: return curPos;
471: try {
472: curChar = input_stream.readChar();
473: } catch (java.io.IOException e) {
474: return curPos;
475: }
476: }
477: }
478:
479: static final int[] jjnextStates = { 18, 12, 14, 11, 17, 1, 2, 4,
480: 20, 21, 23, 40, 27, 29, 30, 32, 27, 30, 3, 5, 15, 16, };
481:
482: private static final boolean jjCanMove_0(int hiByte, int i1,
483: int i2, long l1, long l2) {
484: switch (hiByte) {
485: case 0:
486: return ((jjbitVec2[i2] & l2) != 0L);
487: default:
488: if ((jjbitVec0[i1] & l1) != 0L)
489: return true;
490: return false;
491: }
492: }
493:
494: public static final String[] jjstrLiteralImages = { "", null, null,
495: null, null, null, "\173", "\175", "\133", "\135", "\72",
496: "\54", "\164\162\165\145", "\146\141\154\163\145",
497: "\156\165\154\154", null, null, null, null, };
498: public static final String[] lexStateNames = { "DEFAULT", };
499: static final long[] jjtoToken = { 0x6ffc1L, };
500: static final long[] jjtoSkip = { 0x3eL, };
501: protected SimpleCharStream input_stream;
502: private final int[] jjrounds = new int[49];
503: private final int[] jjstateSet = new int[98];
504: protected char curChar;
505:
506: public JSONParserTokenManager(SimpleCharStream stream) {
507: if (SimpleCharStream.staticFlag)
508: throw new Error(
509: "ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
510: input_stream = stream;
511: }
512:
513: public JSONParserTokenManager(SimpleCharStream stream, int lexState) {
514: this (stream);
515: SwitchTo(lexState);
516: }
517:
518: public void ReInit(SimpleCharStream stream) {
519: jjmatchedPos = jjnewStateCnt = 0;
520: curLexState = defaultLexState;
521: input_stream = stream;
522: ReInitRounds();
523: }
524:
525: private final void ReInitRounds() {
526: int i;
527: jjround = 0x80000001;
528: for (i = 49; i-- > 0;)
529: jjrounds[i] = 0x80000000;
530: }
531:
532: public void ReInit(SimpleCharStream stream, int lexState) {
533: ReInit(stream);
534: SwitchTo(lexState);
535: }
536:
537: public void SwitchTo(int lexState) {
538: if (lexState >= 1 || lexState < 0)
539: throw new TokenMgrError(
540: "Error: Ignoring invalid lexical state : "
541: + lexState + ". State unchanged.",
542: TokenMgrError.INVALID_LEXICAL_STATE);
543: else
544: curLexState = lexState;
545: }
546:
547: protected Token jjFillToken() {
548: Token t = Token.newToken(jjmatchedKind);
549: t.kind = jjmatchedKind;
550: String im = jjstrLiteralImages[jjmatchedKind];
551: t.image = (im == null) ? input_stream.GetImage() : im;
552: t.beginLine = input_stream.getBeginLine();
553: t.beginColumn = input_stream.getBeginColumn();
554: t.endLine = input_stream.getEndLine();
555: t.endColumn = input_stream.getEndColumn();
556: return t;
557: }
558:
559: int curLexState = 0;
560: int defaultLexState = 0;
561: int jjnewStateCnt;
562: int jjround;
563: int jjmatchedPos;
564: int jjmatchedKind;
565:
566: public Token getNextToken() {
567: Token matchedToken;
568: int curPos = 0;
569:
570: EOFLoop: for (;;) {
571: try {
572: curChar = input_stream.BeginToken();
573: } catch (java.io.IOException e) {
574: jjmatchedKind = 0;
575: matchedToken = jjFillToken();
576: return matchedToken;
577: }
578:
579: try {
580: input_stream.backup(0);
581: while (curChar <= 32
582: && (0x100003600L & (1L << curChar)) != 0L)
583: curChar = input_stream.BeginToken();
584: } catch (java.io.IOException e1) {
585: continue EOFLoop;
586: }
587: jjmatchedKind = 0x7fffffff;
588: jjmatchedPos = 0;
589: curPos = jjMoveStringLiteralDfa0_0();
590: if (jjmatchedKind != 0x7fffffff) {
591: if (jjmatchedPos + 1 < curPos)
592: input_stream.backup(curPos - jjmatchedPos - 1);
593: if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) {
594: matchedToken = jjFillToken();
595: return matchedToken;
596: } else {
597: continue EOFLoop;
598: }
599: }
600: int error_line = input_stream.getEndLine();
601: int error_column = input_stream.getEndColumn();
602: String error_after = null;
603: boolean EOFSeen = false;
604: try {
605: input_stream.readChar();
606: input_stream.backup(1);
607: } catch (java.io.IOException e1) {
608: EOFSeen = true;
609: error_after = curPos <= 1 ? "" : input_stream
610: .GetImage();
611: if (curChar == '\n' || curChar == '\r') {
612: error_line++;
613: error_column = 0;
614: } else
615: error_column++;
616: }
617: if (!EOFSeen) {
618: input_stream.backup(1);
619: error_after = curPos <= 1 ? "" : input_stream
620: .GetImage();
621: }
622: throw new TokenMgrError(EOFSeen, curLexState, error_line,
623: error_column, error_after, curChar,
624: TokenMgrError.LEXICAL_ERROR);
625: }
626: }
627:
628: }
|