Add vis matcher

This commit is contained in:
Edwin Cheng 2019-04-19 21:38:26 +08:00
parent c5983b85fc
commit 87ff908135
6 changed files with 33 additions and 1 deletions

View file

@ -167,7 +167,7 @@ impl BlockLike {
}
}
fn opt_visibility(p: &mut Parser) -> bool {
pub(crate) fn opt_visibility(p: &mut Parser) -> bool {
match p.current() {
PUB_KW => {
let m = p.start();

View file

@ -107,6 +107,13 @@ pub fn parse_item(token_source: &dyn TokenSource, tree_sink: &mut dyn TreeSink)
parse_from_tokens(token_source, tree_sink, grammar::item);
}
/// Parse given tokens into the given sink as an visibility qualifier
pub fn parse_vis(token_source: &dyn TokenSource, tree_sink: &mut dyn TreeSink) {
parse_from_tokens(token_source, tree_sink, |p| {
grammar::opt_visibility(p);
});
}
pub fn parse_macro_items(token_source: &dyn TokenSource, tree_sink: &mut dyn TreeSink) {
parse_from_tokens(token_source, tree_sink, grammar::macro_items);
}