aboutsummaryrefslogtreecommitdiff
path: root/src/grammar
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-08 20:09:47 +0100
committerAleksey Kladov <[email protected]>2018-08-08 20:15:14 +0100
commit8c598d3d8a9d6fe0b8303250c88c252ff98883fd (patch)
treec7957dd4465a2e69ca3dfb447e97a776ac47c3aa /src/grammar
parenta5dc5f1b5cc7932477225128b2c6c9e8dff9cd73 (diff)
Support crate vis
Diffstat (limited to 'src/grammar')
-rw-r--r--src/grammar/mod.rs55
1 files changed, 32 insertions, 23 deletions
diff --git a/src/grammar/mod.rs b/src/grammar/mod.rs
index b6da0d013..1e7d04ce9 100644
--- a/src/grammar/mod.rs
+++ b/src/grammar/mod.rs
@@ -55,34 +55,43 @@ impl BlockLike {
55} 55}
56 56
57fn visibility(p: &mut Parser) { 57fn visibility(p: &mut Parser) {
58 if p.at(PUB_KW) { 58 match p.current() {
59 let vis = p.start(); 59 PUB_KW => {
60 p.bump(); 60 let m = p.start();
61 if p.at(L_PAREN) { 61 p.bump();
62 match p.nth(1) { 62 if p.at(L_PAREN) {
63 // test crate_visibility 63 match p.nth(1) {
64 // pub(crate) struct S; 64 // test crate_visibility
65 // pub(self) struct S; 65 // pub(crate) struct S;
66 // pub(self) struct S; 66 // pub(self) struct S;
67 // pub(self) struct S; 67 // pub(self) struct S;
68 CRATE_KW | SELF_KW | SUPER_KW => { 68 // pub(self) struct S;
69 p.bump(); 69 CRATE_KW | SELF_KW | SUPER_KW => {
70 p.bump(); 70 p.bump();
71 p.expect(R_PAREN); 71 p.bump();
72 } 72 p.expect(R_PAREN);
73 IN_KW => { 73 }
74 p.bump(); 74 IN_KW => {
75 p.bump(); 75 p.bump();
76 paths::use_path(p); 76 p.bump();
77 p.expect(R_PAREN); 77 paths::use_path(p);
78 p.expect(R_PAREN);
79 }
80 _ => (),
78 } 81 }
79 _ => (),
80 } 82 }
83 m.complete(p, VISIBILITY);
81 } 84 }
82 vis.complete(p, VISIBILITY); 85 // test crate_keyword_vis
86 // crate fn main() { }
87 CRATE_KW => {
88 let m = p.start();
89 p.bump();
90 m.complete(p, VISIBILITY);
91 }
92 _ => (),
83 } 93 }
84} 94}
85
86fn alias(p: &mut Parser) -> bool { 95fn alias(p: &mut Parser) -> bool {
87 if p.at(AS_KW) { 96 if p.at(AS_KW) {
88 let alias = p.start(); 97 let alias = p.start();