001/* JmriServerParser.java */ 002/* Generated By:JJTree&JavaCC: Do not edit this line. JmriServerParser.java */ 003package jmri.jmris.simpleserver.parser; 004 005import org.slf4j.Logger; 006import org.slf4j.LoggerFactory; 007 008/* 009 * This file defines a JavaTree/JavaCC parser implementation for 010 * the JMRI simple interconnection protocol. 011 * 012 * @author Paul Bender Copyright (C) 2015 013 */ 014 015// This is generated code. DO NOT ATTEMPT TO FIX ANY FINDBUGS WARNINGS 016@edu.umd.cs.findbugs.annotations.SuppressFBWarnings({"NM_METHOD_NAMING_CONVENTION", 017 "NM_CONFUSING","RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE","SLF4J_FORMAT_SHOULD_BE_CONST"}) 018 019public class JmriServerParser/*@bgen(jjtree)*/implements JmriServerParserTreeConstants, JmriServerParserConstants {/*@bgen(jjtree)*/ 020 protected JJTJmriServerParserState jjtree = new JJTJmriServerParserState(); 021 private final static Logger log = LoggerFactory.getLogger(JmriServerParser.class); 022 023 /* 024 * The error_skipto method is from the JavaCC error recovery tutorial 025 * https://javacc.org/tutorials/errorrecovery 026 */ 027 private void error_skipto(int kind){ 028 ParseException e = generateParseException(); // generate the exception object. 029 log.error("Recovery after Parse Exception"); 030 log.debug(e.toString()); // print the error message 031 Token t; 032 do { 033 t = getNextToken(); 034 } while (t.kind != kind); 035 // The above loop consumes tokens all the way up to a token of 036 // "kind". We use a do-while loop rather than a while because the 037 // current token is the one immediately before the erroneous token 038 } 039 040// Lexical specifications begin here 041 final public 042SimpleNode command() throws ParseException {/*@bgen(jjtree) command */ 043 ASTcommand jjtn000 = new ASTcommand(JJTCOMMAND); 044 boolean jjtc000 = true; 045 jjtree.openNodeScope(jjtn000); 046 try { 047 try { 048 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 049 case POWER:{ 050 powercmd(); 051 break; 052 } 053 case TURNOUT:{ 054 turnoutcmd(); 055 break; 056 } 057 case REPORTER:{ 058 reportercmd(); 059 break; 060 } 061 case LIGHT:{ 062 lightcmd(); 063 break; 064 } 065 case SENSOR:{ 066 sensorcmd(); 067 break; 068 } 069 case OPERATIONS:{ 070 operationscmd(); 071 break; 072 } 073 default: 074 jj_la1[0] = jj_gen; 075 jj_consume_token(-1); 076 throw new ParseException(); 077 } 078 jj_consume_token(EOL); 079 } catch (TokenMgrError tme) { 080error_skipto(EOL); 081 } catch (ParseException pe) { 082error_skipto(EOL); 083 } 084jjtree.closeNodeScope(jjtn000, true); 085 jjtc000 = false; 086log.debug("Command Production"); 087 {if ("" != null) return jjtn000;} 088 } catch (Throwable jjte000) { 089if (jjtc000) { 090 jjtree.clearNodeScope(jjtn000); 091 jjtc000 = false; 092 } else { 093 jjtree.popNode(); 094 } 095 if (jjte000 instanceof RuntimeException) { 096 {if (true) throw (RuntimeException)jjte000;} 097 } 098 if (jjte000 instanceof ParseException) { 099 {if (true) throw (ParseException)jjte000;} 100 } 101 {if (true) throw (Error)jjte000;} 102 } finally { 103if (jjtc000) { 104 jjtree.closeNodeScope(jjtn000, true); 105 } 106 } 107 throw new Error("Missing return statement in function"); 108} 109 110 final public SimpleNode powercmd() throws ParseException {/*@bgen(jjtree) powercmd */ 111 ASTpowercmd jjtn000 = new ASTpowercmd(JJTPOWERCMD); 112 boolean jjtc000 = true; 113 jjtree.openNodeScope(jjtn000); 114 try { 115 power(); 116 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 117 case ONOFF:{ 118 onoff(); 119 break; 120 } 121 default: 122 jj_la1[1] = jj_gen; 123 ; 124 } 125jjtree.closeNodeScope(jjtn000, true); 126 jjtc000 = false; 127{if ("" != null) return jjtn000;} 128 } catch (Throwable jjte000) { 129if (jjtc000) { 130 jjtree.clearNodeScope(jjtn000); 131 jjtc000 = false; 132 } else { 133 jjtree.popNode(); 134 } 135 if (jjte000 instanceof RuntimeException) { 136 {if (true) throw (RuntimeException)jjte000;} 137 } 138 if (jjte000 instanceof ParseException) { 139 {if (true) throw (ParseException)jjte000;} 140 } 141 {if (true) throw (Error)jjte000;} 142 } finally { 143if (jjtc000) { 144 jjtree.closeNodeScope(jjtn000, true); 145 } 146 } 147 throw new Error("Missing return statement in function"); 148} 149 150 final public SimpleNode power() throws ParseException {/*@bgen(jjtree) power */ 151 ASTpower jjtn000 = new ASTpower(JJTPOWER); 152 boolean jjtc000 = true; 153 jjtree.openNodeScope(jjtn000);Token t; 154 try { 155 t = jj_consume_token(POWER); 156jjtree.closeNodeScope(jjtn000, true); 157 jjtc000 = false; 158jjtn000.jjtSetValue(t.image); 159 {if ("" != null) return jjtn000;} 160 } finally { 161if (jjtc000) { 162 jjtree.closeNodeScope(jjtn000, true); 163 } 164 } 165 throw new Error("Missing return statement in function"); 166} 167 168 final public SimpleNode onoff() throws ParseException {/*@bgen(jjtree) onoff */ 169 ASTonoff jjtn000 = new ASTonoff(JJTONOFF); 170 boolean jjtc000 = true; 171 jjtree.openNodeScope(jjtn000);Token t; 172 try { 173 t = jj_consume_token(ONOFF); 174jjtree.closeNodeScope(jjtn000, true); 175 jjtc000 = false; 176log.debug("OnOff Production " +t.image); 177 jjtn000.jjtSetValue(t.image); 178 {if ("" != null) return jjtn000;} 179 } finally { 180if (jjtc000) { 181 jjtree.closeNodeScope(jjtn000, true); 182 } 183 } 184 throw new Error("Missing return statement in function"); 185} 186 187 final public SimpleNode turnoutcmd() throws ParseException {/*@bgen(jjtree) turnoutcmd */ 188 ASTturnoutcmd jjtn000 = new ASTturnoutcmd(JJTTURNOUTCMD); 189 boolean jjtc000 = true; 190 jjtree.openNodeScope(jjtn000); 191 try { 192 turnout(); 193 turnoutdevice(); 194 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 195 case THROWNCLOSED:{ 196 thrownclosed(); 197 break; 198 } 199 default: 200 jj_la1[2] = jj_gen; 201 ; 202 } 203jjtree.closeNodeScope(jjtn000, true); 204 jjtc000 = false; 205{if ("" != null) return jjtn000;} 206 } catch (Throwable jjte000) { 207if (jjtc000) { 208 jjtree.clearNodeScope(jjtn000); 209 jjtc000 = false; 210 } else { 211 jjtree.popNode(); 212 } 213 if (jjte000 instanceof RuntimeException) { 214 {if (true) throw (RuntimeException)jjte000;} 215 } 216 if (jjte000 instanceof ParseException) { 217 {if (true) throw (ParseException)jjte000;} 218 } 219 {if (true) throw (Error)jjte000;} 220 } finally { 221if (jjtc000) { 222 jjtree.closeNodeScope(jjtn000, true); 223 } 224 } 225 throw new Error("Missing return statement in function"); 226} 227 228 final public SimpleNode turnout() throws ParseException {/*@bgen(jjtree) turnout */ 229 ASTturnout jjtn000 = new ASTturnout(JJTTURNOUT); 230 boolean jjtc000 = true; 231 jjtree.openNodeScope(jjtn000);Token t; 232 try { 233 t = jj_consume_token(TURNOUT); 234jjtree.closeNodeScope(jjtn000, true); 235 jjtc000 = false; 236jjtn000.jjtSetValue(t.image); 237 {if ("" != null) return jjtn000;} 238 } finally { 239if (jjtc000) { 240 jjtree.closeNodeScope(jjtn000, true); 241 } 242 } 243 throw new Error("Missing return statement in function"); 244} 245 246 final public SimpleNode turnoutdevice() throws ParseException {/*@bgen(jjtree) turnoutdevice */ 247 ASTturnoutdevice jjtn000 = new ASTturnoutdevice(JJTTURNOUTDEVICE); 248 boolean jjtc000 = true; 249 jjtree.openNodeScope(jjtn000);Token t; 250 try { 251 t = jj_consume_token(JMRITURNOUT); 252jjtree.closeNodeScope(jjtn000, true); 253 jjtc000 = false; 254log.debug("Turnout device Production " +t.image); 255 jjtn000.jjtSetValue(t.image); 256 {if ("" != null) return jjtn000;} 257 } finally { 258if (jjtc000) { 259 jjtree.closeNodeScope(jjtn000, true); 260 } 261 } 262 throw new Error("Missing return statement in function"); 263} 264 265 final public SimpleNode thrownclosed() throws ParseException {/*@bgen(jjtree) thrownclosed */ 266 ASTthrownclosed jjtn000 = new ASTthrownclosed(JJTTHROWNCLOSED); 267 boolean jjtc000 = true; 268 jjtree.openNodeScope(jjtn000);Token t; 269 try { 270 t = jj_consume_token(THROWNCLOSED); 271jjtree.closeNodeScope(jjtn000, true); 272 jjtc000 = false; 273log.debug("Thrown/Closed Production " +t.image); 274 jjtn000.jjtSetValue(t.image); 275 {if ("" != null) return jjtn000;} 276 } finally { 277if (jjtc000) { 278 jjtree.closeNodeScope(jjtn000, true); 279 } 280 } 281 throw new Error("Missing return statement in function"); 282} 283 284 final public SimpleNode lightcmd() throws ParseException {/*@bgen(jjtree) lightcmd */ 285 ASTlightcmd jjtn000 = new ASTlightcmd(JJTLIGHTCMD); 286 boolean jjtc000 = true; 287 jjtree.openNodeScope(jjtn000); 288 try { 289 light(); 290 lightdevice(); 291 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 292 case ONOFF:{ 293 onoff(); 294 break; 295 } 296 default: 297 jj_la1[3] = jj_gen; 298 ; 299 } 300jjtree.closeNodeScope(jjtn000, true); 301 jjtc000 = false; 302{if ("" != null) return jjtn000;} 303 } catch (Throwable jjte000) { 304if (jjtc000) { 305 jjtree.clearNodeScope(jjtn000); 306 jjtc000 = false; 307 } else { 308 jjtree.popNode(); 309 } 310 if (jjte000 instanceof RuntimeException) { 311 {if (true) throw (RuntimeException)jjte000;} 312 } 313 if (jjte000 instanceof ParseException) { 314 {if (true) throw (ParseException)jjte000;} 315 } 316 {if (true) throw (Error)jjte000;} 317 } finally { 318if (jjtc000) { 319 jjtree.closeNodeScope(jjtn000, true); 320 } 321 } 322 throw new Error("Missing return statement in function"); 323} 324 325 final public SimpleNode light() throws ParseException {/*@bgen(jjtree) light */ 326 ASTlight jjtn000 = new ASTlight(JJTLIGHT); 327 boolean jjtc000 = true; 328 jjtree.openNodeScope(jjtn000);Token t; 329 try { 330 t = jj_consume_token(LIGHT); 331jjtree.closeNodeScope(jjtn000, true); 332 jjtc000 = false; 333jjtn000.jjtSetValue(t.image); 334 {if ("" != null) return jjtn000;} 335 } finally { 336if (jjtc000) { 337 jjtree.closeNodeScope(jjtn000, true); 338 } 339 } 340 throw new Error("Missing return statement in function"); 341} 342 343 final public SimpleNode lightdevice() throws ParseException {/*@bgen(jjtree) lightdevice */ 344 ASTlightdevice jjtn000 = new ASTlightdevice(JJTLIGHTDEVICE); 345 boolean jjtc000 = true; 346 jjtree.openNodeScope(jjtn000);Token t; 347 try { 348 t = jj_consume_token(JMRILIGHT); 349jjtree.closeNodeScope(jjtn000, true); 350 jjtc000 = false; 351log.debug("Light device Production " +t.image); 352 jjtn000.jjtSetValue(t.image); 353 {if ("" != null) return jjtn000;} 354 } finally { 355if (jjtc000) { 356 jjtree.closeNodeScope(jjtn000, true); 357 } 358 } 359 throw new Error("Missing return statement in function"); 360} 361 362 final public SimpleNode reportercmd() throws ParseException {/*@bgen(jjtree) reportercmd */ 363 ASTreportercmd jjtn000 = new ASTreportercmd(JJTREPORTERCMD); 364 boolean jjtc000 = true; 365 jjtree.openNodeScope(jjtn000); 366 try { 367 reporter(); 368 reporterdevice(); 369jjtree.closeNodeScope(jjtn000, true); 370 jjtc000 = false; 371{if ("" != null) return jjtn000;} 372 } catch (Throwable jjte000) { 373if (jjtc000) { 374 jjtree.clearNodeScope(jjtn000); 375 jjtc000 = false; 376 } else { 377 jjtree.popNode(); 378 } 379 if (jjte000 instanceof RuntimeException) { 380 {if (true) throw (RuntimeException)jjte000;} 381 } 382 if (jjte000 instanceof ParseException) { 383 {if (true) throw (ParseException)jjte000;} 384 } 385 {if (true) throw (Error)jjte000;} 386 } finally { 387if (jjtc000) { 388 jjtree.closeNodeScope(jjtn000, true); 389 } 390 } 391 throw new Error("Missing return statement in function"); 392} 393 394 final public SimpleNode reporter() throws ParseException {/*@bgen(jjtree) reporter */ 395 ASTreporter jjtn000 = new ASTreporter(JJTREPORTER); 396 boolean jjtc000 = true; 397 jjtree.openNodeScope(jjtn000);Token t; 398 try { 399 t = jj_consume_token(REPORTER); 400jjtree.closeNodeScope(jjtn000, true); 401 jjtc000 = false; 402jjtn000.jjtSetValue(t.image); 403 {if ("" != null) return jjtn000;} 404 } finally { 405if (jjtc000) { 406 jjtree.closeNodeScope(jjtn000, true); 407 } 408 } 409 throw new Error("Missing return statement in function"); 410} 411 412 final public SimpleNode reporterdevice() throws ParseException {/*@bgen(jjtree) reporterdevice */ 413 ASTreporterdevice jjtn000 = new ASTreporterdevice(JJTREPORTERDEVICE); 414 boolean jjtc000 = true; 415 jjtree.openNodeScope(jjtn000);Token t; 416 try { 417 t = jj_consume_token(JMRIREPORTER); 418jjtree.closeNodeScope(jjtn000, true); 419 jjtc000 = false; 420log.debug("Reporter device Production " +t.image); 421 jjtn000.jjtSetValue(t.image); 422 {if ("" != null) return jjtn000;} 423 } finally { 424if (jjtc000) { 425 jjtree.closeNodeScope(jjtn000, true); 426 } 427 } 428 throw new Error("Missing return statement in function"); 429} 430 431 final public SimpleNode sensorcmd() throws ParseException {/*@bgen(jjtree) sensorcmd */ 432 ASTsensorcmd jjtn000 = new ASTsensorcmd(JJTSENSORCMD); 433 boolean jjtc000 = true; 434 jjtree.openNodeScope(jjtn000); 435 try { 436 sensor(); 437 sensordevice(); 438jjtree.closeNodeScope(jjtn000, true); 439 jjtc000 = false; 440{if ("" != null) return jjtn000;} 441 } catch (Throwable jjte000) { 442if (jjtc000) { 443 jjtree.clearNodeScope(jjtn000); 444 jjtc000 = false; 445 } else { 446 jjtree.popNode(); 447 } 448 if (jjte000 instanceof RuntimeException) { 449 {if (true) throw (RuntimeException)jjte000;} 450 } 451 if (jjte000 instanceof ParseException) { 452 {if (true) throw (ParseException)jjte000;} 453 } 454 {if (true) throw (Error)jjte000;} 455 } finally { 456if (jjtc000) { 457 jjtree.closeNodeScope(jjtn000, true); 458 } 459 } 460 throw new Error("Missing return statement in function"); 461} 462 463 final public SimpleNode sensor() throws ParseException {/*@bgen(jjtree) sensor */ 464 ASTsensor jjtn000 = new ASTsensor(JJTSENSOR); 465 boolean jjtc000 = true; 466 jjtree.openNodeScope(jjtn000);Token t; 467 try { 468 t = jj_consume_token(SENSOR); 469jjtree.closeNodeScope(jjtn000, true); 470 jjtc000 = false; 471jjtn000.jjtSetValue(t.image); 472 {if ("" != null) return jjtn000;} 473 } finally { 474if (jjtc000) { 475 jjtree.closeNodeScope(jjtn000, true); 476 } 477 } 478 throw new Error("Missing return statement in function"); 479} 480 481 final public SimpleNode sensordevice() throws ParseException {/*@bgen(jjtree) sensordevice */ 482 ASTsensordevice jjtn000 = new ASTsensordevice(JJTSENSORDEVICE); 483 boolean jjtc000 = true; 484 jjtree.openNodeScope(jjtn000);Token t; 485 try { 486 t = jj_consume_token(JMRISENSOR); 487jjtree.closeNodeScope(jjtn000, true); 488 jjtc000 = false; 489log.debug("Sensor device Production " +t.image); 490 jjtn000.jjtSetValue(t.image); 491 {if ("" != null) return jjtn000;} 492 } finally { 493if (jjtc000) { 494 jjtree.closeNodeScope(jjtn000, true); 495 } 496 } 497 throw new Error("Missing return statement in function"); 498} 499 500 final public SimpleNode operationscmd() throws ParseException {/*@bgen(jjtree) operationscmd */ 501 ASToperationscmd jjtn000 = new ASToperationscmd(JJTOPERATIONSCMD); 502 boolean jjtc000 = true; 503 jjtree.openNodeScope(jjtn000); 504 try { 505 operations(); 506 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 507 case TRAINS:{ 508 trains(); 509 break; 510 } 511 case LOCATIONS:{ 512 locations(); 513 break; 514 } 515 case TERMINATE:{ 516 terminate(); 517 break; 518 } 519 case TRAIN:{ 520 traincmd(); 521 break; 522 } 523 default: 524 jj_la1[4] = jj_gen; 525 jj_consume_token(-1); 526 throw new ParseException(); 527 } 528jjtree.closeNodeScope(jjtn000, true); 529 jjtc000 = false; 530{if ("" != null) return jjtn000;} 531 } catch (Throwable jjte000) { 532if (jjtc000) { 533 jjtree.clearNodeScope(jjtn000); 534 jjtc000 = false; 535 } else { 536 jjtree.popNode(); 537 } 538 if (jjte000 instanceof RuntimeException) { 539 {if (true) throw (RuntimeException)jjte000;} 540 } 541 if (jjte000 instanceof ParseException) { 542 {if (true) throw (ParseException)jjte000;} 543 } 544 {if (true) throw (Error)jjte000;} 545 } finally { 546if (jjtc000) { 547 jjtree.closeNodeScope(jjtn000, true); 548 } 549 } 550 throw new Error("Missing return statement in function"); 551} 552 553 final public SimpleNode operations() throws ParseException {/*@bgen(jjtree) operations */ 554 ASToperations jjtn000 = new ASToperations(JJTOPERATIONS); 555 boolean jjtc000 = true; 556 jjtree.openNodeScope(jjtn000);Token t; 557 try { 558 t = jj_consume_token(OPERATIONS); 559jjtree.closeNodeScope(jjtn000, true); 560 jjtc000 = false; 561jjtn000.jjtSetValue(t.image); 562 {if ("" != null) return jjtn000;} 563 } finally { 564if (jjtc000) { 565 jjtree.closeNodeScope(jjtn000, true); 566 } 567 } 568 throw new Error("Missing return statement in function"); 569} 570 571 final public SimpleNode trains() throws ParseException {/*@bgen(jjtree) trains */ 572 ASTtrains jjtn000 = new ASTtrains(JJTTRAINS); 573 boolean jjtc000 = true; 574 jjtree.openNodeScope(jjtn000);Token t; 575 try { 576 t = jj_consume_token(TRAINS); 577jjtree.closeNodeScope(jjtn000, true); 578 jjtc000 = false; 579jjtn000.jjtSetValue(t.image); 580 {if ("" != null) return jjtn000;} 581 } finally { 582if (jjtc000) { 583 jjtree.closeNodeScope(jjtn000, true); 584 } 585 } 586 throw new Error("Missing return statement in function"); 587} 588 589 final public SimpleNode locations() throws ParseException {/*@bgen(jjtree) locations */ 590 ASTlocations jjtn000 = new ASTlocations(JJTLOCATIONS); 591 boolean jjtc000 = true; 592 jjtree.openNodeScope(jjtn000);Token t; 593 try { 594 t = jj_consume_token(LOCATIONS); 595jjtree.closeNodeScope(jjtn000, true); 596 jjtc000 = false; 597jjtn000.jjtSetValue(t.image); 598 {if ("" != null) return jjtn000;} 599 } finally { 600if (jjtc000) { 601 jjtree.closeNodeScope(jjtn000, true); 602 } 603 } 604 throw new Error("Missing return statement in function"); 605} 606 607 final public SimpleNode terminate() throws ParseException {/*@bgen(jjtree) terminate */ 608 ASTterminate jjtn000 = new ASTterminate(JJTTERMINATE); 609 boolean jjtc000 = true; 610 jjtree.openNodeScope(jjtn000);Token t; 611 try { 612 t = jj_consume_token(TERMINATE); 613 attributelist(); 614jjtree.closeNodeScope(jjtn000, true); 615 jjtc000 = false; 616jjtn000.jjtSetValue(t.image); 617 {if ("" != null) return jjtn000;} 618 } catch (Throwable jjte000) { 619if (jjtc000) { 620 jjtree.clearNodeScope(jjtn000); 621 jjtc000 = false; 622 } else { 623 jjtree.popNode(); 624 } 625 if (jjte000 instanceof RuntimeException) { 626 {if (true) throw (RuntimeException)jjte000;} 627 } 628 if (jjte000 instanceof ParseException) { 629 {if (true) throw (ParseException)jjte000;} 630 } 631 {if (true) throw (Error)jjte000;} 632 } finally { 633if (jjtc000) { 634 jjtree.closeNodeScope(jjtn000, true); 635 } 636 } 637 throw new Error("Missing return statement in function"); 638} 639 640 final public SimpleNode traincmd() throws ParseException {/*@bgen(jjtree) traincmd */ 641 ASTtraincmd jjtn000 = new ASTtraincmd(JJTTRAINCMD); 642 boolean jjtc000 = true; 643 jjtree.openNodeScope(jjtn000);SimpleNode s; 644 try { 645 jj_consume_token(TRAIN); 646 jj_consume_token(EQUALS); 647 s = value(); 648 jj_consume_token(COMMA); 649 attributename(); 650 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 651 case EQUALS:{ 652 jj_consume_token(EQUALS); 653 value(); 654 break; 655 } 656 default: 657 jj_la1[5] = jj_gen; 658 ; 659 } 660jjtree.closeNodeScope(jjtn000, true); 661 jjtc000 = false; 662jjtn000.jjtSetValue(s.jjtGetValue()); 663 {if ("" != null) return jjtn000;} 664 } catch (Throwable jjte000) { 665if (jjtc000) { 666 jjtree.clearNodeScope(jjtn000); 667 jjtc000 = false; 668 } else { 669 jjtree.popNode(); 670 } 671 if (jjte000 instanceof RuntimeException) { 672 {if (true) throw (RuntimeException)jjte000;} 673 } 674 if (jjte000 instanceof ParseException) { 675 {if (true) throw (ParseException)jjte000;} 676 } 677 {if (true) throw (Error)jjte000;} 678 } finally { 679if (jjtc000) { 680 jjtree.closeNodeScope(jjtn000, true); 681 } 682 } 683 throw new Error("Missing return statement in function"); 684} 685 686 final public SimpleNode attributelist() throws ParseException {/*@bgen(jjtree) attributelist */ 687 ASTattributelist jjtn000 = new ASTattributelist(JJTATTRIBUTELIST); 688 boolean jjtc000 = true; 689 jjtree.openNodeScope(jjtn000);Token t; 690 try { 691 attributename(); 692 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 693 case EQUALS:{ 694 jj_consume_token(EQUALS); 695 value(); 696 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 697 case COMMA:{ 698 jj_consume_token(COMMA); 699 attributelist(); 700 break; 701 } 702 default: 703 jj_la1[6] = jj_gen; 704 ; 705 } 706 break; 707 } 708 default: 709 jj_la1[7] = jj_gen; 710 ; 711 } 712jjtree.closeNodeScope(jjtn000, true); 713 jjtc000 = false; 714{if ("" != null) return jjtn000;} 715 } catch (Throwable jjte000) { 716if (jjtc000) { 717 jjtree.clearNodeScope(jjtn000); 718 jjtc000 = false; 719 } else { 720 jjtree.popNode(); 721 } 722 if (jjte000 instanceof RuntimeException) { 723 {if (true) throw (RuntimeException)jjte000;} 724 } 725 if (jjte000 instanceof ParseException) { 726 {if (true) throw (ParseException)jjte000;} 727 } 728 {if (true) throw (Error)jjte000;} 729 } finally { 730if (jjtc000) { 731 jjtree.closeNodeScope(jjtn000, true); 732 } 733 } 734 throw new Error("Missing return statement in function"); 735} 736 737 final public SimpleNode attributename() throws ParseException {/*@bgen(jjtree) attributename */ 738 ASTattributename jjtn000 = new ASTattributename(JJTATTRIBUTENAME); 739 boolean jjtc000 = true; 740 jjtree.openNodeScope(jjtn000); 741 try { 742 switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { 743 case TRAIN:{ 744 jj_consume_token(TRAIN); 745 break; 746 } 747 case TRAINLENGTH:{ 748 jj_consume_token(TRAINLENGTH); 749 break; 750 } 751 case TRAINWEIGHT:{ 752 jj_consume_token(TRAINWEIGHT); 753 break; 754 } 755 case TRAINCARS:{ 756 jj_consume_token(TRAINCARS); 757 break; 758 } 759 case TRAINLEADLOCO:{ 760 jj_consume_token(TRAINLEADLOCO); 761 break; 762 } 763 case TRAINCABOOSE:{ 764 jj_consume_token(TRAINCABOOSE); 765 break; 766 } 767 case TRAINSTATUS:{ 768 jj_consume_token(TRAINSTATUS); 769 break; 770 } 771 case TRAINLOCATION:{ 772 jj_consume_token(TRAINLOCATION); 773 break; 774 } 775 default: 776 jj_la1[8] = jj_gen; 777 jj_consume_token(-1); 778 throw new ParseException(); 779 } 780jjtree.closeNodeScope(jjtn000, true); 781 jjtc000 = false; 782{if ("" != null) return jjtn000;} 783 } finally { 784if (jjtc000) { 785 jjtree.closeNodeScope(jjtn000, true); 786 } 787 } 788 throw new Error("Missing return statement in function"); 789} 790 791 final public SimpleNode value() throws ParseException {/*@bgen(jjtree) value */ 792 ASTvalue jjtn000 = new ASTvalue(JJTVALUE); 793 boolean jjtc000 = true; 794 jjtree.openNodeScope(jjtn000); 795 try { 796jjtree.closeNodeScope(jjtn000, true); 797 jjtc000 = false; 798{if ("" != null) return jjtn000;} 799 } finally { 800if (jjtc000) { 801 jjtree.closeNodeScope(jjtn000, true); 802 } 803 } 804 throw new Error("Missing return statement in function"); 805} 806 807 /* Generated Token Manager. */ 808 public JmriServerParserTokenManager token_source; 809 SimpleCharStream jj_input_stream; 810 /* Current token. */ 811 public Token token; 812 /* Next token. */ 813 public Token jj_nt; 814 private int jj_ntk; 815 private int jj_gen; 816 final private int[] jj_la1 = new int[9]; 817 static private int[] jj_la1_0; 818 static private int[] jj_la1_1; 819 static private int[] jj_la1_2; 820 static { 821 jj_la1_init_0(); 822 jj_la1_init_1(); 823 jj_la1_init_2(); 824 } 825 private static void jj_la1_init_0() { 826 jj_la1_0 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; 827 } 828 private static void jj_la1_init_1() { 829 jj_la1_1 = new int[] {0x5f00,0x8000,0x40000,0x8000,0xe000000,0x0,0x40,0x0,0xf2000000,}; 830 } 831 private static void jj_la1_init_2() { 832 jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x8,0x10,0x0,0x10,0x7,}; 833 } 834 835 /* Constructor with InputStream. */ 836 public JmriServerParser(java.io.InputStream stream) { 837 this(stream, null); 838 } 839 /* Constructor with InputStream and supplied encoding */ 840 public JmriServerParser(java.io.InputStream stream, String encoding) { 841 try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } 842 token_source = new JmriServerParserTokenManager(jj_input_stream); 843 token = new Token(); 844 jj_ntk = -1; 845 jj_gen = 0; 846 for (int i = 0; i < 9; i++) jj_la1[i] = -1; 847 } 848 849 /* Reinitialise. */ 850 public void ReInit(java.io.InputStream stream) { 851 ReInit(stream, null); 852 } 853 /* Reinitialise. */ 854 public void ReInit(java.io.InputStream stream, String encoding) { 855 try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } 856 token_source.ReInit(jj_input_stream); 857 token = new Token(); 858 jj_ntk = -1; 859 jjtree.reset(); 860 jj_gen = 0; 861 for (int i = 0; i < 9; i++) jj_la1[i] = -1; 862 } 863 864 /* Constructor. */ 865 public JmriServerParser(java.io.Reader stream) { 866 jj_input_stream = new SimpleCharStream(stream, 1, 1); 867 token_source = new JmriServerParserTokenManager(jj_input_stream); 868 token = new Token(); 869 jj_ntk = -1; 870 jj_gen = 0; 871 for (int i = 0; i < 9; i++) jj_la1[i] = -1; 872 } 873 874 /* Reinitialise. */ 875 public void ReInit(java.io.Reader stream) { 876 if (jj_input_stream == null) { 877 jj_input_stream = new SimpleCharStream(stream, 1, 1); 878 } else { 879 jj_input_stream.ReInit(stream, 1, 1); 880 } 881 if (token_source == null) { 882 token_source = new JmriServerParserTokenManager(jj_input_stream); 883 } 884 885 token_source.ReInit(jj_input_stream); 886 token = new Token(); 887 jj_ntk = -1; 888 jjtree.reset(); 889 jj_gen = 0; 890 for (int i = 0; i < 9; i++) jj_la1[i] = -1; 891 } 892 893 /* Constructor with generated Token Manager. */ 894 public JmriServerParser(JmriServerParserTokenManager tm) { 895 token_source = tm; 896 token = new Token(); 897 jj_ntk = -1; 898 jj_gen = 0; 899 for (int i = 0; i < 9; i++) jj_la1[i] = -1; 900 } 901 902 /* Reinitialise. */ 903 public void ReInit(JmriServerParserTokenManager tm) { 904 token_source = tm; 905 token = new Token(); 906 jj_ntk = -1; 907 jjtree.reset(); 908 jj_gen = 0; 909 for (int i = 0; i < 9; i++) jj_la1[i] = -1; 910 } 911 912 private Token jj_consume_token(int kind) throws ParseException { 913 Token oldToken; 914 if ((oldToken = token).next != null) token = token.next; 915 else token = token.next = token_source.getNextToken(); 916 jj_ntk = -1; 917 if (token.kind == kind) { 918 jj_gen++; 919 return token; 920 } 921 token = oldToken; 922 jj_kind = kind; 923 throw generateParseException(); 924 } 925 926 927/* Get the next Token. */ 928 final public Token getNextToken() { 929 if (token.next != null) token = token.next; 930 else token = token.next = token_source.getNextToken(); 931 jj_ntk = -1; 932 jj_gen++; 933 return token; 934 } 935 936/* Get the specific Token. */ 937 final public Token getToken(int index) { 938 Token t = token; 939 for (int i = 0; i < index; i++) { 940 if (t.next != null) t = t.next; 941 else t = t.next = token_source.getNextToken(); 942 } 943 return t; 944 } 945 946 private int jj_ntk_f() { 947 if ((jj_nt=token.next) == null) 948 return (jj_ntk = (token.next=token_source.getNextToken()).kind); 949 else 950 return (jj_ntk = jj_nt.kind); 951 } 952 953 private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>(); 954 private int[] jj_expentry; 955 private int jj_kind = -1; 956 957 /* Generate ParseException. */ 958 public ParseException generateParseException() { 959 jj_expentries.clear(); 960 boolean[] la1tokens = new boolean[69]; 961 if (jj_kind >= 0) { 962 la1tokens[jj_kind] = true; 963 jj_kind = -1; 964 } 965 for (int i = 0; i < 9; i++) { 966 if (jj_la1[i] == jj_gen) { 967 for (int j = 0; j < 32; j++) { 968 if ((jj_la1_0[i] & (1<<j)) != 0) { 969 la1tokens[j] = true; 970 } 971 if ((jj_la1_1[i] & (1<<j)) != 0) { 972 la1tokens[32+j] = true; 973 } 974 if ((jj_la1_2[i] & (1<<j)) != 0) { 975 la1tokens[64+j] = true; 976 } 977 } 978 } 979 } 980 for (int i = 0; i < 69; i++) { 981 if (la1tokens[i]) { 982 jj_expentry = new int[1]; 983 jj_expentry[0] = i; 984 jj_expentries.add(jj_expentry); 985 } 986 } 987 int[][] exptokseq = new int[jj_expentries.size()][]; 988 for (int i = 0; i < jj_expentries.size(); i++) { 989 exptokseq[i] = jj_expentries.get(i); 990 } 991 return new ParseException(token, exptokseq, tokenImage); 992 } 993 994 private int trace_indent = 0; 995 private boolean trace_enabled; 996 997/* Trace enabled. */ 998 final public boolean trace_enabled() { 999 return trace_enabled; 1000 } 1001 1002 /* Enable tracing. */ 1003 final public void enable_tracing() { 1004 } 1005 1006 /* Disable tracing. */ 1007 final public void disable_tracing() { 1008 } 1009 1010 }