From 52a6536103f46c26a3ba9b149b0fe7b40d524d8c Mon Sep 17 00:00:00 2001
From: Li Jin <dragon-fly@qq.com>
Date: Fri, 10 Jan 2020 16:30:34 +0800
Subject: update.

---
 spec/inputs/assign.moon        |  30 +++++
 spec/inputs/bubbling.moon      |  28 +++++
 spec/inputs/class.moon         | 213 ++++++++++++++++++++++++++++++++
 spec/inputs/comprehension.moon |  52 ++++++++
 spec/inputs/cond.moon          | 190 ++++++++++++++++++++++++++++
 spec/inputs/destructure.moon   | 100 +++++++++++++++
 spec/inputs/do.moon            |  27 ++++
 spec/inputs/export.moon        |  77 ++++++++++++
 spec/inputs/funcs.moon         | 158 ++++++++++++++++++++++++
 spec/inputs/import.moon        |  48 ++++++++
 spec/inputs/lists.moon         |  72 +++++++++++
 spec/inputs/literals.moon      |  46 +++++++
 spec/inputs/local.moon         |  94 ++++++++++++++
 spec/inputs/loops.moon         | 133 ++++++++++++++++++++
 spec/inputs/operators.moon     |  72 +++++++++++
 spec/inputs/plus.moon          |   7 ++
 spec/inputs/return.moon        |  55 +++++++++
 spec/inputs/string.moon        |  66 ++++++++++
 spec/inputs/stub.moon          |  16 +++
 spec/inputs/switch.moon        |  64 ++++++++++
 spec/inputs/syntax.moon        | 272 +++++++++++++++++++++++++++++++++++++++++
 spec/inputs/tables.moon        | 161 ++++++++++++++++++++++++
 spec/inputs/unless_else.moon   |   5 +
 spec/inputs/using.moon         |  21 ++++
 spec/inputs/whitespace.moon    | 102 ++++++++++++++++
 spec/inputs/with.moon          | 118 ++++++++++++++++++
 26 files changed, 2227 insertions(+)
 create mode 100644 spec/inputs/assign.moon
 create mode 100644 spec/inputs/bubbling.moon
 create mode 100644 spec/inputs/class.moon
 create mode 100644 spec/inputs/comprehension.moon
 create mode 100644 spec/inputs/cond.moon
 create mode 100644 spec/inputs/destructure.moon
 create mode 100644 spec/inputs/do.moon
 create mode 100644 spec/inputs/export.moon
 create mode 100644 spec/inputs/funcs.moon
 create mode 100644 spec/inputs/import.moon
 create mode 100644 spec/inputs/lists.moon
 create mode 100644 spec/inputs/literals.moon
 create mode 100644 spec/inputs/local.moon
 create mode 100644 spec/inputs/loops.moon
 create mode 100644 spec/inputs/operators.moon
 create mode 100644 spec/inputs/plus.moon
 create mode 100644 spec/inputs/return.moon
 create mode 100644 spec/inputs/string.moon
 create mode 100644 spec/inputs/stub.moon
 create mode 100644 spec/inputs/switch.moon
 create mode 100644 spec/inputs/syntax.moon
 create mode 100644 spec/inputs/tables.moon
 create mode 100644 spec/inputs/unless_else.moon
 create mode 100644 spec/inputs/using.moon
 create mode 100644 spec/inputs/whitespace.moon
 create mode 100644 spec/inputs/with.moon

(limited to 'spec')

