-
Notifications
You must be signed in to change notification settings - Fork 236
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
Fix language_js
regex constant detection
#1581
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Guldoman
force-pushed
the
PR_improve_js_regex
branch
2 times, most recently
from
September 6, 2023 23:45
68569f7
to
9f3301c
Compare
With the latest changes this should be even more robust, and will allow in the future to match elements inside the pattern more easily. |
Guldoman
force-pushed
the
PR_improve_js_regex
branch
from
November 8, 2023 02:48
c933ef9
to
fb0c3dc
Compare
…tion This avoids more catastrophic backtracking cases.
With the latest commits the regex has been simplified a bit. |
I love you Guldo. You know that right? You're awesome. I'll port these changes to the .jsx plugin as well when this is merged. |
Whatever it is, it's better than what we've got. Merging. |
takase1121
pushed a commit
to takase1121/lite-xl
that referenced
this pull request
Nov 30, 2023
* Fix `language_js` regex constant detection * Simplify regex constant detection in `language_js` * Add more possessive quantifiers in `language_js` regex constant detection This avoids more catastrophic backtracking cases. * Allow `.` after regex constant in `language_js`
takase1121
pushed a commit
to takase1121/lite-xl
that referenced
this pull request
Nov 30, 2023
* Fix `language_js` regex constant detection * Simplify regex constant detection in `language_js` * Add more possessive quantifiers in `language_js` regex constant detection This avoids more catastrophic backtracking cases. * Allow `.` after regex constant in `language_js`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This should improve regex constant detection in js.
Before:
After:
Fixes #1580.
The initial
(?<=^|[(,;=])
doesn't really work, because #860 makes the regex engine only receive the part we're trying to match, so the lookbehind doesn't work properly.We could solve this by using subsyntaxes, but this would make the plugin way more complex, or by reverting #860, but we'd need to find a different solution for the problem it fixes.