Module rustc_expand::mbe
source · Expand description
This module implements declarative macros: old macro_rules and the newer
macro. Declarative macros are also known as “macro by example”, and that’s
why we call this module mbe. For external documentation, prefer the
official terminology: “declarative macros”.
Modules§
- Checks that meta-variables in macro definition are correctly declared and used.
- This is an NFA-based parser, which calls out to the main Rust parser for named non-terminals (which it commits to fully when it hits one in a grammar). There’s a set of current NFA threads and a set of next ones. Instead of NTs, we have a special case for Kleene star. The big-O, in pathological cases, is worse than traditional use of NFA or Earley parsing, but it’s an easier fit for Macro-by-Example-style rules.
- quoted 🔒
Structs§
- Contains the sub-token-trees of a “delimited” token tree such as
(a b c). The delimiters are not represented explicitly in thettsvector.
Enums§
- KleeneOp 🔒A Kleene-style repetition operator for token sequences.
- Similar to
tokenstream::TokenTree, except thatSequence,MetaVar,MetaVarDecl, andMetaVarExprare “first-class” token trees. Useful for parsing macros.