From ccfe66f87663e10603e453f02894bb82dd23c93b Mon Sep 17 00:00:00 2001 From: Li Jin Date: Mon, 19 Jan 2026 17:11:31 +0800 Subject: Made `;` work as statements separator. --- spec/inputs/syntax.yue | 49 +++++++++++++++++++++++++++++++++++--- spec/inputs/unicode/syntax.yue | 2 +- spec/inputs/unicode/whitespace.yue | 10 ++++---- spec/inputs/whitespace.yue | 10 ++++---- 4 files changed, 57 insertions(+), 14 deletions(-) (limited to 'spec/inputs') 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 func arg1, arg2, another, arg3 here, we = () ->, yeah -the, different = () -> approach; yeah +the, different = (() -> approach), yeah dad() dad(lord) @@ -321,7 +321,7 @@ ajax url, (error) -> print error --- +-- a += 3 - 5 a *= 3 + 5 a *= 3 @@ -480,11 +480,54 @@ do do return res if res ~= "" - + do return res if res ~= "" -- +do + a = 1; b = 2; c = a + b + print a; print b; print c + + f = -> + a = 1; b = 2; a + b + + a = 1; + b = 2; + + success, result = try func!; print result if success + + value = "foo"; print value; value = value .. "bar"; print value + + do + if ok then print "ok!"; return 42 + + for i=1,3 + print i; continue + + n = 0 + while n < 2 + print "n=", n; n += 1 + + obj = {} + obj\set 10; obj\get!; print "done" + + with tbl + \push 1; print "push" + + a = 5 + if a > 3 + print "big"; b = a * 2; print b + else + print "small"; b = a + + try + x = 1; y = 2; print x + y + catch err + print "error:", err + + q = 1;; w = 2;;; e = 3; print q, w, e; + nil 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 @@ 函数 参数1, 参数2, 另外, 参数3 这里, 我们 = () ->, 是的 -这个, 不同 = () -> 方法; 是的 +这个, 不同 = (() -> 方法), 是的 爸爸() 爸爸(主) 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 = -> 变量c -- v3 v1, v2, \ - v3 = -> - 变量a; \-- 函数结束于v1 + v3 = (-> + 变量a), \-- 函数结束于v1 变量b, \-- v2 变量c -- v3 变量a, 变量b, \ 变量c, 变量d, \ 变量e, 变量f = 1, \ - f2 - :abc; \-- 参数2 + (f2 + :abc), \-- 参数2 3, \ 4, \ - 函数5 abc; \-- 参数5 + 函数5(abc), \-- 参数5 6 for 变量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 = -> c -- v3 v1, v2, \ - v3 = -> - a; \-- end of function for v1 + v3 = (-> + a), \-- end of function for v1 b, \-- v2 c -- v3 a, b, \ c, d, \ e, f = 1, \ - f2 - :abc; \-- arg2 + (f2 + :abc), \-- arg2 3, \ 4, \ - f5 abc; \-- arg5 + f5(abc), \-- arg5 6 for a, \-- destruct 1 -- cgit v1.2.3-55-g6feb