Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAccept underscores in unicode escapes #43716
Conversation
rust-highfive
assigned
nikomatsakis
Aug 7, 2017
This comment has been minimized.
This comment has been minimized.
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
MaloJaffre
force-pushed the
MaloJaffre:_-in-literals
branch
from
47416d3
to
7d1fa02
Aug 7, 2017
kennytm
reviewed
Aug 7, 2017
| /// | ||
| /// At this point, we have already seen the \ and the u, the { is the current character. We | ||
| /// will read at least one digit, and up to 6, and pass over the }. | ||
| /// At this point, we have already seen the `\` and the `u`, the `{` is the current character. We |
This comment has been minimized.
This comment has been minimized.
kennytm
Aug 7, 2017
Member
The CI is unhappy with this line because it is too long
[00:03:14] tidy error: /checkout/src/libsyntax/parse/lexer/mod.rs:968: line longer than 100 chars
[00:03:15] some tidy checks failed
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
arielb1
assigned
petrochenkov
and unassigned
nikomatsakis
Aug 8, 2017
arielb1
added
the
S-waiting-on-review
label
Aug 8, 2017
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin what do you think about this? Also ping @rust-lang/lang |
This comment has been minimized.
This comment has been minimized.
|
Making numeric escape sequences consistent with integer literals makes sense to me. |
This comment has been minimized.
This comment has been minimized.
|
Please don't allow prefixes or suffixes, but otherwise this seems like a great idea. |
This comment has been minimized.
This comment has been minimized.
|
@MaloJaffre |
MaloJaffre
force-pushed the
MaloJaffre:_-in-literals
branch
from
14085a8
to
0bac86c
Aug 13, 2017
This comment has been minimized.
This comment has been minimized.
|
Thanks for the suggestion @petrochenkov. Edit: Travis failure looks spurious (workers failed to start) |
petrochenkov
reviewed
Aug 17, 2017
| loop { | ||
| match self.ch { | ||
| Some('}') => { | ||
| if valid && count == 0 { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
MaloJaffre
Aug 17, 2017
Author
Contributor
No, because in the case \u{#}, we don't want to say that the escape is empty, so we check there was no invalid characters before.
This comment has been minimized.
This comment has been minimized.
petrochenkov
reviewed
Aug 17, 2017
| self.err_span_char(start_bpos, | ||
| self.pos, | ||
| "invalid character in unicode escape", | ||
| c); |
This comment has been minimized.
This comment has been minimized.
petrochenkov
Aug 17, 2017
Contributor
This error can now be reported a lot of times in case of unterminated unicode escapes.
It probably should be reported only the first time.
petrochenkov
reviewed
Aug 17, 2017
| diag.struct_span_err(span, "invalid unicode character escape") | ||
| .help("unicode escape must be at most 10FFFF") | ||
| .emit(); | ||
| None |
This comment has been minimized.
This comment has been minimized.
petrochenkov
Aug 17, 2017
Contributor
I think you can avoid an changing the return type to option here and just return something like Replacement character U+FFFD.
This comment has been minimized.
This comment has been minimized.
petrochenkov
Aug 17, 2017
Contributor
@MaloJaffre
Could you also squash commits after updating the PR?
This comment has been minimized.
This comment has been minimized.
MaloJaffre
Aug 17, 2017
•
Author
Contributor
Thanks for the review @petrochenkov!
Ok, I will shortly do another round of changes and squash everything.
petrochenkov
added
S-waiting-on-author
S-waiting-on-team
T-lang
and removed
S-waiting-on-review
labels
Aug 17, 2017
This comment has been minimized.
This comment has been minimized.
|
Implementation LGTM, modulo comments. @rfcbot fcp merge |
This comment has been minimized.
This comment has been minimized.
|
I have no rights for @rfcbot, could someone start an FCP? |
MaloJaffre
force-pushed the
MaloJaffre:_-in-literals
branch
from
0bac86c
to
d4e0e52
Aug 17, 2017
This comment has been minimized.
This comment has been minimized.
|
@petrochenkov Done. Edit: Travis failure looks spurious (OSX jobs failed to start). |
petrochenkov
approved these changes
Aug 17, 2017
petrochenkov
removed
the
S-waiting-on-author
label
Aug 20, 2017
This comment has been minimized.
This comment has been minimized.
|
Friendly ping @nikomatsakis, to start a FCP, if there are no concerns about the implementation. |
This comment has been minimized.
This comment has been minimized.
|
@MaloJaffre |
This comment has been minimized.
This comment has been minimized.
|
I think this is fine without a feature gate. (Though I’m not in any team that would make that decision.) |
This comment has been minimized.
This comment has been minimized.
|
@rfcbot fcp merge |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Aug 25, 2017
•
|
Team member @aturon has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
rfcbot
added
the
proposed-final-comment-period
label
Aug 25, 2017
pnkfelix
reviewed
Aug 30, 2017
| self.bump(); | ||
| count += 1; | ||
| if let Some('_') = self.ch { | ||
| // disallow leading `_` |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
MaloJaffre
Aug 30, 2017
Author
Contributor
There is already a parse-fail test that checks that, do I need to move it to compile-fail?
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Sep 1, 2017
|
|
rfcbot
added
final-comment-period
and removed
proposed-final-comment-period
labels
Sep 1, 2017
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Sep 11, 2017
|
The final comment period is now complete. |
This comment has been minimized.
This comment has been minimized.
@bors r+ |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Sep 12, 2017
This comment has been minimized.
This comment has been minimized.
|
|
bors
merged commit d4e0e52
into
rust-lang:master
Sep 12, 2017
MaloJaffre
deleted the
MaloJaffre:_-in-literals
branch
Sep 12, 2017
This comment has been minimized.
This comment has been minimized.
|
It is worth noting that most syntax highlighters will need updating to support this. (I just did Vim.) We need something like a mailing list for syntax highlighters where syntax changes can be announced. Regular expression highlighters will now need something like |
MaloJaffre commentedAug 7, 2017
Fixes #43692.
I don't know if this need an RFC, but at least the impl is here!