summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/data-exp.lua
diff options
context:
space:
mode:
authorMojca Miklavec <mojca.miklavec@gmail.com>2012-05-23 23:07:14 +0000
committerMojca Miklavec <mojca.miklavec@gmail.com>2012-05-23 23:07:14 +0000
commitc54f51b46d82d7739231640fc5cea60593d1a5d4 (patch)
tree108c2b6e88c8d48f13d258b4b3c1275a82fa8085 /Master/texmf-dist/tex/context/base/data-exp.lua
parentb311cf9511f08f1a393e21095e362ca8f7e53a05 (diff)
ConTeXt 2012.05.23 23:31; should enable loading built-in TEXMFCNF
git-svn-id: svn://tug.org/texlive/trunk@26606 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/data-exp.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/data-exp.lua37
1 files changed, 32 insertions, 5 deletions
diff --git a/Master/texmf-dist/tex/context/base/data-exp.lua b/Master/texmf-dist/tex/context/base/data-exp.lua
index 52368f8a82e..1e323728c86 100644
--- a/Master/texmf-dist/tex/context/base/data-exp.lua
+++ b/Master/texmf-dist/tex/context/base/data-exp.lua
@@ -42,6 +42,16 @@ local function f_second(a,b)
return concat(t,",")
end
+-- 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
+-- n = n + 1 ; t[n] = sa .. sb
+-- end
+-- end
+-- return concat(t,",")
+-- end
+
local function f_both(a,b)
local t, n = { }, 0
for sa in gmatch(a,"[^,]+") do
@@ -52,6 +62,7 @@ local function f_both(a,b)
return concat(t,",")
end
+
local left = P("{")
local right = P("}")
local var = P((1 - S("{}" ))^0)
@@ -66,6 +77,9 @@ 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)
@@ -73,11 +87,24 @@ local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpeggi
local t, ok, done = newlist or { }, false, false
local n = #t
str = lpegmatch(replacer_1,str)
- repeat local old = str
- repeat local old = str ; str = lpegmatch(l_first, str) until old == str
- repeat local old = str ; str = lpegmatch(l_second,str) until old == str
- repeat local old = str ; str = lpegmatch(l_both, str) until old == str
- repeat local old = str ; str = lpegmatch(l_rest, str) until old == str
+ repeat
+ local old = str
+ repeat
+ local old = str
+ str = lpegmatch(l_first, str)
+ until old == str
+ repeat
+ local old = str
+ str = lpegmatch(l_second,str)
+ until old == str
+ repeat
+ local old = str
+ str = lpegmatch(l_both, str)
+ until old == str
+ repeat
+ local old = str
+ str = lpegmatch(l_rest, str)
+ until old == str
until old == str -- or not find(str,"{")
str = lpegmatch(stripper_1,str)
if validate then