From 3fcaa5434b428fcc717fbd06822b54ec18194c62 Mon Sep 17 00:00:00 2001 From: Marius Date: Sun, 28 Oct 2012 15:00:25 +0200 Subject: beta 2012.10.28 13:23 --- tex/context/base/l-lpeg.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tex/context/base/l-lpeg.lua') diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua index 38ac3c0dd..55c520691 100644 --- a/tex/context/base/l-lpeg.lua +++ b/tex/context/base/l-lpeg.lua @@ -606,7 +606,7 @@ else end -local range = Cs(utf8byte) * (Cs(utf8byte) + Cc(false)) +local range = utf8byte * utf8byte + Cc(false) -- utf8byte is already a capture local utfchar = unicode and unicode.utf8 and unicode.utf8.char @@ -623,7 +623,7 @@ function lpeg.UR(str,more) end if first == last then return P(str) - elseif utfchar and last - first < 8 then -- a somewhat arbitrary criterium + elseif utfchar and (last - first < 8) then -- a somewhat arbitrary criterium local p = P(false) for i=first,last do p = p + P(utfchar(i)) @@ -633,10 +633,13 @@ function lpeg.UR(str,more) local f = function(b) return b >= first and b <= last end + -- tricky, these nested captures return utf8byte / f -- nil when invalid range end end +-- print(lpeg.match(lpeg.Cs((C(lpeg.UR("αω"))/{ ["χ"] = "OEPS" })^0),"αωχαω")) + --~ lpeg.print(lpeg.R("ab","cd","gh")) --~ lpeg.print(lpeg.P("a","b","c")) --~ lpeg.print(lpeg.S("a","b","c")) -- cgit v1.2.3