aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs
diff options
context:
space:
mode:
Diffstat (limited to 'spec/inputs')
-rw-r--r--spec/inputs/syntax.yue49
-rw-r--r--spec/inputs/unicode/syntax.yue2
-rw-r--r--spec/inputs/unicode/whitespace.yue10
-rw-r--r--spec/inputs/whitespace.yue10
4 files changed, 57 insertions, 14 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
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
@@ -480,11 +480,54 @@ do
480 480
481do 481do
482 return res if res ~= "" 482 return res if res ~= ""
483 483
484 484
485do 485do
486 return res if res ~= "" 486 return res if res ~= ""
487 -- 487 --
488 488
489do
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
489nil 532nil
490 533
diff --git a/spec/inputs/unicode/syntax.yue b/spec/inputs/unicode/syntax.yue
index 01d5c87..939579b 100644
--- a/spec/inputs/unicode/syntax.yue
+++ b/spec/inputs/unicode/syntax.yue
@@ -7,7 +7,7 @@
7函数 参数1, 参数2, 另外, 参数3 7函数 参数1, 参数2, 另外, 参数3
8 8
9这里, 我们 = () ->, 是的 9这里, 我们 = () ->, 是的
10这个, 不同 = () -> 方法; 是的 10这个, 不同 = (() -> 方法), 是的
11 11
12爸爸() 12爸爸()
13爸爸(主) 13爸爸(主)
diff --git a/spec/inputs/unicode/whitespace.yue b/spec/inputs/unicode/whitespace.yue
index efe55ce..151789a 100644
--- a/spec/inputs/unicode/whitespace.yue
+++ b/spec/inputs/unicode/whitespace.yue
@@ -97,19 +97,19 @@ v = ->
97 变量c -- v3 97 变量c -- v3
98 98
99v1, v2, \ 99v1, v2, \
100 v3 = -> 100 v3 = (->
101 变量a; \-- 函数结束于v1 101 变量a), \-- 函数结束于v1
102 变量b, \-- v2 102 变量b, \-- v2
103 变量c -- v3 103 变量c -- v3
104 104
105变量a, 变量b, \ 105变量a, 变量b, \
106 变量c, 变量d, \ 106 变量c, 变量d, \
107变量e, 变量f = 1, \ 107变量e, 变量f = 1, \
108 f2 108 (f2
109 :abc; \-- 参数2 109 :abc), \-- 参数2
110 3, \ 110 3, \
111 4, \ 111 4, \
112 函数5 abc; \-- 参数5 112 函数5(abc), \-- 参数5
113 6 113 6
114 114
115for 变量a, \-- 解构1 115for 变量a, \-- 解构1
diff --git a/spec/inputs/whitespace.yue b/spec/inputs/whitespace.yue
index 2655961..e501d3d 100644
--- a/spec/inputs/whitespace.yue
+++ b/spec/inputs/whitespace.yue
@@ -128,19 +128,19 @@ v = ->
128 c -- v3 128 c -- v3
129 129
130v1, v2, \ 130v1, v2, \
131 v3 = -> 131 v3 = (->
132 a; \-- end of function for v1 132 a), \-- end of function for v1
133 b, \-- v2 133 b, \-- v2
134 c -- v3 134 c -- v3
135 135
136a, b, \ 136a, b, \
137 c, d, \ 137 c, d, \
138e, f = 1, \ 138e, f = 1, \
139 f2 139 (f2
140 :abc; \-- arg2 140 :abc), \-- arg2
141 3, \ 141 3, \
142 4, \ 142 4, \
143 f5 abc; \-- arg5 143 f5(abc), \-- arg5
144 6 144 6
145 145
146for a, \-- destruct 1 146for a, \-- destruct 1