1 |
|
|
2 |
|
package org.apache.commons.configuration.plist; |
3 |
|
|
4 |
|
import java.io.IOException; |
5 |
|
import java.io.PrintStream; |
6 |
|
|
7 |
|
class PropertyListParserTokenManager implements PropertyListParserConstants |
8 |
|
{ |
9 |
54 |
public PrintStream debugStream = System.out; |
10 |
|
|
11 |
|
private final int jjStopStringLiteralDfa_0(class="keyword">int pos, long active0) |
12 |
|
{ |
13 |
0 |
switch (pos) |
14 |
|
{ |
15 |
|
case 0: |
16 |
0 |
if ((active0 & 0x4000L) != 0L) |
17 |
0 |
return 9; |
18 |
0 |
if ((active0 & 0x1000L) != 0L) |
19 |
0 |
return 10; |
20 |
0 |
if ((active0 & 0x2000L) != 0L) |
21 |
0 |
return 3; |
22 |
0 |
if ((active0 & 0x200000L) != 0L) |
23 |
|
{ |
24 |
0 |
jjmatchedKind = 19; |
25 |
0 |
return 3; |
26 |
|
} |
27 |
0 |
return -1; |
28 |
|
default : |
29 |
0 |
return -1; |
30 |
|
} |
31 |
|
} |
32 |
|
|
33 |
|
private final int jjStartNfa_0(class="keyword">int pos, long active0) |
34 |
|
{ |
35 |
0 |
return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); |
36 |
|
} |
37 |
|
|
38 |
|
private final int jjStopAtPos(class="keyword">int pos, class="keyword">int kind) |
39 |
|
{ |
40 |
2811 |
jjmatchedKind = kind; |
41 |
2811 |
jjmatchedPos = pos; |
42 |
2811 |
return pos + 1; |
43 |
|
} |
44 |
|
|
45 |
|
private final int jjStartNfaWithStates_0(class="keyword">int pos, class="keyword">int kind, class="keyword">int state) |
46 |
|
{ |
47 |
441 |
jjmatchedKind = kind; |
48 |
441 |
jjmatchedPos = pos; |
49 |
|
try |
50 |
|
{ |
51 |
441 |
curChar = input_stream.readChar(); |
52 |
441 |
} |
53 |
|
catch (IOException e) |
54 |
|
{ |
55 |
0 |
return pos + 1; |
56 |
|
} |
57 |
441 |
return jjMoveNfa_0(state, pos + 1); |
58 |
|
} |
59 |
|
|
60 |
|
private final int jjMoveStringLiteralDfa0_0() |
61 |
|
{ |
62 |
4404 |
switch (curChar) |
63 |
|
{ |
64 |
|
case 34: |
65 |
357 |
return jjStartNfaWithStates_0(0, 14, 9); |
66 |
|
case 40: |
67 |
252 |
return jjStopAtPos(0, 5); |
68 |
|
case 41: |
69 |
252 |
return jjStopAtPos(0, 6); |
70 |
|
case 44: |
71 |
252 |
return jjStopAtPos(0, 7); |
72 |
|
case 59: |
73 |
552 |
return jjStopAtPos(0, 10); |
74 |
|
case 60: |
75 |
84 |
return jjStartNfaWithStates_0(0, 12, 10); |
76 |
|
case 61: |
77 |
837 |
return jjStopAtPos(0, 11); |
78 |
|
case 62: |
79 |
0 |
return jjStartNfaWithStates_0(0, 13, 3); |
80 |
|
case 92: |
81 |
0 |
return jjMoveStringLiteralDfa1_0(0x200000L); |
82 |
|
case 123: |
83 |
333 |
return jjStopAtPos(0, 8); |
84 |
|
case 125: |
85 |
333 |
return jjStopAtPos(0, 9); |
86 |
|
default : |
87 |
1152 |
return jjMoveNfa_0(0, 0); |
88 |
|
} |
89 |
|
} |
90 |
|
|
91 |
|
private final int jjMoveStringLiteralDfa1_0(long active0) |
92 |
|
{ |
93 |
|
try |
94 |
|
{ |
95 |
0 |
curChar = input_stream.readChar(); |
96 |
0 |
} |
97 |
|
catch (IOException e) |
98 |
|
{ |
99 |
0 |
jjStopStringLiteralDfa_0(0, active0); |
100 |
0 |
return 1; |
101 |
|
} |
102 |
0 |
switch (curChar) |
103 |
|
{ |
104 |
|
case 34: |
105 |
0 |
if ((active0 & 0x200000L) != 0L) |
106 |
0 |
return jjStopAtPos(1, 21); |
107 |
|
break; |
108 |
|
default : |
109 |
|
break; |
110 |
|
} |
111 |
0 |
return jjStartNfa_0(0, active0); |
112 |
|
} |
113 |
|
|
114 |
|
private final void jjCheckNAdd(int state) |
115 |
|
{ |
116 |
21858 |
if (jjrounds[state] != jjround) |
117 |
|
{ |
118 |
21858 |
jjstateSet[jjnewStateCnt++] = state; |
119 |
21858 |
jjrounds[state] = jjround; |
120 |
|
} |
121 |
21858 |
} |
122 |
|
|
123 |
|
private final void jjCheckNAddTwoStates(int state1, class="keyword">int state2) |
124 |
|
{ |
125 |
705 |
jjCheckNAdd(state1); |
126 |
705 |
jjCheckNAdd(state2); |
127 |
705 |
} |
128 |
|
|
129 |
|
private final void jjCheckNAddStates(int start, class="keyword">int end) |
130 |
|
{ |
131 |
|
do |
132 |
|
{ |
133 |
12051 |
jjCheckNAdd(jjnextStates[start]); |
134 |
|
} |
135 |
12051 |
while (start++ != end); |
136 |
4017 |
} |
137 |
|
|
138 |
12 |
static final long[] jjbitVec0 = { |
139 |
|
0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL |
140 |
|
}; |
141 |
|
|
142 |
|
private final int jjMoveNfa_0(class="keyword">int startState, class="keyword">int curPos) |
143 |
|
{ |
144 |
1593 |
int startsAt = 0; |
145 |
1593 |
jjnewStateCnt = 9; |
146 |
1593 |
int i = 1; |
147 |
1593 |
jjstateSet[0] = startState; |
148 |
1593 |
int kind = 0x7fffffff; |
149 |
1593 |
for (; ;) |
150 |
|
{ |
151 |
14436 |
if (++jjround == 0x7fffffff) |
152 |
0 |
ReInitRounds(); |
153 |
14436 |
if (curChar < 64) |
154 |
|
{ |
155 |
3687 |
long l = 1L << curChar; |
156 |
|
MatchLoop: do |
157 |
|
{ |
158 |
6948 |
switch (jjstateSet[--i]) |
159 |
|
{ |
160 |
|
case 9: |
161 |
0 |
if ((0xfffffffbffffffffL & l) != 0L) |
162 |
0 |
jjCheckNAddStates(0, 2); |
163 |
0 |
else if (curChar == 34) |
164 |
|
{ |
165 |
0 |
if (kind > 20) |
166 |
0 |
kind = 20; |
167 |
|
} |
168 |
|
break; |
169 |
|
case 10: |
170 |
84 |
if ((0xd7ffecfaffffd9ffL & l) != 0L) |
171 |
|
{ |
172 |
45 |
if (kind > 19) |
173 |
45 |
kind = 19; |
174 |
45 |
jjCheckNAdd(3); |
175 |
|
} |
176 |
84 |
if ((0x3ff000100002600L & l) != 0L) |
177 |
81 |
jjCheckNAddTwoStates(1, 2); |
178 |
3 |
else if (curChar == 62) |
179 |
|
{ |
180 |
3 |
if (kind > 18) |
181 |
3 |
kind = 18; |
182 |
|
} |
183 |
|
break; |
184 |
|
case 0: |
185 |
0 |
if ((0xd7ffecfaffffd9ffL & l) != 0L) |
186 |
|
{ |
187 |
0 |
if (kind > 19) |
188 |
0 |
kind = 19; |
189 |
0 |
jjCheckNAdd(3); |
190 |
|
} |
191 |
0 |
else if (curChar == 34) |
192 |
0 |
jjCheckNAddStates(0, 2); |
193 |
0 |
if (curChar == 60) |
194 |
0 |
jjCheckNAddTwoStates(1, 2); |
195 |
|
break; |
196 |
|
case 1: |
197 |
621 |
if ((0x3ff000100002600L & l) != 0L) |
198 |
540 |
jjCheckNAddTwoStates(1, 2); |
199 |
|
break; |
200 |
|
case 2: |
201 |
621 |
if (curChar == 62 && kind > 18) |
202 |
81 |
kind = 18; |
203 |
|
break; |
204 |
|
case 3: |
205 |
1992 |
if ((0xd7ffecfaffffd9ffL & l) == 0L) |
206 |
1197 |
break; |
207 |
795 |
if (kind > 19) |
208 |
795 |
kind = 19; |
209 |
795 |
jjCheckNAdd(3); |
210 |
795 |
break; |
211 |
|
case 4: |
212 |
|
case 6: |
213 |
84 |
if (curChar == 34) |
214 |
84 |
jjCheckNAddStates(0, 2); |
215 |
|
break; |
216 |
|
case 5: |
217 |
1182 |
if ((0xfffffffbffffffffL & l) != 0L) |
218 |
741 |
jjCheckNAddStates(0, 2); |
219 |
|
break; |
220 |
|
case 8: |
221 |
1182 |
if (curChar == 34 && kind > 20) |
222 |
441 |
kind = 20; |
223 |
|
break; |
224 |
|
default : |
225 |
|
break; |
226 |
|
} |
227 |
|
} |
228 |
6948 |
while (i != startsAt); |
229 |
|
} |
230 |
10749 |
else if (curChar < 128) |
231 |
|
{ |
232 |
10749 |
long l = 1L << (curChar & 077); |
233 |
|
MatchLoop: do |
234 |
|
{ |
235 |
16587 |
switch (jjstateSet[--i]) |
236 |
|
{ |
237 |
|
case 9: |
238 |
357 |
jjCheckNAddStates(0, 2); |
239 |
357 |
if (curChar == 92) |
240 |
0 |
jjstateSet[jjnewStateCnt++] = 6; |
241 |
|
break; |
242 |
|
case 10: |
243 |
0 |
if ((0xd7ffffffffffffffL & l) != 0L) |
244 |
|
{ |
245 |
0 |
if (kind > 19) |
246 |
0 |
kind = 19; |
247 |
0 |
jjCheckNAdd(3); |
248 |
|
} |
249 |
0 |
if ((0x7e0000007eL & l) != 0L) |
250 |
0 |
jjCheckNAddTwoStates(1, 2); |
251 |
|
break; |
252 |
|
case 0: |
253 |
|
case 3: |
254 |
7557 |
if ((0xd7ffffffffffffffL & l) == 0L) |
255 |
0 |
break; |
256 |
7557 |
if (kind > 19) |
257 |
7557 |
kind = 19; |
258 |
7557 |
jjCheckNAdd(3); |
259 |
7557 |
break; |
260 |
|
case 1: |
261 |
84 |
if ((0x7e0000007eL & l) != 0L) |
262 |
84 |
jjCheckNAddTwoStates(1, 2); |
263 |
|
break; |
264 |
|
case 5: |
265 |
2835 |
jjCheckNAddStates(0, 2); |
266 |
2835 |
break; |
267 |
|
case 7: |
268 |
2835 |
if (curChar == 92) |
269 |
84 |
jjstateSet[jjnewStateCnt++] = 6; |
270 |
|
break; |
271 |
|
default : |
272 |
|
break; |
273 |
|
} |
274 |
|
} |
275 |
16587 |
while (i != startsAt); |
276 |
|
} |
277 |
|
else |
278 |
|
{ |
279 |
0 |
int i2 = (curChar & 0xff) >> 6; |
280 |
0 |
long l2 = 1L << (curChar & 077); |
281 |
|
MatchLoop: do |
282 |
|
{ |
283 |
0 |
switch (jjstateSet[--i]) |
284 |
|
{ |
285 |
|
case 9: |
286 |
|
case 5: |
287 |
0 |
if ((jjbitVec0[i2] & l2) != 0L) |
288 |
0 |
jjCheckNAddStates(0, 2); |
289 |
|
break; |
290 |
|
case 10: |
291 |
|
case 3: |
292 |
0 |
if ((jjbitVec0[i2] & l2) == 0L) |
293 |
0 |
break; |
294 |
0 |
if (kind > 19) |
295 |
0 |
kind = 19; |
296 |
0 |
jjCheckNAdd(3); |
297 |
0 |
break; |
298 |
|
case 0: |
299 |
0 |
if ((jjbitVec0[i2] & l2) == 0L) |
300 |
0 |
break; |
301 |
0 |
if (kind > 19) |
302 |
0 |
kind = 19; |
303 |
0 |
jjCheckNAdd(3); |
304 |
0 |
break; |
305 |
|
default : |
306 |
|
break; |
307 |
|
} |
308 |
|
} |
309 |
0 |
while (i != startsAt); |
310 |
|
} |
311 |
14436 |
if (kind != 0x7fffffff) |
312 |
|
{ |
313 |
8916 |
jjmatchedKind = kind; |
314 |
8916 |
jjmatchedPos = curPos; |
315 |
8916 |
kind = 0x7fffffff; |
316 |
|
} |
317 |
14436 |
++curPos; |
318 |
14436 |
if ((i = jjnewStateCnt) == (startsAt = 9 - (jjnewStateCnt = startsAt))) |
319 |
1593 |
return curPos; |
320 |
|
try |
321 |
|
{ |
322 |
12843 |
curChar = input_stream.readChar(); |
323 |
12843 |
} |
324 |
|
catch (IOException e) |
325 |
|
{ |
326 |
0 |
return curPos; |
327 |
12843 |
} |
328 |
|
} |
329 |
|
} |
330 |
|
|
331 |
6 |
static final int[] jjnextStates = { |
332 |
|
5, 7, 8, |
333 |
|
}; |
334 |
6 |
public static final String[] jjstrLiteralImages = { |
335 |
|
"", null, class="keyword">null, class="keyword">null, class="keyword">null, "\50", "\51", "\54", "\173", "\175", "\73", "\75", |
336 |
|
"\74", "\76", "\42", null, class="keyword">null, class="keyword">null, class="keyword">null, class="keyword">null, class="keyword">null, "\134\42", }; |
337 |
6 |
public static final String[] lexStateNames = { |
338 |
|
"DEFAULT", |
339 |
|
}; |
340 |
6 |
static final long[] jjtoToken = { |
341 |
|
0x3c7fe1L, |
342 |
|
}; |
343 |
6 |
static final long[] jjtoSkip = { |
344 |
|
0x1eL, |
345 |
|
}; |
346 |
|
protected SimpleCharStream input_stream; |
347 |
54 |
private final int[] jjrounds = new class="keyword">int[9]; |
348 |
54 |
private final int[] jjstateSet = new class="keyword">int[18]; |
349 |
|
protected char curChar; |
350 |
|
|
351 |
|
public PropertyListParserTokenManager(SimpleCharStream stream) |
352 |
54 |
{ |
353 |
|
if (SimpleCharStream.staticFlag) |
354 |
|
throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); |
355 |
54 |
input_stream = stream; |
356 |
54 |
} |
357 |
|
|
358 |
|
public void ReInit(SimpleCharStream stream) |
359 |
|
{ |
360 |
0 |
jjmatchedPos = jjnewStateCnt = 0; |
361 |
0 |
curLexState = defaultLexState; |
362 |
0 |
input_stream = stream; |
363 |
0 |
ReInitRounds(); |
364 |
0 |
} |
365 |
|
|
366 |
|
private final void ReInitRounds() |
367 |
|
{ |
368 |
|
int i; |
369 |
0 |
jjround = 0x80000001; |
370 |
0 |
for (i = 9; i-- > 0;) |
371 |
0 |
jjrounds[i] = 0x80000000; |
372 |
0 |
} |
373 |
|
|
374 |
|
protected Token jjFillToken() |
375 |
|
{ |
376 |
4449 |
Token t = Token.newToken(jjmatchedKind); |
377 |
4449 |
t.kind = jjmatchedKind; |
378 |
4449 |
String im = jjstrLiteralImages[jjmatchedKind]; |
379 |
4449 |
t.image = (im == null) ? input_stream.GetImage() : im; |
380 |
4449 |
t.beginLine = input_stream.getBeginLine(); |
381 |
4449 |
t.beginColumn = input_stream.getBeginColumn(); |
382 |
4449 |
t.endLine = input_stream.getEndLine(); |
383 |
4449 |
t.endColumn = input_stream.getEndColumn(); |
384 |
4449 |
return t; |
385 |
|
} |
386 |
|
|
387 |
54 |
int curLexState = 0; |
388 |
54 |
int defaultLexState = 0; |
389 |
|
int jjnewStateCnt; |
390 |
|
int jjround; |
391 |
|
int jjmatchedPos; |
392 |
|
int jjmatchedKind; |
393 |
|
|
394 |
|
public Token getNextToken() |
395 |
|
{ |
396 |
|
Token matchedToken; |
397 |
4449 |
int curPos = 0; |
398 |
|
|
399 |
|
EOFLoop : |
400 |
4449 |
for (; ;) |
401 |
|
{ |
402 |
|
try |
403 |
|
{ |
404 |
4488 |
curChar = input_stream.BeginToken(); |
405 |
4443 |
} |
406 |
|
catch (IOException e) |
407 |
|
{ |
408 |
45 |
jjmatchedKind = 0; |
409 |
45 |
matchedToken = jjFillToken(); |
410 |
45 |
return matchedToken; |
411 |
|
} |
412 |
|
|
413 |
|
try |
414 |
|
{ |
415 |
4443 |
input_stream.backup(0); |
416 |
22128 |
while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) |
417 |
13281 |
curChar = input_stream.BeginToken(); |
418 |
4404 |
} |
419 |
|
catch (IOException e1) |
420 |
|
{ |
421 |
39 |
continue EOFLoop; |
422 |
|
} |
423 |
4404 |
jjmatchedKind = 0x7fffffff; |
424 |
4404 |
jjmatchedPos = 0; |
425 |
4404 |
curPos = jjMoveStringLiteralDfa0_0(); |
426 |
4404 |
if (jjmatchedKind != 0x7fffffff) |
427 |
|
{ |
428 |
4404 |
if (jjmatchedPos + 1 < curPos) |
429 |
1158 |
input_stream.backup(curPos - jjmatchedPos - 1); |
430 |
4404 |
if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) |
431 |
|
{ |
432 |
4404 |
matchedToken = jjFillToken(); |
433 |
4404 |
return matchedToken; |
434 |
|
} |
435 |
|
else |
436 |
|
{ |
437 |
|
continue EOFLoop; |
438 |
|
} |
439 |
|
} |
440 |
0 |
int error_line = input_stream.getEndLine(); |
441 |
0 |
int error_column = input_stream.getEndColumn(); |
442 |
0 |
String error_after = null; |
443 |
0 |
boolean EOFSeen = false; |
444 |
|
try |
445 |
|
{ |
446 |
0 |
input_stream.readChar(); |
447 |
0 |
input_stream.backup(1); |
448 |
0 |
} |
449 |
|
catch (IOException e1) |
450 |
|
{ |
451 |
0 |
EOFSeen = true; |
452 |
0 |
error_after = curPos <= 1 ? "" : input_stream.GetImage(); |
453 |
0 |
if (curChar == '\n' || curChar == '\r') |
454 |
|
{ |
455 |
0 |
error_line++; |
456 |
0 |
error_column = 0; |
457 |
|
} |
458 |
|
else |
459 |
0 |
error_column++; |
460 |
|
} |
461 |
0 |
if (!EOFSeen) |
462 |
|
{ |
463 |
0 |
input_stream.backup(1); |
464 |
0 |
error_after = curPos <= 1 ? "" : input_stream.GetImage(); |
465 |
|
} |
466 |
0 |
throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); |
467 |
|
} |
468 |
|
} |
469 |
|
|
470 |
|
} |