Move raw_identifiers check to the lexer.
This commit is contained in:
@@ -1155,6 +1155,10 @@ impl<'a> StringReader<'a> {
|
|||||||
&format!("`r#{}` is not currently supported.", ident.name)
|
&format!("`r#{}` is not currently supported.", ident.name)
|
||||||
).raise();
|
).raise();
|
||||||
}
|
}
|
||||||
|
if is_raw_ident {
|
||||||
|
let span = self.mk_sp(raw_start, self.pos);
|
||||||
|
self.sess.raw_identifier_spans.borrow_mut().push(span);
|
||||||
|
}
|
||||||
token::Ident(ident, is_raw_ident)
|
token::Ident(ident, is_raw_ident)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -784,7 +784,7 @@ impl<'a> Parser<'a> {
|
|||||||
|
|
||||||
fn parse_ident_common(&mut self, recover: bool) -> PResult<'a, ast::Ident> {
|
fn parse_ident_common(&mut self, recover: bool) -> PResult<'a, ast::Ident> {
|
||||||
match self.token {
|
match self.token {
|
||||||
token::Ident(i, is_raw) => {
|
token::Ident(i, _) => {
|
||||||
if self.token.is_reserved_ident() {
|
if self.token.is_reserved_ident() {
|
||||||
let mut err = self.expected_ident_found();
|
let mut err = self.expected_ident_found();
|
||||||
if recover {
|
if recover {
|
||||||
@@ -793,9 +793,6 @@ impl<'a> Parser<'a> {
|
|||||||
return Err(err);
|
return Err(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if is_raw {
|
|
||||||
self.sess.raw_identifier_spans.borrow_mut().push(self.span);
|
|
||||||
}
|
|
||||||
self.bump();
|
self.bump();
|
||||||
Ok(i)
|
Ok(i)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user