diff options
author | Hans Hagen <pragma@wxs.nl> | 2012-05-24 09:57:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2012-05-24 09:57:00 +0200 |
commit | 5717e743b276322c25007e7e5bc84f4be6347abd (patch) | |
tree | 39d69b6741d566a69f2ecca956615411fcf0f128 /tex/context/base/data-exp.lua | |
parent | 9494d9dd118ab3202bcbc7f22cf787fb067afde8 (diff) | |
download | context-5717e743b276322c25007e7e5bc84f4be6347abd.tar.gz |
beta 2012.05.24 09:57
Diffstat (limited to 'tex/context/base/data-exp.lua')
-rw-r--r-- | tex/context/base/data-exp.lua | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tex/context/base/data-exp.lua b/tex/context/base/data-exp.lua index 1e323728c..19d4a9ec8 100644 --- a/tex/context/base/data-exp.lua +++ b/tex/context/base/data-exp.lua @@ -42,27 +42,30 @@ local function f_second(a,b) return concat(t,",") end +-- old {a,b}{c,d} => ac ad bc bd +-- -- local function f_both(a,b) -- local t, n = { }, 0 --- for sb in gmatch(b,"[^,]+") do -- and not sa --- for sa in gmatch(a,"[^,]+") do -- sb +-- for sa in gmatch(a,"[^,]+") do +-- for sb in gmatch(b,"[^,]+") do -- n = n + 1 ; t[n] = sa .. sb -- end -- end -- return concat(t,",") -- end +-- +-- new {a,b}{c,d} => ac bc ad bd local function f_both(a,b) local t, n = { }, 0 - for sa in gmatch(a,"[^,]+") do - for sb in gmatch(b,"[^,]+") do + for sb in gmatch(b,"[^,]+") do -- and not sa + for sa in gmatch(a,"[^,]+") do -- sb n = n + 1 ; t[n] = sa .. sb end end return concat(t,",") end - local left = P("{") local right = P("}") local var = P((1 - S("{}" ))^0) @@ -77,9 +80,6 @@ local l_rest = Cs( ( left * var * (left/"") * var * (right/"") * var * right local stripper_1 = lpeg.stripper ("{}@") local replacer_1 = lpeg.replacer { { ",}", ",@}" }, { "{,", "{@," }, } --- old {a,b}{c,d} => ac ad bc bd --- new {a,b}{c,d} => ac bc ad bd - local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpegging it (nice exercise). if trace_expansions then report_expansions("expanding variable '%s'",str) |