Skip to content

Commit

Permalink
Merge #1070
Browse files Browse the repository at this point in the history
1070: Support extern_crate_self r=matklad a=memoryruins

closes #1069

Co-authored-by: memoryruins <memoryruinsmusic@gmail.com>
  • Loading branch information
bors[bot] and memoryruins committed Mar 28, 2019
2 parents de56dba + 7a06282 commit 2a77019
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions crates/ra_parser/src/grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ fn name_ref(p: &mut Parser) {
let m = p.start();
p.bump();
m.complete(p, NAME_REF);
} else if p.at(SELF_KW) {
let m = p.start();
p.bump();
m.complete(p, SELF_KW);
} else {
p.err_and_bump("expected identifier");
}
Expand Down
1 change: 1 addition & 0 deletions crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
extern crate foo;
extern crate foo as bar;
extern crate self as baz;
17 changes: 16 additions & 1 deletion crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SOURCE_FILE@[0; 43)
SOURCE_FILE@[0; 69)
EXTERN_CRATE_ITEM@[0; 17)
EXTERN_KW@[0; 6)
WHITESPACE@[6; 7)
Expand All @@ -23,3 +23,18 @@ SOURCE_FILE@[0; 43)
IDENT@[38; 41) "bar"
SEMI@[41; 42)
WHITESPACE@[42; 43)
EXTERN_CRATE_ITEM@[43; 68)
EXTERN_KW@[43; 49)
WHITESPACE@[49; 50)
CRATE_KW@[50; 55)
WHITESPACE@[55; 56)
SELF_KW@[56; 60)
SELF_KW@[56; 60)
WHITESPACE@[60; 61)
ALIAS@[61; 67)
AS_KW@[61; 63)
WHITESPACE@[63; 64)
NAME@[64; 67)
IDENT@[64; 67) "baz"
SEMI@[67; 68)
WHITESPACE@[68; 69)

0 comments on commit 2a77019

Please sign in to comment.