[][src]Function c2rust_refactor::collapse::match_nonterminal_ids

pub fn match_nonterminal_ids(node_map: &mut NodeMap, mac_table: &MacTable)

Match up IDs of pre-expansion Nonterminal tokens with post-expansion AST nodes. Matching is performed by first checking for equal spans and then by comparing with ast_equiv. This can match multiple new IDs to a single old ID.

We need this to match up nodes across multiple rounds of macro expansion and collapsing. The first macro expansion step turns some sequences of tokens into actual nodes, and later collapse/expand steps preserve those nodes by storing them as nonterminals. Nonterminal ID matching lets us track those nodes throughout the later rounds of this process.