Skip to content

Conversation

@anivar
Copy link
Contributor

@anivar anivar commented Sep 13, 2025

Implements foundational support for RegExp d (hasIndices) and v (unicodeSets) flags.

Changes

  • Add flag constants, parsing, validation, and properties for d and v flags
  • Update TokenStream to accept d and v in regexp literals
  • Add test suite and regenerate test262.properties

Status

  • Flag recognition and properties work
  • Actual functionality (indices array, Unicode set operations) not yet implemented
  • All existing tests pass

Partially addresses #976 and #1350

@gbrail
Copy link
Collaborator

gbrail commented Sep 16, 2025

This is good progress and I am generally in favor of Claude helping us get our spec compliance up to date, but could you take the Claude stuff out of the PR? Thanks!

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 mozilla#976 (ES2022 d flag) and partially addresses mozilla#1350 (ES2024 v flag)
@anivar anivar force-pushed the es2022-regexp-hasindices branch from 0a6fc67 to dbf98f4 Compare September 16, 2025 05:46
@anivar
Copy link
Contributor Author

anivar commented Sep 16, 2025

@gbrail I've been using AI tools to help analyze the codebase and catch up with implementation approaches and verification same. I should have been more careful with the commits and documentation.

I've cleaned up the PR to focus solely on the RegExp d/v flag implementation. All the unrelated documentation files have been removed, and the commits have been squashed into a single clean commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants