[latex3-commits] [git/LaTeX3-latex3-latex3] text-map: Refactor (114bb602c)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Aug 9 10:57:39 CEST 2022


Repository : https://github.com/latex3/latex3
On branch  : text-map
Link       : https://github.com/latex3/latex3/commit/114bb602c7ab5551ba7c437a8986988ac70e7da2

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

commit 114bb602c7ab5551ba7c437a8986988ac70e7da2
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Aug 9 09:57:39 2022 +0100

    Refactor


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

114bb602c7ab5551ba7c437a8986988ac70e7da2
 l3kernel/l3text-map.dtx | 83 ++++++++++++++++++-------------------------------
 1 file changed, 30 insertions(+), 53 deletions(-)

diff --git a/l3kernel/l3text-map.dtx b/l3kernel/l3text-map.dtx
index 98e47feef..f611bc994 100644
--- a/l3kernel/l3text-map.dtx
+++ b/l3kernel/l3text-map.dtx
@@ -83,11 +83,9 @@
 %     \@@_map_Control:Nnn     ,
 %     \@@_map_Extend:Nnn      ,
 %     \@@_map_SpacingMark:Nnn ,
-%     \@@_map_Prepend:Nnn
+%     \@@_map_Prepend:Nnn     ,
+%     \@@_map_Prepend_aux:Nnn
 %   }
-% \begin{macro}[EXP]{\@@_map_Prepend:Nnw}
-% \begin{macro}[EXP]{\@@_map_Prepend:NnN}
-% \begin{macro}[EXP]{\@@_map_Prepend:Nnn}
 % \begin{macro}[EXP]
 %   {
 %     \@@_map_not_Control:Nnn     ,
@@ -124,10 +122,10 @@
 %     \@@_map_hangul_LVT:Nnn ,
 %     \@@_map_hangul_T:Nnn
 %   }
-% \begin{macro}[EXP]{\@@_map_Regional_Indicator:Nnn}
-% \begin{macro}[EXP]{\@@_map_RI:Nnw}
-% \begin{macro}[EXP]{\@@_map_RI:NnN}
-% \begin{macro}[EXP]{\@@_map_RI:Nnn}
+% \begin{macro}[EXP]
+%   {\@@_map_Regional_Indicator:Nnn, \@@_map_Regional_Indicator_aux:Nnn}
+% \begin{macro}[EXP]{\@@_map_lookahead:NnNw}
+% \begin{macro}[EXP]{\@@_map_lookahead:NnNN}
 % \begin{macro}[EXP]{\@@_map_output:Nn}
 % \begin{macro}[EXP]{\text_map_break:}
 % \begin{macro}[EXP]{\text_map_break:n}
@@ -298,26 +296,7 @@
 \cs_new:Npn \@@_map_Prepend:Nnn #1#2#3
   {
     \@@_map_output:Nn #1 {#2}
-    \@@_map_Prepend:Nnw #1 {#3}
-  }
-\cs_new:Npn \@@_map_Prepend:Nnw
-  #1#2#3 \q_@@_recursion_stop
-  {
-    \tl_if_head_is_N_type:nTF {#3}
-      { \@@_map_Prepend:NnN #1 {#2} }
-      { \@@_map_loop:Nnw #1 {#2} }
-    #3 \q_@@_recursion_stop
-  }
-\cs_new:Npn \@@_map_Prepend:NnN #1#2#3
-  {
-    \@@_if_q_recursion_tail_stop_do:Nn #3 { #1 {#2} }
-    \token_if_cs:NTF #3
-      {
-        #1 {#2}
-        \@@_map_loop:Nnw #1 { }
-      }
-      { \@@_codepoint_process:nN { \@@_map_Prepend_aux:Nnn #1 {#2} } }
-        #3
+    \@@_map_lookahead:NnNw #1 {#3} \@@_map_Prepend_aux:Nnn
   }
 \cs_new:Npn \@@_map_Prepend_aux:Nnn #1#2#3
   { \@@_map_loop:Nnw #1 {#2#3} }
@@ -466,28 +445,9 @@
 \cs_new:Npn \@@_map_Regional_Indicator:Nnn #1#2#3
   {
     \@@_map_output:Nn #1 {#2}
-    \@@_map_RI:Nnw #1 {#3}
-  }
-\cs_new:Npn \@@_map_RI:Nnw
-  #1#2#3 \q_@@_recursion_stop
-  {
-    \tl_if_head_is_N_type:nTF {#3}
-      { \@@_map_RI:NnN #1 {#2} }
-      { \@@_map_loop:Nnw #1 {#2} }
-    #3 \q_@@_recursion_stop
+    \@@_map_lookahead:NnNw #1 {#3} \@@_map_Regional_Indicator_aux:Nnn
   }
-\cs_new:Npn \@@_map_RI:NnN #1#2#3
-  {
-    \@@_if_q_recursion_tail_stop_do:Nn #3 { #1 {#2} }
-    \token_if_cs:NTF #3
-      {
-        #1 {#2}
-        \@@_map_loop:Nnw #1 { }
-      }
-      { \@@_codepoint_process:nN { \@@_map_RI:Nnn #1 {#2} } }
-        #3
-  }
-\cs_new:Npn \@@_map_RI:Nnn #1#2#3
+\cs_new:Npn \@@_map_Regional_Indicator_aux:Nnn #1#2#3
   {
     \bool_lazy_or:nnTF
       { \@@_codepoint_compare_p:nNn {#3} < { "1F1E6 } }
@@ -498,6 +458,27 @@
       { \@@_map_loop:Nnw #1 {#2#3} }
   }
 %    \end{macrocode}
+%   A generic loop-ahead setup.
+%    \begin{macrocode}
+\cs_new:Npn \@@_map_lookahead:NnNw #1#2#3#4 \q_@@_recursion_stop
+  {
+    \tl_if_head_is_N_type:nTF {#4}
+      { \@@_map_lookahead:NnNN #1 {#2} #3 }
+      { \@@_map_loop:Nnw #1 {#2} }
+    #4 \q_@@_recursion_stop
+  }
+\cs_new:Npn \@@_map_lookahead:NnNN #1#2#3#4
+  {
+    \@@_if_q_recursion_tail_stop_do:Nn #4 { #1 {#2} }
+    \token_if_cs:NTF #4
+      {
+        #1 {#2}
+        \@@_map_loop:Nnw #1 { }
+      }
+      { \@@_codepoint_process:nN { #3 #1 {#2} } }
+        #4
+  }
+%    \end{macrocode}
 %   For the end of the process.
 %    \begin{macrocode}
 \cs_new:Npn \@@_map_output:Nn #1#2
@@ -538,10 +519,6 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
 %
 % \begin{macro}{\text_map_inline:nn}
 %   The standard non-expandable inline version.





More information about the latex3-commits mailing list.