[latex3-commits] [git/LaTeX3-latex3-xxetex] main: avoid looping on inserted nodes (b784977)

David Carlisle d.p.carlisle at gmail.com
Fri Jan 27 00:57:23 CET 2023


Repository : https://github.com/latex3/xxetex
On branch  : main
Link       : https://github.com/latex3/xxetex/commit/b784977a3cdcb214aeed5c73542f0ada3b10fc10

>---------------------------------------------------------------

commit b784977a3cdcb214aeed5c73542f0ada3b10fc10
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Thu Jan 26 23:57:23 2023 +0000

    avoid looping on inserted nodes


>---------------------------------------------------------------

b784977a3cdcb214aeed5c73542f0ada3b10fc10
 classes.tex   | 8 +++-----
 xxclasses.lua | 7 ++++++-
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/classes.tex b/classes.tex
index 451578f..b12577d 100644
--- a/classes.tex
+++ b/classes.tex
@@ -58,16 +58,14 @@
 \XeTeXinterchartoks \mycharclassA \mycharclassa = {\upshape]}
 
 % between " " and "B":
-%\XeTeXinterchartoks 4095 \mycharclassB = {\bgroup\color{blue}(}
-%\XeTeXinterchartoks \mycharclassB 4095 = {)\egroup}
+\XeTeXinterchartoks 4095 \mycharclassB = {\color{blue}(}
+\XeTeXinterchartoks \mycharclassB 4095 = {)\color{black}}
 
-%\XeTeXinterchartoks 4095 \mycharclassB = {(}% this one loops
-\XeTeXinterchartoks \mycharclassB 4095 = {)}
 
 % between "B" and "B":
 \XeTeXinterchartoks \mycharclassB \mycharclassB = {.}
 
-aAa A a B aBa BB
+aAa A a B aBa BB x
 
 
 
diff --git a/xxclasses.lua b/xxclasses.lua
index 3abd89c..56dd8cb 100644
--- a/xxclasses.lua
+++ b/xxclasses.lua
@@ -31,10 +31,12 @@ local function xxinterchartoks(head)
     if not (tex.count.XeTeXinterchartokenstate > 0) then
         return head
     end
-
+    xxflag=-1
     for n in node.traverse(head) do
     local a = 4095
     local b = 4095
+    if xxflag==n then xxflag=-1 end
+    if xxflag ==-1 then
     if n.id==glyphid then
      a = xxclasses[n.char] or 0
     end
@@ -45,12 +47,15 @@ local function xxinterchartoks(head)
 	print("AAb" .. xxruninterchartoksnum)
 	print(a,b)
 	print("AAc" .. xxclasstoks[a .. "/" .. b])
+	    xxflag=1
+	    if n.next then xxflag=n.next end
 	    tex.scantoks(xxinterchartoksnum,0,xxclasstoks[a .. "/" .. b])
             tex.runtoks("xxruninterchartoks")
             local box = tex.getbox("xxintercharbox")
             node.insert_after(head, n, node.copy_list(box))	
         end
     end
+    end
     return head
 end
 





More information about the latex3-commits mailing list.