Various fixes for parsing string and char literals #210
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.
Fix unicode backslash escaped double quote in string and char literals
Closes #209
As described in JLS: https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.2, the translation for unicode escapes happens before parsing. Hence this is allowed:
To handle this behaviour I've updated the existing rules such that wherever
\\
was accepted\u005c
is also accepted.Allow multiple u chars in unicode escapes within string literals
Closes #207
I feel it's weird but it is mentioned in the JLS: https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.2:~:text=If%20an%20eligible%20%5C%20is%20followed%20by%20u%2C%20or%20more%20than%20one%20u%2C%20and%20the%20last%20u%20is%20not%20followed%20by%20four%20hexadecimal%20digits%2C%20then%20a%20compile%2Dtime%20error%20occurs - there can be multiple
u
after\u
as long as the 4 hex digits come at the end.