aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs/syntax.moon
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2020-01-18 18:15:24 +0800
committerLi Jin <dragon-fly@qq.com>2020-01-18 18:15:24 +0800
commit8d1af508f4173e4af6a4ea98584c1a86619f6a20 (patch)
tree0264c4b01f1152d8114cf46aea6fd773276c0b01 /spec/inputs/syntax.moon
parentf53ccb373efbf6f6f40284111df309e351c2c18f (diff)
downloadyuescript-8d1af508f4173e4af6a4ea98584c1a86619f6a20.tar.gz
yuescript-8d1af508f4173e4af6a4ea98584c1a86619f6a20.tar.bz2
yuescript-8d1af508f4173e4af6a4ea98584c1a86619f6a20.zip
fix Moonscript issue 122, add support for ? operator.
Diffstat (limited to 'spec/inputs/syntax.moon')
-rw-r--r--spec/inputs/syntax.moon42
1 files changed, 21 insertions, 21 deletions
diff --git a/spec/inputs/syntax.moon b/spec/inputs/syntax.moon
index 854f629..351b22c 100644
--- a/spec/inputs/syntax.moon
+++ b/spec/inputs/syntax.moon
@@ -27,7 +27,7 @@ what(the)[3243] world, yeck heck
27 27
28hairy[hands][are](gross) okay okay[world] 28hairy[hands][are](gross) okay okay[world]
29 29
30(get[something] + 5)[years] 30_ = (get[something] + 5)[years]
31 31
32i,x = 200, 300 32i,x = 200, 300
33 33
@@ -37,27 +37,27 @@ yeah = ((1+5)*3)/2 + i % 100
37 37
38whoa = (1+2) * (3+4) * (4+5) 38whoa = (1+2) * (3+4) * (4+5)
39 39
40-> 40_ = ->
41 if something 41 if something
42 return 1,2,4 42 return 1,2,4
43 43
44 print "hello" 44 print "hello"
45 45
46-> 46_ = ->
47 if hello 47 if hello
48 "heloo", "world" 48 "heloo", "world"
49 else 49 else
50 no, way 50 no, way
51 51
52 52
53-> 1,2,34 53_ = -> 1,2,34
54 54
55return 5 + () -> 4 + 2 55return 5 + () -> 4 + 2
56 56
57return 5 + (() -> 4) + 2 57return 5 + (() -> 4) + 2
58 58
59print 5 + () -> 59print 5 + () ->
60 34 60 _ = 34
61 good nads 61 good nads
62 62
63 63
@@ -66,19 +66,19 @@ something 'else', "ya"
66something'else' 66something'else'
67something"else" 67something"else"
68 68
69something[[hey]] * 2 69_ = something[[hey]] * 2
70something[======[hey]======] * 2 70_ = something[======[hey]======] * 2
71 71
72 72
73something'else', 2 73_ = something'else', 2
74something"else", 2 74_ = something"else", 2
75something[[else]], 2 75_ = something[[else]], 2
76 76
77something 'else', 2 77something 'else', 2
78something "else", 2 78something "else", 2
79something [[else]], 2 79something [[else]], 2
80 80
81here(we)"go"[12123] 81_ = here(we)"go"[12123]
82 82
83-- this runs 83-- this runs
84something = 84something =
@@ -120,9 +120,9 @@ print "hello" for i=1,10
120 120
121print "nutjob" 121print "nutjob"
122 122
123if hello then 343 123if hello then _ = 343
124 124
125print "what" if cool else whack 125print "what" if cool else whack!
126 126
127arg = {...} 127arg = {...}
128 128
@@ -139,7 +139,7 @@ y = #"hello"
139 139
140x = #{#{},#{1},#{1,2}} 140x = #{#{},#{1},#{1,2}}
141 141
142hello, world 142_ = hello, world
143 143
144something\hello(what) a,b 144something\hello(what) a,b
145something\hello what 145something\hello what
@@ -163,7 +163,7 @@ a["hello#{tostring ff}"] += 10
163a[four].x += 10 163a[four].x += 10
164 164
165x = 0 165x = 0
166(if ntype(v) == "fndef" then x += 1) for v in *values 166_ = (if ntype(v) == "fndef" then x += 1) for v in *values
167 167
168 168
169hello = 169hello =
@@ -176,10 +176,10 @@ hello =
176 176
177div class: "cool" 177div class: "cool"
178 178
1795 + what wack 179_ = 5 + what wack
180what whack + 5 180what whack + 5
181 181
1825 - what wack 182_ = 5 - what wack
183what whack - 5 183what whack - 5
184 184
185x = hello - world - something 185x = hello - world - something
@@ -189,16 +189,16 @@ x = hello - world - something
189 print something)! 189 print something)!
190 190
191if something 191if something
192 03589 192 _ = 03589
193 193
194-- okay what about this 194-- okay what about this
195 195
196else 196else
197 3434 197 _ = 3434
198 198
199 199
200if something 200if something
201 yeah 201 _ = yeah
202 202
203 203
204elseif "ymmm" 204elseif "ymmm"
@@ -207,7 +207,7 @@ elseif "ymmm"
207 207
208else 208else
209 209
210 okay 210 _ = okay
211 211
212 212
213-- test names containing keywords 213-- test names containing keywords