Enum syn::TokenTree [] [src]

pub enum TokenTree {
    Token(Token),
    Delimited(Delimited),
}

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 SubstNts it finds.

The RHS of an MBE macro is the only place SubstNts are substituted. Nothing special happens to misnamed or misplaced SubstNts.

Variants

A single token

A delimited sequence of token trees

Trait Implementations

impl ToTokens for TokenTree
[src]

Write self to the given Tokens. Read more

impl Debug for TokenTree
[src]

Formats the value using the given formatter.

impl Clone for TokenTree
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Eq for TokenTree
[src]

impl PartialEq for TokenTree
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Hash for TokenTree
[src]

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.