diff options
author | Aleksey Kladov <[email protected]> | 2018-09-08 07:18:42 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-09-08 07:18:42 +0100 |
commit | 44334f6f56bd99635f650796af0db8047e4c21c4 (patch) | |
tree | 2cee555747588449ba3cc1279b254e9b2140b83e /crates/libsyntax2/tests/data/parser/ok | |
parent | 127814d9a7f62c834c0893ff05e933aac4be89e9 (diff) |
fix labled expressions
Diffstat (limited to 'crates/libsyntax2/tests/data/parser/ok')
-rw-r--r-- | crates/libsyntax2/tests/data/parser/ok/0033_label_break.rs | 28 | ||||
-rw-r--r-- | crates/libsyntax2/tests/data/parser/ok/0033_label_break.txt | 215 |
2 files changed, 243 insertions, 0 deletions
diff --git a/crates/libsyntax2/tests/data/parser/ok/0033_label_break.rs b/crates/libsyntax2/tests/data/parser/ok/0033_label_break.rs new file mode 100644 index 000000000..728d78137 --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/ok/0033_label_break.rs | |||
@@ -0,0 +1,28 @@ | |||
1 | // format with label break value. | ||
2 | fn main() { | ||
3 | 'empty_block: {} | ||
4 | |||
5 | 'block: { | ||
6 | do_thing(); | ||
7 | if condition_not_met() { | ||
8 | break 'block; | ||
9 | } | ||
10 | do_next_thing(); | ||
11 | if condition_not_met() { | ||
12 | break 'block; | ||
13 | } | ||
14 | do_last_thing(); | ||
15 | } | ||
16 | |||
17 | let result = 'block: { | ||
18 | if foo() { | ||
19 | // comment | ||
20 | break 'block 1; | ||
21 | } | ||
22 | if bar() { | ||
23 | /* comment */ | ||
24 | break 'block 2; | ||
25 | } | ||
26 | 3 | ||
27 | }; | ||
28 | } | ||
diff --git a/crates/libsyntax2/tests/data/parser/ok/0033_label_break.txt b/crates/libsyntax2/tests/data/parser/ok/0033_label_break.txt new file mode 100644 index 000000000..6abb9234c --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/ok/0033_label_break.txt | |||
@@ -0,0 +1,215 @@ | |||
1 | ROOT@[0; 506) | ||
2 | COMMENT@[0; 33) | ||
3 | WHITESPACE@[33; 34) | ||
4 | FN_DEF@[34; 505) | ||
5 | FN_KW@[34; 36) | ||
6 | WHITESPACE@[36; 37) | ||
7 | NAME@[37; 41) | ||
8 | IDENT@[37; 41) "main" | ||
9 | PARAM_LIST@[41; 43) | ||
10 | L_PAREN@[41; 42) | ||
11 | R_PAREN@[42; 43) | ||
12 | WHITESPACE@[43; 44) | ||
13 | BLOCK@[44; 505) | ||
14 | L_CURLY@[44; 45) | ||
15 | WHITESPACE@[45; 50) | ||
16 | EXPR_STMT@[50; 66) | ||
17 | BLOCK_EXPR@[50; 66) | ||
18 | LABEL@[50; 63) | ||
19 | LIFETIME@[50; 62) "'empty_block" | ||
20 | COLON@[62; 63) | ||
21 | WHITESPACE@[63; 64) | ||
22 | BLOCK@[64; 66) | ||
23 | L_CURLY@[64; 65) | ||
24 | R_CURLY@[65; 66) | ||
25 | WHITESPACE@[66; 72) | ||
26 | EXPR_STMT@[72; 295) | ||
27 | BLOCK_EXPR@[72; 295) | ||
28 | LABEL@[72; 79) | ||
29 | LIFETIME@[72; 78) "'block" | ||
30 | COLON@[78; 79) | ||
31 | WHITESPACE@[79; 80) | ||
32 | BLOCK@[80; 295) | ||
33 | L_CURLY@[80; 81) | ||
34 | WHITESPACE@[81; 90) | ||
35 | EXPR_STMT@[90; 101) | ||
36 | CALL_EXPR@[90; 100) | ||
37 | PATH_EXPR@[90; 98) | ||
38 | PATH@[90; 98) | ||
39 | PATH_SEGMENT@[90; 98) | ||
40 | NAME_REF@[90; 98) | ||
41 | IDENT@[90; 98) "do_thing" | ||
42 | ARG_LIST@[98; 100) | ||
43 | L_PAREN@[98; 99) | ||
44 | R_PAREN@[99; 100) | ||
45 | SEMI@[100; 101) | ||
46 | WHITESPACE@[101; 110) | ||
47 | EXPR_STMT@[110; 170) | ||
48 | IF_EXPR@[110; 170) | ||
49 | IF_KW@[110; 112) | ||
50 | WHITESPACE@[112; 113) | ||
51 | CONDITION@[113; 132) | ||
52 | CALL_EXPR@[113; 132) | ||
53 | PATH_EXPR@[113; 130) | ||
54 | PATH@[113; 130) | ||
55 | PATH_SEGMENT@[113; 130) | ||
56 | NAME_REF@[113; 130) | ||
57 | IDENT@[113; 130) "condition_not_met" | ||
58 | ARG_LIST@[130; 132) | ||
59 | L_PAREN@[130; 131) | ||
60 | R_PAREN@[131; 132) | ||
61 | WHITESPACE@[132; 133) | ||
62 | BLOCK@[133; 170) | ||
63 | L_CURLY@[133; 134) | ||
64 | WHITESPACE@[134; 147) | ||
65 | EXPR_STMT@[147; 160) | ||
66 | BREAK_EXPR@[147; 159) | ||
67 | BREAK_KW@[147; 152) | ||
68 | WHITESPACE@[152; 153) | ||
69 | LIFETIME@[153; 159) "'block" | ||
70 | SEMI@[159; 160) | ||
71 | WHITESPACE@[160; 169) | ||
72 | R_CURLY@[169; 170) | ||
73 | WHITESPACE@[170; 179) | ||
74 | EXPR_STMT@[179; 195) | ||
75 | CALL_EXPR@[179; 194) | ||
76 | PATH_EXPR@[179; 192) | ||
77 | PATH@[179; 192) | ||
78 | PATH_SEGMENT@[179; 192) | ||
79 | NAME_REF@[179; 192) | ||
80 | IDENT@[179; 192) "do_next_thing" | ||
81 | ARG_LIST@[192; 194) | ||
82 | L_PAREN@[192; 193) | ||
83 | R_PAREN@[193; 194) | ||
84 | SEMI@[194; 195) | ||
85 | WHITESPACE@[195; 204) | ||
86 | EXPR_STMT@[204; 264) | ||
87 | IF_EXPR@[204; 264) | ||
88 | IF_KW@[204; 206) | ||
89 | WHITESPACE@[206; 207) | ||
90 | CONDITION@[207; 226) | ||
91 | CALL_EXPR@[207; 226) | ||
92 | PATH_EXPR@[207; 224) | ||
93 | PATH@[207; 224) | ||
94 | PATH_SEGMENT@[207; 224) | ||
95 | NAME_REF@[207; 224) | ||
96 | IDENT@[207; 224) "condition_not_met" | ||
97 | ARG_LIST@[224; 226) | ||
98 | L_PAREN@[224; 225) | ||
99 | R_PAREN@[225; 226) | ||
100 | WHITESPACE@[226; 227) | ||
101 | BLOCK@[227; 264) | ||
102 | L_CURLY@[227; 228) | ||
103 | WHITESPACE@[228; 241) | ||
104 | EXPR_STMT@[241; 254) | ||
105 | BREAK_EXPR@[241; 253) | ||
106 | BREAK_KW@[241; 246) | ||
107 | WHITESPACE@[246; 247) | ||
108 | LIFETIME@[247; 253) "'block" | ||
109 | SEMI@[253; 254) | ||
110 | WHITESPACE@[254; 263) | ||
111 | R_CURLY@[263; 264) | ||
112 | WHITESPACE@[264; 273) | ||
113 | EXPR_STMT@[273; 289) | ||
114 | CALL_EXPR@[273; 288) | ||
115 | PATH_EXPR@[273; 286) | ||
116 | PATH@[273; 286) | ||
117 | PATH_SEGMENT@[273; 286) | ||
118 | NAME_REF@[273; 286) | ||
119 | IDENT@[273; 286) "do_last_thing" | ||
120 | ARG_LIST@[286; 288) | ||
121 | L_PAREN@[286; 287) | ||
122 | R_PAREN@[287; 288) | ||
123 | SEMI@[288; 289) | ||
124 | WHITESPACE@[289; 294) | ||
125 | R_CURLY@[294; 295) | ||
126 | WHITESPACE@[295; 301) | ||
127 | LET_STMT@[301; 503) | ||
128 | LET_KW@[301; 304) | ||
129 | WHITESPACE@[304; 305) | ||
130 | BIND_PAT@[305; 311) | ||
131 | NAME@[305; 311) | ||
132 | IDENT@[305; 311) "result" | ||
133 | WHITESPACE@[311; 312) | ||
134 | EQ@[312; 313) | ||
135 | WHITESPACE@[313; 314) | ||
136 | BLOCK_EXPR@[314; 502) | ||
137 | LABEL@[314; 321) | ||
138 | LIFETIME@[314; 320) "'block" | ||
139 | COLON@[320; 321) | ||
140 | WHITESPACE@[321; 322) | ||
141 | BLOCK@[322; 502) | ||
142 | L_CURLY@[322; 323) | ||
143 | WHITESPACE@[323; 332) | ||
144 | EXPR_STMT@[332; 403) | ||
145 | IF_EXPR@[332; 403) | ||
146 | IF_KW@[332; 334) | ||
147 | WHITESPACE@[334; 335) | ||
148 | CONDITION@[335; 340) | ||
149 | CALL_EXPR@[335; 340) | ||
150 | PATH_EXPR@[335; 338) | ||
151 | PATH@[335; 338) | ||
152 | PATH_SEGMENT@[335; 338) | ||
153 | NAME_REF@[335; 338) | ||
154 | IDENT@[335; 338) "foo" | ||
155 | ARG_LIST@[338; 340) | ||
156 | L_PAREN@[338; 339) | ||
157 | R_PAREN@[339; 340) | ||
158 | WHITESPACE@[340; 341) | ||
159 | BLOCK@[341; 403) | ||
160 | L_CURLY@[341; 342) | ||
161 | WHITESPACE@[342; 355) | ||
162 | COMMENT@[355; 365) | ||
163 | WHITESPACE@[365; 378) | ||
164 | EXPR_STMT@[378; 393) | ||
165 | BREAK_EXPR@[378; 392) | ||
166 | BREAK_KW@[378; 383) | ||
167 | WHITESPACE@[383; 384) | ||
168 | LIFETIME@[384; 390) "'block" | ||
169 | WHITESPACE@[390; 391) | ||
170 | LITERAL@[391; 392) | ||
171 | INT_NUMBER@[391; 392) "1" | ||
172 | SEMI@[392; 393) | ||
173 | WHITESPACE@[393; 402) | ||
174 | R_CURLY@[402; 403) | ||
175 | WHITESPACE@[403; 412) | ||
176 | EXPR_STMT@[412; 486) | ||
177 | IF_EXPR@[412; 486) | ||
178 | IF_KW@[412; 414) | ||
179 | WHITESPACE@[414; 415) | ||
180 | CONDITION@[415; 420) | ||
181 | CALL_EXPR@[415; 420) | ||
182 | PATH_EXPR@[415; 418) | ||
183 | PATH@[415; 418) | ||
184 | PATH_SEGMENT@[415; 418) | ||
185 | NAME_REF@[415; 418) | ||
186 | IDENT@[415; 418) "bar" | ||
187 | ARG_LIST@[418; 420) | ||
188 | L_PAREN@[418; 419) | ||
189 | R_PAREN@[419; 420) | ||
190 | WHITESPACE@[420; 421) | ||
191 | BLOCK@[421; 486) | ||
192 | L_CURLY@[421; 422) | ||
193 | WHITESPACE@[422; 435) | ||
194 | COMMENT@[435; 448) | ||
195 | WHITESPACE@[448; 461) | ||
196 | EXPR_STMT@[461; 476) | ||
197 | BREAK_EXPR@[461; 475) | ||
198 | BREAK_KW@[461; 466) | ||
199 | WHITESPACE@[466; 467) | ||
200 | LIFETIME@[467; 473) "'block" | ||
201 | WHITESPACE@[473; 474) | ||
202 | LITERAL@[474; 475) | ||
203 | INT_NUMBER@[474; 475) "2" | ||
204 | SEMI@[475; 476) | ||
205 | WHITESPACE@[476; 485) | ||
206 | R_CURLY@[485; 486) | ||
207 | WHITESPACE@[486; 495) | ||
208 | LITERAL@[495; 496) | ||
209 | INT_NUMBER@[495; 496) "3" | ||
210 | WHITESPACE@[496; 501) | ||
211 | R_CURLY@[501; 502) | ||
212 | SEMI@[502; 503) | ||
213 | WHITESPACE@[503; 504) | ||
214 | R_CURLY@[504; 505) | ||
215 | WHITESPACE@[505; 506) | ||