diff options
author | Luigi Scarso <luigi.scarso@gmail.com> | 2019-02-22 23:11:47 +0000 |
---|---|---|
committer | Luigi Scarso <luigi.scarso@gmail.com> | 2019-02-22 23:11:47 +0000 |
commit | 5c6357cdb820b4f628d036ba7b2248f221d50c0b (patch) | |
tree | 6365552f2737faaffe63a395272da242ee2c4f03 /Master/texmf-dist/tex/context/base/mkiv/toks-scn.lua | |
parent | b4568bc71e054f3d1fd6404b45d2322631778284 (diff) |
ConTeXt version 2019.02.22 19:35
git-svn-id: svn://tug.org/texlive/trunk@50086 c570f23f-e606-0410-a88d-b1316a301751
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, 37 insertions, 33 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 fe32a1de4d8..f73ecc86c50 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/toks-scn.lua +++ b/Master/texmf-dist/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 |