Function rustc_expand::mbe::quoted::parse [−][src]
pub(super) fn parse(
input: TokenStream,
expect_matchers: bool,
sess: &ParseSess,
node_id: NodeId,
features: &Features,
edition: Edition
) -> Vec<TokenTree>
Expand description
Takes a tokenstream::TokenStream
and returns a Vec<self::TokenTree>
. Specifically, this
takes a generic TokenStream
, such as is used in the rest of the compiler, and returns a
collection of TokenTree
for use in parsing a macro.
Parameters
input
: a token stream to read from, the contents of which we are parsing.expect_matchers
:parse
can be used to parse either the “patterns” or the “body” of a macro. Both take roughly the same form except that in a pattern, metavars are declared with their “matcher” type. For example$var:expr
or$id:ident
. In this example,expr
andident
are “matchers”. They are not present in the body of a macro rule – just in the pattern, so we pass a parameter to indicate whether to expect them or not.sess
: the parsing session. Any errors will be emitted to this session.node_id
: the NodeId of the macro we are parsing.features
: language features so we can do feature gating.edition
: the edition of the crate defining the macro
Returns
A collection of self::TokenTree
. There may also be some errors emitted to sess
.