Add initial support for raw lifetimes
This commit is contained in:
parent
3b3e43a386
commit
97910580aa
18 changed files with 116 additions and 40 deletions
|
@ -88,7 +88,7 @@ impl<'a> Parser<'a> {
|
|||
},
|
||||
NonterminalKind::Pat(pat_kind) => token.can_begin_pattern(pat_kind),
|
||||
NonterminalKind::Lifetime => match &token.kind {
|
||||
token::Lifetime(_) | token::NtLifetime(..) => true,
|
||||
token::Lifetime(..) | token::NtLifetime(..) => true,
|
||||
_ => false,
|
||||
},
|
||||
NonterminalKind::TT | NonterminalKind::Item | NonterminalKind::Stmt => {
|
||||
|
@ -171,9 +171,9 @@ impl<'a> Parser<'a> {
|
|||
NonterminalKind::Lifetime => {
|
||||
// We want to keep `'keyword` parsing, just like `keyword` is still
|
||||
// an ident for nonterminal purposes.
|
||||
return if let Some(ident) = self.token.lifetime() {
|
||||
return if let Some((ident, is_raw)) = self.token.lifetime() {
|
||||
self.bump();
|
||||
Ok(ParseNtResult::Lifetime(ident))
|
||||
Ok(ParseNtResult::Lifetime(ident, is_raw))
|
||||
} else {
|
||||
Err(self.dcx().create_err(UnexpectedNonterminal::Lifetime {
|
||||
span: self.token.span,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue