| 1 16 17 package org.apache.commons.jexl.parser; 18 19 import java.io.Reader ; 20 21 public class Parserimplements ParserTreeConstants, ParserConstants { 22 protected JJTParserState jjtree = new JJTParserState(); 23 24 public SimpleNode parse(Reader reader) throws Exception { 25 ReInit(reader); 26 27 31 32 SimpleNode tree = JexlScript(); 33 return tree; 34 } 35 36 39 public final SimpleNode JexlScript() throws ParseException { 40 41 ASTJexlScript jjtn000 = new ASTJexlScript(this, JJTJEXLSCRIPT); 42 boolean jjtc000 = true; 43 jjtree.openNodeScope(jjtn000); 44 String name; 45 try { 46 label_1: while (true) { 47 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { 48 case INTEGER_LITERAL: 49 case FLOAT_LITERAL: 50 case 9: 51 case 11: 52 case 12: 53 case 14: 54 case 36: 55 case 42: 56 case 43: 57 case 44: 58 case 45: 59 case 46: 60 case 47: 61 case 48: 62 case 49: 63 case 51: 64 case 52: 65 case IDENTIFIER: 66 case STRING_LITERAL: 67 ; 68 break; 69 default: 70 jj_la1[0] = jj_gen; 71 break label_1; 72 } 73 Statement(); 74 } 75 jj_consume_token(0); 76 jjtree.closeNodeScope(jjtn000, true); 77 jjtc000 = false; 78 { 79 if (true) 80 return jjtn000; 81 } 82 } catch (Throwable jjte000) { 83 if (jjtc000) { 84 jjtree.clearNodeScope(jjtn000); 85 jjtc000 = false; 86 } else { 87 jjtree.popNode(); 88 } 89 if (jjte000 instanceof RuntimeException ) { 90 { 91 if (true) 92 throw (RuntimeException ) jjte000; 93 } 94 } 95 if (jjte000 instanceof ParseException) { 96 { 97 if (true) 98 throw (ParseException) jjte000; 99 } 100 } 101 { 102 if (true) 103 throw (Error ) jjte000; 104 } 105 } finally { 106 if (jjtc000) { 107 jjtree.closeNodeScope(jjtn000, true); 108 } 109 } 110 throw new Error ("Missing return statement in function"); 111 } 112 113 final public void Block() throws ParseException { 114 115 ASTBlock jjtn000 = new ASTBlock(this, JJTBLOCK); 116 boolean jjtc000 = true; 117 jjtree.openNodeScope(jjtn000); 118 try { 119 jj_consume_token(9); 120 label_2: while (true) { 121 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { 122 case INTEGER_LITERAL: 123 case FLOAT_LITERAL: 124 case 9: 125 case 11: 126 case 12: 127 case 14: 128 case 36: 129 case 42: 130 case 43: 131 case 44: 132 case 45: 133 case 46: 134 case 47: 135 case 48: 136 case 49: 137 case 51: 138 case 52: 139 case IDENTIFIER: 140 case STRING_LITERAL: 141 ; 142 break; 143 default: 144 jj_la1[1] = jj_gen; 145 break label_2; 146 } 147 Statement(); 148 } 149 jj_consume_token(10); 150 } catch (Throwable jjte000) { 151 if (jjtc000) { 152 jjtree.clearNodeScope(jjtn000); 153 jjtc000 = false; 154 } else { 155 jjtree.popNode(); 156 } 157 if (jjte000 instanceof RuntimeException ) { 158 { 159 if (true) 160 throw (RuntimeException ) jjte000; 161 } 162 } 163 if (jjte000 instanceof ParseException) { 164 { 165 if (true) 166 throw (ParseException) jjte000; 167 } 168 } 169 { 170 if (true) 171 throw (Error ) jjte000; 172 } 173 } finally { 174 if (jjtc000) { 175 jjtree.closeNodeScope(jjtn000, true); 176 } 177 } 178 } 179 180 final public void EmptyFunction() throws ParseException { 181 182 ASTEmptyFunction jjtn000 = new ASTEmptyFunction(this, JJTEMPTYFUNCTION); 183 boolean jjtc000 = true; 184 jjtree.openNodeScope(jjtn000); 185 try { 186 jj_consume_token(11); 187 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { 188 case IDENTIFIER: 189 Reference(); 190 break; 191 case 12: 192 jj_consume_token(12); 193 Reference(); 194 jj_consume_token(13); 195 break; 196 default: 197 jj_la1[2] = jj_gen; 198 jj_consume_token(-1); 199 throw new ParseException(); 200 } 201 } catch (Throwable jjte000) { 202 if (jjtc000) { 203 jjtree.clearNodeScope(jjtn000); 204 jjtc000 = false; 205 } else { 206 jjtree.popNode(); 207 } 208 if (jjte000 instanceof RuntimeException ) { 209 { 210 if (true) 211 throw (RuntimeException ) jjte000; 212 } 213 } 214 if (jjte000 instanceof ParseException) { 215 { 216 if (true) 217 throw (ParseException) jjte000; 218 } 219 } 220 { 221 if (true) 222 throw (Error ) jjte000; 223 } 224 } finally { 225 if (jjtc000) { 226 jjtree.closeNodeScope(jjtn000, true); 227 } 228 } 229 } 230 231 final public void SizeFunction() throws ParseException { 232 233 ASTSizeFunction jjtn000 = new ASTSizeFunction(this, JJTSIZEFUNCTION); 234 boolean jjtc000 = true; 235 jjtree.openNodeScope(jjtn000); 236 try { 237 jj_consume_token(14); 238 jj_consume_token(12); 239 Reference(); 240 jj_consume_token(13); 241 } catch (Throwable jjte000) { 242 if (jjtc000) { 243 jjtree.clearNodeScope(jjtn000); 244 jjtc000 = false; 245 } else { 246 jjtree.popNode(); 247 } 248 if (jjte000 instanceof RuntimeException ) { 249 { 250 if (true) 251 throw (RuntimeException ) jjte000; 252 } 253 } 254 if (jjte000 instanceof ParseException) { 255 { 256 if (true) 257 throw (ParseException) jjte000; 258 } 259 } 260 { 261 if (true) 262 throw (Error ) jjte000; 263 } 264 } finally { 265 if (jjtc000) { 266 jjtree.closeNodeScope(jjtn000, true); 267 } 268 } 269 } 270 271 final public void Identifier() throws ParseException { 272 273 ASTIdentifier jjtn000 = new ASTIdentifier(this, JJTIDENTIFIER); 274 boolean jjtc000 = true; 275 jjtree.openNodeScope(jjtn000); 276 Token t; 277 try { 278 t = jj_consume_token(IDENTIFIER); 279 jjtree.closeNodeScope(jjtn000, true); 280 jjtc000 = false; 281 jjtn000.val = t.image; 282 } finally { 283 if (jjtc000) { 284 jjtree.closeNodeScope(jjtn000, true); 285 } 286 } 287 } 288 289 292 final public void Expression() throws ParseException { 293 294 ASTExpression jjtn000 = new ASTExpression(this, JJTEXPRESSION); 295 boolean jjtc000 = true; 296 jjtree.openNodeScope(jjtn000); 297 try { 298 if (jj_2_1(2147483647)) { 299 Assignment(); 300 } else { 301 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { 302 case INTEGER_LITERAL: 303 case FLOAT_LITERAL: 304 case 11: 305 case 12: 306 case 14: 307 case 36: 308 case 42: 309 case 43: 310 case 44: 311 case 45: 312 case 46: 313 case 47: 314 case IDENTIFIER: 315 case STRING_LITERAL: 316 ConditionalOrExpression(); 317 break; 318 default: 319 jj_la1[3] = jj_gen; 320 jj_consume_token(-1); 321 throw new ParseException(); 322 } 323 } 324 } catch (Throwable jjte000) { 325 if (jjtc000) { 326 jjtree.clearNodeScope(jjtn000); 327 jjtc000 = false; 328 } else { 329 jjtree.popNode(); 330 } 331 if (jjte000 instanceof RuntimeException ) { 332 { 333 if (true) 334 throw (RuntimeException ) jjte000; 335 } 336 } 337 if (jjte000 instanceof ParseException) { 338 { 339 if (true) 340 throw (ParseException) jjte000; 341 } 342 } 343 { 344 if (true) 345 throw (Error ) jjte000; 346 } 347 } finally { 348 if (jjtc000) { 349 jjtree.closeNodeScope(jjtn000, true); 350 } 351 } 352 } 353 354 final public void Assignment() throws ParseException { 355 356 ASTAssignment jjtn000 = new ASTAssignment(this, JJTASSIGNMENT); 357 boolean jjtc000 = true; 358 jjtree.openNodeScope(jjtn000); 359 try { 360 PrimaryExpression(); 361 jj_consume_token(15); 362 Expression(); 363 } catch (Throwable jjte000) { 364 if (jjtc000) { 365 jjtree.clearNodeScope(jjtn000); 366 jjtc000 = false; 367 } else { 368 jjtree.popNode(); 369 } 370 if (jjte000 instanceof RuntimeException ) { 371 { 372 if (true) 373 throw (RuntimeException ) jjte000; 374 } 375 } 376 if (jjte000 instanceof ParseException) { 377 { 378 if (true) 379 throw (ParseException) jjte000; 380 } 381 } 382 { 383 if (true) 384 throw (Error ) jjte000; 385 } 386 } finally { 387 if (jjtc000) { 388 jjtree.closeNodeScope(jjtn000, 2); 389 } 390 } 391 } 392 393 final public void ConditionalOrExpression() throws ParseException { 394 ConditionalAndExpression(); 395 label_3: while (true) { 396 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { 397 case 16: 398 case 17: 399 ; 400 break; 401 default: 402 jj_la1[4] = jj_gen; 403 break label_3; 404 } 405 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { 406 case 16: 407 jj_consume_token(16); 408 ASTOrNode jjtn001 = new ASTOrNode(this, JJTORNODE); 409 boolean jjtc001 = true; 410 jjtree.openNodeScope(jjtn001); 411 try { 412 ConditionalAndExpression(); 413 } catch (Throwable jjte001) { 414 if (jjtc001) { 415 jjtree.clearNodeScope(jjtn001); 416 jjtc001 = false; 417 } else { 418 jjtree.popNode(); 419 } 420 if (jjte001 instanceof RuntimeException ) { 421 { 422 if (true) 423 throw (RuntimeException ) jjte001; 424 } 425 } 426 if (jjte001 instanceof ParseException) { 427 { 428 if (true) 429 throw (ParseException) jjte001; 430 } 431 } 432 { 433 if (true) 434 throw (Error ) jjte001; 435 } 436 } finally { 437 if (jjtc001) { 438 jjtree.closeNodeScope(jjtn001, 2); 439 } 440 } 441 break; 442 case 17: 443 jj_consume_token(17); 444 ASTOrNode jjtn002 = new ASTOrNode(this, JJTORNODE); 445 boolean jjtc002 = true; 446 jjtree.openNodeScope(jjtn002); 447 try { 448 ConditionalAndExpression(); 449 } catch (Throwable jjte002) { 450 if (jjtc002) { 451 jjtree.clearNodeScope(jjtn002); 452 jjtc002 = false; 453 } else { 454 jjtree.popNode(); 455 } 456 if (jjte002 instanceof RuntimeException ) { 457 { 458 if (true) 459 throw (RuntimeException ) jjte002; 460 } 461 } 462 if (jjte002 instanceof ParseException) { 463 { 464 if (true) 465 throw (ParseException) jjte002; 466 } 467 } 468 { 469 if (true) 470 throw (Error ) jjte002; 471 } 472 } finally { 473 if (jjtc002) { 474 jjtree.closeNodeScope(jjtn002, 2); 475 } 476 } 477 break; 478 default: 479 jj_la1[5] = jj_gen; 480 jj_consume_token(-1); 481 throw new ParseException(); 482 } 483 } 484 } 485 486 final public void ConditionalAndExpression() throws ParseException { 487 InclusiveOrExpression(); 488 label_4: while (true) { 489 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { 490 case 18: 491 case 19: 492 ; 493 break; 494 default: 495 jj_la1[6] = jj_gen; 496 break label_4; 497 } 498 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { 499 case 18: 500 jj_consume_token(18); 501 ASTAndNode jjtn001 = new ASTAndNode(this, JJTANDNODE); 502 boolean jjtc001 = true; 503 jjtree.openNodeScope(jjtn001); 504 try { 505 InclusiveOrExpression(); 506 } catch (Throwable jjte001) { 507 if (jjtc001) { 508 jjtree.clearNodeScope(jjtn001); 509 jjtc001 = false; 510 } else { 511 jjtree.popNode(); 512 } 513 if (jjte001 instanceof RuntimeException ) { 514 { 515 if (true) 516 throw (RuntimeException ) jjte001; 517 } 518 } 519 if (jjte001 instanceof ParseException) { 520 { 521 if (true) 522 throw (ParseException) jjte001; 523 } 524 } 525 { 526 if (true) 527 throw (Error ) jjte001; 528 } 529 } finally { 530 if (jjtc001) { 531 jjtree.closeNodeScope(jjtn001, 2); 532 } 533 } 534 break; 535 case 19: 536 jj_consume_token(19); 537 ASTAndNode jjtn002 = new ASTAndNode(this, JJTANDNODE); 538 boolean jjtc002 = true; 539 jjtree.openNodeScope(jjtn002); 540 try { 541 InclusiveOrExpression(); 542 } catch (Throwable jjte002) { 543 if (jjtc002) { 544 jjtree.clearNodeScope(jjtn002); 545 jjtc002 = false; 546 } else { 547 jjtree.popNode(); 548 } 549 if (jjte002 instanceof RuntimeException ) { 550 { 551 if (true) 552 throw (RuntimeException ) jjte002; 553 } 554 } 555 if (jjte002 instanceof ParseException) { 556 { 557 if (true) 558 throw (ParseException) jjte002; 559 } 560 } 561 { 562 if (true) 563 throw (Error ) jjte002; 564 } 565 } finally { 566 if (jjtc002) { 567 jjtree.closeNodeScope(jjtn002, 2); 568 } 569 } 570 break; 571 default: 572 jj_la1[7] = jj_gen; 573 jj_consume_token(-1); 574 throw new ParseException(); 575 } 576 } 577 } 578 579 final public void InclusiveOrExpression() throws ParseException { 580 ExclusiveOrExpression(); 581 label_5: while (true) { 582 switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { 583 case 20: 584 ; 585 break; 586 default: 587 jj_la1[8] = jj_gen; 588 break label_5; 589 } 590 jj_consume_token(20); 591 ASTBitwiseOrNode jjtn001 = new ASTBitwiseOrNode(this, JJTBITWISEORNODE); 592 boolean jjtc001 = true; 593 jjtree.openNodeScope(jjtn001); 594 try { 595 ExclusiveOrExpression(); 596 } catch (Throwable jjte001) { 597 if (jjtc001) { 598 jjtree.clearNodeScope(jjtn001); 599 jjtc001 = false; 600 } else { 601 jjtree.popNode(); 602 } 603 if (jjte001 instanceof RuntimeException ) { 604 { 605 if (true) 606 throw (RuntimeException ) jjte001; 607 } 608 } 609 if (jjte001 instanceof ParseException) { 610 { 611 if (true) 612 throw (ParseException) jjte001; 613 } 614 } 615 { 616 if (true) 617 &n
|