summaryrefslogtreecommitdiff
path: root/tex/context/base/l-lpeg.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/l-lpeg.lua')
-rw-r--r--tex/context/base/l-lpeg.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua
index 9fb22e1b5..25d48ee75 100644
--- a/tex/context/base/l-lpeg.lua
+++ b/tex/context/base/l-lpeg.lua
@@ -600,7 +600,7 @@ end
-- For the moment here, but it might move to utilities. Beware, we need to
-- have the longest keyword first, so 'aaa' comes beforte 'aa' which is why we
--- loop back from the end.
+-- loop back from the end cq. prepend.
local sort, fastcopy, sortedkeys = table.sort, table.fastcopy, table.sortedkeys -- dependency!
@@ -620,13 +620,13 @@ function lpeg.append(list,pp,delayed,checked)
elseif delayed then -- hm, it looks like the lpeg parser resolves anyway
local keys = sortedkeys(list)
if p then
- for i=#keys,1,-1 do
+ for i=1,#keys,1 do
local k = keys[i]
local v = list[k]
p = P(k)/list + p
end
else
- for i=#keys,1,-1 do
+ for i=1,#keys do
local k = keys[i]
local v = list[k]
if p then
@@ -642,7 +642,7 @@ function lpeg.append(list,pp,delayed,checked)
elseif checked then
-- problem: substitution gives a capture
local keys = sortedkeys(list)
- for i=#keys,1,-1 do
+ for i=1,#keys do
local k = keys[i]
local v = list[k]
if p then
@@ -661,7 +661,7 @@ function lpeg.append(list,pp,delayed,checked)
end
else
local keys = sortedkeys(list)
- for i=#keys,1,-1 do
+ for i=1,#keys do
local k = keys[i]
local v = list[k]
if p then
@@ -674,6 +674,9 @@ function lpeg.append(list,pp,delayed,checked)
return p
end
+-- inspect(lpeg.append({ a = "1", aa = "1", aaa = "1" } ,nil,true))
+-- inspect(lpeg.append({ ["degree celsius"] = "1", celsius = "1", degree = "1" } ,nil,true))
+
-- function lpeg.exact_match(words,case_insensitive)
-- local pattern = concat(words)
-- if case_insensitive then