-
Notifications
You must be signed in to change notification settings - Fork 51
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: Handle escape and regex characters #930
Conversation
Correct the handling of escape sequences in string literals. Don't replace escape sequences in regex expressions, for example, \r or \n. In the parser, these sequences start with \\. Same for \s, don't replace it with a whitespace, since this is also a part of a regex. Handle \\ to avoid that the sequence is escaped and returned as \\\\.
d4702cd
to
d266e80
Compare
@mboskamp I fixed the issue with However, it is important to note that |
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.
👍 Looks good. I did not test this in C7 and did not fully understand the fix. However, the test cases look good.
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 1.16
git worktree add -d .worktree/backport-930-to-1.16 origin/1.16
cd .worktree/backport-930-to-1.16
git switch --create backport-930-to-1.16
git cherry-pick -x c8b01bd09f2cf6fca2bc789a2101001c99778480 58efca98cca80dcdb7d9dc28c2331e9991b63956 544c0388bb0ee8e9a3b078f4567941ce684a8f0a d266e80173126eaf6dbfee4333be6cb0833c39bf |
Successfully created backport PR for |
Successfully created backport PR for |
Description
Correct the handling of escape sequences in string literals.
Don't replace escape sequences in regex expressions, for example, \r or \n. In the parser, these sequences start with \. Same for \s, don't replace it with a whitespace, since this is also a part of a regex.
Handle \ to avoid that the sequence is escaped and returned as \\.
Related issues
closes #883
closes #879