[latex3-commits] [git/LaTeX3-latex3-latex3] master: Skip \exp_not:n in \text_expand:n (c02736fdc)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Jan 22 20:49:54 CET 2020


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/c02736fdca4bc7ba8a8d0f177994242a42927c8c

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

commit c02736fdca4bc7ba8a8d0f177994242a42927c8c
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Wed Jan 22 19:49:54 2020 +0000

    Skip \exp_not:n in \text_expand:n


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

c02736fdca4bc7ba8a8d0f177994242a42927c8c
 l3kernel/l3text.dtx | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/l3kernel/l3text.dtx b/l3kernel/l3text.dtx
index 0b110313a..aba51b16c 100644
--- a/l3kernel/l3text.dtx
+++ b/l3kernel/l3text.dtx
@@ -538,6 +538,7 @@
 % \begin{macro}[EXP]{\@@_expand_replace:N}
 % \begin{macro}[EXP]{\@@_expand_replace:n}
 % \begin{macro}[EXP]{\@@_expand_cs_expand:N}
+% \begin{macro}[EXP]{\@@_expand_noexpand:n}
 %   After precautions against |&| tokens, start a simple loop: that of
 %   course means that \enquote{text} cannot contain the two recursion
 %   quarks. The loop here must be \texttt{f}-type expandable; we have
@@ -890,17 +891,27 @@
 \cs_new:Npn \@@_expand_replace:n #1 { \@@_expand_loop:w #1 }
 %    \end{macrocode}
 %   Finally, expand any macros which can be: this then loops back around to
-%   deal with what they produce.
+%   deal with what they produce. The only issue is if the token is
+%   \cs{exp_not:n}, as that must apply to the following balanced text.
 %    \begin{macrocode}
 \cs_new:Npn \@@_expand_cs_expand:N #1
   {
     \@@_if_expandable:NTF #1
-      { \exp_after:wN \@@_expand_loop:w #1 }
+      {
+        \token_if_eq_meaning:NNTF #1 \exp_not:n
+          { \@@_expand_noexpand:n }
+          { \exp_after:wN \@@_expand_loop:w #1 }
+      }
       {
         \@@_expand_store:n {#1}
         \@@_expand_loop:w
       }
   }
+\cs_new:Npn \@@_expand_noexpand:n #1
+  {
+    \@@_expand_store:n {#1}
+    \@@_expand_loop:w
+  }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -928,6 +939,7 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}
 %   {





More information about the latex3-commits mailing list