Commit 0a6fc67
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, v/i incompatibility)
- Ensure alphabetical flag ordering per ES spec
- Add comprehensive test suite
- Regenerate 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 2c091dd commit 0a6fc67
File tree
3 files changed
+202
-61
lines changed- rhino/src/main/java/org/mozilla/javascript/regexp
- tests
- src/test/java/org/mozilla/javascript/tests/es2022
- testsrc
3 files changed
+202
-61
lines changedLines changed: 40 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
250 | 251 | | |
251 | 252 | | |
252 | 253 | | |
253 | | - | |
| 254 | + | |
254 | 255 | | |
255 | 256 | | |
256 | 257 | | |
| |||
646 | 647 | | |
647 | 648 | | |
648 | 649 | | |
649 | | - | |
650 | | - | |
651 | | - | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | | - | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
| 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 | + | |
667 | 677 | | |
668 | 678 | | |
669 | 679 | | |
| |||
672 | 682 | | |
673 | 683 | | |
674 | 684 | | |
675 | | - | |
| 685 | + | |
| 686 | + | |
676 | 687 | | |
677 | 688 | | |
678 | 689 | | |
679 | | - | |
680 | 690 | | |
681 | 691 | | |
682 | 692 | | |
683 | 693 | | |
684 | | - | |
685 | | - | |
| 694 | + | |
686 | 695 | | |
687 | 696 | | |
688 | 697 | | |
| |||
Lines changed: 42 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | | - | |
5 | | - | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 8 | + | |
14 | 9 | | |
15 | 10 | | |
16 | 11 | | |
| |||
39 | 34 | | |
40 | 35 | | |
41 | 36 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
49 | 44 | | |
50 | 45 | | |
51 | 46 | | |
52 | 47 | | |
53 | 48 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
61 | 56 | | |
62 | 57 | | |
63 | 58 | | |
| |||
103 | 98 | | |
104 | 99 | | |
105 | 100 | | |
106 | | - | |
| 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