Remove NtVis.

We now use invisible delimiters for expanded `vis` fragments, instead of
`Token::Interpolated`.
This commit is contained in:
Nicholas Nethercote
2024-04-17 12:17:09 +10:00
parent 5986ff05d8
commit c7981d6411
8 changed files with 110 additions and 18 deletions

View File

@@ -969,6 +969,15 @@ impl Token {
}
}
/// Is this an invisible open delimiter at the start of a token sequence
/// from an expanded metavar?
pub fn is_metavar_seq(&self) -> Option<MetaVarKind> {
match self.kind {
OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(kind))) => Some(kind),
_ => None,
}
}
pub fn glue(&self, joint: &Token) -> Option<Token> {
let kind = match self.kind {
Eq => match joint.kind {
@@ -1072,7 +1081,6 @@ pub enum Nonterminal {
/// Stuff inside brackets for attributes
NtMeta(P<ast::AttrItem>),
NtPath(P<ast::Path>),
NtVis(P<ast::Visibility>),
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable_Generic)]
@@ -1169,7 +1177,6 @@ impl Nonterminal {
NtTy(ty) => ty.span,
NtMeta(attr_item) => attr_item.span(),
NtPath(path) => path.span,
NtVis(vis) => vis.span,
}
}
@@ -1184,7 +1191,6 @@ impl Nonterminal {
NtTy(..) => "type",
NtMeta(..) => "attribute",
NtPath(..) => "path",
NtVis(..) => "visibility",
}
}
}
@@ -1211,7 +1217,6 @@ impl fmt::Debug for Nonterminal {
NtLiteral(..) => f.pad("NtLiteral(..)"),
NtMeta(..) => f.pad("NtMeta(..)"),
NtPath(..) => f.pad("NtPath(..)"),
NtVis(..) => f.pad("NtVis(..)"),
}
}
}