Module macro_rules

Source

Structs§

DummyExpander πŸ”’
FirstSets πŸ”’
MacroRulesMacroExpander πŸ”’
NoopTracker πŸ”’
A noop tracker that is used in the hot path of the expansion, has zero overhead thanks to monomorphization.
ParserAnyMacro πŸ”’
TokenSet πŸ”’

Enums§

CanRetry πŸ”’
IsInFollow πŸ”’
TtHandle πŸ”’

Traits§

Tracker πŸ”’

Functions§

check_lhs_no_empty_seq πŸ”’
Checks that the lhs contains no repetition which could match an empty token tree, because then the matcher would hang indefinitely.
check_lhs_nt_follows πŸ”’
check_matcher πŸ”’
check_matcher_core πŸ”’
check_rhs πŸ”’
compile_declarative_macro
Converts a macro item into a syntax extension.
expand_macro πŸ”’
Expands the rules based macro defined by lhses and rhses for a given input arg.
frag_can_be_followed_by_any πŸ”’
Returns true if a fragment of type frag can be followed by any sort of token. We use this (among other things) as a useful approximation for when frag can be followed by a repetition like $(...)* or $(...)+. In general, these can be a bit tricky to reason about, so we adopt a conservative position that says that any fragment specifier which consumes at most one token tree can be followed by a fragment specifier (indeed, these fragments can be followed by ANYTHING without fear of future compatibility hazards).
has_compile_error_macro πŸ”’
is_empty_token_tree πŸ”’
is_in_follow πŸ”’
Returns true if frag can legally be followed by the token tok. For fragments that can consume an unbounded number of tokens, tok must be within a well-defined follow set. This is intended to guarantee future compatibility: for example, without this rule, if we expanded expr to include a new binary operator, we might break macros that were relying on that binary operator as a separator.
parser_from_cx πŸ”’
quoted_tt_to_string πŸ”’
token_can_be_followed_by_any πŸ”’
trace_macros_note πŸ”’
try_match_macro πŸ”’
Try expanding the macro. Returns the index of the successful arm and its named_matches if it was successful, and nothing if it failed. On failure, it’s the callers job to use track accordingly to record all errors correctly.