diff --git a/spec/inputs/assign.moon b/spec/inputs/assign.moon
new file mode 100644
index 0000000..1e5e7a6
--- /dev/null
+++ b/spec/inputs/assign.moon
@@ -0,0 +1,30 @@
+
+->
+  joop = 2302
+
+  (hi) ->
+    d = 100
+    hi = 1021
+
+    a,b,c,d = 1,2,3,4
+
+    hello[232], (5+5)[121], hello, x[99] = 100, 200, 300
+
+    joop = 12
+
+joop = 2345
+
+a, b = if hello
+  "hello"
+else
+  "nothing", "yeah"
+
+
+a, b = if hello
+  if yeah then "one", "two" else "mmhh"
+else
+  print "the other"
+  "nothing", "yeah"
+
+
+
diff --git a/spec/inputs/bubbling.moon b/spec/inputs/bubbling.moon
new file mode 100644
index 0000000..d1004f9
--- /dev/null
+++ b/spec/inputs/bubbling.moon
@@ -0,0 +1,28 @@
+
+-- vararg bubbling
+f = (...) -> #{...}
+
+dont_bubble = ->
+  [x for x in ((...)-> print ...)("hello")]
+
+k = [x for x in ((...)-> print ...)("hello")]
+
+j = for i=1,10
+  (...) -> print ...
+
+-- bubble me
+
+m = (...) ->
+  [x for x in *{...} when f(...) > 4]
+
+x = for i in *{...} do i
+y = [x for x in *{...}]
+z = [x for x in hallo when f(...) > 4]
+
+
+a = for i=1,10 do ...
+
+b = for i=1,10
+  -> print ...
+
+
diff --git a/spec/inputs/class.moon b/spec/inputs/class.moon
new file mode 100644
index 0000000..9a98055
--- /dev/null
+++ b/spec/inputs/class.moon
@@ -0,0 +1,213 @@
+
+class Hello
+  new: (@test, @world) =>
+    print "creating object.."
+  hello: =>
+    print @test, @world
+  __tostring: => "hello world"
+
+x = Hello 1,2
+x\hello()
+
+print x
+
+class Simple
+  cool: => print "cool"
+
+class Yikes extends Simple
+  new: => print "created hello"
+
+x = Yikes()
+x\cool()
+
+
+class Hi
+  new: (arg) =>
+    print "init arg", arg
+
+  cool: (num) =>
+    print "num", num
+
+
+class Simple extends Hi
+  new: => super "man"
+  cool: => super 120302
+
+x = Simple()
+x\cool()
+
+print x.__class == Simple
+
+
+class Okay
+  -- what is going on
+  something: 20323
+  -- yeaha
+
+
+class Biggie extends Okay
+  something: =>
+    super 1,2,3,4
+    super.something another_self, 1,2,3,4
+    assert super == Okay
+
+
+class Yeah
+  okay: =>
+    super\something 1,2,3,4
+
+
+class What
+  something: => print "val:", @val
+
+class Hello extends What
+  val: 2323
+  something: => super\something
+
+with Hello!
+  x = \something!
+  print x
+  x!
+
+class CoolSuper
+  hi: =>
+    super(1,2,3,4) 1,2,3,4
+    super.something 1,2,3,4
+    super.something(1,2,3,4).world
+    super\yeah"world".okay hi, hi, hi
+    something.super
+    super.super.super.super
+    super\hello
+    nil
+
+
+-- selfing
+x = @hello
+x = @@hello
+
+@hello "world"
+@@hello "world"
+
+@@one @@two(4,5) @three, @four
+
+xx = (@hello, @@world, cool) ->
+
+
+-- class properties
+class ClassMan
+  @yeah: 343
+  blue: =>
+  @hello: 3434, @world: 23423
+  green: =>
+  @red: =>
+
+
+x = @
+y = @@
+
+@ something
+
+@@ something
+
+@ = @ + @ / @
+
+@ = 343
+@.hello 2,3,4
+
+hello[@].world
+
+
+class Whacko
+  @hello
+  if something
+    print "hello world"
+
+  hello = "world"
+  @another = "day"
+
+  print "yeah" if something -- this is briken
+
+
+print "hello"
+
+yyy = ->
+  class Cool
+    nil
+
+
+--
+
+class a.b.c.D
+  nil
+
+
+class a.b["hello"]
+  nil
+
+class (-> require "moon")!.Something extends Hello.World
+  nil
+
+--
+
+a = class
+b = class Something
+c = class Something extends Hello
+d = class extends World
+
+print (class WhatsUp).__name
+
+--
+
+export ^
+class Something
+  nil
+
+
+--
+
+-- hoisting
+class Something
+  val = 23
+  {:insert} = table
+  new: => print insert, val -- prints nil 23
+
+--
+
+class X
+  new: hi
+
+
+--
+
+class Cool extends Thing
+  dang: =>
+    {
+      hello: -> super!
+      world: -> super.one
+    }
+
+-- 
+
+class Whack extends Thing
+  dang: do_something =>
+    super!
+
+---
+
+class Wowha extends Thing
+  @butt: ->
+    super!
+    super.hello
+    super\hello!
+    super\hello
+
+
+  @zone: cool {
+    ->
+      super!
+      super.hello
+      super\hello!
+      super\hello
+  }
+
+nil
diff --git a/spec/inputs/comprehension.moon b/spec/inputs/comprehension.moon
new file mode 100644
index 0000000..1609d79
--- /dev/null
+++ b/spec/inputs/comprehension.moon
@@ -0,0 +1,52 @@
+
+-- see lists.moon for list comprehension tests
+
+items = {1,2,3,4,5,6}
+out = {k,k*2 for k in items}
+
+
+x = hello: "world", okay: 2323
+
+copy  = {k,v for k,v in pairs x when k != "okay"}
+
+--
+
+{ unpack(x) for x in yes }
+{ unpack(x) for x in *yes }
+
+{ xxxx for x in yes }
+{ unpack [a*i for i, a in ipairs x] for x in *{{1,2}, {3,4}} }
+
+
+--
+
+n1 = [i for i=1,10]
+n2 = [i for i=1,10 when i % 2 == 1]
+
+aa = [{x,y} for x=1,10 for y=5,14]
+bb = [y for thing in y for i=1,10]
+cc = [y for i=1,10 for thing in y]
+dd = [y for i=1,10 when cool for thing in y when x > 3 when c + 3]
+
+{"hello", "world" for i=1,10}
+
+--
+
+j = [a for {a,b,c} in things]
+k = [a for {a,b,c} in *things]
+i = [hello for {:hello, :world} in *things]
+
+hj = {a,c for {a,b,c} in things}
+hk = {a,c for {a,b,c} in *things}
+hi = {hello,world for {:hello, :world} in *things}
+
+ok(a,b,c) for {a,b,c} in things
+
+--
+
+[item for item in *items[1 + 2,3+4]]
+[item for item in *items[hello! * 4, 2 - thing[4]]]
+
+
+
+nil
diff --git a/spec/inputs/cond.moon b/spec/inputs/cond.moon
new file mode 100644
index 0000000..18e42b9
--- /dev/null
+++ b/spec/inputs/cond.moon
@@ -0,0 +1,190 @@
+
+you_cool = false
+
+if cool
+  if you_cool
+    one
+  else if eatdic
+    yeah
+  else
+    two
+    three
+else
+  no
+
+if cool then no
+if cool then no else yes
+
+if cool then wow cool else
+  noso cool
+
+if working
+  if cool then if cool then okay else what else nah
+
+
+if yeah then no day elseif cool me then okay ya else u way
+if yeah then no dad else if cool you then okay bah else p way
+
+
+if (->)() then what ever
+
+if nil then flip me else
+  it be,rad
+
+
+if things great then no way elseif okay sure
+  what here
+
+
+if things then no chance
+elseif okay
+  what now
+
+
+if things
+  yes man
+elseif okay person then hi there else hmm sure
+
+if lets go
+  print "greetings"
+elseif "just us"
+  print "will smith" else show 5555555
+
+--
+
+if something = 10
+  print something
+else
+  print "else"
+
+hello = if something = 10
+  print something
+else
+  print "else"
+
+
+hello = 5 + if something = 10
+  print something
+
+---
+
+z = false
+
+if false
+  one
+elseif x = true
+  two
+elseif z = true
+  three
+else
+  four
+
+
+out = if false
+  one
+elseif x = true
+  two
+elseif z = true
+  three
+else
+  four
+
+kzy = ->
+  if something = true
+    1
+  elseif another = false
+    2
+
+---
+
+unless true
+  print "cool!"
+
+unless true and false
+  print "cool!"
+
+unless false then print "cool!"
+unless false then print "cool!" else print "no way!"
+
+unless nil
+  print "hello"
+else
+  print "world"
+
+--
+
+x = unless true
+  print "cool!"
+
+x = unless true and false
+  print "cool!"
+
+y = unless false then print "cool!"
+y = unless false then print "cool!" else print "no way!"
+
+z = unless nil
+  print "hello"
+else
+  print "world"
+
+print unless true
+  print "cool!"
+
+print unless true and false
+  print "cool!"
+
+print unless false then print "cool!"
+print unless false then print "cool!" else print "no way!"
+
+print unless nil
+  print "hello"
+else
+  print "world"
+
+--
+
+print "hello" unless value
+
+dddd = {1,2,3} unless value
+
+
+-- 
+
+do
+  j = 100
+  unless j = hi!
+    error "not j!"
+
+----------------
+
+a = 12
+a,c,b = "cool" if something
+
+
+
+---
+
+j = if 1
+  if 2
+    3
+else 6
+
+
+m = if 1
+
+
+
+  if 2
+
+
+    3
+
+
+else 6
+
+
+
+nil
+
+
+
diff --git a/spec/inputs/destructure.moon b/spec/inputs/destructure.moon
new file mode 100644
index 0000000..beb79d6
--- /dev/null
+++ b/spec/inputs/destructure.moon
@@ -0,0 +1,100 @@
+
+do
+  {a, b} = hello
+
+  {{a}, b, {c}} = hello
+
+  { :hello, :world } = value
+
+do
+  { yes: no, thing } = world
+
+  {:a,:b,:c,:d} = yeah
+
+  {a} = one, two
+  {b}, c = one
+  {d}, e = one, two
+
+  x, {y} = one, two
+
+  xx, yy = 1, 2
+  {yy, xx} = {xx, yy}
+
+  {a, :b, c, :d, e, :f, g} = tbl
+
+--- 
+
+do
+  futurists =
+    sculptor: "Umberto Boccioni"
+    painter:  "Vladimir Burliuk"
+    poet:
+      name:   "F.T. Marinetti"
+      address: {
+        "Via Roma 42R"
+        "Bellagio, Italy 22021"
+      }
+
+  {poet: {:name, address: {street, city}}} = futurists
+
+--
+
+do
+  { @world } = x
+  { a.b, c.y, func!.z } = x
+
+  { world: @world } = x
+
+--
+
+do
+  thing = {{1,2}, {3,4}}
+
+  for {x,y} in *thing
+    print x,y
+
+
+--
+
+do
+  with {a,b} = thing
+    print a, b
+
+
+--
+
+do
+  thing = nil
+  if {a} = thing
+    print a
+  else
+    print "nothing"
+
+  thang = {1,2}
+  if {a,b} = thang
+    print a,b
+
+  if {a,b} = thing
+    print a,b
+  elseif {c,d} = thang
+    print c,d
+  else
+    print "NO"
+
+--
+
+do
+  z = "yeah"
+  {a,b,c} = z
+
+do
+  {a,b,c} = z
+
+(z) ->
+  {a,b,c} = z
+
+do
+  z = "oo"
+  (k) ->
+    {a,b,c} = z
+
diff --git a/spec/inputs/do.moon b/spec/inputs/do.moon
new file mode 100644
index 0000000..334e68f
--- /dev/null
+++ b/spec/inputs/do.moon
@@ -0,0 +1,27 @@
+
+do
+  print "hello"
+  print "world"
+
+x = do
+  print "hello"
+  print "world"
+
+y = do
+  things = "shhh"
+  -> "hello: " .. things
+
+-> if something then do "yeah"
+
+t = {
+  y: do
+    number = 100
+    (x) -> x + number
+}
+
+(y=(do
+  x = 10 + 2
+  x), k=do
+    "nothing") -> do
+      "uhhh"
+
diff --git a/spec/inputs/export.moon b/spec/inputs/export.moon
new file mode 100644
index 0000000..0a56379
--- /dev/null
+++ b/spec/inputs/export.moon
@@ -0,0 +1,77 @@
+
+do
+  export a,b,c = 223, 343
+  export cool = "dad"
+
+do
+  export class Something
+    umm: "cool"
+
+do
+  export a,b,c
+  a,b,c,d = "hello"
+
+
+do
+  What = if this
+    232
+  else
+    4343
+
+  export ^
+
+  another = 3434
+  Another = 7890
+
+  if inner then Yeah = "10000"
+
+  What = if this
+    232
+  else
+    4343
+
+
+do
+  export *
+
+  What = if this
+    232
+  else
+    4343
+
+  x,y,z = 1,2,3
+
+  y = ->
+    hallo = 3434
+
+  with tmp
+    j = 2000
+
+
+do
+  export *
+  x = 3434
+  if y then
+    x = 10
+
+do
+  export *
+  if y then
+    x = 10
+  x = 3434
+
+do
+  do
+    export *
+
+    k = 1212
+
+    do
+      h = 100
+
+    y = ->
+      h = 100
+      k = 100
+
+  h = 100
+
diff --git a/spec/inputs/funcs.moon b/spec/inputs/funcs.moon
new file mode 100644
index 0000000..08a29b6
--- /dev/null
+++ b/spec/inputs/funcs.moon
@@ -0,0 +1,158 @@
+
+
+x = -> print what
+
+->
+
+-> -> ->
+
+go to the barn
+
+open -> the -> door
+
+open ->
+  the door
+  hello = ->
+    my func
+
+h = -> hi
+
+eat ->, world
+
+
+(->)()
+
+x = (...) ->
+
+hello!
+hello.world!
+
+hello!.something
+what!["ofefe"]
+
+what! the! heck!
+
+(a,b,c,d,e) ->
+
+(a,a,a,a,a) ->
+  print a
+
+(x=23023) ->
+
+(x=(y=()->) ->) ->
+
+(x = if something then yeah else no) ->
+
+something = (hello=100, world=(x=[[yeah cool]])-> print "eat rice") ->
+  print hello
+
+(x, y) =>
+(@x, @y) =>
+(x=1) =>
+(@x=1,y,@z="hello world") =>
+
+
+x -> return
+y -> return 1
+z -> return 1, "hello", "world"
+k -> if yes then return else return
+
+-> real_name if something
+
+--
+
+d(
+  ->
+    print "hello world"
+  10
+)
+
+
+
+d(
+  1,2,3
+  4
+  5
+  6
+
+  if something
+    print "okay"
+    10
+
+  10,20
+)
+
+
+f(
+  
+  )(
+  
+  )(
+    what
+  )(->
+    print "srue"
+  123)
+
+--
+
+x = (a,
+  b) ->
+    print "what"
+
+
+y = (a="hi",
+  b=23) ->
+    print "what"
+
+z = (
+  a="hi",
+  b=23) ->
+    print "what"
+
+
+j = (f,g,m,
+  a="hi",
+  b=23
+) ->
+    print "what"
+
+
+y = (a="hi",
+  b=23,
+  ...) ->
+    print "what"
+
+
+y = (a="hi",
+  b=23,
+  ...
+) ->
+    print "what"
+
+--
+
+args = (a
+  b) ->
+    print "what"
+
+
+args = (a="hi"
+  b=23) ->
+    print "what"
+
+args = (
+  a="hi"
+  b=23) ->
+    print "what"
+
+
+args = (f,g,m
+  a="hi"
+  b=23
+) ->
+    print "what"
+
+
+
+
+nil
diff --git a/spec/inputs/import.moon b/spec/inputs/import.moon
new file mode 100644
index 0000000..d86d724
--- /dev/null
+++ b/spec/inputs/import.moon
@@ -0,0 +1,48 @@
+
+
+import hello from yeah
+import hello, world from table["cool"]
+
+import a, \b, c from items
+
+
+import master, \ghost from find "mytable"
+
+
+a, yumm = 3434, "hello"
+
+
+_table_0 = 232
+
+import something from a table
+
+
+if indent
+  import okay, \well from tables[100]
+
+do
+  import a, b, c from z
+
+do
+  import a,
+    b, c from z
+
+do
+  import a
+    b
+    c from z
+
+do
+  import
+    a
+    b
+    c from z
+
+
+do
+  import
+    a
+    b
+    c
+    from z
+
diff --git a/spec/inputs/lists.moon b/spec/inputs/lists.moon
new file mode 100644
index 0000000..c119185
--- /dev/null
+++ b/spec/inputs/lists.moon
@@ -0,0 +1,72 @@
+
+hi = [x*2 for _, x in ipairs{1,2,3,4}]
+
+items = {1,2,3,4,5,6}
+
+[z for z in ipairs items when z > 4]
+
+rad = [{a} for a in ipairs {
+   1,2,3,4,5,6,
+} when good_number a]
+
+
+[z for z in items for j in list when z > 4]
+
+require "util"
+
+dump = (x) -> print util.dump x
+
+range = (count) ->
+  i = 0
+  return coroutine.wrap ->
+    while i < count
+      coroutine.yield i
+      i = i + 1
+
+dump [x for x in range 10]
+dump [{x, y} for x in range 5 when x > 2 for y in range 5]
+
+things = [x + y for x in range 10 when x > 5 for y in range 10 when y > 7]
+
+print x,y for x in ipairs{1,2,4} for y in ipairs{1,2,3} when x != 2
+
+print "hello", x for x in items
+
+[x for x in x]
+x = [x for x in x]
+
+print x,y for x in ipairs{1,2,4} for y in ipairs{1,2,3} when x != 2
+
+double = [x*2 for x in *items]
+
+print x for x in *double
+
+cut = [x for x in *items when x > 3]
+
+hello = [x + y for x in *items for y in *items]
+
+print z for z in *hello
+
+
+-- slice
+x = {1, 2, 3, 4, 5, 6, 7}
+print y for y in *x[2,-5,2]
+print y for y in *x[,3]
+print y for y in *x[2,]
+print y for y in *x[,,2]
+print y for y in *x[2,,2]
+
+a, b, c = 1, 5, 2
+print y for y in *x[a,b,c]
+
+
+normal = (hello) ->
+  [x for x in yeah]
+
+
+test = x 1,2,3,4,5
+print thing for thing in *test
+
+-> a = b for row in *rows
+
+
diff --git a/spec/inputs/literals.moon b/spec/inputs/literals.moon
new file mode 100644
index 0000000..c3a24a6
--- /dev/null
+++ b/spec/inputs/literals.moon
@@ -0,0 +1,46 @@
+
+
+121
+121.2323
+121.2323e-1
+121.2323e13434
+2323E34
+0x12323
+
+0xfF2323
+0xabcdef
+0xABCDEF
+
+.2323
+.2323e-1
+.2323e13434
+
+
+1LL
+1ULL
+9332LL
+9332
+0x2aLL
+0x2aULL
+
+[[ hello world ]]
+
+[=[ hello world ]=]
+[====[ hello world ]====]
+
+"another world"
+
+'what world'
+
+
+"
+hello world
+"
+
+'yeah
+what is going on
+here is something cool'
+
+
+nil
+
diff --git a/spec/inputs/local.moon b/spec/inputs/local.moon
new file mode 100644
index 0000000..fec78b1
--- /dev/null
+++ b/spec/inputs/local.moon
@@ -0,0 +1,94 @@
+
+do
+  local a
+  local a,b,c
+
+  b,g = 23232
+
+
+do
+  x = 1212
+  something = ->
+    local x
+    x = 1212
+
+do
+  local *
+  y = 2323
+  z = 2323
+
+do
+  local *
+  print "Nothing Here!"
+
+do
+  local ^
+  x = 3434
+  y = 3434
+  X = 3434
+  Y = "yeah"
+
+do
+  local ^
+  x,y = "a", "b"
+
+do
+  local *
+  x,y = "a", "b"
+
+
+do
+  local *
+  if something
+    x = 2323
+
+do
+  local *
+  do
+    x = "one"
+
+  x = 100
+
+  do
+    x = "two"
+
+do
+  local *
+  k = if what
+    10
+  x = 100
+
+  {:a,:b, :c} = y
+
+
+do
+  local *
+
+  a = 100
+  print "hi"
+  b = 200
+
+  local *
+  c = 100
+  print "hi"
+  d = 200
+  d = 2323
+
+
+do
+  local ^
+  lowercase = 5
+  Uppercase = 3
+
+  class One
+    Five = 6
+
+  class Two
+    class No
+
+do
+  local *
+  -- this generates a nil value in the body
+  for a in *{} do a
+
+g = 2323 -- test if anything leaked
diff --git a/spec/inputs/loops.moon b/spec/inputs/loops.moon
new file mode 100644
index 0000000..a704e56
--- /dev/null
+++ b/spec/inputs/loops.moon
@@ -0,0 +1,133 @@
+
+for x=1,10
+  print "yeah"
+
+for x=1,#something
+  print "yeah"
+
+for y=100,60,-3
+  print "count down", y
+
+for a=1,10 do print "okay"
+
+for a=1,10
+  for b = 2,43
+    print a,b
+
+for i in iter
+  for j in yeah
+    x = 343 + i + j
+    print i, j
+
+for x in *something
+  print x
+
+for k,v in pairs hello do print k,v
+
+for x in y, z
+  print x
+
+for x in y, z, k
+  print x
+
+
+x = ->
+  for x in y
+    y
+
+hello = {1,2,3,4,5}
+
+x = for y in *hello
+  if y % 2 == 0
+    y
+
+x = ->
+  for x in *hello
+    y
+
+t = for i=10,20 do i * 2
+
+hmm = 0
+y = for j = 3,30, 8
+  hmm += 1
+  j * hmm
+
+->
+  for k=10,40
+    "okay"
+
+->
+  return for k=10,40
+    "okay"
+
+while true do print "name"
+
+while 5 + 5
+  print "okay world"
+  working man
+
+while also do
+  i work too
+  "okay"
+
+i = 0
+x = while i < 10
+  i += 1
+
+-- values that can'e be coerced
+
+x = for thing in *3
+  y = "hello"
+
+x = for x=1,2
+  y = "hello"
+
+
+-- continue
+
+while true
+  continue if false
+  print "yes"
+  break if true
+  print "no"
+
+
+for x=1,10
+  continue if x > 3 and x < 7
+  print x
+
+
+list = for x=1,10
+  continue if x > 3 and x < 7
+  x
+
+
+for a in *{1,2,3,4,5,6}
+  continue if a == 1
+  continue if a == 3
+  print a
+
+
+
+for x=1,10
+  continue if x % 2 == 0
+  for y = 2,12
+    continue if y % 3 == 0
+
+
+while true
+  continue if false
+  break
+
+while true
+  continue if false
+  return 22
+
+--
+
+do
+  xxx = {1,2,3,4}
+  for thing in *xxx
+    print thing
+
+
diff --git a/spec/inputs/operators.moon b/spec/inputs/operators.moon
new file mode 100644
index 0000000..142ef62
--- /dev/null
+++ b/spec/inputs/operators.moon
@@ -0,0 +1,72 @@
+
+-- binary ops
+x = 1 + 3
+
+y = 1 +
+  3
+
+z = 1 +
+  3 +
+  4
+
+--
+
+k = b and c and
+  g
+
+
+h = thing and
+  ->
+    print "hello world"
+
+-- TODO: should fail, indent still set to previous line so it thinks body is
+-- indented
+i = thing or
+  ->
+  print "hello world"
+
+p = thing and
+  ->
+print "hello world"
+
+s = thing or
+  -> and 234
+
+
+--
+u = {
+  color: 1 and 2 and
+    3
+    4
+  4
+}
+
+v = {
+  color: 1 and
+    ->
+      "yeah"
+    "great"
+  oksy: 3 ^
+2
+}
+
+-- parens
+
+nno = (
+  yeah + 2   )
+
+nn = (
+  yeah + 2
+)
+
+n = hello(
+  b
+) ->
+
+hello a,
+  (
+    yeah +
+      2
+  ) -
+    okay
+
diff --git a/spec/inputs/plus.moon b/spec/inputs/plus.moon
new file mode 100644
index 0000000..fdca8be
--- /dev/null
+++ b/spec/inputs/plus.moon
@@ -0,0 +1,7 @@
+
+func a\do!\end("OK")\if "abc",123
+
+res = b.function\do!\while("OK")\if "def",998
+
+c.repeat.if\then("xyz")\else res
+
diff --git a/spec/inputs/return.moon b/spec/inputs/return.moon
new file mode 100644
index 0000000..61d3dca
--- /dev/null
+++ b/spec/inputs/return.moon
@@ -0,0 +1,55 @@
+-- testing `return` propagation
+
+-> x for x in *things
+-> [x for x in *things]
+
+
+-- doesn't make sense on purpose
+do
+  return x for x in *things
+
+do
+  return [x for x in *things]
+
+do
+  return {x,y for x,y in *things}
+
+->
+  if a
+    if a
+      a
+    else
+      b
+  elseif b
+    if a
+      a
+    else
+      b
+  else
+    if a
+      a
+    else
+      b
+
+
+do
+  return if a
+    if a
+      a
+    else
+      b
+  elseif b
+    if a
+      a
+    else
+      b
+  else
+    if a
+      a
+    else
+      b
+
+-> a\b
+do a\b
+
+
diff --git a/spec/inputs/string.moon b/spec/inputs/string.moon
new file mode 100644
index 0000000..897056a
--- /dev/null
+++ b/spec/inputs/string.moon
@@ -0,0 +1,66 @@
+
+hi = "hello"
+hello = "what the heckyes"
+print hi
+
+umm = 'umm'
+
+here, another = "yeah", 'world'
+
+aye = "YU'M"
+you '"hmmm" I said'
+
+print aye, you
+
+another = [[ hello world ]]
+
+
+hi_there = [[
+  hi there
+]]
+
+well = [==[ "helo" ]==]
+
+hola = [===[
+  eat noots]===]
+
+mm = [[well trhere]]
+
+oo = ""
+
+x = "\\"
+x = "a\\b"
+x = "\\\n"
+x = "\""
+
+-- 
+
+a = "hello #{hello} hello"
+b = "#{hello} hello"
+c = "hello #{5+1}"
+d = "#{hello world}"
+e = "#{1} #{2} #{3}"
+
+f = [[hello #{world} world]]
+
+--
+
+a = 'hello #{hello} hello'
+b = '#{hello} hello'
+c = 'hello #{hello}'
+
+
+--
+
+"hello"
+"hello"\format 1
+"hello"\format(1,2,3)
+"hello"\format(1,2,3) 1,2,3
+
+"hello"\world!
+"hello"\format!.hello 1,2,3
+"hello"\format 1,2,3
+
+something"hello"\world!
+something "hello"\world!
+
diff --git a/spec/inputs/stub.moon b/spec/inputs/stub.moon
new file mode 100644
index 0000000..f8f6c3f
--- /dev/null
+++ b/spec/inputs/stub.moon
@@ -0,0 +1,16 @@
+
+
+x = {
+  val: 100
+  hello: =>
+    print @val
+}
+
+fn = x\val
+print fn!
+print x\val!
+
+
+-- ... should be bubbled up anon functions
+x = hello(...)\world
+
diff --git a/spec/inputs/switch.moon b/spec/inputs/switch.moon
new file mode 100644
index 0000000..3bc179b
--- /dev/null
+++ b/spec/inputs/switch.moon
@@ -0,0 +1,64 @@
+
+switch value
+  when "cool"
+    print "hello world"
+
+
+switch value
+  when "cool"
+    print "hello world"
+  else
+    print "okay rad"
+
+
+switch value
+  when "cool"
+    print "hello world"
+  when "yeah"
+    [[FFFF]] + [[MMMM]]
+  when 2323 + 32434
+    print "okay"
+  else
+    print "okay rad"
+
+out = switch value
+  when "cool" then print "hello world"
+  else print "okay rad"
+
+out = switch value
+  when "cool" then xxxx
+  when "umm" then 34340
+  else error "this failed big time"
+
+with something
+  switch \value!
+    when .okay
+      "world"
+    else
+      "yesh"
+
+fix this
+call_func switch something
+  when 1 then "yes"
+  else "no"
+
+--
+
+switch hi
+  when hello or world
+    greene
+
+--
+
+switch hi
+  when "one", "two"
+    print "cool"
+  when "dad"
+    no
+
+switch hi
+  when 3+1, hello!, (-> 4)!
+    yello
+  else
+    print "cool"
+
diff --git a/spec/inputs/syntax.moon b/spec/inputs/syntax.moon
new file mode 100644
index 0000000..854f629
--- /dev/null
+++ b/spec/inputs/syntax.moon
@@ -0,0 +1,272 @@
+#!/this/is/ignored
+
+a = 1 + 2* 3 / 6
+
+a, bunch, go, here = another, world
+
+func arg1, arg2, another, arg3
+
+here, we = () ->, yeah
+the, different = () -> approach; yeah
+
+dad()
+dad(lord)
+hello(one,two)()
+(5 + 5)(world)
+
+fun(a)(b)
+
+fun(a) b
+
+fun(a) b, bad hello
+
+hello world what are you doing here
+
+
+what(the)[3243] world, yeck heck
+
+hairy[hands][are](gross) okay okay[world]
+
+(get[something] + 5)[years]
+
+i,x  = 200, 300
+
+yeah = (1 + 5) * 3
+yeah = ((1+5)*3)/2
+yeah = ((1+5)*3)/2 + i % 100
+
+whoa = (1+2) * (3+4) * (4+5)
+
+->
+  if something
+    return 1,2,4
+
+  print "hello"
+
+->
+  if hello
+    "heloo", "world"
+  else
+    no, way
+
+
+-> 1,2,34
+
+return 5 + () -> 4 + 2
+
+return 5 + (() -> 4) + 2
+
+print 5 + () ->
+	34
+	good nads
+
+
+something 'else', "ya"
+
+something'else'
+something"else"
+
+something[[hey]] * 2
+something[======[hey]======] * 2
+
+
+something'else', 2
+something"else", 2
+something[[else]], 2
+
+something 'else', 2
+something "else", 2
+something [[else]], 2
+
+here(we)"go"[12123]
+
+-- this runs
+something =
+  test: 12323
+  what: -> print "hello world"
+
+print something.test
+
+frick = hello: "world"
+
+argon =
+  num: 100
+  world: (self) ->
+    print self.num
+    return {
+      something: -> print "hi from something"
+    }
+  somethin: (self, str) ->
+    print "string is", str
+    return world: (a,b) -> print "sum", a + b
+
+something.what()
+argon\world().something()
+
+argon\somethin"200".world(1,2)
+
+x = -434
+
+x = -hello world one two
+
+hi = -"herfef"
+
+x = -[x for x in x]
+
+print "hello" if cool
+print "hello" unless cool
+print "hello" unless 1212 and 3434 -- hello
+print "hello" for i=1,10
+
+print "nutjob"
+
+if hello then 343
+
+print "what" if cool else whack
+
+arg = {...}
+
+x = (...) ->
+  dump {...}
+
+
+x = not true
+
+y = not(5+5)
+
+
+y = #"hello"
+
+x = #{#{},#{1},#{1,2}}
+
+hello, world
+
+something\hello(what) a,b
+something\hello what
+something.hello\world a,b
+something.hello\world(1,2,3) a,b
+
+
+x = 1232
+x += 10 + 3
+j -= "hello"
+y *= 2
+y /= 100
+m %= 2
+hello ..= "world"
+
+@@something += 10
+@something += 10
+
+a["hello"] += 10
+a["hello#{tostring ff}"] += 10
+a[four].x += 10
+
+x = 0
+(if ntype(v) == "fndef" then x += 1) for v in *values
+
+
+hello =
+  something: world
+  if: "hello"
+  else: 3434
+  function: "okay"
+  good: 230203
+
+
+div class: "cool"
+
+5 + what wack
+what whack + 5
+
+5 - what wack
+what whack - 5
+
+x = hello - world - something
+
+((something = with what
+  \cool 100) ->
+  print something)!
+
+if something
+  03589
+
+-- okay what about this
+
+else
+  3434
+
+
+if something
+  yeah
+
+
+elseif "ymmm"
+
+  print "cool"
+
+else
+
+  okay
+
+
+-- test names containing keywords
+x = notsomething
+y = ifsomething
+z = x and b
+z = x andb
+
+
+-- undelimited tables
+
+while 10 > something
+  something: "world"
+    print "yeah"
+
+x =
+  okay: sure
+
+yeah
+  okay: man
+  sure: sir
+
+hello "no comma"
+ yeah: dada
+ another: world
+
+hello "comma",
+ something: hello_world
+ frick: you
+
+-- creates two tables
+another hello, one,
+  two, three, four, yeah: man
+  okay: yeah
+
+-- 
+a += 3 - 5
+a *= 3 + 5
+a *= 3
+a >>= 3
+a <<= 3
+a /= func "cool"
+
+---
+
+x.then = "hello"
+x.while.true = "hello"
+
+--
+
+x or= "hello"
+x and= "hello"
+
+--
+
+z = a-b
+z = a -b
+z = a - b
+z = a- b
+
+
+-- cooool
diff --git a/spec/inputs/tables.moon b/spec/inputs/tables.moon
new file mode 100644
index 0000000..2bf66d7
--- /dev/null
+++ b/spec/inputs/tables.moon
@@ -0,0 +1,161 @@
+
+backpack =
+  something:
+    yeah: 200
+    they: ->
+      print "hello"
+      yor_feet"small"
+    pretty: hair
+    gold: hmm
+  yow: 1000
+
+  eat: goo
+  yeah: dudd
+
+
+start =
+  something: "cold"
+
+bathe =
+  on: "fire"
+
+another =
+  [4]: 232
+  ["good food"]: "is the best"
+
+fwip =
+  something: hello"what", number: 2323,
+  what: yo "momma", "yeah",
+  fruit: basket
+  nuts: day
+
+
+frick = hello: "world"
+
+frack, best = hello: "world", rice: 3434, "what"
+
+ya = { 1,2,3, key: 100, 343, "hello", umm: 232 }
+
+
+x = { 1,2,
+  4343, 343 ,343 }
+
+
+g, p = {
+  1,2, nowy: "yes", 3,4,
+  hey: 232, another: "day"
+}, 234
+
+annother = {
+  1,2,3
+  3,4,5
+  6,7,8
+}
+
+yeah = {
+  [232]: 3434, "helo"
+  ice: "cake"
+}
+
+-- confusing stuff...
+whatabout = {
+  hello world, another
+  what, about, now
+
+  hello"world", yeah
+  hello "world", yeah
+}
+
+x =
+  -- yeah
+  something: => "hello"
+  cool: -- umm
+    --so ething
+    bed: {
+      2323,2323
+    }
+    red: 2343 -- here
+  -- what
+  name: (node) => @value node -- here
+  -- comment me
+-- okay
+
+
+x = { :something, something: something }
+
+y = {
+  :hi, :there, :how, :you
+  :thing
+}
+
+call_me "hello", :x, :y, :z
+
+t = {
+  a: 'a'
+  [b]: 'b'
+}
+
+xam = {
+  hello: 1234
+  "hello": 12354
+  ["hello"]: 12354
+}
+
+
+kam = {
+  hello: 12
+  goodcheese:
+    "mmm"
+
+  yeah:
+    12 + 232
+
+  lets:
+    keepit going: true,
+      okay: "yeah"
+
+  more:
+    {
+      1, [x for x=1,10]
+    }
+
+  [{"one", "two"}]:
+    one_thing =>
+}
+
+-- TODO: both of these have undesirable output
+keepit going: true,
+  okay: "yeah",
+  workd: "okay"
+
+thing what:
+  "great", no:
+    "more"
+          okay: 123
+
+
+-- 
+thing what:
+  "great", no:
+    "more"
+okay: 123 -- a anon table
+
+
+-- 
+
+k = { "hello": "world" }
+k = { 'hello': 'world' }
+k = { "hello": 'world', "hat": "zat" }
+
+please "hello": "world"
+k = "hello": "world", "one": "zone"
+
+f = "one", "two": three, "four"
+f = "two": three, "four"
+f = { "one", "two": three, "four" }
+
+
+j = "one", "two": three, "four": five, 6, 7
+
+
+nil
diff --git a/spec/inputs/unless_else.moon b/spec/inputs/unless_else.moon
new file mode 100644
index 0000000..fe96c0b
--- /dev/null
+++ b/spec/inputs/unless_else.moon
@@ -0,0 +1,5 @@
+if a
+  unless b
+    print "hi"
+  elseif c
+    print "not hi"
diff --git a/spec/inputs/using.moon b/spec/inputs/using.moon
new file mode 100644
index 0000000..55a16a7
--- /dev/null
+++ b/spec/inputs/using.moon
@@ -0,0 +1,21 @@
+
+hello = "hello"
+world = "world"
+
+(using nil) ->
+  hello = 3223
+
+(a using nil) ->
+  hello = 3223
+  a = 323
+
+(a,b,c using a,b,c) ->
+  a,b,c = 1,2,3
+  world = 12321
+
+(a,e,f using a,b,c, hello) ->
+  a,b,c = 1,2,3
+  hello = 12321
+  world = "yeah"
+
+
diff --git a/spec/inputs/whitespace.moon b/spec/inputs/whitespace.moon
new file mode 100644
index 0000000..4a2ff1f
--- /dev/null
+++ b/spec/inputs/whitespace.moon
@@ -0,0 +1,102 @@
+
+{
+  1, 2
+}
+
+{ 1, 2
+}
+
+{ 1, 2 }
+
+{1,2}
+
+{
+1,2
+
+}
+
+{ something 1,2,
+    4,5,6,
+  3,4,5
+}
+
+{
+  a 1,2,3,
+  4,5,6
+  1,2,3
+}
+
+
+{
+  b 1,2,3,
+    4,5,6
+  1,2,3,
+    1,2,3
+}
+
+{ 1,2,3 }
+
+{ c 1,2,3,
+}
+
+
+hello 1,2,3,4,
+  1,2,3,4,4,5
+
+x 1,
+  2, 3,
+  4, 5, 6
+
+
+hello 1,2,3,
+  world 4,5,6,
+    5,6,7,8
+
+hello 1,2,3,
+  world 4,5,6,
+    5,6,7,8,
+  9,9
+
+
+{
+  hello 1,2,
+  3,4,
+  5, 6
+}
+
+x = {
+  hello 1,2,3,4,
+    5,6,7
+  1,2,3,4
+}
+
+if hello 1,2,3,
+  world,
+  world
+    print "hello"
+
+if hello 1,2,3,
+    world,
+    world
+  print "hello"
+
+
+--
+
+a(
+  one, two, three
+)
+
+b(
+  one,
+  two,
+  three
+)
+
+
+c(one, two,
+  three, four)
+
+-- 
+
+nil
diff --git a/spec/inputs/with.moon b/spec/inputs/with.moon
new file mode 100644
index 0000000..ae3c8c0
--- /dev/null
+++ b/spec/inputs/with.moon
@@ -0,0 +1,118 @@
+
+do
+  a = ->
+    with something
+      print .hello
+      print hi
+      print "world"
+
+do
+  with leaf
+    .world!
+    .world 1,2,3
+
+    g = .what.is.this
+
+    .hi 1,2,3
+
+    \hi(1,2).world 2323
+
+    \hi "yeah", "man"
+    .world = 200
+
+do
+  zyzyzy = with something
+    .set_state "hello world"
+
+do
+  x = 5 + with Something!
+    \write "hello world"
+
+
+do
+  x = {
+    hello: with yeah
+      \okay!
+  }
+
+do
+  with foo
+    \prop"something".hello
+    .prop\send(one)
+    .prop\send one
+
+
+--
+
+do
+  with a, b -- b is lost
+    print .world
+
+  mod = with _M = {}
+    .Thing = "hi"
+
+  -- operate on a only
+  with a, b = something, pooh
+    print .world
+
+  x = with a, b = 1, 2
+    print a + b
+
+  print with a, b = 1, 2
+    print a + b
+
+  -- assignment lhs must be evaluated in the order they appear
+  p = with hello!.x, world!.y = 1, 2
+    print a + b
+
+--
+
+do
+  x = "hello"
+  with x
+    x\upper!
+
+do
+  with k = "jo"
+    print \upper!
+
+do
+  with a,b,c = "", "", ""
+    print \upper!
+
+do
+  a = "bunk"
+  with a,b,c = "", "", ""
+    print \upper!
+
+do
+  with j
+    print \upper!
+
+do
+  with k.j = "jo"
+    print \upper!
+
+do
+  with a
+    print .b
+    -- nested `with`s should change the scope correctly
+    with .c
+      print .d
+
+do
+  with a
+    -- nested `with`s with assignments should change the scope correctly
+    with .b = 2
+      print .c
+
+do
+  ->
+    with hi
+      return .a, .b
+
+
+do
+  with dad
+    .if "yes"
+    y = .end.of.function
-- 
cgit v1.2.3-55-g6feb