forked from leafo/moonscript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformat.lua
More file actions
55 lines (55 loc) · 1014 Bytes
/
Copy pathformat.lua
File metadata and controls
55 lines (55 loc) · 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
module("moonscript.compile", package.seeall)
local util = require("moonscript.util")
local data = require("moonscript.data")
local Set
do
local _table_0 = require("moonscript.data")
Set = _table_0.Set
end
local ntype
do
local _table_0 = require("moonscript.types")
ntype = _table_0.ntype
end
local concat, insert = table.concat, table.insert
indent_char = " "
user_error = function(...)
return error({
"user-error",
...
})
end
moonlib = {
bind = function(tbl, name)
return concat({
"moon.bind(",
tbl,
".",
name,
", ",
tbl,
")"
})
end
}
non_atomic = Set({
"update"
})
has_value = function(node)
if ntype(node) == "chain" then
local ctype = ntype(node[#node])
return ctype ~= "call" and ctype ~= "colon"
else
return true
end
end
is_non_atomic = function(node)
return non_atomic[ntype(node)]
end
count_lines = function(str)
local count = 1
for _ in str:gmatch("\n") do
count = count + 1
end
return count
end