mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
Merge branch 'master' into patch-1
This commit is contained in:
commit
b972b0d538
8
Makefile
8
Makefile
@ -1,6 +1,6 @@
|
||||
LUA ?= lua5.1
|
||||
LUA_VERSION = $(shell $(LUA) -e 'print(_VERSION:match("%d%.%d"))')
|
||||
LUAROCKS = luarocks-$(LUA_VERSION)
|
||||
LUAROCKS = luarocks --lua-version=$(LUA_VERSION)
|
||||
LUA_PATH_MAKE = $(shell $(LUAROCKS) path --lr-path);./?.lua;./?/init.lua
|
||||
LUA_CPATH_MAKE = $(shell $(LUAROCKS) path --lr-cpath);./?.so
|
||||
|
||||
@ -25,12 +25,6 @@ compile:
|
||||
$(LUA) bin/moonc -p bin/moon.moon >> bin/moon
|
||||
echo "-- vim: set filetype=lua:" >> bin/moon
|
||||
|
||||
compile_system:
|
||||
moonc moon/ moonscript/
|
||||
echo "#!/usr/bin/env lua" > bin/moon
|
||||
moonc -p bin/moon.moon >> bin/moon
|
||||
echo "-- vim: set filetype=lua:" >> bin/moon
|
||||
|
||||
watch:
|
||||
moonc moon/ moonscript/ && moonc -w moon/ moonscript/
|
||||
|
||||
|
3
bin/moonc
Executable file → Normal file
3
bin/moonc
Executable file → Normal file
@ -6,9 +6,11 @@ local lfs = require "lfs"
|
||||
local parser = argparse()
|
||||
|
||||
parser:flag("-l --lint", "Perform a lint on the file instead of compiling")
|
||||
|
||||
parser:flag("-v --version", "Print version")
|
||||
parser:flag("-w --watch", "Watch file/directory for updates")
|
||||
parser:option("--transform", "Transform syntax tree with module")
|
||||
|
||||
parser:mutex(
|
||||
parser:option("-t --output-to", "Specify where to place compiled files"),
|
||||
parser:option("-o", "Write output to file"),
|
||||
@ -17,6 +19,7 @@ parser:mutex(
|
||||
parser:flag("-b", "Write parse and compile time instead of code(to stdout)"),
|
||||
parser:flag("-X", "Write line rewrite map instead of code (to stdout)")
|
||||
)
|
||||
|
||||
parser:flag("-",
|
||||
"Read from standard in, print to standard out (Must be only argument)")
|
||||
|
||||
|
@ -102,7 +102,11 @@ dump = function(what)
|
||||
lines = _accum_0
|
||||
end
|
||||
seen[what] = false
|
||||
return "{\n" .. concat(lines) .. (" "):rep((depth - 1) * 4) .. "}\n"
|
||||
local class_name
|
||||
if what.__class then
|
||||
class_name = "<" .. tostring(what.__class.__name) .. ">"
|
||||
end
|
||||
return tostring(class_name or "") .. "{\n" .. concat(lines) .. (" "):rep((depth - 1) * 4) .. "}\n"
|
||||
else
|
||||
return tostring(what) .. "\n"
|
||||
end
|
||||
|
@ -70,7 +70,10 @@ dump = (what) ->
|
||||
|
||||
seen[what] = false
|
||||
|
||||
"{\n" .. concat(lines) .. (" ")\rep((depth - 1)*4) .. "}\n"
|
||||
class_name = if what.__class
|
||||
"<#{what.__class.__name}>"
|
||||
|
||||
"#{class_name or ""}{\n" .. concat(lines) .. (" ")\rep((depth - 1)*4) .. "}\n"
|
||||
else
|
||||
tostring(what).."\n"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user