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 +- tests/data/parser/ok/0023_static_items.txt | 10 ++++++---- tests/data/parser/ok/0024_const_item.txt | 10 ++++++---- 3 files changed, 13 insertions(+), 9 deletions(-) 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); diff --git a/tests/data/parser/ok/0023_static_items.txt b/tests/data/parser/ok/0023_static_items.txt index 7cd2228fa..8872520c5 100644 --- a/tests/data/parser/ok/0023_static_items.txt +++ b/tests/data/parser/ok/0023_static_items.txt @@ -1,8 +1,9 @@ FILE@[0; 47) STATIC_ITEM@[0; 21) STATIC_KW@[0; 6) - WHITESPACE@[6; 7) - IDENT@[7; 10) "FOO" + NAME@[6; 10) + WHITESPACE@[6; 7) + IDENT@[7; 10) "FOO" COLON@[10; 11) WHITESPACE@[11; 12) IDENT@[12; 15) "u32" @@ -17,8 +18,9 @@ FILE@[0; 47) STATIC_KW@[21; 27) WHITESPACE@[27; 28) MUT_KW@[28; 31) - WHITESPACE@[31; 32) - IDENT@[32; 35) "BAR" + NAME@[31; 35) + WHITESPACE@[31; 32) + IDENT@[32; 35) "BAR" COLON@[35; 36) WHITESPACE@[36; 37) IDENT@[37; 40) "i32" diff --git a/tests/data/parser/ok/0024_const_item.txt b/tests/data/parser/ok/0024_const_item.txt index 588e001f5..0f31d19d3 100644 --- a/tests/data/parser/ok/0024_const_item.txt +++ b/tests/data/parser/ok/0024_const_item.txt @@ -1,8 +1,9 @@ FILE@[0; 46) CONST_ITEM@[0; 21) CONST_KW@[0; 5) - WHITESPACE@[5; 6) - IDENT@[6; 9) "FOO" + NAME@[5; 9) + WHITESPACE@[5; 6) + IDENT@[6; 9) "FOO" COLON@[9; 10) WHITESPACE@[10; 11) IDENT@[11; 14) "u32" @@ -17,8 +18,9 @@ FILE@[0; 46) CONST_KW@[21; 26) WHITESPACE@[26; 27) MUT_KW@[27; 30) - WHITESPACE@[30; 31) - IDENT@[31; 34) "BAR" + NAME@[30; 34) + WHITESPACE@[30; 31) + IDENT@[31; 34) "BAR" COLON@[34; 35) WHITESPACE@[35; 36) IDENT@[36; 39) "u32" -- cgit v1.2.3