-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
change guarded string reserved tokens to #"
, ##"
, ###
#133924
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -415,8 +415,16 @@ impl Cursor<'_> { | |
} | ||
|
||
// Guarded string literal prefix: `#"` or `##` | ||
'#' if matches!(self.first(), '"' | '#') => { | ||
'#' if matches!( | ||
(self.first(), self.second()), | ||
// #" ##" ### | ||
('"', _) | ('#', '"') | ('#', '#') | ||
Comment on lines
+418
to
+421
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Miiiildly concerned about the implicit interaction between parser and lexer with these now, given the new reserved syntax, but that goes beyond this PR and is more about the feature as a whole, and I'm not going to block that. |
||
) => | ||
{ | ||
self.bump(); | ||
if self.first() != '"' { | ||
self.bump(); | ||
} | ||
TokenKind::GuardedStrPrefix | ||
} | ||
|
||
|
@@ -804,8 +812,6 @@ impl Cursor<'_> { | |
/// guarded string is not found. It is the caller's | ||
/// responsibility to do so. | ||
pub fn guarded_double_quoted_string(&mut self) -> Option<GuardedStr> { | ||
debug_assert!(self.prev() != '#'); | ||
|
||
Comment on lines
-807
to
-808
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be replaced with a check of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this check should exist at all, and I'm surprised it hasn't blown up yet. It will blow up on |
||
let mut n_start_hashes: u32 = 0; | ||
while self.first() == '#' { | ||
n_start_hashes += 1; | ||
|
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.
Should we update this comment?
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.
Yes. Will do