Implement RegExp v-flag (unicodeSets) syntax validation - #36
Conversation
0eba837 to
0f2a0c1
Compare
There was a problem hiding this comment.
Pull request overview
Adds ES2024 (v / unicodeSets) RegExp parsing support to Acornima by introducing a validation-only unicode-sets parser and expanding Unicode property validation to cover ES2024 “binary properties of strings”, along with new unit tests and enabling Test262 coverage for the feature.
Changes:
- Add
EcmaVersion.ES15/ES2024and treat it asLatest. - Implement
UnicodeSetsModewith recursive parsing/validation for v-flag class set expressions, plus v-flag conversion refusal in AdaptTo* modes. - Extend Unicode properties to include ES2024 binary properties of strings and add v-flag-focused tests; enable Test262
regexp-v-flag.
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/Acornima.Tests/RegExpTests.cs | Adds v-flag validation, conversion-failure, and u/v mutual exclusion tests. |
| test/Acornima.Tests.Test262/Test262Harness.settings.json | Enables Test262 coverage by removing regexp-v-flag from excluded features. |
| src/Acornima/EcmaVersion.cs | Adds ES15/ES2024 and updates Latest. |
| src/Acornima/UnicodeProperties.cs | Adds ES2024 binary properties-of-strings lookup and validation API. |
| src/Acornima/Tokenizer.RegExpParser.cs | Routes v-flag to UnicodeSetsMode; blocks conversion for v-flag; updates brace-balance scanning for nested sets; adds IMode.TryParseCharacterClass. |
| src/Acornima/Tokenizer.RegExpParser.UnicodeSets.cs | New unicodeSets (v-flag) class set expression validator. |
| src/Acornima/Tokenizer.RegExpParser.Unicode.cs | Refactors Unicode property validation helper usage and implements new IMode member. |
| src/Acornima/Tokenizer.RegExpParser.Legacy.cs | Implements new IMode member. |
| src/Acornima/Properties/SyntaxErrorMessages.resx + Designer.cs | Adds v-flag-related syntax error messages. |
| src/Acornima/Properties/RegExpConversionErrorMessages.resx + Designer.cs | Updates v-flag conversion error wording. |
Files not reviewed (2)
- src/Acornima/Properties/RegExpConversionErrorMessages.Designer.cs: Language not supported
- src/Acornima/Properties/SyntaxErrorMessages.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0f2a0c1 to
012b2e7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 12 changed files in this pull request and generated 2 comments.
Files not reviewed (2)
- src/Acornima/Properties/RegExpConversionErrorMessages.Designer.cs: Language not supported
- src/Acornima/Properties/SyntaxErrorMessages.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Love it, thanks! ❤️ However, as a preparation step for implementing this, I did some refactoring around |
|
Already doing the rebase, no worries, I'm also running feedback loop and then marking this ready for review. |
341df19 to
7e074ad
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 12 changed files in this pull request and generated 2 comments.
Files not reviewed (2)
- src/Acornima/Properties/RegExpConversionErrorMessages.Designer.cs: Language not supported
- src/Acornima/Properties/SyntaxErrorMessages.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7e074ad to
4789d17
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 12 changed files in this pull request and generated 2 comments.
Files not reviewed (2)
- src/Acornima/Properties/RegExpConversionErrorMessages.Designer.cs: Language not supported
- src/Acornima/Properties/SyntaxErrorMessages.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4789d17 to
c9e0252
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 12 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- src/Acornima/Properties/RegExpConversionErrorMessages.Designer.cs: Language not supported
- src/Acornima/Properties/SyntaxErrorMessages.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c9e0252 to
2fb5d31
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 12 changed files in this pull request and generated 3 comments.
Files not reviewed (2)
- src/Acornima/Properties/RegExpConversionErrorMessages.Designer.cs: Language not supported
- src/Acornima/Properties/SyntaxErrorMessages.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2fb5d31 to
e46d436
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 12 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- src/Acornima/Properties/RegExpConversionErrorMessages.Designer.cs: Language not supported
- src/Acornima/Properties/SyntaxErrorMessages.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 12 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- src/Acornima/Properties/RegExpConversionErrorMessages.Designer.cs: Language not supported
- src/Acornima/Properties/SyntaxErrorMessages.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This loop starts to stabilize and now actionable items seem to rise. I'm running regex engine fixes on Jint side and asked for v-flag status (referencing this PR on Jint's side and depending on the changes):
I'll hopefully soon mark this as ready for review, just some running with Jint context remaining.. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 12 changed files in this pull request and generated no new comments.
Files not reviewed (2)
- src/Acornima/Properties/RegExpConversionErrorMessages.Designer.cs: Language not supported
- src/Acornima/Properties/SyntaxErrorMessages.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@adams85 I've verified that this now works on Jint's side - all tests except unicode pass now, I'm checking the unicode minimal fix next. This PR is ready from my side, feel free to use/change how you will. |
Add 11 new scripts from Unicode 17.0 with their 4-letter aliases: Beria_Erfe, Garay, Gurung_Khema, Kirat_Rai, Ol_Onal, Sidetic, Sunuwar, Tai_Yo, Todhri, Tolong_Siki, Tulu_Tigalari. This unblocks 44 test262 tests (22 Script + 22 Script_Extensions) that were excluded because the parser rejected these names at parse time. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
I added Unicode 17.0 script names to the property escape validation in my fork (lahma/acornima@0197c29). This is a small addition — just 11 new scripts with their 4-letter aliases added to This unblocks 44 test262 tests (22 Script + 22 Script_Extensions) that were failing because the parser rejected names like Scripts added: Beria_Erfe, Garay, Gurung_Khema, Kirat_Rai, Ol_Onal, Sidetic, Sunuwar, Tai_Yo, Todhri, Tolong_Siki, Tulu_Tigalari. |
Awesome, this is a dream coming true! 😄 I'll review and finalize the PR soon and probably release a new version before extracting the conversion logic into a separate package (so we can move step by step and coordinate our efforts more easily).
This data is necessary for validation so it's perfectly okay to add. Thank you very much! |
|
The Jint PR already sets Acornima only to validate, not adapt - all problematic are directed to the (slower) custom engjne. So it aligns with your idea of removing the feature- maybe mark option obsolete? |
|
👍 I'm going to do that. The current conversion logic will still be available separate from Acornima for anyone who needs it, I just don't plan to put any more effort into it. |
15ac90d to
f24caa1
Compare
…overflow prevention, performance)
c6c9875 to
a7c5b93
Compare
a7c5b93 to
550a03a
Compare
|
The source file implementing the Unicode sets mode turned out to be exactly 666 lines long... This cannot be a coincidence. Now I'm sure that flag v is the work of the devil himself! 😈 |
Summary
Implements syntax validation for the RegExp
vflag (unicodeSets) as specified in TC39 proposal-regexp-v-flag, now ratified in ES2024. Closes #9.ES15/ES2024toEcmaVersionenum (nowLatest)UnicodeSetsModewith recursive class set expression parser supporting:&&), subtraction (--), union[[a-z]&&[aeiou]]\q{abc|def}\p{Basic_Emoji},\p{RGI_Emoji}, etc.CheckBracesBalanceto handle nested[...]in v-flag modeRegexis not supported for v-flag patterns (returns conversion error inAdaptTo*modes)Test plan
regexp-v-flagremoved from Test262ExcludedFeatures— all 98,118 Test262 tests pass with 0 failures🤖 Generated with Claude Code