aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs10
-rw-r--r--crates/ra_syntax/src/grammar.ron4
-rw-r--r--crates/ra_syntax/src/grammar/items.rs2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0060_extern_crate.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/ok/0007_extern_crate.txt4
5 files changed, 16 insertions, 6 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 60480c699..a8d60e882 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -970,7 +970,15 @@ impl ToOwned for ExternCrateItem {
970} 970}
971 971
972 972
973impl ExternCrateItem {} 973impl ExternCrateItem {
974 pub fn name_ref(&self) -> Option<&NameRef> {
975 super::child_opt(self)
976 }
977
978 pub fn alias(&self) -> Option<&Alias> {
979 super::child_opt(self)
980 }
981}
974 982
975// FalseKw 983// FalseKw
976#[derive(Debug, PartialEq, Eq, Hash)] 984#[derive(Debug, PartialEq, Eq, Hash)]
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index a2ccd7cb9..2ed1fd1b8 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -601,7 +601,9 @@ Grammar(
601 "UseTreeList": ( 601 "UseTreeList": (
602 collections: [["use_trees", "UseTree"]] 602 collections: [["use_trees", "UseTree"]]
603 ), 603 ),
604 "ExternCrateItem": (), 604 "ExternCrateItem": (
605 options: ["NameRef", "Alias"],
606 ),
605 "ArgList": ( 607 "ArgList": (
606 collections: [ 608 collections: [
607 ["args", "Expr"] 609 ["args", "Expr"]
diff --git a/crates/ra_syntax/src/grammar/items.rs b/crates/ra_syntax/src/grammar/items.rs
index 18039cd3f..84c18a293 100644
--- a/crates/ra_syntax/src/grammar/items.rs
+++ b/crates/ra_syntax/src/grammar/items.rs
@@ -247,7 +247,7 @@ fn extern_crate_item(p: &mut Parser) {
247 p.bump(); 247 p.bump();
248 assert!(p.at(CRATE_KW)); 248 assert!(p.at(CRATE_KW));
249 p.bump(); 249 p.bump();
250 name(p); 250 name_ref(p);
251 opt_alias(p); 251 opt_alias(p);
252 p.expect(SEMI); 252 p.expect(SEMI);
253} 253}
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0060_extern_crate.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0060_extern_crate.txt
index 7ffdc7fbd..a7b428787 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0060_extern_crate.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0060_extern_crate.txt
@@ -4,7 +4,7 @@ SOURCE_FILE@[0; 18)
4 WHITESPACE@[6; 7) 4 WHITESPACE@[6; 7)
5 CRATE_KW@[7; 12) 5 CRATE_KW@[7; 12)
6 WHITESPACE@[12; 13) 6 WHITESPACE@[12; 13)
7 NAME@[13; 16) 7 NAME_REF@[13; 16)
8 IDENT@[13; 16) "foo" 8 IDENT@[13; 16) "foo"
9 SEMI@[16; 17) 9 SEMI@[16; 17)
10 WHITESPACE@[17; 18) 10 WHITESPACE@[17; 18)
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 5adf3f276..5558d952e 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
@@ -4,7 +4,7 @@ SOURCE_FILE@[0; 43)
4 WHITESPACE@[6; 7) 4 WHITESPACE@[6; 7)
5 CRATE_KW@[7; 12) 5 CRATE_KW@[7; 12)
6 WHITESPACE@[12; 13) 6 WHITESPACE@[12; 13)
7 NAME@[13; 16) 7 NAME_REF@[13; 16)
8 IDENT@[13; 16) "foo" 8 IDENT@[13; 16) "foo"
9 SEMI@[16; 17) 9 SEMI@[16; 17)
10 WHITESPACE@[17; 18) 10 WHITESPACE@[17; 18)
@@ -13,7 +13,7 @@ SOURCE_FILE@[0; 43)
13 WHITESPACE@[24; 25) 13 WHITESPACE@[24; 25)
14 CRATE_KW@[25; 30) 14 CRATE_KW@[25; 30)
15 WHITESPACE@[30; 31) 15 WHITESPACE@[30; 31)
16 NAME@[31; 34) 16 NAME_REF@[31; 34)
17 IDENT@[31; 34) "foo" 17 IDENT@[31; 34) "foo"
18 WHITESPACE@[34; 35) 18 WHITESPACE@[34; 35)
19 ALIAS@[35; 41) 19 ALIAS@[35; 41)