mirror of https://github.com/rust-lang/rust.git
Shrink the comment on `TokenTree`.
It uses very old language that is more confusing today than helpful, including references to `SubstNt` that no longer exists. The comment above `TokenStream` is better, and suffices for a basic understanding of these types.
This commit is contained in:
parent
a94bb2a013
commit
82a609f9a6
|
@ -28,18 +28,7 @@ use smallvec::{smallvec, SmallVec};
|
|||
use std::borrow::Cow;
|
||||
use std::{cmp, fmt, iter};
|
||||
|
||||
/// 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.
|
||||
/// Part of a `TokenStream`.
|
||||
#[derive(Debug, Clone, PartialEq, Encodable, Decodable, HashStable_Generic)]
|
||||
pub enum TokenTree {
|
||||
/// A single token. Should never be `OpenDelim` or `CloseDelim`, because
|
||||
|
|
Loading…
Reference in New Issue