From 95c8c65139c10e4de44367fead8dff88511e6d46 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 17 Jun 2021 17:37:14 +0200 Subject: Nest all the or-patterns! --- crates/mbe/src/expander/matcher.rs | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'crates/mbe/src') diff --git a/crates/mbe/src/expander/matcher.rs b/crates/mbe/src/expander/matcher.rs index c2a9a38c9..b4f2fe9a4 100644 --- a/crates/mbe/src/expander/matcher.rs +++ b/crates/mbe/src/expander/matcher.rs @@ -804,33 +804,17 @@ impl<'a> TtIter<'a> { }; match (punct.char, second, third) { - ('.', '.', Some('.')) - | ('.', '.', Some('=')) - | ('<', '<', Some('=')) - | ('>', '>', Some('=')) => { + ('.', '.', Some('.' | '=')) | ('<', '<', Some('=')) | ('>', '>', Some('=')) => { let tt2 = self.next().unwrap().clone(); let tt3 = self.next().unwrap().clone(); Ok(tt::Subtree { delimiter: None, token_trees: vec![tt, tt2, tt3] }.into()) } - ('-', '=', _) - | ('-', '>', _) + ('-' | '!' | '*' | '/' | '&' | '%' | '^' | '+' | '<' | '=' | '>' | '|', '=', _) + | ('-' | '=' | '>', '>', _) | (':', ':', _) - | ('!', '=', _) | ('.', '.', _) - | ('*', '=', _) - | ('/', '=', _) | ('&', '&', _) - | ('&', '=', _) - | ('%', '=', _) - | ('^', '=', _) - | ('+', '=', _) | ('<', '<', _) - | ('<', '=', _) - | ('=', '=', _) - | ('=', '>', _) - | ('>', '=', _) - | ('>', '>', _) - | ('|', '=', _) | ('|', '|', _) => { let tt2 = self.next().unwrap().clone(); Ok(tt::Subtree { delimiter: None, token_trees: vec![tt, tt2] }.into()) -- cgit v1.2.3