1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 16:49:31 +00:00

Recursively check equality for lists and pairs, improve function redefinition error message

This commit is contained in:
Étienne Fildadut 2021-04-04 19:36:42 +02:00
parent 6dc0db71e0
commit ec18d2e611
58 changed files with 288 additions and 172 deletions

View file

@ -110,11 +110,14 @@ local function eval(state, exp)
flush_state(state) flush_state(state)
if r then if r then
return r, e return r, e
-- resume function from paragraph
elseif not exp.explicit_call then elseif not exp.explicit_call then
r, e = run(state, fn.value.parent_block, true, fn.value.parent_position+1) r, e = run(state, fn.value.parent_block, true, fn.value.parent_position+1)
else else
r = { type = "nil", value = nil } r = { type = "nil", value = nil }
end end
-- paragraph decorators: run single line or resume from it.
-- checkpoint & seen variables will be updated from the interpreter usual paragraph-reaching code.
elseif exp.explicit_call then elseif exp.explicit_call then
r, e = run(state, fn.value.parent_block, false, fn.value.parent_position, fn.value.parent_position) r, e = run(state, fn.value.parent_block, false, fn.value.parent_position, fn.value.parent_position)
else else

View file

@ -144,7 +144,7 @@ local function parse_line(line, state, namespace)
min, max = variant.arity, r.variant.arity min, max = variant.arity, r.variant.arity
end end
if min == vmin and max == vmax then if min == vmin and max == vmax then
return nil, ("trying to define %s %s with arity [%s;%s], but another function with the arity exist; at %s"):format(r.type, fqm, min, max, line.source) return nil, ("trying to define %s %s with arity [%s;%s], but another function with the same name and arity exist; at %s"):format(r.type, fqm, min, max, line.source)
end end
end end
-- add -- add

View file

