diff options
author | Hans Hagen <pragma@wxs.nl> | 2012-01-05 19:27:22 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2012-01-05 19:27:22 +0100 |
commit | 573dc6804335e4d9730530f309252e4f1377ce86 (patch) | |
tree | c7901e95fb1b8684f7216ea441ee7ddcb483e91b /tex/generic | |
parent | 070ae5b1b840ddffa974b63d6f8c2696665d6781 (diff) | |
download | context-573dc6804335e4d9730530f309252e4f1377ce86.tar.gz |
beta 2011.11.09 19:33
Diffstat (limited to 'tex/generic')
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index e9ab336ca..b6c269569 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 11/08/11 19:35:08 +-- merge date : 11/09/11 19:33:25 do -- begin closure to overcome local limits and interference @@ -1147,7 +1147,7 @@ local report = texio and texio.write_nl or print --~ function lpeg.Carg (l) local p = lpcarg(l) report("LPEG Carg =") lpprint(l) return p end local type = type -local byte, char = string.byte, string.char +local byte, char, gmatch = string.byte, string.char, string.gmatch -- Beware, we predefine a bunch of patterns here and one reason for doing so -- is that we get consistent behaviour in some of the visualizers. @@ -1754,6 +1754,61 @@ end -- end -- end +-- experiment: + +local function make(t) + local p +-- for k, v in next, t do + for k, v in table.sortedhash(t) do + if not p then + if next(v) then + p = P(k) * make(v) + else + p = P(k) + end + else + if next(v) then + p = p + P(k) * make(v) + else + p = p + P(k) + end + end + end + return p +end + +function lpeg.utfchartabletopattern(list) + local tree = { } + for i=1,#list do + local t = tree + for c in gmatch(list[i],".") do + if not t[c] then + t[c] = { } + end + t = t[c] + end + end + return make(tree) +end + +-- inspect ( lpeg.utfchartabletopattern { +-- utfchar(0x00A0), -- nbsp +-- utfchar(0x2000), -- enquad +-- utfchar(0x2001), -- emquad +-- utfchar(0x2002), -- enspace +-- utfchar(0x2003), -- emspace +-- utfchar(0x2004), -- threeperemspace +-- utfchar(0x2005), -- fourperemspace +-- utfchar(0x2006), -- sixperemspace +-- utfchar(0x2007), -- figurespace +-- utfchar(0x2008), -- punctuationspace +-- utfchar(0x2009), -- breakablethinspace +-- utfchar(0x200A), -- hairspace +-- utfchar(0x200B), -- zerowidthspace +-- utfchar(0x202F), -- narrownobreakspace +-- utfchar(0x205F), -- math thinspace +-- } ) + end -- closure do -- begin closure to overcome local limits and interference |