mbe: split Op::Leaf and handle multi-character puncts

This commit is contained in:
Ryo Yoshida 2022-12-27 18:18:18 +09:00
parent 47c6c8e2f3
commit ec7148b091
No known key found for this signature in database
GPG key ID: E25698A930586171
6 changed files with 183 additions and 56 deletions

View file

@ -141,7 +141,13 @@ fn invocation_fixtures(rules: &FxHashMap<String, DeclarativeMacro>) -> Vec<(Stri
None => (),
Some(kind) => panic!("Unhandled kind {kind:?}"),
},
Op::Leaf(leaf) => parent.token_trees.push(leaf.clone().into()),
Op::Literal(it) => parent.token_trees.push(tt::Leaf::from(it.clone()).into()),
Op::Ident(it) => parent.token_trees.push(tt::Leaf::from(it.clone()).into()),
Op::Punct(puncts) => {
for punct in puncts {
parent.token_trees.push(tt::Leaf::from(punct.clone()).into());
}
}
Op::Repeat { tokens, kind, separator } => {
let max = 10;
let cnt = match kind {