[−][src]Function rustc_expand::mbe::transcribe::transcribe

pub(in mbe) fn transcribe<'a>(
    cx: &ExtCtxt<'a>,
    interp: &FxHashMap<MacroRulesNormalizedIdent, NamedMatch>,
    src: Vec<TokenTree>,
    transparency: Transparency
) -> PResult<'a, TokenStream>

This can do Macro-By-Example transcription.

For example,

macro_rules! foo {
    ($id:ident) => { println!("{}", stringify!($id)); }
}

foo!(bar);

interp would contain $id => bar and src would contain println!("{}", stringify!($id));.

transcribe would return a TokenStream containing println!("{}", stringify!(bar));.

Along the way, we do some additional error checking.