Expand description
mbe (short for Macro By Example) crate contains code for handling
macro_rules macros. It uses TokenTree (from tt package) as the
interface, although it contains some code to bridge SyntaxNodes and
TokenTrees as well!
The tes for this functionality live in another crate:
hir_def::macro_expansion_tests::mbe.
Structs
This struct contains AST for a single macro_rules definition. What might
be very confusing is that AST has almost exactly the same shape as
tt::TokenTree, but there’s a crucial difference: in macro rules, $ident
and $()* have special meaning (see Var and Repeat data structures)
Maps tt::TokenId to the relative range of the original token.
Enums
Parse the whole of the input as a given syntactic construct.
Functions
Split token tree with separate expr: $($e:expr)SEP*
Convert a string to a TokenTree
Convert the syntax node to a TokenTree (what macro
will consume).
Convert the syntax node to a TokenTree (what macro will consume)
with the censored range excluded.