diff options
author | Marius <mariausol@gmail.com> | 2012-10-28 15:00:25 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2012-10-28 15:00:25 +0200 |
commit | 3fcaa5434b428fcc717fbd06822b54ec18194c62 (patch) | |
tree | 020fe87ecadf1865b9358d31a04fcdc37dbdefe4 /tex/context/base/l-lpeg.lua | |
parent | a6994b024b0e60c9d69ddbedc399f0d7a823c70d (diff) | |
download | context-3fcaa5434b428fcc717fbd06822b54ec18194c62.tar.gz |
beta 2012.10.28 13:23
Diffstat (limited to 'tex/context/base/l-lpeg.lua')
-rw-r--r-- | tex/context/base/l-lpeg.lua | 7 |
1 files changed, 5 insertions, 2 deletions
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")) |