aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs/vararg.yue
blob: 941cd97b55ccad17592dfa35f881e8fff953a239 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
join = (...) ->
	f_with with a
		\func!
	f_with with a
		\func ...

	f_listcomp [items[i] for i = 1, 10]
	f_listcomp [items[i] ... for i = 1, 10]
	f_listcomp [item for item in *items]
	f_listcomp [item ... for item in *items]

	f_class class A
		func!
	f_class class A
		func ...

	f_tblcomp {k, v for k, v in pairs tb}
	f_tblcomp {k, v ... for k, v in pairs tb}
	f_tblcomp {item, true for item in *items}
	f_tblcomp {item(...), true for item in *items}

	f_do do
		func!
	f_do do
		func ...

	f_while while false
		func!
	f_while while false
		func ...

	f_if if false
		func!
	f_if if false
		func ...

	f_unless unless true
		func!
	f_unless unless true
		func ...

	f_switch switch x
		when "abc"
			func!
	f_switch switch x
		when "abc"
			func ...

	f_eop func?!
	f_eop func? ...

	f_colon f!\func
	f_colon f(...)\func

	_ = ->
		list = {1, 2, 3, 4, 5}
		fn = (ok) ->
		  ok, table.unpack list
		ok, ... = fn true
		print ok, ...

		fn_many_args = ->
		  10, nil, 20, nil, 30

		... = fn_many_args!
		print select "#", ...
		print ...

	do
		... = switch x when 1
			with tb
				.x = 123
		else
			tb2
		print ...

	do
		... = 1, 2, if cond
			3, 4, 5
		print ...

	do
		tb, ... =
			name: "abc"
			value: 123
		print ...
	nil