aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar.rs
diff options
context:
space:
mode:
authorpcpthm <[email protected]>2019-03-18 05:34:08 +0000
committerpcpthm <[email protected]>2019-03-18 05:34:08 +0000
commit76075c74103b3204ebc1bde54a330629d9e00811 (patch)
tree316ffdffb672856e7d897736e280261a11a07efd /crates/ra_parser/src/grammar.rs
parent3d9c2beb8e0d4e0fbaded7dac259cadf7616a3ad (diff)
Use Marker argument for item parsers
- Fix pub_expr - Fix incorrect parsing of crate::path
Diffstat (limited to 'crates/ra_parser/src/grammar.rs')
-rw-r--r--crates/ra_parser/src/grammar.rs12
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
89fn opt_visibility(p: &mut Parser) { 89fn 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
128fn opt_alias(p: &mut Parser) { 134fn opt_alias(p: &mut Parser) {