001: /* Generated By:JavaCC: Do not edit this line. PropertyListParserTokenManager.java */
002: package org.apache.commons.configuration.plist;
003:
004: import java.io.IOException;
005: import java.io.PrintStream;
006:
007: class PropertyListParserTokenManager implements
008: PropertyListParserConstants {
009: public PrintStream debugStream = System.out;
010:
011: private final int jjStopStringLiteralDfa_0(int pos, long active0) {
012: switch (pos) {
013: case 0:
014: if ((active0 & 0x4000L) != 0L)
015: return 9;
016: if ((active0 & 0x1000L) != 0L)
017: return 10;
018: if ((active0 & 0x2000L) != 0L)
019: return 3;
020: if ((active0 & 0x200000L) != 0L) {
021: jjmatchedKind = 19;
022: return 3;
023: }
024: return -1;
025: default:
026: return -1;
027: }
028: }
029:
030: private final int jjStartNfa_0(int pos, long active0) {
031: return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0),
032: pos + 1);
033: }
034:
035: private final int jjStopAtPos(int pos, int kind) {
036: jjmatchedKind = kind;
037: jjmatchedPos = pos;
038: return pos + 1;
039: }
040:
041: private final int jjStartNfaWithStates_0(int pos, int kind,
042: int state) {
043: jjmatchedKind = kind;
044: jjmatchedPos = pos;
045: try {
046: curChar = input_stream.readChar();
047: } catch (IOException e) {
048: return pos + 1;
049: }
050: return jjMoveNfa_0(state, pos + 1);
051: }
052:
053: private final int jjMoveStringLiteralDfa0_0() {
054: switch (curChar) {
055: case 34:
056: return jjStartNfaWithStates_0(0, 14, 9);
057: case 40:
058: return jjStopAtPos(0, 5);
059: case 41:
060: return jjStopAtPos(0, 6);
061: case 44:
062: return jjStopAtPos(0, 7);
063: case 59:
064: return jjStopAtPos(0, 10);
065: case 60:
066: return jjStartNfaWithStates_0(0, 12, 10);
067: case 61:
068: return jjStopAtPos(0, 11);
069: case 62:
070: return jjStartNfaWithStates_0(0, 13, 3);
071: case 92:
072: return jjMoveStringLiteralDfa1_0(0x200000L);
073: case 123:
074: return jjStopAtPos(0, 8);
075: case 125:
076: return jjStopAtPos(0, 9);
077: default:
078: return jjMoveNfa_0(0, 0);
079: }
080: }
081:
082: private final int jjMoveStringLiteralDfa1_0(long active0) {
083: try {
084: curChar = input_stream.readChar();
085: } catch (IOException e) {
086: jjStopStringLiteralDfa_0(0, active0);
087: return 1;
088: }
089: switch (curChar) {
090: case 34:
091: if ((active0 & 0x200000L) != 0L)
092: return jjStopAtPos(1, 21);
093: break;
094: default:
095: break;
096: }
097: return jjStartNfa_0(0, active0);
098: }
099:
100: private final void jjCheckNAdd(int state) {
101: if (jjrounds[state] != jjround) {
102: jjstateSet[jjnewStateCnt++] = state;
103: jjrounds[state] = jjround;
104: }
105: }
106:
107: private final void jjCheckNAddTwoStates(int state1, int state2) {
108: jjCheckNAdd(state1);
109: jjCheckNAdd(state2);
110: }
111:
112: private final void jjCheckNAddStates(int start, int end) {
113: do {
114: jjCheckNAdd(jjnextStates[start]);
115: } while (start++ != end);
116: }
117:
118: static final long[] jjbitVec0 = { 0x0L, 0x0L, 0xffffffffffffffffL,
119: 0xffffffffffffffffL };
120:
121: private final int jjMoveNfa_0(int startState, int curPos) {
122: int startsAt = 0;
123: jjnewStateCnt = 9;
124: int i = 1;
125: jjstateSet[0] = startState;
126: int kind = 0x7fffffff;
127: for (;;) {
128: if (++jjround == 0x7fffffff)
129: ReInitRounds();
130: if (curChar < 64) {
131: long l = 1L << curChar;
132: MatchLoop: do {
133: switch (jjstateSet[--i]) {
134: case 9:
135: if ((0xfffffffbffffffffL & l) != 0L)
136: jjCheckNAddStates(0, 2);
137: else if (curChar == 34) {
138: if (kind > 20)
139: kind = 20;
140: }
141: break;
142: case 10:
143: if ((0xd7ffecfaffffd9ffL & l) != 0L) {
144: if (kind > 19)
145: kind = 19;
146: jjCheckNAdd(3);
147: }
148: if ((0x3ff000100002600L & l) != 0L)
149: jjCheckNAddTwoStates(1, 2);
150: else if (curChar == 62) {
151: if (kind > 18)
152: kind = 18;
153: }
154: break;
155: case 0:
156: if ((0xd7ffecfaffffd9ffL & l) != 0L) {
157: if (kind > 19)
158: kind = 19;
159: jjCheckNAdd(3);
160: } else if (curChar == 34)
161: jjCheckNAddStates(0, 2);
162: if (curChar == 60)
163: jjCheckNAddTwoStates(1, 2);
164: break;
165: case 1:
166: if ((0x3ff000100002600L & l) != 0L)
167: jjCheckNAddTwoStates(1, 2);
168: break;
169: case 2:
170: if (curChar == 62 && kind > 18)
171: kind = 18;
172: break;
173: case 3:
174: if ((0xd7ffecfaffffd9ffL & l) == 0L)
175: break;
176: if (kind > 19)
177: kind = 19;
178: jjCheckNAdd(3);
179: break;
180: case 4:
181: case 6:
182: if (curChar == 34)
183: jjCheckNAddStates(0, 2);
184: break;
185: case 5:
186: if ((0xfffffffbffffffffL & l) != 0L)
187: jjCheckNAddStates(0, 2);
188: break;
189: case 8:
190: if (curChar == 34 && kind > 20)
191: kind = 20;
192: break;
193: default:
194: break;
195: }
196: } while (i != startsAt);
197: } else if (curChar < 128) {
198: long l = 1L << (curChar & 077);
199: MatchLoop: do {
200: switch (jjstateSet[--i]) {
201: case 9:
202: jjCheckNAddStates(0, 2);
203: if (curChar == 92)
204: jjstateSet[jjnewStateCnt++] = 6;
205: break;
206: case 10:
207: if ((0xd7ffffffffffffffL & l) != 0L) {
208: if (kind > 19)
209: kind = 19;
210: jjCheckNAdd(3);
211: }
212: if ((0x7e0000007eL & l) != 0L)
213: jjCheckNAddTwoStates(1, 2);
214: break;
215: case 0:
216: case 3:
217: if ((0xd7ffffffffffffffL & l) == 0L)
218: break;
219: if (kind > 19)
220: kind = 19;
221: jjCheckNAdd(3);
222: break;
223: case 1:
224: if ((0x7e0000007eL & l) != 0L)
225: jjCheckNAddTwoStates(1, 2);
226: break;
227: case 5:
228: jjCheckNAddStates(0, 2);
229: break;
230: case 7:
231: if (curChar == 92)
232: jjstateSet[jjnewStateCnt++] = 6;
233: break;
234: default:
235: break;
236: }
237: } while (i != startsAt);
238: } else {
239: int i2 = (curChar & 0xff) >> 6;
240: long l2 = 1L << (curChar & 077);
241: MatchLoop: do {
242: switch (jjstateSet[--i]) {
243: case 9:
244: case 5:
245: if ((jjbitVec0[i2] & l2) != 0L)
246: jjCheckNAddStates(0, 2);
247: break;
248: case 10:
249: case 3:
250: if ((jjbitVec0[i2] & l2) == 0L)
251: break;
252: if (kind > 19)
253: kind = 19;
254: jjCheckNAdd(3);
255: break;
256: case 0:
257: if ((jjbitVec0[i2] & l2) == 0L)
258: break;
259: if (kind > 19)
260: kind = 19;
261: jjCheckNAdd(3);
262: break;
263: default:
264: break;
265: }
266: } while (i != startsAt);
267: }
268: if (kind != 0x7fffffff) {
269: jjmatchedKind = kind;
270: jjmatchedPos = curPos;
271: kind = 0x7fffffff;
272: }
273: ++curPos;
274: if ((i = jjnewStateCnt) == (startsAt = 9 - (jjnewStateCnt = startsAt)))
275: return curPos;
276: try {
277: curChar = input_stream.readChar();
278: } catch (IOException e) {
279: return curPos;
280: }
281: }
282: }
283:
284: static final int[] jjnextStates = { 5, 7, 8, };
285: public static final String[] jjstrLiteralImages = { "", null, null,
286: null, null, "\50", "\51", "\54", "\173", "\175", "\73",
287: "\75", "\74", "\76", "\42", null, null, null, null, null,
288: null, "\134\42", };
289: public static final String[] lexStateNames = { "DEFAULT", };
290: static final long[] jjtoToken = { 0x3c7fe1L, };
291: static final long[] jjtoSkip = { 0x1eL, };
292: protected SimpleCharStream input_stream;
293: private final int[] jjrounds = new int[9];
294: private final int[] jjstateSet = new int[18];
295: protected char curChar;
296:
297: public PropertyListParserTokenManager(SimpleCharStream stream) {
298: if (SimpleCharStream.staticFlag)
299: throw new Error(
300: "ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
301: input_stream = stream;
302: }
303:
304: public void ReInit(SimpleCharStream stream) {
305: jjmatchedPos = jjnewStateCnt = 0;
306: curLexState = defaultLexState;
307: input_stream = stream;
308: ReInitRounds();
309: }
310:
311: private final void ReInitRounds() {
312: int i;
313: jjround = 0x80000001;
314: for (i = 9; i-- > 0;)
315: jjrounds[i] = 0x80000000;
316: }
317:
318: protected Token jjFillToken() {
319: Token t = Token.newToken(jjmatchedKind);
320: t.kind = jjmatchedKind;
321: String im = jjstrLiteralImages[jjmatchedKind];
322: t.image = (im == null) ? input_stream.GetImage() : im;
323: t.beginLine = input_stream.getBeginLine();
324: t.beginColumn = input_stream.getBeginColumn();
325: t.endLine = input_stream.getEndLine();
326: t.endColumn = input_stream.getEndColumn();
327: return t;
328: }
329:
330: int curLexState = 0;
331: int defaultLexState = 0;
332: int jjnewStateCnt;
333: int jjround;
334: int jjmatchedPos;
335: int jjmatchedKind;
336:
337: public Token getNextToken() {
338: Token matchedToken;
339: int curPos = 0;
340:
341: EOFLoop: for (;;) {
342: try {
343: curChar = input_stream.BeginToken();
344: } catch (IOException e) {
345: jjmatchedKind = 0;
346: matchedToken = jjFillToken();
347: return matchedToken;
348: }
349:
350: try {
351: input_stream.backup(0);
352: while (curChar <= 32
353: && (0x100002600L & (1L << curChar)) != 0L)
354: curChar = input_stream.BeginToken();
355: } catch (IOException e1) {
356: continue EOFLoop;
357: }
358: jjmatchedKind = 0x7fffffff;
359: jjmatchedPos = 0;
360: curPos = jjMoveStringLiteralDfa0_0();
361: if (jjmatchedKind != 0x7fffffff) {
362: if (jjmatchedPos + 1 < curPos)
363: input_stream.backup(curPos - jjmatchedPos - 1);
364: if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) {
365: matchedToken = jjFillToken();
366: return matchedToken;
367: } else {
368: continue EOFLoop;
369: }
370: }
371: int error_line = input_stream.getEndLine();
372: int error_column = input_stream.getEndColumn();
373: String error_after = null;
374: boolean EOFSeen = false;
375: try {
376: input_stream.readChar();
377: input_stream.backup(1);
378: } catch (IOException e1) {
379: EOFSeen = true;
380: error_after = curPos <= 1 ? "" : input_stream
381: .GetImage();
382: if (curChar == '\n' || curChar == '\r') {
383: error_line++;
384: error_column = 0;
385: } else
386: error_column++;
387: }
388: if (!EOFSeen) {
389: input_stream.backup(1);
390: error_after = curPos <= 1 ? "" : input_stream
391: .GetImage();
392: }
393: throw new TokenMgrError(EOFSeen, curLexState, error_line,
394: error_column, error_after, curChar,
395: TokenMgrError.LEXICAL_ERROR);
396: }
397: }
398:
399: }
|