Enum syntax::tokenstream::TokenTree [] [src]

pub enum TokenTree {
    Token(SpanToken),
    Delimited(SpanDelimited),
}
🔬 This is a nightly-only experimental API. (rustc_private)

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

🔬 This is a nightly-only experimental API. (rustc_private)

A single token

🔬 This is a nightly-only experimental API. (rustc_private)

A delimited sequence of token trees

Methods

impl TokenTree
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

Use this token tree as a matcher to parse given tts.

🔬 This is a nightly-only experimental API. (rustc_private)

Check if this TokenTree is equal to the other, regardless of span information.

🔬 This is a nightly-only experimental API. (rustc_private)

Retrieve the TokenTree's span.

🔬 This is a nightly-only experimental API. (rustc_private)

Indicates if the stream is a token that is equal to the provided token.

Trait Implementations

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 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 Eq for TokenTree
[src]

impl Encodable for TokenTree
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

deprecated in favor of rustc-serialize on crates.io

impl Decodable for TokenTree
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

deprecated in favor of rustc-serialize on crates.io

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.

impl ToTokens for TokenTree
[src]

🔬 This is a nightly-only experimental API. (rustc_private)