diff options
author | Marius <mariausol@gmail.com> | 2010-12-01 17:00:20 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2010-12-01 17:00:20 +0200 |
commit | 7ddd9fa6ca5b953fe385fa7ad464a408006bb993 (patch) | |
tree | 51f21910916292bfdc460ac076ef618ad79cb6b9 /tex/generic | |
parent | 43b3007b67e55a65c5853402b973b82352a795b0 (diff) | |
download | context-7ddd9fa6ca5b953fe385fa7ad464a408006bb993.tar.gz |
beta 2010.12.01 15:28
Diffstat (limited to 'tex/generic')
-rw-r--r-- | tex/generic/context/luatex-fonts-merged.lua | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 6897f2151..6224e159c 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 11/27/10 14:27:23 +-- merge date : 12/01/10 15:28:31 do -- begin closure to overcome local limits and interference @@ -86,7 +86,7 @@ local patterns_escapes = { ["."] = "%.", ["+"] = "%+", ["-"] = "%-", ["*"] = "%*", ["["] = "%[", ["]"] = "%]", - ["("] = "%)", [")"] = "%)", + ["("] = "%(", [")"] = "%)", -- ["{"] = "%{", ["}"] = "%}" -- ["^"] = "%^", ["$"] = "%$", } @@ -151,6 +151,7 @@ local patterns = lpeg.patterns local P, R, S, V, match = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.match local Ct, C, Cs, Cc, Cf, Cg = lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.Cf, lpeg.Cg +local lpegtype = lpeg.type local utfcharacters = string.utfcharacters local utfgmatch = unicode and unicode.utf8.gmatch @@ -167,7 +168,6 @@ patterns.alwaysmatched = alwaysmatched local digit, sign = R('09'), S('+-') local cr, lf, crlf = P("\r"), P("\n"), P("\r\n") local newline = crlf + cr + lf -local utf8next = R("\128\191") local escaped = P("\\") * anything local squote = P("'") local dquote = P('"') @@ -188,6 +188,8 @@ local utftype = utfbom_32_be / "utf-32-be" + utfbom_32_le / "utf-32-le + utfbom_16_be / "utf-16-be" + utfbom_16_le / "utf-16-le" + utfbom_8 / "utf-8" + alwaysmatched / "unknown" +local utf8next = R("\128\191") + patterns.utf8one = R("\000\127") patterns.utf8two = R("\194\223") * utf8next patterns.utf8three = R("\224\239") * utf8next * utf8next @@ -418,19 +420,25 @@ end -- Just for fun I looked at the used bytecode and -- p = (p and p + pp) or pp gets one more (testset). -function lpeg.replacer(t) - if #t > 0 then - local p - for i=1,#t do - local ti= t[i] - local pp = P(ti[1]) / ti[2] - if p then - p = p + pp - else - p = pp +function lpeg.replacer(one,two) + if type(one) == "table" then + local no = #one + if no > 0 then + local p + for i=1,no do + local o = one[i] + local pp = P(o[1]) / o[2] + if p then + p = p + pp + else + p = pp + end end + return Cs((p + 1)^0) end - return Cs((p + 1)^0) + else + two = two or "" + return Cs((P(one)/two + 1)^0) end end @@ -655,6 +663,10 @@ function lpeg.oneof(list,...) -- lpeg.oneof("elseif","else","if","then") return p end +function lpeg.is_lpeg(p) + return p and lpegtype(p) == "pattern" +end + end -- closure do -- begin closure to overcome local limits and interference @@ -2057,6 +2069,9 @@ local separator = P("://") local qualified = P(".")^0 * P("/") + letter*P(":") + letter^1*separator + letter^1 * P("/") local rootbased = P("/") + letter*P(":") +lpeg.patterns.qualified = qualified +lpeg.patterns.rootbased = rootbased + -- ./name ../name /name c: :// name/name function file.is_qualified_path(filename) |