diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/toks-scn.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/toks-scn.lua | 70 |
1 files changed, 33 insertions, 37 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/toks-scn.lua b/Master/texmf-dist/tex/context/base/mkiv/toks-scn.lua index f73ecc86c50..fe32a1de4d8 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/toks-scn.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/toks-scn.lua @@ -106,40 +106,7 @@ 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 = { @@ -151,7 +118,6 @@ local shortcuts = { scanstring = scanstring, scaninteger = scaninteger, scannumber = scannumber, - scantable = scantable, scankeyword = scankeyword, scankeywordcs = scankeywordcs, scanword = scanword, @@ -288,8 +254,6 @@ local presets = { ["8 strings"] = { "string", "string", "string", "string", "string", "string", "string", "string" }, } -tokens.presets = presets - function tokens.compile(specification) local f = { } local n = 0 @@ -355,7 +319,7 @@ function tokens.compile(specification) return c end end - local p = t and presets[t] -- already done in implement + local p = t and presets[t] if p then t = p end @@ -496,3 +460,35 @@ 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 |