summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-05-17 10:29:20 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-05-17 10:29:20 +0200
commitaf172a8db5f7583d0117635edde17eba5619d883 (patch)
tree50688f3516ce1a3e3d19922666d80101d473f124 /scripts
parentb344014638169aad6e5f6d2a9a703cb03a8b5064 (diff)
downloadcontext-af172a8db5f7583d0117635edde17eba5619d883.tar.gz
2016-05-17 10:11:00
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/lua/mtx-patterns.lua23
1 files changed, 12 insertions, 11 deletions
diff --git a/scripts/context/lua/mtx-patterns.lua b/scripts/context/lua/mtx-patterns.lua
index b3f5f5bb1..e8d4d3e65 100644
--- a/scripts/context/lua/mtx-patterns.lua
+++ b/scripts/context/lua/mtx-patterns.lua
@@ -9,7 +9,8 @@ if not modules then modules = { } end modules ['mtx-patterns'] = {
local format, find, concat, gsub, match, gmatch = string.format, string.find, table.concat, string.gsub, string.match, string.gmatch
local byte, char = utf.byte, utf.char
local addsuffix = file.addsuffix
-local lpegmatch, validutf8 = lpeg.match, lpeg.patterns.validutf8
+local lpegmatch, lpegsplit, lpegpatterns, validutf8 = lpeg.match, lpeg.split, lpeg.patterns, lpeg.patterns.validutf8
+local P, V, Cs = lpeg.P, lpeg.V, lpeg.Cs
local helpinfo = [[
<?xml version="1.0"?>
@@ -165,7 +166,7 @@ scripts.patterns.list = {
local utf = unicode.utf8
function utf.check(str)
- return lpeg.match(lpeg.patterns.validutf8,str)
+ return lpegmatch(lpegpatterns.validutf8,str)
end
-- *.tex
@@ -214,9 +215,9 @@ function scripts.patterns.load(path,name,mnemonic,ignored)
end
if okay then
-- split into lines
- local how = lpeg.patterns.whitespace^1
- splitpatternsnew = lpeg.split(how,patterns)
- splithyphenationsnew = lpeg.split(how,hyphenations)
+ local how = lpegpatterns.whitespace^1
+ splitpatternsnew = lpegsplit(how,patterns)
+ splithyphenationsnew = lpegsplit(how,hyphenations)
end
if okay then
-- remove comments
@@ -316,23 +317,23 @@ function scripts.patterns.load(path,name,mnemonic,ignored)
if ignored then
for k, v in next, ignored do
if p then
- p = p + lpeg.P(char(k))
+ p = p + P(char(k))
else
- p = lpeg.P(char(k))
+ p = P(char(k))
end
end
- p = lpeg.P{ p + 1 * lpeg.V(1) } -- anywhere
+ p = P{ p + 1 * V(1) } -- anywhere
end
-- replaced (all languages)
local r = nil
for k, v in next, replaced_whatever do
if r then
- r = r + lpeg.P(k)/v
+ r = r + P(k)/v
else
- r = lpeg.P(k)/v
+ r = P(k)/v
end
end
- r = lpeg.Cs((r + 1)^0)
+ r = Cs((r + 1)^0)
local result = { }
for i=1,#what do
local line = what[i]