diff options
Diffstat (limited to 'spec/inputs/syntax.yue')
| -rw-r--r-- | spec/inputs/syntax.yue | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/spec/inputs/syntax.yue b/spec/inputs/syntax.yue index eee518a..cef3e3d 100644 --- a/spec/inputs/syntax.yue +++ b/spec/inputs/syntax.yue | |||
| @@ -7,7 +7,7 @@ a, bunch, go, here = another, world, nil, nil | |||
| 7 | func arg1, arg2, another, arg3 | 7 | func arg1, arg2, another, arg3 |
| 8 | 8 | ||
| 9 | here, we = () ->, yeah | 9 | here, we = () ->, yeah |
| 10 | the, different = () -> approach; yeah | 10 | the, different = (() -> approach), yeah |
| 11 | 11 | ||
| 12 | dad() | 12 | dad() |
| 13 | dad(lord) | 13 | dad(lord) |
| @@ -321,7 +321,7 @@ ajax url, | |||
| 321 | (error) -> | 321 | (error) -> |
| 322 | print error | 322 | print error |
| 323 | 323 | ||
| 324 | -- | 324 | -- |
| 325 | a += 3 - 5 | 325 | a += 3 - 5 |
| 326 | a *= 3 + 5 | 326 | a *= 3 + 5 |
| 327 | a *= 3 | 327 | a *= 3 |
| @@ -480,11 +480,54 @@ do | |||
| 480 | 480 | ||
| 481 | do | 481 | do |
| 482 | return res if res ~= "" | 482 | return res if res ~= "" |
| 483 | 483 | ||
| 484 | 484 | ||
| 485 | do | 485 | do |
| 486 | return res if res ~= "" | 486 | return res if res ~= "" |
| 487 | -- | 487 | -- |
| 488 | 488 | ||
| 489 | do | ||
| 490 | a = 1; b = 2; c = a + b | ||
| 491 | print a; print b; print c | ||
| 492 | |||
| 493 | f = -> | ||
| 494 | a = 1; b = 2; a + b | ||
| 495 | |||
| 496 | a = 1; | ||
| 497 | b = 2; | ||
| 498 | |||
| 499 | success, result = try func!; print result if success | ||
| 500 | |||
| 501 | value = "foo"; print value; value = value .. "bar"; print value | ||
| 502 | |||
| 503 | do | ||
| 504 | if ok then print "ok!"; return 42 | ||
| 505 | |||
| 506 | for i=1,3 | ||
| 507 | print i; continue | ||
| 508 | |||
| 509 | n = 0 | ||
| 510 | while n < 2 | ||
| 511 | print "n=", n; n += 1 | ||
| 512 | |||
| 513 | obj = {} | ||
| 514 | obj\set 10; obj\get!; print "done" | ||
| 515 | |||
| 516 | with tbl | ||
| 517 | \push 1; print "push" | ||
| 518 | |||
| 519 | a = 5 | ||
| 520 | if a > 3 | ||
| 521 | print "big"; b = a * 2; print b | ||
| 522 | else | ||
| 523 | print "small"; b = a | ||
| 524 | |||
| 525 | try | ||
| 526 | x = 1; y = 2; print x + y | ||
| 527 | catch err | ||
| 528 | print "error:", err | ||
| 529 | |||
| 530 | q = 1;; w = 2;;; e = 3; print q, w, e; | ||
| 531 | |||
| 489 | nil | 532 | nil |
| 490 | 533 | ||
