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

Add list assignment operators

This commit is contained in:
Étienne Fildadut 2021-04-25 19:10:37 +02:00
parent b93061143c
commit 4b139019c9
7 changed files with 179 additions and 2 deletions

View file

@ -0,0 +1,20 @@
:[1,2] x
{x}
{x(1) := 3}
{x}
{x("foo") := "a"}
{x}
{x("bar") := "b"}
{x}
{x("foo") := "c"}
{x}

View file

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

View file

@ -0,0 +1,10 @@
$ f(l...)
~ l.len
:0 a
~ a := l(1)
~ l.remove(1)
@a + f(l=l)
~~
@0
{f(1,2,3,4,5)}

View file

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