-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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 rust escape double quots in string #3904
Fix rust escape double quots in string #3904
Conversation
Build Size ReportChanges to minified artifacts in 4 files changedTotal change +45 B View Changes
|
hi @joshgoebel, this is my suggested solution to solve the resolved issue feel free to review it and give me your pieces of advice. |
src/languages/rust.js
Outdated
{ | ||
begin: /b?r(#*)"(.|\n)*?"\1(?!#)/, | ||
contains: [ | ||
hljs.BACKSLASH_ESCAPE | ||
] | ||
}, | ||
{ | ||
begin: /b?'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/, | ||
contains: [ | ||
hljs.BACKSLASH_ESCAPE | ||
] | ||
}, | ||
], |
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.
This doesn't work... you'd need end
as well and need to rewrite any specific internals (like the unicode matching) to be sub rules inside the contains
. And you can't use match history (\1
) across begin/end combos... how many #
characters are used in practice? is there a max limit?
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.
I am sorry, I can't understand you.
Do you mean removing this change avoiding complexity or another thing?
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.
Please add test cases for these and you will see that they do not work they way they are currently written.
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.
You are right, this change didn't work. So I will remove contains
at these variants and commit changes again.
Thanks in advance
Build Size ReportChanges to minified artifacts in 5 files changedTotal change +36 B View Changes
|
Ok, I supposing fixing one of the variants s better than nothing. Please add a changelog entry. |
@joshgoebel, I have updated the changelogs at CHANGES.md Is that what you expect? |
Please only include your single change in the log. |
@joshgoebel, Thanks for approving the changes, I hope to merge it if possible. |
@joshgoebel, I show that the first test has failed and I can't find the reason for that I want to understand that if you can please explain that with my thanks in advance. |
Build Size ReportChanges to minified artifacts in 3 files changedTotal change +38 B View Changes
|
I have fixed unescaping the
"
at string attributes such as I have seen in the #3817 issue.Changes
The string scops didn't contain the backslash escape expression which is
BACKSLASH_ESCAPE
so I have put it at every string scope.Before
After
Checklist
BACKSLASH_ESCAPE
to string scops to avoid this issue.