Improve detection of line boundary assertions (Part 1 for issue #116445) #116823
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 PR fixes #116445
Currently
^
inside of character class[^a]
will be detected in assumption that it's line boundary assertion, but it actually has different meaning.This PR provides more precise detection of line boundary assettions as an example which will provide adequate behavior in case of #116445.
However I think that this check should be removed completely and next match search position should be propagated by 1 column (when possible, or to next line at the end of the string) because existence of start of line assertion may not be triggered at all if it's in specific branch.
Pathological case
Will investigate if it's possible to remove check at all and if there are more cases hen even precise boundary check wont help.
Then will add corresponding tests.
@rebornix would love to hear whe do you think about removing checks like this one completely.
https://github.com/microsoft/vscode/pull/116823/files#diff-4bd68ef6798b8b4aea76c65b352d49515f4adfc9fce8d1d33b0b2963bfab2e58R256-R259