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 | |
| 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')
| -rw-r--r-- | spec/inputs/assign.moon | 2 | ||||
| -rw-r--r-- | spec/inputs/class.moon | 30 | ||||
| -rw-r--r-- | spec/inputs/comprehension.moon | 14 | ||||
| -rw-r--r-- | spec/inputs/cond.moon | 12 | ||||
| -rw-r--r-- | spec/inputs/destructure.moon | 2 | ||||
| -rw-r--r-- | spec/inputs/do.moon | 2 | ||||
| -rw-r--r-- | spec/inputs/existential.moon | 8 | ||||
| -rw-r--r-- | spec/inputs/funcs.moon | 30 | ||||
| -rw-r--r-- | spec/inputs/lists.moon | 8 | ||||
| -rw-r--r-- | spec/inputs/literals.moon | 62 | ||||
| -rw-r--r-- | spec/inputs/local.moon | 2 | ||||
| -rw-r--r-- | spec/inputs/loops.moon | 12 | ||||
| -rw-r--r-- | spec/inputs/return.moon | 8 | ||||
| -rw-r--r-- | spec/inputs/string.moon | 2 | ||||
| -rw-r--r-- | spec/inputs/switch.moon | 10 | ||||
| -rw-r--r-- | spec/inputs/syntax.moon | 42 | ||||
| -rw-r--r-- | spec/inputs/tables.moon | 2 | ||||
| -rw-r--r-- | spec/inputs/using.moon | 8 | ||||
| -rw-r--r-- | spec/inputs/whitespace.moon | 22 | ||||
| -rw-r--r-- | spec/inputs/with.moon | 4 |
20 files changed, 145 insertions, 137 deletions
diff --git a/spec/inputs/assign.moon b/spec/inputs/assign.moon index 1e5e7a6..3e66491 100644 --- a/spec/inputs/assign.moon +++ b/spec/inputs/assign.moon | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | -> | 2 | _ = -> |
| 3 | joop = 2302 | 3 | joop = 2302 |
| 4 | 4 | ||
| 5 | (hi) -> | 5 | (hi) -> |
diff --git a/spec/inputs/class.moon b/spec/inputs/class.moon index 9a98055..2290bc7 100644 --- a/spec/inputs/class.moon +++ b/spec/inputs/class.moon | |||
| @@ -73,11 +73,11 @@ class CoolSuper | |||
| 73 | hi: => | 73 | hi: => |
| 74 | super(1,2,3,4) 1,2,3,4 | 74 | super(1,2,3,4) 1,2,3,4 |
| 75 | super.something 1,2,3,4 | 75 | super.something 1,2,3,4 |
| 76 | super.something(1,2,3,4).world | 76 | _ = super.something(1,2,3,4).world |
| 77 | super\yeah"world".okay hi, hi, hi | 77 | super\yeah"world".okay hi, hi, hi |
| 78 | something.super | 78 | _ = something.super |
| 79 | super.super.super.super | 79 | _ = super.super.super.super |
| 80 | super\hello | 80 | _ = super\hello |
| 81 | nil | 81 | nil |
| 82 | 82 | ||
| 83 | 83 | ||
| @@ -114,11 +114,11 @@ y = @@ | |||
| 114 | @ = 343 | 114 | @ = 343 |
| 115 | @.hello 2,3,4 | 115 | @.hello 2,3,4 |
| 116 | 116 | ||
| 117 | hello[@].world | 117 | _ = hello[@].world |
| 118 | 118 | ||
| 119 | 119 | ||
| 120 | class Whacko | 120 | class Whacko |
| 121 | @hello | 121 | _ = @hello |
| 122 | if something | 122 | if something |
| 123 | print "hello world" | 123 | print "hello world" |
| 124 | 124 | ||
| @@ -132,20 +132,20 @@ print "hello" | |||
| 132 | 132 | ||
| 133 | yyy = -> | 133 | yyy = -> |
| 134 | class Cool | 134 | class Cool |
| 135 | nil | 135 | _ = nil |
| 136 | 136 | ||
| 137 | 137 | ||
| 138 | -- | 138 | -- |
| 139 | 139 | ||
| 140 | class a.b.c.D | 140 | class a.b.c.D |
| 141 | nil | 141 | _ = nil |
| 142 | 142 | ||
| 143 | 143 | ||
| 144 | class a.b["hello"] | 144 | class a.b["hello"] |
| 145 | nil | 145 | _ = nil |
| 146 | 146 | ||
| 147 | class (-> require "moon")!.Something extends Hello.World | 147 | class (-> require "moon")!.Something extends Hello.World |
| 148 | nil | 148 | _ = nil |
| 149 | 149 | ||
| 150 | -- | 150 | -- |
| 151 | 151 | ||
| @@ -160,7 +160,7 @@ print (class WhatsUp).__name | |||
| 160 | 160 | ||
| 161 | export ^ | 161 | export ^ |
| 162 | class Something | 162 | class Something |
| 163 | nil | 163 | _ = nil |
| 164 | 164 | ||
| 165 | 165 | ||
| 166 | -- | 166 | -- |
| @@ -197,17 +197,17 @@ class Whack extends Thing | |||
| 197 | class Wowha extends Thing | 197 | class Wowha extends Thing |
| 198 | @butt: -> | 198 | @butt: -> |
| 199 | super! | 199 | super! |
| 200 | super.hello | 200 | _ = super.hello |
| 201 | super\hello! | 201 | super\hello! |
| 202 | super\hello | 202 | _ = super\hello |
| 203 | 203 | ||
| 204 | 204 | ||
| 205 | @zone: cool { | 205 | @zone: cool { |
| 206 | -> | 206 | -> |
| 207 | super! | 207 | super! |
| 208 | super.hello | 208 | _ = super.hello |
| 209 | super\hello! | 209 | super\hello! |
| 210 | super\hello | 210 | _ = super\hello |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | nil | 213 | nil |
diff --git a/spec/inputs/comprehension.moon b/spec/inputs/comprehension.moon index 1609d79..f07cf89 100644 --- a/spec/inputs/comprehension.moon +++ b/spec/inputs/comprehension.moon | |||
| @@ -11,11 +11,11 @@ copy = {k,v for k,v in pairs x when k != "okay"} | |||
| 11 | 11 | ||
| 12 | -- | 12 | -- |
| 13 | 13 | ||
| 14 | { unpack(x) for x in yes } | 14 | _ = { unpack(x) for x in yes } |
| 15 | { unpack(x) for x in *yes } | 15 | _ = { unpack(x) for x in *yes } |
| 16 | 16 | ||
| 17 | { xxxx for x in yes } | 17 | _ = { xxxx for x in yes } |
| 18 | { unpack [a*i for i, a in ipairs x] for x in *{{1,2}, {3,4}} } | 18 | _ = { unpack [a*i for i, a in ipairs x] for x in *{{1,2}, {3,4}} } |
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | -- | 21 | -- |
| @@ -28,7 +28,7 @@ bb = [y for thing in y for i=1,10] | |||
| 28 | cc = [y for i=1,10 for thing in y] | 28 | cc = [y for i=1,10 for thing in y] |
| 29 | dd = [y for i=1,10 when cool for thing in y when x > 3 when c + 3] | 29 | dd = [y for i=1,10 when cool for thing in y when x > 3 when c + 3] |
| 30 | 30 | ||
| 31 | {"hello", "world" for i=1,10} | 31 | _ = {"hello", "world" for i=1,10} |
| 32 | 32 | ||
| 33 | -- | 33 | -- |
| 34 | 34 | ||
| @@ -44,8 +44,8 @@ ok(a,b,c) for {a,b,c} in things | |||
| 44 | 44 | ||
| 45 | -- | 45 | -- |
| 46 | 46 | ||
| 47 | [item for item in *items[1 + 2,3+4]] | 47 | _ = [item for item in *items[1 + 2,3+4]] |
| 48 | [item for item in *items[hello! * 4, 2 - thing[4]]] | 48 | _ = [item for item in *items[hello! * 4, 2 - thing[4]]] |
| 49 | 49 | ||
| 50 | 50 | ||
| 51 | 51 | ||
diff --git a/spec/inputs/cond.moon b/spec/inputs/cond.moon index 18e42b9..e8b6283 100644 --- a/spec/inputs/cond.moon +++ b/spec/inputs/cond.moon | |||
| @@ -1,25 +1,25 @@ | |||
| 1 | 1 | ||
| 2 | you_cool = false | 2 | you_cool = false |
| 3 | 3 | ||
| 4 | if cool | 4 | _ = if cool |
| 5 | if you_cool | 5 | if you_cool |
| 6 | one | 6 | one |
| 7 | else if eatdic | 7 | else if eatdic |
| 8 | yeah | 8 | yeah |
| 9 | else | 9 | else |
| 10 | two | 10 | _ = two |
| 11 | three | 11 | three |
| 12 | else | 12 | else |
| 13 | no | 13 | no |
| 14 | 14 | ||
| 15 | if cool then no | 15 | _ = if cool then no |
| 16 | if cool then no else yes | 16 | _ = if cool then no else yes |
| 17 | 17 | ||
| 18 | if cool then wow cool else | 18 | if cool then wow cool else |
| 19 | noso cool | 19 | noso cool |
| 20 | 20 | ||
| 21 | if working | 21 | if working |
| 22 | if cool then if cool then okay else what else nah | 22 | _ = if cool then if cool then okay else what else nah |
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | if yeah then no day elseif cool me then okay ya else u way | 25 | if yeah then no day elseif cool me then okay ya else u way |
| @@ -70,7 +70,7 @@ hello = 5 + if something = 10 | |||
| 70 | 70 | ||
| 71 | z = false | 71 | z = false |
| 72 | 72 | ||
| 73 | if false | 73 | _ = if false |
| 74 | one | 74 | one |
| 75 | elseif x = true | 75 | elseif x = true |
| 76 | two | 76 | two |
diff --git a/spec/inputs/destructure.moon b/spec/inputs/destructure.moon index beb79d6..2509968 100644 --- a/spec/inputs/destructure.moon +++ b/spec/inputs/destructure.moon | |||
| @@ -90,7 +90,7 @@ do | |||
| 90 | do | 90 | do |
| 91 | {a,b,c} = z | 91 | {a,b,c} = z |
| 92 | 92 | ||
| 93 | (z) -> | 93 | _ = (z) -> |
| 94 | {a,b,c} = z | 94 | {a,b,c} = z |
| 95 | 95 | ||
| 96 | do | 96 | do |
diff --git a/spec/inputs/do.moon b/spec/inputs/do.moon index 334e68f..21e2127 100644 --- a/spec/inputs/do.moon +++ b/spec/inputs/do.moon | |||
| @@ -11,7 +11,7 @@ y = do | |||
| 11 | things = "shhh" | 11 | things = "shhh" |
| 12 | -> "hello: " .. things | 12 | -> "hello: " .. things |
| 13 | 13 | ||
| 14 | -> if something then do "yeah" | 14 | _ = -> if something then do "yeah" |
| 15 | 15 | ||
| 16 | t = { | 16 | t = { |
| 17 | y: do | 17 | y: do |
diff --git a/spec/inputs/existential.moon b/spec/inputs/existential.moon new file mode 100644 index 0000000..97e8de0 --- /dev/null +++ b/spec/inputs/existential.moon | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | if {:x} = a?.if?\then?(123)? @?\function 998 | ||
| 2 | print x | ||
| 3 | |||
| 4 | with abc?!\func?! | ||
| 5 | if \p? "abc" | ||
| 6 | return 123 | ||
| 7 | |||
| 8 | @?\func 998 | ||
diff --git a/spec/inputs/funcs.moon b/spec/inputs/funcs.moon index 08a29b6..7a4d5d6 100644 --- a/spec/inputs/funcs.moon +++ b/spec/inputs/funcs.moon | |||
| @@ -2,9 +2,9 @@ | |||
| 2 | 2 | ||
| 3 | x = -> print what | 3 | x = -> print what |
| 4 | 4 | ||
| 5 | -> | 5 | _ = -> |
| 6 | 6 | ||
| 7 | -> -> -> | 7 | _ = -> -> -> |
| 8 | 8 | ||
| 9 | go to the barn | 9 | go to the barn |
| 10 | 10 | ||
| @@ -27,29 +27,29 @@ x = (...) -> | |||
| 27 | hello! | 27 | hello! |
| 28 | hello.world! | 28 | hello.world! |
| 29 | 29 | ||
| 30 | hello!.something | 30 | _ = hello!.something |
| 31 | what!["ofefe"] | 31 | _ = what!["ofefe"] |
| 32 | 32 | ||
| 33 | what! the! heck! | 33 | what! the! heck! |
| 34 | 34 | ||
| 35 | (a,b,c,d,e) -> | 35 | _ = (a,b,c,d,e) -> |
| 36 | 36 | ||
| 37 | (a,a,a,a,a) -> | 37 | _ = (a,a,a,a,a) -> |
| 38 | print a | 38 | print a |
| 39 | 39 | ||
| 40 | (x=23023) -> | 40 | _ = (x=23023) -> |
| 41 | 41 | ||
| 42 | (x=(y=()->) ->) -> | 42 | _ = (x=(y=()->) ->) -> |
| 43 | 43 | ||
| 44 | (x = if something then yeah else no) -> | 44 | _ = (x = if something then yeah else no) -> |
| 45 | 45 | ||
| 46 | something = (hello=100, world=(x=[[yeah cool]])-> print "eat rice") -> | 46 | something = (hello=100, world=(x=[[yeah cool]])-> print "eat rice") -> |
| 47 | print hello | 47 | print hello |
| 48 | 48 | ||
| 49 | (x, y) => | 49 | _ = (x, y) => |
| 50 | (@x, @y) => | 50 | _ = (@x, @y) => |
| 51 | (x=1) => | 51 | _ = (x=1) => |
| 52 | (@x=1,y,@z="hello world") => | 52 | _ = (@x=1,y,@z="hello world") => |
| 53 | 53 | ||
| 54 | 54 | ||
| 55 | x -> return | 55 | x -> return |
| @@ -57,7 +57,7 @@ y -> return 1 | |||
| 57 | z -> return 1, "hello", "world" | 57 | z -> return 1, "hello", "world" |
| 58 | k -> if yes then return else return | 58 | k -> if yes then return else return |
| 59 | 59 | ||
| 60 | -> real_name if something | 60 | _ = -> real_name if something |
| 61 | 61 | ||
| 62 | -- | 62 | -- |
| 63 | 63 | ||
| @@ -97,7 +97,7 @@ f( | |||
| 97 | 97 | ||
| 98 | x = (a, | 98 | x = (a, |
| 99 | b) -> | 99 | b) -> |
| 100 | print "what" | 100 | print "what" |
| 101 | 101 | ||
| 102 | 102 | ||
| 103 | y = (a="hi", | 103 | y = (a="hi", |
diff --git a/spec/inputs/lists.moon b/spec/inputs/lists.moon index c119185..e377d5e 100644 --- a/spec/inputs/lists.moon +++ b/spec/inputs/lists.moon | |||
| @@ -3,14 +3,14 @@ hi = [x*2 for _, x in ipairs{1,2,3,4}] | |||
| 3 | 3 | ||
| 4 | items = {1,2,3,4,5,6} | 4 | items = {1,2,3,4,5,6} |
| 5 | 5 | ||
| 6 | [z for z in ipairs items when z > 4] | 6 | _ = [z for z in ipairs items when z > 4] |
| 7 | 7 | ||
| 8 | rad = [{a} for a in ipairs { | 8 | rad = [{a} for a in ipairs { |
| 9 | 1,2,3,4,5,6, | 9 | 1,2,3,4,5,6, |
| 10 | } when good_number a] | 10 | } when good_number a] |
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | [z for z in items for j in list when z > 4] | 13 | _ = [z for z in items for j in list when z > 4] |
| 14 | 14 | ||
| 15 | require "util" | 15 | require "util" |
| 16 | 16 | ||
| @@ -32,7 +32,7 @@ print x,y for x in ipairs{1,2,4} for y in ipairs{1,2,3} when x != 2 | |||
| 32 | 32 | ||
| 33 | print "hello", x for x in items | 33 | print "hello", x for x in items |
| 34 | 34 | ||
| 35 | [x for x in x] | 35 | _ = [x for x in x] |
| 36 | x = [x for x in x] | 36 | x = [x for x in x] |
| 37 | 37 | ||
| 38 | print x,y for x in ipairs{1,2,4} for y in ipairs{1,2,3} when x != 2 | 38 | print x,y for x in ipairs{1,2,4} for y in ipairs{1,2,3} when x != 2 |
| @@ -67,6 +67,6 @@ normal = (hello) -> | |||
| 67 | test = x 1,2,3,4,5 | 67 | test = x 1,2,3,4,5 |
| 68 | print thing for thing in *test | 68 | print thing for thing in *test |
| 69 | 69 | ||
| 70 | -> a = b for row in *rows | 70 | _ = -> a = b for row in *rows |
| 71 | 71 | ||
| 72 | 72 | ||
diff --git a/spec/inputs/literals.moon b/spec/inputs/literals.moon index c3a24a6..d4b0326 100644 --- a/spec/inputs/literals.moon +++ b/spec/inputs/literals.moon | |||
| @@ -1,46 +1,46 @@ | |||
| 1 | 1 | ||
| 2 | _ = { | ||
| 3 | 121 | ||
| 4 | 121.2323 | ||
| 5 | 121.2323e-1 | ||
| 6 | 121.2323e13434 | ||
| 7 | 2323E34 | ||
| 8 | 0x12323 | ||
| 2 | 9 | ||
| 3 | 121 | 10 | 0xfF2323 |
| 4 | 121.2323 | 11 | 0xabcdef |
| 5 | 121.2323e-1 | 12 | 0xABCDEF |
| 6 | 121.2323e13434 | ||
| 7 | 2323E34 | ||
| 8 | 0x12323 | ||
| 9 | 13 | ||
| 10 | 0xfF2323 | 14 | .2323 |
| 11 | 0xabcdef | 15 | .2323e-1 |
| 12 | 0xABCDEF | 16 | .2323e13434 |
| 13 | 17 | ||
| 14 | .2323 | ||
| 15 | .2323e-1 | ||
| 16 | .2323e13434 | ||
| 17 | 18 | ||
| 19 | 1LL | ||
| 20 | 1ULL | ||
| 21 | 9332LL | ||
| 22 | 9332 | ||
| 23 | 0x2aLL | ||
| 24 | 0x2aULL | ||
| 18 | 25 | ||
| 19 | 1LL | 26 | [[ hello world ]] |
| 20 | 1ULL | ||
| 21 | 9332LL | ||
| 22 | 9332 | ||
| 23 | 0x2aLL | ||
| 24 | 0x2aULL | ||
| 25 | 27 | ||
| 26 | [[ hello world ]] | 28 | [=[ hello world ]=] |
| 29 | [====[ hello world ]====] | ||
| 27 | 30 | ||
| 28 | [=[ hello world ]=] | 31 | "another world" |
| 29 | [====[ hello world ]====] | ||
| 30 | 32 | ||
| 31 | "another world" | 33 | 'what world' |
| 32 | 34 | ||
| 33 | 'what world' | ||
| 34 | 35 | ||
| 36 | " | ||
| 37 | hello world | ||
| 38 | " | ||
| 35 | 39 | ||
| 36 | " | 40 | 'yeah |
| 37 | hello world | 41 | what is going on |
| 38 | " | 42 | here is something cool' |
| 39 | |||
| 40 | 'yeah | ||
| 41 | what is going on | ||
| 42 | here is something cool' | ||
| 43 | |||
| 44 | 43 | ||
| 44 | } | ||
| 45 | nil | 45 | nil |
| 46 | 46 | ||
diff --git a/spec/inputs/local.moon b/spec/inputs/local.moon index fec78b1..f14f575 100644 --- a/spec/inputs/local.moon +++ b/spec/inputs/local.moon | |||
| @@ -89,6 +89,6 @@ do | |||
| 89 | do | 89 | do |
| 90 | local * | 90 | local * |
| 91 | -- this generates a nil value in the body | 91 | -- this generates a nil value in the body |
| 92 | for a in *{} do a | 92 | for a in *{} do _ = a |
| 93 | 93 | ||
| 94 | g = 2323 -- test if anything leaked | 94 | g = 2323 -- test if anything leaked |
diff --git a/spec/inputs/loops.moon b/spec/inputs/loops.moon index a704e56..130570e 100644 --- a/spec/inputs/loops.moon +++ b/spec/inputs/loops.moon | |||
| @@ -33,7 +33,7 @@ for x in y, z, k | |||
| 33 | 33 | ||
| 34 | x = -> | 34 | x = -> |
| 35 | for x in y | 35 | for x in y |
| 36 | y | 36 | _ = y |
| 37 | 37 | ||
| 38 | hello = {1,2,3,4,5} | 38 | hello = {1,2,3,4,5} |
| 39 | 39 | ||
| @@ -43,7 +43,7 @@ x = for y in *hello | |||
| 43 | 43 | ||
| 44 | x = -> | 44 | x = -> |
| 45 | for x in *hello | 45 | for x in *hello |
| 46 | y | 46 | _ = y |
| 47 | 47 | ||
| 48 | t = for i=10,20 do i * 2 | 48 | t = for i=10,20 do i * 2 |
| 49 | 49 | ||
| @@ -52,11 +52,11 @@ y = for j = 3,30, 8 | |||
| 52 | hmm += 1 | 52 | hmm += 1 |
| 53 | j * hmm | 53 | j * hmm |
| 54 | 54 | ||
| 55 | -> | 55 | _ = -> |
| 56 | for k=10,40 | 56 | for k=10,40 |
| 57 | "okay" | 57 | _ = "okay" |
| 58 | 58 | ||
| 59 | -> | 59 | _ = -> |
| 60 | return for k=10,40 | 60 | return for k=10,40 |
| 61 | "okay" | 61 | "okay" |
| 62 | 62 | ||
| @@ -68,7 +68,7 @@ while 5 + 5 | |||
| 68 | 68 | ||
| 69 | while also do | 69 | while also do |
| 70 | i work too | 70 | i work too |
| 71 | "okay" | 71 | _ = "okay" |
| 72 | 72 | ||
| 73 | i = 0 | 73 | i = 0 |
| 74 | x = while i < 10 | 74 | x = while i < 10 |
diff --git a/spec/inputs/return.moon b/spec/inputs/return.moon index 61d3dca..98c3104 100644 --- a/spec/inputs/return.moon +++ b/spec/inputs/return.moon | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | -- testing `return` propagation | 1 | -- testing `return` propagation |
| 2 | 2 | ||
| 3 | -> x for x in *things | 3 | _ = -> _ = x for x in *things |
| 4 | -> [x for x in *things] | 4 | _ = -> [x for x in *things] |
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | -- doesn't make sense on purpose | 7 | -- doesn't make sense on purpose |
| @@ -14,7 +14,7 @@ do | |||
| 14 | do | 14 | do |
| 15 | return {x,y for x,y in *things} | 15 | return {x,y for x,y in *things} |
| 16 | 16 | ||
| 17 | -> | 17 | _ = -> |
| 18 | if a | 18 | if a |
| 19 | if a | 19 | if a |
| 20 | a | 20 | a |
| @@ -49,7 +49,7 @@ do | |||
| 49 | else | 49 | else |
| 50 | b | 50 | b |
| 51 | 51 | ||
| 52 | -> a\b | 52 | _ = -> a\b |
| 53 | do a\b | 53 | do a\b |
| 54 | 54 | ||
| 55 | 55 | ||
diff --git a/spec/inputs/string.moon b/spec/inputs/string.moon index 897056a..5d8f772 100644 --- a/spec/inputs/string.moon +++ b/spec/inputs/string.moon | |||
| @@ -52,7 +52,7 @@ c = 'hello #{hello}' | |||
| 52 | 52 | ||
| 53 | -- | 53 | -- |
| 54 | 54 | ||
| 55 | "hello" | 55 | _ = "hello" |
| 56 | "hello"\format 1 | 56 | "hello"\format 1 |
| 57 | "hello"\format(1,2,3) | 57 | "hello"\format(1,2,3) |
| 58 | "hello"\format(1,2,3) 1,2,3 | 58 | "hello"\format(1,2,3) 1,2,3 |
diff --git a/spec/inputs/switch.moon b/spec/inputs/switch.moon index 3bc179b..a028f98 100644 --- a/spec/inputs/switch.moon +++ b/spec/inputs/switch.moon | |||
| @@ -15,7 +15,7 @@ switch value | |||
| 15 | when "cool" | 15 | when "cool" |
| 16 | print "hello world" | 16 | print "hello world" |
| 17 | when "yeah" | 17 | when "yeah" |
| 18 | [[FFFF]] + [[MMMM]] | 18 | _ = [[FFFF]] + [[MMMM]] |
| 19 | when 2323 + 32434 | 19 | when 2323 + 32434 |
| 20 | print "okay" | 20 | print "okay" |
| 21 | else | 21 | else |
| @@ -33,9 +33,9 @@ out = switch value | |||
| 33 | with something | 33 | with something |
| 34 | switch \value! | 34 | switch \value! |
| 35 | when .okay | 35 | when .okay |
| 36 | "world" | 36 | _ = "world" |
| 37 | else | 37 | else |
| 38 | "yesh" | 38 | _ = "yesh" |
| 39 | 39 | ||
| 40 | fix this | 40 | fix this |
| 41 | call_func switch something | 41 | call_func switch something |
| @@ -46,7 +46,7 @@ call_func switch something | |||
| 46 | 46 | ||
| 47 | switch hi | 47 | switch hi |
| 48 | when hello or world | 48 | when hello or world |
| 49 | greene | 49 | _ = greene |
| 50 | 50 | ||
| 51 | -- | 51 | -- |
| 52 | 52 | ||
| @@ -54,7 +54,7 @@ switch hi | |||
| 54 | when "one", "two" | 54 | when "one", "two" |
| 55 | print "cool" | 55 | print "cool" |
| 56 | when "dad" | 56 | when "dad" |
| 57 | no | 57 | _ = no |
| 58 | 58 | ||
| 59 | switch hi | 59 | switch hi |
| 60 | when 3+1, hello!, (-> 4)! | 60 | when 3+1, hello!, (-> 4)! |
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 |
diff --git a/spec/inputs/tables.moon b/spec/inputs/tables.moon index 2bf66d7..10bccde 100644 --- a/spec/inputs/tables.moon +++ b/spec/inputs/tables.moon | |||
| @@ -138,7 +138,7 @@ thing what: | |||
| 138 | thing what: | 138 | thing what: |
| 139 | "great", no: | 139 | "great", no: |
| 140 | "more" | 140 | "more" |
| 141 | okay: 123 -- a anon table | 141 | _ = okay: 123 -- a anon table |
| 142 | 142 | ||
| 143 | 143 | ||
| 144 | -- | 144 | -- |
diff --git a/spec/inputs/using.moon b/spec/inputs/using.moon index 55a16a7..e407983 100644 --- a/spec/inputs/using.moon +++ b/spec/inputs/using.moon | |||
| @@ -2,18 +2,18 @@ | |||
| 2 | hello = "hello" | 2 | hello = "hello" |
| 3 | world = "world" | 3 | world = "world" |
| 4 | 4 | ||
| 5 | (using nil) -> | 5 | _ = (using nil) -> |
| 6 | hello = 3223 | 6 | hello = 3223 |
| 7 | 7 | ||
| 8 | (a using nil) -> | 8 | _ = (a using nil) -> |
| 9 | hello = 3223 | 9 | hello = 3223 |
| 10 | a = 323 | 10 | a = 323 |
| 11 | 11 | ||
| 12 | (a,b,c using a,b,c) -> | 12 | _ = (a,b,c using a,b,c) -> |
| 13 | a,b,c = 1,2,3 | 13 | a,b,c = 1,2,3 |
| 14 | world = 12321 | 14 | world = 12321 |
| 15 | 15 | ||
| 16 | (a,e,f using a,b,c, hello) -> | 16 | _ = (a,e,f using a,b,c, hello) -> |
| 17 | a,b,c = 1,2,3 | 17 | a,b,c = 1,2,3 |
| 18 | hello = 12321 | 18 | hello = 12321 |
| 19 | world = "yeah" | 19 | world = "yeah" |
diff --git a/spec/inputs/whitespace.moon b/spec/inputs/whitespace.moon index 4a2ff1f..e505b1b 100644 --- a/spec/inputs/whitespace.moon +++ b/spec/inputs/whitespace.moon | |||
| @@ -1,42 +1,42 @@ | |||
| 1 | 1 | ||
| 2 | { | 2 | _ = { |
| 3 | 1, 2 | 3 | 1, 2 |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | { 1, 2 | 6 | _ = { 1, 2 |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | { 1, 2 } | 9 | _ = { 1, 2 } |
| 10 | 10 | ||
| 11 | {1,2} | 11 | _ = {1,2} |
| 12 | 12 | ||
| 13 | { | 13 | _ = { |
| 14 | 1,2 | 14 | 1,2 |
| 15 | 15 | ||
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | { something 1,2, | 18 | _ = { something 1,2, |
| 19 | 4,5,6, | 19 | 4,5,6, |
| 20 | 3,4,5 | 20 | 3,4,5 |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | { | 23 | _ = { |
| 24 | a 1,2,3, | 24 | a 1,2,3, |
| 25 | 4,5,6 | 25 | 4,5,6 |
| 26 | 1,2,3 | 26 | 1,2,3 |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | { | 30 | _ = { |
| 31 | b 1,2,3, | 31 | b 1,2,3, |
| 32 | 4,5,6 | 32 | 4,5,6 |
| 33 | 1,2,3, | 33 | 1,2,3, |
| 34 | 1,2,3 | 34 | 1,2,3 |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | { 1,2,3 } | 37 | _ = { 1,2,3 } |
| 38 | 38 | ||
| 39 | { c 1,2,3, | 39 | _ = { c 1,2,3, |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | 42 | ||
| @@ -58,7 +58,7 @@ hello 1,2,3, | |||
| 58 | 9,9 | 58 | 9,9 |
| 59 | 59 | ||
| 60 | 60 | ||
| 61 | { | 61 | _ = { |
| 62 | hello 1,2, | 62 | hello 1,2, |
| 63 | 3,4, | 63 | 3,4, |
| 64 | 5, 6 | 64 | 5, 6 |
diff --git a/spec/inputs/with.moon b/spec/inputs/with.moon index ae3c8c0..f543356 100644 --- a/spec/inputs/with.moon +++ b/spec/inputs/with.moon | |||
| @@ -37,7 +37,7 @@ do | |||
| 37 | 37 | ||
| 38 | do | 38 | do |
| 39 | with foo | 39 | with foo |
| 40 | \prop"something".hello | 40 | _ = \prop"something".hello |
| 41 | .prop\send(one) | 41 | .prop\send(one) |
| 42 | .prop\send one | 42 | .prop\send one |
| 43 | 43 | ||
| @@ -107,7 +107,7 @@ do | |||
| 107 | print .c | 107 | print .c |
| 108 | 108 | ||
| 109 | do | 109 | do |
| 110 | -> | 110 | _ = -> |
| 111 | with hi | 111 | with hi |
| 112 | return .a, .b | 112 | return .a, .b |
| 113 | 113 | ||
