1 2 20 21 22 package org.apache.cayenne.exp.parser; 23 24 import java.io.*; 25 import java.util.*; 26 import java.math.*; 27 import org.apache.cayenne.exp.*; 28 29 34 public class ExpressionParserimplements ExpressionParserTreeConstants, ExpressionParserConstants { 35 protected JJTExpressionParserState jjtree = new JJTExpressionParserState();public static void main(String [] arg) { 36 Expression.fromString(arg[0]); 39 40 long start = System.currentTimeMillis(); 41 Expression exp = Expression.fromString(arg[0]); 42 long end = System.currentTimeMillis(); 43 44 System.out.println(exp); 45 System.out.println("Parsed in " + (end - start) + " ms."); 46 } 47 48 final public Expression expression() throws ParseException { 49 orCondition(); 50 jj_consume_token(0); 51 {if (true) return (Expression) jjtree.rootNode();} 52 throw new Error ("Missing return statement in function"); 53 } 54 55 final public void orCondition() throws ParseException { 56 andCondition(); 57 label_1: 58 while (true) { 59 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 60 case 1: 61 ; 62 break; 63 default: 64 jj_la1[0] = jj_gen; 65 break label_1; 66 } 67 jj_consume_token(1); 68 ASTOr jjtn001 = new ASTOr(JJTOR); 69 boolean jjtc001 = true; 70 jjtree.openNodeScope(jjtn001); 71 try { 72 andCondition(); 73 } catch (Throwable jjte001) { 74 if (jjtc001) { 75 jjtree.clearNodeScope(jjtn001); 76 jjtc001 = false; 77 } else { 78 jjtree.popNode(); 79 } 80 if (jjte001 instanceof RuntimeException ) { 81 {if (true) throw (RuntimeException )jjte001;} 82 } 83 if (jjte001 instanceof ParseException) { 84 {if (true) throw (ParseException)jjte001;} 85 } 86 {if (true) throw (Error )jjte001;} 87 } finally { 88 if (jjtc001) { 89 jjtree.closeNodeScope(jjtn001, 2); 90 } 91 } 92 } 93 } 94 95 final public void andCondition() throws ParseException { 96 notCondition(); 97 label_2: 98 while (true) { 99 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 100 case 2: 101 ; 102 break; 103 default: 104 jj_la1[1] = jj_gen; 105 break label_2; 106 } 107 jj_consume_token(2); 108 ASTAnd jjtn001 = new ASTAnd(JJTAND); 109 boolean jjtc001 = true; 110 jjtree.openNodeScope(jjtn001); 111 try { 112 notCondition(); 113 } catch (Throwable jjte001) { 114 if (jjtc001) { 115 jjtree.clearNodeScope(jjtn001); 116 jjtc001 = false; 117 } else { 118 jjtree.popNode(); 119 } 120 if (jjte001 instanceof RuntimeException ) { 121 {if (true) throw (RuntimeException )jjte001;} 122 } 123 if (jjte001 instanceof ParseException) { 124 {if (true) throw (ParseException)jjte001;} 125 } 126 {if (true) throw (Error )jjte001;} 127 } finally { 128 if (jjtc001) { 129 jjtree.closeNodeScope(jjtn001, 2); 130 } 131 } 132 } 133 } 134 135 final public void notCondition() throws ParseException { 136 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 137 case 3: 138 case 4: 139 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 140 case 3: 141 jj_consume_token(3); 142 break; 143 case 4: 144 jj_consume_token(4); 145 break; 146 default: 147 jj_la1[2] = jj_gen; 148 jj_consume_token(-1); 149 throw new ParseException(); 150 } 151 ASTNot jjtn001 = new ASTNot(JJTNOT); 152 boolean jjtc001 = true; 153 jjtree.openNodeScope(jjtn001); 154 try { 155 simpleCondition(); 156 } catch (Throwable jjte001) { 157 if (jjtc001) { 158 jjtree.clearNodeScope(jjtn001); 159 jjtc001 = false; 160 } else { 161 jjtree.popNode(); 162 } 163 if (jjte001 instanceof RuntimeException ) { 164 {if (true) throw (RuntimeException )jjte001;} 165 } 166 if (jjte001 instanceof ParseException) { 167 {if (true) throw (ParseException)jjte001;} 168 } 169 {if (true) throw (Error )jjte001;} 170 } finally { 171 if (jjtc001) { 172 jjtree.closeNodeScope(jjtn001, 1); 173 } 174 } 175 break; 176 case 16: 177 case 20: 178 case 21: 179 case 24: 180 case 25: 181 case 26: 182 case NULL: 183 case TRUE: 184 case FALSE: 185 case PROPERTY_PATH: 186 case SINGLE_QUOTED_STRING: 187 case DOUBLE_QUOTED_STRING: 188 case INT_LITERAL: 189 case FLOAT_LITERAL: 190 simpleCondition(); 191 break; 192 default: 193 jj_la1[3] = jj_gen; 194 jj_consume_token(-1); 195 throw new ParseException(); 196 } 197 } 198 199 final public void simpleCondition() throws ParseException { 200 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 201 case TRUE: 202 ASTTrue jjtn001 = new ASTTrue(JJTTRUE); 203 boolean jjtc001 = true; 204 jjtree.openNodeScope(jjtn001); 205 try { 206 jj_consume_token(TRUE); 207 } finally { 208 if (jjtc001) { 209 jjtree.closeNodeScope(jjtn001, true); 210 } 211 } 212 break; 213 case FALSE: 214 ASTFalse jjtn002 = new ASTFalse(JJTFALSE); 215 boolean jjtc002 = true; 216 jjtree.openNodeScope(jjtn002); 217 try { 218 jj_consume_token(FALSE); 219 } finally { 220 if (jjtc002) { 221 jjtree.closeNodeScope(jjtn002, true); 222 } 223 } 224 break; 225 case 16: 226 case 20: 227 case 21: 228 case 24: 229 case 25: 230 case 26: 231 case NULL: 232 case PROPERTY_PATH: 233 case SINGLE_QUOTED_STRING: 234 case DOUBLE_QUOTED_STRING: 235 case INT_LITERAL: 236 case FLOAT_LITERAL: 237 scalarExpression(); 238 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 239 case 3: 240 case 4: 241 case 5: 242 case 6: 243 case 7: 244 case 8: 245 case 9: 246 case 10: 247 case 11: 248 case 12: 249 case 13: 250 case 14: 251 case 15: 252 case 18: 253 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 254 case 3: 255 case 4: 256 simpleNotCondition(); 257 break; 258 case 5: 259 case 6: 260 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 261 case 5: 262 jj_consume_token(5); 263 break; 264 case 6: 265 jj_consume_token(6); 266 break; 267 default: 268 jj_la1[4] = jj_gen; 269 jj_consume_token(-1); 270 throw new ParseException(); 271 } 272 ASTEqual jjtn003 = new ASTEqual(JJTEQUAL); 273 boolean jjtc003 = true; 274 jjtree.openNodeScope(jjtn003); 275 try { 276 scalarExpression(); 277 } catch (Throwable jjte003) { 278 if (jjtc003) { 279 jjtree.clearNodeScope(jjtn003); 280 jjtc003 = false; 281 } else { 282 jjtree.popNode(); 283 } 284 if (jjte003 instanceof RuntimeException ) { 285 {if (true) throw (RuntimeException )jjte003;} 286 } 287 if (jjte003 instanceof ParseException) { 288 {if (true) throw (ParseException)jjte003;} 289 } 290 {if (true) throw (Error )jjte003;} 291 } finally { 292 if (jjtc003) { 293 jjtree.closeNodeScope(jjtn003, 2); 294 } 295 } 296 break; 297 case 7: 298 case 8: 299 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 300 case 7: 301 jj_consume_token(7); 302 break; 303 case 8: 304 jj_consume_token(8); 305 break; 306 default: 307 jj_la1[5] = jj_gen; 308 jj_consume_token(-1); 309 throw new ParseException(); 310 } 311 ASTNotEqual jjtn004 = new ASTNotEqual(JJTNOTEQUAL); 312 boolean jjtc004 = true; 313 jjtree.openNodeScope(jjtn004); 314 try { 315 scalarExpression(); 316 } catch (Throwable jjte004) { 317 if (jjtc004) { 318 jjtree.clearNodeScope(jjtn004); 319 jjtc004 = false; 320 } else { 321 jjtree.popNode(); 322 } 323 if (jjte004 instanceof RuntimeException ) { 324 {if (true) throw (RuntimeException )jjte004;} 325 } 326 if (jjte004 instanceof ParseException) { 327 {if (true) throw (ParseException)jjte004;} 328 } 329 {if (true) throw (Error )jjte004;} 330 } finally { 331 if (jjtc004) { 332 jjtree.closeNodeScope(jjtn004, 2); 333 } 334 } 335 break; 336 case 9: 337 jj_consume_token(9); 338 ASTLessOrEqual jjtn005 = new ASTLessOrEqual(JJTLESSOREQUAL); 339 boolean jjtc005 = true; 340 jjtree.openNodeScope(jjtn005); 341 try { 342 scalarExpression(); 343 } catch (Throwable jjte005) { 344 if (jjtc005) { 345 jjtree.clearNodeScope(jjtn005); 346 jjtc005 = false; 347 } else { 348 jjtree.popNode(); 349 } 350 if (jjte005 instanceof RuntimeException ) { 351 {if (true) throw (RuntimeException )jjte005;} 352 } 353 if (jjte005 instanceof ParseException) { 354 {if (true) throw (ParseException)jjte005;} 355 } 356 {if (true) throw (Error )jjte005;} 357 } finally { 358 if (jjtc005) { 359 jjtree.closeNodeScope(jjtn005, 2); 360 } 361 } 362 break; 363 case 10: 364 jj_consume_token(10); 365 ASTLess jjtn006 = new ASTLess(JJTLESS); 366 boolean jjtc006 = true; 367 jjtree.openNodeScope(jjtn006); 368 try { 369 scalarExpression(); 370 } catch (Throwable jjte006) { 371 if (jjtc006) { 372 jjtree.clearNodeScope(jjtn006); 373 jjtc006 = false; 374 } else { 375 jjtree.popNode(); 376 } 377 if (jjte006 instanceof RuntimeException ) { 378 {if (true) throw (RuntimeException )jjte006;} 379 } 380 if (jjte006 instanceof ParseException) { 381 {if (true) throw (ParseException)jjte006;} 382 } 383 {if (true) throw (Error )jjte006;} 384 } finally { 385 if (jjtc006) { 386 jjtree.closeNodeScope(jjtn006, 2); 387 } 388 } 389 break; 390 case 11: 391 jj_consume_token(11); 392 ASTGreater jjtn007 = new ASTGreater(JJTGREATER); 393 boolean jjtc007 = true; 394 jjtree.openNodeScope(jjtn007); 395 try { 396 scalarExpression(); 397 } catch (Throwable jjte007) { 398 if (jjtc007) { 399 jjtree.clearNodeScope(jjtn007); 400 jjtc007 = false; 401 } else { 402 jjtree.popNode(); 403 } 404 if (jjte007 instanceof RuntimeException ) { 405 {if (true) throw (RuntimeException )jjte007;} 406 } 407 if (jjte007 instanceof ParseException) { 408 {if (true) throw (ParseException)jjte007;} 409 } 410 {if (true) throw (Error )jjte007;} 411 } finally { 412 if (jjtc007) { 413 jjtree.closeNodeScope(jjtn007, 2); 414 } 415 } 416 break; 417 case 12: 418 jj_consume_token(12); 419 ASTGreaterOrEqual jjtn008 = new ASTGreaterOrEqual(JJTGREATEROREQUAL); 420 boolean jjtc008 = true; 421 jjtree.openNodeScope(jjtn008); 422 try { 423 scalarExpression(); 424 } catch (Throwable jjte008) { 425 if (jjtc008) { 426 jjtree.clearNodeScope(jjtn008); 427 jjtc008 = false; 428 } else { 429 jjtree.popNode(); 430 } 431 if (jjte008 instanceof RuntimeException ) { 432 {if (true) throw (RuntimeException )jjte008;} 433 } 434 if (jjte008 instanceof ParseException) { 435 {if (true) throw (ParseException)jjte008;} 436 } 437 {if (true) throw (Error )jjte008;} 438 } finally { 439 if (jjtc008) { 440 jjtree.closeNodeScope(jjtn008, 2); 441 } 442 } 443 break; 444 case 13: 445 jj_consume_token(13); 446 ASTLike jjtn009 = new ASTLike(JJTLIKE); 447 boolean jjtc009 = true; 448 jjtree.openNodeScope(jjtn009); 449 try { 450 scalarExpression(); 451 } catch (Throwable jjte009) { 452 if (jjtc009) { 453 jjtree.clearNodeScope(jjtn009); 454 jjtc009 = false; 455 } else { 456 jjtree.popNode(); 457 } 458 if (jjte009 instanceof RuntimeException ) { 459 {if (true) throw (RuntimeException )jjte009;} 460 } 461 if (jjte009 instanceof ParseException) { 462 {if (true) throw (ParseException)jjte009;} 463 } 464 {if (true) throw (Error )jjte009;} 465 } finally { 466 if (jjtc009) { 467 jjtree.closeNodeScope(jjtn009, 2); 468 } 469 } 470 break; 471 case 14: 472 jj_consume_token(14); 473 ASTLikeIgnoreCase jjtn010 = new ASTLikeIgnoreCase(JJTLIKEIGNORECASE); 474 boolean jjtc010 = true; 475 jjtree.openNodeScope(jjtn010); 476 try { 477 scalarExpression(); 478 } catch (Throwable jjte010) { 479 if (jjtc010) { 480 jjtree.clearNodeScope(jjtn010); 481 jjtc010 = false; 482 } else { 483 jjtree.popNode(); 484 } 485 if (jjte010 instanceof RuntimeException ) { 486 {if (true) throw (RuntimeException )jjte010;} 487 } 488 if (jjte010 instanceof ParseException) { 489 {if (true) throw (ParseException)jjte010;} 490 } 491 {if (true) throw (Error )jjte010;} 492 } finally { 493 if (jjtc010) { 494 jjtree.closeNodeScope(jjtn010, 2); 495 } 496 } 497 break; 498 case 15: 499 jj_consume_token(15); 500 ASTIn jjtn011 = new ASTIn(JJTIN); 501 boolean jjtc011 = true; 502 jjtree.openNodeScope(jjtn011); 503 try { 504 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 505 case 24: 506 namedParameter(); 507 break; 508 case 16: 509 jj_consume_token(16); 510 scalarCommaList(); 511 jj_consume_token(17); 512 break; 513 default: 514 jj_la1[6] = jj_gen; 515 jj_consume_token(-1); 516 throw new ParseException(); 517 } 518 } catch (Throwable jjte011) { 519 if (jjtc011) { 520 jjtree.clearNodeScope(jjtn011); 521 jjtc011 = false; 522 } else { 523 jjtree.popNode(); 524 } 525 if (jjte011 instanceof RuntimeException ) { 526 {if (true) throw (RuntimeException )jjte011;} 527 } 528 if (jjte011 instanceof ParseException) { 529 {if (true) throw (ParseException)jjte011;} 530 } 531 {if (true) throw (Error )jjte011;} 532 } finally { 533 if (jjtc011) { 534 jjtree.closeNodeScope(jjtn011, 2); 535 } 536 } 537 break; 538 case 18: 539 jj_consume_token(18); 540 scalarExpression(); 541 jj_consume_token(2); 542 ASTBetween jjtn012 = new ASTBetween(JJTBETWEEN); 543 boolean jjtc012 = true; 544 jjtree.openNodeScope(jjtn012); 545 try { 546 scalarExpression(); 547 } catch (Throwable jjte012) { 548 if (jjtc012) { 549 jjtree.clearNodeScope(jjtn012); 550 jjtc012 = false; 551 } else { 552 jjtree.popNode(); 553 } 554 if (jjte012 instanceof RuntimeException ) { 555 {if (true) throw (RuntimeException )jjte012;} 556 } 557 if (jjte012 instanceof ParseException) { 558 {if (true) throw (ParseException)jjte012;} 559 } 560 {if (true) throw (Error )jjte012;} 561 } finally { 562 if (jjtc012) { 563 jjtree.closeNodeScope(jjtn012, 3); 564 } 565 } 566 break; 567 default: 568 jj_la1[7] = jj_gen; 569 jj_consume_token(-1); 570 throw new ParseException(); 571 } 572 break; 573 default: 574 jj_la1[8] = jj_gen; 575 ; 576 } 577 break; 578 default: 579 jj_la1[9] = jj_gen; 580 jj_consume_token(-1); 581 throw new ParseException(); 582 } 583 } 584 585 final public void simpleNotCondition() throws ParseException { 586 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 587 case 3: 588 jj_consume_token(3); 589 break; 590 case 4: 591 jj_consume_token(4); 592 break; 593 default: 594 jj_la1[10] = jj_gen; 595 jj_consume_token(-1); 596 throw new ParseException(); 597 } 598 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 599 case 13: 600 jj_consume_token(13); 601 ASTNotLike jjtn001 = new ASTNotLike(JJTNOTLIKE); 602 boolean jjtc001 = true; 603 jjtree.openNodeScope(jjtn001); 604 try { 605 scalarExpression(); 606 } catch (Throwable jjte001) { 607 if (jjtc001) { 608 jjtree.clearNodeScope(jjtn001); 609 jjtc001 = false; 610 } else { 611 jjtree.popNode(); 612 } 613 if (jjte001 instanceof RuntimeException ) { 614 {if (true) throw (RuntimeException )jjte001;} 615 } 616 if (jjte001 instanceof ParseException) { 617 {if (true) throw (ParseException)jjte001;} 618 } 619 {if (true) throw (Error )jjte001;} 620 } finally { 621 if (jjtc001) { 622 jjtree.closeNodeScope(jjtn001, 2); 623 } 624 } 625 break; 626 case 14: 627 jj_consume_token(14); 628 ASTNotLikeIgnoreCase jjtn002 = new ASTNotLikeIgnoreCase(JJTNOTLIKEIGNORECASE); 629 boolean jjtc002 = true; 630 jjtree.openNodeScope(jjtn002); 631 try { 632 scalarExpression(); 633 } catch (Throwable jjte002) { 634 if (jjtc002) { 635 jjtree.clearNodeScope(jjtn002); 636 jjtc002 = false; 637 } else { 638 jjtree.popNode(); 639 } 640 if (jjte002 instanceof RuntimeException ) { 641 {if (true) throw (RuntimeException )jjte002;} 642 } 643 if (jjte002 instanceof ParseException) { 644 {if (true) throw (ParseException)jjte002;} 645 } 646 {if (true) throw (Error )jjte002;} 647 } finally { 648 if (jjtc002) { 649 jjtree.closeNodeScope(jjtn002, 2); 650 } 651 } 652 break; 653 case 15: 654 jj_consume_token(15); 655 ASTNotIn jjtn003 = new ASTNotIn(JJTNOTIN); 656 boolean jjtc003 = true; 657 jjtree.openNodeScope(jjtn003); 658 try { 659 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 660 case 24: 661 namedParameter(); 662 break; 663 case 16: 664 jj_consume_token(16); 665 scalarCommaList(); 666 jj_consume_token(17); 667 break; 668 default: 669 jj_la1[11] = jj_gen; 670 jj_consume_token(-1); 671 throw new ParseException(); 672 } 673 } catch (Throwable jjte003) { 674 if (jjtc003) { 675 jjtree.clearNodeScope(jjtn003); 676 jjtc003 = false; 677 } else { 678 jjtree.popNode(); 679 } 680 if (jjte003 instanceof RuntimeException ) { 681 {if (true) throw (RuntimeException )jjte003;} 682 } 683 if (jjte003 instanceof ParseException) { 684 {if (true) throw (ParseException)jjte003;} 685 } 686 {if (true) throw (Error )jjte003;} 687 } finally { 688 if (jjtc003) { 689 jjtree.closeNodeScope(jjtn003, 2); 690 } 691 } 692 break; 693 case 18: 694 jj_consume_token(18); 695 scalarExpression(); 696 jj_consume_token(2); 697 ASTNotBetween jjtn004 = new ASTNotBetween(JJTNOTBETWEEN); 698 boolean jjtc004 = true; 699 jjtree.openNodeScope(jjtn004); 700 try { 701 scalarExpression(); 702 } catch (Throwable jjte004) { 703 if (jjtc004) { 704 jjtree.clearNodeScope(jjtn004); 705 jjtc004 = false; 706 } else { 707 jjtree.popNode(); 708 } 709 if (jjte004 instanceof RuntimeException ) { 710 {if (true) throw (RuntimeException )jjte004;} 711 } 712 if (jjte004 instanceof ParseException) { 713 {if (true) throw (ParseException)jjte004;} 714 } 715 {if (true) throw (Error )jjte004;} 716 } finally { 717 if (jjtc004) { 718 jjtree.closeNodeScope(jjtn004, 3); 719 } 720 } 721 break; 722 default: 723 jj_la1[12] = jj_gen; 724 jj_consume_token(-1); 725 throw new ParseException(); 726 } 727 } 728 729 final public void scalarCommaList() throws ParseException { 730 ASTList jjtn001 = new ASTList(JJTLIST); 731 boolean jjtc001 = true; 732 jjtree.openNodeScope(jjtn001); 733 try { 734 scalarConstExpression(); 735 label_3: 736 while (true) { 737 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 738 case 19: 739 ; 740 break; 741 default: 742 jj_la1[13] = jj_gen; 743 break label_3; 744 } 745 jj_consume_token(19); 746 scalarConstExpression(); 747 } 748 } catch (Throwable jjte001) { 749 if (jjtc001) { 750 jjtree.clearNodeScope(jjtn001); 751 jjtc001 = false; 752 } else { 753 jjtree.popNode(); 754 } 755 if (jjte001 instanceof RuntimeException ) { 756 {if (true) throw (RuntimeException )jjte001;} 757 } 758 if (jjte001 instanceof ParseException) { 759 {if (true) throw (ParseException)jjte001;} 760 } 761 {if (true) throw (Error )jjte001;} 762 } finally { 763 if (jjtc001) { 764 jjtree.closeNodeScope(jjtn001, true); 765 } 766 } 767 } 768 769 final public void scalarExpression() throws ParseException { 770 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 771 case 16: 772 case 20: 773 case 21: 774 case 24: 775 case 25: 776 case 26: 777 case PROPERTY_PATH: 778 case INT_LITERAL: 779 case FLOAT_LITERAL: 780 scalarNumericExpression(); 781 break; 782 case SINGLE_QUOTED_STRING: 783 jj_consume_token(SINGLE_QUOTED_STRING); 784 ASTScalar jjtn001 = new ASTScalar(JJTSCALAR); 785 boolean jjtc001 = true; 786 jjtree.openNodeScope(jjtn001); 787 try { 788 jjtree.closeNodeScope(jjtn001, 0); 789 jjtc001 = false; 790 jjtn001.setValue(token_source.literalValue); 791 } finally { 792 if (jjtc001) { 793 jjtree.closeNodeScope(jjtn001, 0); 794 } 795 } 796 break; 797 case DOUBLE_QUOTED_STRING: 798 jj_consume_token(DOUBLE_QUOTED_STRING); 799 ASTScalar jjtn002 = new ASTScalar(JJTSCALAR); 800 boolean jjtc002 = true; 801 jjtree.openNodeScope(jjtn002); 802 try { 803 jjtree.closeNodeScope(jjtn002, 0); 804 jjtc002 = false; 805 jjtn002.setValue(token_source.literalValue); 806 } finally { 807 if (jjtc002) { 808 jjtree.closeNodeScope(jjtn002, 0); 809 } 810 } 811 break; 812 case NULL: 813 ASTScalar jjtn003 = new ASTScalar(JJTSCALAR); 814 boolean jjtc003 = true; 815 jjtree.openNodeScope(jjtn003); 816 try { 817 jj_consume_token(NULL); 818 } finally { 819 if (jjtc003) { 820 jjtree.closeNodeScope(jjtn003, 0); 821 } 822 } 823 break; 824 default: 825 jj_la1[14] = jj_gen; 826 jj_consume_token(-1); 827 throw new ParseException(); 828 } 829 } 830 831 final public void scalarConstExpression() throws ParseException { 832 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 833 case SINGLE_QUOTED_STRING: 834 jj_consume_token(SINGLE_QUOTED_STRING); 835 ASTScalar jjtn001 = new ASTScalar(JJTSCALAR); 836 boolean jjtc001 = true; 837 jjtree.openNodeScope(jjtn001); 838 try { 839 jjtree.closeNodeScope(jjtn001, 0); 840 jjtc001 = false; 841 jjtn001.setValue(token_source.literalValue); 842 } finally { 843 if (jjtc001) { 844 jjtree.closeNodeScope(jjtn001, 0); 845 } 846 } 847 break; 848 case DOUBLE_QUOTED_STRING: 849 jj_consume_token(DOUBLE_QUOTED_STRING); 850 ASTScalar jjtn002 = new ASTScalar(JJTSCALAR); 851 boolean jjtc002 = true; 852 jjtree.openNodeScope(jjtn002); 853 try { 854 jjtree.closeNodeScope(jjtn002, 0); 855 jjtc002 = false; 856 jjtn002.setValue(token_source.literalValue); 857 } finally { 858 if (jjtc002) { 859 jjtree.closeNodeScope(jjtn002, 0); 860 } 861 } 862 break; 863 case 24: 864 namedParameter(); 865 break; 866 case INT_LITERAL: 867 jj_consume_token(INT_LITERAL); 868 ASTScalar jjtn003 = new ASTScalar(JJTSCALAR); 869 boolean jjtc003 = true; 870 jjtree.openNodeScope(jjtn003); 871 try { 872 jjtree.closeNodeScope(jjtn003, 0); 873 jjtc003 = false; 874 jjtn003.setValue(token_source.literalValue); 875 } finally { 876 if (jjtc003) { 877 jjtree.closeNodeScope(jjtn003, 0); 878 } 879 } 880 break; 881 case FLOAT_LITERAL: 882 jj_consume_token(FLOAT_LITERAL); 883 ASTScalar jjtn004 = new ASTScalar(JJTSCALAR); 884 boolean jjtc004 = true; 885 jjtree.openNodeScope(jjtn004); 886 try { 887 jjtree.closeNodeScope(jjtn004, 0); 888 jjtc004 = false; 889 jjtn004.setValue(token_source.literalValue); 890 } finally { 891 if (jjtc004) { 892 jjtree.closeNodeScope(jjtn004, 0); 893 } 894 } 895 break; 896 default: 897 jj_la1[15] = jj_gen; 898 jj_consume_token(-1); 899 throw new ParseException(); 900 } 901 } 902 903 final public void scalarNumericExpression() throws ParseException { 904 multiplySubtractExp(); 905 label_4: 906 while (true) { 907 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 908 case 20: 909 case 21: 910 ; 911 break; 912 default: 913 jj_la1[16] = jj_gen; 914 break label_4; 915 } 916 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 917 case 20: 918 jj_consume_token(20); 919 ASTAdd jjtn001 = new ASTAdd(JJTADD); 920 boolean jjtc001 = true; 921 jjtree.openNodeScope(jjtn001); 922 try { 923 multiplySubtractExp(); 924 } catch (Throwable jjte001) { 925 if (jjtc001) { 926 jjtree.clearNodeScope(jjtn001); 927 jjtc001 = false; 928 } else { 929 jjtree.popNode(); 930 } 931 if (jjte001 instanceof RuntimeException ) { 932 {if (true) throw (RuntimeException )jjte001;} 933 } 934 if (jjte001 instanceof ParseException) { 935 {if (true) throw (ParseException)jjte001;} 936 } 937 {if (true) throw (Error )jjte001;} 938 } finally { 939 if (jjtc001) { 940 jjtree.closeNodeScope(jjtn001, 2); 941 } 942 } 943 break; 944 case 21: 945 jj_consume_token(21); 946 ASTSubtract jjtn002 = new ASTSubtract(JJTSUBTRACT); 947 boolean jjtc002 = true; 948 jjtree.openNodeScope(jjtn002); 949 try { 950 multiplySubtractExp(); 951 } catch (Throwable jjte002) { 952 if (jjtc002) { 953 jjtree.clearNodeScope(jjtn002); 954 jjtc002 = false; 955 } else { 956 jjtree.popNode(); 957 } 958 if (jjte002 instanceof RuntimeException ) { 959 {if (true) throw (RuntimeException )jjte002;} 960 } 961 if (jjte002 instanceof ParseException) { 962 {if (true) throw (ParseException)jjte002;} 963 } 964 {if (true) throw (Error )jjte002;} 965 } finally { 966 if (jjtc002) { 967 jjtree.closeNodeScope(jjtn002, 2); 968 } 969 } 970 break; 971 default: 972 jj_la1[17] = jj_gen; 973 jj_consume_token(-1); 974 throw new ParseException(); 975 } 976 } 977 } 978 979 final public void multiplySubtractExp() throws ParseException { 980 numericTerm(); 981 label_5: 982 while (true) { 983 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 984 case 22: 985 case 23: 986 ; 987 break; 988 default: 989 jj_la1[18] = jj_gen; 990 break label_5; 991 } 992 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 993 case 22: 994 jj_consume_token(22); 995 ASTMultiply jjtn001 = new ASTMultiply(JJTMULTIPLY); 996 boolean jjtc001 = true; 997 jjtree.openNodeScope(jjtn001); 998 try { 999 numericTerm(); 1000 } catch (Throwable jjte001) { 1001 if (jjtc001) { 1002 jjtree.clearNodeScope(jjtn001); 1003 jjtc001 = false; 1004 } else { 1005 jjtree.popNode(); 1006 } 1007 if (jjte001 instanceof RuntimeException ) { 1008 {if (true) throw (RuntimeException )jjte001;} 1009 } 1010 if (jjte001 instanceof ParseException) { 1011 {if (true) throw (ParseException)jjte001;} 1012 } 1013 {if (true) throw (Error )jjte001;} 1014 } finally { 1015 if (jjtc001) { 1016 jjtree.closeNodeScope(jjtn001, 2); 1017 } 1018 } 1019 break; 1020 case 23: 1021 jj_consume_token(23); 1022 ASTDivide jjtn002 = new ASTDivide(JJTDIVIDE); 1023 boolean jjtc002 = true; 1024 jjtree.openNodeScope(jjtn002); 1025 try { 1026 numericTerm(); 1027 } catch (Throwable jjte002) { 1028 if (jjtc002) { 1029 jjtree.clearNodeScope(jjtn002); 1030 jjtc002 = false; 1031 } else { 1032 jjtree.popNode(); 1033 } 1034 if (jjte002 instanceof RuntimeException ) { 1035 {if (true) throw (RuntimeException )jjte002;} 1036 } 1037 if (jjte002 instanceof ParseException) { 1038 {if (true) throw (ParseException)jjte002;} 1039 } 1040 {if (true) throw (Error )jjte002;} 1041 } finally { 1042 if (jjtc002) { 1043 jjtree.closeNodeScope(jjtn002, 2); 1044 } 1045 } 1046 break; 1047 default: 1048 jj_la1[19] = jj_gen; 1049 jj_consume_token(-1); 1050 throw new ParseException(); 1051 } 1052 } 1053 } 1054 1055 final public void numericTerm() throws ParseException { 1056 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1057 case 16: 1058 case 20: 1059 case 24: 1060 case 25: 1061 case 26: 1062 case PROPERTY_PATH: 1063 case INT_LITERAL: 1064 case FLOAT_LITERAL: 1065 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1066 case 20: 1067 jj_consume_token(20); 1068 break; 1069 default: 1070 jj_la1[20] = jj_gen; 1071 ; 1072 } 1073 numericPrimary(); 1074 break; 1075 case 21: 1076 jj_consume_token(21); 1077 ASTNegate jjtn001 = new ASTNegate(JJTNEGATE); 1078 boolean jjtc001 = true; 1079 jjtree.openNodeScope(jjtn001); 1080 try { 1081 numericPrimary(); 1082 } catch (Throwable jjte001) { 1083 if (jjtc001) { 1084 jjtree.clearNodeScope(jjtn001); 1085 jjtc001 = false; 1086 } else { 1087 jjtree.popNode(); 1088 } 1089 if (jjte001 instanceof RuntimeException ) { 1090 {if (true) throw (RuntimeException )jjte001;} 1091 } 1092 if (jjte001 instanceof ParseException) { 1093 {if (true) throw (ParseException)jjte001;} 1094 } 1095 {if (true) throw (Error )jjte001;} 1096 } finally { 1097 if (jjtc001) { 1098 jjtree.closeNodeScope(jjtn001, 1); 1099 } 1100 } 1101 break; 1102 default: 1103 jj_la1[21] = jj_gen; 1104 jj_consume_token(-1); 1105 throw new ParseException(); 1106 } 1107 } 1108 1109 final public void numericPrimary() throws ParseException { 1110 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1111 case 16: 1112 jj_consume_token(16); 1113 orCondition(); 1114 jj_consume_token(17); 1115 break; 1116 case 25: 1117 case 26: 1118 case PROPERTY_PATH: 1119 pathExpression(); 1120 break; 1121 case 24: 1122 namedParameter(); 1123 break; 1124 case INT_LITERAL: 1125 jj_consume_token(INT_LITERAL); 1126 ASTScalar jjtn001 = new ASTScalar(JJTSCALAR); 1127 boolean jjtc001 = true; 1128 jjtree.openNodeScope(jjtn001); 1129 try { 1130 jjtree.closeNodeScope(jjtn001, 0); 1131 jjtc001 = false; 1132 jjtn001.setValue(token_source.literalValue); 1133 } finally { 1134 if (jjtc001) { 1135 jjtree.closeNodeScope(jjtn001, 0); 1136 } 1137 } 1138 break; 1139 case FLOAT_LITERAL: 1140 jj_consume_token(FLOAT_LITERAL); 1141 ASTScalar jjtn002 = new ASTScalar(JJTSCALAR); 1142 boolean jjtc002 = true; 1143 jjtree.openNodeScope(jjtn002); 1144 try { 1145 jjtree.closeNodeScope(jjtn002, 0); 1146 jjtc002 = false; 1147 jjtn002.setValue(token_source.literalValue); 1148 } finally { 1149 if (jjtc002) { 1150 jjtree.closeNodeScope(jjtn002, 0); 1151 } 1152 } 1153 break; 1154 default: 1155 jj_la1[22] = jj_gen; 1156 jj_consume_token(-1); 1157 throw new ParseException(); 1158 } 1159 } 1160 1161 final public void namedParameter() throws ParseException { 1162 Token t; 1163 jj_consume_token(24); 1164 t = jj_consume_token(PROPERTY_PATH); 1165 ASTNamedParameter jjtn001 = new ASTNamedParameter(JJTNAMEDPARAMETER); 1166 boolean jjtc001 = true; 1167 jjtree.openNodeScope(jjtn001); 1168 try { 1169 jjtree.closeNodeScope(jjtn001, 0); 1170 jjtc001 = false; 1171 jjtn001.setValue(t.image); 1172 } finally { 1173 if (jjtc001) { 1174 jjtree.closeNodeScope(jjtn001, 0); 1175 } 1176 } 1177 } 1178 1179 final public void pathExpression() throws ParseException { 1180 Token t; 1181 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1182 case PROPERTY_PATH: 1183 t = jj_consume_token(PROPERTY_PATH); 1184 ASTObjPath jjtn001 = new ASTObjPath(JJTOBJPATH); 1185 boolean jjtc001 = true; 1186 jjtree.openNodeScope(jjtn001); 1187 try { 1188 jjtree.closeNodeScope(jjtn001, 0); 1189 jjtc001 = false; 1190 jjtn001.setPath(t.image); 1191 } finally { 1192 if (jjtc001) { 1193 jjtree.closeNodeScope(jjtn001, 0); 1194 } 1195 } 1196 break; 1197 case 25: 1198 jj_consume_token(25); 1199 t = jj_consume_token(PROPERTY_PATH); 1200 ASTObjPath jjtn002 = new ASTObjPath(JJTOBJPATH); 1201 boolean jjtc002 = true; 1202 jjtree.openNodeScope(jjtn002); 1203 try { 1204 jjtree.closeNodeScope(jjtn002, 0); 1205 jjtc002 = false; 1206 jjtn002.setPath(t.image); 1207 } finally { 1208 if (jjtc002) { 1209 jjtree.closeNodeScope(jjtn002, 0); 1210 } 1211 } 1212 break; 1213 case 26: 1214 jj_consume_token(26); 1215 t = jj_consume_token(PROPERTY_PATH); 1216 ASTDbPath jjtn003 = new ASTDbPath(JJTDBPATH); 1217 boolean jjtc003 = true; 1218 jjtree.openNodeScope(jjtn003); 1219 try { 1220 jjtree.closeNodeScope(jjtn003, 0); 1221 jjtc003 = false; 1222 jjtn003.setPath(t.image); 1223 } finally { 1224 if (jjtc003) { 1225 jjtree.closeNodeScope(jjtn003, 0); 1226 } 1227 } 1228 break; 1229 default: 1230 jj_la1[23] = jj_gen; 1231 jj_consume_token(-1); 1232 throw new ParseException(); 1233 } 1234 } 1235 1236 public ExpressionParserTokenManager token_source; 1237 JavaCharStream jj_input_stream; 1238 public Token token, jj_nt; 1239 private int jj_ntk; 1240 private int jj_gen; 1241 final private int[] jj_la1 = new int[24]; 1242 static private int[] jj_la1_0; 1243 static private int[] jj_la1_1; 1244 static { 1245 jj_la1_0(); 1246 jj_la1_1(); 1247 } 1248 private static void jj_la1_0() { 1249 jj_la1_0 = new int[] {0x2,0x4,0x18,0x87310018,0x60,0x180,0x1010000,0x4fff8,0x4fff8,0x87310000,0x18,0x1010000,0x4e000,0x80000,0x87310000,0x1000000,0x300000,0x300000,0xc00000,0xc00000,0x100000,0x7310000,0x7010000,0x6000000,}; 1250 } 1251 private static void jj_la1_1() { 1252 jj_la1_1 = new int[] {0x0,0x0,0x0,0xe407,0x0,0x0,0x0,0x0,0x0,0xe407,0x0,0x0,0x0,0x0,0xe404,0xe400,0x0,0x0,0x0,0x0,0x0,0xc004,0xc004,0x4,}; 1253 } 1254 1255 public ExpressionParser(java.io.InputStream stream) { 1256 this(stream, null); 1257 } 1258 public ExpressionParser(java.io.InputStream stream, String encoding) { 1259 try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException (e); } 1260 token_source = new ExpressionParserTokenManager(jj_input_stream); 1261 token = new Token(); 1262 jj_ntk = -1; 1263 jj_gen = 0; 1264 for (int i = 0; i < 24; i++) jj_la1[i] = -1; 1265 } 1266 1267 public void ReInit(java.io.InputStream stream) { 1268 ReInit(stream, null); 1269 } 1270 public void ReInit(java.io.InputStream stream, String encoding) { 1271 try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException (e); } 1272 token_source.ReInit(jj_input_stream); 1273 token = new Token(); 1274 jj_ntk = -1; 1275 jjtree.reset(); 1276 jj_gen = 0; 1277 for (int i = 0; i < 24; i++) jj_la1[i] = -1; 1278 } 1279 1280 public ExpressionParser(java.io.Reader stream) { 1281 jj_input_stream = new JavaCharStream(stream, 1, 1); 1282 token_source = new ExpressionParserTokenManager(jj_input_stream); 1283 token = new Token(); 1284 jj_ntk = -1; 1285 jj_gen = 0; 1286 for (int i = 0; i < 24; i++) jj_la1[i] = -1; 1287 } 1288 1289 public void ReInit(java.io.Reader stream) { 1290 jj_input_stream.ReInit(stream, 1, 1); 1291 token_source.ReInit(jj_input_stream); 1292 token = new Token(); 1293 jj_ntk = -1; 1294 jjtree.reset(); 1295 jj_gen = 0; 1296 for (int i = 0; i < 24; i++) jj_la1[i] = -1; 1297 } 1298 1299 public ExpressionParser(ExpressionParserTokenManager tm) { 1300 token_source = tm; 1301 token = new Token(); 1302 jj_ntk = -1; 1303 jj_gen = 0; 1304 for (int i = 0; i < 24; i++) jj_la1[i] = -1; 1305 } 1306 1307 public void ReInit(ExpressionParserTokenManager tm) { 1308 token_source = tm; 1309 token = new Token(); 1310 jj_ntk = -1; 1311 jjtree.reset(); 1312 jj_gen = 0; 1313 for (int i = 0; i < 24; i++) jj_la1[i] = -1; 1314 } 1315 1316 final private Token jj_consume_token(int kind) throws ParseException { 1317 Token oldToken; 1318 if ((oldToken = token).next != null) token = token.next; 1319 else token = token.next = token_source.getNextToken(); 1320 jj_ntk = -1; 1321 if (token.kind == kind) { 1322 jj_gen++; 1323 return token; 1324 } 1325 token = oldToken; 1326 jj_kind = kind; 1327 throw generateParseException(); 1328 } 1329 1330 final public Token getNextToken() { 1331 if (token.next != null) token = token.next; 1332 else token = token.next = token_source.getNextToken(); 1333 jj_ntk = -1; 1334 jj_gen++; 1335 return token; 1336 } 1337 1338 final public Token getToken(int index) { 1339 Token t = token; 1340 for (int i = 0; i < index; i++) { 1341 if (t.next != null) t = t.next; 1342 else t = t.next = token_source.getNextToken(); 1343 } 1344 return t; 1345 } 1346 1347 final private int jj_ntk() { 1348 if ((jj_nt=token.next) == null) 1349 return (jj_ntk = (token.next=token_source.getNextToken()).kind); 1350 else 1351 return (jj_ntk = jj_nt.kind); 1352 } 1353 1354 private java.util.Vector jj_expentries = new java.util.Vector (); 1355 private int[] jj_expentry; 1356 private int jj_kind = -1; 1357 1358 public ParseException generateParseException() { 1359 jj_expentries.removeAllElements(); 1360 boolean[] la1tokens = new boolean[52]; 1361 for (int i = 0; i < 52; i++) { 1362 la1tokens[i] = false; 1363 } 1364 if (jj_kind >= 0) { 1365 la1tokens[jj_kind] = true; 1366 jj_kind = -1; 1367 } 1368 for (int i = 0; i < 24; i++) { 1369 if (jj_la1[i] == jj_gen) { 1370 for (int j = 0; j < 32; j++) { 1371 if ((jj_la1_0[i] & (1<<j)) != 0) { 1372 la1tokens[j] = true; 1373 } 1374 if ((jj_la1_1[i] & (1<<j)) != 0) { 1375 la1tokens[32+j] = true; 1376 } 1377 } 1378 } 1379 } 1380 for (int i = 0; i < 52; i++) { 1381 if (la1tokens[i]) { 1382 jj_expentry = new int[1]; 1383 jj_expentry[0] = i; 1384 jj_expentries.addElement(jj_expentry); 1385 } 1386 } 1387 int[][] exptokseq = new int[jj_expentries.size()][]; 1388 for (int i = 0; i < jj_expentries.size(); i++) { 1389 exptokseq[i] = (int[])jj_expentries.elementAt(i); 1390 } 1391 return new ParseException(token, exptokseq, tokenImage); 1392 } 1393 1394 final public void enable_tracing() { 1395 } 1396 1397 final public void disable_tracing() { 1398 } 1399 1400} 1401 | Popular Tags |