[][src]Module syntax::ext::tt::macro_rules

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Structs

FirstSets [
Experimental
]
MacroRulesMacroExpander [
Experimental
]
ParserAnyMacro [
Experimental
]
TokenSet [
Experimental
]

Functions

check_lhs_no_empty_seq [
Experimental
]

Check that the lhs contains no repetition which could match an empty token tree, because then the matcher would hang indefinitely.

check_lhs_nt_follows [
Experimental
]
check_matcher [
Experimental
]
check_matcher_core [
Experimental
]
check_rhs [
Experimental
]
compile [
Experimental
]

Converts a macro_rules! invocation into a syntax extension.

frag_can_be_followed_by_any [
Experimental
]

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).

generic_extension [
Experimental
]

Given lhses and rhses, this is the new macro we create

has_legal_fragment_specifier [
Experimental
]
is_in_follow [
Experimental
]

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.

is_legal_fragment_specifier [
Experimental
]
quoted_tt_to_string [
Experimental
]
token_can_be_followed_by_any [
Experimental
]
trace_macros_note [
Experimental
]