1 /* SpecParserTokenManager.java */
2 /* Generated By:JavaCC: Do not edit this line. SpecParserTokenManager.java */
3 package edu.uci.eecs.specCompiler.grammerParser;
6 @SuppressWarnings("unused")public class SpecParserTokenManager implements SpecParserConstants {
9 public java.io.PrintStream debugStream = System.out;
10 /** Set debug output. */
11 public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
12 private final int jjStopStringLiteralDfa_0(int pos, long active0){
16 if ((active0 & 0x2L) != 0L)
23 private final int jjStartNfa_0(int pos, long active0){
24 return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
26 private int jjStopAtPos(int pos, int kind)
32 private int jjMoveStringLiteralDfa0_0(){
37 return jjMoveStringLiteralDfa1_0(0x10L);
39 return jjStartNfaWithStates_0(0, 1, 6);
41 return jjMoveStringLiteralDfa1_0(0x80L);
43 return jjMoveStringLiteralDfa1_0(0x40L);
45 return jjMoveStringLiteralDfa1_0(0x300L);
47 return jjMoveNfa_0(0, 0);
50 private int jjMoveStringLiteralDfa1_0(long active0){
51 try { curChar = input_stream.readChar(); }
52 catch(java.io.IOException e) {
53 jjStopStringLiteralDfa_0(0, active0);
59 if ((active0 & 0x10L) != 0L)
60 return jjStopAtPos(1, 4);
63 return jjMoveStringLiteralDfa2_0(active0, 0x40L);
65 if ((active0 & 0x80L) != 0L)
66 return jjStopAtPos(1, 7);
69 return jjMoveStringLiteralDfa2_0(active0, 0x100L);
71 return jjMoveStringLiteralDfa2_0(active0, 0x200L);
75 return jjStartNfa_0(0, active0);
77 private int jjMoveStringLiteralDfa2_0(long old0, long active0){
78 if (((active0 &= old0)) == 0L)
79 return jjStartNfa_0(0, old0);
80 try { curChar = input_stream.readChar(); }
81 catch(java.io.IOException e) {
82 jjStopStringLiteralDfa_0(1, active0);
88 if ((active0 & 0x40L) != 0L)
89 return jjStopAtPos(2, 6);
92 return jjMoveStringLiteralDfa3_0(active0, 0x100L);
94 return jjMoveStringLiteralDfa3_0(active0, 0x200L);
98 return jjStartNfa_0(1, active0);
100 private int jjMoveStringLiteralDfa3_0(long old0, long active0){
101 if (((active0 &= old0)) == 0L)
102 return jjStartNfa_0(1, old0);
103 try { curChar = input_stream.readChar(); }
104 catch(java.io.IOException e) {
105 jjStopStringLiteralDfa_0(2, active0);
111 if ((active0 & 0x200L) != 0L)
112 return jjStopAtPos(3, 9);
115 return jjMoveStringLiteralDfa4_0(active0, 0x100L);
119 return jjStartNfa_0(2, active0);
121 private int jjMoveStringLiteralDfa4_0(long old0, long active0){
122 if (((active0 &= old0)) == 0L)
123 return jjStartNfa_0(2, old0);
124 try { curChar = input_stream.readChar(); }
125 catch(java.io.IOException e) {
126 jjStopStringLiteralDfa_0(3, active0);
132 return jjMoveStringLiteralDfa5_0(active0, 0x100L);
136 return jjStartNfa_0(3, active0);
138 private int jjMoveStringLiteralDfa5_0(long old0, long active0){
139 if (((active0 &= old0)) == 0L)
140 return jjStartNfa_0(3, old0);
141 try { curChar = input_stream.readChar(); }
142 catch(java.io.IOException e) {
143 jjStopStringLiteralDfa_0(4, active0);
149 if ((active0 & 0x100L) != 0L)
150 return jjStopAtPos(5, 8);
155 return jjStartNfa_0(4, active0);
157 private int jjStartNfaWithStates_0(int pos, int kind, int state)
159 jjmatchedKind = kind;
161 try { curChar = input_stream.readChar(); }
162 catch(java.io.IOException e) { return pos + 1; }
163 return jjMoveNfa_0(state, pos + 1);
165 static final long[] jjbitVec0 = {
166 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
168 static final long[] jjbitVec2 = {
169 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
171 private int jjMoveNfa_0(int startState, int curPos)
176 jjstateSet[0] = startState;
177 int kind = 0x7fffffff;
180 if (++jjround == 0x7fffffff)
184 long l = 1L << curChar;
187 switch(jjstateSet[--i])
190 if ((0x100000200L & l) != 0L)
191 { jjCheckNAddTwoStates(2, 3); }
192 else if (curChar == 35)
193 { jjCheckNAddTwoStates(4, 5); }
194 if ((0x100000200L & l) != 0L)
202 if ((0x100000200L & l) == 0L)
206 { jjCheckNAddStates(0, 2); }
209 if ((0x100000200L & l) == 0L)
216 if ((0x100000200L & l) != 0L)
217 { jjCheckNAddTwoStates(2, 3); }
221 { jjCheckNAddTwoStates(4, 5); }
224 if ((0xffffffffffffdbffL & l) != 0L)
225 { jjCheckNAddTwoStates(4, 5); }
228 if ((0x2400L & l) != 0L)
233 } while(i != startsAt);
235 else if (curChar < 128)
237 long l = 1L << (curChar & 077);
240 switch(jjstateSet[--i])
243 { jjAddStates(3, 4); }
247 } while(i != startsAt);
251 int hiByte = (curChar >> 8);
252 int i1 = hiByte >> 6;
253 long l1 = 1L << (hiByte & 077);
254 int i2 = (curChar & 0xff) >> 6;
255 long l2 = 1L << (curChar & 077);
258 switch(jjstateSet[--i])
261 if (jjCanMove_0(hiByte, i1, i2, l1, l2))
262 { jjAddStates(3, 4); }
264 default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break;
266 } while(i != startsAt);
268 if (kind != 0x7fffffff)
270 jjmatchedKind = kind;
271 jjmatchedPos = curPos;
275 if ((i = jjnewStateCnt) == (startsAt = 6 - (jjnewStateCnt = startsAt)))
277 try { curChar = input_stream.readChar(); }
278 catch(java.io.IOException e) { return curPos; }
281 static final int[] jjnextStates = {
284 private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
289 return ((jjbitVec2[i2] & l2) != 0L);
291 if ((jjbitVec0[i1] & l1) != 0L)
297 /** Token literal values. */
298 public static final String[] jjstrLiteralImages = {
299 "", null, null, null, null, null, "\57\52\52", "\52\57",
300 "\100\102\145\147\151\156", "\100\105\156\144", null, };
301 protected Token jjFillToken()
304 final String curTokenImage;
307 final int beginColumn;
309 String im = jjstrLiteralImages[jjmatchedKind];
310 curTokenImage = (im == null) ? input_stream.GetImage() : im;
311 beginLine = input_stream.getBeginLine();
312 beginColumn = input_stream.getBeginColumn();
313 endLine = input_stream.getEndLine();
314 endColumn = input_stream.getEndColumn();
315 t = Token.newToken(jjmatchedKind, curTokenImage);
317 t.beginLine = beginLine;
319 t.beginColumn = beginColumn;
320 t.endColumn = endColumn;
326 int defaultLexState = 0;
332 /** Get the next Token. */
333 public Token getNextToken()
343 curChar = input_stream.BeginToken();
345 catch(java.io.IOException e)
349 matchedToken = jjFillToken();
353 try { input_stream.backup(0);
354 while (curChar <= 10 && (0x400L & (1L << curChar)) != 0L)
355 curChar = input_stream.BeginToken();
357 catch (java.io.IOException e1) { continue EOFLoop; }
358 jjmatchedKind = 0x7fffffff;
360 curPos = jjMoveStringLiteralDfa0_0();
361 if (jjmatchedKind != 0x7fffffff)
363 if (jjmatchedPos + 1 < curPos)
364 input_stream.backup(curPos - jjmatchedPos - 1);
365 if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
367 matchedToken = jjFillToken();
375 int error_line = input_stream.getEndLine();
376 int error_column = input_stream.getEndColumn();
377 String error_after = null;
378 boolean EOFSeen = false;
379 try { input_stream.readChar(); input_stream.backup(1); }
380 catch (java.io.IOException e1) {
382 error_after = curPos <= 1 ? "" : input_stream.GetImage();
383 if (curChar == '\n' || curChar == '\r') {
391 input_stream.backup(1);
392 error_after = curPos <= 1 ? "" : input_stream.GetImage();
394 throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
398 private void jjCheckNAdd(int state)
400 if (jjrounds[state] != jjround)
402 jjstateSet[jjnewStateCnt++] = state;
403 jjrounds[state] = jjround;
406 private void jjAddStates(int start, int end)
409 jjstateSet[jjnewStateCnt++] = jjnextStates[start];
410 } while (start++ != end);
412 private void jjCheckNAddTwoStates(int state1, int state2)
418 private void jjCheckNAddStates(int start, int end)
421 jjCheckNAdd(jjnextStates[start]);
422 } while (start++ != end);
426 public SpecParserTokenManager(JavaCharStream stream){
428 if (JavaCharStream.staticFlag)
429 throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
431 input_stream = stream;
435 public SpecParserTokenManager (JavaCharStream stream, int lexState){
440 /** Reinitialise parser. */
441 public void ReInit(JavaCharStream stream)
443 jjmatchedPos = jjnewStateCnt = 0;
444 curLexState = defaultLexState;
445 input_stream = stream;
449 private void ReInitRounds()
452 jjround = 0x80000001;
453 for (i = 6; i-- > 0;)
454 jjrounds[i] = 0x80000000;
457 /** Reinitialise parser. */
458 public void ReInit(JavaCharStream stream, int lexState)
464 /** Switch to specified lex state. */
465 public void SwitchTo(int lexState)
467 if (lexState >= 1 || lexState < 0)
468 throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
470 curLexState = lexState;
473 /** Lexer state names. */
474 public static final String[] lexStateNames = {
477 static final long[] jjtoToken = {
480 static final long[] jjtoSkip = {
483 protected JavaCharStream input_stream;
485 private final int[] jjrounds = new int[6];
486 private final int[] jjstateSet = new int[2 * 6];
489 protected char curChar;