001/* SRCPClientParser.java */ 002/* Generated By:JJTree&JavaCC: Do not edit this line. SRCPClientParser.java */ 003package jmri.jmrix.srcp.parser; 004 005import org.slf4j.Logger; 006import org.slf4j.LoggerFactory; 007 008/* 009 * This file defines a JavaTree/JavaCC parser implementation for 010 * the SRCP protocol responses to the client. 011 * 012 * @author Paul Bender Copyright (C) 2011 013 */ 014 015// This is generated code. DO NOT ATTEMPT TO FIX ANY FINDBUGS WARNINGS 016@edu.umd.cs.findbugs.annotations.SuppressFBWarnings({ 017 "NM_METHOD_NAMING_CONVENTION","RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE", 018 "SLF4J_FORMAT_SHOULD_BE_CONST","THROWS_METHOD_THROWS_RUNTIMEEXCEPTION"}) 019 020public class SRCPClientParser/*@bgen(jjtree)*/implements SRCPClientParserTreeConstants, SRCPClientParserConstants {/*@bgen(jjtree)*/ 021 protected JJTSRCPClientParserState jjtree = new JJTSRCPClientParserState(); 022 private final static Logger log = LoggerFactory.getLogger(SRCPClientParser.class.getName()); 023 024// Lexical specifications begin here 025 final public 026SimpleNode handshakeresponse() throws ParseException {/*@bgen(jjtree) handshakeresponse */ 027 ASThandshakeresponse jjtn000 = new ASThandshakeresponse(JJTHANDSHAKERESPONSE); 028 boolean jjtc000 = true; 029 jjtree.openNodeScope(jjtn000); 030 jjtn000.jjtSetFirstToken(getToken(1));SimpleNode s; 031 try { 032 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 033 case KEY:{ 034 label_1: 035 while (true) { 036 s = serviceversion(); 037 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 038 case KEY:{ 039 ; 040 break; 041 } 042 default: 043 jj_la1[0] = jj_gen; 044 break label_1; 045 } 046 } 047 break; 048 } 049 case ZEROADDR: 050 case NONZEROADDR: 051 case TIMESTAMP:{ 052 timestamp(); 053 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 054 case KEY:{ 055 label_2: 056 while (true) { 057 s = serviceversion(); 058 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 059 case KEY:{ 060 ; 061 break; 062 } 063 default: 064 jj_la1[1] = jj_gen; 065 break label_2; 066 } 067 } 068 break; 069 } 070 case ZEROADDR: 071 case NONZEROADDR:{ 072 s = inforesponse(); 073 break; 074 } 075 default: 076 jj_la1[2] = jj_gen; 077 jj_consume_token(-1); 078 throw new ParseException(); 079 } 080 break; 081 } 082 default: 083 jj_la1[3] = jj_gen; 084 jj_consume_token(-1); 085 throw new ParseException(); 086 } 087jjtree.closeNodeScope(jjtn000, true); 088 jjtc000 = false; 089 jjtn000.jjtSetLastToken(getToken(0)); 090jjtn000.jjtSetValue(s.jjtGetValue()); 091 log.debug("Handshake Response Production: "+jjtn000.jjtGetValue()); 092 {if ("" != null) return jjtn000;} 093 } catch (Throwable jjte000) { 094if (jjtc000) { 095 jjtree.clearNodeScope(jjtn000); 096 jjtc000 = false; 097 } else { 098 jjtree.popNode(); 099 } 100 if (jjte000 instanceof RuntimeException) { 101 {if (true) throw (RuntimeException)jjte000;} 102 } 103 if (jjte000 instanceof ParseException) { 104 {if (true) throw (ParseException)jjte000;} 105 } 106 {if (true) throw (Error)jjte000;} 107 } finally { 108if (jjtc000) { 109 jjtree.closeNodeScope(jjtn000, true); 110 jjtn000.jjtSetLastToken(getToken(0)); 111 } 112 } 113 throw new Error("Missing return statement in function"); 114} 115 116 final public SimpleNode timestamp() throws ParseException {/*@bgen(jjtree) timestamp */ 117 ASTtimestamp jjtn000 = new ASTtimestamp(JJTTIMESTAMP); 118 boolean jjtc000 = true; 119 jjtree.openNodeScope(jjtn000); 120 jjtn000.jjtSetFirstToken(getToken(1));Token t; 121 try { 122 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 123 case TIMESTAMP:{ 124 t = jj_consume_token(TIMESTAMP); 125 break; 126 } 127 case NONZEROADDR:{ 128 t = jj_consume_token(NONZEROADDR); 129 break; 130 } 131 case ZEROADDR:{ 132 t = jj_consume_token(ZEROADDR); 133 break; 134 } 135 default: 136 jj_la1[4] = jj_gen; 137 jj_consume_token(-1); 138 throw new ParseException(); 139 } 140jjtree.closeNodeScope(jjtn000, true); 141 jjtc000 = false; 142 jjtn000.jjtSetLastToken(getToken(0)); 143jjtn000.jjtSetValue(t.image); 144 log.debug("Timestamp Production: "+jjtn000.jjtGetValue()); 145 {if ("" != null) return jjtn000;} 146 } finally { 147if (jjtc000) { 148 jjtree.closeNodeScope(jjtn000, true); 149 jjtn000.jjtSetLastToken(getToken(0)); 150 } 151 } 152 throw new Error("Missing return statement in function"); 153} 154 155 final public SimpleNode serviceversion() throws ParseException {/*@bgen(jjtree) serviceversion */ 156 ASTserviceversion jjtn000 = new ASTserviceversion(JJTSERVICEVERSION); 157 boolean jjtc000 = true; 158 jjtree.openNodeScope(jjtn000); 159 jjtn000.jjtSetFirstToken(getToken(1));Token t; Token s; 160 try { 161 t = jj_consume_token(KEY); 162 s = jj_consume_token(ENDVALUE); 163jjtree.closeNodeScope(jjtn000, true); 164 jjtc000 = false; 165 jjtn000.jjtSetLastToken(getToken(0)); 166log.debug("Service Version Production"); 167 jjtn000.jjtSetValue(t.image +" " + s.image); 168 {if ("" != null) return jjtn000;} 169 } finally { 170if (jjtc000) { 171 jjtree.closeNodeScope(jjtn000, true); 172 jjtn000.jjtSetLastToken(getToken(0)); 173 } 174 } 175 throw new Error("Missing return statement in function"); 176} 177 178 final public SimpleNode inforesponse() throws ParseException {/*@bgen(jjtree) inforesponse */ 179 ASTinforesponse jjtn000 = new ASTinforesponse(JJTINFORESPONSE); 180 boolean jjtc000 = true; 181 jjtree.openNodeScope(jjtn000); 182 jjtn000.jjtSetFirstToken(getToken(1));SimpleNode t; SimpleNode s; 183 try { 184 address(); 185 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 186 case INFO:{ 187 s = info(); 188 break; 189 } 190 case OK:{ 191 s = ok(); 192 break; 193 } 194 case ERROR:{ 195 s = error(); 196 break; 197 } 198 default: 199 jj_la1[5] = jj_gen; 200 jj_consume_token(-1); 201 throw new ParseException(); 202 } 203jjtree.closeNodeScope(jjtn000, true); 204 jjtc000 = false; 205 jjtn000.jjtSetLastToken(getToken(0)); 206jjtn000.jjtSetValue(""); 207 log.debug("Information Response Production: " + jjtn000.jjtGetValue() ); 208 {if ("" != null) return jjtn000;} 209 } catch (Throwable jjte000) { 210if (jjtc000) { 211 jjtree.clearNodeScope(jjtn000); 212 jjtc000 = false; 213 } else { 214 jjtree.popNode(); 215 } 216 if (jjte000 instanceof RuntimeException) { 217 {if (true) throw (RuntimeException)jjte000;} 218 } 219 if (jjte000 instanceof ParseException) { 220 {if (true) throw (ParseException)jjte000;} 221 } 222 {if (true) throw (Error)jjte000;} 223 } finally { 224if (jjtc000) { 225 jjtree.closeNodeScope(jjtn000, true); 226 jjtn000.jjtSetLastToken(getToken(0)); 227 } 228 } 229 throw new Error("Missing return statement in function"); 230} 231 232 final public SimpleNode info() throws ParseException {/*@bgen(jjtree) info */ 233 ASTinfo jjtn000 = new ASTinfo(JJTINFO); 234 boolean jjtc000 = true; 235 jjtree.openNodeScope(jjtn000); 236 jjtn000.jjtSetFirstToken(getToken(1));Token t;SimpleNode s; SimpleNode r; 237 try { 238 t = jj_consume_token(INFO); 239 bus(); 240 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 241 case FB:{ 242 fb(); 243 jj_consume_token(EOL); 244 break; 245 } 246 case GA:{ 247 ga(); 248 jj_consume_token(EOL); 249 break; 250 } 251 case GL:{ 252 gl(); 253 jj_consume_token(EOL); 254 break; 255 } 256 case SM:{ 257 sm(); 258 break; 259 } 260 case TIME:{ 261 time(); 262 break; 263 } 264 case POWER:{ 265 power(); 266 break; 267 } 268 case SESSION:{ 269 session(); 270 break; 271 } 272 case SERVER:{ 273 server(); 274 break; 275 } 276 case DESCRIPTION:{ 277 description(); 278 break; 279 } 280 case LOCK:{ 281 lock(); 282 break; 283 } 284 default: 285 jj_la1[6] = jj_gen; 286 jj_consume_token(-1); 287 throw new ParseException(); 288 } 289jjtree.closeNodeScope(jjtn000, true); 290 jjtc000 = false; 291 jjtn000.jjtSetLastToken(getToken(0)); 292jjtn000.jjtSetValue(t.image ); 293 log.debug("Information Response Production: " + jjtn000.jjtGetValue() ); 294 {if ("" != null) return jjtn000;} 295 } catch (Throwable jjte000) { 296if (jjtc000) { 297 jjtree.clearNodeScope(jjtn000); 298 jjtc000 = false; 299 } else { 300 jjtree.popNode(); 301 } 302 if (jjte000 instanceof RuntimeException) { 303 {if (true) throw (RuntimeException)jjte000;} 304 } 305 if (jjte000 instanceof ParseException) { 306 {if (true) throw (ParseException)jjte000;} 307 } 308 {if (true) throw (Error)jjte000;} 309 } finally { 310if (jjtc000) { 311 jjtree.closeNodeScope(jjtn000, true); 312 jjtn000.jjtSetLastToken(getToken(0)); 313 } 314 } 315 throw new Error("Missing return statement in function"); 316} 317 318 final public SimpleNode error() throws ParseException {/*@bgen(jjtree) error */ 319 ASTerror jjtn000 = new ASTerror(JJTERROR); 320 boolean jjtc000 = true; 321 jjtree.openNodeScope(jjtn000); 322 jjtn000.jjtSetFirstToken(getToken(1));Token t;Token r; 323 try { 324 t = jj_consume_token(ERROR); 325 r = jj_consume_token(EOL); 326jjtree.closeNodeScope(jjtn000, true); 327 jjtc000 = false; 328 jjtn000.jjtSetLastToken(getToken(0)); 329jjtn000.jjtSetValue(t.image + r.image); 330 //jjtThis.jjtSetValue(r.image); 331 log.debug("Error Response Production: " + jjtn000.jjtGetValue() ); 332 {if ("" != null) return jjtn000;} 333 } finally { 334if (jjtc000) { 335 jjtree.closeNodeScope(jjtn000, true); 336 jjtn000.jjtSetLastToken(getToken(0)); 337 } 338 } 339 throw new Error("Missing return statement in function"); 340} 341 342 final public SimpleNode ok() throws ParseException {/*@bgen(jjtree) ok */ 343 ASTok jjtn000 = new ASTok(JJTOK); 344 boolean jjtc000 = true; 345 jjtree.openNodeScope(jjtn000); 346 jjtn000.jjtSetFirstToken(getToken(1));Token t;Token r; 347 try { 348 t = jj_consume_token(OK); 349 r = jj_consume_token(EOL); 350jjtree.closeNodeScope(jjtn000, true); 351 jjtc000 = false; 352 jjtn000.jjtSetLastToken(getToken(0)); 353jjtn000.jjtSetValue(t.image + " " + r.image); 354 log.debug("OK Response Production: " + jjtn000.jjtGetValue() ); 355 {if ("" != null) return jjtn000;} 356 } finally { 357if (jjtc000) { 358 jjtree.closeNodeScope(jjtn000, true); 359 jjtn000.jjtSetLastToken(getToken(0)); 360 } 361 } 362 throw new Error("Missing return statement in function"); 363} 364 365 final public SimpleNode commandresponse() throws ParseException {/*@bgen(jjtree) commandresponse */ 366 ASTcommandresponse jjtn000 = new ASTcommandresponse(JJTCOMMANDRESPONSE); 367 boolean jjtc000 = true; 368 jjtree.openNodeScope(jjtn000); 369 jjtn000.jjtSetFirstToken(getToken(1));SimpleNode t; SimpleNode s; 370 try { 371 // this should match any valid response to the client in 372 // either command mode or info mode. 373 t = timestamp(); 374 s = inforesponse(); 375jjtree.closeNodeScope(jjtn000, true); 376 jjtc000 = false; 377 jjtn000.jjtSetLastToken(getToken(0)); 378log.debug("Command Mode Response Production"); 379 jjtn000.jjtSetValue(s.jjtGetValue() ); 380 381 {if ("" != null) return jjtn000;} 382 } catch (Throwable jjte000) { 383if (jjtc000) { 384 jjtree.clearNodeScope(jjtn000); 385 jjtc000 = false; 386 } else { 387 jjtree.popNode(); 388 } 389 if (jjte000 instanceof RuntimeException) { 390 {if (true) throw (RuntimeException)jjte000;} 391 } 392 if (jjte000 instanceof ParseException) { 393 {if (true) throw (ParseException)jjte000;} 394 } 395 {if (true) throw (Error)jjte000;} 396 } finally { 397if (jjtc000) { 398 jjtree.closeNodeScope(jjtn000, true); 399 jjtn000.jjtSetLastToken(getToken(0)); 400 } 401 } 402 throw new Error("Missing return statement in function"); 403} 404 405 final public SimpleNode bus() throws ParseException {/*@bgen(jjtree) bus */ 406 ASTbus jjtn000 = new ASTbus(JJTBUS); 407 boolean jjtc000 = true; 408 jjtree.openNodeScope(jjtn000); 409 jjtn000.jjtSetFirstToken(getToken(1));SimpleNode s; 410 try { 411 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 412 case ZEROADDR:{ 413 s = zeroaddress(); 414 break; 415 } 416 case NONZEROADDR:{ 417 s = nonzeroaddress(); 418 break; 419 } 420 default: 421 jj_la1[7] = jj_gen; 422 jj_consume_token(-1); 423 throw new ParseException(); 424 } 425jjtree.closeNodeScope(jjtn000, true); 426 jjtc000 = false; 427 jjtn000.jjtSetLastToken(getToken(0)); 428log.debug("BUS Production "+ s.jjtGetValue()); 429 jjtn000.jjtSetValue(s.jjtGetValue()); 430 {if ("" != null) return jjtn000;} 431 } catch (Throwable jjte000) { 432if (jjtc000) { 433 jjtree.clearNodeScope(jjtn000); 434 jjtc000 = false; 435 } else { 436 jjtree.popNode(); 437 } 438 if (jjte000 instanceof RuntimeException) { 439 {if (true) throw (RuntimeException)jjte000;} 440 } 441 if (jjte000 instanceof ParseException) { 442 {if (true) throw (ParseException)jjte000;} 443 } 444 {if (true) throw (Error)jjte000;} 445 } finally { 446if (jjtc000) { 447 jjtree.closeNodeScope(jjtn000, true); 448 jjtn000.jjtSetLastToken(getToken(0)); 449 } 450 } 451 throw new Error("Missing return statement in function"); 452} 453 454 final public SimpleNode power() throws ParseException {/*@bgen(jjtree) power */ 455 ASTpower jjtn000 = new ASTpower(JJTPOWER); 456 boolean jjtc000 = true; 457 jjtree.openNodeScope(jjtn000); 458 jjtn000.jjtSetFirstToken(getToken(1));Token t; SimpleNode r; 459 try { 460 t = jj_consume_token(POWER); 461 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 462 case ONOFF:{ 463 r = onoff(); 464 break; 465 } 466 case EOL:{ 467 jj_consume_token(EOL); 468 break; 469 } 470 default: 471 jj_la1[8] = jj_gen; 472 jj_consume_token(-1); 473 throw new ParseException(); 474 } 475jjtree.closeNodeScope(jjtn000, true); 476 jjtc000 = false; 477 jjtn000.jjtSetLastToken(getToken(0)); 478log.debug("POWER Production "+ t.image); 479 //jjtThis.jjtSetValue(t.image + " " + r.jjtGetValue() ); 480 jjtn000.jjtSetValue(t.image ); 481 {if ("" != null) return jjtn000;} 482 } catch (Throwable jjte000) { 483if (jjtc000) { 484 jjtree.clearNodeScope(jjtn000); 485 jjtc000 = false; 486 } else { 487 jjtree.popNode(); 488 } 489 if (jjte000 instanceof RuntimeException) { 490 {if (true) throw (RuntimeException)jjte000;} 491 } 492 if (jjte000 instanceof ParseException) { 493 {if (true) throw (ParseException)jjte000;} 494 } 495 {if (true) throw (Error)jjte000;} 496 } finally { 497if (jjtc000) { 498 jjtree.closeNodeScope(jjtn000, true); 499 jjtn000.jjtSetLastToken(getToken(0)); 500 } 501 } 502 throw new Error("Missing return statement in function"); 503} 504 505 final public void address() throws ParseException {SimpleNode s; 506 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 507 case ZEROADDR:{ 508 s = zeroaddress(); 509 break; 510 } 511 case NONZEROADDR:{ 512 s = nonzeroaddress(); 513 break; 514 } 515 default: 516 jj_la1[9] = jj_gen; 517 jj_consume_token(-1); 518 throw new ParseException(); 519 } 520log.debug("Address Production "+ s.jjtGetValue()); 521 //jjtThis.jjtSetValue(s.jjtGetValue()); 522 //return jjtThis; 523 524} 525 526 final public SimpleNode zeroaddress() throws ParseException {/*@bgen(jjtree) zeroaddress */ 527 ASTzeroaddress jjtn000 = new ASTzeroaddress(JJTZEROADDRESS); 528 boolean jjtc000 = true; 529 jjtree.openNodeScope(jjtn000); 530 jjtn000.jjtSetFirstToken(getToken(1));Token t; 531 try { 532 t = jj_consume_token(ZEROADDR); 533jjtree.closeNodeScope(jjtn000, true); 534 jjtc000 = false; 535 jjtn000.jjtSetLastToken(getToken(0)); 536//Zero Address allows a leading zero 537 log.debug("ZeroAddress Production "+ t.image); 538 jjtn000.jjtSetValue(t.image); 539 {if ("" != null) return jjtn000;} 540 } finally { 541if (jjtc000) { 542 jjtree.closeNodeScope(jjtn000, true); 543 jjtn000.jjtSetLastToken(getToken(0)); 544 } 545 } 546 throw new Error("Missing return statement in function"); 547} 548 549 final public SimpleNode nonzeroaddress() throws ParseException {/*@bgen(jjtree) nonzeroaddress */ 550 ASTnonzeroaddress jjtn000 = new ASTnonzeroaddress(JJTNONZEROADDRESS); 551 boolean jjtc000 = true; 552 jjtree.openNodeScope(jjtn000); 553 jjtn000.jjtSetFirstToken(getToken(1));Token t; 554 try { 555 t = jj_consume_token(NONZEROADDR); 556jjtree.closeNodeScope(jjtn000, true); 557 jjtc000 = false; 558 jjtn000.jjtSetLastToken(getToken(0)); 559//NonZero Address requires a value >=1, without 560 //a leading zero 561 log.debug("NonZeroAddress Production "+ t.image); 562 jjtn000.jjtSetValue(t.image); 563 {if ("" != null) return jjtn000;} 564 } finally { 565if (jjtc000) { 566 jjtree.closeNodeScope(jjtn000, true); 567 jjtn000.jjtSetLastToken(getToken(0)); 568 } 569 } 570 throw new Error("Missing return statement in function"); 571} 572 573 final public SimpleNode port() throws ParseException {/*@bgen(jjtree) port */ 574 ASTport jjtn000 = new ASTport(JJTPORT); 575 boolean jjtc000 = true; 576 jjtree.openNodeScope(jjtn000); 577 jjtn000.jjtSetFirstToken(getToken(1));SimpleNode s; 578 try { 579 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 580 case ZEROADDR:{ 581 s = zeroaddress(); 582 break; 583 } 584 case NONZEROADDR:{ 585 s = nonzeroaddress(); 586 break; 587 } 588 default: 589 jj_la1[10] = jj_gen; 590 jj_consume_token(-1); 591 throw new ParseException(); 592 } 593jjtree.closeNodeScope(jjtn000, true); 594 jjtc000 = false; 595 jjtn000.jjtSetLastToken(getToken(0)); 596log.debug("PORT Production "+ s.jjtGetValue()); 597 jjtn000.jjtSetValue(s.jjtGetValue()); 598 {if ("" != null) return jjtn000;} 599 } catch (Throwable jjte000) { 600if (jjtc000) { 601 jjtree.clearNodeScope(jjtn000); 602 jjtc000 = false; 603 } else { 604 jjtree.popNode(); 605 } 606 if (jjte000 instanceof RuntimeException) { 607 {if (true) throw (RuntimeException)jjte000;} 608 } 609 if (jjte000 instanceof ParseException) { 610 {if (true) throw (ParseException)jjte000;} 611 } 612 {if (true) throw (Error)jjte000;} 613 } finally { 614if (jjtc000) { 615 jjtree.closeNodeScope(jjtn000, true); 616 jjtn000.jjtSetLastToken(getToken(0)); 617 } 618 } 619 throw new Error("Missing return statement in function"); 620} 621 622 final public SimpleNode devicegroup() throws ParseException {/*@bgen(jjtree) devicegroup */ 623 ASTdevicegroup jjtn000 = new ASTdevicegroup(JJTDEVICEGROUP); 624 boolean jjtc000 = true; 625 jjtree.openNodeScope(jjtn000); 626 jjtn000.jjtSetFirstToken(getToken(1));Token t; 627 try { 628 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 629 case FB:{ 630 t = jj_consume_token(FB); 631 break; 632 } 633 case GA:{ 634 t = jj_consume_token(GA); 635 break; 636 } 637 case GL:{ 638 t = jj_consume_token(GL); 639 break; 640 } 641 case SM:{ 642 t = jj_consume_token(SM); 643 break; 644 } 645 case TIME:{ 646 t = jj_consume_token(TIME); 647 break; 648 } 649 case SESSION:{ 650 t = jj_consume_token(SESSION); 651 break; 652 } 653 case SERVER:{ 654 t = jj_consume_token(SERVER); 655 break; 656 } 657 case LOCK:{ 658 t = jj_consume_token(LOCK); 659 break; 660 } 661 case POWER:{ 662 t = jj_consume_token(POWER); 663 break; 664 } 665 case DESCRIPTION:{ 666 t = jj_consume_token(DESCRIPTION); 667 break; 668 } 669 default: 670 jj_la1[11] = jj_gen; 671 jj_consume_token(-1); 672 throw new ParseException(); 673 } 674jjtree.closeNodeScope(jjtn000, true); 675 jjtc000 = false; 676 jjtn000.jjtSetLastToken(getToken(0)); 677log.debug("DeviceGroup Production"); 678 jjtn000.jjtSetValue(t.image); 679 {if ("" != null) return jjtn000;} 680 } finally { 681if (jjtc000) { 682 jjtree.closeNodeScope(jjtn000, true); 683 jjtn000.jjtSetLastToken(getToken(0)); 684 } 685 } 686 throw new Error("Missing return statement in function"); 687} 688 689 final public SimpleNode gl() throws ParseException {/*@bgen(jjtree) gl */ 690 ASTgl jjtn000 = new ASTgl(JJTGL); 691 boolean jjtc000 = true; 692 jjtree.openNodeScope(jjtn000); 693 jjtn000.jjtSetFirstToken(getToken(1));Token t; 694 try { 695 t = jj_consume_token(GL); 696 address(); 697 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 698 case ZEROADDR: 699 case NONZEROADDR: 700 case DRIVEMODE: 701 case PROTOCOL:{ 702 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 703 case ZEROADDR: 704 case NONZEROADDR: 705 case DRIVEMODE:{ 706 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 707 case DRIVEMODE:{ 708 jj_consume_token(DRIVEMODE); 709 break; 710 } 711 case ZEROADDR: 712 case NONZEROADDR:{ 713 address(); 714 break; 715 } 716 default: 717 jj_la1[12] = jj_gen; 718 jj_consume_token(-1); 719 throw new ParseException(); 720 } 721 label_3: 722 while (true) { 723 address(); 724 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 725 case ZEROADDR: 726 case NONZEROADDR:{ 727 ; 728 break; 729 } 730 default: 731 jj_la1[13] = jj_gen; 732 break label_3; 733 } 734 } 735 break; 736 } 737 case PROTOCOL:{ 738 jj_consume_token(PROTOCOL); 739 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 740 case ZEROADDR: 741 case NONZEROADDR:{ 742 address(); 743 address(); 744 break; 745 } 746 default: 747 jj_la1[14] = jj_gen; 748 ; 749 } 750 break; 751 } 752 default: 753 jj_la1[15] = jj_gen; 754 jj_consume_token(-1); 755 throw new ParseException(); 756 } 757 break; 758 } 759 default: 760 jj_la1[16] = jj_gen; 761 ; 762 } 763jjtree.closeNodeScope(jjtn000, true); 764 jjtc000 = false; 765 jjtn000.jjtSetLastToken(getToken(0)); 766jjtn000.jjtSetValue(t.image); 767 {if ("" != null) return jjtn000;} 768 } catch (Throwable jjte000) { 769if (jjtc000) { 770 jjtree.clearNodeScope(jjtn000); 771 jjtc000 = false; 772 } else { 773 jjtree.popNode(); 774 } 775 if (jjte000 instanceof RuntimeException) { 776 {if (true) throw (RuntimeException)jjte000;} 777 } 778 if (jjte000 instanceof ParseException) { 779 {if (true) throw (ParseException)jjte000;} 780 } 781 {if (true) throw (Error)jjte000;} 782 } finally { 783if (jjtc000) { 784 jjtree.closeNodeScope(jjtn000, true); 785 jjtn000.jjtSetLastToken(getToken(0)); 786 } 787 } 788 throw new Error("Missing return statement in function"); 789} 790 791 final public SimpleNode sm() throws ParseException {/*@bgen(jjtree) sm */ 792 ASTsm jjtn000 = new ASTsm(JJTSM); 793 boolean jjtc000 = true; 794 jjtree.openNodeScope(jjtn000); 795 jjtn000.jjtSetFirstToken(getToken(1));Token t; 796 try { 797 t = jj_consume_token(SM); 798jjtree.closeNodeScope(jjtn000, true); 799 jjtc000 = false; 800 jjtn000.jjtSetLastToken(getToken(0)); 801jjtn000.jjtSetValue(t.image); 802 {if ("" != null) return jjtn000;} 803 } finally { 804if (jjtc000) { 805 jjtree.closeNodeScope(jjtn000, true); 806 jjtn000.jjtSetLastToken(getToken(0)); 807 } 808 } 809 throw new Error("Missing return statement in function"); 810} 811 812 final public SimpleNode ga() throws ParseException {/*@bgen(jjtree) ga */ 813 ASTga jjtn000 = new ASTga(JJTGA); 814 boolean jjtc000 = true; 815 jjtree.openNodeScope(jjtn000); 816 jjtn000.jjtSetFirstToken(getToken(1));Token t; 817 try { 818 t = jj_consume_token(GA); 819 address(); 820 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 821 case ZEROADDR: 822 case NONZEROADDR: 823 case PROTOCOL:{ 824 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 825 case PROTOCOL:{ 826 jj_consume_token(PROTOCOL); 827 break; 828 } 829 case ZEROADDR: 830 case NONZEROADDR:{ 831 port(); 832 zeroone(); 833 break; 834 } 835 default: 836 jj_la1[17] = jj_gen; 837 jj_consume_token(-1); 838 throw new ParseException(); 839 } 840 break; 841 } 842 default: 843 jj_la1[18] = jj_gen; 844 ; 845 } 846jjtree.closeNodeScope(jjtn000, true); 847 jjtc000 = false; 848 jjtn000.jjtSetLastToken(getToken(0)); 849jjtn000.jjtSetValue(t.image); 850 {if ("" != null) return jjtn000;} 851 } catch (Throwable jjte000) { 852if (jjtc000) { 853 jjtree.clearNodeScope(jjtn000); 854 jjtc000 = false; 855 } else { 856 jjtree.popNode(); 857 } 858 if (jjte000 instanceof RuntimeException) { 859 {if (true) throw (RuntimeException)jjte000;} 860 } 861 if (jjte000 instanceof ParseException) { 862 {if (true) throw (ParseException)jjte000;} 863 } 864 {if (true) throw (Error)jjte000;} 865 } finally { 866if (jjtc000) { 867 jjtree.closeNodeScope(jjtn000, true); 868 jjtn000.jjtSetLastToken(getToken(0)); 869 } 870 } 871 throw new Error("Missing return statement in function"); 872} 873 874 final public SimpleNode fb() throws ParseException {/*@bgen(jjtree) fb */ 875 ASTfb jjtn000 = new ASTfb(JJTFB); 876 boolean jjtc000 = true; 877 jjtree.openNodeScope(jjtn000); 878 jjtn000.jjtSetFirstToken(getToken(1));Token t; 879 try { 880 t = jj_consume_token(FB); 881 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 882 case ZEROADDR: 883 case NONZEROADDR:{ 884 address(); 885 zeroone(); 886 break; 887 } 888 default: 889 jj_la1[19] = jj_gen; 890 ; 891 } 892jjtree.closeNodeScope(jjtn000, true); 893 jjtc000 = false; 894 jjtn000.jjtSetLastToken(getToken(0)); 895jjtn000.jjtSetValue(t.image); 896 {if ("" != null) return jjtn000;} 897 } catch (Throwable jjte000) { 898if (jjtc000) { 899 jjtree.clearNodeScope(jjtn000); 900 jjtc000 = false; 901 } else { 902 jjtree.popNode(); 903 } 904 if (jjte000 instanceof RuntimeException) { 905 {if (true) throw (RuntimeException)jjte000;} 906 } 907 if (jjte000 instanceof ParseException) { 908 {if (true) throw (ParseException)jjte000;} 909 } 910 {if (true) throw (Error)jjte000;} 911 } finally { 912if (jjtc000) { 913 jjtree.closeNodeScope(jjtn000, true); 914 jjtn000.jjtSetLastToken(getToken(0)); 915 } 916 } 917 throw new Error("Missing return statement in function"); 918} 919 920 final public SimpleNode time() throws ParseException {/*@bgen(jjtree) time */ 921 ASTtime jjtn000 = new ASTtime(JJTTIME); 922 boolean jjtc000 = true; 923 jjtree.openNodeScope(jjtn000); 924 jjtn000.jjtSetFirstToken(getToken(1));Token t; 925 try { 926 t = jj_consume_token(TIME); 927jjtree.closeNodeScope(jjtn000, true); 928 jjtc000 = false; 929 jjtn000.jjtSetLastToken(getToken(0)); 930jjtn000.jjtSetValue(t.image); 931 {if ("" != null) return jjtn000;} 932 } finally { 933if (jjtc000) { 934 jjtree.closeNodeScope(jjtn000, true); 935 jjtn000.jjtSetLastToken(getToken(0)); 936 } 937 } 938 throw new Error("Missing return statement in function"); 939} 940 941 final public SimpleNode server() throws ParseException {/*@bgen(jjtree) server */ 942 ASTserver jjtn000 = new ASTserver(JJTSERVER); 943 boolean jjtc000 = true; 944 jjtree.openNodeScope(jjtn000); 945 jjtn000.jjtSetFirstToken(getToken(1));Token t;Token r; 946 try { 947 t = jj_consume_token(SERVER); 948 r = jj_consume_token(EOL); 949jjtree.closeNodeScope(jjtn000, true); 950 jjtc000 = false; 951 jjtn000.jjtSetLastToken(getToken(0)); 952jjtn000.jjtSetValue(t.image + " " + r.image); 953 {if ("" != null) return jjtn000;} 954 } finally { 955if (jjtc000) { 956 jjtree.closeNodeScope(jjtn000, true); 957 jjtn000.jjtSetLastToken(getToken(0)); 958 } 959 } 960 throw new Error("Missing return statement in function"); 961} 962 963 final public SimpleNode session() throws ParseException {/*@bgen(jjtree) session */ 964 ASTsession jjtn000 = new ASTsession(JJTSESSION); 965 boolean jjtc000 = true; 966 jjtree.openNodeScope(jjtn000); 967 jjtn000.jjtSetFirstToken(getToken(1));Token t; 968 try { 969 t = jj_consume_token(SESSION); 970 address(); 971 jj_consume_token(EOL); 972jjtree.closeNodeScope(jjtn000, true); 973 jjtc000 = false; 974 jjtn000.jjtSetLastToken(getToken(0)); 975jjtn000.jjtSetValue(t.image); 976 {if ("" != null) return jjtn000;} 977 } catch (Throwable jjte000) { 978if (jjtc000) { 979 jjtree.clearNodeScope(jjtn000); 980 jjtc000 = false; 981 } else { 982 jjtree.popNode(); 983 } 984 if (jjte000 instanceof RuntimeException) { 985 {if (true) throw (RuntimeException)jjte000;} 986 } 987 if (jjte000 instanceof ParseException) { 988 {if (true) throw (ParseException)jjte000;} 989 } 990 {if (true) throw (Error)jjte000;} 991 } finally { 992if (jjtc000) { 993 jjtree.closeNodeScope(jjtn000, true); 994 jjtn000.jjtSetLastToken(getToken(0)); 995 } 996 } 997 throw new Error("Missing return statement in function"); 998} 999 1000 final public SimpleNode lock() throws ParseException {/*@bgen(jjtree) lock */ 1001 ASTlock jjtn000 = new ASTlock(JJTLOCK); 1002 boolean jjtc000 = true; 1003 jjtree.openNodeScope(jjtn000); 1004 jjtn000.jjtSetFirstToken(getToken(1));Token t; 1005 try { 1006 t = jj_consume_token(LOCK); 1007 devicegroup(); 1008 label_4: 1009 while (true) { 1010 address(); 1011 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1012 case ZEROADDR: 1013 case NONZEROADDR:{ 1014 ; 1015 break; 1016 } 1017 default: 1018 jj_la1[20] = jj_gen; 1019 break label_4; 1020 } 1021 } 1022 jj_consume_token(EOL); 1023jjtree.closeNodeScope(jjtn000, true); 1024 jjtc000 = false; 1025 jjtn000.jjtSetLastToken(getToken(0)); 1026jjtn000.jjtSetValue(t.image); 1027 {if ("" != null) return jjtn000;} 1028 } catch (Throwable jjte000) { 1029if (jjtc000) { 1030 jjtree.clearNodeScope(jjtn000); 1031 jjtc000 = false; 1032 } else { 1033 jjtree.popNode(); 1034 } 1035 if (jjte000 instanceof RuntimeException) { 1036 {if (true) throw (RuntimeException)jjte000;} 1037 } 1038 if (jjte000 instanceof ParseException) { 1039 {if (true) throw (ParseException)jjte000;} 1040 } 1041 {if (true) throw (Error)jjte000;} 1042 } finally { 1043if (jjtc000) { 1044 jjtree.closeNodeScope(jjtn000, true); 1045 jjtn000.jjtSetLastToken(getToken(0)); 1046 } 1047 } 1048 throw new Error("Missing return statement in function"); 1049} 1050 1051 final public SimpleNode description() throws ParseException {/*@bgen(jjtree) description */ 1052 ASTdescription jjtn000 = new ASTdescription(JJTDESCRIPTION); 1053 boolean jjtc000 = true; 1054 jjtree.openNodeScope(jjtn000); 1055 jjtn000.jjtSetFirstToken(getToken(1));Token t; 1056 try { 1057 t = jj_consume_token(DESCRIPTION); 1058 if (jj_2_1(3)) { 1059 label_5: 1060 while (true) { 1061 devicegroup(); 1062 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1063 case FB: 1064 case GA: 1065 case GL: 1066 case SM: 1067 case LOCK: 1068 case TIME: 1069 case POWER: 1070 case SESSION: 1071 case DESCRIPTION: 1072 case SERVER:{ 1073 ; 1074 break; 1075 } 1076 default: 1077 jj_la1[21] = jj_gen; 1078 break label_5; 1079 } 1080 } 1081 jj_consume_token(EOL); 1082 } else { 1083 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1084 case FB: 1085 case GA: 1086 case GL: 1087 case SM: 1088 case LOCK: 1089 case TIME: 1090 case POWER: 1091 case SESSION: 1092 case SERVER:{ 1093 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1094 case FB:{ 1095 fb(); 1096 jj_consume_token(EOL); 1097 break; 1098 } 1099 case GA:{ 1100 ga(); 1101 jj_consume_token(EOL); 1102 break; 1103 } 1104 case GL:{ 1105 gl(); 1106 jj_consume_token(EOL); 1107 break; 1108 } 1109 case SM:{ 1110 sm(); 1111 break; 1112 } 1113 case TIME:{ 1114 time(); 1115 break; 1116 } 1117 case POWER:{ 1118 power(); 1119 break; 1120 } 1121 case SESSION:{ 1122 session(); 1123 break; 1124 } 1125 case SERVER:{ 1126 server(); 1127 break; 1128 } 1129 case LOCK:{ 1130 lock(); 1131 break; 1132 } 1133 default: 1134 jj_la1[22] = jj_gen; 1135 jj_consume_token(-1); 1136 throw new ParseException(); 1137 } 1138 break; 1139 } 1140 default: 1141 jj_la1[23] = jj_gen; 1142 jj_consume_token(-1); 1143 throw new ParseException(); 1144 } 1145 } 1146jjtree.closeNodeScope(jjtn000, true); 1147 jjtc000 = false; 1148 jjtn000.jjtSetLastToken(getToken(0)); 1149jjtn000.jjtSetValue(t.image); 1150 {if ("" != null) return jjtn000;} 1151 } catch (Throwable jjte000) { 1152if (jjtc000) { 1153 jjtree.clearNodeScope(jjtn000); 1154 jjtc000 = false; 1155 } else { 1156 jjtree.popNode(); 1157 } 1158 if (jjte000 instanceof RuntimeException) { 1159 {if (true) throw (RuntimeException)jjte000;} 1160 } 1161 if (jjte000 instanceof ParseException) { 1162 {if (true) throw (ParseException)jjte000;} 1163 } 1164 {if (true) throw (Error)jjte000;} 1165 } finally { 1166if (jjtc000) { 1167 jjtree.closeNodeScope(jjtn000, true); 1168 jjtn000.jjtSetLastToken(getToken(0)); 1169 } 1170 } 1171 throw new Error("Missing return statement in function"); 1172} 1173 1174 final public SimpleNode onoff() throws ParseException {/*@bgen(jjtree) onoff */ 1175 ASTonoff jjtn000 = new ASTonoff(JJTONOFF); 1176 boolean jjtc000 = true; 1177 jjtree.openNodeScope(jjtn000); 1178 jjtn000.jjtSetFirstToken(getToken(1));Token t; Token r; 1179 try { 1180 t = jj_consume_token(ONOFF); 1181 r = jj_consume_token(EOL); 1182jjtree.closeNodeScope(jjtn000, true); 1183 jjtc000 = false; 1184 jjtn000.jjtSetLastToken(getToken(0)); 1185log.debug("OnOff Production " +t.image + " " + r.image); 1186 jjtn000.jjtSetValue(t.image); 1187 {if ("" != null) return jjtn000;} 1188 } finally { 1189if (jjtc000) { 1190 jjtree.closeNodeScope(jjtn000, true); 1191 jjtn000.jjtSetLastToken(getToken(0)); 1192 } 1193 } 1194 throw new Error("Missing return statement in function"); 1195} 1196 1197 final public void zeroone() throws ParseException {SimpleNode s; 1198 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 1199 case ZEROADDR:{ 1200 s = zeroaddress(); 1201 break; 1202 } 1203 case NONZEROADDR:{ 1204 s = nonzeroaddress(); 1205 break; 1206 } 1207 default: 1208 jj_la1[24] = jj_gen; 1209 jj_consume_token(-1); 1210 throw new ParseException(); 1211 } 1212log.debug("ZeroOne Production "); 1213 //return jjtThis; 1214 1215} 1216 1217 private boolean jj_2_1(int xla) 1218 { 1219 jj_la = xla; jj_lastpos = jj_scanpos = token; 1220 try { return (!jj_3_1()); } 1221 catch(LookaheadSuccess ls) { return true; } 1222 finally { jj_save(0, xla); } 1223 } 1224 1225 private boolean jj_3R_6() 1226 { 1227 if (jj_3R_7()) return true; 1228 return false; 1229 } 1230 1231 private boolean jj_3R_7() 1232 { 1233 Token xsp; 1234 xsp = jj_scanpos; 1235 if (jj_scan_token(18)) { 1236 jj_scanpos = xsp; 1237 if (jj_scan_token(19)) { 1238 jj_scanpos = xsp; 1239 if (jj_scan_token(20)) { 1240 jj_scanpos = xsp; 1241 if (jj_scan_token(22)) { 1242 jj_scanpos = xsp; 1243 if (jj_scan_token(24)) { 1244 jj_scanpos = xsp; 1245 if (jj_scan_token(26)) { 1246 jj_scanpos = xsp; 1247 if (jj_scan_token(28)) { 1248 jj_scanpos = xsp; 1249 if (jj_scan_token(23)) { 1250 jj_scanpos = xsp; 1251 if (jj_scan_token(25)) { 1252 jj_scanpos = xsp; 1253 if (jj_scan_token(27)) return true; 1254 } 1255 } 1256 } 1257 } 1258 } 1259 } 1260 } 1261 } 1262 } 1263 return false; 1264 } 1265 1266 private boolean jj_3_1() 1267 { 1268 Token xsp; 1269 if (jj_3R_6()) return true; 1270 while (true) { 1271 xsp = jj_scanpos; 1272 if (jj_3R_6()) { jj_scanpos = xsp; break; } 1273 } 1274 if (jj_scan_token(EOL)) return true; 1275 return false; 1276 } 1277 1278 /* Generated Token Manager. */ 1279 public SRCPClientParserTokenManager token_source; 1280 SimpleCharStream jj_input_stream; 1281 /* Current token. */ 1282 public Token token; 1283 /* Next token. */ 1284 public Token jj_nt; 1285 private int jj_ntk; 1286 private Token jj_scanpos, jj_lastpos; 1287 private int jj_la; 1288 private int jj_gen; 1289 final private int[] jj_la1 = new int[25]; 1290 static private int[] jj_la1_0; 1291 static private int[] jj_la1_1; 1292 static { 1293 jj_la1_init_0(); 1294 jj_la1_init_1(); 1295 } 1296 private static void jj_la1_init_0() { 1297 jj_la1_0 = new int[] {0x0,0x0,0x180,0x2180,0x2180,0xe0000000,0x1fdc0000,0x180,0x4004,0x180,0x180,0x1fdc0000,0x380,0x180,0x180,0x20380,0x20380,0x20180,0x20180,0x180,0x180,0x1fdc0000,0x17dc0000,0x17dc0000,0x180,}; 1298 } 1299 private static void jj_la1_init_1() { 1300 jj_la1_1 = new int[] {0x10,0x10,0x10,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; 1301 } 1302 final private JJCalls[] jj_2_rtns = new JJCalls[1]; 1303 private boolean jj_rescan = false; 1304 private int jj_gc = 0; 1305 1306 /* Constructor with InputStream. */ 1307 public SRCPClientParser(java.io.InputStream stream) { 1308 this(stream, null); 1309 } 1310 /* Constructor with InputStream and supplied encoding */ 1311 public SRCPClientParser(java.io.InputStream stream, String encoding) { 1312 try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } 1313 token_source = new SRCPClientParserTokenManager(jj_input_stream); 1314 token = new Token(); 1315 jj_ntk = -1; 1316 jj_gen = 0; 1317 for (int i = 0; i < 25; i++) jj_la1[i] = -1; 1318 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1319 } 1320 1321 /* Reinitialise. */ 1322 public void ReInit(java.io.InputStream stream) { 1323 ReInit(stream, null); 1324 } 1325 /* Reinitialise. */ 1326 public void ReInit(java.io.InputStream stream, String encoding) { 1327 try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } 1328 token_source.ReInit(jj_input_stream); 1329 token = new Token(); 1330 jj_ntk = -1; 1331 jjtree.reset(); 1332 jj_gen = 0; 1333 for (int i = 0; i < 25; i++) jj_la1[i] = -1; 1334 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1335 } 1336 1337 /* Constructor. */ 1338 public SRCPClientParser(java.io.Reader stream) { 1339 jj_input_stream = new SimpleCharStream(stream, 1, 1); 1340 token_source = new SRCPClientParserTokenManager(jj_input_stream); 1341 token = new Token(); 1342 jj_ntk = -1; 1343 jj_gen = 0; 1344 for (int i = 0; i < 25; i++) jj_la1[i] = -1; 1345 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1346 } 1347 1348 /* Reinitialise. */ 1349 public void ReInit(java.io.Reader stream) { 1350 if (jj_input_stream == null) { 1351 jj_input_stream = new SimpleCharStream(stream, 1, 1); 1352 } else { 1353 jj_input_stream.ReInit(stream, 1, 1); 1354 } 1355 if (token_source == null) { 1356 token_source = new SRCPClientParserTokenManager(jj_input_stream); 1357 } 1358 1359 token_source.ReInit(jj_input_stream); 1360 token = new Token(); 1361 jj_ntk = -1; 1362 jjtree.reset(); 1363 jj_gen = 0; 1364 for (int i = 0; i < 25; i++) jj_la1[i] = -1; 1365 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1366 } 1367 1368 /* Constructor with generated Token Manager. */ 1369 public SRCPClientParser(SRCPClientParserTokenManager tm) { 1370 token_source = tm; 1371 token = new Token(); 1372 jj_ntk = -1; 1373 jj_gen = 0; 1374 for (int i = 0; i < 25; i++) jj_la1[i] = -1; 1375 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1376 } 1377 1378 /* Reinitialise. */ 1379 public void ReInit(SRCPClientParserTokenManager tm) { 1380 token_source = tm; 1381 token = new Token(); 1382 jj_ntk = -1; 1383 jjtree.reset(); 1384 jj_gen = 0; 1385 for (int i = 0; i < 25; i++) jj_la1[i] = -1; 1386 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1387 } 1388 1389 private Token jj_consume_token(int kind) throws ParseException { 1390 Token oldToken; 1391 if ((oldToken = token).next != null) token = token.next; 1392 else token = token.next = token_source.getNextToken(); 1393 jj_ntk = -1; 1394 if (token.kind == kind) { 1395 jj_gen++; 1396 if (++jj_gc > 100) { 1397 jj_gc = 0; 1398 for (int i = 0; i < jj_2_rtns.length; i++) { 1399 JJCalls c = jj_2_rtns[i]; 1400 while (c != null) { 1401 if (c.gen < jj_gen) c.first = null; 1402 c = c.next; 1403 } 1404 } 1405 } 1406 return token; 1407 } 1408 token = oldToken; 1409 jj_kind = kind; 1410 throw generateParseException(); 1411 } 1412 1413 @SuppressWarnings("serial") 1414 static private final class LookaheadSuccess extends java.lang.Error { } 1415 final private LookaheadSuccess jj_ls = new LookaheadSuccess(); 1416 private boolean jj_scan_token(int kind) { 1417 if (jj_scanpos == jj_lastpos) { 1418 jj_la--; 1419 if (jj_scanpos.next == null) { 1420 jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); 1421 } else { 1422 jj_lastpos = jj_scanpos = jj_scanpos.next; 1423 } 1424 } else { 1425 jj_scanpos = jj_scanpos.next; 1426 } 1427 if (jj_rescan) { 1428 int i = 0; Token tok = token; 1429 while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } 1430 if (tok != null) jj_add_error_token(kind, i); 1431 } 1432 if (jj_scanpos.kind != kind) return true; 1433 if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; 1434 return false; 1435 } 1436 1437 1438/* Get the next Token. */ 1439 final public Token getNextToken() { 1440 if (token.next != null) token = token.next; 1441 else token = token.next = token_source.getNextToken(); 1442 jj_ntk = -1; 1443 jj_gen++; 1444 return token; 1445 } 1446 1447/* Get the specific Token. */ 1448 final public Token getToken(int index) { 1449 Token t = token; 1450 for (int i = 0; i < index; i++) { 1451 if (t.next != null) t = t.next; 1452 else t = t.next = token_source.getNextToken(); 1453 } 1454 return t; 1455 } 1456 1457 private int jj_ntk_f() { 1458 if ((jj_nt=token.next) == null) 1459 return (jj_ntk = (token.next=token_source.getNextToken()).kind); 1460 else 1461 return (jj_ntk = jj_nt.kind); 1462 } 1463 1464 private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>(); 1465 private int[] jj_expentry; 1466 private int jj_kind = -1; 1467 private int[] jj_lasttokens = new int[100]; 1468 private int jj_endpos; 1469 1470 private void jj_add_error_token(int kind, int pos) { 1471 if (pos >= 100) { 1472 return; 1473 } 1474 1475 if (pos == jj_endpos + 1) { 1476 jj_lasttokens[jj_endpos++] = kind; 1477 } else if (jj_endpos != 0) { 1478 jj_expentry = new int[jj_endpos]; 1479 1480 for (int i = 0; i < jj_endpos; i++) { 1481 jj_expentry[i] = jj_lasttokens[i]; 1482 } 1483 1484 for (int[] oldentry : jj_expentries) { 1485 if (oldentry.length == jj_expentry.length) { 1486 boolean isMatched = true; 1487 1488 for (int i = 0; i < jj_expentry.length; i++) { 1489 if (oldentry[i] != jj_expentry[i]) { 1490 isMatched = false; 1491 break; 1492 } 1493 1494 } 1495 if (isMatched) { 1496 jj_expentries.add(jj_expentry); 1497 break; 1498 } 1499 } 1500 } 1501 1502 if (pos != 0) { 1503 jj_lasttokens[(jj_endpos = pos) - 1] = kind; 1504 } 1505 } 1506 } 1507 1508 /* Generate ParseException. */ 1509 public ParseException generateParseException() { 1510 jj_expentries.clear(); 1511 boolean[] la1tokens = new boolean[63]; 1512 if (jj_kind >= 0) { 1513 la1tokens[jj_kind] = true; 1514 jj_kind = -1; 1515 } 1516 for (int i = 0; i < 25; i++) { 1517 if (jj_la1[i] == jj_gen) { 1518 for (int j = 0; j < 32; j++) { 1519 if ((jj_la1_0[i] & (1<<j)) != 0) { 1520 la1tokens[j] = true; 1521 } 1522 if ((jj_la1_1[i] & (1<<j)) != 0) { 1523 la1tokens[32+j] = true; 1524 } 1525 } 1526 } 1527 } 1528 for (int i = 0; i < 63; i++) { 1529 if (la1tokens[i]) { 1530 jj_expentry = new int[1]; 1531 jj_expentry[0] = i; 1532 jj_expentries.add(jj_expentry); 1533 } 1534 } 1535 jj_endpos = 0; 1536 jj_rescan_token(); 1537 jj_add_error_token(0, 0); 1538 int[][] exptokseq = new int[jj_expentries.size()][]; 1539 for (int i = 0; i < jj_expentries.size(); i++) { 1540 exptokseq[i] = jj_expentries.get(i); 1541 } 1542 return new ParseException(token, exptokseq, tokenImage); 1543 } 1544 1545 private int trace_indent = 0; 1546 private boolean trace_enabled; 1547 1548/* Trace enabled. */ 1549 final public boolean trace_enabled() { 1550 return trace_enabled; 1551 } 1552 1553 /* Enable tracing. */ 1554 final public void enable_tracing() { 1555 } 1556 1557 /* Disable tracing. */ 1558 final public void disable_tracing() { 1559 } 1560 1561 private void jj_rescan_token() { 1562 jj_rescan = true; 1563 for (int i = 0; i < 1; i++) { 1564 try { 1565 JJCalls p = jj_2_rtns[i]; 1566 1567 do { 1568 if (p.gen > jj_gen) { 1569 jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; 1570 switch (i) { 1571 case 0: jj_3_1(); break; 1572 } 1573 } 1574 p = p.next; 1575 } while (p != null); 1576 1577 } catch(LookaheadSuccess ls) { } 1578 } 1579 jj_rescan = false; 1580 } 1581 1582 private void jj_save(int index, int xla) { 1583 JJCalls p = jj_2_rtns[index]; 1584 while (p.gen > jj_gen) { 1585 if (p.next == null) { p = p.next = new JJCalls(); break; } 1586 p = p.next; 1587 } 1588 1589 p.gen = jj_gen + xla - jj_la; 1590 p.first = token; 1591 p.arg = xla; 1592 } 1593 1594 static final class JJCalls { 1595 int gen; 1596 Token first; 1597 int arg; 1598 JJCalls next; 1599 } 1600 1601 }