diff options
Diffstat (limited to 'crates')
7 files changed, 51 insertions, 129 deletions
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index 5c413317e..a98a2a3ef 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs | |||
@@ -188,19 +188,9 @@ fn array_expr(p: &mut Parser) -> CompletedMarker { | |||
188 | p.bump(T!['[']); | 188 | p.bump(T!['[']); |
189 | while !p.at(EOF) && !p.at(T![']']) { | 189 | while !p.at(EOF) && !p.at(T![']']) { |
190 | n_exprs += 1; | 190 | n_exprs += 1; |
191 | // test first_array_member_attributes | 191 | |
192 | // pub const A: &[i64] = &[ | 192 | // test array_attrs |
193 | // #[cfg(test)] | 193 | // const A: &[i64] = &[1, #[cfg(test)] 2]; |
194 | // 1, | ||
195 | // 2, | ||
196 | // ]; | ||
197 | |||
198 | // test subsequent_array_member_attributes | ||
199 | // pub const A: &[i64] = &[ | ||
200 | // 1, | ||
201 | // #[cfg(test)] | ||
202 | // 2, | ||
203 | // ]; | ||
204 | let m = p.start(); | 194 | let m = p.start(); |
205 | let has_attrs = p.at(T![#]); | 195 | let has_attrs = p.at(T![#]); |
206 | attributes::outer_attributes(p); | 196 | attributes::outer_attributes(p); |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0135_first_array_member_attributes.rs b/crates/ra_syntax/test_data/parser/inline/ok/0135_first_array_member_attributes.rs deleted file mode 100644 index f59e13771..000000000 --- a/crates/ra_syntax/test_data/parser/inline/ok/0135_first_array_member_attributes.rs +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | pub const A: &[i64] = &[ | ||
2 | #[cfg(test)] | ||
3 | 1, | ||
4 | 2, | ||
5 | ]; | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0135_first_array_member_attributes.txt b/crates/ra_syntax/test_data/parser/inline/ok/0135_first_array_member_attributes.txt deleted file mode 100644 index 2e3a13005..000000000 --- a/crates/ra_syntax/test_data/parser/inline/ok/0135_first_array_member_attributes.txt +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | SOURCE_FILE@[0; 56) | ||
2 | CONST_DEF@[0; 55) | ||
3 | VISIBILITY@[0; 3) | ||
4 | PUB_KW@[0; 3) "pub" | ||
5 | WHITESPACE@[3; 4) " " | ||
6 | CONST_KW@[4; 9) "const" | ||
7 | WHITESPACE@[9; 10) " " | ||
8 | NAME@[10; 11) | ||
9 | IDENT@[10; 11) "A" | ||
10 | COLON@[11; 12) ":" | ||
11 | WHITESPACE@[12; 13) " " | ||
12 | REFERENCE_TYPE@[13; 19) | ||
13 | AMP@[13; 14) "&" | ||
14 | SLICE_TYPE@[14; 19) | ||
15 | L_BRACK@[14; 15) "[" | ||
16 | PATH_TYPE@[15; 18) | ||
17 | PATH@[15; 18) | ||
18 | PATH_SEGMENT@[15; 18) | ||
19 | NAME_REF@[15; 18) | ||
20 | IDENT@[15; 18) "i64" | ||
21 | R_BRACK@[18; 19) "]" | ||
22 | WHITESPACE@[19; 20) " " | ||
23 | EQ@[20; 21) "=" | ||
24 | WHITESPACE@[21; 22) " " | ||
25 | REF_EXPR@[22; 54) | ||
26 | AMP@[22; 23) "&" | ||
27 | ARRAY_EXPR@[23; 54) | ||
28 | L_BRACK@[23; 24) "[" | ||
29 | WHITESPACE@[24; 28) "\n " | ||
30 | LITERAL@[28; 45) | ||
31 | ATTR@[28; 40) | ||
32 | POUND@[28; 29) "#" | ||
33 | L_BRACK@[29; 30) "[" | ||
34 | PATH@[30; 33) | ||
35 | PATH_SEGMENT@[30; 33) | ||
36 | NAME_REF@[30; 33) | ||
37 | IDENT@[30; 33) "cfg" | ||
38 | TOKEN_TREE@[33; 39) | ||
39 | L_PAREN@[33; 34) "(" | ||
40 | IDENT@[34; 38) "test" | ||
41 | R_PAREN@[38; 39) ")" | ||
42 | R_BRACK@[39; 40) "]" | ||
43 | WHITESPACE@[40; 44) "\n " | ||
44 | INT_NUMBER@[44; 45) "1" | ||
45 | COMMA@[45; 46) "," | ||
46 | WHITESPACE@[46; 50) "\n " | ||
47 | LITERAL@[50; 51) | ||
48 | INT_NUMBER@[50; 51) "2" | ||
49 | COMMA@[51; 52) "," | ||
50 | WHITESPACE@[52; 53) "\n" | ||
51 | R_BRACK@[53; 54) "]" | ||
52 | SEMI@[54; 55) ";" | ||
53 | WHITESPACE@[55; 56) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0136_subsequent_array_member_attributes.rs b/crates/ra_syntax/test_data/parser/inline/ok/0136_subsequent_array_member_attributes.rs deleted file mode 100644 index 1324acb3f..000000000 --- a/crates/ra_syntax/test_data/parser/inline/ok/0136_subsequent_array_member_attributes.rs +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | pub const A: &[i64] = &[ | ||
2 | 1, | ||
3 | #[cfg(test)] | ||
4 | 2, | ||
5 | ]; | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0136_subsequent_array_member_attributes.txt b/crates/ra_syntax/test_data/parser/inline/ok/0136_subsequent_array_member_attributes.txt deleted file mode 100644 index 1bb8a0afc..000000000 --- a/crates/ra_syntax/test_data/parser/inline/ok/0136_subsequent_array_member_attributes.txt +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | SOURCE_FILE@[0; 56) | ||
2 | CONST_DEF@[0; 55) | ||
3 | VISIBILITY@[0; 3) | ||
4 | PUB_KW@[0; 3) "pub" | ||
5 | WHITESPACE@[3; 4) " " | ||
6 | CONST_KW@[4; 9) "const" | ||
7 | WHITESPACE@[9; 10) " " | ||
8 | NAME@[10; 11) | ||
9 | IDENT@[10; 11) "A" | ||
10 | COLON@[11; 12) ":" | ||
11 | WHITESPACE@[12; 13) " " | ||
12 | REFERENCE_TYPE@[13; 19) | ||
13 | AMP@[13; 14) "&" | ||
14 | SLICE_TYPE@[14; 19) | ||
15 | L_BRACK@[14; 15) "[" | ||
16 | PATH_TYPE@[15; 18) | ||
17 | PATH@[15; 18) | ||
18 | PATH_SEGMENT@[15; 18) | ||
19 | NAME_REF@[15; 18) | ||
20 | IDENT@[15; 18) "i64" | ||
21 | R_BRACK@[18; 19) "]" | ||
22 | WHITESPACE@[19; 20) " " | ||
23 | EQ@[20; 21) "=" | ||
24 | WHITESPACE@[21; 22) " " | ||
25 | REF_EXPR@[22; 54) | ||
26 | AMP@[22; 23) "&" | ||
27 | ARRAY_EXPR@[23; 54) | ||
28 | L_BRACK@[23; 24) "[" | ||
29 | WHITESPACE@[24; 28) "\n " | ||
30 | LITERAL@[28; 29) | ||
31 | INT_NUMBER@[28; 29) "1" | ||
32 | COMMA@[29; 30) "," | ||
33 | WHITESPACE@[30; 34) "\n " | ||
34 | LITERAL@[34; 51) | ||
35 | ATTR@[34; 46) | ||
36 | POUND@[34; 35) "#" | ||
37 | L_BRACK@[35; 36) "[" | ||
38 | PATH@[36; 39) | ||
39 | PATH_SEGMENT@[36; 39) | ||
40 | NAME_REF@[36; 39) | ||
41 | IDENT@[36; 39) "cfg" | ||
42 | TOKEN_TREE@[39; 45) | ||
43 | L_PAREN@[39; 40) "(" | ||
44 | IDENT@[40; 44) "test" | ||
45 | R_PAREN@[44; 45) ")" | ||
46 | R_BRACK@[45; 46) "]" | ||
47 | WHITESPACE@[46; 50) "\n " | ||
48 | INT_NUMBER@[50; 51) "2" | ||
49 | COMMA@[51; 52) "," | ||
50 | WHITESPACE@[52; 53) "\n" | ||
51 | R_BRACK@[53; 54) "]" | ||
52 | SEMI@[54; 55) ";" | ||
53 | WHITESPACE@[55; 56) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rs b/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rs new file mode 100644 index 000000000..2ac310924 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rs | |||
@@ -0,0 +1 @@ | |||
const A: &[i64] = &[1, #[cfg(test)] 2]; | |||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.txt b/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.txt new file mode 100644 index 000000000..78e296f88 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.txt | |||
@@ -0,0 +1,47 @@ | |||
1 | SOURCE_FILE@[0; 40) | ||
2 | CONST_DEF@[0; 39) | ||
3 | CONST_KW@[0; 5) "const" | ||
4 | WHITESPACE@[5; 6) " " | ||
5 | NAME@[6; 7) | ||
6 | IDENT@[6; 7) "A" | ||
7 | COLON@[7; 8) ":" | ||
8 | WHITESPACE@[8; 9) " " | ||
9 | REFERENCE_TYPE@[9; 15) | ||
10 | AMP@[9; 10) "&" | ||
11 | SLICE_TYPE@[10; 15) | ||
12 | L_BRACK@[10; 11) "[" | ||
13 | PATH_TYPE@[11; 14) | ||
14 | PATH@[11; 14) | ||
15 | PATH_SEGMENT@[11; 14) | ||
16 | NAME_REF@[11; 14) | ||
17 | IDENT@[11; 14) "i64" | ||
18 | R_BRACK@[14; 15) "]" | ||
19 | WHITESPACE@[15; 16) " " | ||
20 | EQ@[16; 17) "=" | ||
21 | WHITESPACE@[17; 18) " " | ||
22 | REF_EXPR@[18; 38) | ||
23 | AMP@[18; 19) "&" | ||
24 | ARRAY_EXPR@[19; 38) | ||
25 | L_BRACK@[19; 20) "[" | ||
26 | LITERAL@[20; 21) | ||
27 | INT_NUMBER@[20; 21) "1" | ||
28 | COMMA@[21; 22) "," | ||
29 | WHITESPACE@[22; 23) " " | ||
30 | LITERAL@[23; 37) | ||
31 | ATTR@[23; 35) | ||
32 | POUND@[23; 24) "#" | ||
33 | L_BRACK@[24; 25) "[" | ||
34 | PATH@[25; 28) | ||
35 | PATH_SEGMENT@[25; 28) | ||
36 | NAME_REF@[25; 28) | ||
37 | IDENT@[25; 28) "cfg" | ||
38 | TOKEN_TREE@[28; 34) | ||
39 | L_PAREN@[28; 29) "(" | ||
40 | IDENT@[29; 33) "test" | ||
41 | R_PAREN@[33; 34) ")" | ||
42 | R_BRACK@[34; 35) "]" | ||
43 | WHITESPACE@[35; 36) " " | ||
44 | INT_NUMBER@[36; 37) "2" | ||
45 | R_BRACK@[37; 38) "]" | ||
46 | SEMI@[38; 39) ";" | ||
47 | WHITESPACE@[39; 40) "\n" | ||