1
Fork 0

Attach TokenStream to ast::Path

This commit is contained in:
Aaron Hill 2020-08-21 18:51:23 -04:00
parent 3815e91ccd
commit 55082ce413
No known key found for this signature in database
GPG key ID: B4087E510E98B164
15 changed files with 41 additions and 21 deletions

View file

@ -168,7 +168,15 @@ impl<'a> Parser<'a> {
return Err(self.struct_span_err(self.token.span, msg));
}
}
NonterminalKind::Path => token::NtPath(self.parse_path(PathStyle::Type)?),
NonterminalKind::Path => {
let (mut path, tokens) =
self.collect_tokens(|this| this.parse_path(PathStyle::Type))?;
// We have have eaten an NtPath, which could already have tokens
if path.tokens.is_none() {
path.tokens = Some(tokens);
}
token::NtPath(path)
}
NonterminalKind::Meta => {
let (mut attr, tokens) = self.collect_tokens(|this| this.parse_attr_item())?;
// We may have eaten a nonterminal, which could already have tokens