diff options
Diffstat (limited to 'crates/ra_syntax/test_data/parser')
7 files changed, 227 insertions, 85 deletions
diff --git a/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.txt b/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.txt new file mode 100644 index 000000000..0cdca4b55 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.txt | |||
@@ -0,0 +1,95 @@ | |||
1 | SOURCE_FILE@[0; 91) | ||
2 | FN_DEF@[0; 89) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 7) | ||
6 | IDENT@[3; 7) "main" | ||
7 | PARAM_LIST@[7; 9) | ||
8 | L_PAREN@[7; 8) "(" | ||
9 | R_PAREN@[8; 9) ")" | ||
10 | WHITESPACE@[9; 10) " " | ||
11 | BLOCK@[10; 89) | ||
12 | L_CURLY@[10; 11) "{" | ||
13 | WHITESPACE@[11; 16) "\n " | ||
14 | LET_STMT@[16; 27) | ||
15 | LET_KW@[16; 19) "let" | ||
16 | WHITESPACE@[19; 20) " " | ||
17 | BIND_PAT@[20; 27) | ||
18 | REF_KW@[20; 23) "ref" | ||
19 | WHITESPACE@[23; 24) " " | ||
20 | ERROR@[24; 27) | ||
21 | BOX_KW@[24; 27) "box" | ||
22 | WHITESPACE@[27; 28) " " | ||
23 | EXPR_STMT@[28; 35) | ||
24 | BIN_EXPR@[28; 34) | ||
25 | PATH_EXPR@[28; 29) | ||
26 | PATH@[28; 29) | ||
27 | PATH_SEGMENT@[28; 29) | ||
28 | NAME_REF@[28; 29) | ||
29 | IDENT@[28; 29) "i" | ||
30 | WHITESPACE@[29; 30) " " | ||
31 | EQ@[30; 31) "=" | ||
32 | WHITESPACE@[31; 32) " " | ||
33 | TUPLE_EXPR@[32; 34) | ||
34 | L_PAREN@[32; 33) "(" | ||
35 | R_PAREN@[33; 34) ")" | ||
36 | SEMI@[34; 35) ";" | ||
37 | WHITESPACE@[35; 40) "\n " | ||
38 | LET_STMT@[40; 51) | ||
39 | LET_KW@[40; 43) "let" | ||
40 | WHITESPACE@[43; 44) " " | ||
41 | BIND_PAT@[44; 51) | ||
42 | MUT_KW@[44; 47) "mut" | ||
43 | WHITESPACE@[47; 48) " " | ||
44 | ERROR@[48; 51) | ||
45 | BOX_KW@[48; 51) "box" | ||
46 | WHITESPACE@[51; 52) " " | ||
47 | EXPR_STMT@[52; 59) | ||
48 | BIN_EXPR@[52; 58) | ||
49 | PATH_EXPR@[52; 53) | ||
50 | PATH@[52; 53) | ||
51 | PATH_SEGMENT@[52; 53) | ||
52 | NAME_REF@[52; 53) | ||
53 | IDENT@[52; 53) "i" | ||
54 | WHITESPACE@[53; 54) " " | ||
55 | EQ@[54; 55) "=" | ||
56 | WHITESPACE@[55; 56) " " | ||
57 | TUPLE_EXPR@[56; 58) | ||
58 | L_PAREN@[56; 57) "(" | ||
59 | R_PAREN@[57; 58) ")" | ||
60 | SEMI@[58; 59) ";" | ||
61 | WHITESPACE@[59; 64) "\n " | ||
62 | LET_STMT@[64; 79) | ||
63 | LET_KW@[64; 67) "let" | ||
64 | WHITESPACE@[67; 68) " " | ||
65 | BIND_PAT@[68; 79) | ||
66 | REF_KW@[68; 71) "ref" | ||
67 | WHITESPACE@[71; 72) " " | ||
68 | MUT_KW@[72; 75) "mut" | ||
69 | WHITESPACE@[75; 76) " " | ||
70 | ERROR@[76; 79) | ||
71 | BOX_KW@[76; 79) "box" | ||
72 | WHITESPACE@[79; 80) " " | ||
73 | EXPR_STMT@[80; 87) | ||
74 | BIN_EXPR@[80; 86) | ||
75 | PATH_EXPR@[80; 81) | ||
76 | PATH@[80; 81) | ||
77 | PATH_SEGMENT@[80; 81) | ||
78 | NAME_REF@[80; 81) | ||
79 | IDENT@[80; 81) "i" | ||
80 | WHITESPACE@[81; 82) " " | ||
81 | EQ@[82; 83) "=" | ||
82 | WHITESPACE@[83; 84) " " | ||
83 | TUPLE_EXPR@[84; 86) | ||
84 | L_PAREN@[84; 85) "(" | ||
85 | R_PAREN@[85; 86) ")" | ||
86 | SEMI@[86; 87) ";" | ||
87 | WHITESPACE@[87; 88) "\n" | ||
88 | R_CURLY@[88; 89) "}" | ||
89 | WHITESPACE@[89; 91) "\n\n" | ||
90 | error 24: expected a name | ||
91 | error 27: expected SEMI | ||
92 | error 48: expected a name | ||
93 | error 51: expected SEMI | ||
94 | error 76: expected a name | ||
95 | error 79: expected SEMI | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rs b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rs index 2d476278d..9e009e24f 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rs | |||
@@ -5,7 +5,5 @@ fn foo() { | |||
5 | X | Y if Z => (), | 5 | X | Y if Z => (), |
6 | | X | Y if Z => (), | 6 | | X | Y if Z => (), |
7 | | X => (), | 7 | | X => (), |
8 | box X => (), | ||
9 | Some(box X) => (), | ||
10 | }; | 8 | }; |
11 | } | 9 | } |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.txt b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.txt index 35f023782..c2f256ac3 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 215) | 1 | SOURCE_FILE@[0; 167) |
2 | FN_DEF@[0; 214) | 2 | FN_DEF@[0; 166) |
3 | FN_KW@[0; 2) "fn" | 3 | FN_KW@[0; 2) "fn" |
4 | WHITESPACE@[2; 3) " " | 4 | WHITESPACE@[2; 3) " " |
5 | NAME@[3; 6) | 5 | NAME@[3; 6) |
@@ -8,18 +8,18 @@ SOURCE_FILE@[0; 215) | |||
8 | L_PAREN@[6; 7) "(" | 8 | L_PAREN@[6; 7) "(" |
9 | R_PAREN@[7; 8) ")" | 9 | R_PAREN@[7; 8) ")" |
10 | WHITESPACE@[8; 9) " " | 10 | WHITESPACE@[8; 9) " " |
11 | BLOCK@[9; 214) | 11 | BLOCK@[9; 166) |
12 | L_CURLY@[9; 10) "{" | 12 | L_CURLY@[9; 10) "{" |
13 | WHITESPACE@[10; 15) "\n " | 13 | WHITESPACE@[10; 15) "\n " |
14 | EXPR_STMT@[15; 212) | 14 | EXPR_STMT@[15; 164) |
15 | MATCH_EXPR@[15; 211) | 15 | MATCH_EXPR@[15; 163) |
16 | MATCH_KW@[15; 20) "match" | 16 | MATCH_KW@[15; 20) "match" |
17 | WHITESPACE@[20; 21) " " | 17 | WHITESPACE@[20; 21) " " |
18 | TUPLE_EXPR@[21; 23) | 18 | TUPLE_EXPR@[21; 23) |
19 | L_PAREN@[21; 22) "(" | 19 | L_PAREN@[21; 22) "(" |
20 | R_PAREN@[22; 23) ")" | 20 | R_PAREN@[22; 23) ")" |
21 | WHITESPACE@[23; 24) " " | 21 | WHITESPACE@[23; 24) " " |
22 | MATCH_ARM_LIST@[24; 211) | 22 | MATCH_ARM_LIST@[24; 163) |
23 | L_CURLY@[24; 25) "{" | 23 | L_CURLY@[24; 25) "{" |
24 | WHITESPACE@[25; 34) "\n " | 24 | WHITESPACE@[25; 34) "\n " |
25 | MATCH_ARM@[34; 41) | 25 | MATCH_ARM@[34; 41) |
@@ -141,44 +141,9 @@ SOURCE_FILE@[0; 215) | |||
141 | L_PAREN@[154; 155) "(" | 141 | L_PAREN@[154; 155) "(" |
142 | R_PAREN@[155; 156) ")" | 142 | R_PAREN@[155; 156) ")" |
143 | COMMA@[156; 157) "," | 143 | COMMA@[156; 157) "," |
144 | WHITESPACE@[157; 166) "\n " | 144 | WHITESPACE@[157; 162) "\n " |
145 | MATCH_ARM@[166; 177) | 145 | R_CURLY@[162; 163) "}" |
146 | BIND_PAT@[166; 171) | 146 | SEMI@[163; 164) ";" |
147 | BOX_KW@[166; 169) "box" | 147 | WHITESPACE@[164; 165) "\n" |
148 | WHITESPACE@[169; 170) " " | 148 | R_CURLY@[165; 166) "}" |
149 | NAME@[170; 171) | 149 | WHITESPACE@[166; 167) "\n" |
150 | IDENT@[170; 171) "X" | ||
151 | WHITESPACE@[171; 172) " " | ||
152 | FAT_ARROW@[172; 174) "=>" | ||
153 | WHITESPACE@[174; 175) " " | ||
154 | TUPLE_EXPR@[175; 177) | ||
155 | L_PAREN@[175; 176) "(" | ||
156 | R_PAREN@[176; 177) ")" | ||
157 | COMMA@[177; 178) "," | ||
158 | WHITESPACE@[178; 187) "\n " | ||
159 | MATCH_ARM@[187; 204) | ||
160 | TUPLE_STRUCT_PAT@[187; 198) | ||
161 | PATH@[187; 191) | ||
162 | PATH_SEGMENT@[187; 191) | ||
163 | NAME_REF@[187; 191) | ||
164 | IDENT@[187; 191) "Some" | ||
165 | L_PAREN@[191; 192) "(" | ||
166 | BIND_PAT@[192; 197) | ||
167 | BOX_KW@[192; 195) "box" | ||
168 | WHITESPACE@[195; 196) " " | ||
169 | NAME@[196; 197) | ||
170 | IDENT@[196; 197) "X" | ||
171 | R_PAREN@[197; 198) ")" | ||
172 | WHITESPACE@[198; 199) " " | ||
173 | FAT_ARROW@[199; 201) "=>" | ||
174 | WHITESPACE@[201; 202) " " | ||
175 | TUPLE_EXPR@[202; 204) | ||
176 | L_PAREN@[202; 203) "(" | ||
177 | R_PAREN@[203; 204) ")" | ||
178 | COMMA@[204; 205) "," | ||
179 | WHITESPACE@[205; 210) "\n " | ||
180 | R_CURLY@[210; 211) "}" | ||
181 | SEMI@[211; 212) ";" | ||
182 | WHITESPACE@[212; 213) "\n" | ||
183 | R_CURLY@[213; 214) "}" | ||
184 | WHITESPACE@[214; 215) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rs b/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rs index 5a93469af..820a9e72c 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rs | |||
@@ -5,5 +5,4 @@ fn main() { | |||
5 | let ref mut d = (); | 5 | let ref mut d = (); |
6 | let e @ _ = (); | 6 | let e @ _ = (); |
7 | let ref mut f @ g @ _ = (); | 7 | let ref mut f @ g @ _ = (); |
8 | let box i = Box::new(1i32); | ||
9 | } | 8 | } |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.txt b/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.txt index 189254a19..ab0f88507 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 178) | 1 | SOURCE_FILE@[0; 146) |
2 | FN_DEF@[0; 177) | 2 | FN_DEF@[0; 145) |
3 | FN_KW@[0; 2) "fn" | 3 | FN_KW@[0; 2) "fn" |
4 | WHITESPACE@[2; 3) " " | 4 | WHITESPACE@[2; 3) " " |
5 | NAME@[3; 7) | 5 | NAME@[3; 7) |
@@ -8,7 +8,7 @@ SOURCE_FILE@[0; 178) | |||
8 | L_PAREN@[7; 8) "(" | 8 | L_PAREN@[7; 8) "(" |
9 | R_PAREN@[8; 9) ")" | 9 | R_PAREN@[8; 9) ")" |
10 | WHITESPACE@[9; 10) " " | 10 | WHITESPACE@[9; 10) " " |
11 | BLOCK@[10; 177) | 11 | BLOCK@[10; 145) |
12 | L_CURLY@[10; 11) "{" | 12 | L_CURLY@[10; 11) "{" |
13 | WHITESPACE@[11; 16) "\n " | 13 | WHITESPACE@[11; 16) "\n " |
14 | LET_STMT@[16; 27) | 14 | LET_STMT@[16; 27) |
@@ -122,35 +122,6 @@ SOURCE_FILE@[0; 178) | |||
122 | L_PAREN@[140; 141) "(" | 122 | L_PAREN@[140; 141) "(" |
123 | R_PAREN@[141; 142) ")" | 123 | R_PAREN@[141; 142) ")" |
124 | SEMI@[142; 143) ";" | 124 | SEMI@[142; 143) ";" |
125 | WHITESPACE@[143; 148) "\n " | 125 | WHITESPACE@[143; 144) "\n" |
126 | LET_STMT@[148; 175) | 126 | R_CURLY@[144; 145) "}" |
127 | LET_KW@[148; 151) "let" | 127 | WHITESPACE@[145; 146) "\n" |
128 | WHITESPACE@[151; 152) " " | ||
129 | BIND_PAT@[152; 157) | ||
130 | BOX_KW@[152; 155) "box" | ||
131 | WHITESPACE@[155; 156) " " | ||
132 | NAME@[156; 157) | ||
133 | IDENT@[156; 157) "i" | ||
134 | WHITESPACE@[157; 158) " " | ||
135 | EQ@[158; 159) "=" | ||
136 | WHITESPACE@[159; 160) " " | ||
137 | CALL_EXPR@[160; 174) | ||
138 | PATH_EXPR@[160; 168) | ||
139 | PATH@[160; 168) | ||
140 | PATH@[160; 163) | ||
141 | PATH_SEGMENT@[160; 163) | ||
142 | NAME_REF@[160; 163) | ||
143 | IDENT@[160; 163) "Box" | ||
144 | COLONCOLON@[163; 165) "::" | ||
145 | PATH_SEGMENT@[165; 168) | ||
146 | NAME_REF@[165; 168) | ||
147 | IDENT@[165; 168) "new" | ||
148 | ARG_LIST@[168; 174) | ||
149 | L_PAREN@[168; 169) "(" | ||
150 | LITERAL@[169; 173) | ||
151 | INT_NUMBER@[169; 173) "1i32" | ||
152 | R_PAREN@[173; 174) ")" | ||
153 | SEMI@[174; 175) ";" | ||
154 | WHITESPACE@[175; 176) "\n" | ||
155 | R_CURLY@[176; 177) "}" | ||
156 | WHITESPACE@[177; 178) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rs b/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rs new file mode 100644 index 000000000..9d458aa1e --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | fn main() { | ||
2 | let box i = (); | ||
3 | let box Outer { box i, j: box Inner(box &x) } = (); | ||
4 | let box ref mut i = (); | ||
5 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.txt b/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.txt new file mode 100644 index 000000000..f0db58143 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.txt | |||
@@ -0,0 +1,109 @@ | |||
1 | SOURCE_FILE@[0; 118) | ||
2 | FN_DEF@[0; 117) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 7) | ||
6 | IDENT@[3; 7) "main" | ||
7 | PARAM_LIST@[7; 9) | ||
8 | L_PAREN@[7; 8) "(" | ||
9 | R_PAREN@[8; 9) ")" | ||
10 | WHITESPACE@[9; 10) " " | ||
11 | BLOCK@[10; 117) | ||
12 | L_CURLY@[10; 11) "{" | ||
13 | WHITESPACE@[11; 16) "\n " | ||
14 | LET_STMT@[16; 31) | ||
15 | LET_KW@[16; 19) "let" | ||
16 | WHITESPACE@[19; 20) " " | ||
17 | BOX_PAT@[20; 25) | ||
18 | BOX_KW@[20; 23) "box" | ||
19 | WHITESPACE@[23; 24) " " | ||
20 | BIND_PAT@[24; 25) | ||
21 | NAME@[24; 25) | ||
22 | IDENT@[24; 25) "i" | ||
23 | WHITESPACE@[25; 26) " " | ||
24 | EQ@[26; 27) "=" | ||
25 | WHITESPACE@[27; 28) " " | ||
26 | TUPLE_EXPR@[28; 30) | ||
27 | L_PAREN@[28; 29) "(" | ||
28 | R_PAREN@[29; 30) ")" | ||
29 | SEMI@[30; 31) ";" | ||
30 | WHITESPACE@[31; 36) "\n " | ||
31 | LET_STMT@[36; 87) | ||
32 | LET_KW@[36; 39) "let" | ||
33 | WHITESPACE@[39; 40) " " | ||
34 | BOX_PAT@[40; 81) | ||
35 | BOX_KW@[40; 43) "box" | ||
36 | WHITESPACE@[43; 44) " " | ||
37 | RECORD_PAT@[44; 81) | ||
38 | PATH@[44; 49) | ||
39 | PATH_SEGMENT@[44; 49) | ||
40 | NAME_REF@[44; 49) | ||
41 | IDENT@[44; 49) "Outer" | ||
42 | WHITESPACE@[49; 50) " " | ||
43 | RECORD_FIELD_PAT_LIST@[50; 81) | ||
44 | L_CURLY@[50; 51) "{" | ||
45 | WHITESPACE@[51; 52) " " | ||
46 | BOX_PAT@[52; 57) | ||
47 | BOX_KW@[52; 55) "box" | ||
48 | WHITESPACE@[55; 56) " " | ||
49 | BIND_PAT@[56; 57) | ||
50 | NAME@[56; 57) | ||
51 | IDENT@[56; 57) "i" | ||
52 | COMMA@[57; 58) "," | ||
53 | WHITESPACE@[58; 59) " " | ||
54 | RECORD_FIELD_PAT@[59; 79) | ||
55 | NAME@[59; 60) | ||
56 | IDENT@[59; 60) "j" | ||
57 | COLON@[60; 61) ":" | ||
58 | WHITESPACE@[61; 62) " " | ||
59 | BOX_PAT@[62; 79) | ||
60 | BOX_KW@[62; 65) "box" | ||
61 | WHITESPACE@[65; 66) " " | ||
62 | TUPLE_STRUCT_PAT@[66; 79) | ||
63 | PATH@[66; 71) | ||
64 | PATH_SEGMENT@[66; 71) | ||
65 | NAME_REF@[66; 71) | ||
66 | IDENT@[66; 71) "Inner" | ||
67 | L_PAREN@[71; 72) "(" | ||
68 | BOX_PAT@[72; 78) | ||
69 | BOX_KW@[72; 75) "box" | ||
70 | WHITESPACE@[75; 76) " " | ||
71 | REF_PAT@[76; 78) | ||
72 | AMP@[76; 77) "&" | ||
73 | BIND_PAT@[77; 78) | ||
74 | NAME@[77; 78) | ||
75 | IDENT@[77; 78) "x" | ||
76 | R_PAREN@[78; 79) ")" | ||
77 | WHITESPACE@[79; 80) " " | ||
78 | R_CURLY@[80; 81) "}" | ||
79 | WHITESPACE@[81; 82) " " | ||
80 | EQ@[82; 83) "=" | ||
81 | WHITESPACE@[83; 84) " " | ||
82 | TUPLE_EXPR@[84; 86) | ||
83 | L_PAREN@[84; 85) "(" | ||
84 | R_PAREN@[85; 86) ")" | ||
85 | SEMI@[86; 87) ";" | ||
86 | WHITESPACE@[87; 92) "\n " | ||
87 | LET_STMT@[92; 115) | ||
88 | LET_KW@[92; 95) "let" | ||
89 | WHITESPACE@[95; 96) " " | ||
90 | BOX_PAT@[96; 109) | ||
91 | BOX_KW@[96; 99) "box" | ||
92 | WHITESPACE@[99; 100) " " | ||
93 | BIND_PAT@[100; 109) | ||
94 | REF_KW@[100; 103) "ref" | ||
95 | WHITESPACE@[103; 104) " " | ||
96 | MUT_KW@[104; 107) "mut" | ||
97 | WHITESPACE@[107; 108) " " | ||
98 | NAME@[108; 109) | ||
99 | IDENT@[108; 109) "i" | ||
100 | WHITESPACE@[109; 110) " " | ||
101 | EQ@[110; 111) "=" | ||
102 | WHITESPACE@[111; 112) " " | ||
103 | TUPLE_EXPR@[112; 114) | ||
104 | L_PAREN@[112; 113) "(" | ||
105 | R_PAREN@[113; 114) ")" | ||
106 | SEMI@[114; 115) ";" | ||
107 | WHITESPACE@[115; 116) "\n" | ||
108 | R_CURLY@[116; 117) "}" | ||
109 | WHITESPACE@[117; 118) "\n" | ||