aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs/syntax.yue
diff options
context:
space:
mode:
Diffstat (limited to 'spec/inputs/syntax.yue')
-rw-r--r--spec/inputs/syntax.yue68
1 files changed, 64 insertions, 4 deletions
diff --git a/spec/inputs/syntax.yue b/spec/inputs/syntax.yue
index a414d6f..a63f629 100644
--- a/spec/inputs/syntax.yue
+++ b/spec/inputs/syntax.yue
@@ -7,7 +7,7 @@ a, bunch, go, here = another, world, nil, nil
7func arg1, arg2, another, arg3 7func arg1, arg2, another, arg3
8 8
9here, we = () ->, yeah 9here, we = () ->, yeah
10the, different = () -> approach; yeah 10the, different = (() -> approach), yeah
11 11
12dad() 12dad()
13dad(lord) 13dad(lord)
@@ -321,7 +321,7 @@ ajax url,
321 (error) -> 321 (error) ->
322 print error 322 print error
323 323
324-- 324--
325a += 3 - 5 325a += 3 - 5
326a *= 3 + 5 326a *= 3 + 5
327a *= 3 327a *= 3
@@ -392,7 +392,7 @@ invokeA(
392v = { 392v = {
393 a -1 393 a -1
394 a( 394 a(
395-1) 395 -1)
396 a \ 396 a \
397- 1 397- 1
398 a-1 398 a-1
@@ -405,7 +405,7 @@ v = {
405 405
406 a ~1 406 a ~1
407 a( 407 a(
408~1) 408 ~1)
409 a \ 409 a \
410~ 1 410~ 1
411 a~1 411 a~1
@@ -478,5 +478,65 @@ do
478 f2 = -> 478 f2 = ->
479 -- 479 --
480 480
481do
482 return res if res ~= ""
483
484
485do
486 return res if res ~= ""
487 --
488
489do
490 -- Simple one-liners
491 x = 1; y = 2
492
493 -- Short related statements
494 i += 1; j += 1
495
496 if condition
497 setup!; run!; cleanup!
498
499 a = 1; b = 2; c = a + b
500 print a; print b; print c
501
502 f = ->
503 a = 1; b = 2; a + b
504
505 a = 1;
506 b = 2;
507
508 success, result = try func!; print result if success
509
510 value = "foo"; print value; value = value .. "bar"; print value
511
512 do
513 if ok then print "ok!"; return 42
514
515 for i=1,3
516 print i; continue
517
518 n = 0
519 while n < 2
520 print "n=", n; n += 1
521
522 obj = {}
523 obj\set 10; obj\get!; print "done"
524
525 with tbl
526 \push 1; print "push"
527
528 a = 5
529 if a > 3
530 print "big"; b = a * 2; print b
531 else
532 print "small"; b = a
533
534 try
535 x = 1; y = 2; print x + y
536 catch err
537 print "error:", err
538
539q = 1 --[[it's q]]; --[[got w]] w = 2; e = 3; print --[[param q]] q, w, e; --[[here]] -- line ends
540
481nil 541nil
482 542