mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 16:49:31 +00:00
Fix scoping with mutable variables
This commit is contained in:
parent
16d0bb8d7a
commit
bb45cc8fdd
16 changed files with 1243 additions and 38 deletions
49
test/tests/scope checkpoint mutable bis error.ans
Normal file
49
test/tests/scope checkpoint mutable bis error.ans
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
:post run = "check"
|
||||
|
||||
:x = [99]
|
||||
|
||||
:l = [1,x]
|
||||
|
||||
:n = 0
|
||||
|
||||
$ f(t)
|
||||
~ t!insert(len(l)+1)
|
||||
|
||||
f1: {l} {t}
|
||||
|
||||
CHECK
|
||||
§ c
|
||||
|
||||
~ n < 1
|
||||
REC
|
||||
|
||||
~ n += 1
|
||||
~ f(t)
|
||||
|
||||
END REC
|
||||
|
||||
f2: {l}
|
||||
|
||||
CHECK 2
|
||||
§ d
|
||||
|
||||
~ t!insert(len(t)+1)
|
||||
|
||||
~ t(2)!insert(len(l)+1)
|
||||
|
||||
~ error("t")
|
||||
|
||||
f3: {l} {t}
|
||||
|
||||
~ f(l)
|
||||
|
||||
FINAL
|
||||
|
||||
l: {l}
|
||||
|
||||
x: {x}
|
||||
|
||||
$ check
|
||||
AFTER ERROR
|
||||
|
||||
l: {l}
|
||||
120
test/tests/scope checkpoint mutable bis error.lua
Normal file
120
test/tests/scope checkpoint mutable bis error.lua
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
local _={}
|
||||
_[54]={}
|
||||
_[53]={}
|
||||
_[52]={}
|
||||
_[51]={}
|
||||
_[50]={}
|
||||
_[49]={}
|
||||
_[48]={}
|
||||
_[47]={}
|
||||
_[46]={}
|
||||
_[45]={}
|
||||
_[44]={}
|
||||
_[43]={}
|
||||
_[42]={}
|
||||
_[41]={}
|
||||
_[40]={}
|
||||
_[39]={}
|
||||
_[38]={}
|
||||
_[37]={text="[1, [99], 3, 4]",tags=_[54]}
|
||||
_[36]={text="l: ",tags=_[53]}
|
||||
_[35]={text="AFTER ERROR",tags=_[52]}
|
||||
_[34]={text="CHECK 2",tags=_[51]}
|
||||
_[33]={text="[1, [99], 3, 4]",tags=_[50]}
|
||||
_[32]={text="f2: ",tags=_[49]}
|
||||
_[31]={text="CHECK",tags=_[48]}
|
||||
_[30]={text="[1, [99], 3, 4]",tags=_[47]}
|
||||
_[29]={text=" ",tags=_[46]}
|
||||
_[28]={text="[1, [99], 3, 4]",tags=_[45]}
|
||||
_[27]={text="f1: ",tags=_[44]}
|
||||
_[26]={text="REC",tags=_[43]}
|
||||
_[25]={text="CHECK",tags=_[42]}
|
||||
_[24]={text="[1, [99], 3]",tags=_[41]}
|
||||
_[23]={text=" ",tags=_[40]}
|
||||
_[22]={text="[1, [99], 3]",tags=_[39]}
|
||||
_[21]={text="f1: ",tags=_[38]}
|
||||
_[20]={_[36],_[37]}
|
||||
_[19]={_[35]}
|
||||
_[18]={_[34]}
|
||||
_[17]={_[32],_[33]}
|
||||
_[16]={_[31]}
|
||||
_[15]={_[27],_[28],_[29],_[30]}
|
||||
_[14]={_[26]}
|
||||
_[13]={_[25]}
|
||||
_[12]={_[21],_[22],_[23],_[24]}
|
||||
_[11]={"return"}
|
||||
_[10]={"text",_[20]}
|
||||
_[9]={"text",_[19]}
|
||||
_[8]={"error","t; in Lua function \"error\"; at test/tests/scope checkpoint mutable bis error.ans:34; at test/tests/scope checkpoint mutable bis error.ans:21; at test/tests/scope checkpoint mutable bis error.ans:38"}
|
||||
_[7]={"text",_[18]}
|
||||
_[6]={"text",_[17]}
|
||||
_[5]={"text",_[16]}
|
||||
_[4]={"text",_[15]}
|
||||
_[3]={"text",_[14]}
|
||||
_[2]={"text",_[13]}
|
||||
_[1]={"text",_[12]}
|
||||
return {_[1],_[2],_[3],_[4],_[5],_[6],_[7],_[8],_[9],_[10],_[11]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f1: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "REC"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f1: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3, 4]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3, 4]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f2: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3, 4]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK 2"
|
||||
} } }
|
||||
{ "error", 't; in Lua function "error"; at test/tests/scope checkpoint mutable bis error.ans:34; at test/tests/scope checkpoint mutable bis error.ans:21; at test/tests/scope checkpoint mutable bis error.ans:38' }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "AFTER ERROR"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "l: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3, 4]"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
40
test/tests/scope checkpoint mutable bis.ans
Normal file
40
test/tests/scope checkpoint mutable bis.ans
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
:x = [99]
|
||||
|
||||
:l = [1,x]
|
||||
|
||||
:n = 0
|
||||
|
||||
$ f(t)
|
||||
~ t!insert(len(l)+1)
|
||||
|
||||
f1: {l} {t}
|
||||
|
||||
CHECK
|
||||
§ c
|
||||
|
||||
~ n < 1
|
||||
REC
|
||||
|
||||
~ n += 1
|
||||
~ f(t)
|
||||
|
||||
END REC
|
||||
|
||||
f2: {l}
|
||||
|
||||
CHECK 2
|
||||
§ d
|
||||
|
||||
~ t!insert(len(t)+1)
|
||||
|
||||
~ t(2)!insert(len(l)+1)
|
||||
|
||||
f3: {l} {t}
|
||||
|
||||
~ f(l)
|
||||
|
||||
FINAL
|
||||
|
||||
l: {l}
|
||||
|
||||
x: {x}
|
||||
206
test/tests/scope checkpoint mutable bis.lua
Normal file
206
test/tests/scope checkpoint mutable bis.lua
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
local _={}
|
||||
_[93]={}
|
||||
_[92]={}
|
||||
_[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]={}
|
||||
_[64]={}
|
||||
_[63]={}
|
||||
_[62]={tags=_[93],text="[99, 6, 7]"}
|
||||
_[61]={tags=_[92],text="x: "}
|
||||
_[60]={tags=_[91],text="[1, [99, 6, 7], 3, 4, 5, 6]"}
|
||||
_[59]={tags=_[90],text="l: "}
|
||||
_[58]={tags=_[89],text="FINAL"}
|
||||
_[57]={tags=_[88],text="[1, [99, 6, 7], 3, 4, 5, 6]"}
|
||||
_[56]={tags=_[87],text=" "}
|
||||
_[55]={tags=_[86],text="[1, [99, 6, 7], 3, 4, 5, 6]"}
|
||||
_[54]={tags=_[85],text="f3: "}
|
||||
_[53]={tags=_[84],text="CHECK 2"}
|
||||
_[52]={tags=_[83],text="[1, [99, 6], 3, 4, 5]"}
|
||||
_[51]={tags=_[82],text="f2: "}
|
||||
_[50]={tags=_[81],text="END REC"}
|
||||
_[49]={tags=_[80],text="[1, [99, 6], 3, 4, 5]"}
|
||||
_[48]={tags=_[79],text=" "}
|
||||
_[47]={tags=_[78],text="[1, [99, 6], 3, 4, 5]"}
|
||||
_[46]={tags=_[77],text="f3: "}
|
||||
_[45]={tags=_[76],text="CHECK 2"}
|
||||
_[44]={tags=_[75],text="[1, [99], 3, 4]"}
|
||||
_[43]={tags=_[74],text="f2: "}
|
||||
_[42]={tags=_[73],text="CHECK"}
|
||||
_[41]={tags=_[72],text="[1, [99], 3, 4]"}
|
||||
_[40]={tags=_[71],text=" "}
|
||||
_[39]={tags=_[70],text="[1, [99], 3, 4]"}
|
||||
_[38]={tags=_[69],text="f1: "}
|
||||
_[37]={tags=_[68],text="REC"}
|
||||
_[36]={tags=_[67],text="CHECK"}
|
||||
_[35]={tags=_[66],text="[1, [99], 3]"}
|
||||
_[34]={tags=_[65],text=" "}
|
||||
_[33]={tags=_[64],text="[1, [99], 3]"}
|
||||
_[32]={tags=_[63],text="f1: "}
|
||||
_[31]={_[61],_[62]}
|
||||
_[30]={_[59],_[60]}
|
||||
_[29]={_[58]}
|
||||
_[28]={_[54],_[55],_[56],_[57]}
|
||||
_[27]={_[53]}
|
||||
_[26]={_[51],_[52]}
|
||||
_[25]={_[50]}
|
||||
_[24]={_[46],_[47],_[48],_[49]}
|
||||
_[23]={_[45]}
|
||||
_[22]={_[43],_[44]}
|
||||
_[21]={_[42]}
|
||||
_[20]={_[38],_[39],_[40],_[41]}
|
||||
_[19]={_[37]}
|
||||
_[18]={_[36]}
|
||||
_[17]={_[32],_[33],_[34],_[35]}
|
||||
_[16]={"return"}
|
||||
_[15]={"text",_[31]}
|
||||
_[14]={"text",_[30]}
|
||||
_[13]={"text",_[29]}
|
||||
_[12]={"text",_[28]}
|
||||
_[11]={"text",_[27]}
|
||||
_[10]={"text",_[26]}
|
||||
_[9]={"text",_[25]}
|
||||
_[8]={"text",_[24]}
|
||||
_[7]={"text",_[23]}
|
||||
_[6]={"text",_[22]}
|
||||
_[5]={"text",_[21]}
|
||||
_[4]={"text",_[20]}
|
||||
_[3]={"text",_[19]}
|
||||
_[2]={"text",_[18]}
|
||||
_[1]={"text",_[17]}
|
||||
return {_[1],_[2],_[3],_[4],_[5],_[6],_[7],_[8],_[9],_[10],_[11],_[12],_[13],_[14],_[15],_[16]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f1: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "REC"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f1: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3, 4]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3, 4]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f2: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3, 4]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK 2"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f3: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99, 6], 3, 4, 5]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99, 6], 3, 4, 5]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "END REC"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f2: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99, 6], 3, 4, 5]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK 2"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f3: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99, 6, 7], 3, 4, 5, 6]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99, 6, 7], 3, 4, 5, 6]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "FINAL"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "l: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99, 6, 7], 3, 4, 5, 6]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "x: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[99, 6, 7]"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
38
test/tests/scope checkpoint mutable error.ans
Normal file
38
test/tests/scope checkpoint mutable error.ans
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
:post run = "check"
|
||||
|
||||
:l = [1]
|
||||
|
||||
:n = 0
|
||||
|
||||
$ f(t)
|
||||
~ t!insert(len(l)+1)
|
||||
|
||||
f1: {l} {t}
|
||||
|
||||
CHECK
|
||||
§ c
|
||||
|
||||
~ n < 1
|
||||
REC
|
||||
|
||||
~ n += 1
|
||||
~ f(t)
|
||||
|
||||
END REC
|
||||
|
||||
~ t!insert(len(t)+1)
|
||||
|
||||
~ error("t")
|
||||
|
||||
f2: {l}
|
||||
|
||||
~ f(l)
|
||||
|
||||
FINAL
|
||||
|
||||
l: {l}
|
||||
|
||||
$ check
|
||||
AFTER ERROR
|
||||
|
||||
l: {l}
|
||||
99
test/tests/scope checkpoint mutable error.lua
Normal file
99
test/tests/scope checkpoint mutable error.lua
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
local _={}
|
||||
_[44]={}
|
||||
_[43]={}
|
||||
_[42]={}
|
||||
_[41]={}
|
||||
_[40]={}
|
||||
_[39]={}
|
||||
_[38]={}
|
||||
_[37]={}
|
||||
_[36]={}
|
||||
_[35]={}
|
||||
_[34]={}
|
||||
_[33]={}
|
||||
_[32]={}
|
||||
_[31]={}
|
||||
_[30]={tags=_[44],text="[1, 2, 3]"}
|
||||
_[29]={tags=_[43],text="l: "}
|
||||
_[28]={tags=_[42],text="AFTER ERROR"}
|
||||
_[27]={tags=_[41],text="CHECK"}
|
||||
_[26]={tags=_[40],text="[1, 2, 3]"}
|
||||
_[25]={tags=_[39],text=" "}
|
||||
_[24]={tags=_[38],text="[1, 2, 3]"}
|
||||
_[23]={tags=_[37],text="f1: "}
|
||||
_[22]={tags=_[36],text="REC"}
|
||||
_[21]={tags=_[35],text="CHECK"}
|
||||
_[20]={tags=_[34],text="[1, 2]"}
|
||||
_[19]={tags=_[33],text=" "}
|
||||
_[18]={tags=_[32],text="[1, 2]"}
|
||||
_[17]={tags=_[31],text="f1: "}
|
||||
_[16]={_[29],_[30]}
|
||||
_[15]={_[28]}
|
||||
_[14]={_[27]}
|
||||
_[13]={_[23],_[24],_[25],_[26]}
|
||||
_[12]={_[22]}
|
||||
_[11]={_[21]}
|
||||
_[10]={_[17],_[18],_[19],_[20]}
|
||||
_[9]={"return"}
|
||||
_[8]={"text",_[16]}
|
||||
_[7]={"text",_[15]}
|
||||
_[6]={"error","t; in Lua function \"error\"; at test/tests/scope checkpoint mutable error.ans:25; at test/tests/scope checkpoint mutable error.ans:19; at test/tests/scope checkpoint mutable error.ans:29"}
|
||||
_[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", { {
|
||||
tags = {},
|
||||
text = "f1: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, 2]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, 2]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "REC"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f1: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, 2, 3]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, 2, 3]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK"
|
||||
} } }
|
||||
{ "error", 't; in Lua function "error"; at test/tests/scope checkpoint mutable error.ans:25; at test/tests/scope checkpoint mutable error.ans:19; at test/tests/scope checkpoint mutable error.ans:29' }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "AFTER ERROR"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "l: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, 2, 3]"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
51
test/tests/scope checkpoint mutable ter error.ans
Normal file
51
test/tests/scope checkpoint mutable ter error.ans
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
:post run = "check"
|
||||
|
||||
:x = [99]
|
||||
|
||||
:l = [1,x]
|
||||
|
||||
:n = 0
|
||||
|
||||
$ f(t)
|
||||
~ t!insert(len(l)+1)
|
||||
|
||||
f1: {l} {t}
|
||||
|
||||
CHECK
|
||||
§ c
|
||||
|
||||
~ n < 1
|
||||
REC
|
||||
|
||||
~ n += 1
|
||||
~ f(t)
|
||||
|
||||
END REC
|
||||
|
||||
~ x!insert(12)
|
||||
|
||||
f2: {l}
|
||||
|
||||
CHECK 2
|
||||
§ d
|
||||
|
||||
~ t!insert(len(t)+1)
|
||||
|
||||
~ t(2)!insert(len(l)+1)
|
||||
|
||||
~ error("t")
|
||||
|
||||
f3: {l} {t}
|
||||
|
||||
~ f(l)
|
||||
|
||||
FINAL
|
||||
|
||||
l: {l}
|
||||
|
||||
x: {x}
|
||||
|
||||
$ check
|
||||
AFTER ERROR
|
||||
|
||||
l: {l}
|
||||
120
test/tests/scope checkpoint mutable ter error.lua
Normal file
120
test/tests/scope checkpoint mutable ter error.lua
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
local _={}
|
||||
_[54]={}
|
||||
_[53]={}
|
||||
_[52]={}
|
||||
_[51]={}
|
||||
_[50]={}
|
||||
_[49]={}
|
||||
_[48]={}
|
||||
_[47]={}
|
||||
_[46]={}
|
||||
_[45]={}
|
||||
_[44]={}
|
||||
_[43]={}
|
||||
_[42]={}
|
||||
_[41]={}
|
||||
_[40]={}
|
||||
_[39]={}
|
||||
_[38]={}
|
||||
_[37]={text="[1, [99, 12], 3, 4]",tags=_[54]}
|
||||
_[36]={text="l: ",tags=_[53]}
|
||||
_[35]={text="AFTER ERROR",tags=_[52]}
|
||||
_[34]={text="CHECK 2",tags=_[51]}
|
||||
_[33]={text="[1, [99, 12], 3, 4]",tags=_[50]}
|
||||
_[32]={text="f2: ",tags=_[49]}
|
||||
_[31]={text="CHECK",tags=_[48]}
|
||||
_[30]={text="[1, [99], 3, 4]",tags=_[47]}
|
||||
_[29]={text=" ",tags=_[46]}
|
||||
_[28]={text="[1, [99], 3, 4]",tags=_[45]}
|
||||
_[27]={text="f1: ",tags=_[44]}
|
||||
_[26]={text="REC",tags=_[43]}
|
||||
_[25]={text="CHECK",tags=_[42]}
|
||||
_[24]={text="[1, [99], 3]",tags=_[41]}
|
||||
_[23]={text=" ",tags=_[40]}
|
||||
_[22]={text="[1, [99], 3]",tags=_[39]}
|
||||
_[21]={text="f1: ",tags=_[38]}
|
||||
_[20]={_[36],_[37]}
|
||||
_[19]={_[35]}
|
||||
_[18]={_[34]}
|
||||
_[17]={_[32],_[33]}
|
||||
_[16]={_[31]}
|
||||
_[15]={_[27],_[28],_[29],_[30]}
|
||||
_[14]={_[26]}
|
||||
_[13]={_[25]}
|
||||
_[12]={_[21],_[22],_[23],_[24]}
|
||||
_[11]={"return"}
|
||||
_[10]={"text",_[20]}
|
||||
_[9]={"text",_[19]}
|
||||
_[8]={"error","t; in Lua function \"error\"; at test/tests/scope checkpoint mutable ter error.ans:36; at test/tests/scope checkpoint mutable ter error.ans:21; at test/tests/scope checkpoint mutable ter error.ans:40"}
|
||||
_[7]={"text",_[18]}
|
||||
_[6]={"text",_[17]}
|
||||
_[5]={"text",_[16]}
|
||||
_[4]={"text",_[15]}
|
||||
_[3]={"text",_[14]}
|
||||
_[2]={"text",_[13]}
|
||||
_[1]={"text",_[12]}
|
||||
return {_[1],_[2],_[3],_[4],_[5],_[6],_[7],_[8],_[9],_[10],_[11]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f1: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "REC"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f1: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3, 4]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3, 4]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f2: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99, 12], 3, 4]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK 2"
|
||||
} } }
|
||||
{ "error", 't; in Lua function "error"; at test/tests/scope checkpoint mutable ter error.ans:36; at test/tests/scope checkpoint mutable ter error.ans:21; at test/tests/scope checkpoint mutable ter error.ans:40' }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "AFTER ERROR"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "l: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99, 12], 3, 4]"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
42
test/tests/scope checkpoint mutable ter.ans
Normal file
42
test/tests/scope checkpoint mutable ter.ans
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
:x = [99]
|
||||
|
||||
:l = [1,x]
|
||||
|
||||
:n = 0
|
||||
|
||||
$ f(t)
|
||||
~ t!insert(len(l)+1)
|
||||
|
||||
f1: {l} {t}
|
||||
|
||||
CHECK
|
||||
§ c
|
||||
|
||||
~ n < 1
|
||||
REC
|
||||
|
||||
~ n += 1
|
||||
~ f(t)
|
||||
|
||||
END REC
|
||||
|
||||
~ x!insert(12)
|
||||
|
||||
f2: {l}
|
||||
|
||||
CHECK 2
|
||||
§ d
|
||||
|
||||
~ t!insert(len(t)+1)
|
||||
|
||||
~ t(2)!insert(len(l)+1)
|
||||
|
||||
f3: {l} {t}
|
||||
|
||||
~ f(l)
|
||||
|
||||
FINAL
|
||||
|
||||
l: {l}
|
||||
|
||||
x: {x}
|
||||
206
test/tests/scope checkpoint mutable ter.lua
Normal file
206
test/tests/scope checkpoint mutable ter.lua
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
local _={}
|
||||
_[93]={}
|
||||
_[92]={}
|
||||
_[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]={}
|
||||
_[64]={}
|
||||
_[63]={}
|
||||
_[62]={tags=_[93],text="[99, 12, 6, 12, 7]"}
|
||||
_[61]={tags=_[92],text="x: "}
|
||||
_[60]={tags=_[91],text="[1, [99, 12, 6, 12, 7], 3, 4, 5, 6]"}
|
||||
_[59]={tags=_[90],text="l: "}
|
||||
_[58]={tags=_[89],text="FINAL"}
|
||||
_[57]={tags=_[88],text="[1, [99, 12, 6, 12, 7], 3, 4, 5, 6]"}
|
||||
_[56]={tags=_[87],text=" "}
|
||||
_[55]={tags=_[86],text="[1, [99, 12, 6, 12, 7], 3, 4, 5, 6]"}
|
||||
_[54]={tags=_[85],text="f3: "}
|
||||
_[53]={tags=_[84],text="CHECK 2"}
|
||||
_[52]={tags=_[83],text="[1, [99, 12, 6, 12], 3, 4, 5]"}
|
||||
_[51]={tags=_[82],text="f2: "}
|
||||
_[50]={tags=_[81],text="END REC"}
|
||||
_[49]={tags=_[80],text="[1, [99, 12, 6], 3, 4, 5]"}
|
||||
_[48]={tags=_[79],text=" "}
|
||||
_[47]={tags=_[78],text="[1, [99, 12, 6], 3, 4, 5]"}
|
||||
_[46]={tags=_[77],text="f3: "}
|
||||
_[45]={tags=_[76],text="CHECK 2"}
|
||||
_[44]={tags=_[75],text="[1, [99, 12], 3, 4]"}
|
||||
_[43]={tags=_[74],text="f2: "}
|
||||
_[42]={tags=_[73],text="CHECK"}
|
||||
_[41]={tags=_[72],text="[1, [99], 3, 4]"}
|
||||
_[40]={tags=_[71],text=" "}
|
||||
_[39]={tags=_[70],text="[1, [99], 3, 4]"}
|
||||
_[38]={tags=_[69],text="f1: "}
|
||||
_[37]={tags=_[68],text="REC"}
|
||||
_[36]={tags=_[67],text="CHECK"}
|
||||
_[35]={tags=_[66],text="[1, [99], 3]"}
|
||||
_[34]={tags=_[65],text=" "}
|
||||
_[33]={tags=_[64],text="[1, [99], 3]"}
|
||||
_[32]={tags=_[63],text="f1: "}
|
||||
_[31]={_[61],_[62]}
|
||||
_[30]={_[59],_[60]}
|
||||
_[29]={_[58]}
|
||||
_[28]={_[54],_[55],_[56],_[57]}
|
||||
_[27]={_[53]}
|
||||
_[26]={_[51],_[52]}
|
||||
_[25]={_[50]}
|
||||
_[24]={_[46],_[47],_[48],_[49]}
|
||||
_[23]={_[45]}
|
||||
_[22]={_[43],_[44]}
|
||||
_[21]={_[42]}
|
||||
_[20]={_[38],_[39],_[40],_[41]}
|
||||
_[19]={_[37]}
|
||||
_[18]={_[36]}
|
||||
_[17]={_[32],_[33],_[34],_[35]}
|
||||
_[16]={"return"}
|
||||
_[15]={"text",_[31]}
|
||||
_[14]={"text",_[30]}
|
||||
_[13]={"text",_[29]}
|
||||
_[12]={"text",_[28]}
|
||||
_[11]={"text",_[27]}
|
||||
_[10]={"text",_[26]}
|
||||
_[9]={"text",_[25]}
|
||||
_[8]={"text",_[24]}
|
||||
_[7]={"text",_[23]}
|
||||
_[6]={"text",_[22]}
|
||||
_[5]={"text",_[21]}
|
||||
_[4]={"text",_[20]}
|
||||
_[3]={"text",_[19]}
|
||||
_[2]={"text",_[18]}
|
||||
_[1]={"text",_[17]}
|
||||
return {_[1],_[2],_[3],_[4],_[5],_[6],_[7],_[8],_[9],_[10],_[11],_[12],_[13],_[14],_[15],_[16]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f1: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "REC"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f1: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3, 4]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99], 3, 4]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f2: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99, 12], 3, 4]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK 2"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f3: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99, 12, 6], 3, 4, 5]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99, 12, 6], 3, 4, 5]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "END REC"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f2: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99, 12, 6, 12], 3, 4, 5]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK 2"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f3: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99, 12, 6, 12, 7], 3, 4, 5, 6]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99, 12, 6, 12, 7], 3, 4, 5, 6]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "FINAL"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "l: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, [99, 12, 6, 12, 7], 3, 4, 5, 6]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "x: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[99, 12, 6, 12, 7]"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
29
test/tests/scope checkpoint mutable.ans
Normal file
29
test/tests/scope checkpoint mutable.ans
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
:l = [1]
|
||||
|
||||
:n = 0
|
||||
|
||||
$ f(t)
|
||||
~ t!insert(len(l)+1)
|
||||
|
||||
f1: {l} {t}
|
||||
|
||||
CHECK
|
||||
§ c
|
||||
|
||||
~ n < 1
|
||||
REC
|
||||
|
||||
~ n += 1
|
||||
~ f(t)
|
||||
|
||||
END REC
|
||||
|
||||
~ t!insert(len(t)+1)
|
||||
|
||||
f2: {l}
|
||||
|
||||
~ f(l)
|
||||
|
||||
FINAL
|
||||
|
||||
l: {l}
|
||||
131
test/tests/scope checkpoint mutable.lua
Normal file
131
test/tests/scope checkpoint mutable.lua
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
local _={}
|
||||
_[59]={}
|
||||
_[58]={}
|
||||
_[57]={}
|
||||
_[56]={}
|
||||
_[55]={}
|
||||
_[54]={}
|
||||
_[53]={}
|
||||
_[52]={}
|
||||
_[51]={}
|
||||
_[50]={}
|
||||
_[49]={}
|
||||
_[48]={}
|
||||
_[47]={}
|
||||
_[46]={}
|
||||
_[45]={}
|
||||
_[44]={}
|
||||
_[43]={}
|
||||
_[42]={}
|
||||
_[41]={}
|
||||
_[40]={text="[1, 2, 3, 4, 5]",tags=_[59]}
|
||||
_[39]={text="l: ",tags=_[58]}
|
||||
_[38]={text="FINAL",tags=_[57]}
|
||||
_[37]={text="[1, 2, 3, 4, 5]",tags=_[56]}
|
||||
_[36]={text="f2: ",tags=_[55]}
|
||||
_[35]={text="END REC",tags=_[54]}
|
||||
_[34]={text="[1, 2, 3, 4]",tags=_[53]}
|
||||
_[33]={text="f2: ",tags=_[52]}
|
||||
_[32]={text="CHECK",tags=_[51]}
|
||||
_[31]={text="[1, 2, 3]",tags=_[50]}
|
||||
_[30]={text=" ",tags=_[49]}
|
||||
_[29]={text="[1, 2, 3]",tags=_[48]}
|
||||
_[28]={text="f1: ",tags=_[47]}
|
||||
_[27]={text="REC",tags=_[46]}
|
||||
_[26]={text="CHECK",tags=_[45]}
|
||||
_[25]={text="[1, 2]",tags=_[44]}
|
||||
_[24]={text=" ",tags=_[43]}
|
||||
_[23]={text="[1, 2]",tags=_[42]}
|
||||
_[22]={text="f1: ",tags=_[41]}
|
||||
_[21]={_[39],_[40]}
|
||||
_[20]={_[38]}
|
||||
_[19]={_[36],_[37]}
|
||||
_[18]={_[35]}
|
||||
_[17]={_[33],_[34]}
|
||||
_[16]={_[32]}
|
||||
_[15]={_[28],_[29],_[30],_[31]}
|
||||
_[14]={_[27]}
|
||||
_[13]={_[26]}
|
||||
_[12]={_[22],_[23],_[24],_[25]}
|
||||
_[11]={"return"}
|
||||
_[10]={"text",_[21]}
|
||||
_[9]={"text",_[20]}
|
||||
_[8]={"text",_[19]}
|
||||
_[7]={"text",_[18]}
|
||||
_[6]={"text",_[17]}
|
||||
_[5]={"text",_[16]}
|
||||
_[4]={"text",_[15]}
|
||||
_[3]={"text",_[14]}
|
||||
_[2]={"text",_[13]}
|
||||
_[1]={"text",_[12]}
|
||||
return {_[1],_[2],_[3],_[4],_[5],_[6],_[7],_[8],_[9],_[10],_[11]}
|
||||
--[[
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f1: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, 2]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, 2]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "REC"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f1: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, 2, 3]"
|
||||
}, {
|
||||
tags = {},
|
||||
text = " "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, 2, 3]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "CHECK"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f2: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, 2, 3, 4]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "END REC"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "f2: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, 2, 3, 4, 5]"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "FINAL"
|
||||
} } }
|
||||
{ "text", { {
|
||||
tags = {},
|
||||
text = "l: "
|
||||
}, {
|
||||
tags = {},
|
||||
text = "[1, 2, 3, 4, 5]"
|
||||
} } }
|
||||
{ "return" }
|
||||
]]--
|
||||
Loading…
Add table
Add a link
Reference in a new issue