diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-03-26 13:38:18 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-03-26 13:38:18 +0100 |
commit | 788487819ccf38a8478cc2afd88e0c0b088d0ec1 (patch) | |
tree | 215addbe3b9e293c2958227e7fc8923880b2e71f /tex/context/base/mkiv/lang-rep.lua | |
parent | adfe72d5a0c9d7bdc1bd7bc8faabb4d05e21d70a (diff) | |
download | context-788487819ccf38a8478cc2afd88e0c0b088d0ec1.tar.gz |
2016-03-26 13:07:00
Diffstat (limited to 'tex/context/base/mkiv/lang-rep.lua')
-rw-r--r-- | tex/context/base/mkiv/lang-rep.lua | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/tex/context/base/mkiv/lang-rep.lua b/tex/context/base/mkiv/lang-rep.lua index ec82b7b19..28f2e5d50 100644 --- a/tex/context/base/mkiv/lang-rep.lua +++ b/tex/context/base/mkiv/lang-rep.lua @@ -49,6 +49,7 @@ local getprev = nuts.getprev local getattr = nuts.getattr local getid = nuts.getid local getchar = nuts.getchar +local isglyph = nuts.isglyph local setfield = nuts.setfield local setattr = nuts.setattr @@ -146,23 +147,28 @@ local function hit(a,head) local current = getnext(head) local lastrun = false local lastfinal = false - while current and getid(current) == glyph_code do - local newroot = root[getchar(current)] - if not newroot then - return lastrun, lastfinal - else - local final = newroot.final - if final then - if trace_detail then - report_replacement("hitting word %a, replacement %a",final.word,final.replacement) - end - lastrun = current - lastfinal = final + while current do + local char = isglyph(current) + if char then + local newroot = root[char] + if not newroot then + return lastrun, lastfinal else - root = newroot + local final = newroot.final + if final then + if trace_detail then + report_replacement("hitting word %a, replacement %a",final.word,final.replacement) + end + lastrun = current + lastfinal = final + else + root = newroot + end end + current = getnext(current) + else + break end - current = getnext(current) end if lastrun then return lastrun, lastfinal |