Crate ra_ap_mbe[][src]

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!

Structs

Delimiter
ExpandResult
MacroDef

For Macro 2.0

MacroRules

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)

Punct
TokenMap

Maps tt::TokenId to the relative range of the original token.

Enums

DelimiterKind
ExpandError
Origin
ParseError

Functions

ast_to_token_tree

Convert the syntax tree (what user has written) to a TokenTree (what macro will consume).

parse_exprs_with_sep

Split token tree with seperate expr: $($e:expr)SEP*

parse_to_token_tree

Convert a string to a TokenTree

syntax_node_to_token_tree

Convert the syntax node to a TokenTree (what macro will consume).

token_tree_to_syntax_node