diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2017-09-24 20:20:27 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2017-09-24 20:20:27 -0700 |
| commit | af3274ca9237a08093009e87955e30ab5f473f12 (patch) | |
| tree | 46c249d6b42ac51111c7e198a10b8dad09b17923 /utils.moon | |
| parent | e4660b169c14d24c3ec373b197e8b9469d200d50 (diff) | |
massive overhaul, compiler kinda works.
Diffstat (limited to 'utils.moon')
| -rw-r--r-- | utils.moon | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -7,6 +7,10 @@ utils = { i += 1 return true + size: (t)-> + with n = 0 + for _ in pairs(t) do n += 1 + repr: (x)-> switch type(x) when 'table' @@ -18,7 +22,9 @@ utils = { else "{#{table.concat(["[#{utils.repr(k)}]= #{utils.repr(v)}" for k,v in pairs x], ", ")}}" when 'string' - if not x\find[["]] and not x\find"\n" and not x\find"\\" + if x == "\n" + return "'\\n'" + elseif not x\find[["]] and not x\find"\n" and not x\find"\\" "\""..x.."\"" elseif not x\find[[']] and not x\find"\n" and not x\find"\\" "\'"..x.."\'" |
