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