mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 16:49:31 +00:00
Anselme v2.0.0-alpha rewrite
Woke up and felt like changing a couple things. It's actually been worked on for a while, little at a time... The goal was to make the language and implementation much simpler. Well I don't know if it really ended up being simpler but it sure is more robust. Main changes: * proper first class functions and closures supports! proper scoping rules! no more namespace shenanigans! * everything is an expression, no more statements! make the implementation both simpler and more complex, but it's much more consistent now! the syntax has massively changed as a result though. * much more organized and easy to modify codebase: one file for each AST node, no more random fields or behavior set by some random node exceptionally, everything should now follow the same API defined in ast.abstract.Node Every foundational feature should be implemented right now. The vast majority of things that were possible in v2 are possible now; some things aren't, but that's usually because v2 is a bit more sane. The main missing things before a proper release are tests and documentation. There's a few other things that might be implemented later, see the ideas.md file.
This commit is contained in:
parent
2ff494d108
commit
fe351b5ca4
484 changed files with 7099 additions and 18084 deletions
334
test/inspect.lua
334
test/inspect.lua
|
|
@ -1,334 +0,0 @@
|
|||
local inspect ={
|
||||
_VERSION = 'inspect.lua 3.1.0',
|
||||
_URL = 'http://github.com/kikito/inspect.lua',
|
||||
_DESCRIPTION = 'human-readable representations of tables',
|
||||
_LICENSE = [[
|
||||
MIT LICENSE
|
||||
|
||||
Copyright (c) 2013 Enrique García Cota
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
]]
|
||||
}
|
||||
|
||||
local tostring = tostring
|
||||
|
||||
inspect.KEY = setmetatable({}, {__tostring = function() return 'inspect.KEY' end})
|
||||
inspect.METATABLE = setmetatable({}, {__tostring = function() return 'inspect.METATABLE' end})
|
||||
|
||||
local function rawpairs(t)
|
||||
return next, t, nil
|
||||
end
|
||||
|
||||
-- Apostrophizes the string if it has quotes, but not aphostrophes
|
||||
-- Otherwise, it returns a regular quoted string
|
||||
local function smartQuote(str)
|
||||
if str:match('"') and not str:match("'") then
|
||||
return "'" .. str .. "'"
|
||||
end
|
||||
return '"' .. str:gsub('"', '\\"') .. '"'
|
||||
end
|
||||
|
||||
-- \a => '\\a', \0 => '\\0', 31 => '\31'
|
||||
local shortControlCharEscapes = {
|
||||
["\a"] = "\\a", ["\b"] = "\\b", ["\f"] = "\\f", ["\n"] = "\\n",
|
||||
["\r"] = "\\r", ["\t"] = "\\t", ["\v"] = "\\v"
|
||||
}
|
||||
local longControlCharEscapes = {} -- \a => nil, \0 => \000, 31 => \031
|
||||
for i=0, 31 do
|
||||
local ch = string.char(i)
|
||||
if not shortControlCharEscapes[ch] then
|
||||
shortControlCharEscapes[ch] = "\\"..i
|
||||
longControlCharEscapes[ch] = string.format("\\%03d", i)
|
||||
end
|
||||
end
|
||||
|
||||
local function escape(str)
|
||||
return (str:gsub("\\", "\\\\")
|
||||
:gsub("(%c)%f[0-9]", longControlCharEscapes)
|
||||
:gsub("%c", shortControlCharEscapes))
|
||||
end
|
||||
|
||||
local function isIdentifier(str)
|
||||
return type(str) == 'string' and str:match( "^[_%a][_%a%d]*$" )
|
||||
end
|
||||
|
||||
local function isSequenceKey(k, sequenceLength)
|
||||
return type(k) == 'number'
|
||||
and 1 <= k
|
||||
and k <= sequenceLength
|
||||
and math.floor(k) == k
|
||||
end
|
||||
|
||||
local defaultTypeOrders = {
|
||||
['number'] = 1, ['boolean'] = 2, ['string'] = 3, ['table'] = 4,
|
||||
['function'] = 5, ['userdata'] = 6, ['thread'] = 7
|
||||
}
|
||||
|
||||
local function sortKeys(a, b)
|
||||
local ta, tb = type(a), type(b)
|
||||
|
||||
-- strings and numbers are sorted numerically/alphabetically
|
||||
if ta == tb and (ta == 'string' or ta == 'number') then return a < b end
|
||||
|
||||
local dta, dtb = defaultTypeOrders[ta], defaultTypeOrders[tb]
|
||||
-- Two default types are compared according to the defaultTypeOrders table
|
||||
if dta and dtb then return defaultTypeOrders[ta] < defaultTypeOrders[tb]
|
||||
elseif dta then return true -- default types before custom ones
|
||||
elseif dtb then return false -- custom types after default ones
|
||||
end
|
||||
|
||||
-- custom types are sorted out alphabetically
|
||||
return ta < tb
|
||||
end
|
||||
|
||||
-- For implementation reasons, the behavior of rawlen & # is "undefined" when
|
||||
-- tables aren't pure sequences. So we implement our own # operator.
|
||||
local function getSequenceLength(t)
|
||||
local len = 1
|
||||
local v = rawget(t,len)
|
||||
while v ~= nil do
|
||||
len = len + 1
|
||||
v = rawget(t,len)
|
||||
end
|
||||
return len - 1
|
||||
end
|
||||
|
||||
local function getNonSequentialKeys(t)
|
||||
local keys, keysLength = {}, 0
|
||||
local sequenceLength = getSequenceLength(t)
|
||||
for k,_ in rawpairs(t) do
|
||||
if not isSequenceKey(k, sequenceLength) then
|
||||
keysLength = keysLength + 1
|
||||
keys[keysLength] = k
|
||||
end
|
||||
end
|
||||
table.sort(keys, sortKeys)
|
||||
return keys, keysLength, sequenceLength
|
||||
end
|
||||
|
||||
local function countTableAppearances(t, tableAppearances)
|
||||
tableAppearances = tableAppearances or {}
|
||||
|
||||
if type(t) == 'table' then
|
||||
if not tableAppearances[t] then
|
||||
tableAppearances[t] = 1
|
||||
for k,v in rawpairs(t) do
|
||||
countTableAppearances(k, tableAppearances)
|
||||
countTableAppearances(v, tableAppearances)
|
||||
end
|
||||
countTableAppearances(getmetatable(t), tableAppearances)
|
||||
else
|
||||
tableAppearances[t] = tableAppearances[t] + 1
|
||||
end
|
||||
end
|
||||
|
||||
return tableAppearances
|
||||
end
|
||||
|
||||
local copySequence = function(s)
|
||||
local copy, len = {}, #s
|
||||
for i=1, len do copy[i] = s[i] end
|
||||
return copy, len
|
||||
end
|
||||
|
||||
local function makePath(path, ...)
|
||||
local keys = {...}
|
||||
local newPath, len = copySequence(path)
|
||||
for i=1, #keys do
|
||||
newPath[len + i] = keys[i]
|
||||
end
|
||||
return newPath
|
||||
end
|
||||
|
||||
local function processRecursive(process, item, path, visited)
|
||||
if item == nil then return nil end
|
||||
if visited[item] then return visited[item] end
|
||||
|
||||
local processed = process(item, path)
|
||||
if type(processed) == 'table' then
|
||||
local processedCopy = {}
|
||||
visited[item] = processedCopy
|
||||
local processedKey
|
||||
|
||||
for k,v in rawpairs(processed) do
|
||||
processedKey = processRecursive(process, k, makePath(path, k, inspect.KEY), visited)
|
||||
if processedKey ~= nil then
|
||||
processedCopy[processedKey] = processRecursive(process, v, makePath(path, processedKey), visited)
|
||||
end
|
||||
end
|
||||
|
||||
local mt = processRecursive(process, getmetatable(processed), makePath(path, inspect.METATABLE), visited)
|
||||
if type(mt) ~= 'table' then mt = nil end -- ignore not nil/table __metatable field
|
||||
setmetatable(processedCopy, mt)
|
||||
processed = processedCopy
|
||||
end
|
||||
return processed
|
||||
end
|
||||
|
||||
|
||||
|
||||
-------------------------------------------------------------------
|
||||
|
||||
local Inspector = {}
|
||||
local Inspector_mt = {__index = Inspector}
|
||||
|
||||
function Inspector:puts(...)
|
||||
local args = {...}
|
||||
local buffer = self.buffer
|
||||
local len = #buffer
|
||||
for i=1, #args do
|
||||
len = len + 1
|
||||
buffer[len] = args[i]
|
||||
end
|
||||
end
|
||||
|
||||
function Inspector:down(f)
|
||||
self.level = self.level + 1
|
||||
f()
|
||||
self.level = self.level - 1
|
||||
end
|
||||
|
||||
function Inspector:tabify()
|
||||
self:puts(self.newline, string.rep(self.indent, self.level))
|
||||
end
|
||||
|
||||
function Inspector:alreadyVisited(v)
|
||||
return self.ids[v] ~= nil
|
||||
end
|
||||
|
||||
function Inspector:getId(v)
|
||||
local id = self.ids[v]
|
||||
if not id then
|
||||
local tv = type(v)
|
||||
id = (self.maxIds[tv] or 0) + 1
|
||||
self.maxIds[tv] = id
|
||||
self.ids[v] = id
|
||||
end
|
||||
return tostring(id)
|
||||
end
|
||||
|
||||
function Inspector:putKey(k)
|
||||
if isIdentifier(k) then return self:puts(k) end
|
||||
self:puts("[")
|
||||
self:putValue(k)
|
||||
self:puts("]")
|
||||
end
|
||||
|
||||
function Inspector:putTable(t)
|
||||
if t == inspect.KEY or t == inspect.METATABLE then
|
||||
self:puts(tostring(t))
|
||||
elseif self:alreadyVisited(t) then
|
||||
self:puts('<table ', self:getId(t), '>')
|
||||
elseif self.level >= self.depth then
|
||||
self:puts('{...}')
|
||||
else
|
||||
if self.tableAppearances[t] > 1 then self:puts('<', self:getId(t), '>') end
|
||||
|
||||
local nonSequentialKeys, nonSequentialKeysLength, sequenceLength = getNonSequentialKeys(t)
|
||||
local mt = getmetatable(t)
|
||||
|
||||
self:puts('{')
|
||||
self:down(function()
|
||||
local count = 0
|
||||
for i=1, sequenceLength do
|
||||
if count > 0 then self:puts(',') end
|
||||
self:puts(' ')
|
||||
self:putValue(t[i])
|
||||
count = count + 1
|
||||
end
|
||||
|
||||
for i=1, nonSequentialKeysLength do
|
||||
local k = nonSequentialKeys[i]
|
||||
if count > 0 then self:puts(',') end
|
||||
self:tabify()
|
||||
self:putKey(k)
|
||||
self:puts(' = ')
|
||||
self:putValue(t[k])
|
||||
count = count + 1
|
||||
end
|
||||
|
||||
if type(mt) == 'table' then
|
||||
if count > 0 then self:puts(',') end
|
||||
self:tabify()
|
||||
self:puts('<metatable> = ')
|
||||
self:putValue(mt)
|
||||
end
|
||||
end)
|
||||
|
||||
if nonSequentialKeysLength > 0 or type(mt) == 'table' then -- result is multi-lined. Justify closing }
|
||||
self:tabify()
|
||||
elseif sequenceLength > 0 then -- array tables have one extra space before closing }
|
||||
self:puts(' ')
|
||||
end
|
||||
|
||||
self:puts('}')
|
||||
end
|
||||
end
|
||||
|
||||
function Inspector:putValue(v)
|
||||
local tv = type(v)
|
||||
|
||||
if tv == 'string' then
|
||||
self:puts(smartQuote(escape(v)))
|
||||
elseif tv == 'number' or tv == 'boolean' or tv == 'nil' or
|
||||
tv == 'cdata' or tv == 'ctype' then
|
||||
self:puts(tostring(v))
|
||||
elseif tv == 'table' then
|
||||
self:putTable(v)
|
||||
else
|
||||
self:puts('<', tv, ' ', self:getId(v), '>')
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------
|
||||
|
||||
function inspect.inspect(root, options)
|
||||
options = options or {}
|
||||
|
||||
local depth = options.depth or math.huge
|
||||
local newline = options.newline or '\n'
|
||||
local indent = options.indent or ' '
|
||||
local process = options.process
|
||||
|
||||
if process then
|
||||
root = processRecursive(process, root, {}, {})
|
||||
end
|
||||
|
||||
local inspector = setmetatable({
|
||||
depth = depth,
|
||||
level = 0,
|
||||
buffer = {},
|
||||
ids = {},
|
||||
maxIds = {},
|
||||
newline = newline,
|
||||
indent = indent,
|
||||
tableAppearances = countTableAppearances(root)
|
||||
}, Inspector_mt)
|
||||
|
||||
inspector:putValue(root)
|
||||
|
||||
return table.concat(inspector.buffer)
|
||||
end
|
||||
|
||||
setmetatable(inspect, { __call = function(_, ...) return inspect.inspect(...) end })
|
||||
|
||||
return inspect
|
||||
|
||||
278
test/run.lua
278
test/run.lua
|
|
@ -1,278 +0,0 @@
|
|||
local lfs = require("lfs")
|
||||
local anselme = require("anselme")
|
||||
local ser = require("test.ser")
|
||||
local inspect = require("test.inspect")
|
||||
|
||||
local function format_text(t)
|
||||
local r = ""
|
||||
for _, l in ipairs(t) do
|
||||
-- format tags display
|
||||
local tags = ""
|
||||
for k, v in pairs(l.tags) do
|
||||
tags = tags .. ("[%q]=%q"):format(k, v)
|
||||
end
|
||||
-- build text
|
||||
if tags ~= "" then
|
||||
r = r .. ("[%s]%s"):format(tags, l.text)
|
||||
else
|
||||
r = r .. l.text
|
||||
end
|
||||
end
|
||||
return r
|
||||
end
|
||||
|
||||
local function compare(a, b)
|
||||
if type(a) == "table" and type(b) == "table" then
|
||||
for k, v in pairs(a) do
|
||||
if not compare(v, b[k]) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
for k, v in pairs(b) do
|
||||
if not compare(v, a[k]) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
else
|
||||
return a == b
|
||||
end
|
||||
end
|
||||
|
||||
local function write_result(filebase, result)
|
||||
local o = assert(io.open(filebase..".lua", "w"))
|
||||
o:write(ser(result))
|
||||
o:write("\n--[[\n")
|
||||
for _, v in ipairs(result) do
|
||||
o:write(inspect(v):gsub("]]", "] ]").."\n") -- professional-level bandaid when ]] appear in the output
|
||||
end
|
||||
o:write("]]--")
|
||||
o:close()
|
||||
end
|
||||
|
||||
-- parse args
|
||||
local args = {}
|
||||
local i=1
|
||||
while i <= #arg do
|
||||
if arg[i+1] and not arg[i+1]:match("^%-%-") then
|
||||
args[arg[i]:gsub("^%-%-", "")] = arg[i+1]
|
||||
i = i + 2
|
||||
else
|
||||
args[arg[i]:gsub("^%-%-", "")] = true
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
|
||||
if args.help then
|
||||
print("Anselme test runner. Usage:")
|
||||
print(" no arguments: perform included test suite")
|
||||
print(" --script filename: test a script interactively")
|
||||
print(" --game directory: test a game interactively")
|
||||
print(" --help: display this message")
|
||||
print("")
|
||||
print("For test suite mode:")
|
||||
print(" --filter pattern: only perform tests matching pattern")
|
||||
print(" --write-all: rewrite all expected test results with current output")
|
||||
print(" --write-new: write expected test results with current output for test that do not already have a saved expected output")
|
||||
print(" --write-error: rewrite expected test results with current output for test with invalid output")
|
||||
print(" --silent: silent output")
|
||||
print("")
|
||||
print("For script or game mode:")
|
||||
print(" --lang code: load a language file")
|
||||
print(" --save: print save data at the end of the script")
|
||||
os.exit()
|
||||
end
|
||||
|
||||
-- test script
|
||||
if args.script or args.game then
|
||||
local vm = anselme()
|
||||
if args.lang then
|
||||
assert(vm:loadlanguage(args.lang))
|
||||
end
|
||||
local state, err
|
||||
if args.script then
|
||||
state, err = vm:loadfile(args.script, "script")
|
||||
else
|
||||
state, err = vm:loadgame(args.game)
|
||||
end
|
||||
if state then
|
||||
local istate, e
|
||||
if args.script then
|
||||
istate, e = vm:run("script")
|
||||
elseif args.game then
|
||||
istate, e = vm:rungame()
|
||||
end
|
||||
if not istate then
|
||||
print("error", e)
|
||||
else
|
||||
repeat
|
||||
local t, d = istate:step()
|
||||
if t == "text" then
|
||||
print(format_text(d))
|
||||
elseif t == "choice" then
|
||||
for j, choice in ipairs(d) do
|
||||
print(j.."> "..format_text(choice))
|
||||
end
|
||||
istate:choose(io.read())
|
||||
elseif t == "error" then
|
||||
print(t, d)
|
||||
else
|
||||
print(t, inspect(d))
|
||||
end
|
||||
until t == "return" or t == "error"
|
||||
end
|
||||
else
|
||||
print("error", err)
|
||||
end
|
||||
if args.save then
|
||||
local s, e = vm:save()
|
||||
if s then
|
||||
print(inspect(s))
|
||||
else
|
||||
print(("Error while saving: %s"):format(e))
|
||||
end
|
||||
end
|
||||
|
||||
-- test mode
|
||||
else
|
||||
-- list tests
|
||||
local files = {}
|
||||
for item in lfs.dir("test/tests/") do
|
||||
if item:match("%.ans$") and item:match(args.filter or "") then
|
||||
table.insert(files, "test/tests/"..item)
|
||||
end
|
||||
end
|
||||
table.sort(files)
|
||||
|
||||
-- run tests
|
||||
local total, success = #files, 0
|
||||
for _, file in ipairs(files) do
|
||||
local filebase = file:match("^(.*)%.ans$")
|
||||
local namespace = filebase:match("([^/]*)$")
|
||||
-- simple random to get the same result across lua versions
|
||||
local prev = 0
|
||||
local function badrandom(a, b)
|
||||
prev = (4241 * prev + 11) % 6997
|
||||
return a + prev % (b-a+1)
|
||||
end
|
||||
function math.random(a, b)
|
||||
if not a and not b then
|
||||
return badrandom(0, 999) / 1000
|
||||
elseif not b then
|
||||
return badrandom(1, a)
|
||||
else
|
||||
return badrandom(a, b)
|
||||
end
|
||||
end
|
||||
-- load vm
|
||||
local vm = anselme()
|
||||
vm:setaliases("seen", "checkpoint", "reached")
|
||||
vm:loadfunction {
|
||||
-- custom event test
|
||||
["wait(time::number)"] = {
|
||||
value = function(duration)
|
||||
coroutine.yield("wait", duration)
|
||||
end
|
||||
},
|
||||
-- run another function in parallel
|
||||
["run(name::string)"] = {
|
||||
value = function(str)
|
||||
local istate, e = anselme.running.vm:run(str, anselme.running:current_namespace())
|
||||
if not istate then coroutine.yield("error", e) end
|
||||
local event, data = istate:step()
|
||||
coroutine.yield(event, data)
|
||||
end
|
||||
},
|
||||
-- manual choice
|
||||
["choose(choice::number)"] = {
|
||||
value = function(c)
|
||||
anselme.running:choose(c)
|
||||
end
|
||||
},
|
||||
-- manual interrupt
|
||||
["interrupt(name::string)"] = {
|
||||
value = function(str)
|
||||
anselme.running:interrupt(str)
|
||||
coroutine.yield("wait", 0)
|
||||
end
|
||||
},
|
||||
["interrupt()"] = {
|
||||
value = function()
|
||||
anselme.running:interrupt()
|
||||
coroutine.yield("wait", 0)
|
||||
end
|
||||
}
|
||||
}
|
||||
local state, err = vm:loadfile(file, namespace)
|
||||
|
||||
local result = {}
|
||||
if state then
|
||||
local istate, e = vm:run(namespace)
|
||||
if not istate then
|
||||
table.insert(result, { "error", e })
|
||||
else
|
||||
repeat
|
||||
local t, d = istate:step()
|
||||
table.insert(result, { t, d })
|
||||
until t == "return" or t == "error"
|
||||
|
||||
local postrun = vm:eval(namespace..".post run")
|
||||
if postrun then
|
||||
istate, e = vm:run(namespace.."."..postrun)
|
||||
if not istate then
|
||||
table.insert(result, { "error", e })
|
||||
else
|
||||
repeat
|
||||
local t, d = istate:step()
|
||||
table.insert(result, { t, d })
|
||||
until t == "return" or t == "error"
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
table.insert(result, { "error", err })
|
||||
end
|
||||
|
||||
if args["write-all"] then
|
||||
write_result(filebase, result)
|
||||
else
|
||||
local o, e = loadfile(filebase..".lua")
|
||||
if o then
|
||||
local output = o()
|
||||
if not compare(result, output) then
|
||||
if not args.silent then
|
||||
print("> "..namespace)
|
||||
print(inspect(result))
|
||||
print("is not equal to")
|
||||
print(inspect(output))
|
||||
print("")
|
||||
end
|
||||
if args["write-error"] then
|
||||
write_result(filebase, result)
|
||||
print("Rewritten result file for "..filebase)
|
||||
success = success + 1
|
||||
end
|
||||
else
|
||||
success = success + 1
|
||||
end
|
||||
else
|
||||
if args["write-new"] and e:match("No such file") then
|
||||
write_result(filebase, result)
|
||||
print("Written result file for "..filebase)
|
||||
success = success + 1
|
||||
elseif not args.silent then
|
||||
print("> "..namespace)
|
||||
print(e)
|
||||
print("result was:")
|
||||
print(inspect(result))
|
||||
print("")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if args["write-all"] then
|
||||
print("Wrote test results.")
|
||||
else
|
||||
print(("%s/%s tests passed."):format(success, total))
|
||||
end
|
||||
end
|
||||
143
test/ser.lua
143
test/ser.lua
|
|
@ -1,143 +0,0 @@
|
|||
--[[
|
||||
Copyright (c) 2011,2013 Robin Wellner
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
]]
|
||||
|
||||
local pairs, ipairs, tostring, type, concat, dump, floor, format = pairs, ipairs, tostring, type, table.concat, string.dump, math.floor, string.format
|
||||
|
||||
local function getchr(c)
|
||||
return "\\" .. c:byte()
|
||||
end
|
||||
|
||||
local function make_safe(text)
|
||||
return ("%q"):format(text):gsub('\n', 'n'):gsub("[\128-\255]", getchr)
|
||||
end
|
||||
|
||||
local oddvals = {[tostring(1/0)] = '1/0', [tostring(-1/0)] = '-1/0', [tostring(-(0/0))] = '-(0/0)', [tostring(0/0)] = '0/0'}
|
||||
local function write(t, memo, rev_memo)
|
||||
local ty = type(t)
|
||||
if ty == 'number' then
|
||||
t = format("%.17g", t)
|
||||
return oddvals[t] or t
|
||||
elseif ty == 'boolean' or ty == 'nil' then
|
||||
return tostring(t)
|
||||
elseif ty == 'string' then
|
||||
return make_safe(t)
|
||||
elseif ty == 'table' or ty == 'function' then
|
||||
if not memo[t] then
|
||||
local index = #rev_memo + 1
|
||||
memo[t] = index
|
||||
rev_memo[index] = t
|
||||
end
|
||||
return '_[' .. memo[t] .. ']'
|
||||
else
|
||||
error("Trying to serialize unsupported type " .. ty)
|
||||
end
|
||||
end
|
||||
|
||||
local kw = {['and'] = true, ['break'] = true, ['do'] = true, ['else'] = true,
|
||||
['elseif'] = true, ['end'] = true, ['false'] = true, ['for'] = true,
|
||||
['function'] = true, ['goto'] = true, ['if'] = true, ['in'] = true,
|
||||
['local'] = true, ['nil'] = true, ['not'] = true, ['or'] = true,
|
||||
['repeat'] = true, ['return'] = true, ['then'] = true, ['true'] = true,
|
||||
['until'] = true, ['while'] = true}
|
||||
local function write_key_value_pair(k, v, memo, rev_memo, name)
|
||||
if type(k) == 'string' and k:match '^[_%a][_%w]*$' and not kw[k] then
|
||||
return (name and name .. '.' or '') .. k ..'=' .. write(v, memo, rev_memo)
|
||||
else
|
||||
return (name or '') .. '[' .. write(k, memo, rev_memo) .. ']=' .. write(v, memo, rev_memo)
|
||||
end
|
||||
end
|
||||
|
||||
-- fun fact: this function is not perfect
|
||||
-- it has a few false positives sometimes
|
||||
-- but no false negatives, so that's good
|
||||
local function is_cyclic(memo, sub, super)
|
||||
local m = memo[sub]
|
||||
local p = memo[super]
|
||||
return m and p and m < p
|
||||
end
|
||||
|
||||
local function write_table_ex(t, memo, rev_memo, srefs, name)
|
||||
if type(t) == 'function' then
|
||||
return '_[' .. name .. ']=loadstring' .. make_safe(dump(t))
|
||||
end
|
||||
local m = {}
|
||||
local mi = 1
|
||||
for i = 1, #t do -- don't use ipairs here, we need the gaps
|
||||
local v = t[i]
|
||||
if v == t or is_cyclic(memo, v, t) then
|
||||
srefs[#srefs + 1] = {name, i, v}
|
||||
m[mi] = 'nil'
|
||||
mi = mi + 1
|
||||
else
|
||||
m[mi] = write(v, memo, rev_memo)
|
||||
mi = mi + 1
|
||||
end
|
||||
end
|
||||
for k,v in pairs(t) do
|
||||
if type(k) ~= 'number' or floor(k) ~= k or k < 1 or k > #t then
|
||||
if v == t or k == t or is_cyclic(memo, v, t) or is_cyclic(memo, k, t) then
|
||||
srefs[#srefs + 1] = {name, k, v}
|
||||
else
|
||||
m[mi] = write_key_value_pair(k, v, memo, rev_memo)
|
||||
mi = mi + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
return '_[' .. name .. ']={' .. concat(m, ',') .. '}'
|
||||
end
|
||||
|
||||
return function(t)
|
||||
local memo = {[t] = 0}
|
||||
local rev_memo = {[0] = t}
|
||||
local srefs = {}
|
||||
local result = {}
|
||||
|
||||
-- phase 1: recursively descend the table structure
|
||||
local n = 0
|
||||
while rev_memo[n] do
|
||||
result[n + 1] = write_table_ex(rev_memo[n], memo, rev_memo, srefs, n)
|
||||
n = n + 1
|
||||
end
|
||||
|
||||
-- phase 2: reverse order
|
||||
for i = 1, n*.5 do
|
||||
local j = n - i + 1
|
||||
result[i], result[j] = result[j], result[i]
|
||||
end
|
||||
|
||||
-- phase 3: add all the tricky cyclic stuff
|
||||
for i, v in ipairs(srefs) do
|
||||
n = n + 1
|
||||
result[n] = write_key_value_pair(v[2], v[3], memo, rev_memo, '_[' .. v[1] .. ']')
|
||||
end
|
||||
|
||||
-- phase 4: add something about returning the main table
|
||||
if result[n]:sub(1, 5) == '_[0]=' then
|
||||
result[n] = 'return ' .. result[n]:sub(6)
|
||||
else
|
||||
result[n + 1] = 'return _[0]'
|
||||
end
|
||||
|
||||
-- phase 5: just concatenate everything
|
||||
result = concat(result, '\n')
|
||||
return n > 1 and 'local _={}\n' .. result or result
|
||||
end
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
:f = $(x)x*x
|
||||
|
||||
:$g(x)
|
||||
@x*x
|
||||
|
||||
{f(5)} = {g(5)}
|
||||
|
||||
{f(2)} = {g(2)}
|
||||
|
||||
:y = 5
|
||||
:h = $(x)x*x+y
|
||||
|
||||
{h(3)} == 14
|
||||
|
||||
~ y := 7
|
||||
|
||||
{h(5)} == 32
|
||||
|
||||
:i = $y*y
|
||||
|
||||
{i} == 49
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
local _={}
|
||||
_[35]={}
|
||||
_[34]={}
|
||||
_[33]={}
|
||||
_[32]={}
|
||||
_[31]={}
|
||||
_[30]={}
|
||||
_[29]={}
|
||||
_[28]={}
|
||||
_[27]={}
|
||||
_[26]={}
|
||||
_[25]={}
|
||||
_[24]={}
|
||||
_[23]={tags=_[35],text=" == 49"}
|
||||
_[22]={tags=_[34],text="49"}
|
||||
_[21]={tags=_[33],text=" == 32"}
|
||||
_[20]={tags=_[32],text="32"}
|
||||
_[19]={tags=_[31],text=" == 14"}
|
||||
_[18]={tags=_[30],text="14"}
|
||||
_[17]={tags=_[29],text="4"}
|
||||
_[16]={tags=_[28],text=" = "}
|
||||
_[15]={tags=_[27],text="4"}
|
||||
_[14]={tags=_[26],text="25"}
|
||||
_[13]={tags=_[25],text=" = "}
|
||||
_[12]={tags=_[24],text="25"}
|
||||
_[11]={_[22],_[23]}
|
||||
_[10]={_[20],_[21]}
|
||||
_[9]={_[18],_[19]}
|
||||
_[8]={_[15],_[16],_[17]}
|
||||
_[7]={_[12],_[13],_[14]}
|
||||
_[6]={"return"}
|
||||
_[5]={"text",_[11]}
|
||||
_[4]={"text",_[10]}
|
||||
_[3]={"text",_[9]}
|
||||
_[2]={"text",_[8]}
|
||||
_[1]={"text",_[7]}
|
||||
return {_[1],_[2],_[3],_[4],_[5],_[6]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "25"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "25"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "4"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "4"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "14"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " == 14"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "32"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " == 32"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "49"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " == 49"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
:$ f(str: foo)
|
||||
@str + foo
|
||||
|
||||
{f("bi")} = {f(foo="bi")}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
local _={}
|
||||
_[7]={}
|
||||
_[6]={tags=_[7],text="bibi"}
|
||||
_[5]={tags=_[7],text=" = "}
|
||||
_[4]={tags=_[7],text="bibi"}
|
||||
_[3]={_[4],_[5],_[6]}
|
||||
_[2]={"return"}
|
||||
_[1]={"text",_[3]}
|
||||
return {_[1],_[2]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "bibi"
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = " = "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "bibi"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
:$ _-_(a, b)
|
||||
@"generic minus"
|
||||
|
||||
:$ _-_(a::string, b::string)
|
||||
@a + " minus " + b
|
||||
|
||||
{2-5}
|
||||
|
||||
{"heh"-"lol"}
|
||||
|
||||
{[]-[]}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
local _={}
|
||||
_[13]={}
|
||||
_[12]={}
|
||||
_[11]={}
|
||||
_[10]={tags=_[13],text="generic minus"}
|
||||
_[9]={tags=_[12],text="heh minus lol"}
|
||||
_[8]={tags=_[11],text="-3"}
|
||||
_[7]={_[10]}
|
||||
_[6]={_[9]}
|
||||
_[5]={_[8]}
|
||||
_[4]={"return"}
|
||||
_[3]={"text",_[7]}
|
||||
_[2]={"text",_[6]}
|
||||
_[1]={"text",_[5]}
|
||||
return {_[1],_[2],_[3],_[4]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "-3"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "heh minus lol"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "generic minus"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
:c = 1
|
||||
|
||||
{c}
|
||||
|
||||
~ c += 2
|
||||
|
||||
{c}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
local _={}
|
||||
_[9]={}
|
||||
_[8]={}
|
||||
_[7]={tags=_[9],text="3"}
|
||||
_[6]={tags=_[8],text="1"}
|
||||
_[5]={_[7]}
|
||||
_[4]={_[6]}
|
||||
_[3]={"return"}
|
||||
_[2]={"text",_[5]}
|
||||
_[1]={"text",_[4]}
|
||||
return {_[1],_[2],_[3]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "1"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "3"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
:$ f
|
||||
x
|
||||
:! p
|
||||
a
|
||||
|
||||
:! q
|
||||
b
|
||||
|
||||
c
|
||||
|
||||
d
|
||||
|
||||
From start:
|
||||
~ f
|
||||
|
||||
From p checkpoint:
|
||||
~ f
|
||||
|
||||
From q checkpoint:
|
||||
~ f
|
||||
|
||||
From q checkpoint again:
|
||||
~ f
|
||||
|
||||
Force p checkpoint:
|
||||
~ f.p()
|
||||
|
||||
From q again:
|
||||
~ f
|
||||
|
||||
Go to p again by setting checkpoint manually:
|
||||
~ f.checkpoint := &f.p
|
||||
~ f
|
||||
|
|
@ -1,193 +0,0 @@
|
|||
local _={}
|
||||
_[91]={}
|
||||
_[90]={}
|
||||
_[89]={}
|
||||
_[88]={}
|
||||
_[87]={}
|
||||
_[86]={}
|
||||
_[85]={}
|
||||
_[84]={}
|
||||
_[83]={}
|
||||
_[82]={}
|
||||
_[81]={}
|
||||
_[80]={}
|
||||
_[79]={}
|
||||
_[78]={}
|
||||
_[77]={}
|
||||
_[76]={}
|
||||
_[75]={}
|
||||
_[74]={}
|
||||
_[73]={}
|
||||
_[72]={}
|
||||
_[71]={}
|
||||
_[70]={}
|
||||
_[69]={}
|
||||
_[68]={}
|
||||
_[67]={}
|
||||
_[66]={}
|
||||
_[65]={tags=_[91],text="d"}
|
||||
_[64]={tags=_[90],text="c"}
|
||||
_[63]={tags=_[89],text="a"}
|
||||
_[62]={tags=_[88],text="Go to p again by setting checkpoint manually:"}
|
||||
_[61]={tags=_[87],text="d"}
|
||||
_[60]={tags=_[86],text="c"}
|
||||
_[59]={tags=_[85],text="b"}
|
||||
_[58]={tags=_[84],text="From q again:"}
|
||||
_[57]={tags=_[83],text="c"}
|
||||
_[56]={tags=_[82],text="a"}
|
||||
_[55]={tags=_[81],text="Force p checkpoint:"}
|
||||
_[54]={tags=_[80],text="d"}
|
||||
_[53]={tags=_[79],text="c"}
|
||||
_[52]={tags=_[78],text="b"}
|
||||
_[51]={tags=_[77],text="From q checkpoint again:"}
|
||||
_[50]={tags=_[76],text="d"}
|
||||
_[49]={tags=_[75],text="c"}
|
||||
_[48]={tags=_[74],text="b"}
|
||||
_[47]={tags=_[73],text="From q checkpoint:"}
|
||||
_[46]={tags=_[72],text="d"}
|
||||
_[45]={tags=_[71],text="c"}
|
||||
_[44]={tags=_[70],text="a"}
|
||||
_[43]={tags=_[69],text="From p checkpoint:"}
|
||||
_[42]={tags=_[68],text="d"}
|
||||
_[41]={tags=_[67],text="x"}
|
||||
_[40]={tags=_[66],text="From start:"}
|
||||
_[39]={_[65]}
|
||||
_[38]={_[64]}
|
||||
_[37]={_[62],_[63]}
|
||||
_[36]={_[61]}
|
||||
_[35]={_[60]}
|
||||
_[34]={_[58],_[59]}
|
||||
_[33]={_[57]}
|
||||
_[32]={_[55],_[56]}
|
||||
_[31]={_[54]}
|
||||
_[30]={_[53]}
|
||||
_[29]={_[51],_[52]}
|
||||
_[28]={_[50]}
|
||||
_[27]={_[49]}
|
||||
_[26]={_[47],_[48]}
|
||||
_[25]={_[46]}
|
||||
_[24]={_[45]}
|
||||
_[23]={_[43],_[44]}
|
||||
_[22]={_[42]}
|
||||
_[21]={_[40],_[41]}
|
||||
_[20]={"return"}
|
||||
_[19]={"text",_[39]}
|
||||
_[18]={"text",_[38]}
|
||||
_[17]={"text",_[37]}
|
||||
_[16]={"text",_[36]}
|
||||
_[15]={"text",_[35]}
|
||||
_[14]={"text",_[34]}
|
||||
_[13]={"text",_[33]}
|
||||
_[12]={"text",_[32]}
|
||||
_[11]={"text",_[31]}
|
||||
_[10]={"text",_[30]}
|
||||
_[9]={"text",_[29]}
|
||||
_[8]={"text",_[28]}
|
||||
_[7]={"text",_[27]}
|
||||
_[6]={"text",_[26]}
|
||||
_[5]={"text",_[25]}
|
||||
_[4]={"text",_[24]}
|
||||
_[3]={"text",_[23]}
|
||||
_[2]={"text",_[22]}
|
||||
_[1]={"text",_[21]}
|
||||
return {_[1],_[2],_[3],_[4],_[5],_[6],_[7],_[8],_[9],_[10],_[11],_[12],_[13],_[14],_[15],_[16],_[17],_[18],_[19],_[20]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "From start:"
|
||||
}, {
|
||||
tags = {},
|
||||
text = "x"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "d"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "From p checkpoint:"
|
||||
}, {
|
||||
tags = {},
|
||||
text = "a"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "c"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "d"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "From q checkpoint:"
|
||||
}, {
|
||||
tags = {},
|
||||
text = "b"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "c"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "d"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "From q checkpoint again:"
|
||||
}, {
|
||||
tags = {},
|
||||
text = "b"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "c"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "d"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "Force p checkpoint:"
|
||||
}, {
|
||||
tags = {},
|
||||
text = "a"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "c"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "From q again:"
|
||||
}, {
|
||||
tags = {},
|
||||
text = "b"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "c"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "d"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "Go to p again by setting checkpoint manually:"
|
||||
}, {
|
||||
tags = {},
|
||||
text = "a"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "c"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "d"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
:post run = "after error"
|
||||
|
||||
:l = [1,2]
|
||||
|
||||
1,2: {l}
|
||||
|
||||
~ l!insert(3)
|
||||
|
||||
1,2,3: {l}
|
||||
|
||||
:! a
|
||||
|
||||
~ l!insert(4)
|
||||
|
||||
1,2,3,4: {l}
|
||||
|
||||
:! b
|
||||
|
||||
~ l!insert(5)
|
||||
|
||||
1,2,3,4,5: {l}
|
||||
|
||||
~ error("cancel merge")
|
||||
|
||||
:$ after error
|
||||
1,2,3,4: {l}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
local _={}
|
||||
_[27]={}
|
||||
_[26]={}
|
||||
_[25]={}
|
||||
_[24]={}
|
||||
_[23]={}
|
||||
_[22]={tags=_[27],text="[1, 2, 3, 4]"}
|
||||
_[21]={tags=_[27],text="1,2,3,4: "}
|
||||
_[20]={tags=_[26],text="[1, 2, 3, 4, 5]"}
|
||||
_[19]={tags=_[26],text="1,2,3,4,5: "}
|
||||
_[18]={tags=_[25],text="[1, 2, 3, 4]"}
|
||||
_[17]={tags=_[25],text="1,2,3,4: "}
|
||||
_[16]={tags=_[24],text="[1, 2, 3]"}
|
||||
_[15]={tags=_[24],text="1,2,3: "}
|
||||
_[14]={tags=_[23],text="[1, 2]"}
|
||||
_[13]={tags=_[23],text="1,2: "}
|
||||
_[12]={_[21],_[22]}
|
||||
_[11]={_[19],_[20]}
|
||||
_[10]={_[17],_[18]}
|
||||
_[9]={_[15],_[16]}
|
||||
_[8]={_[13],_[14]}
|
||||
_[7]={"return"}
|
||||
_[6]={"text",_[12]}
|
||||
_[5]={"error","cancel merge; in Lua function \"error\"; at test/tests/checkpoint merging mutable value.ans:23"}
|
||||
_[4]={"text",_[11]}
|
||||
_[3]={"text",_[10]}
|
||||
_[2]={"text",_[9]}
|
||||
_[1]={"text",_[8]}
|
||||
return {_[1],_[2],_[3],_[4],_[5],_[6],_[7]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "1,2: "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "[1, 2]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "1,2,3: "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "[1, 2, 3]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "1,2,3,4: "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "[1, 2, 3, 4]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "1,2,3,4,5: "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "[1, 2, 3, 4, 5]"
|
||||
} } }
|
||||
{ "error", 'cancel merge; in Lua function "error"; at test/tests/checkpoint merging mutable value.ans:23' }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "1,2,3,4: "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "[1, 2, 3, 4]"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
:post run = "after error"
|
||||
|
||||
:l = 1
|
||||
|
||||
1: {l}
|
||||
|
||||
~ l := 2
|
||||
|
||||
2: {l}
|
||||
|
||||
:! a
|
||||
|
||||
~ l := 3
|
||||
|
||||
3: {l}
|
||||
|
||||
:! b
|
||||
|
||||
~ l := 4
|
||||
|
||||
4: {l}
|
||||
|
||||
~ error("cancel merge")
|
||||
|
||||
:$ after error
|
||||
3: {l}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
local _={}
|
||||
_[27]={}
|
||||
_[26]={}
|
||||
_[25]={}
|
||||
_[24]={}
|
||||
_[23]={}
|
||||
_[22]={tags=_[27],text="3"}
|
||||
_[21]={tags=_[27],text="3: "}
|
||||
_[20]={tags=_[26],text="4"}
|
||||
_[19]={tags=_[26],text="4: "}
|
||||
_[18]={tags=_[25],text="3"}
|
||||
_[17]={tags=_[25],text="3: "}
|
||||
_[16]={tags=_[24],text="2"}
|
||||
_[15]={tags=_[24],text="2: "}
|
||||
_[14]={tags=_[23],text="1"}
|
||||
_[13]={tags=_[23],text="1: "}
|
||||
_[12]={_[21],_[22]}
|
||||
_[11]={_[19],_[20]}
|
||||
_[10]={_[17],_[18]}
|
||||
_[9]={_[15],_[16]}
|
||||
_[8]={_[13],_[14]}
|
||||
_[7]={"return"}
|
||||
_[6]={"text",_[12]}
|
||||
_[5]={"error","cancel merge; in Lua function \"error\"; at test/tests/checkpoint merging variable.ans:23"}
|
||||
_[4]={"text",_[11]}
|
||||
_[3]={"text",_[10]}
|
||||
_[2]={"text",_[9]}
|
||||
_[1]={"text",_[8]}
|
||||
return {_[1],_[2],_[3],_[4],_[5],_[6],_[7]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "1: "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "1"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "2: "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "2"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "3: "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "3"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "4: "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "4"
|
||||
} } }
|
||||
{ "error", 'cancel merge; in Lua function "error"; at test/tests/checkpoint merging variable.ans:23' }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "3: "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "3"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
:! p
|
||||
seen!
|
||||
|
||||
Seen: {p.seen}
|
||||
|
||||
Reached: {p.reached}
|
||||
|
||||
@p ~ !p.seen
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
local _={}
|
||||
_[29]={}
|
||||
_[28]={}
|
||||
_[27]={}
|
||||
_[26]={}
|
||||
_[25]={}
|
||||
_[24]={}
|
||||
_[23]={}
|
||||
_[22]={}
|
||||
_[21]={}
|
||||
_[20]={text="1",tags=_[29]}
|
||||
_[19]={text="Reached: ",tags=_[28]}
|
||||
_[18]={text="1",tags=_[27]}
|
||||
_[17]={text="Seen: ",tags=_[26]}
|
||||
_[16]={text="seen!",tags=_[25]}
|
||||
_[15]={text="1",tags=_[24]}
|
||||
_[14]={text="Reached: ",tags=_[23]}
|
||||
_[13]={text="0",tags=_[22]}
|
||||
_[12]={text="Seen: ",tags=_[21]}
|
||||
_[11]={_[19],_[20]}
|
||||
_[10]={_[17],_[18]}
|
||||
_[9]={_[16]}
|
||||
_[8]={_[14],_[15]}
|
||||
_[7]={_[12],_[13]}
|
||||
_[6]={"return"}
|
||||
_[5]={"text",_[11]}
|
||||
_[4]={"text",_[10]}
|
||||
_[3]={"text",_[9]}
|
||||
_[2]={"text",_[8]}
|
||||
_[1]={"text",_[7]}
|
||||
return {_[1],_[2],_[3],_[4],_[5],_[6]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "Seen: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "Reached: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "1"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "seen!"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "Seen: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "1"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "Reached: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "1"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
> ye
|
||||
no
|
||||
> ne
|
||||
ok
|
||||
~ choose(2)
|
||||
|
||||
> ho
|
||||
plop
|
||||
> oh
|
||||
plup
|
||||
~ choose(1)
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
local _={}
|
||||
_[23]={}
|
||||
_[22]={}
|
||||
_[21]={}
|
||||
_[20]={tags=_[23],text="oh"}
|
||||
_[19]={tags=_[21],text="ho"}
|
||||
_[18]={}
|
||||
_[17]={tags=_[18],text="ne"}
|
||||
_[16]={tags=_[22],text="ye"}
|
||||
_[15]={tags=_[21],text="plop"}
|
||||
_[14]={_[20]}
|
||||
_[13]={_[19]}
|
||||
_[12]={tags=_[18],text="ok"}
|
||||
_[11]={_[17]}
|
||||
_[10]={_[16]}
|
||||
_[9]={_[15]}
|
||||
_[8]={_[13],_[14]}
|
||||
_[7]={_[12]}
|
||||
_[6]={_[10],_[11]}
|
||||
_[5]={"return"}
|
||||
_[4]={"text",_[9]}
|
||||
_[3]={"choice",_[8]}
|
||||
_[2]={"text",_[7]}
|
||||
_[1]={"choice",_[6]}
|
||||
return {_[1],_[2],_[3],_[4],_[5]}
|
||||
--[[
|
||||
{ "choice", { { {
|
||||
tags = {},
|
||||
text = "ye"
|
||||
} }, { {
|
||||
tags = {},
|
||||
text = "ne"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ok"
|
||||
} } }
|
||||
{ "choice", { { {
|
||||
tags = {},
|
||||
text = "ho"
|
||||
} }, { {
|
||||
tags = {},
|
||||
text = "oh"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "plop"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
:$ f
|
||||
> neol
|
||||
nah
|
||||
|
||||
> ho
|
||||
plop
|
||||
~ f
|
||||
> oh
|
||||
ok
|
||||
~ f
|
||||
~ choose(3)
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
local _={}
|
||||
_[18]={}
|
||||
_[17]={}
|
||||
_[16]={}
|
||||
_[15]={}
|
||||
_[14]={tags=_[18],text="neol"}
|
||||
_[13]={tags=_[15],text="oh"}
|
||||
_[12]={tags=_[17],text="neol"}
|
||||
_[11]={tags=_[16],text="ho"}
|
||||
_[10]={tags=_[15],text="ok"}
|
||||
_[9]={_[14]}
|
||||
_[8]={_[13]}
|
||||
_[7]={_[12]}
|
||||
_[6]={_[11]}
|
||||
_[5]={_[10]}
|
||||
_[4]={_[6],_[7],_[8],_[9]}
|
||||
_[3]={"return"}
|
||||
_[2]={"text",_[5]}
|
||||
_[1]={"choice",_[4]}
|
||||
return {_[1],_[2],_[3]}
|
||||
--[[
|
||||
{ "choice", { { {
|
||||
tags = {},
|
||||
text = "ho"
|
||||
} }, { {
|
||||
tags = {},
|
||||
text = "neol"
|
||||
} }, { {
|
||||
tags = {},
|
||||
text = "oh"
|
||||
} }, { {
|
||||
tags = {},
|
||||
text = "neol"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ok"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
~ choose(1)
|
||||
> Press {jump button} to jump.
|
||||
ok
|
||||
> No
|
||||
ko
|
||||
|
||||
:$ jump button
|
||||
A # 1
|
||||
> Suprise choice!
|
||||
@"JOIN"
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
local _={}
|
||||
_[19]={}
|
||||
_[18]={}
|
||||
_[17]={1}
|
||||
_[16]={}
|
||||
_[15]={text="No",tags=_[19]}
|
||||
_[14]={text=" to jump.",tags=_[16]}
|
||||
_[13]={text="JOIN",tags=_[16]}
|
||||
_[12]={text="Suprise choice!",tags=_[18]}
|
||||
_[11]={text="A",tags=_[17]}
|
||||
_[10]={text="Press ",tags=_[16]}
|
||||
_[9]={text="ok",tags=_[16]}
|
||||
_[8]={_[15]}
|
||||
_[7]={_[12],_[13],_[14]}
|
||||
_[6]={_[10],_[11]}
|
||||
_[5]={_[9]}
|
||||
_[4]={_[6],_[7],_[8]}
|
||||
_[3]={"return"}
|
||||
_[2]={"text",_[5]}
|
||||
_[1]={"choice",_[4]}
|
||||
return {_[1],_[2],_[3]}
|
||||
--[[
|
||||
{ "choice", { { {
|
||||
tags = <1>{},
|
||||
text = "Press "
|
||||
}, {
|
||||
tags = { 1 },
|
||||
text = "A"
|
||||
} }, { {
|
||||
tags = {},
|
||||
text = "Suprise choice!"
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "JOIN"
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = " to jump."
|
||||
} }, { {
|
||||
tags = {},
|
||||
text = "No"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ok"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
~ choose(1)
|
||||
> Press {jump button} to jump.
|
||||
ok
|
||||
~ choose(1)
|
||||
> No
|
||||
ko
|
||||
|
||||
:$ jump button
|
||||
A # 1
|
||||
|
||||
@"SPLIT"
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
local _={}
|
||||
_[22]={}
|
||||
_[21]={1}
|
||||
_[20]={tags=_[22],text="No"}
|
||||
_[19]={text=" to jump."}
|
||||
_[18]={text="SPLIT"}
|
||||
_[17]={}
|
||||
_[16]={tags=_[21],text="A"}
|
||||
_[15]={tags=_[17],text="Press "}
|
||||
_[14]={tags=_[17],text="ok"}
|
||||
_[13]={_[20]}
|
||||
_[12]={_[18],_[19]}
|
||||
_[11]={tags=_[17],text="ok"}
|
||||
_[10]={_[15],_[16]}
|
||||
_[9]={_[14]}
|
||||
_[8]={_[12],_[13]}
|
||||
_[7]={_[11]}
|
||||
_[6]={_[10]}
|
||||
_[5]={"return"}
|
||||
_[4]={"text",_[9]}
|
||||
_[3]={"choice",_[8]}
|
||||
_[2]={"text",_[7]}
|
||||
_[1]={"choice",_[6]}
|
||||
_[0]={_[1],_[2],_[3],_[4],_[5]}
|
||||
_[18].tags=_[17]
|
||||
_[19].tags=_[17]
|
||||
return _[0]
|
||||
--[[
|
||||
{ "choice", { { {
|
||||
tags = {},
|
||||
text = "Press "
|
||||
}, {
|
||||
tags = { 1 },
|
||||
text = "A"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ok"
|
||||
} } }
|
||||
{ "choice", { { {
|
||||
tags = <1>{},
|
||||
text = "SPLIT"
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = " to jump."
|
||||
} }, { {
|
||||
tags = {},
|
||||
text = "No"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ok"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
> Press {jump button} to jump.
|
||||
ok
|
||||
> No
|
||||
ko
|
||||
~ choose(1)
|
||||
|
||||
:$ jump button
|
||||
A # 1
|
||||
|
||||
> Other
|
||||
ko
|
||||
> Use {move axis} to move.
|
||||
ok
|
||||
~ choose(2)
|
||||
|
||||
:$ move axis
|
||||
left # 1
|
||||
@" joystick"
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
local _={}
|
||||
_[30]={1}
|
||||
_[29]={}
|
||||
_[28]={}
|
||||
_[27]={1}
|
||||
_[26]={}
|
||||
_[25]={text=" to move.",tags=_[26]}
|
||||
_[24]={text="joystick",tags=_[26]}
|
||||
_[23]={text="left ",tags=_[30]}
|
||||
_[22]={text="Use ",tags=_[26]}
|
||||
_[21]={text="Other",tags=_[29]}
|
||||
_[20]={}
|
||||
_[19]={text="No",tags=_[28]}
|
||||
_[18]={text="to jump.",tags=_[20]}
|
||||
_[17]={text="A ",tags=_[27]}
|
||||
_[16]={text="Press ",tags=_[20]}
|
||||
_[15]={text="ok",tags=_[26]}
|
||||
_[14]={_[22],_[23],_[24],_[25]}
|
||||
_[13]={_[21]}
|
||||
_[12]={text="ok",tags=_[20]}
|
||||
_[11]={_[19]}
|
||||
_[10]={_[16],_[17],_[18]}
|
||||
_[9]={_[15]}
|
||||
_[8]={_[13],_[14]}
|
||||
_[7]={_[12]}
|
||||
_[6]={_[10],_[11]}
|
||||
_[5]={"return"}
|
||||
_[4]={"text",_[9]}
|
||||
_[3]={"choice",_[8]}
|
||||
_[2]={"text",_[7]}
|
||||
_[1]={"choice",_[6]}
|
||||
return {_[1],_[2],_[3],_[4],_[5]}
|
||||
--[[
|
||||
{ "choice", { { {
|
||||
tags = <1>{},
|
||||
text = "Press "
|
||||
}, {
|
||||
tags = { 1 },
|
||||
text = "A "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "to jump."
|
||||
} }, { {
|
||||
tags = {},
|
||||
text = "No"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ok"
|
||||
} } }
|
||||
{ "choice", { { {
|
||||
tags = {},
|
||||
text = "Other"
|
||||
} }, { {
|
||||
tags = <1>{},
|
||||
text = "Use "
|
||||
}, {
|
||||
tags = { 1 },
|
||||
text = "left "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "joystick"
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = " to move."
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ok"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
:$ f
|
||||
# 42
|
||||
> a
|
||||
b
|
||||
|
||||
~ f
|
||||
> c
|
||||
~ choose(1)
|
||||
|
||||
# "k"="v"
|
||||
~ f
|
||||
> d
|
||||
~ choose(1)
|
||||
e
|
||||
|
||||
f
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
local _={}
|
||||
_[30]={}
|
||||
_[29]={}
|
||||
_[28]={k="v"}
|
||||
_[27]={42,k="v"}
|
||||
_[26]={tags=_[28],text="d"}
|
||||
_[25]={tags=_[27],text="a"}
|
||||
_[24]={42}
|
||||
_[23]={tags=_[30],text="c"}
|
||||
_[22]={tags=_[24],text="a"}
|
||||
_[21]={tags=_[29],text="f"}
|
||||
_[20]={tags=_[28],text="e"}
|
||||
_[19]={tags=_[27],text="b"}
|
||||
_[18]={_[26]}
|
||||
_[17]={_[25]}
|
||||
_[16]={tags=_[24],text="b"}
|
||||
_[15]={_[23]}
|
||||
_[14]={_[22]}
|
||||
_[13]={_[21]}
|
||||
_[12]={_[20]}
|
||||
_[11]={_[19]}
|
||||
_[10]={_[17],_[18]}
|
||||
_[9]={_[16]}
|
||||
_[8]={_[14],_[15]}
|
||||
_[7]={"return"}
|
||||
_[6]={"text",_[13]}
|
||||
_[5]={"text",_[12]}
|
||||
_[4]={"text",_[11]}
|
||||
_[3]={"choice",_[10]}
|
||||
_[2]={"text",_[9]}
|
||||
_[1]={"choice",_[8]}
|
||||
return {_[1],_[2],_[3],_[4],_[5],_[6],_[7]}
|
||||
--[[
|
||||
{ "choice", { { {
|
||||
tags = { 42 },
|
||||
text = "a"
|
||||
} }, { {
|
||||
tags = {},
|
||||
text = "c"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = { 42 },
|
||||
text = "b"
|
||||
} } }
|
||||
{ "choice", { { {
|
||||
tags = { 42,
|
||||
k = "v"
|
||||
},
|
||||
text = "a"
|
||||
} }, { {
|
||||
tags = {
|
||||
k = "v"
|
||||
},
|
||||
text = "d"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = { 42,
|
||||
k = "v"
|
||||
},
|
||||
text = "b"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {
|
||||
k = "v"
|
||||
},
|
||||
text = "e"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
> ye
|
||||
no
|
||||
> ne
|
||||
ok
|
||||
~ choose(2)
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
local _={}
|
||||
_[12]={}
|
||||
_[11]={}
|
||||
_[10]={tags=_[11],text="ne"}
|
||||
_[9]={tags=_[12],text="ye"}
|
||||
_[8]={tags=_[11],text="ok"}
|
||||
_[7]={_[10]}
|
||||
_[6]={_[9]}
|
||||
_[5]={_[8]}
|
||||
_[4]={_[6],_[7]}
|
||||
_[3]={"return"}
|
||||
_[2]={"text",_[5]}
|
||||
_[1]={"choice",_[4]}
|
||||
return {_[1],_[2],_[3]}
|
||||
--[[
|
||||
{ "choice", { { {
|
||||
tags = {},
|
||||
text = "ye"
|
||||
} }, { {
|
||||
tags = {},
|
||||
text = "ne"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ok"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
> a ~ 1
|
||||
-> a
|
||||
> b
|
||||
-> b
|
||||
~ choose(1)
|
||||
|
||||
> a ~ 1
|
||||
-> a
|
||||
> b
|
||||
-> b
|
||||
~ choose(2)
|
||||
|
||||
> a ~ 0
|
||||
-> a
|
||||
> b
|
||||
-> b
|
||||
~ choose(1)
|
||||
|
||||
> a
|
||||
-> a
|
||||
> b # 25
|
||||
-> b
|
||||
~ choose(2)
|
||||
|
||||
> a ~ 0 # 12
|
||||
-> a
|
||||
> b # 3
|
||||
-> b
|
||||
~ choose(1)
|
||||
|
||||
> a ~ 1 # 12
|
||||
-> a
|
||||
> b # 3
|
||||
-> b
|
||||
~ choose(1)
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
local _={}
|
||||
_[67]={3}
|
||||
_[66]={12}
|
||||
_[65]={3}
|
||||
_[64]={25}
|
||||
_[63]={}
|
||||
_[62]={}
|
||||
_[61]={}
|
||||
_[60]={}
|
||||
_[59]={}
|
||||
_[58]={}
|
||||
_[57]={}
|
||||
_[56]={text="b",tags=_[67]}
|
||||
_[55]={text="a",tags=_[66]}
|
||||
_[54]={}
|
||||
_[53]={text="b",tags=_[65]}
|
||||
_[52]={}
|
||||
_[51]={text="b",tags=_[64]}
|
||||
_[50]={text="a",tags=_[63]}
|
||||
_[49]={}
|
||||
_[48]={text="b",tags=_[62]}
|
||||
_[47]={}
|
||||
_[46]={text="b",tags=_[61]}
|
||||
_[45]={text="a",tags=_[60]}
|
||||
_[44]={}
|
||||
_[43]={text="b",tags=_[59]}
|
||||
_[42]={text="a",tags=_[58]}
|
||||
_[41]={text="-> a",tags=_[57]}
|
||||
_[40]={_[56]}
|
||||
_[39]={_[55]}
|
||||
_[38]={text="-> b",tags=_[54]}
|
||||
_[37]={_[53]}
|
||||
_[36]={text="-> b",tags=_[52]}
|
||||
_[35]={_[51]}
|
||||
_[34]={_[50]}
|
||||
_[33]={text="-> b",tags=_[49]}
|
||||
_[32]={_[48]}
|
||||
_[31]={text="-> b",tags=_[47]}
|
||||
_[30]={_[46]}
|
||||
_[29]={_[45]}
|
||||
_[28]={text="-> a",tags=_[44]}
|
||||
_[27]={_[43]}
|
||||
_[26]={_[42]}
|
||||
_[25]={_[41]}
|
||||
_[24]={_[39],_[40]}
|
||||
_[23]={_[38]}
|
||||
_[22]={_[37]}
|
||||
_[21]={_[36]}
|
||||
_[20]={_[34],_[35]}
|
||||
_[19]={_[33]}
|
||||
_[18]={_[32]}
|
||||
_[17]={_[31]}
|
||||
_[16]={_[29],_[30]}
|
||||
_[15]={_[28]}
|
||||
_[14]={_[26],_[27]}
|
||||
_[13]={"return"}
|
||||
_[12]={"text",_[25]}
|
||||
_[11]={"choice",_[24]}
|
||||
_[10]={"text",_[23]}
|
||||
_[9]={"choice",_[22]}
|
||||
_[8]={"text",_[21]}
|
||||
_[7]={"choice",_[20]}
|
||||
_[6]={"text",_[19]}
|
||||
_[5]={"choice",_[18]}
|
||||
_[4]={"text",_[17]}
|
||||
_[3]={"choice",_[16]}
|
||||
_[2]={"text",_[15]}
|
||||
_[1]={"choice",_[14]}
|
||||
return {_[1],_[2],_[3],_[4],_[5],_[6],_[7],_[8],_[9],_[10],_[11],_[12],_[13]}
|
||||
--[[
|
||||
{ "choice", { { {
|
||||
tags = {},
|
||||
text = "a"
|
||||
} }, { {
|
||||
tags = {},
|
||||
text = "b"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "-> a"
|
||||
} } }
|
||||
{ "choice", { { {
|
||||
tags = {},
|
||||
text = "a"
|
||||
} }, { {
|
||||
tags = {},
|
||||
text = "b"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "-> b"
|
||||
} } }
|
||||
{ "choice", { { {
|
||||
tags = {},
|
||||
text = "b"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "-> b"
|
||||
} } }
|
||||
{ "choice", { { {
|
||||
tags = {},
|
||||
text = "a"
|
||||
} }, { {
|
||||
tags = { 25 },
|
||||
text = "b"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "-> b"
|
||||
} } }
|
||||
{ "choice", { { {
|
||||
tags = { 3 },
|
||||
text = "b"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "-> b"
|
||||
} } }
|
||||
{ "choice", { { {
|
||||
tags = { 12 },
|
||||
text = "a"
|
||||
} }, { {
|
||||
tags = { 3 },
|
||||
text = "b"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "-> a"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
(hey couic + 5)
|
||||
other stuff
|
||||
|
||||
CHAZOUM
|
||||
OO
|
||||
|
||||
k
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
local _={}
|
||||
_[1]={"return"}
|
||||
return {_[1]}
|
||||
--[[
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1 +0,0 @@
|
|||
(hey couic + 5)
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
local _={}
|
||||
_[1]={"return"}
|
||||
return {_[1]}
|
||||
--[[
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
:$ bar
|
||||
:var=5
|
||||
|
||||
~ var := 2
|
||||
|
||||
before: {var}
|
||||
|
||||
~ run("parallel")
|
||||
|
||||
:! foo
|
||||
checkpoint
|
||||
|
||||
after: {var}
|
||||
|
||||
~ run("parallel")
|
||||
|
||||
:$ parallel
|
||||
parallel: {bar.var}
|
||||
|
||||
~ bar
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
local _={}
|
||||
_[21]={}
|
||||
_[20]={}
|
||||
_[19]={}
|
||||
_[18]={}
|
||||
_[17]={tags=_[21],text="2"}
|
||||
_[16]={tags=_[21],text="parallel: "}
|
||||
_[15]={tags=_[20],text="2"}
|
||||
_[14]={tags=_[20],text="after: "}
|
||||
_[13]={tags=_[19],text="5"}
|
||||
_[12]={tags=_[19],text="parallel: "}
|
||||
_[11]={tags=_[18],text="2"}
|
||||
_[10]={tags=_[18],text="before: "}
|
||||
_[9]={_[16],_[17]}
|
||||
_[8]={_[14],_[15]}
|
||||
_[7]={_[12],_[13]}
|
||||
_[6]={_[10],_[11]}
|
||||
_[5]={"return"}
|
||||
_[4]={"text",_[9]}
|
||||
_[3]={"text",_[8]}
|
||||
_[2]={"text",_[7]}
|
||||
_[1]={"text",_[6]}
|
||||
return {_[1],_[2],_[3],_[4],_[5]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "before: "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "2"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "parallel: "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "5"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "after: "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "2"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "parallel: "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "2"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
ko ~ 0
|
||||
ok ~ 1
|
||||
ok bis ~ 1
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
local _={}
|
||||
_[7]={}
|
||||
_[6]={}
|
||||
_[5]={text="ok bis",tags=_[7]}
|
||||
_[4]={text="ok ",tags=_[6]}
|
||||
_[3]={_[4],_[5]}
|
||||
_[2]={"return"}
|
||||
_[1]={"text",_[3]}
|
||||
return {_[1],_[2]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ok "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "ok bis"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
:a = 5
|
||||
|
||||
~ a == 2
|
||||
ko
|
||||
~~
|
||||
ok
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
local _={}
|
||||
_[5]={}
|
||||
_[4]={tags=_[5],text="ok"}
|
||||
_[3]={_[4]}
|
||||
_[2]={"return"}
|
||||
_[1]={"text",_[3]}
|
||||
return {_[1],_[2]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ok"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
:a = 5
|
||||
|
||||
~ a == 5
|
||||
ok
|
||||
~~
|
||||
ko
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
local _={}
|
||||
_[5]={}
|
||||
_[4]={tags=_[5],text="ok"}
|
||||
_[3]={_[4]}
|
||||
_[2]={"return"}
|
||||
_[1]={"text",_[3]}
|
||||
return {_[1],_[2]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ok"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
:a = 5
|
||||
|
||||
~ a == 2
|
||||
ko
|
||||
~~ 0
|
||||
ko
|
||||
~~
|
||||
ok
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
local _={}
|
||||
_[5]={}
|
||||
_[4]={tags=_[5],text="ok"}
|
||||
_[3]={_[4]}
|
||||
_[2]={"return"}
|
||||
_[1]={"text",_[3]}
|
||||
return {_[1],_[2]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ok"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
:a = 5
|
||||
|
||||
~ a == 2
|
||||
ko
|
||||
~~ 1
|
||||
ok
|
||||
~~
|
||||
ko
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
local _={}
|
||||
_[5]={}
|
||||
_[4]={tags=_[5],text="ok"}
|
||||
_[3]={_[4]}
|
||||
_[2]={"return"}
|
||||
_[1]={"text",_[3]}
|
||||
return {_[1],_[2]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ok"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
:a = 5
|
||||
|
||||
~ a == 2
|
||||
ko
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
local _={}
|
||||
_[1]={"return"}
|
||||
return {_[1]}
|
||||
--[[
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
:$ f
|
||||
b
|
||||
|
||||
a {f ~ 5} c
|
||||
|
||||
a {f ~ 0} c
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
local _={}
|
||||
_[13]={}
|
||||
_[12]={}
|
||||
_[11]={}
|
||||
_[10]={tags=_[13],text="c"}
|
||||
_[9]={tags=_[13],text="a "}
|
||||
_[8]={tags=_[11],text=" c"}
|
||||
_[7]={tags=_[12],text="b"}
|
||||
_[6]={tags=_[11],text="a "}
|
||||
_[5]={_[9],_[10]}
|
||||
_[4]={_[6],_[7],_[8]}
|
||||
_[3]={"return"}
|
||||
_[2]={"text",_[5]}
|
||||
_[1]={"text",_[4]}
|
||||
return {_[1],_[2],_[3]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "a "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "b"
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = " c"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "a "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "c"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
:a = 5
|
||||
|
||||
~ a == 5
|
||||
ok
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
local _={}
|
||||
_[5]={}
|
||||
_[4]={tags=_[5],text="ok"}
|
||||
_[3]={_[4]}
|
||||
_[2]={"return"}
|
||||
_[1]={"text",_[3]}
|
||||
return {_[1],_[2]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ok"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
:% obj
|
||||
::a = 12
|
||||
|
||||
:x = obj()
|
||||
|
||||
{x.a}
|
||||
|
||||
{x.a := 52}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
local _={}
|
||||
_[5]={}
|
||||
_[4]={tags=_[5],text="12"}
|
||||
_[3]={_[4]}
|
||||
_[2]={"error","can't change the value of a constant attribute; in Lua function \"_._\"; at test/tests/constant object attribute.ans:8"}
|
||||
_[1]={"text",_[3]}
|
||||
return {_[1],_[2]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "12"
|
||||
} } }
|
||||
{ "error", "can't change the value of a constant attribute; in Lua function \"_._\"; at test/tests/constant object attribute.ans:8" }
|
||||
]]--
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
:% obj
|
||||
:a = 12
|
||||
|
||||
::x = obj()
|
||||
|
||||
{x.a}
|
||||
|
||||
{x.a := 52}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
local _={}
|
||||
_[5]={}
|
||||
_[4]={tags=_[5],text="12"}
|
||||
_[3]={_[4]}
|
||||
_[2]={"error","can't change the value of an attribute of a constant object; in Lua function \"_._\"; at test/tests/constant object.ans:8"}
|
||||
_[1]={"text",_[3]}
|
||||
return {_[1],_[2]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "12"
|
||||
} } }
|
||||
{ "error", "can't change the value of an attribute of a constant object; in Lua function \"_._\"; at test/tests/constant object.ans:8" }
|
||||
]]--
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
:l = [1,2,3]
|
||||
|
||||
::x = l
|
||||
|
||||
{l}
|
||||
{x}
|
||||
|
||||
-----
|
||||
|
||||
~ l!remove()
|
||||
|
||||
{l}
|
||||
{x}
|
||||
|
||||
~ x!remove()
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
local _={}
|
||||
_[17]={}
|
||||
_[16]={}
|
||||
_[15]={}
|
||||
_[14]={}
|
||||
_[13]={}
|
||||
_[12]={text="[1, 2, 3]",tags=_[17]}
|
||||
_[11]={text="[1, 2]",tags=_[16]}
|
||||
_[10]={text="-----",tags=_[15]}
|
||||
_[9]={text="[1, 2, 3]",tags=_[14]}
|
||||
_[8]={text="[1, 2, 3]",tags=_[13]}
|
||||
_[7]={_[11],_[12]}
|
||||
_[6]={_[10]}
|
||||
_[5]={_[8],_[9]}
|
||||
_[4]={"error","can't remove values from a constant list; in Lua function \"remove\"; at test/tests/constant values variable.ans:15"}
|
||||
_[3]={"text",_[7]}
|
||||
_[2]={"text",_[6]}
|
||||
_[1]={"text",_[5]}
|
||||
return {_[1],_[2],_[3],_[4]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "[1, 2, 3]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, 2, 3]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "-----"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "[1, 2]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, 2, 3]"
|
||||
} } }
|
||||
{ "error", "can't remove values from a constant list; in Lua function \"remove\"; at test/tests/constant values variable.ans:15" }
|
||||
]]--
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
:l = [1,2,3]
|
||||
|
||||
:x = constant(l)
|
||||
|
||||
{l}
|
||||
{x}
|
||||
|
||||
-----
|
||||
|
||||
~ l!remove()
|
||||
|
||||
{l}
|
||||
{x}
|
||||
|
||||
~ x!remove()
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
local _={}
|
||||
_[17]={}
|
||||
_[16]={}
|
||||
_[15]={}
|
||||
_[14]={}
|
||||
_[13]={}
|
||||
_[12]={text="[1, 2, 3]",tags=_[17]}
|
||||
_[11]={text="[1, 2]",tags=_[16]}
|
||||
_[10]={text="-----",tags=_[15]}
|
||||
_[9]={text="[1, 2, 3]",tags=_[14]}
|
||||
_[8]={text="[1, 2, 3]",tags=_[13]}
|
||||
_[7]={_[11],_[12]}
|
||||
_[6]={_[10]}
|
||||
_[5]={_[8],_[9]}
|
||||
_[4]={"error","can't remove values from a constant list; in Lua function \"remove\"; at test/tests/constant values.ans:15"}
|
||||
_[3]={"text",_[7]}
|
||||
_[2]={"text",_[6]}
|
||||
_[1]={"text",_[5]}
|
||||
return {_[1],_[2],_[3],_[4]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "[1, 2, 3]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, 2, 3]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "-----"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "[1, 2]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, 2, 3]"
|
||||
} } }
|
||||
{ "error", "can't remove values from a constant list; in Lua function \"remove\"; at test/tests/constant values.ans:15" }
|
||||
]]--
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
::a = [3]
|
||||
|
||||
{a}
|
||||
|
||||
~ a!insert(52)
|
||||
|
||||
{a}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
local _={}
|
||||
_[5]={}
|
||||
_[4]={tags=_[5],text="[3]"}
|
||||
_[3]={_[4]}
|
||||
_[2]={"error","can't insert values into a constant list; in Lua function \"insert\"; at test/tests/constant variable list.ans:5"}
|
||||
_[1]={"text",_[3]}
|
||||
return {_[1],_[2]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "[3]"
|
||||
} } }
|
||||
{ "error", "can't insert values into a constant list; in Lua function \"insert\"; at test/tests/constant variable list.ans:5" }
|
||||
]]--
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
::a = 3
|
||||
|
||||
{a}
|
||||
|
||||
~ a := 52
|
||||
|
||||
{a}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
local _={}
|
||||
_[5]={}
|
||||
_[4]={tags=_[5],text="3"}
|
||||
_[3]={_[4]}
|
||||
_[2]={"error","can't change the value of a constant \"constant variable.a\"; while assigning value to variable \"constant variable.a\"; at test/tests/constant variable.ans:5"}
|
||||
_[1]={"text",_[3]}
|
||||
return {_[1],_[2]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "3"
|
||||
} } }
|
||||
{ "error", "can't change the value of a constant \"constant variable.a\"; while assigning value to variable \"constant variable.a\"; at test/tests/constant variable.ans:5" }
|
||||
]]--
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
:weigh::"kg" = 5::"kg"
|
||||
|
||||
{weigh}
|
||||
|
||||
~ weigh := 12::"kg"
|
||||
|
||||
{weigh}
|
||||
|
||||
~ weigh := 32
|
||||
|
||||
{weigh}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
local _={}
|
||||
_[9]={}
|
||||
_[8]={}
|
||||
_[7]={text="12::kg",tags=_[9]}
|
||||
_[6]={text="5::kg",tags=_[8]}
|
||||
_[5]={_[7]}
|
||||
_[4]={_[6]}
|
||||
_[3]={"error","constraint check failed; while assigning value to variable \"constrained variable assignement.weigh\"; at test/tests/constrained variable assignement.ans:9"}
|
||||
_[2]={"text",_[5]}
|
||||
_[1]={"text",_[4]}
|
||||
return {_[1],_[2],_[3]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "5::kg"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "12::kg"
|
||||
} } }
|
||||
{ "error", 'constraint check failed; while assigning value to variable "constrained variable assignement.weigh"; at test/tests/constrained variable assignement.ans:9' }
|
||||
]]--
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
:weigh::"kg" = 5::"kg"
|
||||
|
||||
{weigh}
|
||||
|
||||
:not weigh::"kg" = 12
|
||||
|
||||
{not weigh}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
local _={}
|
||||
_[5]={}
|
||||
_[4]={text="5::kg",tags=_[5]}
|
||||
_[3]={_[4]}
|
||||
_[2]={"error","constraint check failed; while assigning value to variable \"constrained variable definition.not weigh\"; at test/tests/constrained variable definition.ans:7"}
|
||||
_[1]={"text",_[3]}
|
||||
return {_[1],_[2]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "5::kg"
|
||||
} } }
|
||||
{ "error", 'constraint check failed; while assigning value to variable "constrained variable definition.not weigh"; at test/tests/constrained variable definition.ans:7' }
|
||||
]]--
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
ah
|
||||
~ wait(5)
|
||||
ho
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
local _={}
|
||||
_[8]={}
|
||||
_[7]={}
|
||||
_[6]={tags=_[8],text="ho"}
|
||||
_[5]={tags=_[7],text="ah"}
|
||||
_[4]={_[5],_[6]}
|
||||
_[3]={"return"}
|
||||
_[2]={"text",_[4]}
|
||||
_[1]={"wait",5}
|
||||
return {_[1],_[2],_[3]}
|
||||
--[[
|
||||
{ "wait", 5 }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ah"
|
||||
}, {
|
||||
tags = {},
|
||||
text = "ho"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
:person = "personne"
|
||||
|
||||
:$ Person(name, age)
|
||||
@{name=name, age=age}::person
|
||||
|
||||
:abject = Person("Darmanin", 38)
|
||||
|
||||
{abject}
|
||||
|
||||
:$ {}(p::person)
|
||||
@"Name: {p("name")}\nAge: {p("age")}"
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
local _={}
|
||||
_[5]={}
|
||||
_[4]={tags=_[5],text="Name: Darmanin\nAge: 38"}
|
||||
_[3]={_[4]}
|
||||
_[2]={"return"}
|
||||
_[1]={"text",_[3]}
|
||||
return {_[1],_[2]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "Name: Darmanin\nAge: 38"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
:$ a
|
||||
|
||||
:a = 2
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
local _={}
|
||||
_[1]={"error","trying to define variable \"define override function.a\", but a function with the same name exists; at test/tests/define override function.ans:3"}
|
||||
return {_[1]}
|
||||
--[[
|
||||
{ "error", 'trying to define variable "define override function.a", but a function with the same name exists; at test/tests/define override function.ans:3' }
|
||||
]]--
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
:a = 2
|
||||
|
||||
:$ a
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
local _={}
|
||||
_[1]={"error","trying to define function define override variable.a, but a variable with the same name exists; at test/tests/define override variable.ans:3"}
|
||||
return {_[1]}
|
||||
--[[
|
||||
{ "error", "trying to define function define override variable.a, but a variable with the same name exists; at test/tests/define override variable.ans:3" }
|
||||
]]--
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
:a = 5
|
||||
|
||||
:a = 2
|
||||
|
||||
a: {a}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
local _={}
|
||||
_[1]={"error","trying to define variable \"define override.a\" but it is already defined at test/tests/define override.ans:1; at test/tests/define override.ans:3"}
|
||||
return {_[1]}
|
||||
--[[
|
||||
{ "error", 'trying to define variable "define override.a" but it is already defined at test/tests/define override.ans:1; at test/tests/define override.ans:3' }
|
||||
]]--
|
||||
|
|
@ -1 +0,0 @@
|
|||
:a = 5
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
local _={}
|
||||
_[1]={"return"}
|
||||
return {_[1]}
|
||||
--[[
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
::a = [1=2]
|
||||
|
||||
0 = {a == [5=2]!constant}
|
||||
|
||||
0 = {a == [1=3]!constant}
|
||||
|
||||
1 = {a == [1=2]!constant}
|
||||
|
||||
::b = [1,2,3]
|
||||
|
||||
0 = {b == a}
|
||||
|
||||
0 = {b == []!constant}
|
||||
|
||||
0 = {b == [3,1,2]!constant}
|
||||
|
||||
0 = {b == [1,2,3,4]!constant}
|
||||
|
||||
1 = {b == [1,2,3]!constant}
|
||||
|
||||
:c = [1,2,3]
|
||||
|
||||
0 = {c == b}
|
||||
|
||||
1 = {c!constant == b}
|
||||
|
||||
::d = [1,2,3]
|
||||
|
||||
1 = {d == b}
|
||||
|
|
@ -1,149 +0,0 @@
|
|||
local _={}
|
||||
_[67]={}
|
||||
_[66]={}
|
||||
_[65]={}
|
||||
_[64]={}
|
||||
_[63]={}
|
||||
_[62]={}
|
||||
_[61]={}
|
||||
_[60]={}
|
||||
_[59]={}
|
||||
_[58]={}
|
||||
_[57]={}
|
||||
_[56]={}
|
||||
_[55]={}
|
||||
_[54]={}
|
||||
_[53]={}
|
||||
_[52]={}
|
||||
_[51]={}
|
||||
_[50]={}
|
||||
_[49]={}
|
||||
_[48]={}
|
||||
_[47]={}
|
||||
_[46]={}
|
||||
_[45]={tags=_[67],text="1"}
|
||||
_[44]={tags=_[66],text="1 = "}
|
||||
_[43]={tags=_[65],text="1"}
|
||||
_[42]={tags=_[64],text="1 = "}
|
||||
_[41]={tags=_[63],text="0"}
|
||||
_[40]={tags=_[62],text="0 = "}
|
||||
_[39]={tags=_[61],text="1"}
|
||||
_[38]={tags=_[60],text="1 = "}
|
||||
_[37]={tags=_[59],text="0"}
|
||||
_[36]={tags=_[58],text="0 = "}
|
||||
_[35]={tags=_[57],text="0"}
|
||||
_[34]={tags=_[56],text="0 = "}
|
||||
_[33]={tags=_[55],text="0"}
|
||||
_[32]={tags=_[54],text="0 = "}
|
||||
_[31]={tags=_[53],text="0"}
|
||||
_[30]={tags=_[52],text="0 = "}
|
||||
_[29]={tags=_[51],text="1"}
|
||||
_[28]={tags=_[50],text="1 = "}
|
||||
_[27]={tags=_[49],text="0"}
|
||||
_[26]={tags=_[48],text="0 = "}
|
||||
_[25]={tags=_[47],text="0"}
|
||||
_[24]={tags=_[46],text="0 = "}
|
||||
_[23]={_[44],_[45]}
|
||||
_[22]={_[42],_[43]}
|
||||
_[21]={_[40],_[41]}
|
||||
_[20]={_[38],_[39]}
|
||||
_[19]={_[36],_[37]}
|
||||
_[18]={_[34],_[35]}
|
||||
_[17]={_[32],_[33]}
|
||||
_[16]={_[30],_[31]}
|
||||
_[15]={_[28],_[29]}
|
||||
_[14]={_[26],_[27]}
|
||||
_[13]={_[24],_[25]}
|
||||
_[12]={"return"}
|
||||
_[11]={"text",_[23]}
|
||||
_[10]={"text",_[22]}
|
||||
_[9]={"text",_[21]}
|
||||
_[8]={"text",_[20]}
|
||||
_[7]={"text",_[19]}
|
||||
_[6]={"text",_[18]}
|
||||
_[5]={"text",_[17]}
|
||||
_[4]={"text",_[16]}
|
||||
_[3]={"text",_[15]}
|
||||
_[2]={"text",_[14]}
|
||||
_[1]={"text",_[13]}
|
||||
return {_[1],_[2],_[3],_[4],_[5],_[6],_[7],_[8],_[9],_[10],_[11],_[12]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "1 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "1"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "1 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "1"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "0 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "0"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "1 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "1"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "1 = "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "1"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
a
|
||||
|
||||
> b
|
||||
~ choose(1)
|
||||
|
||||
c
|
||||
> d
|
||||
~ choose(1)
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
local _={}
|
||||
_[19]={}
|
||||
_[18]={}
|
||||
_[17]={tags=_[19],text="d"}
|
||||
_[16]={}
|
||||
_[15]={tags=_[18],text="b"}
|
||||
_[14]={}
|
||||
_[13]={_[17]}
|
||||
_[12]={tags=_[16],text="c"}
|
||||
_[11]={_[15]}
|
||||
_[10]={tags=_[14],text="a"}
|
||||
_[9]={_[13]}
|
||||
_[8]={_[12]}
|
||||
_[7]={_[11]}
|
||||
_[6]={_[10]}
|
||||
_[5]={"return"}
|
||||
_[4]={"choice",_[9]}
|
||||
_[3]={"text",_[8]}
|
||||
_[2]={"choice",_[7]}
|
||||
_[1]={"text",_[6]}
|
||||
return {_[1],_[2],_[3],_[4],_[5]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "a"
|
||||
} } }
|
||||
{ "choice", { { {
|
||||
tags = {},
|
||||
text = "b"
|
||||
} } } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "c"
|
||||
} } }
|
||||
{ "choice", { { {
|
||||
tags = {},
|
||||
text = "d"
|
||||
} } } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
:$ f : test
|
||||
@"ok"
|
||||
|
||||
{f} = {test}
|
||||
|
||||
:$ g : bis(a)
|
||||
@a
|
||||
|
||||
{g("ye")} = {bis("ye")}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
local _={}
|
||||
_[13]={}
|
||||
_[12]={}
|
||||
_[11]={tags=_[13],text="ye"}
|
||||
_[10]={tags=_[13],text=" = "}
|
||||
_[9]={tags=_[13],text="ye"}
|
||||
_[8]={tags=_[12],text="ok"}
|
||||
_[7]={tags=_[12],text=" = "}
|
||||
_[6]={tags=_[12],text="ok"}
|
||||
_[5]={_[9],_[10],_[11]}
|
||||
_[4]={_[6],_[7],_[8]}
|
||||
_[3]={"return"}
|
||||
_[2]={"text",_[5]}
|
||||
_[1]={"text",_[4]}
|
||||
return {_[1],_[2],_[3]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "ok"
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = " = "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "ok"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "ye"
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = " = "
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "ye"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
:$ f(a, l...)
|
||||
{a}
|
||||
{l}
|
||||
|
||||
~ f("ok", "o", "k")
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
local _={}
|
||||
_[7]={}
|
||||
_[6]={}
|
||||
_[5]={tags=_[7],text="[o, k]"}
|
||||
_[4]={tags=_[6],text="ok"}
|
||||
_[3]={_[4],_[5]}
|
||||
_[2]={"return"}
|
||||
_[1]={"text",_[3]}
|
||||
return {_[1],_[2]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ok"
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[o, k]"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
:$ f(a)
|
||||
{a}
|
||||
|
||||
~ f("ok")
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
local _={}
|
||||
_[5]={}
|
||||
_[4]={tags=_[5],text="ok"}
|
||||
_[3]={_[4]}
|
||||
_[2]={"return"}
|
||||
_[1]={"text",_[3]}
|
||||
return {_[1],_[2]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "ok"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
:$ f(a, b)
|
||||
{a}{b}
|
||||
|
||||
~ f("ok")
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
local _={}
|
||||
_[1]={"error","function \"function args arity check fail.f\" expected 2 arguments but received 1; at test/tests/function args arity check fail.ans:4"}
|
||||
return {_[1]}
|
||||
--[[
|
||||
{ "error", 'function "function args arity check fail.f" expected 2 arguments but received 1; at test/tests/function args arity check fail.ans:4' }
|
||||
]]--
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
:$ f(a, b, l...)
|
||||
{a}{b}
|
||||
{l}
|
||||
|
||||
~ f("o","k")
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
local _={}
|
||||
_[8]={}
|
||||
_[7]={}
|
||||
_[6]={tags=_[8],text="[]"}
|
||||
_[5]={tags=_[7],text="k"}
|
||||
_[4]={tags=_[7],text="o"}
|
||||
_[3]={_[4],_[5],_[6]}
|
||||
_[2]={"return"}
|
||||
_[1]={"text",_[3]}
|
||||
return {_[1],_[2]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = <1>{},
|
||||
text = "o"
|
||||
}, {
|
||||
tags = <table 1>,
|
||||
text = "k"
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[]"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
:$ f(a, b, l...)
|
||||
{a}{b}
|
||||
{l}
|
||||
|
||||
~ f("o", "k", "o", "k")
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue