From f31d85860771b0c4c8d232d79e4a3489a051ba9d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 12 Jan 2018 22:05:46 +0300 Subject: G: visibility --- src/parser/event_parser/grammar/items.rs | 2 +- src/parser/event_parser/grammar/mod.rs | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'src/parser/event_parser') diff --git a/src/parser/event_parser/grammar/items.rs b/src/parser/event_parser/grammar/items.rs index 725f04d1e..f7310c09a 100644 --- a/src/parser/event_parser/grammar/items.rs +++ b/src/parser/event_parser/grammar/items.rs @@ -12,7 +12,7 @@ pub(super) fn mod_contents(p: &mut Parser) { fn item_first(p: &Parser) -> bool { match p.current() { - STRUCT_KW | FN_KW | EXTERN_KW | MOD_KW | USE_KW | POUND => true, + STRUCT_KW | FN_KW | EXTERN_KW | MOD_KW | USE_KW | POUND | PUB_KW => true, _ => false, } } diff --git a/src/parser/event_parser/grammar/mod.rs b/src/parser/event_parser/grammar/mod.rs index 3c4b223a9..1c57e0cb4 100644 --- a/src/parser/event_parser/grammar/mod.rs +++ b/src/parser/event_parser/grammar/mod.rs @@ -15,7 +15,25 @@ pub(crate) fn file(p: &mut Parser) { }) } -fn visibility(_: &mut Parser) { +fn visibility(p: &mut Parser) { + node_if(p, PUB_KW, VISIBILITY, |p| { + if p.current() != L_PAREN { + return + } + match p.raw_lookahead(1) { + CRATE_KW | SELF_KW | SUPER_KW => { + p.bump(); + p.bump(); + } + IN_KW => { + p.bump(); + p.bump(); + paths::use_path(p); + } + _ => return + } + p.expect(R_PAREN); + }); } fn alias(p: &mut Parser) -> bool { -- cgit v1.2.3