aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-28 19:59:48 +0100
committerAleksey Kladov <[email protected]>2020-07-28 19:59:48 +0100
commitb10e437039c2d7e300f6be6b5de6446419a2d660 (patch)
treec08df3e0cf61f1acecdefed66b88634988dc981a
parenteb99c35b3da43020df074b91243f6b51d792d116 (diff)
Fix nameref parsing
-rw-r--r--crates/ra_parser/src/grammar.rs4
-rw-r--r--crates/ra_parser/src/grammar/items.rs8
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0007_extern_crate.rast3
3 files changed, 8 insertions, 7 deletions
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs
index caedeead0..de2c98afd 100644
--- a/crates/ra_parser/src/grammar.rs
+++ b/crates/ra_parser/src/grammar.rs
@@ -270,10 +270,6 @@ fn name_ref(p: &mut Parser) {
270 let m = p.start(); 270 let m = p.start();
271 p.bump(IDENT); 271 p.bump(IDENT);
272 m.complete(p, NAME_REF); 272 m.complete(p, NAME_REF);
273 } else if p.at(T![self]) {
274 let m = p.start();
275 p.bump(T![self]);
276 m.complete(p, T![self]);
277 } else { 273 } else {
278 p.err_and_bump("expected identifier"); 274 p.err_and_bump("expected identifier");
279 } 275 }
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs
index 97642bc24..ffcdaaa99 100644
--- a/crates/ra_parser/src/grammar/items.rs
+++ b/crates/ra_parser/src/grammar/items.rs
@@ -304,7 +304,13 @@ fn extern_crate_item(p: &mut Parser, m: Marker) {
304 p.bump(T![extern]); 304 p.bump(T![extern]);
305 assert!(p.at(T![crate])); 305 assert!(p.at(T![crate]));
306 p.bump(T![crate]); 306 p.bump(T![crate]);
307 name_ref(p); 307
308 if p.at(T![self]) {
309 p.bump(T![self]);
310 } else {
311 name_ref(p);
312 }
313
308 opt_alias(p); 314 opt_alias(p);
309 p.expect(T![;]); 315 p.expect(T![;]);
310 m.complete(p, EXTERN_CRATE_ITEM); 316 m.complete(p, EXTERN_CRATE_ITEM);
diff --git a/crates/ra_syntax/test_data/parser/ok/0007_extern_crate.rast b/crates/ra_syntax/test_data/parser/ok/0007_extern_crate.rast
index b5bdf0aa9..271486605 100644
--- a/crates/ra_syntax/test_data/parser/ok/0007_extern_crate.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0007_extern_crate.rast
@@ -28,8 +28,7 @@ [email protected]
28 [email protected] " " 28 [email protected] " "
29 [email protected] "crate" 29 [email protected] "crate"
30 [email protected] " " 30 [email protected] " "
31 [email protected] 31 [email protected] "self"
32 [email protected] "self"
33 [email protected] " " 32 [email protected] " "
34 [email protected] 33 [email protected]
35 [email protected] "as" 34 [email protected] "as"