summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/toks-scn.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/toks-scn.lua')
-rw-r--r--tex/context/base/mkiv/toks-scn.lua70
1 files changed, 37 insertions, 33 deletions
diff --git a/tex/context/base/mkiv/toks-scn.lua b/tex/context/base/mkiv/toks-scn.lua
index fe32a1de4..f73ecc86c 100644
--- a/tex/context/base/mkiv/toks-scn.lua
+++ b/tex/context/base/mkiv/toks-scn.lua
@@ -106,7 +106,40 @@ local function scanconditional()
return nil
end
+local function scantable(t,data)
+ if not data then
+ data = { }
+ end
+ local wrapped = scanopen()
+ while true do
+ local key = scanword()
+ if key then
+ local get = t[key]
+ if get then
+ data[key] = get()
+ else
+ -- catch all we can get
+ end
+ else
+ break
+ end
+ end
+ if wrapped then
+ scanclose()
+ end
+ return data
+end
+
+function tokens.constant(s)
+ if type(s) == "string" then
+ return "'" .. s .. "'"
+ else
+ return s
+ end
+end
+
scanners.list = scanlist
+scanners.table = scantable
scanners.conditional = scanconditional
local shortcuts = {
@@ -118,6 +151,7 @@ local shortcuts = {
scanstring = scanstring,
scaninteger = scaninteger,
scannumber = scannumber,
+ scantable = scantable,
scankeyword = scankeyword,
scankeywordcs = scankeywordcs,
scanword = scanword,
@@ -254,6 +288,8 @@ local presets = {
["8 strings"] = { "string", "string", "string", "string", "string", "string", "string", "string" },
}
+tokens.presets = presets
+
function tokens.compile(specification)
local f = { }
local n = 0
@@ -319,7 +355,7 @@ function tokens.compile(specification)
return c
end
end
- local p = t and presets[t]
+ local p = t and presets[t] -- already done in implement
if p then
t = p
end
@@ -460,35 +496,3 @@ end
-- }
--
-- os.exit()
-
-function tokens.scantable(t,data)
- if not data then
- data = { }
- end
- local wrapped = scanopen()
- while true do
- local key = scanword()
- if key then
- local get = t[key]
- if get then
- data[key] = get()
- else
- -- catch all we can get
- end
- else
- break
- end
- end
- if wrapped then
- scanclose()
- end
- return data
-end
-
-function tokens.constant(s)
- if type(s) == "string" then
- return "'" .. s .. "'"
- else
- return s
- end
-end