-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support v flag #82
Conversation
4a0e3dc
to
9dcfdfe
Compare
Thank you @ota-meshi! I'll review this soon. There is one thing I noticed by looking at the AST format: I also think that the new So I think it would make sense to more clearly separate the new |
Good point. I think your idea makes sense. I will change the AST. |
I refactored this PR. Previously, a string indicating the kind was returned from some consume functions and processed. However, this was inconsistent so I refactored the consume function to return a boolean. |
I refactored this PR. Changed MayContainStrings to handle using result. This follows a review comment in PR in Acorn. |
@eslint-community/core-team @RunDevelopment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not very familiar with this repo, but the test cases look good! :)
Thank you for checking out this PR. I will merge this PR. |
🎉 This PR is included in version 4.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hi @RunDevelopment! |
Joined. Thanks @ota-meshi! |
Overview
This PR adds support for v flag.
Add new AST nodes
ExpressionCharacterClass
If the character class has intersection or subtraction it will be wrapped in this node. E.g.
[a--b]
,[a&&b]
,[^a--b]
,[^a&&b]
ClassIntersection
It is an intersection node. E.g.
a&&b
ClassSubtraction
It is a subtraction node. E.g.
a--b
ClassStringDisjunction
It is
\p{...}
node. E.g.\q{a|b}
StringAlternative
It is
Alternative
like node inClassStringDisjunction
.Change AST nodes
unicodeSets
flag. true if the regex has the v flag. It had this because negation (^
) behaves differently at runtime.kind: "property"
)strings
flag. true if it\p{}
with property of string (e.g.Basic_Emoji
). It has no negation.Change API
parser.parsePattern
andvalidator.validatePattern
has been changed from a booleanuFlag
to an object with flags.This is because the object format is easier to use than specifying multiple flags in argument order. For backward compatibility, the old boolean value work as well.
close #80