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