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