diff options
author | Aleksey Kladov <[email protected]> | 2018-01-12 19:05:46 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-01-12 19:05:46 +0000 |
commit | f31d85860771b0c4c8d232d79e4a3489a051ba9d (patch) | |
tree | 931adff1f926fa41943b726282f20822ade8ee36 /src/parser/event_parser | |
parent | c111a1f7b8b9da2b4691c792e1658b2888ff5420 (diff) |
G: visibility
Diffstat (limited to 'src/parser/event_parser')
-rw-r--r-- | src/parser/event_parser/grammar/items.rs | 2 | ||||
-rw-r--r-- | src/parser/event_parser/grammar/mod.rs | 20 |
2 files changed, 20 insertions, 2 deletions
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) { | |||
12 | 12 | ||
13 | fn item_first(p: &Parser) -> bool { | 13 | fn item_first(p: &Parser) -> bool { |
14 | match p.current() { | 14 | match p.current() { |
15 | STRUCT_KW | FN_KW | EXTERN_KW | MOD_KW | USE_KW | POUND => true, | 15 | STRUCT_KW | FN_KW | EXTERN_KW | MOD_KW | USE_KW | POUND | PUB_KW => true, |
16 | _ => false, | 16 | _ => false, |
17 | } | 17 | } |
18 | } | 18 | } |
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) { | |||
15 | }) | 15 | }) |
16 | } | 16 | } |
17 | 17 | ||
18 | fn visibility(_: &mut Parser) { | 18 | fn visibility(p: &mut Parser) { |
19 | node_if(p, PUB_KW, VISIBILITY, |p| { | ||
20 | if p.current() != L_PAREN { | ||
21 | return | ||
22 | } | ||
23 | match p.raw_lookahead(1) { | ||
24 | CRATE_KW | SELF_KW | SUPER_KW => { | ||
25 | p.bump(); | ||
26 | p.bump(); | ||
27 | } | ||
28 | IN_KW => { | ||
29 | p.bump(); | ||
30 | p.bump(); | ||
31 | paths::use_path(p); | ||
32 | } | ||
33 | _ => return | ||
34 | } | ||
35 | p.expect(R_PAREN); | ||
36 | }); | ||
19 | } | 37 | } |
20 | 38 | ||
21 | fn alias(p: &mut Parser) -> bool { | 39 | fn alias(p: &mut Parser) -> bool { |