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_parser/src/lib.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_parser/src/lib.rs')
-rw-r--r-- | crates/ra_parser/src/lib.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crates/ra_parser/src/lib.rs b/crates/ra_parser/src/lib.rs index 0ea942b6e..970d699c0 100644 --- a/crates/ra_parser/src/lib.rs +++ b/crates/ra_parser/src/lib.rs | |||
@@ -93,11 +93,27 @@ pub fn parse_stmt(token_source: &dyn TokenSource, tree_sink: &mut dyn TreeSink, | |||
93 | parse_from_tokens(token_source, tree_sink, |p| grammar::stmt(p, with_semi)); | 93 | parse_from_tokens(token_source, tree_sink, |p| grammar::stmt(p, with_semi)); |
94 | } | 94 | } |
95 | 95 | ||
96 | /// Parse given tokens into the given sink as a block | ||
97 | pub fn parse_block(token_source: &dyn TokenSource, tree_sink: &mut dyn TreeSink) { | ||
98 | parse_from_tokens(token_source, tree_sink, grammar::block); | ||
99 | } | ||
100 | |||
101 | pub fn parse_meta(token_source: &dyn TokenSource, tree_sink: &mut dyn TreeSink) { | ||
102 | parse_from_tokens(token_source, tree_sink, grammar::meta_item); | ||
103 | } | ||
104 | |||
96 | /// Parse given tokens into the given sink as an item | 105 | /// Parse given tokens into the given sink as an item |
97 | pub fn parse_item(token_source: &dyn TokenSource, tree_sink: &mut dyn TreeSink) { | 106 | pub fn parse_item(token_source: &dyn TokenSource, tree_sink: &mut dyn TreeSink) { |
98 | parse_from_tokens(token_source, tree_sink, grammar::item); | 107 | parse_from_tokens(token_source, tree_sink, grammar::item); |
99 | } | 108 | } |
100 | 109 | ||
110 | /// Parse given tokens into the given sink as an visibility qualifier | ||
111 | pub fn parse_vis(token_source: &dyn TokenSource, tree_sink: &mut dyn TreeSink) { | ||
112 | parse_from_tokens(token_source, tree_sink, |p| { | ||
113 | grammar::opt_visibility(p); | ||
114 | }); | ||
115 | } | ||
116 | |||
101 | pub fn parse_macro_items(token_source: &dyn TokenSource, tree_sink: &mut dyn TreeSink) { | 117 | pub fn parse_macro_items(token_source: &dyn TokenSource, tree_sink: &mut dyn TreeSink) { |
102 | parse_from_tokens(token_source, tree_sink, grammar::macro_items); | 118 | parse_from_tokens(token_source, tree_sink, grammar::macro_items); |
103 | } | 119 | } |