Enum rustc_ap_rustc_ast::tokenstream::TokenTree [−][src]
pub enum TokenTree { Token(Token), Delimited(DelimSpan, DelimToken, TokenStream), }
Expand description
When the main Rust parser encounters a syntax-extension invocation, it parses the arguments to the invocation as a token tree. This is a very loose structure, such that all sorts of different AST fragments can be passed to syntax extensions using a uniform type.
If the syntax extension is an MBE macro, it will attempt to match its
LHS token tree against the provided token tree, and if it finds a
match, will transcribe the RHS token tree, splicing in any captured
macro_parser::matched_nonterminals
into the SubstNt
s it finds.
The RHS of an MBE macro is the only place SubstNt
s are substituted.
Nothing special happens to misnamed or misplaced SubstNt
s.
Variants
Token(Token)
A single token.
Delimited(DelimSpan, DelimToken, TokenStream)
A delimited sequence of token trees.
Implementations
Checks if this TokenTree
is equal to the other, regardless of span information.
Returns the opening delimiter as a token tree.
Returns the closing delimiter as a token tree.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for TokenTree
impl !UnwindSafe for TokenTree
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V