aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_parser/src/grammar.rs4
-rw-r--r--crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.rs1
-rw-r--r--crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.txt17
3 files changed, 21 insertions, 1 deletions
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs
index e428faffb..b2ffeff8c 100644
--- a/crates/ra_parser/src/grammar.rs
+++ b/crates/ra_parser/src/grammar.rs
@@ -184,6 +184,10 @@ fn name_ref(p: &mut Parser) {
184 let m = p.start(); 184 let m = p.start();
185 p.bump(); 185 p.bump();
186 m.complete(p, NAME_REF); 186 m.complete(p, NAME_REF);
187 } else if p.at(SELF_KW) {
188 let m = p.start();
189 p.bump();
190 m.complete(p, SELF_KW);
187 } else { 191 } else {
188 p.err_and_bump("expected identifier"); 192 p.err_and_bump("expected identifier");
189 } 193 }
diff --git a/crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.rs b/crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.rs
index 3ce336676..ab81a608c 100644
--- a/crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.rs
+++ b/crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.rs
@@ -1,2 +1,3 @@
1extern crate foo; 1extern crate foo;
2extern crate foo as bar; 2extern crate foo as bar;
3extern crate self as baz;
diff --git a/crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.txt b/crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.txt
index 5558d952e..0176260c1 100644
--- a/crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.txt
+++ b/crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.txt
@@ -1,4 +1,4 @@
1SOURCE_FILE@[0; 43) 1SOURCE_FILE@[0; 69)
2 EXTERN_CRATE_ITEM@[0; 17) 2 EXTERN_CRATE_ITEM@[0; 17)
3 EXTERN_KW@[0; 6) 3 EXTERN_KW@[0; 6)
4 WHITESPACE@[6; 7) 4 WHITESPACE@[6; 7)
@@ -23,3 +23,18 @@ SOURCE_FILE@[0; 43)
23 IDENT@[38; 41) "bar" 23 IDENT@[38; 41) "bar"
24 SEMI@[41; 42) 24 SEMI@[41; 42)
25 WHITESPACE@[42; 43) 25 WHITESPACE@[42; 43)
26 EXTERN_CRATE_ITEM@[43; 68)
27 EXTERN_KW@[43; 49)
28 WHITESPACE@[49; 50)
29 CRATE_KW@[50; 55)
30 WHITESPACE@[55; 56)
31 SELF_KW@[56; 60)
32 SELF_KW@[56; 60)
33 WHITESPACE@[60; 61)
34 ALIAS@[61; 67)
35 AS_KW@[61; 63)
36 WHITESPACE@[63; 64)
37 NAME@[64; 67)
38 IDENT@[64; 67) "baz"
39 SEMI@[67; 68)
40 WHITESPACE@[68; 69)