[][src]Function syntax::ext::tt::quoted::parse

pub fn parse(
    input: TokenStream,
    expect_matchers: bool,
    sess: &ParseSess,
    features: &Features,
    attrs: &[Attribute],
    edition: Edition,
    macro_node_id: NodeId
) -> Vec<TokenTree>

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 and ident 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.
  • features, attrs: language feature flags and attributes so that we know whether to use unstable features or not.
  • edition: which edition are we in.
  • macro_node_id: the NodeId of the macro we are parsing.

Returns

A collection of self::TokenTree. There may also be some errors emitted to sess.