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

Preserve tags in choices children

This commit is contained in:
Étienne Fildadut 2021-04-12 01:58:10 +02:00
parent b9c6d1d704
commit 5c3e9d2c5d
5 changed files with 134 additions and 30 deletions

View file

@ -0,0 +1,16 @@
$ f
# 42
> a
b
~ f
> c
~ choose(1)
# "k":"v"
~ f
> d
~ choose(1)
e
f

View file

@ -0,0 +1,69 @@
local _={}
_[26]={}
_[25]={k="v"}
_[24]={42,k="v"}
_[23]={}
_[22]={42}
_[21]={tags=_[26],data="f"}
_[20]={tags=_[25],data="e"}
_[19]={tags=_[24],data="b"}
_[18]={tags=_[25],data="d"}
_[17]={tags=_[24],data="a"}
_[16]={tags=_[22],data="b"}
_[15]={tags=_[23],data="c"}
_[14]={tags=_[22],data="a"}
_[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", { {
data = "a",
tags = { 42 }
}, {
data = "c",
tags = {}
} } }
{ "text", { {
data = "b",
tags = { 42 }
} } }
{ "choice", { {
data = "a",
tags = { 42,
k = "v"
}
}, {
data = "d",
tags = {
k = "v"
}
} } }
{ "text", { {
data = "b",
tags = { 42,
k = "v"
}
} } }
{ "text", { {
data = "e",
tags = {
k = "v"
}
} } }
{ "text", { {
data = "f",
tags = {}
} } }
{ "return" }
]]--