diff options
Diffstat (limited to 'tex/context/base/mkiv/toks-scn.lua')
-rw-r--r-- | tex/context/base/mkiv/toks-scn.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/toks-scn.lua b/tex/context/base/mkiv/toks-scn.lua index f3781d022..fe32a1de4 100644 --- a/tex/context/base/mkiv/toks-scn.lua +++ b/tex/context/base/mkiv/toks-scn.lua @@ -21,6 +21,7 @@ local scanners = tokens.scanners local tokenbits = tokens.bits local scanstring = scanners.string +local scanargument = scanners.argument local scaninteger = scanners.integer local scannumber = scanners.number local scankeyword = scanners.keyword @@ -240,6 +241,19 @@ local f_check = formatters[ [[ end ]] ] +-- using these shortcuts saves temporary small tables (okay, it looks uglier) + +local presets = { + ["1 string" ] = { "string" }, + ["2 strings"] = { "string", "string" }, + ["3 strings"] = { "string", "string", "string" }, + ["4 strings"] = { "string", "string", "string", "string" }, + ["5 strings"] = { "string", "string", "string", "string", "string" }, + ["6 strings"] = { "string", "string", "string", "string", "string", "string" }, + ["7 strings"] = { "string", "string", "string", "string", "string", "string", "string" }, + ["8 strings"] = { "string", "string", "string", "string", "string", "string", "string", "string" }, +} + function tokens.compile(specification) local f = { } local n = 0 @@ -305,6 +319,10 @@ function tokens.compile(specification) return c end end + local p = t and presets[t] + if p then + t = p + end local tt = type(t) if tt == "string" then if a then |