diff options
author | Karl Berry <karl@freefriends.org> | 2013-04-08 00:43:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-04-08 00:43:40 +0000 |
commit | 824f7b0903de8ad7f6ee3d7656005e4c59155e06 (patch) | |
tree | abfc8673ef9916f3ab7074e811207384c301492b /Master/texmf-dist/tex/context/base/util-seq.lua | |
parent | 689aefb0727676ed3cddf331337b4be226495e72 (diff) |
context import for TL13, from www.pragma-ade.com/context/beta/cont-tmf.zip
git-svn-id: svn://tug.org/texlive/trunk@29731 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/util-seq.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/util-seq.lua | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Master/texmf-dist/tex/context/base/util-seq.lua b/Master/texmf-dist/tex/context/base/util-seq.lua index c3361b7be9e..27f95f0eeed 100644 --- a/Master/texmf-dist/tex/context/base/util-seq.lua +++ b/Master/texmf-dist/tex/context/base/util-seq.lua @@ -18,7 +18,7 @@ use locals to refer to them when compiling the chain.</p> -- todo: protect groups (as in tasks) local format, gsub, concat, gmatch = string.format, string.gsub, table.concat, string.gmatch -local type, loadstring = type, loadstring +local type, load = type, load utilities = utilities or { } local tables = utilities.tables @@ -235,6 +235,7 @@ local function construct(t) t.compiled = format("%s\nreturn function(%s)\n%s\nend",variables,arguments,calls) end end +-- print(t.compiled) return t.compiled -- also stored so that we can trace end @@ -257,7 +258,7 @@ compile = function(t,compiler,n) -- already referred to in sequencers.new if compiled == "" then runner = false else - runner = compiled and loadstring(compiled)() + runner = compiled and load(compiled)() -- we can use loadstripped here end t.runner = runner return runner @@ -273,7 +274,7 @@ sequencers.compile = compile -- todo: use sequencer (can have arguments and returnvalues etc now) -local template = [[ +local template_yes = [[ %s return function(head%s) local ok, done = false, false @@ -281,6 +282,11 @@ return function(head%s) return head, done end]] +local template_nop = [[ +return function() + return false, false +end]] + function sequencers.nodeprocessor(t,nofarguments) -- todo: handle 'kind' in plug into tostring local list, order, kind, gskip, askip = t.list, t.order, t.kind, t.gskip, t.askip local vars, calls, args, n = { }, { }, nil, 0 @@ -319,7 +325,6 @@ function sequencers.nodeprocessor(t,nofarguments) -- todo: handle 'kind' in plug end end end - local processor = format(template,concat(vars,"\n"),args,concat(calls,"\n")) - -- print(processor) + local processor = #calls > 0 and format(template_yes,concat(vars,"\n"),args,concat(calls,"\n")) or template_nop return processor end |