From b10e437039c2d7e300f6be6b5de6446419a2d660 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 28 Jul 2020 20:59:48 +0200 Subject: Fix nameref parsing --- crates/ra_parser/src/grammar/items.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'crates/ra_parser/src/grammar/items.rs') 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) { p.bump(T![extern]); assert!(p.at(T![crate])); p.bump(T![crate]); - name_ref(p); + + if p.at(T![self]) { + p.bump(T![self]); + } else { + name_ref(p); + } + opt_alias(p); p.expect(T![;]); m.complete(p, EXTERN_CRATE_ITEM); -- cgit v1.2.3 From d032f872b619c651dc66bfd669ef783108fc122c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 12:26:57 +0200 Subject: Finish extern crates grammar --- crates/ra_parser/src/grammar/items.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_parser/src/grammar/items.rs') diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index ffcdaaa99..3b73e5346 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs @@ -313,7 +313,7 @@ fn extern_crate_item(p: &mut Parser, m: Marker) { opt_alias(p); p.expect(T![;]); - m.complete(p, EXTERN_CRATE_ITEM); + m.complete(p, EXTERN_CRATE); } pub(crate) fn extern_item_list(p: &mut Parser) { -- cgit v1.2.3 From 1142112c70b705f59b7d559d9d72cdc831865158 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 14:51:08 +0200 Subject: Rename FnDef -> Fn --- crates/ra_parser/src/grammar/items.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_parser/src/grammar/items.rs') diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index 3b73e5346..7f8a51ddb 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs @@ -180,7 +180,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul // unsafe const fn bar() {} T![fn] => { fn_def(p); - m.complete(p, FN_DEF); + m.complete(p, FN); } // test unsafe_trait -- cgit v1.2.3 From eb2f8063444b11257111f4f8ade990ec810e0361 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 15:25:46 +0200 Subject: Rename TypeAliasDef -> TypeAlias --- crates/ra_parser/src/grammar/items.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_parser/src/grammar/items.rs') diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index 7f8a51ddb..664b23f6a 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs @@ -380,7 +380,7 @@ fn type_def(p: &mut Parser, m: Marker) { types::type_(p); } p.expect(T![;]); - m.complete(p, TYPE_ALIAS_DEF); + m.complete(p, TYPE_ALIAS); } pub(crate) fn mod_item(p: &mut Parser, m: Marker) { -- cgit v1.2.3 From c83467796b6c7365ea4f41900d74444384a9e618 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 18:17:28 +0200 Subject: Finalize Trait grammar --- crates/ra_parser/src/grammar/items.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_parser/src/grammar/items.rs') diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index 664b23f6a..5603d61a9 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs @@ -193,7 +193,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul // unsafe auto trait T {} T![trait] => { traits::trait_def(p); - m.complete(p, TRAIT_DEF); + m.complete(p, TRAIT); } // test unsafe_impl -- cgit v1.2.3 From c5798c4d75aa807aec47208a49101bdec3affcca Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 18:28:28 +0200 Subject: Finalize impl Grammar --- crates/ra_parser/src/grammar/items.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_parser/src/grammar/items.rs') diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index 5603d61a9..cca524cea 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs @@ -221,7 +221,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul // unsafe default impl Foo {} T![impl] => { traits::impl_def(p); - m.complete(p, IMPL_DEF); + m.complete(p, IMPL); } // test existential_type -- cgit v1.2.3