Make sure we match the entire pattern

This commit is contained in:
Jeff Muizelaar 2019-02-03 10:06:09 -05:00
parent f370393bba
commit dbc3074556
2 changed files with 34 additions and 1 deletions

View file

@ -13,6 +13,9 @@ pub(crate) fn exapnd(rules: &crate::MacroRules, input: &tt::Subtree) -> Option<t
fn expand_rule(rule: &crate::Rule, input: &tt::Subtree) -> Option<tt::Subtree> {
let mut input = TtCursor::new(input);
let bindings = match_lhs(&rule.lhs, &mut input)?;
if !input.is_eof() {
return None;
}
expand_subtree(&rule.rhs, &bindings, &mut Vec::new())
}