diff options
author | Li Jin <dragon-fly@qq.com> | 2020-01-18 18:15:24 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2020-01-18 18:15:24 +0800 |
commit | 8d1af508f4173e4af6a4ea98584c1a86619f6a20 (patch) | |
tree | 0264c4b01f1152d8114cf46aea6fd773276c0b01 /spec/inputs/syntax.moon | |
parent | f53ccb373efbf6f6f40284111df309e351c2c18f (diff) | |
download | yuescript-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.moon | 42 |
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 | ||
28 | hairy[hands][are](gross) okay okay[world] | 28 | hairy[hands][are](gross) okay okay[world] |
29 | 29 | ||
30 | (get[something] + 5)[years] | 30 | _ = (get[something] + 5)[years] |
31 | 31 | ||
32 | i,x = 200, 300 | 32 | i,x = 200, 300 |
33 | 33 | ||
@@ -37,27 +37,27 @@ yeah = ((1+5)*3)/2 + i % 100 | |||
37 | 37 | ||
38 | whoa = (1+2) * (3+4) * (4+5) | 38 | whoa = (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 | ||
55 | return 5 + () -> 4 + 2 | 55 | return 5 + () -> 4 + 2 |
56 | 56 | ||
57 | return 5 + (() -> 4) + 2 | 57 | return 5 + (() -> 4) + 2 |
58 | 58 | ||
59 | print 5 + () -> | 59 | print 5 + () -> |
60 | 34 | 60 | _ = 34 |
61 | good nads | 61 | good nads |
62 | 62 | ||
63 | 63 | ||
@@ -66,19 +66,19 @@ something 'else', "ya" | |||
66 | something'else' | 66 | something'else' |
67 | something"else" | 67 | something"else" |
68 | 68 | ||
69 | something[[hey]] * 2 | 69 | _ = something[[hey]] * 2 |
70 | something[======[hey]======] * 2 | 70 | _ = something[======[hey]======] * 2 |
71 | 71 | ||
72 | 72 | ||
73 | something'else', 2 | 73 | _ = something'else', 2 |
74 | something"else", 2 | 74 | _ = something"else", 2 |
75 | something[[else]], 2 | 75 | _ = something[[else]], 2 |
76 | 76 | ||
77 | something 'else', 2 | 77 | something 'else', 2 |
78 | something "else", 2 | 78 | something "else", 2 |
79 | something [[else]], 2 | 79 | something [[else]], 2 |
80 | 80 | ||
81 | here(we)"go"[12123] | 81 | _ = here(we)"go"[12123] |
82 | 82 | ||
83 | -- this runs | 83 | -- this runs |
84 | something = | 84 | something = |
@@ -120,9 +120,9 @@ print "hello" for i=1,10 | |||
120 | 120 | ||
121 | print "nutjob" | 121 | print "nutjob" |
122 | 122 | ||
123 | if hello then 343 | 123 | if hello then _ = 343 |
124 | 124 | ||
125 | print "what" if cool else whack | 125 | print "what" if cool else whack! |
126 | 126 | ||
127 | arg = {...} | 127 | arg = {...} |
128 | 128 | ||
@@ -139,7 +139,7 @@ y = #"hello" | |||
139 | 139 | ||
140 | x = #{#{},#{1},#{1,2}} | 140 | x = #{#{},#{1},#{1,2}} |
141 | 141 | ||
142 | hello, world | 142 | _ = hello, world |
143 | 143 | ||
144 | something\hello(what) a,b | 144 | something\hello(what) a,b |
145 | something\hello what | 145 | something\hello what |
@@ -163,7 +163,7 @@ a["hello#{tostring ff}"] += 10 | |||
163 | a[four].x += 10 | 163 | a[four].x += 10 |
164 | 164 | ||
165 | x = 0 | 165 | x = 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 | ||
169 | hello = | 169 | hello = |
@@ -176,10 +176,10 @@ hello = | |||
176 | 176 | ||
177 | div class: "cool" | 177 | div class: "cool" |
178 | 178 | ||
179 | 5 + what wack | 179 | _ = 5 + what wack |
180 | what whack + 5 | 180 | what whack + 5 |
181 | 181 | ||
182 | 5 - what wack | 182 | _ = 5 - what wack |
183 | what whack - 5 | 183 | what whack - 5 |
184 | 184 | ||
185 | x = hello - world - something | 185 | x = hello - world - something |
@@ -189,16 +189,16 @@ x = hello - world - something | |||
189 | print something)! | 189 | print something)! |
190 | 190 | ||
191 | if something | 191 | if something |
192 | 03589 | 192 | _ = 03589 |
193 | 193 | ||
194 | -- okay what about this | 194 | -- okay what about this |
195 | 195 | ||
196 | else | 196 | else |
197 | 3434 | 197 | _ = 3434 |
198 | 198 | ||
199 | 199 | ||
200 | if something | 200 | if something |
201 | yeah | 201 | _ = yeah |
202 | 202 | ||
203 | 203 | ||
204 | elseif "ymmm" | 204 | elseif "ymmm" |
@@ -207,7 +207,7 @@ elseif "ymmm" | |||
207 | 207 | ||
208 | else | 208 | else |
209 | 209 | ||
210 | okay | 210 | _ = okay |
211 | 211 | ||
212 | 212 | ||
213 | -- test names containing keywords | 213 | -- test names containing keywords |