00001
00002 package edu.tum.cs.logic.parser;
00003 import java.util.*;
00004 import edu.tum.cs.logic.*;
00005 import java.io.*;
00006
00007 public @SuppressWarnings("all") class FormulaParserTokenManager implements FormulaParserConstants
00008 {
00009 public java.io.PrintStream debugStream = System.out;
00010 public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
00011 private final int jjStopStringLiteralDfa_0(int pos, long active0)
00012 {
00013 switch (pos)
00014 {
00015 case 0:
00016 if ((active0 & 0x40L) != 0L)
00017 return 4;
00018 if ((active0 & 0x1000L) != 0L)
00019 {
00020 jjmatchedKind = 21;
00021 return 2;
00022 }
00023 return -1;
00024 case 1:
00025 if ((active0 & 0x1000L) != 0L)
00026 {
00027 jjmatchedKind = 21;
00028 jjmatchedPos = 1;
00029 return 2;
00030 }
00031 return -1;
00032 case 2:
00033 if ((active0 & 0x1000L) != 0L)
00034 {
00035 jjmatchedKind = 21;
00036 jjmatchedPos = 2;
00037 return 2;
00038 }
00039 return -1;
00040 case 3:
00041 if ((active0 & 0x1000L) != 0L)
00042 {
00043 jjmatchedKind = 21;
00044 jjmatchedPos = 3;
00045 return 2;
00046 }
00047 return -1;
00048 case 4:
00049 if ((active0 & 0x1000L) != 0L)
00050 {
00051 jjmatchedKind = 21;
00052 jjmatchedPos = 4;
00053 return 2;
00054 }
00055 return -1;
00056 default :
00057 return -1;
00058 }
00059 }
00060 private final int jjStartNfa_0(int pos, long active0)
00061 {
00062 return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
00063 }
00064 private final int jjStopAtPos(int pos, int kind)
00065 {
00066 jjmatchedKind = kind;
00067 jjmatchedPos = pos;
00068 return pos + 1;
00069 }
00070 private final int jjStartNfaWithStates_0(int pos, int kind, int state)
00071 {
00072 jjmatchedKind = kind;
00073 jjmatchedPos = pos;
00074 try { curChar = input_stream.readChar(); }
00075 catch(java.io.IOException e) { return pos + 1; }
00076 return jjMoveNfa_0(state, pos + 1);
00077 }
00078 private final int jjMoveStringLiteralDfa0_0()
00079 {
00080 switch(curChar)
00081 {
00082 case 33:
00083 return jjStopAtPos(0, 5);
00084 case 40:
00085 return jjStopAtPos(0, 13);
00086 case 41:
00087 return jjStopAtPos(0, 14);
00088 case 44:
00089 return jjStopAtPos(0, 15);
00090 case 60:
00091 return jjMoveStringLiteralDfa1_0(0x400L);
00092 case 61:
00093 jjmatchedKind = 9;
00094 return jjMoveStringLiteralDfa1_0(0x100L);
00095 case 70:
00096 return jjMoveStringLiteralDfa1_0(0x1000L);
00097 case 94:
00098 return jjStopAtPos(0, 7);
00099 case 118:
00100 return jjStartNfaWithStates_0(0, 6, 4);
00101 default :
00102 return jjMoveNfa_0(1, 0);
00103 }
00104 }
00105 private final int jjMoveStringLiteralDfa1_0(long active0)
00106 {
00107 try { curChar = input_stream.readChar(); }
00108 catch(java.io.IOException e) {
00109 jjStopStringLiteralDfa_0(0, active0);
00110 return 1;
00111 }
00112 switch(curChar)
00113 {
00114 case 61:
00115 return jjMoveStringLiteralDfa2_0(active0, 0x400L);
00116 case 62:
00117 if ((active0 & 0x100L) != 0L)
00118 return jjStopAtPos(1, 8);
00119 break;
00120 case 79:
00121 return jjMoveStringLiteralDfa2_0(active0, 0x1000L);
00122 default :
00123 break;
00124 }
00125 return jjStartNfa_0(0, active0);
00126 }
00127 private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
00128 {
00129 if (((active0 &= old0)) == 0L)
00130 return jjStartNfa_0(0, old0);
00131 try { curChar = input_stream.readChar(); }
00132 catch(java.io.IOException e) {
00133 jjStopStringLiteralDfa_0(1, active0);
00134 return 2;
00135 }
00136 switch(curChar)
00137 {
00138 case 62:
00139 if ((active0 & 0x400L) != 0L)
00140 return jjStopAtPos(2, 10);
00141 break;
00142 case 82:
00143 return jjMoveStringLiteralDfa3_0(active0, 0x1000L);
00144 default :
00145 break;
00146 }
00147 return jjStartNfa_0(1, active0);
00148 }
00149 private final int jjMoveStringLiteralDfa3_0(long old0, long active0)
00150 {
00151 if (((active0 &= old0)) == 0L)
00152 return jjStartNfa_0(1, old0);
00153 try { curChar = input_stream.readChar(); }
00154 catch(java.io.IOException e) {
00155 jjStopStringLiteralDfa_0(2, active0);
00156 return 3;
00157 }
00158 switch(curChar)
00159 {
00160 case 65:
00161 return jjMoveStringLiteralDfa4_0(active0, 0x1000L);
00162 default :
00163 break;
00164 }
00165 return jjStartNfa_0(2, active0);
00166 }
00167 private final int jjMoveStringLiteralDfa4_0(long old0, long active0)
00168 {
00169 if (((active0 &= old0)) == 0L)
00170 return jjStartNfa_0(2, old0);
00171 try { curChar = input_stream.readChar(); }
00172 catch(java.io.IOException e) {
00173 jjStopStringLiteralDfa_0(3, active0);
00174 return 4;
00175 }
00176 switch(curChar)
00177 {
00178 case 76:
00179 return jjMoveStringLiteralDfa5_0(active0, 0x1000L);
00180 default :
00181 break;
00182 }
00183 return jjStartNfa_0(3, active0);
00184 }
00185 private final int jjMoveStringLiteralDfa5_0(long old0, long active0)
00186 {
00187 if (((active0 &= old0)) == 0L)
00188 return jjStartNfa_0(3, old0);
00189 try { curChar = input_stream.readChar(); }
00190 catch(java.io.IOException e) {
00191 jjStopStringLiteralDfa_0(4, active0);
00192 return 5;
00193 }
00194 switch(curChar)
00195 {
00196 case 76:
00197 if ((active0 & 0x1000L) != 0L)
00198 return jjStartNfaWithStates_0(5, 12, 2);
00199 break;
00200 default :
00201 break;
00202 }
00203 return jjStartNfa_0(4, active0);
00204 }
00205 private final void jjCheckNAdd(int state)
00206 {
00207 if (jjrounds[state] != jjround)
00208 {
00209 jjstateSet[jjnewStateCnt++] = state;
00210 jjrounds[state] = jjround;
00211 }
00212 }
00213 private final void jjAddStates(int start, int end)
00214 {
00215 do {
00216 jjstateSet[jjnewStateCnt++] = jjnextStates[start];
00217 } while (start++ != end);
00218 }
00219 private final void jjCheckNAddTwoStates(int state1, int state2)
00220 {
00221 jjCheckNAdd(state1);
00222 jjCheckNAdd(state2);
00223 }
00224 private final void jjCheckNAddStates(int start, int end)
00225 {
00226 do {
00227 jjCheckNAdd(jjnextStates[start]);
00228 } while (start++ != end);
00229 }
00230 private final void jjCheckNAddStates(int start)
00231 {
00232 jjCheckNAdd(jjnextStates[start]);
00233 jjCheckNAdd(jjnextStates[start + 1]);
00234 }
00235 private final int jjMoveNfa_0(int startState, int curPos)
00236 {
00237 int[] nextStates;
00238 int startsAt = 0;
00239 jjnewStateCnt = 15;
00240 int i = 1;
00241 jjstateSet[0] = startState;
00242 int j, kind = 0x7fffffff;
00243 for (;;)
00244 {
00245 if (++jjround == 0x7fffffff)
00246 ReInitRounds();
00247 if (curChar < 64)
00248 {
00249 long l = 1L << curChar;
00250 MatchLoop: do
00251 {
00252 switch(jjstateSet[--i])
00253 {
00254 case 1:
00255 case 0:
00256 if ((0x3ff000000000000L & l) == 0L)
00257 break;
00258 if (kind > 20)
00259 kind = 20;
00260 jjCheckNAdd(0);
00261 break;
00262 case 2:
00263 if ((0x3ff000000000000L & l) == 0L)
00264 break;
00265 if (kind > 21)
00266 kind = 21;
00267 jjstateSet[jjnewStateCnt++] = 2;
00268 break;
00269 case 4:
00270 if ((0x3ff000000000000L & l) == 0L)
00271 break;
00272 if (kind > 22)
00273 kind = 22;
00274 jjstateSet[jjnewStateCnt++] = 4;
00275 break;
00276 default : break;
00277 }
00278 } while(i != startsAt);
00279 }
00280 else if (curChar < 128)
00281 {
00282 long l = 1L << (curChar & 077);
00283 MatchLoop: do
00284 {
00285 switch(jjstateSet[--i])
00286 {
00287 case 1:
00288 if ((0x7fffffe80000000L & l) != 0L)
00289 {
00290 if (kind > 22)
00291 kind = 22;
00292 jjCheckNAdd(4);
00293 }
00294 else if ((0x7fffffeL & l) != 0L)
00295 {
00296 if (kind > 21)
00297 kind = 21;
00298 jjCheckNAdd(2);
00299 }
00300 if (curChar == 69)
00301 jjAddStates(0, 1);
00302 break;
00303 case 2:
00304 if ((0x7fffffe87fffffeL & l) == 0L)
00305 break;
00306 if (kind > 21)
00307 kind = 21;
00308 jjCheckNAdd(2);
00309 break;
00310 case 3:
00311 if ((0x7fffffe80000000L & l) == 0L)
00312 break;
00313 if (kind > 22)
00314 kind = 22;
00315 jjCheckNAdd(4);
00316 break;
00317 case 4:
00318 if ((0x7fffffe87fffffeL & l) == 0L)
00319 break;
00320 if (kind > 22)
00321 kind = 22;
00322 jjCheckNAdd(4);
00323 break;
00324 case 5:
00325 if (curChar == 69)
00326 jjAddStates(0, 1);
00327 break;
00328 case 6:
00329 if (curChar == 84 && kind > 11)
00330 kind = 11;
00331 break;
00332 case 7:
00333 if (curChar == 83)
00334 jjstateSet[jjnewStateCnt++] = 6;
00335 break;
00336 case 8:
00337 if (curChar == 73)
00338 jjstateSet[jjnewStateCnt++] = 7;
00339 break;
00340 case 9:
00341 if (curChar == 88)
00342 jjstateSet[jjnewStateCnt++] = 8;
00343 break;
00344 case 10:
00345 if (curChar == 83 && kind > 11)
00346 kind = 11;
00347 break;
00348 case 11:
00349 if (curChar == 84)
00350 jjstateSet[jjnewStateCnt++] = 10;
00351 break;
00352 case 12:
00353 if (curChar == 83)
00354 jjstateSet[jjnewStateCnt++] = 11;
00355 break;
00356 case 13:
00357 if (curChar == 73)
00358 jjstateSet[jjnewStateCnt++] = 12;
00359 break;
00360 case 14:
00361 if (curChar == 88)
00362 jjstateSet[jjnewStateCnt++] = 13;
00363 break;
00364 default : break;
00365 }
00366 } while(i != startsAt);
00367 }
00368 else
00369 {
00370 int i2 = (curChar & 0xff) >> 6;
00371 long l2 = 1L << (curChar & 077);
00372 MatchLoop: do
00373 {
00374 switch(jjstateSet[--i])
00375 {
00376 default : break;
00377 }
00378 } while(i != startsAt);
00379 }
00380 if (kind != 0x7fffffff)
00381 {
00382 jjmatchedKind = kind;
00383 jjmatchedPos = curPos;
00384 kind = 0x7fffffff;
00385 }
00386 ++curPos;
00387 if ((i = jjnewStateCnt) == (startsAt = 15 - (jjnewStateCnt = startsAt)))
00388 return curPos;
00389 try { curChar = input_stream.readChar(); }
00390 catch(java.io.IOException e) { return curPos; }
00391 }
00392 }
00393 static final int[] jjnextStates = {
00394 9, 14,
00395 };
00396 public static final String[] jjstrLiteralImages = {
00397 "", null, null, null, null, "\41", "\166", "\136", "\75\76", "\75",
00398 "\74\75\76", null, "\106\117\122\101\114\114", "\50", "\51", "\54", null, null, null, null,
00399 null, null, null, };
00400 public static final String[] lexStateNames = {
00401 "DEFAULT",
00402 };
00403 static final long[] jjtoToken = {
00404 0x70ffe1L,
00405 };
00406 static final long[] jjtoSkip = {
00407 0x1eL,
00408 };
00409 protected SimpleCharStream input_stream;
00410 private final int[] jjrounds = new int[15];
00411 private final int[] jjstateSet = new int[30];
00412 protected char curChar;
00413 public FormulaParserTokenManager(SimpleCharStream stream){
00414 if (SimpleCharStream.staticFlag)
00415 throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
00416 input_stream = stream;
00417 }
00418 public FormulaParserTokenManager(SimpleCharStream stream, int lexState){
00419 this(stream);
00420 SwitchTo(lexState);
00421 }
00422 public void ReInit(SimpleCharStream stream)
00423 {
00424 jjmatchedPos = jjnewStateCnt = 0;
00425 curLexState = defaultLexState;
00426 input_stream = stream;
00427 ReInitRounds();
00428 }
00429 private final void ReInitRounds()
00430 {
00431 int i;
00432 jjround = 0x80000001;
00433 for (i = 15; i-- > 0;)
00434 jjrounds[i] = 0x80000000;
00435 }
00436 public void ReInit(SimpleCharStream stream, int lexState)
00437 {
00438 ReInit(stream);
00439 SwitchTo(lexState);
00440 }
00441 public void SwitchTo(int lexState)
00442 {
00443 if (lexState >= 1 || lexState < 0)
00444 throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
00445 else
00446 curLexState = lexState;
00447 }
00448
00449 protected Token jjFillToken()
00450 {
00451 Token t = Token.newToken(jjmatchedKind);
00452 t.kind = jjmatchedKind;
00453 String im = jjstrLiteralImages[jjmatchedKind];
00454 t.image = (im == null) ? input_stream.GetImage() : im;
00455 t.beginLine = input_stream.getBeginLine();
00456 t.beginColumn = input_stream.getBeginColumn();
00457 t.endLine = input_stream.getEndLine();
00458 t.endColumn = input_stream.getEndColumn();
00459 return t;
00460 }
00461
00462 int curLexState = 0;
00463 int defaultLexState = 0;
00464 int jjnewStateCnt;
00465 int jjround;
00466 int jjmatchedPos;
00467 int jjmatchedKind;
00468
00469 public Token getNextToken()
00470 {
00471 int kind;
00472 Token specialToken = null;
00473 Token matchedToken;
00474 int curPos = 0;
00475
00476 EOFLoop :
00477 for (;;)
00478 {
00479 try
00480 {
00481 curChar = input_stream.BeginToken();
00482 }
00483 catch(java.io.IOException e)
00484 {
00485 jjmatchedKind = 0;
00486 matchedToken = jjFillToken();
00487 return matchedToken;
00488 }
00489
00490 try { input_stream.backup(0);
00491 while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
00492 curChar = input_stream.BeginToken();
00493 }
00494 catch (java.io.IOException e1) { continue EOFLoop; }
00495 jjmatchedKind = 0x7fffffff;
00496 jjmatchedPos = 0;
00497 curPos = jjMoveStringLiteralDfa0_0();
00498 if (jjmatchedKind != 0x7fffffff)
00499 {
00500 if (jjmatchedPos + 1 < curPos)
00501 input_stream.backup(curPos - jjmatchedPos - 1);
00502 if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
00503 {
00504 matchedToken = jjFillToken();
00505 return matchedToken;
00506 }
00507 else
00508 {
00509 continue EOFLoop;
00510 }
00511 }
00512 int error_line = input_stream.getEndLine();
00513 int error_column = input_stream.getEndColumn();
00514 String error_after = null;
00515 boolean EOFSeen = false;
00516 try { input_stream.readChar(); input_stream.backup(1); }
00517 catch (java.io.IOException e1) {
00518 EOFSeen = true;
00519 error_after = curPos <= 1 ? "" : input_stream.GetImage();
00520 if (curChar == '\n' || curChar == '\r') {
00521 error_line++;
00522 error_column = 0;
00523 }
00524 else
00525 error_column++;
00526 }
00527 if (!EOFSeen) {
00528 input_stream.backup(1);
00529 error_after = curPos <= 1 ? "" : input_stream.GetImage();
00530 }
00531 throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
00532 }
00533 }
00534
00535 }