aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe/src/subtree_parser.rs
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-04-13 11:38:31 +0100
committerEdwin Cheng <[email protected]>2019-04-14 04:42:20 +0100
commit6646d49f238bb92d55fcb4900830f19faa2994a5 (patch)
tree1a7091b6e104abedcc086e99f560f36010aefe5f /crates/ra_mbe/src/subtree_parser.rs
parentf66300ccd1e6ef05b633cda06c87f913d1c91a1e (diff)
Fix bug and add expr , pat , ty matcher
Diffstat (limited to 'crates/ra_mbe/src/subtree_parser.rs')
-rw-r--r--crates/ra_mbe/src/subtree_parser.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/ra_mbe/src/subtree_parser.rs b/crates/ra_mbe/src/subtree_parser.rs
index 164240d92..13d5d2169 100644
--- a/crates/ra_mbe/src/subtree_parser.rs
+++ b/crates/ra_mbe/src/subtree_parser.rs
@@ -30,6 +30,18 @@ impl<'a> Parser<'a> {
30 self.parse(ra_parser::parse_path) 30 self.parse(ra_parser::parse_path)
31 } 31 }
32 32
33 pub fn parse_expr(self) -> Option<tt::TokenTree> {
34 self.parse(ra_parser::parse_expr)
35 }
36
37 pub fn parse_ty(self) -> Option<tt::TokenTree> {
38 self.parse(ra_parser::parse_ty)
39 }
40
41 pub fn parse_pat(self) -> Option<tt::TokenTree> {
42 self.parse(ra_parser::parse_pat)
43 }
44
33 fn parse<F>(self, f: F) -> Option<tt::TokenTree> 45 fn parse<F>(self, f: F) -> Option<tt::TokenTree>
34 where 46 where
35 F: FnOnce(&dyn TokenSource, &mut dyn TreeSink), 47 F: FnOnce(&dyn TokenSource, &mut dyn TreeSink),