Commit dbf98f4
committed
Add ES2022 d flag and ES2024 v flag support to RegExp
Implements foundational support for RegExp hasIndices (d) and unicodeSets (v) flags.
Changes:
- Add flag constants JSREG_HASINDICES (0x40) and JSREG_UNICODESETS (0x80)
- Update TokenStream to accept d and v flags in regexp literals
- Add hasIndices and unicodeSets properties to RegExp.prototype
- Implement flag validation (u/v mutual exclusion per ES2024 spec)
- Ensure alphabetical flag ordering per ES spec
- Add comprehensive test suite
- Update test262.properties with new flag support
What works:
- Flag recognition and parsing
- Properties return correct boolean values
- Flag validation prevents invalid combinations
- All existing tests pass (backward compatible)
Not yet implemented:
- Actual indices array for d flag (requires regexp engine changes)
- Unicode set operations for v flag (requires parser rewrite)
This provides the foundation for full implementation while maintaining
compatibility with existing code.
Addresses #976 (ES2022 d flag) and partially addresses #1350 (ES2024 v flag)1 parent 8b20fb2 commit dbf98f4
File tree
4 files changed
+319
-31
lines changed- rhino/src/main/java/org/mozilla/javascript
- regexp
- tests
- src/test/java/org/mozilla/javascript/tests/es2022
- testsrc
4 files changed
+319
-31
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1571 | 1571 | | |
1572 | 1572 | | |
1573 | 1573 | | |
| 1574 | + | |
| 1575 | + | |
1574 | 1576 | | |
1575 | 1577 | | |
1576 | 1578 | | |
| |||
Lines changed: 69 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
| |||
248 | 251 | | |
249 | 252 | | |
250 | 253 | | |
| 254 | + | |
| 255 | + | |
251 | 256 | | |
252 | 257 | | |
253 | 258 | | |
254 | 259 | | |
255 | | - | |
256 | 260 | | |
| 261 | + | |
| 262 | + | |
257 | 263 | | |
258 | 264 | | |
259 | 265 | | |
| |||
641 | 647 | | |
642 | 648 | | |
643 | 649 | | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | | - | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | | - | |
656 | | - | |
657 | | - | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
658 | 677 | | |
659 | 678 | | |
660 | 679 | | |
| |||
663 | 682 | | |
664 | 683 | | |
665 | 684 | | |
666 | | - | |
| 685 | + | |
| 686 | + | |
667 | 687 | | |
668 | 688 | | |
669 | 689 | | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
670 | 698 | | |
671 | 699 | | |
672 | 700 | | |
| |||
3681 | 3709 | | |
3682 | 3710 | | |
3683 | 3711 | | |
3684 | | - | |
| 3712 | + | |
| 3713 | + | |
| 3714 | + | |
3685 | 3715 | | |
3686 | 3716 | | |
3687 | 3717 | | |
| |||
3719 | 3749 | | |
3720 | 3750 | | |
3721 | 3751 | | |
| 3752 | + | |
| 3753 | + | |
| 3754 | + | |
| 3755 | + | |
| 3756 | + | |
| 3757 | + | |
3722 | 3758 | | |
3723 | 3759 | | |
3724 | 3760 | | |
| |||
3739 | 3775 | | |
3740 | 3776 | | |
3741 | 3777 | | |
| 3778 | + | |
| 3779 | + | |
3742 | 3780 | | |
3743 | 3781 | | |
3744 | 3782 | | |
| |||
3768 | 3806 | | |
3769 | 3807 | | |
3770 | 3808 | | |
| 3809 | + | |
| 3810 | + | |
| 3811 | + | |
| 3812 | + | |
3771 | 3813 | | |
3772 | 3814 | | |
3773 | 3815 | | |
| |||
3797 | 3839 | | |
3798 | 3840 | | |
3799 | 3841 | | |
| 3842 | + | |
| 3843 | + | |
| 3844 | + | |
| 3845 | + | |
3800 | 3846 | | |
3801 | 3847 | | |
3802 | 3848 | | |
| |||
Lines changed: 125 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
0 commit comments