001/* ConfParserLegacyTokenManager.java */ 002/* Generated By:JavaCC: Do not edit this line. ConfParserLegacyTokenManager.java */ 003package org.dllearner.confparser; 004import org.dllearner.cli.ConfFileOption; 005import org.dllearner.core.ComponentInitException; 006import org.dllearner.parser.KBParser; 007import java.io.*; 008import java.util.*; 009 010/** Token Manager. */ 011@SuppressWarnings("unused")public class ConfParserLegacyTokenManager implements ConfParserLegacyConstants { 012 013 /** Debug output. */ 014 public java.io.PrintStream debugStream = System.out; 015 /** Set debug output. */ 016 public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } 017private final int jjStopStringLiteralDfa_0(int pos, long active0){ 018 switch (pos) 019 { 020 default : 021 return -1; 022 } 023} 024private final int jjStartNfa_0(int pos, long active0){ 025 return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); 026} 027private int jjStopAtPos(int pos, int kind) 028{ 029 jjmatchedKind = kind; 030 jjmatchedPos = pos; 031 return pos + 1; 032} 033private int jjMoveStringLiteralDfa0_0(){ 034 switch(curChar) 035 { 036 case 40: 037 return jjStopAtPos(0, 20); 038 case 41: 039 return jjStopAtPos(0, 21); 040 case 44: 041 return jjStopAtPos(0, 16); 042 case 45: 043 return jjStopAtPos(0, 17); 044 case 46: 045 return jjStopAtPos(0, 8); 046 case 58: 047 return jjStopAtPos(0, 22); 048 case 61: 049 return jjStopAtPos(0, 13); 050 case 91: 051 return jjStopAtPos(0, 18); 052 case 93: 053 return jjStopAtPos(0, 19); 054 case 123: 055 return jjStopAtPos(0, 14); 056 case 125: 057 return jjStopAtPos(0, 15); 058 default : 059 return jjMoveNfa_0(0, 0); 060 } 061} 062static final long[] jjbitVec0 = { 063 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL 064}; 065static final long[] jjbitVec2 = { 066 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL 067}; 068private int jjMoveNfa_0(int startState, int curPos) 069{ 070 int startsAt = 0; 071 jjnewStateCnt = 30; 072 int i = 1; 073 jjstateSet[0] = startState; 074 int kind = 0x7fffffff; 075 for (;;) 076 { 077 if (++jjround == 0x7fffffff) 078 ReInitRounds(); 079 if (curChar < 64) 080 { 081 long l = 1L << curChar; 082 do 083 { 084 switch(jjstateSet[--i]) 085 { 086 case 0: 087 if ((0x3fe000000000000L & l) != 0L) 088 { 089 if (kind > 10) 090 kind = 10; 091 { jjCheckNAddStates(0, 2); } 092 } 093 else if (curChar == 48) 094 { 095 if (kind > 10) 096 kind = 10; 097 { jjCheckNAdd(27); } 098 } 099 else if (curChar == 47) 100 { jjAddStates(3, 5); } 101 else if (curChar == 34) 102 { jjCheckNAddTwoStates(3, 4); } 103 break; 104 case 1: 105 if ((0x3ff000000000000L & l) == 0L) 106 break; 107 if (kind > 9) 108 kind = 9; 109 jjstateSet[jjnewStateCnt++] = 1; 110 break; 111 case 2: 112 if (curChar == 34) 113 { jjCheckNAddTwoStates(3, 4); } 114 break; 115 case 3: 116 if ((0xfffffffbffffffffL & l) != 0L) 117 { jjCheckNAddTwoStates(3, 4); } 118 break; 119 case 4: 120 if (curChar == 34 && kind > 12) 121 kind = 12; 122 break; 123 case 5: 124 if (curChar == 47) 125 { jjAddStates(3, 5); } 126 break; 127 case 6: 128 if (curChar == 47) 129 { jjCheckNAddStates(6, 8); } 130 break; 131 case 7: 132 if ((0xffffffffffffdbffL & l) != 0L) 133 { jjCheckNAddStates(6, 8); } 134 break; 135 case 8: 136 if ((0x2400L & l) != 0L && kind > 5) 137 kind = 5; 138 break; 139 case 9: 140 if (curChar == 10 && kind > 5) 141 kind = 5; 142 break; 143 case 10: 144 if (curChar == 13) 145 jjstateSet[jjnewStateCnt++] = 9; 146 break; 147 case 11: 148 if (curChar == 42) 149 { jjCheckNAddTwoStates(12, 13); } 150 break; 151 case 12: 152 if ((0xfffffbffffffffffL & l) != 0L) 153 { jjCheckNAddTwoStates(12, 13); } 154 break; 155 case 13: 156 if (curChar == 42) 157 { jjCheckNAddStates(9, 11); } 158 break; 159 case 14: 160 if ((0xffff7bffffffffffL & l) != 0L) 161 { jjCheckNAddTwoStates(15, 13); } 162 break; 163 case 15: 164 if ((0xfffffbffffffffffL & l) != 0L) 165 { jjCheckNAddTwoStates(15, 13); } 166 break; 167 case 16: 168 if (curChar == 47 && kind > 6) 169 kind = 6; 170 break; 171 case 17: 172 if (curChar == 42) 173 jjstateSet[jjnewStateCnt++] = 11; 174 break; 175 case 18: 176 if (curChar == 42) 177 { jjCheckNAddTwoStates(19, 20); } 178 break; 179 case 19: 180 if ((0xfffffbffffffffffL & l) != 0L) 181 { jjCheckNAddTwoStates(19, 20); } 182 break; 183 case 20: 184 if (curChar == 42) 185 { jjCheckNAddStates(12, 14); } 186 break; 187 case 21: 188 if ((0xffff7bffffffffffL & l) != 0L) 189 { jjCheckNAddTwoStates(22, 20); } 190 break; 191 case 22: 192 if ((0xfffffbffffffffffL & l) != 0L) 193 { jjCheckNAddTwoStates(22, 20); } 194 break; 195 case 23: 196 if (curChar == 47 && kind > 7) 197 kind = 7; 198 break; 199 case 24: 200 if ((0x3fe000000000000L & l) == 0L) 201 break; 202 if (kind > 10) 203 kind = 10; 204 { jjCheckNAddStates(0, 2); } 205 break; 206 case 25: 207 if ((0x3ff000000000000L & l) == 0L) 208 break; 209 if (kind > 10) 210 kind = 10; 211 { jjCheckNAdd(25); } 212 break; 213 case 26: 214 if ((0x3ff000000000000L & l) != 0L) 215 { jjCheckNAddTwoStates(26, 27); } 216 break; 217 case 27: 218 if (curChar != 46) 219 break; 220 if (kind > 11) 221 kind = 11; 222 { jjCheckNAdd(28); } 223 break; 224 case 28: 225 if ((0x3ff000000000000L & l) == 0L) 226 break; 227 if (kind > 11) 228 kind = 11; 229 { jjCheckNAdd(28); } 230 break; 231 case 29: 232 if (curChar != 48) 233 break; 234 if (kind > 10) 235 kind = 10; 236 { jjCheckNAdd(27); } 237 break; 238 default : break; 239 } 240 } while(i != startsAt); 241 } 242 else if (curChar < 128) 243 { 244 long l = 1L << (curChar & 077); 245 do 246 { 247 switch(jjstateSet[--i]) 248 { 249 case 0: 250 if ((0x7fffffe00000000L & l) == 0L) 251 break; 252 if (kind > 9) 253 kind = 9; 254 { jjCheckNAdd(1); } 255 break; 256 case 1: 257 if ((0x7fffffe87fffffeL & l) == 0L) 258 break; 259 if (kind > 9) 260 kind = 9; 261 { jjCheckNAdd(1); } 262 break; 263 case 3: 264 if ((0xffffffffefffffffL & l) != 0L) 265 { jjAddStates(15, 16); } 266 break; 267 case 7: 268 { jjAddStates(6, 8); } 269 break; 270 case 12: 271 { jjCheckNAddTwoStates(12, 13); } 272 break; 273 case 14: 274 case 15: 275 { jjCheckNAddTwoStates(15, 13); } 276 break; 277 case 19: 278 { jjCheckNAddTwoStates(19, 20); } 279 break; 280 case 21: 281 case 22: 282 { jjCheckNAddTwoStates(22, 20); } 283 break; 284 default : break; 285 } 286 } while(i != startsAt); 287 } 288 else 289 { 290 int hiByte = (curChar >> 8); 291 int i1 = hiByte >> 6; 292 long l1 = 1L << (hiByte & 077); 293 int i2 = (curChar & 0xff) >> 6; 294 long l2 = 1L << (curChar & 077); 295 do 296 { 297 switch(jjstateSet[--i]) 298 { 299 case 3: 300 if (jjCanMove_0(hiByte, i1, i2, l1, l2)) 301 { jjAddStates(15, 16); } 302 break; 303 case 7: 304 if (jjCanMove_0(hiByte, i1, i2, l1, l2)) 305 { jjAddStates(6, 8); } 306 break; 307 case 12: 308 if (jjCanMove_0(hiByte, i1, i2, l1, l2)) 309 { jjCheckNAddTwoStates(12, 13); } 310 break; 311 case 14: 312 case 15: 313 if (jjCanMove_0(hiByte, i1, i2, l1, l2)) 314 { jjCheckNAddTwoStates(15, 13); } 315 break; 316 case 19: 317 if (jjCanMove_0(hiByte, i1, i2, l1, l2)) 318 { jjCheckNAddTwoStates(19, 20); } 319 break; 320 case 21: 321 case 22: 322 if (jjCanMove_0(hiByte, i1, i2, l1, l2)) 323 { jjCheckNAddTwoStates(22, 20); } 324 break; 325 default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break; 326 } 327 } while(i != startsAt); 328 } 329 if (kind != 0x7fffffff) 330 { 331 jjmatchedKind = kind; 332 jjmatchedPos = curPos; 333 kind = 0x7fffffff; 334 } 335 ++curPos; 336 if ((i = jjnewStateCnt) == (startsAt = 30 - (jjnewStateCnt = startsAt))) 337 return curPos; 338 try { curChar = input_stream.readChar(); } 339 catch(java.io.IOException e) { return curPos; } 340 } 341} 342static final int[] jjnextStates = { 343 25, 26, 27, 6, 17, 18, 7, 8, 10, 13, 14, 16, 20, 21, 23, 3, 344 4, 345}; 346private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) 347{ 348 switch(hiByte) 349 { 350 case 0: 351 return ((jjbitVec2[i2] & l2) != 0L); 352 default : 353 if ((jjbitVec0[i1] & l1) != 0L) 354 return true; 355 return false; 356 } 357} 358 359/** Token literal values. */ 360public static final String[] jjstrLiteralImages = { 361"", null, null, null, null, null, null, null, "\56", null, null, null, null, 362"\75", "\173", "\175", "\54", "\55", "\133", "\135", "\50", "\51", "\72", }; 363protected Token jjFillToken() 364{ 365 final Token t; 366 final String curTokenImage; 367 final int beginLine; 368 final int endLine; 369 final int beginColumn; 370 final int endColumn; 371 String im = jjstrLiteralImages[jjmatchedKind]; 372 curTokenImage = (im == null) ? input_stream.GetImage() : im; 373 beginLine = input_stream.getBeginLine(); 374 beginColumn = input_stream.getBeginColumn(); 375 endLine = input_stream.getEndLine(); 376 endColumn = input_stream.getEndColumn(); 377 t = Token.newToken(jjmatchedKind, curTokenImage); 378 379 t.beginLine = beginLine; 380 t.endLine = endLine; 381 t.beginColumn = beginColumn; 382 t.endColumn = endColumn; 383 384 return t; 385} 386 387int curLexState = 0; 388int defaultLexState = 0; 389int jjnewStateCnt; 390int jjround; 391int jjmatchedPos; 392int jjmatchedKind; 393 394/** Get the next Token. */ 395public Token getNextToken() 396{ 397 Token matchedToken; 398 int curPos = 0; 399 400 EOFLoop : 401 for (;;) 402 { 403 try 404 { 405 curChar = input_stream.BeginToken(); 406 } 407 catch(java.io.IOException e) 408 { 409 jjmatchedKind = 0; 410 jjmatchedPos = -1; 411 matchedToken = jjFillToken(); 412 return matchedToken; 413 } 414 415 try { input_stream.backup(0); 416 while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) 417 curChar = input_stream.BeginToken(); 418 } 419 catch (java.io.IOException e1) { continue EOFLoop; } 420 jjmatchedKind = 0x7fffffff; 421 jjmatchedPos = 0; 422 curPos = jjMoveStringLiteralDfa0_0(); 423 if (jjmatchedKind != 0x7fffffff) 424 { 425 if (jjmatchedPos + 1 < curPos) 426 input_stream.backup(curPos - jjmatchedPos - 1); 427 if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) 428 { 429 matchedToken = jjFillToken(); 430 return matchedToken; 431 } 432 else 433 { 434 continue EOFLoop; 435 } 436 } 437 int error_line = input_stream.getEndLine(); 438 int error_column = input_stream.getEndColumn(); 439 String error_after = null; 440 boolean EOFSeen = false; 441 try { input_stream.readChar(); input_stream.backup(1); } 442 catch (java.io.IOException e1) { 443 EOFSeen = true; 444 error_after = curPos <= 1 ? "" : input_stream.GetImage(); 445 if (curChar == '\n' || curChar == '\r') { 446 error_line++; 447 error_column = 0; 448 } 449 else 450 error_column++; 451 } 452 if (!EOFSeen) { 453 input_stream.backup(1); 454 error_after = curPos <= 1 ? "" : input_stream.GetImage(); 455 } 456 throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); 457 } 458} 459 460private void jjCheckNAdd(int state) 461{ 462 if (jjrounds[state] != jjround) 463 { 464 jjstateSet[jjnewStateCnt++] = state; 465 jjrounds[state] = jjround; 466 } 467} 468private void jjAddStates(int start, int end) 469{ 470 do { 471 jjstateSet[jjnewStateCnt++] = jjnextStates[start]; 472 } while (start++ != end); 473} 474private void jjCheckNAddTwoStates(int state1, int state2) 475{ 476 jjCheckNAdd(state1); 477 jjCheckNAdd(state2); 478} 479 480private void jjCheckNAddStates(int start, int end) 481{ 482 do { 483 jjCheckNAdd(jjnextStates[start]); 484 } while (start++ != end); 485} 486 487 /** Constructor. */ 488 public ConfParserLegacyTokenManager(SimpleCharStream stream){ 489 490 if (SimpleCharStream.staticFlag) 491 throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); 492 493 input_stream = stream; 494 } 495 496 /** Constructor. */ 497 public ConfParserLegacyTokenManager (SimpleCharStream stream, int lexState){ 498 ReInit(stream); 499 SwitchTo(lexState); 500 } 501 502 /** Reinitialise parser. */ 503 public void ReInit(SimpleCharStream stream) 504 { 505 jjmatchedPos = jjnewStateCnt = 0; 506 curLexState = defaultLexState; 507 input_stream = stream; 508 ReInitRounds(); 509 } 510 511 private void ReInitRounds() 512 { 513 int i; 514 jjround = 0x80000001; 515 for (i = 30; i-- > 0;) 516 jjrounds[i] = 0x80000000; 517 } 518 519 /** Reinitialise parser. */ 520 public void ReInit(SimpleCharStream stream, int lexState) 521 { 522 ReInit(stream); 523 SwitchTo(lexState); 524 } 525 526 /** Switch to specified lex state. */ 527 public void SwitchTo(int lexState) 528 { 529 if (lexState >= 1 || lexState < 0) 530 throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); 531 else 532 curLexState = lexState; 533 } 534 535/** Lexer state names. */ 536public static final String[] lexStateNames = { 537 "DEFAULT", 538}; 539static final long[] jjtoToken = { 540 0x7fff01L, 541}; 542static final long[] jjtoSkip = { 543 0xfeL, 544}; 545 protected SimpleCharStream input_stream; 546 547 private final int[] jjrounds = new int[30]; 548 private final int[] jjstateSet = new int[2 * 30]; 549 550 551 protected char curChar; 552}