1 /* 2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package jdk.nashorn.internal.ir.visitor; 27 28 import jdk.nashorn.internal.ir.BinaryNode; 29 import jdk.nashorn.internal.ir.LexicalContext; 30 import jdk.nashorn.internal.ir.Node; 31 import jdk.nashorn.internal.ir.UnaryNode; 32 33 /** 34 * Like NodeVisitor but navigating further into operators. 35 * @param <T> Lexical context class for this NodeOperatorVisitor 36 */ 37 public abstract class NodeOperatorVisitor<T extends LexicalContext> extends NodeVisitor<T> { 38 /** 39 * Constructor 40 * 41 * @param lc a custom lexical context 42 */ 43 public NodeOperatorVisitor(final T lc) { 44 super(lc); 45 } 46 47 @Override 48 public final boolean enterUnaryNode(final UnaryNode unaryNode) { 49 switch (unaryNode.tokenType()) { 50 case ADD: 51 return enterADD(unaryNode); 52 case BIT_NOT: 53 return enterBIT_NOT(unaryNode); 54 case DELETE: 55 return enterDELETE(unaryNode); 56 case NEW: 57 return enterNEW(unaryNode); 58 case NOT: 59 return enterNOT(unaryNode); 60 case SUB: 61 return enterSUB(unaryNode); 62 case TYPEOF: 63 return enterTYPEOF(unaryNode); 64 case VOID: 65 return enterVOID(unaryNode); 66 case DECPREFIX: 67 case DECPOSTFIX: 68 case INCPREFIX: 69 case INCPOSTFIX: 70 return enterDECINC(unaryNode); 71 default: 72 return super.enterUnaryNode(unaryNode); 73 } 74 } 75 76 @Override 77 public final Node leaveUnaryNode(final UnaryNode unaryNode) { 78 switch (unaryNode.tokenType()) { 79 case ADD: 80 return leaveADD(unaryNode); 81 case BIT_NOT: 82 return leaveBIT_NOT(unaryNode); 83 case DELETE: 84 return leaveDELETE(unaryNode); 85 case NEW: 86 return leaveNEW(unaryNode); 87 case NOT: 88 return leaveNOT(unaryNode); 89 case SUB: 90 return leaveSUB(unaryNode); 91 case TYPEOF: 92 return leaveTYPEOF(unaryNode); 93 case VOID: 94 return leaveVOID(unaryNode); 95 case DECPREFIX: 96 case DECPOSTFIX: 97 case INCPREFIX: 98 case INCPOSTFIX: 99 return leaveDECINC(unaryNode); 100 default: 101 return super.leaveUnaryNode(unaryNode); 102 } 103 } 104 105 @Override 106 public final boolean enterBinaryNode(final BinaryNode binaryNode) { 107 switch (binaryNode.tokenType()) { 108 case ADD: 109 return enterADD(binaryNode); 110 case AND: 111 return enterAND(binaryNode); 112 case ASSIGN: 113 return enterASSIGN(binaryNode); 114 case ASSIGN_ADD: 115 return enterASSIGN_ADD(binaryNode); 116 case ASSIGN_BIT_AND: 117 return enterASSIGN_BIT_AND(binaryNode); 118 case ASSIGN_BIT_OR: 119 return enterASSIGN_BIT_OR(binaryNode); 120 case ASSIGN_BIT_XOR: 121 return enterASSIGN_BIT_XOR(binaryNode); 122 case ASSIGN_DIV: 123 return enterASSIGN_DIV(binaryNode); 124 case ASSIGN_MOD: 125 return enterASSIGN_MOD(binaryNode); 126 case ASSIGN_MUL: 127 return enterASSIGN_MUL(binaryNode); 128 case ASSIGN_SAR: 129 return enterASSIGN_SAR(binaryNode); 130 case ASSIGN_SHL: 131 return enterASSIGN_SHL(binaryNode); 132 case ASSIGN_SHR: 133 return enterASSIGN_SHR(binaryNode); 134 case ASSIGN_SUB: 135 return enterASSIGN_SUB(binaryNode); 136 case BIND: 137 return enterBIND(binaryNode); 138 case BIT_AND: 139 return enterBIT_AND(binaryNode); 140 case BIT_OR: 141 return enterBIT_OR(binaryNode); 142 case BIT_XOR: 143 return enterBIT_XOR(binaryNode); 144 case COMMARIGHT: 145 return enterCOMMARIGHT(binaryNode); 146 case COMMALEFT: 147 return enterCOMMALEFT(binaryNode); 148 case DIV: 149 return enterDIV(binaryNode); 150 case EQ: 151 return enterEQ(binaryNode); 152 case EQ_STRICT: 153 return enterEQ_STRICT(binaryNode); 154 case GE: 155 return enterGE(binaryNode); 156 case GT: 157 return enterGT(binaryNode); 158 case IN: 159 return enterIN(binaryNode); 160 case INSTANCEOF: 161 return enterINSTANCEOF(binaryNode); 162 case LE: 163 return enterLE(binaryNode); 164 case LT: 165 return enterLT(binaryNode); 166 case MOD: 167 return enterMOD(binaryNode); 168 case MUL: 169 return enterMUL(binaryNode); 170 case NE: 171 return enterNE(binaryNode); 172 case NE_STRICT: 173 return enterNE_STRICT(binaryNode); 174 case OR: 175 return enterOR(binaryNode); 176 case SAR: 177 return enterSAR(binaryNode); 178 case SHL: 179 return enterSHL(binaryNode); 180 case SHR: 181 return enterSHR(binaryNode); 182 case SUB: 183 return enterSUB(binaryNode); 184 default: 185 return super.enterBinaryNode(binaryNode); 186 } 187 } 188 189 @Override 190 public final Node leaveBinaryNode(final BinaryNode binaryNode) { 191 switch (binaryNode.tokenType()) { 192 case ADD: 193 return leaveADD(binaryNode); 194 case AND: 195 return leaveAND(binaryNode); 196 case ASSIGN: 197 return leaveASSIGN(binaryNode); 198 case ASSIGN_ADD: 199 return leaveASSIGN_ADD(binaryNode); 200 case ASSIGN_BIT_AND: 201 return leaveASSIGN_BIT_AND(binaryNode); 202 case ASSIGN_BIT_OR: 203 return leaveASSIGN_BIT_OR(binaryNode); 204 case ASSIGN_BIT_XOR: 205 return leaveASSIGN_BIT_XOR(binaryNode); 206 case ASSIGN_DIV: 207 return leaveASSIGN_DIV(binaryNode); 208 case ASSIGN_MOD: 209 return leaveASSIGN_MOD(binaryNode); 210 case ASSIGN_MUL: 211 return leaveASSIGN_MUL(binaryNode); 212 case ASSIGN_SAR: 213 return leaveASSIGN_SAR(binaryNode); 214 case ASSIGN_SHL: 215 return leaveASSIGN_SHL(binaryNode); 216 case ASSIGN_SHR: 217 return leaveASSIGN_SHR(binaryNode); 218 case ASSIGN_SUB: 219 return leaveASSIGN_SUB(binaryNode); 220 case BIND: 221 return leaveBIND(binaryNode); 222 case BIT_AND: 223 return leaveBIT_AND(binaryNode); 224 case BIT_OR: 225 return leaveBIT_OR(binaryNode); 226 case BIT_XOR: 227 return leaveBIT_XOR(binaryNode); 228 case COMMARIGHT: 229 return leaveCOMMARIGHT(binaryNode); 230 case COMMALEFT: 231 return leaveCOMMALEFT(binaryNode); 232 case DIV: 233 return leaveDIV(binaryNode); 234 case EQ: 235 return leaveEQ(binaryNode); 236 case EQ_STRICT: 237 return leaveEQ_STRICT(binaryNode); 238 case GE: 239 return leaveGE(binaryNode); 240 case GT: 241 return leaveGT(binaryNode); 242 case IN: 243 return leaveIN(binaryNode); 244 case INSTANCEOF: 245 return leaveINSTANCEOF(binaryNode); 246 case LE: 247 return leaveLE(binaryNode); 248 case LT: 249 return leaveLT(binaryNode); 250 case MOD: 251 return leaveMOD(binaryNode); 252 case MUL: 253 return leaveMUL(binaryNode); 254 case NE: 255 return leaveNE(binaryNode); 256 case NE_STRICT: 257 return leaveNE_STRICT(binaryNode); 258 case OR: 259 return leaveOR(binaryNode); 260 case SAR: 261 return leaveSAR(binaryNode); 262 case SHL: 263 return leaveSHL(binaryNode); 264 case SHR: 265 return leaveSHR(binaryNode); 266 case SUB: 267 return leaveSUB(binaryNode); 268 default: 269 return super.leaveBinaryNode(binaryNode); 270 } 271 } 272 273 /* 274 * Unary entries and exists. 275 */ 276 277 /** 278 * Unary enter - callback for entering a unary + 279 * 280 * @param unaryNode the node 281 * @return true if traversal should continue and node children be traversed, false otherwise 282 */ 283 public boolean enterADD(final UnaryNode unaryNode) { 284 return enterDefault(unaryNode); 285 } 286 287 /** 288 * Unary leave - callback for leaving a unary + 289 * 290 * @param unaryNode the node 291 * @return processed node, which will replace the original one, or the original node 292 */ 293 public Node leaveADD(final UnaryNode unaryNode) { 294 return leaveDefault(unaryNode); 295 } 296 297 /** 298 * Unary enter - callback for entering a ~ operator 299 * 300 * @param unaryNode the node 301 * @return true if traversal should continue and node children be traversed, false otherwise 302 */ 303 public boolean enterBIT_NOT(final UnaryNode unaryNode) { 304 return enterDefault(unaryNode); 305 } 306 307 /** 308 * Unary leave - callback for leaving a unary ~ 309 * 310 * @param unaryNode the node 311 * @return processed node, which will replace the original one, or the original node 312 */ 313 public Node leaveBIT_NOT(final UnaryNode unaryNode) { 314 return leaveDefault(unaryNode); 315 } 316 317 /** 318 * Unary enter - callback for entering a ++ or -- operator 319 * 320 * @param unaryNode the node 321 * @return true if traversal should continue and node children be traversed, false otherwise 322 */ 323 public boolean enterDECINC(final UnaryNode unaryNode) { 324 return enterDefault(unaryNode); 325 } 326 327 /** 328 * Unary leave - callback for leaving a ++ or -- operator 329 * 330 * @param unaryNode the node 331 * @return processed node, which will replace the original one, or the original node 332 */ 333 public Node leaveDECINC(final UnaryNode unaryNode) { 334 return leaveDefault(unaryNode); 335 } 336 337 /** 338 * Unary enter - callback for entering a delete operator 339 * 340 * @param unaryNode the node 341 * @return processed node 342 */ 343 public boolean enterDELETE(final UnaryNode unaryNode) { 344 return enterDefault(unaryNode); 345 } 346 347 /** 348 * Unary leave - callback for leaving a delete operator 349 * 350 * @param unaryNode the node 351 * @return processed node, which will replace the original one, or the original node 352 */ 353 public Node leaveDELETE(final UnaryNode unaryNode) { 354 return leaveDefault(unaryNode); 355 } 356 357 /** 358 * Unary enter - callback for entering a new operator 359 * 360 * @param unaryNode the node 361 * @return true if traversal should continue and node children be traversed, false otherwise 362 */ 363 public boolean enterNEW(final UnaryNode unaryNode) { 364 return enterDefault(unaryNode); 365 } 366 367 /** 368 * Unary leave - callback for leaving a new operator 369 * 370 * @param unaryNode the node 371 * @return processed node, which will replace the original one, or the original node 372 */ 373 public Node leaveNEW(final UnaryNode unaryNode) { 374 return leaveDefault(unaryNode); 375 } 376 377 /** 378 * Unary enter - callback for entering a ! operator 379 * 380 * @param unaryNode the node 381 * @return true if traversal should continue and node children be traversed, false otherwise 382 */ 383 public boolean enterNOT(final UnaryNode unaryNode) { 384 return enterDefault(unaryNode); 385 } 386 387 /** 388 * Unary leave - callback for leaving a ! operator 389 * 390 * @param unaryNode the node 391 * @return processed node, which will replace the original one, or the original node 392 */ 393 public Node leaveNOT(final UnaryNode unaryNode) { 394 return leaveDefault(unaryNode); 395 } 396 397 /** 398 * Unary enter - callback for entering a unary - 399 * 400 * @param unaryNode the node 401 * @return true if traversal should continue and node children be traversed, false otherwise 402 */ 403 public boolean enterSUB(final UnaryNode unaryNode) { 404 return enterDefault(unaryNode); 405 } 406 407 /** 408 * Unary leave - callback for leaving a unary - 409 * 410 * @param unaryNode the node 411 * @return processed node, which will replace the original one, or the original node 412 */ 413 public Node leaveSUB(final UnaryNode unaryNode) { 414 return leaveDefault(unaryNode); 415 } 416 417 /** 418 * Unary enter - callback for entering a typeof 419 * 420 * @param unaryNode the node 421 * @return true if traversal should continue and node children be traversed, false otherwise 422 */ 423 public boolean enterTYPEOF(final UnaryNode unaryNode) { 424 return enterDefault(unaryNode); 425 } 426 427 /** 428 * Unary leave - callback for leaving a typeof operator 429 * 430 * @param unaryNode the node 431 * @return processed node, which will replace the original one, or the original node 432 */ 433 public Node leaveTYPEOF(final UnaryNode unaryNode) { 434 return leaveDefault(unaryNode); 435 } 436 437 /** 438 * Unary enter - callback for entering a void 439 * 440 * @param unaryNode the node 441 * @return true if traversal should continue and node children be traversed, false otherwise 442 */ 443 public boolean enterVOID(final UnaryNode unaryNode) { 444 return enterDefault(unaryNode); 445 } 446 447 /** 448 * Unary leave - callback for leaving a void 449 * 450 * @param unaryNode the node 451 * @return processed node, which will replace the original one, or the original node 452 */ 453 public Node leaveVOID(final UnaryNode unaryNode) { 454 return leaveDefault(unaryNode); 455 } 456 457 /** 458 * Binary enter - callback for entering + operator 459 * 460 * @param binaryNode the node 461 * @return true if traversal should continue and node children be traversed, false otherwise 462 */ 463 public boolean enterADD(final BinaryNode binaryNode) { 464 return enterDefault(binaryNode); 465 } 466 467 /** 468 * Binary leave - callback for leaving a + operator 469 * 470 * @param binaryNode the node 471 * @return processed node, which will replace the original one, or the original node 472 */ 473 public Node leaveADD(final BinaryNode binaryNode) { 474 return leaveDefault(binaryNode); 475 } 476 477 /** 478 * Binary enter - callback for entering {@literal &&} operator 479 * 480 * @param binaryNode the node 481 * @return true if traversal should continue and node children be traversed, false otherwise 482 */ 483 public boolean enterAND(final BinaryNode binaryNode) { 484 return enterDefault(binaryNode); 485 } 486 487 /** 488 * Binary leave - callback for leaving a {@literal &&} operator 489 * 490 * @param binaryNode the node 491 * @return processed node, which will replace the original one, or the original node 492 */ 493 public Node leaveAND(final BinaryNode binaryNode) { 494 return leaveDefault(binaryNode); 495 } 496 497 /** 498 * Binary enter - callback for entering an assignment 499 * 500 * @param binaryNode the node 501 * @return true if traversal should continue and node children be traversed, false otherwise 502 */ 503 public boolean enterASSIGN(final BinaryNode binaryNode) { 504 return enterDefault(binaryNode); 505 } 506 507 /** 508 * Binary leave - callback for leaving an assignment 509 * 510 * @param binaryNode the node 511 * @return processed node, which will replace the original one, or the original node 512 */ 513 public Node leaveASSIGN(final BinaryNode binaryNode) { 514 return leaveDefault(binaryNode); 515 } 516 517 /** 518 * Binary enter - callback for entering += operator 519 * 520 * @param binaryNode the node 521 * @return true if traversal should continue and node children be traversed, false otherwise 522 */ 523 public boolean enterASSIGN_ADD(final BinaryNode binaryNode) { 524 return enterDefault(binaryNode); 525 } 526 527 /** 528 * Binary leave - callback for leaving a += operator 529 * 530 * @param binaryNode the node 531 * @return processed node, which will replace the original one, or the original node 532 */ 533 public Node leaveASSIGN_ADD(final BinaryNode binaryNode) { 534 return leaveDefault(binaryNode); 535 } 536 537 /** 538 * Binary enter - callback for entering {@literal &=} operator 539 * 540 * @param binaryNode the node 541 * @return true if traversal should continue and node children be traversed, false otherwise 542 */ 543 public boolean enterASSIGN_BIT_AND(final BinaryNode binaryNode) { 544 return enterDefault(binaryNode); 545 } 546 547 /** 548 * Binary leave - callback for leaving a {@literal &=} operator 549 * 550 * @param binaryNode the node 551 * @return processed node, which will replace the original one, or the original node 552 */ 553 public Node leaveASSIGN_BIT_AND(final BinaryNode binaryNode) { 554 return leaveDefault(binaryNode); 555 } 556 557 /** 558 * Binary enter - callback for entering |= operator 559 * 560 * @param binaryNode the node 561 * @return true if traversal should continue and node children be traversed, false otherwise 562 */ 563 public boolean enterASSIGN_BIT_OR(final BinaryNode binaryNode) { 564 return enterDefault(binaryNode); 565 } 566 567 /** 568 * Binary leave - callback for leaving a |= operator 569 * 570 * @param binaryNode the node 571 * @return processed node, which will replace the original one, or the original node 572 */ 573 public Node leaveASSIGN_BIT_OR(final BinaryNode binaryNode) { 574 return leaveDefault(binaryNode); 575 } 576 577 /** 578 * Binary enter - callback for entering ^= operator 579 * 580 * @param binaryNode the node 581 * @return true if traversal should continue and node children be traversed, false otherwise 582 */ 583 public boolean enterASSIGN_BIT_XOR(final BinaryNode binaryNode) { 584 return enterDefault(binaryNode); 585 } 586 587 /** 588 * Binary leave - callback for leaving a ^= operator 589 * 590 * @param binaryNode the node 591 * @return processed node, which will replace the original one, or the original node 592 */ 593 public Node leaveASSIGN_BIT_XOR(final BinaryNode binaryNode) { 594 return leaveDefault(binaryNode); 595 } 596 597 /** 598 * Binary enter - callback for entering /= operator 599 * 600 * @param binaryNode the node 601 * @return true if traversal should continue and node children be traversed, false otherwise 602 */ 603 public boolean enterASSIGN_DIV(final BinaryNode binaryNode) { 604 return enterDefault(binaryNode); 605 } 606 607 /** 608 * Binary leave - callback for leaving a /= operator 609 * 610 * @param binaryNode the node 611 * @return processed node, which will replace the original one, or the original node 612 */ 613 public Node leaveASSIGN_DIV(final BinaryNode binaryNode) { 614 return leaveDefault(binaryNode); 615 } 616 617 /** 618 * Binary enter - callback for entering %= operator 619 * 620 * @param binaryNode the node 621 * @return true if traversal should continue and node children be traversed, false otherwise 622 */ 623 public boolean enterASSIGN_MOD(final BinaryNode binaryNode) { 624 return enterDefault(binaryNode); 625 } 626 627 /** 628 * Binary leave - callback for leaving a %= operator 629 * 630 * @param binaryNode the node 631 * @return processed node, which will replace the original one, or the original node 632 */ 633 public Node leaveASSIGN_MOD(final BinaryNode binaryNode) { 634 return leaveDefault(binaryNode); 635 } 636 637 /** 638 * Binary enter - callback for entering *= operator 639 * 640 * @param binaryNode the node 641 * @return true if traversal should continue and node children be traversed, false otherwise 642 */ 643 public boolean enterASSIGN_MUL(final BinaryNode binaryNode) { 644 return enterDefault(binaryNode); 645 } 646 647 /** 648 * Binary leave - callback for leaving a *= operator 649 * 650 * @param binaryNode the node 651 * @return processed node, which will replace the original one, or the original node 652 */ 653 public Node leaveASSIGN_MUL(final BinaryNode binaryNode) { 654 return leaveDefault(binaryNode); 655 } 656 657 /** 658 * Binary enter - callback for entering {@literal >>=} operator 659 * 660 * @param binaryNode the node 661 * @return true if traversal should continue and node children be traversed, false otherwise 662 */ 663 public boolean enterASSIGN_SAR(final BinaryNode binaryNode) { 664 return enterDefault(binaryNode); 665 } 666 667 /** 668 * Binary leave - callback for leaving a {@literal >>=} operator 669 * 670 * @param binaryNode the node 671 * @return processed node, which will replace the original one, or the original node 672 */ 673 public Node leaveASSIGN_SAR(final BinaryNode binaryNode) { 674 return leaveDefault(binaryNode); 675 } 676 677 /** 678 * Binary enter - callback for entering a {@literal <<=} operator 679 * 680 * @param binaryNode the node 681 * @return true if traversal should continue and node children be traversed, false otherwise 682 */ 683 public boolean enterASSIGN_SHL(final BinaryNode binaryNode) { 684 return enterDefault(binaryNode); 685 } 686 687 /** 688 * Binary leave - callback for leaving a {@literal <<=} operator 689 * 690 * @param binaryNode the node 691 * @return processed node, which will replace the original one, or the original node 692 */ 693 public Node leaveASSIGN_SHL(final BinaryNode binaryNode) { 694 return leaveDefault(binaryNode); 695 } 696 697 /** 698 * Binary enter - callback for entering {@literal >>>=} operator 699 * 700 * @param binaryNode the node 701 * @return true if traversal should continue and node children be traversed, false otherwise 702 */ 703 public boolean enterASSIGN_SHR(final BinaryNode binaryNode) { 704 return enterDefault(binaryNode); 705 } 706 707 /** 708 * Binary leave - callback for leaving a {@literal >>>=} operator 709 * 710 * @param binaryNode the node 711 * @return processed node, which will replace the original one, or the original node 712 */ 713 public Node leaveASSIGN_SHR(final BinaryNode binaryNode) { 714 return leaveDefault(binaryNode); 715 } 716 717 /** 718 * Binary enter - callback for entering -= operator 719 * 720 * @param binaryNode the node 721 * @return true if traversal should continue and node children be traversed, false otherwise 722 */ 723 public boolean enterASSIGN_SUB(final BinaryNode binaryNode) { 724 return enterDefault(binaryNode); 725 } 726 727 /** 728 * Binary leave - callback for leaving a -= operator 729 * 730 * @param binaryNode the node 731 * @return processed node, which will replace the original one, or the original node 732 */ 733 public Node leaveASSIGN_SUB(final BinaryNode binaryNode) { 734 return leaveDefault(binaryNode); 735 } 736 737 /** 738 * Binary enter - callback for entering a bind operator 739 * 740 * @param binaryNode the node 741 * @return true if traversal should continue and node children be traversed, false otherwise 742 */ 743 public boolean enterBIND(final BinaryNode binaryNode) { 744 return enterDefault(binaryNode); 745 } 746 747 /** 748 * Binary leave - callback for leaving a bind operator 749 * 750 * @param binaryNode the node 751 * @return processed node, which will replace the original one, or the original node 752 */ 753 public Node leaveBIND(final BinaryNode binaryNode) { 754 return leaveDefault(binaryNode); 755 } 756 757 /** 758 * Binary enter - callback for entering {@literal &} operator 759 * 760 * @param binaryNode the node 761 * @return true if traversal should continue and node children be traversed, false otherwise 762 */ 763 public boolean enterBIT_AND(final BinaryNode binaryNode) { 764 return enterDefault(binaryNode); 765 } 766 767 /** 768 * Binary leave - callback for leaving a {@literal &} operator 769 * 770 * @param binaryNode the node 771 * @return processed node, which will replace the original one, or the original node 772 */ 773 public Node leaveBIT_AND(final BinaryNode binaryNode) { 774 return leaveDefault(binaryNode); 775 } 776 777 /** 778 * Binary enter - callback for entering | operator 779 * 780 * @param binaryNode the node 781 * @return true if traversal should continue and node children be traversed, false otherwise 782 */ 783 public boolean enterBIT_OR(final BinaryNode binaryNode) { 784 return enterDefault(binaryNode); 785 } 786 787 /** 788 * Binary leave - callback for leaving a | operator 789 * 790 * @param binaryNode the node 791 * @return processed node, which will replace the original one, or the original node 792 */ 793 public Node leaveBIT_OR(final BinaryNode binaryNode) { 794 return leaveDefault(binaryNode); 795 } 796 797 /** 798 * Binary enter - callback for entering ^ operator 799 * 800 * @param binaryNode the node 801 * @return true if traversal should continue and node children be traversed, false otherwise 802 */ 803 public boolean enterBIT_XOR(final BinaryNode binaryNode) { 804 return enterDefault(binaryNode); 805 } 806 807 /** 808 * Binary leave - callback for leaving a operator 809 * 810 * @param binaryNode the node 811 * @return processed node, which will replace the original one, or the original node 812 */ 813 public Node leaveBIT_XOR(final BinaryNode binaryNode) { 814 return leaveDefault(binaryNode); 815 } 816 817 /** 818 * Binary enter - callback for entering comma left operator 819 * (a, b) where the result is a 820 * 821 * @param binaryNode the node 822 * @return true if traversal should continue and node children be traversed, false otherwise 823 */ 824 public boolean enterCOMMALEFT(final BinaryNode binaryNode) { 825 return enterDefault(binaryNode); 826 } 827 828 /** 829 * Binary leave - callback for leaving a comma left operator 830 * (a, b) where the result is a 831 * 832 * @param binaryNode the node 833 * @return processed node, which will replace the original one, or the original node 834 */ 835 public Node leaveCOMMALEFT(final BinaryNode binaryNode) { 836 return leaveDefault(binaryNode); 837 } 838 839 /** 840 * Binary enter - callback for entering comma right operator 841 * (a, b) where the result is b 842 * 843 * @param binaryNode the node 844 * @return true if traversal should continue and node children be traversed, false otherwise 845 */ 846 public boolean enterCOMMARIGHT(final BinaryNode binaryNode) { 847 return enterDefault(binaryNode); 848 } 849 850 /** 851 * Binary leave - callback for leaving a comma left operator 852 * (a, b) where the result is b 853 * 854 * @param binaryNode the node 855 * @return processed node, which will replace the original one, or the original node 856 */ 857 public Node leaveCOMMARIGHT(final BinaryNode binaryNode) { 858 return leaveDefault(binaryNode); 859 } 860 861 /** 862 * Binary enter - callback for entering a division 863 * 864 * @param binaryNode the node 865 * @return true if traversal should continue and node children be traversed, false otherwise 866 */ 867 public boolean enterDIV(final BinaryNode binaryNode) { 868 return enterDefault(binaryNode); 869 } 870 871 /** 872 * Binary leave - callback for leaving a division 873 * 874 * @param binaryNode the node 875 * @return processed node, which will replace the original one, or the original node 876 */ 877 public Node leaveDIV(final BinaryNode binaryNode) { 878 return leaveDefault(binaryNode); 879 } 880 881 /** 882 * Binary enter - callback for entering == operator 883 * 884 * @param binaryNode the node 885 * @return true if traversal should continue and node children be traversed, false otherwise 886 */ 887 public boolean enterEQ(final BinaryNode binaryNode) { 888 return enterDefault(binaryNode); 889 } 890 891 /** 892 * Binary leave - callback for leaving == operator 893 * 894 * @param binaryNode the node 895 * @return processed node, which will replace the original one, or the original node 896 */ 897 public Node leaveEQ(final BinaryNode binaryNode) { 898 return leaveDefault(binaryNode); 899 } 900 901 /** 902 * Binary enter - callback for entering === operator 903 * 904 * @param binaryNode the node 905 * @return true if traversal should continue and node children be traversed, false otherwise 906 */ 907 public boolean enterEQ_STRICT(final BinaryNode binaryNode) { 908 return enterDefault(binaryNode); 909 } 910 911 /** 912 * Binary leave - callback for leaving === operator 913 * 914 * @param binaryNode the node 915 * @return processed node, which will replace the original one, or the original node 916 */ 917 public Node leaveEQ_STRICT(final BinaryNode binaryNode) { 918 return leaveDefault(binaryNode); 919 } 920 921 /** 922 * Binary enter - callback for entering {@literal >=} operator 923 * 924 * @param binaryNode the node 925 * @return true if traversal should continue and node children be traversed, false otherwise 926 */ 927 public boolean enterGE(final BinaryNode binaryNode) { 928 return enterDefault(binaryNode); 929 } 930 931 /** 932 * Binary leave - callback for leaving {@literal >=} operator 933 * 934 * @param binaryNode the node 935 * @return processed node, which will replace the original one, or the original node 936 */ 937 public Node leaveGE(final BinaryNode binaryNode) { 938 return leaveDefault(binaryNode); 939 } 940 941 /** 942 * Binary enter - callback for entering {@literal >} operator 943 * 944 * @param binaryNode the node 945 * @return true if traversal should continue and node children be traversed, false otherwise 946 */ 947 public boolean enterGT(final BinaryNode binaryNode) { 948 return enterDefault(binaryNode); 949 } 950 951 /** 952 * Binary leave - callback for leaving {@literal >} operator 953 * 954 * @param binaryNode the node 955 * @return processed node, which will replace the original one, or the original node 956 */ 957 public Node leaveGT(final BinaryNode binaryNode) { 958 return leaveDefault(binaryNode); 959 } 960 961 /** 962 * Binary enter - callback for entering in operator 963 * 964 * @param binaryNode the node 965 * @return true if traversal should continue and node children be traversed, false otherwise 966 */ 967 public boolean enterIN(final BinaryNode binaryNode) { 968 return enterDefault(binaryNode); 969 } 970 971 /** 972 * Binary leave - callback for leaving in operator 973 * 974 * @param binaryNode the node 975 * @return processed node, which will replace the original one, or the original node 976 */ 977 public Node leaveIN(final BinaryNode binaryNode) { 978 return leaveDefault(binaryNode); 979 } 980 981 /** 982 * Binary enter - callback for entering instanceof operator 983 * 984 * @param binaryNode the node 985 * @return true if traversal should continue and node children be traversed, false otherwise 986 */ 987 public boolean enterINSTANCEOF(final BinaryNode binaryNode) { 988 return enterDefault(binaryNode); 989 } 990 991 /** 992 * Binary leave - callback for leaving instanceof operator 993 * 994 * @param binaryNode the node 995 * @return processed node, which will replace the original one, or the original node 996 */ 997 public Node leaveINSTANCEOF(final BinaryNode binaryNode) { 998 return leaveDefault(binaryNode); 999 } 1000 1001 /** 1002 * Binary enter - callback for entering {@literal <=} operator 1003 * 1004 * @param binaryNode the node 1005 * @return true if traversal should continue and node children be traversed, false otherwise 1006 */ 1007 public boolean enterLE(final BinaryNode binaryNode) { 1008 return enterDefault(binaryNode); 1009 } 1010 1011 /** 1012 * Binary leave - callback for leaving {@literal <=} operator 1013 * 1014 * @param binaryNode the node 1015 * @return processed node, which will replace the original one, or the original node 1016 */ 1017 public Node leaveLE(final BinaryNode binaryNode) { 1018 return leaveDefault(binaryNode); 1019 } 1020 1021 /** 1022 * Binary enter - callback for entering {@literal <} operator 1023 * 1024 * @param binaryNode the node 1025 * @return true if traversal should continue and node children be traversed, false otherwise 1026 */ 1027 public boolean enterLT(final BinaryNode binaryNode) { 1028 return enterDefault(binaryNode); 1029 } 1030 1031 /** 1032 * Binary leave - callback for leaving {@literal <} operator 1033 * 1034 * @param binaryNode the node 1035 * @return processed node, which will replace the original one, or the original node 1036 */ 1037 public Node leaveLT(final BinaryNode binaryNode) { 1038 return leaveDefault(binaryNode); 1039 } 1040 /** 1041 * Binary enter - callback for entering % operator 1042 * 1043 * @param binaryNode the node 1044 * @return true if traversal should continue and node children be traversed, false otherwise 1045 */ 1046 public boolean enterMOD(final BinaryNode binaryNode) { 1047 return enterDefault(binaryNode); 1048 } 1049 1050 /** 1051 * Binary leave - callback for leaving % operator 1052 * 1053 * @param binaryNode the node 1054 * @return processed node, which will replace the original one, or the original node 1055 */ 1056 public Node leaveMOD(final BinaryNode binaryNode) { 1057 return leaveDefault(binaryNode); 1058 } 1059 1060 /** 1061 * Binary enter - callback for entering * operator 1062 * 1063 * @param binaryNode the node 1064 * @return true if traversal should continue and node children be traversed, false otherwise 1065 */ 1066 public boolean enterMUL(final BinaryNode binaryNode) { 1067 return enterDefault(binaryNode); 1068 } 1069 1070 /** 1071 * Binary leave - callback for leaving * operator 1072 * 1073 * @param binaryNode the node 1074 * @return processed node, which will replace the original one, or the original node 1075 */ 1076 public Node leaveMUL(final BinaryNode binaryNode) { 1077 return leaveDefault(binaryNode); 1078 } 1079 1080 /** 1081 * Binary enter - callback for entering != operator 1082 * 1083 * @param binaryNode the node 1084 * @return true if traversal should continue and node children be traversed, false otherwise 1085 */ 1086 public boolean enterNE(final BinaryNode binaryNode) { 1087 return enterDefault(binaryNode); 1088 } 1089 1090 /** 1091 * Binary leave - callback for leaving != operator 1092 * 1093 * @param binaryNode the node 1094 * @return processed node, which will replace the original one, or the original node 1095 */ 1096 public Node leaveNE(final BinaryNode binaryNode) { 1097 return leaveDefault(binaryNode); 1098 } 1099 1100 /** 1101 * Binary enter - callback for entering a !== operator 1102 * 1103 * @param binaryNode the node 1104 * @return true if traversal should continue and node children be traversed, false otherwise 1105 */ 1106 public boolean enterNE_STRICT(final BinaryNode binaryNode) { 1107 return enterDefault(binaryNode); 1108 } 1109 1110 /** 1111 * Binary leave - callback for leaving !== operator 1112 * 1113 * @param binaryNode the node 1114 * @return processed node, which will replace the original one, or the original node 1115 */ 1116 public Node leaveNE_STRICT(final BinaryNode binaryNode) { 1117 return leaveDefault(binaryNode); 1118 } 1119 1120 /** 1121 * Binary enter - callback for entering || operator 1122 * 1123 * @param binaryNode the node 1124 * @return true if traversal should continue and node children be traversed, false otherwise 1125 */ 1126 public boolean enterOR(final BinaryNode binaryNode) { 1127 return enterDefault(binaryNode); 1128 } 1129 1130 /** 1131 * Binary leave - callback for leaving || operator 1132 * 1133 * @param binaryNode the node 1134 * @return processed node, which will replace the original one, or the original node 1135 */ 1136 public Node leaveOR(final BinaryNode binaryNode) { 1137 return leaveDefault(binaryNode); 1138 } 1139 1140 /** 1141 * Binary enter - callback for entering {@literal >>} operator 1142 * 1143 * @param binaryNode the node 1144 * @return true if traversal should continue and node children be traversed, false otherwise 1145 */ 1146 public boolean enterSAR(final BinaryNode binaryNode) { 1147 return enterDefault(binaryNode); 1148 } 1149 1150 /** 1151 * Binary leave - callback for leaving {@literal >>} operator 1152 * 1153 * @param binaryNode the node 1154 * @return processed node, which will replace the original one, or the original node 1155 */ 1156 public Node leaveSAR(final BinaryNode binaryNode) { 1157 return leaveDefault(binaryNode); 1158 } 1159 1160 /** 1161 * Binary enter - callback for entering {@literal <<} operator 1162 * 1163 * @param binaryNode the node 1164 * @return true if traversal should continue and node children be traversed, false otherwise 1165 */ 1166 public boolean enterSHL(final BinaryNode binaryNode) { 1167 return enterDefault(binaryNode); 1168 } 1169 1170 /** 1171 * Binary leave - callback for leaving {@literal <<} operator 1172 * 1173 * @param binaryNode the node 1174 * @return processed node, which will replace the original one, or the original node 1175 */ 1176 public Node leaveSHL(final BinaryNode binaryNode) { 1177 return leaveDefault(binaryNode); 1178 } 1179 /** 1180 * Binary enter - callback for entering {@literal >>>} operator 1181 * 1182 * @param binaryNode the node 1183 * @return true if traversal should continue and node children be traversed, false otherwise 1184 */ 1185 public boolean enterSHR(final BinaryNode binaryNode) { 1186 return enterDefault(binaryNode); 1187 } 1188 1189 /** 1190 * Binary leave - callback for leaving {@literal >>>} operator 1191 * 1192 * @param binaryNode the node 1193 * @return processed node, which will replace the original one, or the original node 1194 */ 1195 public Node leaveSHR(final BinaryNode binaryNode) { 1196 return leaveDefault(binaryNode); 1197 } 1198 1199 /** 1200 * Binary enter - callback for entering - operator 1201 * 1202 * @param binaryNode the node 1203 * @return true if traversal should continue and node children be traversed, false otherwise 1204 */ 1205 public boolean enterSUB(final BinaryNode binaryNode) { 1206 return enterDefault(binaryNode); 1207 } 1208 1209 /** 1210 * Binary leave - callback for leaving - operator 1211 * 1212 * @param binaryNode the node 1213 * @return processed node, which will replace the original one, or the original node 1214 */ 1215 public Node leaveSUB(final BinaryNode binaryNode) { 1216 return leaveDefault(binaryNode); 1217 } 1218 }