DmitrySoshnikov / regexp-tree

Regular expressions processor in JavaScript
MIT License
400 stars 45 forks source link

Support the `v` flag #265

Open slevithan opened 3 months ago

slevithan commented 3 months ago

ES2024's v flag (unicodeSets, an upgrade to flag u) has been supported since Node.js 20 and 2023-era browsers. Currently, regexp-tree cannot parse the v flag, and as far as I know it can't parse any v-only syntax (nested character classes, set subtraction/intersection, properties of strings, \q{…}, etc.).

Using v is a best practice, so not supporting it makes it much harder to use regexp-tree in tools that want to offer support for modern JS regexes.

DmitrySoshnikov commented 3 months ago

@slevithan thanks, this makes sense - I'll appreciate a PR for this issue!

slevithan commented 3 months ago

Unfortunately, I don't expect to be able to submit a PR for this due to other priorities and the fact that it's probably a significant body of work. That said, I'm open to submitting PRs for other issues in the future, especially if v is supported, making regexp-tree a strong foundation to continue using and building on.

Flag v is a collection of features that will meaningfully change the AST, and I think it will be better if someone familiar with regexp-tree's internals tackles it.