001/* 002 * Copyright 2006 - 2013 003 * Stefan Balev <stefan.balev@graphstream-project.org> 004 * Julien Baudry <julien.baudry@graphstream-project.org> 005 * Antoine Dutot <antoine.dutot@graphstream-project.org> 006 * Yoann Pigné <yoann.pigne@graphstream-project.org> 007 * Guilhelm Savin <guilhelm.savin@graphstream-project.org> 008 * 009 * This file is part of GraphStream <http://graphstream-project.org>. 010 * 011 * GraphStream is a library whose purpose is to handle static or dynamic 012 * graph, create them from scratch, file or any source and display them. 013 * 014 * This program is free software distributed under the terms of two licenses, the 015 * CeCILL-C license that fits European law, and the GNU Lesser General Public 016 * License. You can use, modify and/ or redistribute the software under the terms 017 * of the CeCILL-C license as circulated by CEA, CNRS and INRIA at the following 018 * URL <http://www.cecill.info> or under the terms of the GNU LGPL as published by 019 * the Free Software Foundation, either version 3 of the License, or (at your 020 * option) any later version. 021 * 022 * This program is distributed in the hope that it will be useful, but WITHOUT ANY 023 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 024 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 025 * 026 * You should have received a copy of the GNU Lesser General Public License 027 * along with this program. If not, see <http://www.gnu.org/licenses/>. 028 * 029 * The fact that you are presently reading this means that you have had 030 * knowledge of the CeCILL-C and LGPL licenses and that you accept their terms. 031 */ 032package org.graphstream.stream.file.pajek; 033 034import org.graphstream.util.parser.SimpleCharStream; 035import org.graphstream.util.parser.Token; 036import org.graphstream.util.parser.TokenMgrError; 037 038/** Token Manager. */ 039public class PajekParserTokenManager implements PajekParserConstants { 040 041 /** Debug output. */ 042 public java.io.PrintStream debugStream = System.out; 043 044 /** Set debug output. */ 045 public void setDebugStream(java.io.PrintStream ds) { 046 debugStream = ds; 047 } 048 049 private final int jjStopStringLiteralDfa_0(int pos, long active0) { 050 switch (pos) { 051 case 0: 052 if ((active0 & 0x3c03023660000L) != 0L) { 053 jjmatchedKind = 53; 054 return 11; 055 } 056 if ((active0 & 0x20000000000L) != 0L) 057 return 17; 058 if ((active0 & 0x1c3dcfdc180000L) != 0L) 059 return 11; 060 return -1; 061 case 1: 062 if ((active0 & 0x30077e0000L) != 0L) { 063 if (jjmatchedPos != 1) { 064 jjmatchedKind = 53; 065 jjmatchedPos = 1; 066 } 067 return 11; 068 } 069 if ((active0 & 0xfe80fe0000000L) != 0L) 070 return 11; 071 return -1; 072 case 2: 073 if ((active0 & 0x1004100000L) != 0L) 074 return 11; 075 if ((active0 & 0x28036e0000L) != 0L) { 076 jjmatchedKind = 53; 077 jjmatchedPos = 2; 078 return 11; 079 } 080 return -1; 081 case 3: 082 if ((active0 & 0x36e0000L) != 0L) { 083 jjmatchedKind = 53; 084 jjmatchedPos = 3; 085 return 11; 086 } 087 if ((active0 & 0x2800000000L) != 0L) 088 return 11; 089 return -1; 090 case 4: 091 if ((active0 & 0x3260000L) != 0L) { 092 if (jjmatchedPos != 4) { 093 jjmatchedKind = 53; 094 jjmatchedPos = 4; 095 } 096 return 11; 097 } 098 if ((active0 & 0x480000L) != 0L) 099 return 11; 100 return -1; 101 case 5: 102 if ((active0 & 0x3000000L) != 0L) 103 return 11; 104 if ((active0 & 0x260000L) != 0L) { 105 if (jjmatchedPos != 5) { 106 jjmatchedKind = 53; 107 jjmatchedPos = 5; 108 } 109 return 11; 110 } 111 return -1; 112 case 6: 113 if ((active0 & 0x60000L) != 0L) 114 return 11; 115 if ((active0 & 0x200000L) != 0L) { 116 jjmatchedKind = 53; 117 jjmatchedPos = 6; 118 return 11; 119 } 120 return -1; 121 case 7: 122 if ((active0 & 0x200000L) != 0L) 123 return 11; 124 return -1; 125 default: 126 return -1; 127 } 128 } 129 130 private final int jjStartNfa_0(int pos, long active0) { 131 return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); 132 } 133 134 private int jjStopAtPos(int pos, int kind) { 135 jjmatchedKind = kind; 136 jjmatchedPos = pos; 137 return pos + 1; 138 } 139 140 private int jjMoveStringLiteralDfa0_0() { 141 switch (curChar) { 142 case 42: 143 return jjMoveStringLiteralDfa1_0(0xfe00L); 144 case 65: 145 case 97: 146 jjmatchedKind = 42; 147 return jjMoveStringLiteralDfa1_0(0xc080000000000L); 148 case 66: 149 case 98: 150 jjmatchedKind = 52; 151 return jjMoveStringLiteralDfa1_0(0xc0100000L); 152 case 67: 153 case 99: 154 jjmatchedKind = 38; 155 return jjMoveStringLiteralDfa1_0(0x80000L); 156 case 68: 157 case 100: 158 return jjMoveStringLiteralDfa1_0(0x40000L); 159 case 69: 160 case 101: 161 return jjMoveStringLiteralDfa1_0(0x420000L); 162 case 70: 163 case 102: 164 return jjMoveStringLiteralDfa1_0(0x3000000000L); 165 case 72: 166 case 104: 167 return jjMoveStringLiteralDfa1_0(0xc00000000000L); 168 case 73: 169 case 105: 170 return jjMoveStringLiteralDfa1_0(0x20000000L); 171 case 75: 172 case 107: 173 return jjMoveStringLiteralDfa1_0(0x3000000000000L); 174 case 76: 175 case 108: 176 jjmatchedKind = 44; 177 return jjMoveStringLiteralDfa1_0(0x200f00000000L); 178 case 80: 179 case 112: 180 jjmatchedKind = 39; 181 return jjMoveStringLiteralDfa1_0(0x4000000L); 182 case 81: 183 case 113: 184 return jjStartNfaWithStates_0(0, 28, 11); 185 case 82: 186 case 114: 187 return jjStartNfaWithStates_0(0, 27, 11); 188 case 83: 189 case 115: 190 return jjStartNfaWithStates_0(0, 41, 17); 191 case 84: 192 case 116: 193 return jjMoveStringLiteralDfa1_0(0x200000L); 194 case 87: 195 case 119: 196 return jjStartNfaWithStates_0(0, 40, 11); 197 case 88: 198 case 120: 199 return jjMoveStringLiteralDfa1_0(0x1000000L); 200 case 89: 201 case 121: 202 return jjMoveStringLiteralDfa1_0(0x2000000L); 203 default: 204 return jjMoveNfa_0(0, 0); 205 } 206 } 207 208 private int jjMoveStringLiteralDfa1_0(long active0) { 209 try { 210 curChar = input_stream.readChar(); 211 } catch (java.io.IOException e) { 212 jjStopStringLiteralDfa_0(0, active0); 213 return 1; 214 } 215 switch (curChar) { 216 case 49: 217 if ((active0 & 0x400000000000L) != 0L) 218 return jjStartNfaWithStates_0(1, 46, 11); 219 else if ((active0 & 0x1000000000000L) != 0L) 220 return jjStartNfaWithStates_0(1, 48, 11); 221 else if ((active0 & 0x4000000000000L) != 0L) 222 return jjStartNfaWithStates_0(1, 50, 11); 223 break; 224 case 50: 225 if ((active0 & 0x800000000000L) != 0L) 226 return jjStartNfaWithStates_0(1, 47, 11); 227 else if ((active0 & 0x2000000000000L) != 0L) 228 return jjStartNfaWithStates_0(1, 49, 11); 229 else if ((active0 & 0x8000000000000L) != 0L) 230 return jjStartNfaWithStates_0(1, 51, 11); 231 break; 232 case 95: 233 return jjMoveStringLiteralDfa2_0(active0, 0x3000000L); 234 case 65: 235 case 97: 236 if ((active0 & 0x200000000L) != 0L) 237 return jjStartNfaWithStates_0(1, 33, 11); 238 return jjMoveStringLiteralDfa2_0(active0, 0x4800L); 239 case 67: 240 case 99: 241 if ((active0 & 0x20000000L) != 0L) 242 return jjStartNfaWithStates_0(1, 29, 11); 243 else if ((active0 & 0x40000000L) != 0L) 244 return jjStartNfaWithStates_0(1, 30, 11); 245 else if ((active0 & 0x100000000L) != 0L) 246 return jjStartNfaWithStates_0(1, 32, 11); 247 break; 248 case 69: 249 case 101: 250 return jjMoveStringLiteralDfa2_0(active0, 0x3000L); 251 case 72: 252 case 104: 253 return jjMoveStringLiteralDfa2_0(active0, 0x4000000L); 254 case 73: 255 case 105: 256 return jjMoveStringLiteralDfa2_0(active0, 0x40000L); 257 case 76: 258 case 108: 259 return jjMoveStringLiteralDfa2_0(active0, 0x20000L); 260 case 77: 261 case 109: 262 return jjMoveStringLiteralDfa2_0(active0, 0x408000L); 263 case 78: 264 case 110: 265 return jjMoveStringLiteralDfa2_0(active0, 0x200L); 266 case 79: 267 case 111: 268 return jjMoveStringLiteralDfa2_0(active0, 0x3000100000L); 269 case 80: 270 case 112: 271 if ((active0 & 0x80000000000L) != 0L) 272 return jjStartNfaWithStates_0(1, 43, 11); 273 else if ((active0 & 0x200000000000L) != 0L) { 274 jjmatchedKind = 45; 275 jjmatchedPos = 1; 276 } 277 return jjMoveStringLiteralDfa2_0(active0, 0x800000000L); 278 case 82: 279 case 114: 280 if ((active0 & 0x400000000L) != 0L) 281 return jjStartNfaWithStates_0(1, 34, 11); 282 return jjMoveStringLiteralDfa2_0(active0, 0x280000L); 283 case 86: 284 case 118: 285 return jjMoveStringLiteralDfa2_0(active0, 0x400L); 286 case 87: 287 case 119: 288 if ((active0 & 0x80000000L) != 0L) 289 return jjStartNfaWithStates_0(1, 31, 11); 290 break; 291 default: 292 break; 293 } 294 return jjStartNfa_0(0, active0); 295 } 296 297 private int jjMoveStringLiteralDfa2_0(long old0, long active0) { 298 if (((active0 &= old0)) == 0L) 299 return jjStartNfa_0(0, old0); 300 try { 301 curChar = input_stream.readChar(); 302 } catch (java.io.IOException e) { 303 jjStopStringLiteralDfa_0(1, active0); 304 return 2; 305 } 306 switch (curChar) { 307 case 65: 308 case 97: 309 return jjMoveStringLiteralDfa3_0(active0, 0x48000L); 310 case 68: 311 case 100: 312 return jjMoveStringLiteralDfa3_0(active0, 0x3000L); 313 case 69: 314 case 101: 315 return jjMoveStringLiteralDfa3_0(active0, 0x600L); 316 case 70: 317 case 102: 318 return jjMoveStringLiteralDfa3_0(active0, 0x3000000L); 319 case 72: 320 case 104: 321 return jjMoveStringLiteralDfa3_0(active0, 0x800000000L); 322 case 73: 323 case 105: 324 if ((active0 & 0x4000000L) != 0L) 325 return jjStartNfaWithStates_0(2, 26, 11); 326 return jjMoveStringLiteralDfa3_0(active0, 0x200000L); 327 case 76: 328 case 108: 329 return jjMoveStringLiteralDfa3_0(active0, 0x20000L); 330 case 78: 331 case 110: 332 return jjMoveStringLiteralDfa3_0(active0, 0x2000000000L); 333 case 79: 334 case 111: 335 return jjMoveStringLiteralDfa3_0(active0, 0x80000L); 336 case 80: 337 case 112: 338 return jjMoveStringLiteralDfa3_0(active0, 0x400000L); 339 case 82: 340 case 114: 341 return jjMoveStringLiteralDfa3_0(active0, 0x4800L); 342 case 83: 343 case 115: 344 if ((active0 & 0x1000000000L) != 0L) 345 return jjStartNfaWithStates_0(2, 36, 11); 346 break; 347 case 88: 348 case 120: 349 if ((active0 & 0x100000L) != 0L) 350 return jjStartNfaWithStates_0(2, 20, 11); 351 break; 352 default: 353 break; 354 } 355 return jjStartNfa_0(1, active0); 356 } 357 358 private int jjMoveStringLiteralDfa3_0(long old0, long active0) { 359 if (((active0 &= old0)) == 0L) 360 return jjStartNfa_0(1, old0); 361 try { 362 curChar = input_stream.readChar(); 363 } catch (java.io.IOException e) { 364 jjStopStringLiteralDfa_0(2, active0); 365 return 3; 366 } 367 switch (curChar) { 368 case 65: 369 case 97: 370 return jjMoveStringLiteralDfa4_0(active0, 0x3200000L); 371 case 67: 372 case 99: 373 return jjMoveStringLiteralDfa4_0(active0, 0x4800L); 374 case 71: 375 case 103: 376 return jjMoveStringLiteralDfa4_0(active0, 0x3000L); 377 case 73: 378 case 105: 379 if ((active0 & 0x800000000L) != 0L) 380 return jjStartNfaWithStates_0(3, 35, 11); 381 return jjMoveStringLiteralDfa4_0(active0, 0x20000L); 382 case 77: 383 case 109: 384 return jjMoveStringLiteralDfa4_0(active0, 0x40000L); 385 case 82: 386 case 114: 387 return jjMoveStringLiteralDfa4_0(active0, 0x400L); 388 case 83: 389 case 115: 390 return jjMoveStringLiteralDfa4_0(active0, 0x80000L); 391 case 84: 392 case 116: 393 if ((active0 & 0x2000000000L) != 0L) 394 return jjStartNfaWithStates_0(3, 37, 11); 395 return jjMoveStringLiteralDfa4_0(active0, 0x408200L); 396 default: 397 break; 398 } 399 return jjStartNfa_0(2, active0); 400 } 401 402 private int jjMoveStringLiteralDfa4_0(long old0, long active0) { 403 if (((active0 &= old0)) == 0L) 404 return jjStartNfa_0(2, old0); 405 try { 406 curChar = input_stream.readChar(); 407 } catch (java.io.IOException e) { 408 jjStopStringLiteralDfa_0(3, active0); 409 return 4; 410 } 411 switch (curChar) { 412 case 67: 413 case 99: 414 return jjMoveStringLiteralDfa5_0(active0, 0x3000000L); 415 case 69: 416 case 101: 417 return jjMoveStringLiteralDfa5_0(active0, 0x3000L); 418 case 78: 419 case 110: 420 return jjMoveStringLiteralDfa5_0(active0, 0x200000L); 421 case 79: 422 case 111: 423 return jjMoveStringLiteralDfa5_0(active0, 0x40000L); 424 case 80: 425 case 112: 426 return jjMoveStringLiteralDfa5_0(active0, 0x20000L); 427 case 82: 428 case 114: 429 return jjMoveStringLiteralDfa5_0(active0, 0x8000L); 430 case 83: 431 case 115: 432 if ((active0 & 0x800L) != 0L) { 433 jjmatchedKind = 11; 434 jjmatchedPos = 4; 435 } else if ((active0 & 0x80000L) != 0L) 436 return jjStartNfaWithStates_0(4, 19, 11); 437 return jjMoveStringLiteralDfa5_0(active0, 0x4000L); 438 case 84: 439 case 116: 440 return jjMoveStringLiteralDfa5_0(active0, 0x400L); 441 case 87: 442 case 119: 443 return jjMoveStringLiteralDfa5_0(active0, 0x200L); 444 case 89: 445 case 121: 446 if ((active0 & 0x400000L) != 0L) 447 return jjStartNfaWithStates_0(4, 22, 11); 448 break; 449 default: 450 break; 451 } 452 return jjStartNfa_0(3, active0); 453 } 454 455 private int jjMoveStringLiteralDfa5_0(long old0, long active0) { 456 if (((active0 &= old0)) == 0L) 457 return jjStartNfa_0(3, old0); 458 try { 459 curChar = input_stream.readChar(); 460 } catch (java.io.IOException e) { 461 jjStopStringLiteralDfa_0(4, active0); 462 return 5; 463 } 464 switch (curChar) { 465 case 71: 466 case 103: 467 return jjMoveStringLiteralDfa6_0(active0, 0x200000L); 468 case 73: 469 case 105: 470 return jjMoveStringLiteralDfa6_0(active0, 0x8400L); 471 case 76: 472 case 108: 473 return jjMoveStringLiteralDfa6_0(active0, 0x4000L); 474 case 78: 475 case 110: 476 return jjMoveStringLiteralDfa6_0(active0, 0x40000L); 477 case 79: 478 case 111: 479 return jjMoveStringLiteralDfa6_0(active0, 0x200L); 480 case 83: 481 case 115: 482 if ((active0 & 0x1000L) != 0L) { 483 jjmatchedKind = 12; 484 jjmatchedPos = 5; 485 } 486 return jjMoveStringLiteralDfa6_0(active0, 0x22000L); 487 case 84: 488 case 116: 489 if ((active0 & 0x1000000L) != 0L) 490 return jjStartNfaWithStates_0(5, 24, 11); 491 else if ((active0 & 0x2000000L) != 0L) 492 return jjStartNfaWithStates_0(5, 25, 11); 493 break; 494 default: 495 break; 496 } 497 return jjStartNfa_0(4, active0); 498 } 499 500 private int jjMoveStringLiteralDfa6_0(long old0, long active0) { 501 if (((active0 &= old0)) == 0L) 502 return jjStartNfa_0(4, old0); 503 try { 504 curChar = input_stream.readChar(); 505 } catch (java.io.IOException e) { 506 jjStopStringLiteralDfa_0(5, active0); 507 return 6; 508 } 509 switch (curChar) { 510 case 67: 511 case 99: 512 return jjMoveStringLiteralDfa7_0(active0, 0x400L); 513 case 68: 514 case 100: 515 if ((active0 & 0x40000L) != 0L) 516 return jjStartNfaWithStates_0(6, 18, 11); 517 break; 518 case 69: 519 case 101: 520 if ((active0 & 0x20000L) != 0L) 521 return jjStartNfaWithStates_0(6, 17, 11); 522 break; 523 case 73: 524 case 105: 525 return jjMoveStringLiteralDfa7_0(active0, 0x4000L); 526 case 76: 527 case 108: 528 return jjMoveStringLiteralDfa7_0(active0, 0x202000L); 529 case 82: 530 case 114: 531 return jjMoveStringLiteralDfa7_0(active0, 0x200L); 532 case 88: 533 case 120: 534 if ((active0 & 0x8000L) != 0L) 535 return jjStopAtPos(6, 15); 536 break; 537 default: 538 break; 539 } 540 return jjStartNfa_0(5, active0); 541 } 542 543 private int jjMoveStringLiteralDfa7_0(long old0, long active0) { 544 if (((active0 &= old0)) == 0L) 545 return jjStartNfa_0(5, old0); 546 try { 547 curChar = input_stream.readChar(); 548 } catch (java.io.IOException e) { 549 jjStopStringLiteralDfa_0(6, active0); 550 return 7; 551 } 552 switch (curChar) { 553 case 69: 554 case 101: 555 if ((active0 & 0x200000L) != 0L) 556 return jjStartNfaWithStates_0(7, 21, 11); 557 return jjMoveStringLiteralDfa8_0(active0, 0x400L); 558 case 73: 559 case 105: 560 return jjMoveStringLiteralDfa8_0(active0, 0x2000L); 561 case 75: 562 case 107: 563 if ((active0 & 0x200L) != 0L) 564 return jjStopAtPos(7, 9); 565 break; 566 case 83: 567 case 115: 568 return jjMoveStringLiteralDfa8_0(active0, 0x4000L); 569 default: 570 break; 571 } 572 return jjStartNfa_0(6, active0); 573 } 574 575 private int jjMoveStringLiteralDfa8_0(long old0, long active0) { 576 if (((active0 &= old0)) == 0L) 577 return jjStartNfa_0(6, old0); 578 try { 579 curChar = input_stream.readChar(); 580 } catch (java.io.IOException e) { 581 jjStopStringLiteralDfa_0(7, active0); 582 return 8; 583 } 584 switch (curChar) { 585 case 83: 586 case 115: 587 if ((active0 & 0x400L) != 0L) 588 return jjStopAtPos(8, 10); 589 return jjMoveStringLiteralDfa9_0(active0, 0x2000L); 590 case 84: 591 case 116: 592 if ((active0 & 0x4000L) != 0L) 593 return jjStopAtPos(8, 14); 594 break; 595 default: 596 break; 597 } 598 return jjStartNfa_0(7, active0); 599 } 600 601 private int jjMoveStringLiteralDfa9_0(long old0, long active0) { 602 if (((active0 &= old0)) == 0L) 603 return jjStartNfa_0(7, old0); 604 try { 605 curChar = input_stream.readChar(); 606 } catch (java.io.IOException e) { 607 jjStopStringLiteralDfa_0(8, active0); 608 return 9; 609 } 610 switch (curChar) { 611 case 84: 612 case 116: 613 if ((active0 & 0x2000L) != 0L) 614 return jjStopAtPos(9, 13); 615 break; 616 default: 617 break; 618 } 619 return jjStartNfa_0(8, active0); 620 } 621 622 private int jjStartNfaWithStates_0(int pos, int kind, int state) { 623 jjmatchedKind = kind; 624 jjmatchedPos = pos; 625 try { 626 curChar = input_stream.readChar(); 627 } catch (java.io.IOException e) { 628 return pos + 1; 629 } 630 return jjMoveNfa_0(state, pos + 1); 631 } 632 633 static final long[] jjbitVec0 = { 0x0L, 0x0L, 0xffffffffffffffffL, 634 0xffffffffffffffffL }; 635 636 private int jjMoveNfa_0(int startState, int curPos) { 637 int startsAt = 0; 638 jjnewStateCnt = 26; 639 int i = 1; 640 jjstateSet[0] = startState; 641 int kind = 0x7fffffff; 642 for (;;) { 643 if (++jjround == 0x7fffffff) 644 ReInitRounds(); 645 if (curChar < 64) { 646 long l = 1L << curChar; 647 do { 648 switch (jjstateSet[--i]) { 649 case 0: 650 if ((0x3ff400000000000L & l) != 0L) { 651 if (kind > 53) 652 kind = 53; 653 jjCheckNAdd(11); 654 } else if ((0x280000000000L & l) != 0L) 655 jjCheckNAddTwoStates(21, 22); 656 else if ((0x2400L & l) != 0L) { 657 if (kind > 3) 658 kind = 3; 659 } else if (curChar == 37) 660 jjCheckNAddTwoStates(8, 9); 661 else if (curChar == 39) 662 jjCheckNAddTwoStates(5, 6); 663 else if (curChar == 34) 664 jjCheckNAddTwoStates(2, 3); 665 if ((0x3ff000000000000L & l) != 0L) { 666 if (kind > 6) 667 kind = 6; 668 jjCheckNAddStates(0, 2); 669 } 670 break; 671 case 17: 672 case 11: 673 if ((0x7ff600800000000L & l) == 0L) 674 break; 675 if (kind > 53) 676 kind = 53; 677 jjCheckNAdd(11); 678 break; 679 case 1: 680 if (curChar == 34) 681 jjCheckNAddTwoStates(2, 3); 682 break; 683 case 2: 684 if ((0xfffffffbffffffffL & l) != 0L) 685 jjCheckNAddTwoStates(2, 3); 686 break; 687 case 3: 688 if (curChar == 34 && kind > 8) 689 kind = 8; 690 break; 691 case 4: 692 if (curChar == 39) 693 jjCheckNAddTwoStates(5, 6); 694 break; 695 case 5: 696 if ((0xffffff7fffffffffL & l) != 0L) 697 jjCheckNAddTwoStates(5, 6); 698 break; 699 case 6: 700 if (curChar == 39 && kind > 8) 701 kind = 8; 702 break; 703 case 7: 704 if (curChar == 37) 705 jjCheckNAddTwoStates(8, 9); 706 break; 707 case 8: 708 if ((0xffffffffffffdbffL & l) != 0L) 709 jjCheckNAddTwoStates(8, 9); 710 break; 711 case 9: 712 if ((0x2400L & l) == 0L) 713 break; 714 if (kind > 16) 715 kind = 16; 716 jjCheckNAdd(9); 717 break; 718 case 10: 719 if ((0x3ff400000000000L & l) == 0L) 720 break; 721 if (kind > 53) 722 kind = 53; 723 jjCheckNAdd(11); 724 break; 725 case 20: 726 if ((0x280000000000L & l) != 0L) 727 jjCheckNAddTwoStates(21, 22); 728 break; 729 case 21: 730 if ((0x3ff000000000000L & l) == 0L) 731 break; 732 if (kind > 6) 733 kind = 6; 734 jjCheckNAdd(21); 735 break; 736 case 22: 737 if ((0x3ff000000000000L & l) == 0L) 738 break; 739 if (kind > 7) 740 kind = 7; 741 jjCheckNAddTwoStates(22, 23); 742 break; 743 case 23: 744 if (curChar == 46) 745 jjCheckNAdd(24); 746 break; 747 case 24: 748 if ((0x3ff000000000000L & l) == 0L) 749 break; 750 if (kind > 7) 751 kind = 7; 752 jjCheckNAdd(24); 753 break; 754 case 25: 755 if ((0x3ff000000000000L & l) == 0L) 756 break; 757 if (kind > 6) 758 kind = 6; 759 jjCheckNAddStates(0, 2); 760 break; 761 default: 762 break; 763 } 764 } while (i != startsAt); 765 } else if (curChar < 128) { 766 long l = 1L << (curChar & 077); 767 do { 768 switch (jjstateSet[--i]) { 769 case 0: 770 if ((0x7fffffe07fffffeL & l) != 0L) { 771 if (kind > 53) 772 kind = 53; 773 jjCheckNAdd(11); 774 } 775 if ((0x8000000080000L & l) != 0L) 776 jjAddStates(3, 4); 777 break; 778 case 17: 779 if ((0x7fffffe87ffffffL & l) != 0L) { 780 if (kind > 53) 781 kind = 53; 782 jjCheckNAdd(11); 783 } 784 if ((0x20000000200L & l) != 0L) 785 jjstateSet[jjnewStateCnt++] = 18; 786 else if (curChar == 95) 787 jjstateSet[jjnewStateCnt++] = 16; 788 break; 789 case 2: 790 jjAddStates(5, 6); 791 break; 792 case 5: 793 jjAddStates(7, 8); 794 break; 795 case 8: 796 jjAddStates(9, 10); 797 break; 798 case 10: 799 if ((0x7fffffe07fffffeL & l) == 0L) 800 break; 801 if (kind > 53) 802 kind = 53; 803 jjCheckNAdd(11); 804 break; 805 case 11: 806 if ((0x7fffffe87ffffffL & l) == 0L) 807 break; 808 if (kind > 53) 809 kind = 53; 810 jjCheckNAdd(11); 811 break; 812 case 12: 813 if ((0x8000000080000L & l) != 0L) 814 jjAddStates(3, 4); 815 break; 816 case 13: 817 if ((0x2000000020L & l) != 0L && kind > 23) 818 kind = 23; 819 break; 820 case 14: 821 case 18: 822 if ((0x400000004000000L & l) != 0L) 823 jjCheckNAdd(13); 824 break; 825 case 15: 826 if ((0x20000000200L & l) != 0L) 827 jjstateSet[jjnewStateCnt++] = 14; 828 break; 829 case 16: 830 if ((0x8000000080000L & l) != 0L) 831 jjstateSet[jjnewStateCnt++] = 15; 832 break; 833 case 19: 834 if ((0x20000000200L & l) != 0L) 835 jjstateSet[jjnewStateCnt++] = 18; 836 break; 837 default: 838 break; 839 } 840 } while (i != startsAt); 841 } else { 842 int i2 = (curChar & 0xff) >> 6; 843 long l2 = 1L << (curChar & 077); 844 do { 845 switch (jjstateSet[--i]) { 846 case 2: 847 if ((jjbitVec0[i2] & l2) != 0L) 848 jjAddStates(5, 6); 849 break; 850 case 5: 851 if ((jjbitVec0[i2] & l2) != 0L) 852 jjAddStates(7, 8); 853 break; 854 case 8: 855 if ((jjbitVec0[i2] & l2) != 0L) 856 jjAddStates(9, 10); 857 break; 858 default: 859 break; 860 } 861 } while (i != startsAt); 862 } 863 if (kind != 0x7fffffff) { 864 jjmatchedKind = kind; 865 jjmatchedPos = curPos; 866 kind = 0x7fffffff; 867 } 868 ++curPos; 869 if ((i = jjnewStateCnt) == (startsAt = 26 - (jjnewStateCnt = startsAt))) 870 return curPos; 871 try { 872 curChar = input_stream.readChar(); 873 } catch (java.io.IOException e) { 874 return curPos; 875 } 876 } 877 } 878 879 static final int[] jjnextStates = { 21, 22, 23, 17, 19, 2, 3, 5, 6, 8, 9, }; 880 881 /** Token literal values. */ 882 public static final String[] jjstrLiteralImages = { "", null, null, null, 883 null, null, null, null, null, null, null, null, null, null, null, 884 null, null, null, null, null, null, null, null, null, null, null, 885 null, null, null, null, null, null, null, null, null, null, null, 886 null, null, null, null, null, null, null, null, null, null, null, 887 null, null, null, null, null, null, }; 888 889 /** Lexer state names. */ 890 public static final String[] lexStateNames = { "DEFAULT", }; 891 static final long[] jjtoToken = { 0x3fffffffffffc9L, }; 892 static final long[] jjtoSkip = { 0x6L, }; 893 protected SimpleCharStream input_stream; 894 private final int[] jjrounds = new int[26]; 895 private final int[] jjstateSet = new int[52]; 896 protected char curChar; 897 898 /** Constructor. */ 899 public PajekParserTokenManager(SimpleCharStream stream) { 900 if (SimpleCharStream.staticFlag) 901 throw new Error( 902 "ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); 903 input_stream = stream; 904 } 905 906 /** Constructor. */ 907 public PajekParserTokenManager(SimpleCharStream stream, int lexState) { 908 this(stream); 909 SwitchTo(lexState); 910 } 911 912 /** Reinitialise parser. */ 913 public void ReInit(SimpleCharStream stream) { 914 jjmatchedPos = jjnewStateCnt = 0; 915 curLexState = defaultLexState; 916 input_stream = stream; 917 ReInitRounds(); 918 } 919 920 private void ReInitRounds() { 921 int i; 922 jjround = 0x80000001; 923 for (i = 26; i-- > 0;) 924 jjrounds[i] = 0x80000000; 925 } 926 927 /** Reinitialise parser. */ 928 public void ReInit(SimpleCharStream stream, int lexState) { 929 ReInit(stream); 930 SwitchTo(lexState); 931 } 932 933 /** Switch to specified lex state. */ 934 public void SwitchTo(int lexState) { 935 if (lexState >= 1 || lexState < 0) 936 throw new TokenMgrError("Error: Ignoring invalid lexical state : " 937 + lexState + ". State unchanged.", 938 TokenMgrError.INVALID_LEXICAL_STATE); 939 else 940 curLexState = lexState; 941 } 942 943 protected Token jjFillToken() { 944 final Token t; 945 final String curTokenImage; 946 final int beginLine; 947 final int endLine; 948 final int beginColumn; 949 final int endColumn; 950 String im = jjstrLiteralImages[jjmatchedKind]; 951 curTokenImage = (im == null) ? input_stream.GetImage() : im; 952 beginLine = input_stream.getBeginLine(); 953 beginColumn = input_stream.getBeginColumn(); 954 endLine = input_stream.getEndLine(); 955 endColumn = input_stream.getEndColumn(); 956 t = Token.newToken(jjmatchedKind, curTokenImage); 957 958 t.beginLine = beginLine; 959 t.endLine = endLine; 960 t.beginColumn = beginColumn; 961 t.endColumn = endColumn; 962 963 return t; 964 } 965 966 int curLexState = 0; 967 int defaultLexState = 0; 968 int jjnewStateCnt; 969 int jjround; 970 int jjmatchedPos; 971 int jjmatchedKind; 972 973 /** Get the next Token. */ 974 public Token getNextToken() { 975 Token matchedToken; 976 int curPos = 0; 977 978 EOFLoop: for (;;) { 979 try { 980 curChar = input_stream.BeginToken(); 981 } catch (java.io.IOException e) { 982 jjmatchedKind = 0; 983 matchedToken = jjFillToken(); 984 return matchedToken; 985 } 986 987 try { 988 input_stream.backup(0); 989 while (curChar <= 32 && (0x100000200L & (1L << curChar)) != 0L) 990 curChar = input_stream.BeginToken(); 991 } catch (java.io.IOException e1) { 992 continue EOFLoop; 993 } 994 jjmatchedKind = 0x7fffffff; 995 jjmatchedPos = 0; 996 curPos = jjMoveStringLiteralDfa0_0(); 997 if (jjmatchedKind != 0x7fffffff) { 998 if (jjmatchedPos + 1 < curPos) 999 input_stream.backup(curPos - jjmatchedPos - 1); 1000 if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { 1001 matchedToken = jjFillToken(); 1002 return matchedToken; 1003 } else { 1004 continue EOFLoop; 1005 } 1006 } 1007 int error_line = input_stream.getEndLine(); 1008 int error_column = input_stream.getEndColumn(); 1009 String error_after = null; 1010 boolean EOFSeen = false; 1011 try { 1012 input_stream.readChar(); 1013 input_stream.backup(1); 1014 } catch (java.io.IOException e1) { 1015 EOFSeen = true; 1016 error_after = curPos <= 1 ? "" : input_stream.GetImage(); 1017 if (curChar == '\n' || curChar == '\r') { 1018 error_line++; 1019 error_column = 0; 1020 } else 1021 error_column++; 1022 } 1023 if (!EOFSeen) { 1024 input_stream.backup(1); 1025 error_after = curPos <= 1 ? "" : input_stream.GetImage(); 1026 } 1027 throw new TokenMgrError(EOFSeen, curLexState, error_line, 1028 error_column, error_after, curChar, 1029 TokenMgrError.LEXICAL_ERROR); 1030 } 1031 } 1032 1033 private void jjCheckNAdd(int state) { 1034 if (jjrounds[state] != jjround) { 1035 jjstateSet[jjnewStateCnt++] = state; 1036 jjrounds[state] = jjround; 1037 } 1038 } 1039 1040 private void jjAddStates(int start, int end) { 1041 do { 1042 jjstateSet[jjnewStateCnt++] = jjnextStates[start]; 1043 } while (start++ != end); 1044 } 1045 1046 private void jjCheckNAddTwoStates(int state1, int state2) { 1047 jjCheckNAdd(state1); 1048 jjCheckNAdd(state2); 1049 } 1050 1051 private void jjCheckNAddStates(int start, int end) { 1052 do { 1053 jjCheckNAdd(jjnextStates[start]); 1054 } while (start++ != end); 1055 } 1056 1057}