diff options
Diffstat (limited to 'crates/ra_parser/src/grammar.rs')
-rw-r--r-- | crates/ra_parser/src/grammar.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index c9941fe93..e428faffb 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs | |||
@@ -86,7 +86,7 @@ impl BlockLike { | |||
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | fn opt_visibility(p: &mut Parser) { | 89 | fn opt_visibility(p: &mut Parser) -> bool { |
90 | match p.current() { | 90 | match p.current() { |
91 | PUB_KW => { | 91 | PUB_KW => { |
92 | let m = p.start(); | 92 | let m = p.start(); |
@@ -116,13 +116,19 @@ fn opt_visibility(p: &mut Parser) { | |||
116 | } | 116 | } |
117 | // test crate_keyword_vis | 117 | // test crate_keyword_vis |
118 | // crate fn main() { } | 118 | // crate fn main() { } |
119 | CRATE_KW => { | 119 | // struct S { crate field: u32 } |
120 | // struct T(crate u32); | ||
121 | // | ||
122 | // test crate_keyword_path | ||
123 | // fn foo() { crate::foo(); } | ||
124 | CRATE_KW if p.nth(1) != COLONCOLON => { | ||
120 | let m = p.start(); | 125 | let m = p.start(); |
121 | p.bump(); | 126 | p.bump(); |
122 | m.complete(p, VISIBILITY); | 127 | m.complete(p, VISIBILITY); |
123 | } | 128 | } |
124 | _ => (), | 129 | _ => return false, |
125 | } | 130 | } |
131 | true | ||
126 | } | 132 | } |
127 | 133 | ||
128 | fn opt_alias(p: &mut Parser) { | 134 | fn opt_alias(p: &mut Parser) { |