diff options
Diffstat (limited to 'spec/inputs/funcs.yue')
-rw-r--r-- | spec/inputs/funcs.yue | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/spec/inputs/funcs.yue b/spec/inputs/funcs.yue new file mode 100644 index 0000000..0e45ff1 --- /dev/null +++ b/spec/inputs/funcs.yue | |||
@@ -0,0 +1,161 @@ | |||
1 | |||
2 | |||
3 | x = -> print what | ||
4 | |||
5 | _ = -> | ||
6 | |||
7 | _ = -> -> -> | ||
8 | |||
9 | go to the barn | ||
10 | |||
11 | open -> the -> door | ||
12 | |||
13 | open -> | ||
14 | the door | ||
15 | hello = -> | ||
16 | my func | ||
17 | |||
18 | h = -> hi | ||
19 | |||
20 | eat ->, world | ||
21 | |||
22 | |||
23 | (->)() | ||
24 | |||
25 | x = (...) -> | ||
26 | |||
27 | hello! | ||
28 | hello.world! | ||
29 | |||
30 | _ = hello!.something | ||
31 | _ = what!["ofefe"] | ||
32 | |||
33 | what! the! heck! | ||
34 | |||
35 | _ = (a,b,c,d,e) -> | ||
36 | |||
37 | _ = (a,a,a,a,a) -> | ||
38 | print a | ||
39 | |||
40 | _ = (x=23023) -> | ||
41 | |||
42 | _ = (x=(y=()->) ->) -> | ||
43 | |||
44 | _ = (x = if something then yeah else no) -> | ||
45 | |||
46 | something = (hello=100, world=(x=[[yeah cool]])-> print "eat rice") -> | ||
47 | print hello | ||
48 | |||
49 | _ = () => | ||
50 | _ = (x, y) => | ||
51 | _ = (@x, @y) => | ||
52 | _ = (x=1) => | ||
53 | _ = (@x=1,y,@z="hello world") => | ||
54 | |||
55 | |||
56 | x -> return | ||
57 | y -> return 1 | ||
58 | z -> return 1, "hello", "world" | ||
59 | k -> if yes then return else return | ||
60 | |||
61 | _ = -> real_name if something | ||
62 | |||
63 | -- | ||
64 | |||
65 | d( | ||
66 | -> | ||
67 | print "hello world" | ||
68 | 10 | ||
69 | ) | ||
70 | |||
71 | |||
72 | |||
73 | d( | ||
74 | 1,2,3 | ||
75 | 4 | ||
76 | 5 | ||
77 | 6 | ||
78 | |||
79 | if something | ||
80 | print "okay" | ||
81 | 10 | ||
82 | |||
83 | 10,20 | ||
84 | ) | ||
85 | |||
86 | |||
87 | f( | ||
88 | |||
89 | )( | ||
90 | |||
91 | )( | ||
92 | what | ||
93 | )(-> | ||
94 | print "srue" | ||
95 | 123) | ||
96 | |||
97 | -- | ||
98 | |||
99 | x = (a, | ||
100 | b) -> | ||
101 | print "what" | ||
102 | |||
103 | |||
104 | y = (a="hi", | ||
105 | b=23) -> | ||
106 | print "what" | ||
107 | |||
108 | z = ( | ||
109 | a="hi", | ||
110 | b=23) -> | ||
111 | print "what" | ||
112 | |||
113 | |||
114 | j = (f,g,m, | ||
115 | a="hi", | ||
116 | b=23 | ||
117 | ) -> | ||
118 | print "what" | ||
119 | |||
120 | |||
121 | y = (a="hi", | ||
122 | b=23, | ||
123 | ...) -> | ||
124 | print "what" | ||
125 | |||
126 | |||
127 | y = (a="hi", | ||
128 | b=23, | ||
129 | ... | ||
130 | ) -> | ||
131 | print "what" | ||
132 | |||
133 | -- | ||
134 | |||
135 | args = (a | ||
136 | b) -> | ||
137 | print "what" | ||
138 | |||
139 | |||
140 | args = (a="hi" | ||
141 | b=23) -> | ||
142 | print "what" | ||
143 | |||
144 | args = ( | ||
145 | a="hi" | ||
146 | b=23) -> | ||
147 | print "what" | ||
148 | |||
149 | |||
150 | args = (f,g,m | ||
151 | a="hi" | ||
152 | b=23 | ||
153 | ) -> | ||
154 | print "what" | ||
155 | |||
156 | |||
157 | @ = (n)-> | ||
158 | return 1 if n == 0 | ||
159 | n * @(n-1) | ||
160 | |||
161 | nil | ||