The MacroExpander allows to expand simple (non-resursive) macro
definitions from a macro identifier token and macro arguments. It
annotates the tokens with a newly introduced MacroContext that keeps
track of the role a token played in expanding the macro in order to
be able to reconstruct the macro expansion from an expanded (formatted)
token stream.
Made Token explicitly copy-able to enable copying tokens from the parsed
macro definition.
this is a great example, it might be a little more clear with more distinct chars and some vertical alignment:
Given X(A)=[A], Y(A)=<A>, X({ Y(0) } ) expands as [ { < 0 > } ] StartOfExpansion 1 1 ExpandedFrom[0] X X X X X X X ExpandedFrom[1] Y Y YYou could extend this to cover all the fields and hoist it to be a comment on MacroContext if you like, I think the concreteness helps.