summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/l-lpeg.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-10-03 16:44:19 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2018-10-03 16:44:19 +0200
commit753dd0cbafc567d4960c5fc4888ccb4e2302c64d (patch)
tree6fe5c8e25d597f535b4c7d6b6d254445f79a1e6d /tex/context/base/mkiv/l-lpeg.lua
parent551c89289d267c2d8901f3375e57ed1fe2508de5 (diff)
downloadcontext-753dd0cbafc567d4960c5fc4888ccb4e2302c64d.tar.gz
2018-10-03 16:11:00
Diffstat (limited to 'tex/context/base/mkiv/l-lpeg.lua')
-rw-r--r--tex/context/base/mkiv/l-lpeg.lua20
1 files changed, 18 insertions, 2 deletions
diff --git a/tex/context/base/mkiv/l-lpeg.lua b/tex/context/base/mkiv/l-lpeg.lua
index 750d5e698..589fa2b0b 100644
--- a/tex/context/base/mkiv/l-lpeg.lua
+++ b/tex/context/base/mkiv/l-lpeg.lua
@@ -308,12 +308,28 @@ function lpeg.instringchecker(p)
end
end
+-- function lpeg.splitter(pattern, action)
+-- return (((1-P(pattern))^1)/action+1)^0
+-- end
+
+-- function lpeg.tsplitter(pattern, action)
+-- return Ct((((1-P(pattern))^1)/action+1)^0)
+-- end
+
function lpeg.splitter(pattern, action)
- return (((1-P(pattern))^1)/action+1)^0
+ if action then
+ return (((1-P(pattern))^1)/action+1)^0
+ else
+ return (Cs((1-P(pattern))^1)+1)^0
+ end
end
function lpeg.tsplitter(pattern, action)
- return Ct((((1-P(pattern))^1)/action+1)^0)
+ if action then
+ return Ct((((1-P(pattern))^1)/action+1)^0)
+ else
+ return Ct((Cs((1-P(pattern))^1)+1)^0)
+ end
end
-- probleem: separator can be lpeg and that does not hash too well, but