From fc0a9e266b9d663b1eeca3963495c68ca3384be2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 10 Feb 2018 14:00:23 +0300 Subject: G: introduce names --- src/parser/grammar/items/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/parser/grammar/items') diff --git a/src/parser/grammar/items/mod.rs b/src/parser/grammar/items/mod.rs index ffe86fa97..d671568b1 100644 --- a/src/parser/grammar/items/mod.rs +++ b/src/parser/grammar/items/mod.rs @@ -196,8 +196,9 @@ fn extern_crate_item(p: &mut Parser) { p.bump(); assert!(p.at(CRATE_KW)); p.bump(); - - p.expect(IDENT) && alias(p) && p.expect(SEMI); + name(p); + alias(p); + p.expect(SEMI); } fn extern_block(p: &mut Parser) { -- cgit v1.2.3 From 3c9d8ff42357711775c3aeb3af03f528ee779932 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 10 Feb 2018 14:04:31 +0300 Subject: G: names for fns --- src/parser/grammar/items/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/parser/grammar/items') diff --git a/src/parser/grammar/items/mod.rs b/src/parser/grammar/items/mod.rs index d671568b1..61ebc740f 100644 --- a/src/parser/grammar/items/mod.rs +++ b/src/parser/grammar/items/mod.rs @@ -211,7 +211,7 @@ fn fn_item(p: &mut Parser) { assert!(p.at(FN_KW)); p.bump(); - p.expect(IDENT); + name(p); if p.at(L_PAREN) { fn_value_parameters(p); } else { -- cgit v1.2.3 From f746fb6a93a4f0493fc8f5602372c267befe4e48 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 10 Feb 2018 14:08:46 +0300 Subject: G: use names in consts --- src/parser/grammar/items/consts.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/parser/grammar/items') diff --git a/src/parser/grammar/items/consts.rs b/src/parser/grammar/items/consts.rs index c9881d681..8117af706 100644 --- a/src/parser/grammar/items/consts.rs +++ b/src/parser/grammar/items/consts.rs @@ -12,7 +12,7 @@ fn const_or_static(p: &mut Parser, kw: SyntaxKind) { assert!(p.at(kw)); p.bump(); p.eat(MUT_KW); // TODO: validator to forbid const mut - p.expect(IDENT); + name(p); p.expect(COLON); types::type_ref(p); p.expect(EQ); -- cgit v1.2.3 From ca6e93f091bc6f2e9dc26e842fc87d614089cf9d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 10 Feb 2018 14:10:02 +0300 Subject: G: use names in structs --- src/parser/grammar/items/structs.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/parser/grammar/items') diff --git a/src/parser/grammar/items/structs.rs b/src/parser/grammar/items/structs.rs index 640b940e4..3b1f8a38c 100644 --- a/src/parser/grammar/items/structs.rs +++ b/src/parser/grammar/items/structs.rs @@ -4,9 +4,7 @@ pub(super) fn struct_item(p: &mut Parser) { assert!(p.at(STRUCT_KW)); p.bump(); - if !p.expect(IDENT) { - return; - } + name(p); type_params::list(p); match p.current() { WHERE_KW => { -- cgit v1.2.3 From 8a735b667295f8390394b2536337698cb9a384ce Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 10 Feb 2018 14:10:50 +0300 Subject: G: use names in enums --- src/parser/grammar/items/structs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/parser/grammar/items') diff --git a/src/parser/grammar/items/structs.rs b/src/parser/grammar/items/structs.rs index 3b1f8a38c..3c122a56f 100644 --- a/src/parser/grammar/items/structs.rs +++ b/src/parser/grammar/items/structs.rs @@ -41,7 +41,7 @@ pub(super) fn struct_item(p: &mut Parser) { pub(super) fn enum_item(p: &mut Parser) { assert!(p.at(ENUM_KW)); p.bump(); - p.expect(IDENT); + name(p); type_params::list(p); type_params::where_clause(p); if p.expect(L_CURLY) { -- cgit v1.2.3 From c13e6db774acca952577fa7a18599b75b407f3c2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 10 Feb 2018 14:13:30 +0300 Subject: G: use names in fields --- src/parser/grammar/items/structs.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/parser/grammar/items') diff --git a/src/parser/grammar/items/structs.rs b/src/parser/grammar/items/structs.rs index 3c122a56f..eca0d2e64 100644 --- a/src/parser/grammar/items/structs.rs +++ b/src/parser/grammar/items/structs.rs @@ -86,7 +86,8 @@ fn named_fields(p: &mut Parser) { fn named_field(p: &mut Parser) { let field = p.start(); visibility(p); - if p.expect(IDENT) { + if p.at(IDENT) { + name(p); p.expect(COLON); types::type_ref(p); field.complete(p, NAMED_FIELD); -- cgit v1.2.3 From fa2131365e8ff2a6fa4fcb47aa04e6d51a32943e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 10 Feb 2018 14:15:04 +0300 Subject: G: use names in traits --- src/parser/grammar/items/traits.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/parser/grammar/items') diff --git a/src/parser/grammar/items/traits.rs b/src/parser/grammar/items/traits.rs index 3bef9639f..9961a88fe 100644 --- a/src/parser/grammar/items/traits.rs +++ b/src/parser/grammar/items/traits.rs @@ -3,7 +3,7 @@ use super::*; pub(super) fn trait_item(p: &mut Parser) { assert!(p.at(TRAIT_KW)); p.bump(); - p.expect(IDENT); + name(p); p.expect(L_CURLY); p.expect(R_CURLY); } -- cgit v1.2.3 From d68a187eb5adf489b5e1eef6aa23768b819d0e65 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 10 Feb 2018 14:22:31 +0300 Subject: G: use name in types --- src/parser/grammar/items/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/parser/grammar/items') diff --git a/src/parser/grammar/items/mod.rs b/src/parser/grammar/items/mod.rs index 61ebc740f..2d9580991 100644 --- a/src/parser/grammar/items/mod.rs +++ b/src/parser/grammar/items/mod.rs @@ -236,7 +236,7 @@ fn type_item(p: &mut Parser) { assert!(p.at(TYPE_KW)); p.bump(); - p.expect(IDENT); + name(p); // test type_item_type_params // type Result = (); -- cgit v1.2.3 From 199b3a1604095beee9eaeec541c8f158e85493ea Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 10 Feb 2018 14:23:18 +0300 Subject: G: use name in mods --- src/parser/grammar/items/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/parser/grammar/items') diff --git a/src/parser/grammar/items/mod.rs b/src/parser/grammar/items/mod.rs index 2d9580991..8bb821fb6 100644 --- a/src/parser/grammar/items/mod.rs +++ b/src/parser/grammar/items/mod.rs @@ -255,7 +255,8 @@ fn mod_item(p: &mut Parser) { assert!(p.at(MOD_KW)); p.bump(); - if p.expect(IDENT) && !p.eat(SEMI) { + name(p); + if !p.eat(SEMI) { if p.expect(L_CURLY) { mod_contents(p, true); p.expect(R_CURLY); -- cgit v1.2.3