Module 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§

count_repetitions πŸ”’
Used solely by the count meta-variable expression, counts the outermost repetitions at a given optional nested depth.
extract_symbol_from_pnr πŸ”’
Extracts an metavariable symbol that can be an identifier, a token tree or a literal.
lockstep_iter_size πŸ”’
Given a tree, make sure that all sequences have the same length as the matches for the appropriate meta-vars in interpolations.
lookup_cur_matched πŸ”’
Lookup the meta-var named ident and return the matched token tree from the invocation using the set of matches interpolations.
matched_from_ident πŸ”’
Returns a NamedMatch item declared on the LHS given an arbitrary Ident
maybe_use_metavar_location πŸ”’
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.
out_of_bounds_err πŸ”’
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.
transcribe_metavar_expr πŸ”’