diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-19 14:54:34 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-19 14:54:34 +0100 |
commit | d15abaa06fe65a01072c74db55786e97d17365b4 (patch) | |
tree | 68024131d628d333ffd4e6dcba453b335bfafbae /crates/ra_mbe/src/subtree_parser.rs | |
parent | 153db2467f691aaf5ff6d87044342ddae4ee9ae6 (diff) | |
parent | 1afde29adbb6c9094babe117f7972f7157d16cc1 (diff) |
Merge #1168
1168: Add all remaining mbe matchers r=matklad a=edwin0cheng
This PR adds following mbe matchers:
* block
* meta
* tt
* literal
* vis
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_mbe/src/subtree_parser.rs')
-rw-r--r-- | crates/ra_mbe/src/subtree_parser.rs | 12 |
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 195e4c3ac..528aa0f8a 100644 --- a/crates/ra_mbe/src/subtree_parser.rs +++ b/crates/ra_mbe/src/subtree_parser.rs | |||
@@ -46,10 +46,22 @@ impl<'a> Parser<'a> { | |||
46 | self.parse(|src, sink| ra_parser::parse_stmt(src, sink, false)) | 46 | self.parse(|src, sink| ra_parser::parse_stmt(src, sink, false)) |
47 | } | 47 | } |
48 | 48 | ||
49 | pub fn parse_block(self) -> Option<tt::TokenTree> { | ||
50 | self.parse(ra_parser::parse_block) | ||
51 | } | ||
52 | |||
53 | pub fn parse_meta(self) -> Option<tt::TokenTree> { | ||
54 | self.parse(ra_parser::parse_meta) | ||
55 | } | ||
56 | |||
49 | pub fn parse_item(self) -> Option<tt::TokenTree> { | 57 | pub fn parse_item(self) -> Option<tt::TokenTree> { |
50 | self.parse(ra_parser::parse_item) | 58 | self.parse(ra_parser::parse_item) |
51 | } | 59 | } |
52 | 60 | ||
61 | pub fn parse_vis(self) -> Option<tt::TokenTree> { | ||
62 | self.parse(ra_parser::parse_vis) | ||
63 | } | ||
64 | |||
53 | fn parse<F>(self, f: F) -> Option<tt::TokenTree> | 65 | fn parse<F>(self, f: F) -> Option<tt::TokenTree> |
54 | where | 66 | where |
55 | F: FnOnce(&dyn TokenSource, &mut dyn TreeSink), | 67 | F: FnOnce(&dyn TokenSource, &mut dyn TreeSink), |