@ -8,6 +8,27 @@ local function rewrite_assignement(fqm, state, arg, explicit_call)
return ass return ass
end end
local function compare(a, b)
if a.type ~= b.type then
return false
end
if a.type == "pair" then
return compare(a.value[1], b.value[1]) and compare(a.value[2], b.value[2])
elseif a.type == "list" then
if #a.value ~= #b.value then
return false
end
for i, v in ipairs(a.value) do
if not compare(v, b.value[i]) then
return false
end
end
return true
else
return a.value == b.value
end
end
local functions local functions
functions = { functions = {
-- discard left -- discard left
@ -69,7 +90,7 @@ functions = {
value = function(a, b) value = function(a, b)
return { return {
type = "number", type = "number",
value = (a.type == b.type and a.value == b.value) and 1 or 0 value = compare(a, b) and 1 or 0
} }
end end
} }
@ -80,7 +101,7 @@ functions = {
value = function(a, b) value = function(a, b)
return { return {
type = "number", type = "number",
value = (a.type == b.type and a.value == b.value) and 0 or 1 value = compare(a, b) and 0 or 1
} }
end end
} }
@ -170,10 +191,11 @@ functions = {
{ {
arity = 2, return_type = "number", mode = "custom", arity = 2, return_type = "number", mode = "custom",
value = function(state, exp) value = function(state, exp)
local left, lefte = eval(state, exp.left) local arg = exp.argument
local left, lefte = eval(state, arg.left)
if not left then return left, lefte end if not left then return left, lefte end
if truthy(left) then if truthy(left) then
local right, righte = eval(state, exp.right) local right, righte = eval(state, arg.right)
if not right then return right, righte end if not right then return right, righte end
if truthy(right) then if truthy(right) then
return { return {
@ -191,9 +213,10 @@ functions = {
}, },
["|"] = { ["|"] = {
{ {
arity = 2, return_type = "number", mode = "raw", arity = 2, return_type = "number", mode = "custom",
value = function(state, exp) value = function(state, exp)
local left, lefte = eval(state, exp.left) local arg = exp.argument
local left, lefte = eval(state, arg.left)
if not left then return left, lefte end if not left then return left, lefte end
if truthy(left) then if truthy(left) then
return { return {
@ -201,7 +224,7 @@ functions = {
value = 1 value = 1
} }
end end
local right, righte = eval(state, exp.right) local right, righte = eval(state, arg.right)
if not right then return right, righte end if not right then return right, righte end
return { return {
type = "number", type = "number",
@ -275,6 +298,20 @@ functions = {
end end
} }
}, },
find = {
{
arity = 2, types = { "list" }, return_type = "number", mode = "raw",
value = function(a, v)
for i, x in ipairs(v.value) do
if compare(v, x) then
return i
end
end
return 0
end
},
},
-- other methods
rand = { rand = {
{ {
arity = 0, return_type = "number", arity = 0, return_type = "number",

View file

@ -5,12 +5,12 @@ _[19]={}
_[18]={} _[18]={}
_[17]={} _[17]={}
_[16]={} _[16]={}
_[15]={data="plop",tags=_[21]} _[15]={tags=_[21],data="plop"}
_[14]={data="oh",tags=_[20]} _[14]={tags=_[20],data="oh"}
_[13]={data="ho",tags=_[19]} _[13]={tags=_[19],data="ho"}
_[12]={data="ok",tags=_[18]} _[12]={tags=_[18],data="ok"}
_[11]={data="ne",tags=_[17]} _[11]={tags=_[17],data="ne"}
_[10]={data="ye",tags=_[16]} _[10]={tags=_[16],data="ye"}
_[9]={_[15]} _[9]={_[15]}
_[8]={_[13],_[14]} _[8]={_[13],_[14]}
_[7]={_[12]} _[7]={_[12]}

View file

@ -4,11 +4,11 @@ _[14]={}
_[13]={} _[13]={}
_[12]={} _[12]={}
_[11]={} _[11]={}
_[10]={data="ok",tags=_[15]} _[10]={tags=_[15],data="ok"}
_[9]={data="neol",tags=_[14]} _[9]={tags=_[14],data="neol"}
_[8]={data="oh",tags=_[13]} _[8]={tags=_[13],data="oh"}
_[7]={data="neol",tags=_[12]} _[7]={tags=_[12],data="neol"}
_[6]={data="ho",tags=_[11]} _[6]={tags=_[11],data="ho"}
_[5]={_[10]} _[5]={_[10]}
_[4]={_[6],_[7],_[8],_[9]} _[4]={_[6],_[7],_[8],_[9]}
_[3]={"return"} _[3]={"return"}

View file

@ -2,9 +2,9 @@ local _={}
_[11]={} _[11]={}
_[10]={} _[10]={}
_[9]={} _[9]={}
_[8]={data="ok",tags=_[11]} _[8]={tags=_[11],data="ok"}
_[7]={data="ne",tags=_[10]} _[7]={tags=_[10],data="ne"}
_[6]={data="ye",tags=_[9]} _[6]={tags=_[9],data="ye"}
_[5]={_[8]} _[5]={_[8]}
_[4]={_[6],_[7]} _[4]={_[6],_[7]}
_[3]={"return"} _[3]={"return"}

View file

@ -3,10 +3,10 @@ _[17]={}
_[16]={} _[16]={}
_[15]={} _[15]={}
_[14]={} _[14]={}
_[13]={data="parallel: 2",tags=_[17]} _[13]={tags=_[17],data="parallel: 2"}
_[12]={data="after: 2",tags=_[16]} _[12]={tags=_[16],data="after: 2"}
_[11]={data="parallel: 5",tags=_[15]} _[11]={tags=_[15],data="parallel: 5"}
_[10]={data="before: 2",tags=_[14]} _[10]={tags=_[14],data="before: 2"}
_[9]={_[13]} _[9]={_[13]}
_[8]={_[12]} _[8]={_[12]}
_[7]={_[11]} _[7]={_[11]}

View file

@ -1,8 +1,8 @@
local _={} local _={}
_[7]={} _[7]={}
_[6]={} _[6]={}
_[5]={data="ok bis",tags=_[7]} _[5]={tags=_[7],data="ok bis"}
_[4]={data="ok",tags=_[6]} _[4]={tags=_[6],data="ok"}
_[3]={_[4],_[5]} _[3]={_[4],_[5]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="ok",tags=_[5]} _[4]={tags=_[5],data="ok"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="ok",tags=_[5]} _[4]={tags=_[5],data="ok"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="ok",tags=_[5]} _[4]={tags=_[5],data="ok"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="ok",tags=_[5]} _[4]={tags=_[5],data="ok"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="ok",tags=_[5]} _[4]={tags=_[5],data="ok"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,8 +1,8 @@
local _={} local _={}
_[8]={} _[8]={}
_[7]={} _[7]={}
_[6]={data="ho",tags=_[8]} _[6]={tags=_[8],data="ho"}
_[5]={data="ah",tags=_[7]} _[5]={tags=_[7],data="ah"}
_[4]={_[5],_[6]} _[4]={_[5],_[6]}
_[3]={"return"} _[3]={"return"}
_[2]={"text",_[4]} _[2]={"text",_[4]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="a: 5",tags=_[5]} _[4]={tags=_[5],data="a: 5"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -0,0 +1,19 @@
:(1:2) a
0 = {a = (5:2)}
0 = {a = (1:3)}
1 = {a = (1:2)}
:[1,2,3] b
0 = {b = a}
0 = {b = []}
0 = {b = [3,1,2]}
0 = {b = [1,2,3,4]}
1 = {b = [1,2,3]}

View file

@ -0,0 +1,70 @@
local _={}
_[33]={}
_[32]={}
_[31]={}
_[30]={}
_[29]={}
_[28]={}
_[27]={}
_[26]={}
_[25]={tags=_[33],data="1 = 1"}
_[24]={tags=_[32],data="0 = 0"}
_[23]={tags=_[31],data="0 = 0"}
_[22]={tags=_[30],data="0 = 0"}
_[21]={tags=_[29],data="0 = 0"}
_[20]={tags=_[28],data="1 = 1"}
_[19]={tags=_[27],data="0 = 0"}
_[18]={tags=_[26],data="0 = 0"}
_[17]={_[25]}
_[16]={_[24]}
_[15]={_[23]}
_[14]={_[22]}
_[13]={_[21]}
_[12]={_[20]}
_[11]={_[19]}
_[10]={_[18]}
_[9]={"return"}
_[8]={"text",_[17]}
_[7]={"text",_[16]}
_[6]={"text",_[15]}
_[5]={"text",_[14]}
_[4]={"text",_[13]}
_[3]={"text",_[12]}
_[2]={"text",_[11]}
_[1]={"text",_[10]}
return {_[1],_[2],_[3],_[4],_[5],_[6],_[7],_[8],_[9]}
--[[
{ "text", { {
data = "0 = 0",
tags = {}
} } }
{ "text", { {
data = "0 = 0",
tags = {}
} } }
{ "text", { {
data = "1 = 1",
tags = {}
} } }
{ "text", { {
data = "0 = 0",
tags = {}
} } }
{ "text", { {
data = "0 = 0",
tags = {}
} } }
{ "text", { {
data = "0 = 0",
tags = {}
} } }
{ "text", { {
data = "0 = 0",
tags = {}
} } }
{ "text", { {
data = "1 = 1",
tags = {}
} } }
{ "return" }
]]--

View file

@ -1,8 +1,8 @@
local _={} local _={}
_[7]={} _[7]={}
_[6]={} _[6]={}
_[5]={data="[o, k]",tags=_[7]} _[5]={tags=_[7],data="[o, k]"}
_[4]={data="ok",tags=_[6]} _[4]={tags=_[6],data="ok"}
_[3]={_[4],_[5]} _[3]={_[4],_[5]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="ok",tags=_[5]} _[4]={tags=_[5],data="ok"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,8 +1,8 @@
local _={} local _={}
_[7]={} _[7]={}
_[6]={} _[6]={}
_[5]={data="[]",tags=_[7]} _[5]={tags=_[7],data="[]"}
_[4]={data="ok",tags=_[6]} _[4]={tags=_[6],data="ok"}
_[3]={_[4],_[5]} _[3]={_[4],_[5]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,8 +1,8 @@
local _={} local _={}
_[7]={} _[7]={}
_[6]={} _[6]={}
_[5]={data="[o, k]",tags=_[7]} _[5]={tags=_[7],data="[o, k]"}
_[4]={data="ok",tags=_[6]} _[4]={tags=_[6],data="ok"}
_[3]={_[4],_[5]} _[3]={_[4],_[5]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="ok",tags=_[5]} _[4]={tags=_[5],data="ok"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[1]={"error","trying to define function function arity conflict.f with arity [2;2], but another function with the arity exist; at test/tests/function arity conflict.ans:5"} _[1]={"error","trying to define function function arity conflict.f with arity [2;2], but another function with the same name and arity exist; at test/tests/function arity conflict.ans:5"}
return {_[1]} return {_[1]}
--[[ --[[
{ "error", "trying to define function function arity conflict.f with arity [2;2], but another function with the arity exist; at test/tests/function arity conflict.ans:5" } { "error", "trying to define function function arity conflict.f with arity [2;2], but another function with the same name and arity exist; at test/tests/function arity conflict.ans:5" }
]]-- ]]--

View file

@ -4,11 +4,11 @@ _[20]={}
_[19]={} _[19]={}
_[18]={} _[18]={}
_[17]={} _[17]={}
_[16]={data="b",tags=_[21]} _[16]={tags=_[21],data="b"}
_[15]={data="a",tags=_[20]} _[15]={tags=_[20],data="a"}
_[14]={data="c",tags=_[19]} _[14]={tags=_[19],data="c"}
_[13]={data="b",tags=_[18]} _[13]={tags=_[18],data="b"}
_[12]={data="a",tags=_[17]} _[12]={tags=_[17],data="a"}
_[11]={_[16]} _[11]={_[16]}
_[10]={_[15]} _[10]={_[15]}
_[9]={_[14]} _[9]={_[14]}

View file

@ -4,11 +4,11 @@ _[20]={}
_[19]={} _[19]={}
_[18]={} _[18]={}
_[17]={} _[17]={}
_[16]={data="c",tags=_[21]} _[16]={tags=_[21],data="c"}
_[15]={data="c",tags=_[20]} _[15]={tags=_[20],data="c"}
_[14]={data="c",tags=_[19]} _[14]={tags=_[19],data="c"}
_[13]={data="b",tags=_[18]} _[13]={tags=_[18],data="b"}
_[12]={data="a",tags=_[17]} _[12]={tags=_[17],data="a"}
_[11]={_[16]} _[11]={_[16]}
_[10]={_[15]} _[10]={_[15]}
_[9]={_[14]} _[9]={_[14]}

View file

@ -4,11 +4,11 @@ _[20]={}
_[19]={} _[19]={}
_[18]={} _[18]={}
_[17]={} _[17]={}
_[16]={data="a",tags=_[21]} _[16]={tags=_[21],data="a"}
_[15]={data="c",tags=_[20]} _[15]={tags=_[20],data="a"}
_[14]={data="c",tags=_[19]} _[14]={tags=_[19],data="b"}
_[13]={data="c",tags=_[18]} _[13]={tags=_[18],data="a"}
_[12]={data="b",tags=_[17]} _[12]={tags=_[17],data="b"}
_[11]={_[16]} _[11]={_[16]}
_[10]={_[15]} _[10]={_[15]}
_[9]={_[14]} _[9]={_[14]}
@ -27,15 +27,15 @@ return {_[1],_[2],_[3],_[4],_[5],_[6]}
tags = {} tags = {}
} } } } } }
{ "text", { { { "text", { {
data = "c", data = "a",
tags = {} tags = {}
} } } } } }
{ "text", { { { "text", { {
data = "c", data = "b",
tags = {} tags = {}
} } } } } }
{ "text", { { { "text", { {
data = "c", data = "a",
tags = {} tags = {}
} } } } } }
{ "text", { { { "text", { {

View file

@ -1,8 +1,8 @@
local _={} local _={}
_[7]={} _[7]={}
_[6]={} _[6]={}
_[5]={data="2",tags=_[7]} _[5]={tags=_[7],data="2"}
_[4]={data="5",tags=_[6]} _[4]={tags=_[6],data="5"}
_[3]={_[4],_[5]} _[3]={_[4],_[5]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="5",tags=_[5]} _[4]={tags=_[5],data="5"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="a: 5",tags=_[5]} _[4]={tags=_[5],data="a: 5"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,4 +1,6 @@
$ f(a) $ f(a)
{a} {a}
~ "ok".f
~ "ok".f() ~ "ok".f()

View file

@ -1,11 +1,19 @@
local _={} local _={}
_[5]={} _[9]={}
_[4]={data="ok",tags=_[5]} _[8]={}
_[3]={_[4]} _[7]={tags=_[9],data="ok"}
_[2]={"return"} _[6]={tags=_[8],data="ok"}
_[1]={"text",_[3]} _[5]={_[7]}
return {_[1],_[2]} _[4]={_[6]}
_[3]={"return"}
_[2]={"text",_[5]}
_[1]={"text",_[4]}
return {_[1],_[2],_[3]}
--[[ --[[
{ "text", { {
data = "ok",
tags = {}
} } }
{ "text", { { { "text", { {
data = "ok", data = "ok",
tags = {} tags = {}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="ok",tags=_[5]} _[4]={tags=_[5],data="ok"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="[]",tags=_[5]} _[4]={tags=_[5],data="[]"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="[o, k]",tags=_[5]} _[4]={tags=_[5],data="[o, k]"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="ok",tags=_[5]} _[4]={tags=_[5],data="ok"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -2,9 +2,9 @@ local _={}
_[12]={} _[12]={}
_[11]={} _[11]={}
_[10]={} _[10]={}
_[9]={data="no",tags=_[12]} _[9]={tags=_[12],data="no"}
_[8]={data="in interrupt: 5",tags=_[11]} _[8]={tags=_[11],data="in interrupt: 5"}
_[7]={data="before: 2",tags=_[10]} _[7]={tags=_[10],data="before: 2"}
_[6]={_[8],_[9]} _[6]={_[8],_[9]}
_[5]={_[7]} _[5]={_[7]}
_[4]={"return"} _[4]={"return"}

View file

@ -1,8 +1,8 @@
local _={} local _={}
_[10]={} _[10]={}
_[9]={} _[9]={}
_[8]={data="in interrupt: 5",tags=_[10]} _[8]={tags=_[10],data="in interrupt: 5"}
_[7]={data="before: 2",tags=_[9]} _[7]={tags=_[9],data="before: 2"}
_[6]={_[8]} _[6]={_[8]}
_[5]={_[7]} _[5]={_[7]}
_[4]={"return"} _[4]={"return"}

View file

@ -1,8 +1,8 @@
local _={} local _={}
_[10]={} _[10]={}
_[9]={} _[9]={}
_[8]={data="in interrupt: 5",tags=_[10]} _[8]={tags=_[10],data="in interrupt: 5"}
_[7]={data="before: 2",tags=_[9]} _[7]={tags=_[9],data="before: 2"}
_[6]={_[8]} _[6]={_[8]}
_[5]={_[7]} _[5]={_[7]}
_[4]={"return"} _[4]={"return"}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[6]={} _[6]={}
_[5]={data="before: 2",tags=_[6]} _[5]={tags=_[6],data="before: 2"}
_[4]={_[5]} _[4]={_[5]}
_[3]={"return",""} _[3]={"return",""}
_[2]={"wait",0} _[2]={"wait",0}

View file

@ -1,8 +1,8 @@
local _={} local _={}
_[9]={} _[9]={}
_[8]={} _[8]={}
_[7]={data="a.\240\159\145\129\239\184\143: 1",tags=_[9]} _[7]={tags=_[9],data="a.\240\159\145\129\239\184\143: 1"}
_[6]={data="a.\240\159\145\129\239\184\143: 0",tags=_[8]} _[6]={tags=_[8],data="a.\240\159\145\129\239\184\143: 0"}
_[5]={_[7]} _[5]={_[7]}
_[4]={_[6]} _[4]={_[6]}
_[3]={"return"} _[3]={"return"}

View file

@ -1,8 +1,8 @@
local _={} local _={}
_[7]={} _[7]={}
_[6]={} _[6]={}
_[5]={data="ok",tags=_[7]} _[5]={tags=_[7],data="ok"}
_[4]={data="a.\240\159\145\129\239\184\143: 0",tags=_[6]} _[4]={tags=_[6],data="a.\240\159\145\129\239\184\143: 0"}
_[3]={_[4],_[5]} _[3]={_[4],_[5]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="a.\240\159\145\129\239\184\143: 0",tags=_[5]} _[4]={tags=_[5],data="a.\240\159\145\129\239\184\143: 0"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -7,14 +7,14 @@ _[19]={}
_[18]={} _[18]={}
_[17]={} _[17]={}
_[16]={} _[16]={}
_[15]={data="b",tags=_[23]} _[15]={tags=_[23],data="b"}
_[14]={data="x",tags=_[22]} _[14]={tags=_[22],data="x"}
_[13]={data="Force no checkpoint:",tags=_[21]} _[13]={tags=_[21],data="Force no checkpoint:"}
_[12]={data="b",tags=_[20]} _[12]={tags=_[20],data="b"}
_[11]={data="a",tags=_[19]} _[11]={tags=_[19],data="a"}
_[10]={data="From checkpoint:",tags=_[18]} _[10]={tags=_[18],data="From checkpoint:"}
_[9]={data="a",tags=_[17]} _[9]={tags=_[17],data="a"}
_[8]={data="Force run checkpoint:",tags=_[16]} _[8]={tags=_[16],data="Force run checkpoint:"}
_[7]={_[13],_[14],_[15]} _[7]={_[13],_[14],_[15]}
_[6]={_[10],_[11],_[12]} _[6]={_[10],_[11],_[12]}
_[5]={_[8],_[9]} _[5]={_[8],_[9]}

View file

@ -8,15 +8,15 @@ _[20]={}
_[19]={} _[19]={}
_[18]={} _[18]={}
_[17]={} _[17]={}
_[16]={data="b",tags=_[25]} _[16]={tags=_[25],data="b"}
_[15]={data="x",tags=_[24]} _[15]={tags=_[24],data="x"}
_[14]={data="Force no checkpoint:",tags=_[23]} _[14]={tags=_[23],data="Force no checkpoint:"}
_[13]={data="b",tags=_[22]} _[13]={tags=_[22],data="b"}
_[12]={data="a",tags=_[21]} _[12]={tags=_[21],data="a"}
_[11]={data="From checkpoint:",tags=_[20]} _[11]={tags=_[20],data="From checkpoint:"}
_[10]={data="b",tags=_[19]} _[10]={tags=_[19],data="b"}
_[9]={data="a",tags=_[18]} _[9]={tags=_[18],data="a"}
_[8]={data="Force run from checkpoint:",tags=_[17]} _[8]={tags=_[17],data="Force run from checkpoint:"}
_[7]={_[14],_[15],_[16]} _[7]={_[14],_[15],_[16]}
_[6]={_[11],_[12],_[13]} _[6]={_[11],_[12],_[13]}
_[5]={_[8],_[9],_[10]} _[5]={_[8],_[9],_[10]}

View file

@ -8,15 +8,15 @@ _[20]={}
_[19]={} _[19]={}
_[18]={} _[18]={}
_[17]={} _[17]={}
_[16]={data="b",tags=_[25]} _[16]={tags=_[25],data="b"}
_[15]={data="x",tags=_[24]} _[15]={tags=_[24],data="x"}
_[14]={data="Force no checkpoint:",tags=_[23]} _[14]={tags=_[23],data="Force no checkpoint:"}
_[13]={data="b",tags=_[22]} _[13]={tags=_[22],data="b"}
_[12]={data="a",tags=_[21]} _[12]={tags=_[21],data="a"}
_[11]={data="From checkpoint:",tags=_[20]} _[11]={tags=_[20],data="From checkpoint:"}
_[10]={data="b",tags=_[19]} _[10]={tags=_[19],data="b"}
_[9]={data="x",tags=_[18]} _[9]={tags=_[18],data="x"}
_[8]={data="No checkpoint:",tags=_[17]} _[8]={tags=_[17],data="No checkpoint:"}
_[7]={_[14],_[15],_[16]} _[7]={_[14],_[15],_[16]}
_[6]={_[11],_[12],_[13]} _[6]={_[11],_[12],_[13]}
_[5]={_[8],_[9],_[10]} _[5]={_[8],_[9],_[10]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="b",tags=_[5]} _[4]={tags=_[5],data="b"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,7 +1,7 @@
local _={} local _={}
_[6]={1} _[6]={1}
_[5]={data="bar",tags=_[6]} _[5]={tags=_[6],data="bar"}
_[4]={data="foo",tags=_[6]} _[4]={tags=_[6],data="foo"}
_[3]={_[4],_[5]} _[3]={_[4],_[5]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -2,8 +2,8 @@ local _={}
_[8]={2,3} _[8]={2,3}
_[7]={1,a=_[8]} _[7]={1,a=_[8]}
_[6]={1} _[6]={1}
_[5]={data="bar",tags=_[7]} _[5]={tags=_[7],data="bar"}
_[4]={data="foo",tags=_[6]} _[4]={tags=_[6],data="foo"}
_[3]={_[4],_[5]} _[3]={_[4],_[5]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -2,8 +2,8 @@ local _={}
_[8]={2,3} _[8]={2,3}
_[7]={1,a=_[8]} _[7]={1,a=_[8]}
_[6]={1} _[6]={1}
_[5]={data="bar",tags=_[7]} _[5]={tags=_[7],data="bar"}
_[4]={data="foo",tags=_[6]} _[4]={tags=_[6],data="foo"}
_[3]={_[4],_[5]} _[3]={_[4],_[5]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,7 +1,7 @@
local _={} local _={}
_[6]={1} _[6]={1}
_[5]={data="bar",tags=_[6]} _[5]={tags=_[6],data="bar"}
_[4]={data="foo",tags=_[6]} _[4]={tags=_[6],data="foo"}
_[3]={_[4],_[5]} _[3]={_[4],_[5]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -2,8 +2,8 @@ local _={}
_[8]={2,3} _[8]={2,3}
_[7]={1,a=_[8]} _[7]={1,a=_[8]}
_[6]={1} _[6]={1}
_[5]={data="bar",tags=_[7]} _[5]={tags=_[7],data="bar"}
_[4]={data="foo",tags=_[6]} _[4]={tags=_[6],data="foo"}
_[3]={_[4],_[5]} _[3]={_[4],_[5]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,22 +0,0 @@
local _={}
_[9]={}
_[8]={}
_[7]={data="b c",tags=_[9]}
_[6]={data="a",tags=_[8]}
_[5]={_[7]}
_[4]={_[6]}
_[3]={"return"}
_[2]={"text",_[5]}
_[1]={"text",_[4]}
return {_[1],_[2],_[3]}
--[[
{ "text", { {
data = "a",
tags = {}
} } }
{ "text", { {
data = "b c",
tags = {}
} } }
{ "return" }
]]--

View file

@ -1,8 +1,8 @@
local _={} local _={}
_[7]={} _[7]={}
_[6]={} _[6]={}
_[5]={data="b c",tags=_[7]} _[5]={tags=_[7],data="b c"}
_[4]={data="a",tags=_[6]} _[4]={tags=_[6],data="a"}
_[3]={_[4],_[5]} _[3]={_[4],_[5]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,23 +1,22 @@
local _={} local _={}
_[9]={}
_[8]={} _[8]={}
_[7]={} _[7]={tags=_[9],data="b c"}
_[6]={data="b c",tags=_[8]} _[6]={tags=_[8],data="a"}
_[5]={data="a",tags=_[7]} _[5]={_[7]}
_[4]={type="string",value=""} _[4]={_[6]}
_[3]={_[5],_[6]} _[3]={"return"}
_[2]={"return",_[4]} _[2]={"text",_[5]}
_[1]={"text",_[3]} _[1]={"text",_[4]}
return {_[1],_[2]} return {_[1],_[2],_[3]}
--[[ --[[
{ "text", { { { "text", { {
data = "a", data = "a",
tags = {} tags = {}
}, { } } }
{ "text", { {
data = "b c", data = "b c",
tags = {} tags = {}
} } } } } }
{ "return", { { "return" }
type = "string",
value = ""
} }
]]-- ]]--

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="a: 5",tags=_[5]} _[4]={tags=_[5],data="a: 5"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -1,6 +1,6 @@
local _={} local _={}
_[5]={} _[5]={}
_[4]={data="a",tags=_[5]} _[4]={tags=_[5],data="a"}
_[3]={_[4]} _[3]={_[4]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}

View file

@ -4,11 +4,11 @@ _[12]={}
_[11]={} _[11]={}
_[10]={} _[10]={}
_[9]={} _[9]={}
_[8]={data="b",tags=_[13]} _[8]={tags=_[13],data="b"}
_[7]={data="a",tags=_[12]} _[7]={tags=_[12],data="a"}
_[6]={data="b",tags=_[11]} _[6]={tags=_[11],data="b"}
_[5]={data="seen only once",tags=_[10]} _[5]={tags=_[10],data="seen only once"}
_[4]={data="a",tags=_[9]} _[4]={tags=_[9],data="a"}
_[3]={_[4],_[5],_[6],_[7],_[8]} _[3]={_[4],_[5],_[6],_[7],_[8]}
_[2]={"return"} _[2]={"return"}
_[1]={"text",_[3]} _[1]={"text",_[3]}