|
189 | 189 | LineNumberNode(3) |
190 | 190 | ) |
191 | 191 | ) |
| 192 | + @test parsestmt("for x=xs\ny\nelse\nz\nend") == |
| 193 | + Expr(:for, |
| 194 | + Expr(:(=), :x, :xs), |
| 195 | + Expr(:block, |
| 196 | + LineNumberNode(2), |
| 197 | + :y, |
| 198 | + ), |
| 199 | + Expr(:block, |
| 200 | + LineNumberNode(4), |
| 201 | + :z, |
| 202 | + LineNumberNode(5) |
| 203 | + ) |
| 204 | + ) |
192 | 205 | @test parsestmt("while cond\n\nend") == |
193 | 206 | Expr(:while, |
194 | 207 | :cond, |
|
206 | 219 | LineNumberNode(3) |
207 | 220 | ) |
208 | 221 | ) |
| 222 | + @test parsestmt("while cond\ny\nelse\nz\nend") == |
| 223 | + Expr(:while, |
| 224 | + :cond, |
| 225 | + Expr(:block, |
| 226 | + LineNumberNode(2), |
| 227 | + :y, |
| 228 | + ), |
| 229 | + Expr(:block, |
| 230 | + LineNumberNode(4), |
| 231 | + :z, |
| 232 | + LineNumberNode(5) |
| 233 | + ) |
| 234 | + ) |
209 | 235 | end |
210 | 236 | end |
211 | 237 |
|
|
361 | 387 | Expr(:call, :f, Expr(:parameters, Expr(:kw, :b, 2))) |
362 | 388 | @test parsestmt("f(a=1; b=2)") == |
363 | 389 | Expr(:call, :f, Expr(:parameters, Expr(:kw, :b, 2)), Expr(:kw, :a, 1)) |
364 | | - @test parsestmt("f(a; b; c)") == |
| 390 | + @test parsestmt("f(a; b; c)") == |
365 | 391 | Expr(:call, :f, Expr(:parameters, Expr(:parameters, :c), :b), :a) |
366 | 392 | @test parsestmt("+(a=1,)") == |
367 | 393 | Expr(:call, :+, Expr(:kw, :a, 1)) |
|
371 | 397 | # Operator calls: = is not :kw |
372 | 398 | @test parsestmt("(x=1) != 2") == |
373 | 399 | Expr(:call, :!=, Expr(:(=), :x, 1), 2) |
374 | | - @test parsestmt("+(a=1)") == |
| 400 | + @test parsestmt("+(a=1)") == |
375 | 401 | Expr(:call, :+, Expr(:(=), :a, 1)) |
376 | | - @test parsestmt("(a=1)'") == |
| 402 | + @test parsestmt("(a=1)'") == |
377 | 403 | Expr(Symbol("'"), Expr(:(=), :a, 1)) |
378 | | - @test parsestmt("(a=1)'ᵀ") == |
| 404 | + @test parsestmt("(a=1)'ᵀ") == |
379 | 405 | Expr(:call, Symbol("'ᵀ"), Expr(:(=), :a, 1)) |
380 | 406 |
|
381 | 407 | # Dotcall |
|
583 | 609 | Expr(:generator, :x, |
584 | 610 | Expr(:filter, :z, Expr(:(=), :a, :as), Expr(:(=), :b, :bs))) |
585 | 611 | @test parsestmt("(x for a in as, b in bs for c in cs, d in ds)") == |
586 | | - Expr(:flatten, |
587 | | - Expr(:generator, |
| 612 | + Expr(:flatten, |
| 613 | + Expr(:generator, |
588 | 614 | Expr(:generator, :x, Expr(:(=), :c, :cs), Expr(:(=), :d, :ds)), |
589 | 615 | Expr(:(=), :a, :as), Expr(:(=), :b, :bs))) |
590 | 616 | @test parsestmt("(x for a in as for b in bs if z)") == |
|
754 | 780 | @test parsestmt("global x ~ 1") == Expr(:global, Expr(:call, :~, :x, 1)) |
755 | 781 | @test parsestmt("global x += 1") == Expr(:global, Expr(:+=, :x, 1)) |
756 | 782 |
|
757 | | - # Parsing of global/local with |
| 783 | + # Parsing of global/local with |
758 | 784 | @test parsestmt("global (x,y)") == Expr(:global, :x, :y) |
759 | 785 | @test parsestmt("local (x,y)") == Expr(:local, :x, :y) |
760 | 786 | end |
|
0 commit comments