1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 08:39:30 +00:00
anselme/test/tests/resume from paragraph with nested choice.lua
Étienne Reuh Fildadut 64bc85741a Changed a few things
- Bumped to 0.15.0
- Add boot script
- Change variable definition syntax, using a = to distinguish more cleary between identifier and value
- Variables initial values are evaluated on first use instead of at parsing time
- Error on variable redefinition. Means you should make sure to load saves after your scripts.
- Improve string parsing, support for escape codes
- Remove support for number literals with empty decimal part (42. for 42.0) as there's no distinction in Anselme and it conflicts with .function call suffix
- Changed priority of : pair operator
- Add type type, and type annotations to variables and function parameters
- Change Lua function system to use regular Anselme functions
  - Defining a function from Lua is now way simpler and require providing a full Anselme function signature
- Change Anselme function system
  - Dynamic dispatch, based on arity, type annotation and parameter names. Will select the most specific function at runtime.
  - Define way to overload most operators
  - Allow custom type to text formatters
  - Allow assignment to custom functions
  - Index operator ( renamed to ()
  - Functions with parameters each have their own private namespace (scoping ersatz)
  - Internal: "custom"-mode operators now have their own expression AST type instead of cluttering the function system
- Remove static type checker as it is barely useful with new function system. May or may not rewrite one in the future.
- Improve error messages here and there
- Internal: cleaning
2021-06-03 15:29:25 +02:00

253 lines
No EOL
4.4 KiB
Lua

local _={}
_[118]={}
_[117]={}
_[116]={}
_[115]={}
_[114]={}
_[113]={}
_[112]={}
_[111]={}
_[110]={}
_[109]={}
_[108]={}
_[107]={}
_[106]={}
_[105]={}
_[104]={}
_[103]={}
_[102]={}
_[101]={}
_[100]={}
_[99]={}
_[98]={}
_[97]={}
_[96]={}
_[95]={}
_[94]={}
_[93]={}
_[92]={}
_[91]={}
_[90]={}
_[89]={}
_[88]={}
_[87]={}
_[86]={data="c",tags=_[118]}
_[85]={data="b",tags=_[117]}
_[84]={data="a",tags=_[116]}
_[83]={data="-> aa",tags=_[115]}
_[82]={data="ab",tags=_[114]}
_[81]={data="aa",tags=_[113]}
_[80]={data="-> aa",tags=_[112]}
_[79]={data="ab",tags=_[112]}
_[78]={data="aa",tags=_[112]}
_[77]={data="-> a",tags=_[112]}
_[76]={data="c",tags=_[111]}
_[75]={data="b",tags=_[110]}
_[74]={data="a",tags=_[109]}
_[73]={data="-> c",tags=_[108]}
_[72]={data="c",tags=_[107]}
_[71]={data="autoflush",tags=_[106]}
_[70]={data="-> ab",tags=_[105]}
_[69]={data="ab",tags=_[104]}
_[68]={data="aa",tags=_[103]}
_[67]={data="-> c",tags=_[102]}
_[66]={data="c",tags=_[101]}
_[65]={data="autoflush",tags=_[100]}
_[64]={data="-> b",tags=_[99]}
_[63]={data="b",tags=_[98]}
_[62]={data="a",tags=_[97]}
_[61]={data="-> c",tags=_[96]}
_[60]={data="c",tags=_[95]}
_[59]={data="-> ab",tags=_[94]}
_[58]={data="ab",tags=_[93]}
_[57]={data="aa",tags=_[92]}
_[56]={data="-> c",tags=_[91]}
_[55]={data="c",tags=_[90]}
_[54]={data="-> b",tags=_[89]}
_[53]={data="b",tags=_[88]}
_[52]={data="a",tags=_[87]}
_[51]={_[84],_[85],_[86]}
_[50]={_[83]}
_[49]={_[81],_[82]}
_[48]={_[80]}
_[47]={_[78],_[79]}
_[46]={_[77]}
_[45]={_[74],_[75],_[76]}
_[44]={_[73]}
_[43]={_[72]}
_[42]={_[71]}
_[41]={_[70]}
_[40]={_[68],_[69]}
_[39]={_[67]}
_[38]={_[66]}
_[37]={_[65]}
_[36]={_[64]}
_[35]={_[62],_[63]}
_[34]={_[61]}
_[33]={_[60]}
_[32]={_[59]}
_[31]={_[57],_[58]}
_[30]={_[56]}
_[29]={_[55]}
_[28]={_[54]}
_[27]={_[52],_[53]}
_[26]={"error","invalid choice"}
_[25]={"choice",_[51]}
_[24]={"text",_[50]}
_[23]={"choice",_[49]}
_[22]={"text",_[48]}
_[21]={"choice",_[47]}
_[20]={"text",_[46]}
_[19]={"choice",_[45]}
_[18]={"text",_[44]}
_[17]={"choice",_[43]}
_[16]={"text",_[42]}
_[15]={"text",_[41]}
_[14]={"choice",_[40]}
_[13]={"text",_[39]}
_[12]={"choice",_[38]}
_[11]={"text",_[37]}
_[10]={"text",_[36]}
_[9]={"choice",_[35]}
_[8]={"text",_[34]}
_[7]={"choice",_[33]}
_[6]={"text",_[32]}
_[5]={"choice",_[31]}
_[4]={"text",_[30]}
_[3]={"choice",_[29]}
_[2]={"text",_[28]}
_[1]={"choice",_[27]}
return {_[1],_[2],_[3],_[4],_[5],_[6],_[7],_[8],_[9],_[10],_[11],_[12],_[13],_[14],_[15],_[16],_[17],_[18],_[19],_[20],_[21],_[22],_[23],_[24],_[25],_[26]}
--[[
{ "choice", { {
data = "a",
tags = {}
}, {
data = "b",
tags = {}
} } }
{ "text", { {
data = "-> b",
tags = {}
} } }
{ "choice", { {
data = "c",
tags = {}
} } }
{ "text", { {
data = "-> c",
tags = {}
} } }
{ "choice", { {
data = "aa",
tags = {}
}, {
data = "ab",
tags = {}
} } }
{ "text", { {
data = "-> ab",
tags = {}
} } }
{ "choice", { {
data = "c",
tags = {}
} } }
{ "text", { {
data = "-> c",
tags = {}
} } }
{ "choice", { {
data = "a",
tags = {}
}, {
data = "b",
tags = {}
} } }
{ "text", { {
data = "-> b",
tags = {}
} } }
{ "text", { {
data = "autoflush",
tags = {}
} } }
{ "choice", { {
data = "c",
tags = {}
} } }
{ "text", { {
data = "-> c",
tags = {}
} } }
{ "choice", { {
data = "aa",
tags = {}
}, {
data = "ab",
tags = {}
} } }
{ "text", { {
data = "-> ab",
tags = {}
} } }
{ "text", { {
data = "autoflush",
tags = {}
} } }
{ "choice", { {
data = "c",
tags = {}
} } }
{ "text", { {
data = "-> c",
tags = {}
} } }
{ "choice", { {
data = "a",
tags = {}
}, {
data = "b",
tags = {}
}, {
data = "c",
tags = {}
} } }
{ "text", { {
data = "-> a",
tags = {}
} } }
{ "choice", { {
data = "aa",
tags = <1>{}
}, {
data = "ab",
tags = <table 1>
} } }
{ "text", { {
data = "-> aa",
tags = {}
} } }
{ "choice", { {
data = "aa",
tags = {}
}, {
data = "ab",
tags = {}
} } }
{ "text", { {
data = "-> aa",
tags = {}
} } }
{ "choice", { {
data = "a",
tags = {}
}, {
data = "b",
tags = {}
}, {
data = "c",
tags = {}
} } }
{ "error", "invalid choice" }
]]--