diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-01-25 17:48:03 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-01-25 17:48:03 +0800 |
| commit | ed317e62eb1cf98fde4461fc90c6cb1045ebc7e8 (patch) | |
| tree | 427e365939da39f31dbfa755675fb60bb141583d /spec/inputs/syntax.moon | |
| parent | 4827d200604a086e2ad94edb4257c3abc7a3c4fc (diff) | |
| download | yuescript-ed317e62eb1cf98fde4461fc90c6cb1045ebc7e8.tar.gz yuescript-ed317e62eb1cf98fde4461fc90c6cb1045ebc7e8.tar.bz2 yuescript-ed317e62eb1cf98fde4461fc90c6cb1045ebc7e8.zip | |
fix Moonscript issue 375.
Diffstat (limited to 'spec/inputs/syntax.moon')
| -rw-r--r-- | spec/inputs/syntax.moon | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/spec/inputs/syntax.moon b/spec/inputs/syntax.moon index 351b22c..bf0cf04 100644 --- a/spec/inputs/syntax.moon +++ b/spec/inputs/syntax.moon | |||
| @@ -29,7 +29,7 @@ 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 | ||
| 34 | yeah = (1 + 5) * 3 | 34 | yeah = (1 + 5) * 3 |
| 35 | yeah = ((1+5)*3)/2 | 35 | yeah = ((1+5)*3)/2 |
| @@ -38,16 +38,16 @@ yeah = ((1+5)*3)/2 + i % 100 | |||
| 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 |
| @@ -82,23 +82,23 @@ _ = here(we)"go"[12123] | |||
| 82 | 82 | ||
| 83 | -- this runs | 83 | -- this runs |
| 84 | something = | 84 | something = |
| 85 | test: 12323 | 85 | test: 12323 |
| 86 | what: -> print "hello world" | 86 | what: -> print "hello world" |
| 87 | 87 | ||
| 88 | print something.test | 88 | print something.test |
| 89 | 89 | ||
| 90 | frick = hello: "world" | 90 | frick = hello: "world" |
| 91 | 91 | ||
| 92 | argon = | 92 | argon = |
| 93 | num: 100 | 93 | num: 100 |
| 94 | world: (self) -> | 94 | world: (self) -> |
| 95 | print self.num | 95 | print self.num |
| 96 | return { | 96 | return { |
| 97 | something: -> print "hi from something" | 97 | something: -> print "hi from something" |
| 98 | } | 98 | } |
| 99 | somethin: (self, str) -> | 99 | somethin: (self, str) -> |
| 100 | print "string is", str | 100 | print "string is", str |
| 101 | return world: (a,b) -> print "sum", a + b | 101 | return world: (a,b) -> print "sum", a + b |
| 102 | 102 | ||
| 103 | something.what() | 103 | something.what() |
| 104 | argon\world().something() | 104 | argon\world().something() |
| @@ -127,7 +127,7 @@ print "what" if cool else whack! | |||
| 127 | arg = {...} | 127 | arg = {...} |
| 128 | 128 | ||
| 129 | x = (...) -> | 129 | x = (...) -> |
| 130 | dump {...} | 130 | dump {...} |
| 131 | 131 | ||
| 132 | 132 | ||
| 133 | x = not true | 133 | x = not true |
| @@ -167,11 +167,11 @@ _ = (if ntype(v) == "fndef" then x += 1) for v in *values | |||
| 167 | 167 | ||
| 168 | 168 | ||
| 169 | hello = | 169 | hello = |
| 170 | something: world | 170 | something: world |
| 171 | if: "hello" | 171 | if: "hello" |
| 172 | else: 3434 | 172 | else: 3434 |
| 173 | function: "okay" | 173 | function: "okay" |
| 174 | good: 230203 | 174 | good: 230203 |
| 175 | 175 | ||
| 176 | 176 | ||
| 177 | div class: "cool" | 177 | div class: "cool" |
| @@ -185,29 +185,29 @@ what whack - 5 | |||
| 185 | x = hello - world - something | 185 | x = hello - world - something |
| 186 | 186 | ||
| 187 | ((something = with what | 187 | ((something = with what |
| 188 | \cool 100) -> | 188 | \cool 100) -> |
| 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" |
| 205 | 205 | ||
| 206 | print "cool" | 206 | print "cool" |
| 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 |
| @@ -220,15 +220,15 @@ z = x andb | |||
| 220 | -- undelimited tables | 220 | -- undelimited tables |
| 221 | 221 | ||
| 222 | while 10 > something | 222 | while 10 > something |
| 223 | something: "world" | 223 | something: "world" |
| 224 | print "yeah" | 224 | print "yeah" |
| 225 | 225 | ||
| 226 | x = | 226 | x = |
| 227 | okay: sure | 227 | okay: sure |
| 228 | 228 | ||
| 229 | yeah | 229 | yeah |
| 230 | okay: man | 230 | okay: man |
| 231 | sure: sir | 231 | sure: sir |
| 232 | 232 | ||
| 233 | hello "no comma" | 233 | hello "no comma" |
| 234 | yeah: dada | 234 | yeah: dada |
| @@ -240,8 +240,8 @@ hello "comma", | |||
| 240 | 240 | ||
| 241 | -- creates two tables | 241 | -- creates two tables |
| 242 | another hello, one, | 242 | another hello, one, |
| 243 | two, three, four, yeah: man | 243 | two, three, four, yeah: man |
| 244 | okay: yeah | 244 | okay: yeah |
| 245 | 245 | ||
| 246 | -- | 246 | -- |
| 247 | a += 3 - 5 | 247 | a += 3 - 5 |
