| 1 16 17 18 package org.apache.taglibs.standard.lang.jpath.expression; 19 20 import java.io.StringReader; 21 22 public class Parserimplements ParserTreeConstants, ParserConstants { 23 protected JJTParserState jjtree = new JJTParserState();public static Expression parse(String expressionText) 24 throws ParseException { 25 Parser parser; 26 Expression expression; 27 parser = new Parser(new StringReader(expressionText)); 28 parser.Expression(); 29 expression = (Expression)parser.jjtree.rootNode(); 30 return expression; 31 } 32 33 void jjtreeOpenNodeScope(Node n) { 34 ((SimpleNode)n).firstToken = getToken(0); 35 } 36 37 void jjtreeCloseNodeScope(Node n) { 38 ((SimpleNode)n).lastToken = getToken(0); 39 } 40 41 44 final public void Expression() throws ParseException { 45 46 Expression jjtn000 = new Expression(JJTEXPRESSION); 47 boolean jjtc000 = true; 48 jjtree.openNodeScope(jjtn000); 49 jjtreeOpenNodeScope(jjtn000); 50 try { 51 Expr(); 52 jj_consume_token(0); 53 } catch (Throwable jjte000) { 54 if (jjtc000) { 55 jjtree.clearNodeScope(jjtn000); 56 jjtc000 = false; 57 } else { 58 jjtree.popNode(); 59 } 60 if (jjte000 instanceof RuntimeException) { 61 {if (true) throw (RuntimeException)jjte000;} 62 } 63 if (jjte000 instanceof ParseException) { 64 {if (true) throw (ParseException)jjte000;} 65 } 66 {if (true) throw (Error)jjte000;} 67 } finally { 68 if (jjtc000) { 69 jjtree.closeNodeScope(jjtn000, 1); 70 jjtreeCloseNodeScope(jjtn000); 71 } 72 } 73 } 74 75 76 final public void Expr() throws ParseException { 77 OrExpr(); 78 } 79 80 81 final public void OrExpr() throws ParseException { 82 AndExpr(); 83 label_1: 84 while (true) { 85 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 86 case OR: 87 ; 88 break; 89 default: 90 jj_la1[0] = jj_gen; 91 break label_1; 92 } 93 jj_consume_token(OR); 94 OrOperator jjtn001 = new OrOperator(JJTOROPERATOR); 95 boolean jjtc001 = true; 96 jjtree.openNodeScope(jjtn001); 97 jjtreeOpenNodeScope(jjtn001); 98 try { 99 AndExpr(); 100 } catch (Throwable jjte001) { 101 if (jjtc001) { 102 jjtree.clearNodeScope(jjtn001); 103 jjtc001 = false; 104 } else { 105 jjtree.popNode(); 106 } 107 if (jjte001 instanceof RuntimeException) { 108 {if (true) throw (RuntimeException)jjte001;} 109 } 110 if (jjte001 instanceof ParseException) { 111 {if (true) throw (ParseException)jjte001;} 112 } 113 {if (true) throw (Error)jjte001;} 114 } finally { 115 if (jjtc001) { 116 jjtree.closeNodeScope(jjtn001, 2); 117 jjtreeCloseNodeScope(jjtn001); 118 } 119 } 120 } 121 } 122 123 124 final public void AndExpr() throws ParseException { 125 EqualityExpr(); 126 label_2: 127 while (true) { 128 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 129 case AND: 130 ; 131 break; 132 default: 133 jj_la1[1] = jj_gen; 134 break label_2; 135 } 136 jj_consume_token(AND); 137 AndOperator jjtn001 = new AndOperator(JJTANDOPERATOR); 138 boolean jjtc001 = true; 139 jjtree.openNodeScope(jjtn001); 140 jjtreeOpenNodeScope(jjtn001); 141 try { 142 EqualityExpr(); 143 } catch (Throwable jjte001) { 144 if (jjtc001) { 145 jjtree.clearNodeScope(jjtn001); 146 jjtc001 = false; 147 } else { 148 jjtree.popNode(); 149 } 150 if (jjte001 instanceof RuntimeException) { 151 {if (true) throw (RuntimeException)jjte001;} 152 } 153 if (jjte001 instanceof ParseException) { 154 {if (true) throw (ParseException)jjte001;} 155 } 156 {if (true) throw (Error)jjte001;} 157 } finally { 158 if (jjtc001) { 159 jjtree.closeNodeScope(jjtn001, 2); 160 jjtreeCloseNodeScope(jjtn001); 161 } 162 } 163 } 164 } 165 166 167 final public void EqualityExpr() throws ParseException { 168 RelationalExpr(); 169 label_3: 170 while (true) { 171 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 172 case EQ: 173 case NEQ: 174 ; 175 break; 176 default: 177 jj_la1[2] = jj_gen; 178 break label_3; 179 } 180 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 181 case EQ: 182 jj_consume_token(EQ); 183 EqualsOperator jjtn001 = new EqualsOperator(JJTEQUALSOPERATOR); 184 boolean jjtc001 = true; 185 jjtree.openNodeScope(jjtn001); 186 jjtreeOpenNodeScope(jjtn001); 187 try { 188 RelationalExpr(); 189 } catch (Throwable jjte001) { 190 if (jjtc001) { 191 jjtree.clearNodeScope(jjtn001); 192 jjtc001 = false; 193 } else { 194 jjtree.popNode(); 195 } 196 if (jjte001 instanceof RuntimeException) { 197 {if (true) throw (RuntimeException)jjte001;} 198 } 199 if (jjte001 instanceof ParseException) { 200 {if (true) throw (ParseException)jjte001;} 201 } 202 {if (true) throw (Error)jjte001;} 203 } finally { 204 if (jjtc001) { 205 jjtree.closeNodeScope(jjtn001, 2); 206 jjtreeCloseNodeScope(jjtn001); 207 } 208 } 209 break; 210 case NEQ: 211 jj_consume_token(NEQ); 212 NotEqualsOperator jjtn002 = new NotEqualsOperator(JJTNOTEQUALSOPERATOR); 213 boolean jjtc002 = true; 214 jjtree.openNodeScope(jjtn002); 215 jjtreeOpenNodeScope(jjtn002); 216 try { 217 RelationalExpr(); 218 } catch (Throwable jjte002) { 219 if (jjtc002) { 220 jjtree.clearNodeScope(jjtn002); 221 jjtc002 = false; 222 } else { 223 jjtree.popNode(); 224 } 225 if (jjte002 instanceof RuntimeException) { 226 {if (true) throw (RuntimeException)jjte002;} 227 } 228 if (jjte002 instanceof ParseException) { 229 {if (true) throw (ParseException)jjte002;} 230 } 231 {if (true) throw (Error)jjte002;} 232 } finally { 233 if (jjtc002) { 234 jjtree.closeNodeScope(jjtn002, 2); 235 jjtreeCloseNodeScope(jjtn002); 236 } 237 } 238 break; 239 default: 240 jj_la1[3] = jj_gen; 241 jj_consume_token(-1); 242 throw new ParseException(); 243 } 244 } 245 } 246 247 248 final public void RelationalExpr() throws ParseException { 249 AdditiveExpr(); 250 label_4: 251 while (true) { 252 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 253 case LT: 254 case LTE: 255 case GT: 256 case GTE: 257 ; 258 break; 259 default: 260 jj_la1[4] = jj_gen; 261 break label_4; 262 } 263 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 264 case LT: 265 jj_consume_token(LT); 266 LessThanOperator jjtn001 = new LessThanOperator(JJTLESSTHANOPERATOR); 267 boolean jjtc001 = true; 268 jjtree.openNodeScope(jjtn001); 269 jjtreeOpenNodeScope(jjtn001); 270 try { 271 AdditiveExpr(); 272 } catch (Throwable jjte001) { 273 if (jjtc001) { 274 jjtree.clearNodeScope(jjtn001); 275 jjtc001 = false; 276 } else { 277 jjtree.popNode(); 278 } 279 if (jjte001 instanceof RuntimeException) { 280 {if (true) throw (RuntimeException)jjte001;} 281 } 282 if (jjte001 instanceof ParseException) { 283 {if (true) throw (ParseException)jjte001;} 284 } 285 {if (true) throw (Error)jjte001;} 286 } finally { 287 if (jjtc001) { 288 jjtree.closeNodeScope(jjtn001, 2); 289 jjtreeCloseNodeScope(jjtn001); 290 } 291 } 292 break; 293 case GT: 294 jj_consume_token(GT); 295 GreaterThanOperator jjtn002 = new GreaterThanOperator(JJTGREATERTHANOPERATOR); 296 boolean jjtc002 = true; 297 jjtree.openNodeScope(jjtn002); 298 jjtreeOpenNodeScope(jjtn002); 299 try { 300 AdditiveExpr(); 301 } catch (Throwable jjte002) { 302 if (jjtc002) { 303 jjtree.clearNodeScope(jjtn002); 304 jjtc002 = false; 305 } else { 306 jjtree.popNode(); 307 } 308 if (jjte002 instanceof RuntimeException) { 309 {if (true) throw (RuntimeException)jjte002;} 310 } 311 if (jjte002 instanceof ParseException) { 312 {if (true) throw (ParseException)jjte002;} 313 } 314 {if (true) throw (Error)jjte002;} 315 } finally { 316 if (jjtc002) { 317 jjtree.closeNodeScope(jjtn002, 2); 318 jjtreeCloseNodeScope(jjtn002); 319 } 320 } 321 break; 322 case LTE: 323 jj_consume_token(LTE); 324 LessThanEqualOperator jjtn003 = new LessThanEqualOperator(JJTLESSTHANEQUALOPERATOR); 325 boolean jjtc003 = true; 326 jjtree.openNodeScope(jjtn003); 327 jjtreeOpenNodeScope(jjtn003); 328 try { 329 AdditiveExpr(); 330 } catch (Throwable jjte003) { 331 if (jjtc003) { 332 jjtree.clearNodeScope(jjtn003); 333 jjtc003 = false; 334 } else { 335 jjtree.popNode(); 336 } 337 if (jjte003 instanceof RuntimeException) { 338 {if (true) throw (RuntimeException)jjte003;} 339 } 340 if (jjte003 instanceof ParseException) { 341 {if (true) throw (ParseException)jjte003;} 342 } 343 {if (true) throw (Error)jjte003;} 344 } finally { 345 if (jjtc003) { 346 jjtree.closeNodeScope(jjtn003, 2); 347 jjtreeCloseNodeScope(jjtn003); 348 } 349 } 350 break; 351 case GTE: 352 jj_consume_token(GTE); 353 GreaterThanEqualOperator jjtn004 = new GreaterThanEqualOperator(JJTGREATERTHANEQUALOPERATOR); 354 boolean jjtc004 = true; 355 jjtree.openNodeScope(jjtn004); 356 jjtreeOpenNodeScope(jjtn004); 357 try { 358 AdditiveExpr(); 359 } catch (Throwable jjte004) { 360 if (jjtc004) { 361 jjtree.clearNodeScope(jjtn004); 362 jjtc004 = false; 363 } else { 364 jjtree.popNode(); 365 } 366 if (jjte004 instanceof RuntimeException) { 367 {if (true) throw (RuntimeException)jjte004;} 368 } 369 if (jjte004 instanceof ParseException) { 370 {if (true) throw (ParseException)jjte004;} 371 } 372 {if (true) throw (Error)jjte004;} 373 } finally { 374 if (jjtc004) { 375 jjtree.closeNodeScope(jjtn004, 2); 376 jjtreeCloseNodeScope(jjtn004); 377 } 378 } 379 break; 380 default: 381 jj_la1[5] = jj_gen; 382 jj_consume_token(-1); 383 throw new ParseException(); 384 } 385 } 386 } 387 388 389 final public void AdditiveExpr() throws ParseException { 390 MultiplicativeExpr(); 391 label_5: 392 while (true) { 393 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 394 case PLUS: 395 case MINUS: 396 ; 397 break; 398 default: 399 jj_la1[6] = jj_gen; 400 break label_5; 401 } 402 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 403 case PLUS: 404 jj_consume_token(PLUS); 405 AdditionOperator jjtn001 = new AdditionOperator(JJTADDITIONOPERATOR); 406 boolean jjtc001 = true; 407 jjtree.openNodeScope(jjtn001); 408 jjtreeOpenNodeScope(jjtn001); 409 try { 410 MultiplicativeExpr(); 411 } catch (Throwable jjte001) { 412 if (jjtc001) { 413 jjtree.clearNodeScope(jjtn001); 414 jjtc001 = false; 415 } else { 416 jjtree.popNode(); 417 } 418 if (jjte001 instanceof RuntimeException) { 419 {if (true) throw (RuntimeException)jjte001;} 420 } 421 if (jjte001 instanceof ParseException) { 422 {if (true) throw (ParseException)jjte001;} 423 } 424 {if (true) throw (Error)jjte001;} 425 } finally { 426 if (jjtc001) { 427 jjtree.closeNodeScope(jjtn001, 2); 428 jjtreeCloseNodeScope(jjtn001); 429 } 430 } 431 break; 432 case MINUS: 433 jj_consume_token(MINUS); 434 SubtractionOperator jjtn002 = new SubtractionOperator(JJTSUBTRACTIONOPERATOR); 435 boolean jjtc002 = true; 436 jjtree.openNodeScope(jjtn002); 437 jjtreeOpenNodeScope(jjtn002); 438 try { 439 MultiplicativeExpr(); 440 } catch (Throwable jjte002) { 441 if (jjtc002) { 442 jjtree.clearNodeScope(jjtn002); 443 jjtc002 = false; 444 } else { 445 jjtree.popNode(); 446 } 447 if (jjte002 instanceof RuntimeException) { 448 {if (true) throw (RuntimeException)jjte002;} 449 } 450 if (jjte002 instanceof ParseException) { 451 {if (true) throw (ParseException)jjte002;} 452 } 453 {if (true) throw (Error)jjte002;} 454 } finally { 455 if (jjtc002) { 456 jjtree.closeNodeScope(jjtn002, 2); 457 jjtreeCloseNodeScope(jjtn002); 458 } 459 } 460 break; 461 default: 462 jj_la1[7] = jj_gen; 463 jj_consume_token(-1); 464 throw new ParseException(); 465 } 466 } 467 } 468 469 470 final public void MultiplicativeExpr() throws ParseException { 471 UnaryExpr(); 472 label_6: 473 while (true) { 474 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 475 case DIV: 476 case MULT: 477 case MOD: 478 ; 479 break; 480 default: 481 jj_la1[8] = jj_gen; 482 break label_6; 483 } 484 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 485 case MULT: 486 jj_consume_token(MULT); 487 MultiplicationOperator jjtn001 = new MultiplicationOperator(JJTMULTIPLICATIONOPERATOR); 488 boolean jjtc001 = true; 489 jjtree.openNodeScope(jjtn001); 490 jjtreeOpenNodeScope(jjtn001); 491 try { 492 UnaryExpr(); 493 } catch (Throwable jjte001) { 494 if (jjtc001) { 495 jjtree.clearNodeScope(jjtn001); 496 jjtc001 = false; 497 } else { 498 jjtree.popNode(); 499 } 500 if (jjte001 instanceof RuntimeException) { 501 {if (true) throw (RuntimeException)jjte001;} 502 } 503 if (jjte001 instanceof ParseException) { 504 {if (true) throw (ParseException)jjte001;} 505 } 506 {if (true) throw (Error)jjte001;} 507 } finally { 508 if (jjtc001) { 509 jjtree.closeNodeScope(jjtn001, 2); 510 jjtreeCloseNodeScope(jjtn001); 511 } 512 } 513 break; 514 case DIV: 515 jj_consume_token(DIV); 516 DivisionOperator jjtn002 = new DivisionOperator(JJTDIVISIONOPERATOR); 517 boolean jjtc002 = true; 518 jjtree.openNodeScope(jjtn002); 519 jjtreeOpenNodeScope(jjtn002); 520 try { 521 UnaryExpr(); 522 } catch (Throwable jjte002) { 523 if (jjtc002) { 524 jjtree.clearNodeScope(jjtn002); 525 jjtc002 = false; 526 } else { 527 jjtree.popNode(); 528 } 529 if (jjte002 instanceof RuntimeException) { 530 {if (true) throw (RuntimeException)jjte002;} 531 } 532 if (jjte002 instanceof ParseException) { 533 {if (true) throw (ParseException)jjte002;} 534 } 535 {if (true) throw (Error)jjte002;} 536 } finally { 537 if (jjtc002) { 538 jjtree.closeNodeScope(jjtn002, 2); 539 jjtreeCloseNodeScope(jjtn002); 540 } 541 } 542 break; 543 case MOD: 544 jj_consume_token(MOD); 545 ModulusOperator jjtn003 = new ModulusOperator(JJTMODULUSOPERATOR); 546 boolean jjtc003 = true; 547 jjtree.openNodeScope(jjtn003); 548 jjtreeOpenNodeScope(jjtn003); 549 try { 550 UnaryExpr(); 551 } catch (Throwable jjte003) { 552 if (jjtc003) { 553 jjtree.clearNodeScope(jjtn003); 554 jjtc003 = false; 555 } else { 556 jjtree.popNode(); 557 } 558 if (jjte003 instanceof RuntimeException) { 559 {if (true) throw (RuntimeException)jjte003;} 560 } 561 if (jjte003 instanceof ParseException) { 562 {if (true) throw (ParseException)jjte003;} 563 } 564 {if (true) throw (Error)jjte003;} 565 } finally { 566 if (jjtc003) { 567 jjtree.closeNodeScope(jjtn003, 2); 568 jjtreeCloseNodeScope(jjtn003); 569 } 570 } 571 break; 572 default: 573 jj_la1[9] = jj_gen; 574 jj_consume_token(-1); 575 throw new ParseException(); 576 } 577 } 578 } 579 580 581 final public void UnaryExpr() throws ParseException { 582 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 583 case LIST_BEGIN: 584 case FUNCTION_BEGIN: 585 case 29: 586 case 30: 587 case 31: 588 case 32: 589 case 33: 590 case 34: 591 case 35: 592 case 36: 593 case 37: 594 case 38: 595 case 39: 596 case 40: 597 case 41: 598 case 42: 599 case 43: 600 case 44: 601 case 45: 602 case 46: 603 case 47: 604 case 48: 605 case 49: 606 case 50: 607 case 51: 608 case 52: 609 case 53: 610 case 54: 611 case 55: 612 case 56: 613 case 57: 614 case SCOPE_LIMIT_NAME: 615 case BOOLEAN_LITERAL: 616 case STRING_LITERAL: 617 case NUMBER_LITERAL: 618 case IDENTIFIER: 619 UnionExpr(); 620 break; 621 case MINUS: 622 jj_consume_token(MINUS); 623 UnaryExpr(); 624 break; 625 default: 626 jj_la1[10] = jj_gen; 627 jj_consume_token(-1); 628 throw new ParseException(); 629 } 630 } 631 632 633 final public void UnionExpr() throws ParseException { 634 IntrospectiveExpr(); 635 label_7: 636 while (true) { 637 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 638 case UNION: 639 ; 640 break; 641 default: 642 jj_la1[11] = jj_gen; 643 break label_7; 644 } 645 jj_consume_token(UNION); 646 UnionOperator jjtn001 = new UnionOperator(JJTUNIONOPERATOR); 647 boolean jjtc001 = true; 648 jjtree.openNodeScope(jjtn001); 649 jjtreeOpenNodeScope(jjtn001); 650 try { 651 IntrospectiveExpr(); 652 } catch (Throwable jjte001) { 653 if (jjtc001) { 654 jjtree.clearNodeScope(jjtn001); 655 jjtc001 = false; 656 } else { 657 jjtree.popNode(); 658 } 659 if (jjte001 instanceof RuntimeException) { 660 {if (true) throw (RuntimeException)jjte001;} 661 } 662 if (jjte001 instanceof ParseException) { 663 {if (true) throw (ParseException)jjte001;} 664 } 665 {if (true) throw (Error)jjte001;} 666 } finally { 667 if (jjtc001) { 668 jjtree.closeNodeScope(jjtn001, 2); 669 jjtreeCloseNodeScope(jjtn001); 670 } 671 } 672 } 673 } 674 675 676 final public void IntrospectiveExpr() throws ParseException { 677 PathExpr(); 678 label_8: 679 while (true) { 680 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 681 case INTROSPECT: 682 ; 683 break; 684 default: 685 jj_la1[12] = jj_gen; 686 break label_8; 687 } 688 jj_consume_token(INTROSPECT); 689 IntrospectionOperator jjtn001 = new IntrospectionOperator(JJTINTROSPECTIONOPERATOR); 690 boolean jjtc001 = true; 691 jjtree.openNodeScope(jjtn001); 692 jjtreeOpenNodeScope(jjtn001); 693 try { 694 PathExpr(); 695 } catch (Throwable jjte001) { 696 if (jjtc001) { 697 jjtree.clearNodeScope(jjtn001); 698 jjtc001 = false; 699 } else { 700 jjtree.popNode(); 701 } 702 if (jjte001 instanceof RuntimeException) { 703 {if (true) throw (RuntimeException)jjte001;} 704 } 705 if (jjte001 instanceof ParseException) { 706 {if (true) throw (ParseException)jjte001;} 707 } 708 {if (true) throw (Error)jjte001;} 709 } finally { 710 if (jjtc001) { 711 jjtree.closeNodeScope(jjtn001, 2); 712 jjtreeCloseNodeScope(jjtn001); 713 } 714 } 715 } 716 } 717 718 719 final public void PathExpr() throws ParseException { 720 FilterExpr(); 721 } 722 723 724 final public void FilterExpr() throws ParseException { 725 PrimaryExpr(); 726 label_9: 727 while (true) { 728 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 729 case PREDICATE_BEGIN: 730 ; 731 break; 732 default: 733 jj_la1[13] = jj_gen; 734 break label_9; 735 } 736 FilterOperator jjtn001 = new FilterOperator(JJTFILTEROPERATOR); 737 boolean jjtc001 = true; 738 jjtree.openNodeScope(jjtn001); 739 jjtreeOpenNodeScope(jjtn001); 740 try { 741 Predicate(); 742 } catch (Throwable jjte001) { 743 if (jjtc001) { 744 jjtree.clearNodeScope(jjtn001); 745 jjtc001 = false; 746 } else { 747 jjtree.popNode(); 748 } 749 if (jjte001 instanceof RuntimeException) { 750 {if (true) throw (RuntimeException)jjte001;} 751 } 752 if (jjte001 instanceof ParseException) { 753 {if (true) throw (ParseException)jjte001;} 754 } 755 {if (true) throw (Error)jjte001;} 756 } finally { 757 |