Module rustc_expand::mbe::transcribe

source Β·

Structs§

  • Frame πŸ”’
    An iterator over the token trees in a delimited token tree ({ ... }) or a sequence ($(...)).
  • Marker πŸ”’

Enums§

  • FrameKind πŸ”’
  • LockstepIterSize πŸ”’
    An accumulator over a TokenTree to be used with fold. During transcription, we need to make sure that the size of each sequence and all of its nested sequences are the same as the sizes of all the matched (nested) sequences in the macro invocation. If they don’t match, somebody has made a mistake (either the macro writer or caller).

Functions§

  • Used solely by the count meta-variable expression, counts the outer-most repetitions at a given optional nested depth.
  • Extracts an metavariable symbol that can be an identifier, a token tree or a literal.
  • Given a tree, make sure that all sequences have the same length as the matches for the appropriate meta-vars in interpolations.
  • Lookup the meta-var named ident and return the matched token tree from the invocation using the set of matches interpolations.
  • Returns a NamedMatch item declared on the LHS given an arbitrary Ident
  • Store the metavariable span for this original span into a side table. FIXME: Try to put the metavariable span into SpanData instead of a side table (#118517). An optimal encoding for inlined spans will need to be selected to minimize regressions. The side table approach is relatively good, but not perfect due to collisions. In particular, collisions happen when token is passed as an argument through several macro calls, like in recursive macros. The old heuristic below is used to improve spans in case of collisions, but diagnostics are still degraded sometimes in those cases.
  • Used by meta-variable expressions when an user input is out of the actual declared bounds. For example, index(999999) in an repetition of only three elements.
  • transcribe πŸ”’
    This can do Macro-By-Example transcription.