mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 16:49:31 +00:00
Prefix type checkers with "is", stdlib cleanup
This commit is contained in:
parent
98917c2ca4
commit
7f71569e07
25 changed files with 163 additions and 160 deletions
|
|
@ -76,9 +76,9 @@ local function run(path, interactive)
|
|||
local state = anselme:new()
|
||||
state:load_stdlib()
|
||||
|
||||
state:define("interrupt", "(code::string)", function(state, code) state:interrupt(code:to_lua(state), "interrupt") return ast.Nil:new() end, true)
|
||||
state:define("interrupt", "(code::is string)", function(state, code) state:interrupt(code:to_lua(state), "interrupt") return ast.Nil:new() end, true)
|
||||
state:define("interrupt", "()", function(state) state:interrupt() return ast.Nil:new() end, true)
|
||||
state:define("wait", "(duration::number)", function(duration) coroutine.yield("wait", duration) end)
|
||||
state:define("wait", "(duration::is number)", function(duration) coroutine.yield("wait", duration) end)
|
||||
state:define("run in new branch", "(code)", function(code)
|
||||
local parallel_state = state:branch()
|
||||
write_output("--# parallel script #--")
|
||||
|
|
@ -87,7 +87,7 @@ local function run(path, interactive)
|
|||
write_output("--# main script #--")
|
||||
end)
|
||||
state:define("serialize", "(value)", function(state, value) return ast.String:new(value:serialize(state)) end, true)
|
||||
state:define("deserialize", "(str::string)", function(state, str) return ast.abstract.Node:deserialize(state, str.string) end, true)
|
||||
state:define("deserialize", "(str::is string)", function(state, str) return ast.abstract.Node:deserialize(state, str.string) end, true)
|
||||
|
||||
local run_state = state:branch()
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ end
|
|||
if not arg[1] or arg[1] == "update" then
|
||||
-- display an animated loading indicator
|
||||
local loading = {
|
||||
loop = { "⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷" },
|
||||
loop = { "⣷", "⣯", "⣟", "⡿", "⢿", "⣻", "⣽", "⣾" },
|
||||
loop_pos = 1,
|
||||
erase_code = "",
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue