[latex3-commits] [l3svn] r7373 - Make peeking code a bit more robust against catcode 4 (fixes #379)

noreply at latex-project.org noreply at latex-project.org
Sat Jul 15 17:41:24 CEST 2017


Author: bruno
Date: 2017-07-15 17:41:24 +0200 (Sat, 15 Jul 2017)
New Revision: 7373

Modified:
   trunk/l3kernel/l3token.dtx
   trunk/l3kernel/testfiles/m3expl001.luatex.tlg
   trunk/l3kernel/testfiles/m3expl001.ptex.tlg
   trunk/l3kernel/testfiles/m3expl001.tlg
   trunk/l3kernel/testfiles/m3expl001.uptex.tlg
   trunk/l3kernel/testfiles/m3expl001.xetex.tlg
   trunk/l3kernel/testfiles/m3expl003.luatex.tlg
   trunk/l3kernel/testfiles/m3expl003.ptex.tlg
   trunk/l3kernel/testfiles/m3expl003.tlg
   trunk/l3kernel/testfiles/m3expl003.uptex.tlg
   trunk/l3kernel/testfiles/m3expl003.xetex.tlg
Log:
Make peeking code a bit more robust against catcode 4 (fixes #379)


Modified: trunk/l3kernel/l3token.dtx
===================================================================
--- trunk/l3kernel/l3token.dtx	2017-07-15 15:11:20 UTC (rev 7372)
+++ trunk/l3kernel/l3token.dtx	2017-07-15 15:41:24 UTC (rev 7373)
@@ -2261,61 +2261,53 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_true_remove:w
   {
-    \group_align_safe_end:
     \tex_afterassignment:D \@@_true_aux:w
     \cs_set_eq:NN \@@_tmp:w
   }
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}[TF]{\@@_token_generic:NN}
-%   The generic function stores the test token in both implicit and
+% \begin{macro}{\@@_token_generic_aux:NNNTF}
+%   The generic functions store the test token in both implicit and
 %   explicit modes, and the \texttt{true} and \texttt{false} code as
 %   token lists, more or less. The two branches have to be absorbed here
 %   as the input stream needs to be cleared for the peek function itself.
+%   Here, |#1| is \cs{@@_true_remove:w} when removing the token and
+%   \cs{@@_true_aux:w} otherwise.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_token_generic:NNTF #1#2#3#4
+\cs_new_protected:Npn \@@_token_generic_aux:NNNTF #1#2#3#4#5
   {
-    \cs_set_eq:NN \l_@@_search_token #2
-    \tl_set:Nn \l_@@_search_tl {#2}
-    \cs_set:Npx \@@_true:w
+    \group_align_safe_begin:
+    \cs_set_eq:NN \l_@@_search_token #3
+    \tl_set:Nn \l_@@_search_tl {#3}
+    \cs_set:Npx \@@_true_aux:w
       {
         \exp_not:N \group_align_safe_end:
-        \exp_not:n {#3}
+        \exp_not:n {#4}
       }
+    \cs_set_eq:NN \@@_true:w #1
     \cs_set:Npx \@@_false:w
       {
         \exp_not:N \group_align_safe_end:
-        \exp_not:n {#4}
+        \exp_not:n {#5}
       }
-    \group_align_safe_begin:
-      \peek_after:Nw #1
+    \peek_after:Nw #2
   }
-\cs_new_protected:Npn \@@_token_generic:NNT #1#2#3
-  { \@@_token_generic:NNTF #1 #2 {#3} { } }
-\cs_new_protected:Npn \@@_token_generic:NNF #1#2#3
-  { \@@_token_generic:NNTF #1 #2 { } {#3} }
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}[TF]{\@@_token_remove_generic:NN}
+% \begin{macro}[TF]{\@@_token_generic:NN, \@@_token_remove_generic:NN}
 %   For token removal there needs to be a call to the auxiliary
 %   function which does the work.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_token_remove_generic:NNTF #1#2#3#4
-  {
-    \cs_set_eq:NN \l_@@_search_token #2
-    \tl_set:Nn \l_@@_search_tl {#2}
-    \cs_set_eq:NN \@@_true:w \@@_true_remove:w
-    \cs_set:Npx \@@_true_aux:w { \exp_not:n {#3} }
-    \cs_set:Npx \@@_false:w
-      {
-        \exp_not:N \group_align_safe_end:
-        \exp_not:n {#4}
-      }
-    \group_align_safe_begin:
-      \peek_after:Nw #1
-  }
+\cs_new_protected:Npn \@@_token_generic:NNTF
+  { \@@_token_generic_aux:NNNTF \@@_true_aux:w }
+\cs_new_protected:Npn \@@_token_generic:NNT #1#2#3
+  { \@@_token_generic:NNTF #1 #2 {#3} { } }
+\cs_new_protected:Npn \@@_token_generic:NNF #1#2#3
+  { \@@_token_generic:NNTF #1 #2 { } {#3} }
+\cs_new_protected:Npn \@@_token_remove_generic:NNTF
+  { \@@_token_generic_aux:NNNTF \@@_true_remove:w }
 \cs_new_protected:Npn \@@_token_remove_generic:NNT #1#2#3
   { \@@_token_remove_generic:NNTF #1 #2 {#3} { } }
 \cs_new_protected:Npn \@@_token_remove_generic:NNF #1#2#3

Modified: trunk/l3kernel/testfiles/m3expl001.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.luatex.tlg	2017-07-15 15:11:20 UTC (rev 7372)
+++ trunk/l3kernel/testfiles/m3expl001.luatex.tlg	2017-07-15 15:41:24 UTC (rev 7373)
@@ -2372,6 +2372,7 @@
 Defining \peek_after:Nw on line ...
 Defining \peek_gafter:Nw on line ...
 Defining \__peek_true_remove:w on line ...
+Defining \__peek_token_generic_aux:NNNTF on line ...
 Defining \__peek_token_generic:NNTF on line ...
 Defining \__peek_token_generic:NNT on line ...
 Defining \__peek_token_generic:NNF on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.ptex.tlg	2017-07-15 15:11:20 UTC (rev 7372)
+++ trunk/l3kernel/testfiles/m3expl001.ptex.tlg	2017-07-15 15:41:24 UTC (rev 7373)
@@ -2360,6 +2360,7 @@
 Defining \peek_after:Nw on line ...
 Defining \peek_gafter:Nw on line ...
 Defining \__peek_true_remove:w on line ...
+Defining \__peek_token_generic_aux:NNNTF on line ...
 Defining \__peek_token_generic:NNTF on line ...
 Defining \__peek_token_generic:NNT on line ...
 Defining \__peek_token_generic:NNF on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.tlg	2017-07-15 15:11:20 UTC (rev 7372)
+++ trunk/l3kernel/testfiles/m3expl001.tlg	2017-07-15 15:41:24 UTC (rev 7373)
@@ -2360,6 +2360,7 @@
 Defining \peek_after:Nw on line ...
 Defining \peek_gafter:Nw on line ...
 Defining \__peek_true_remove:w on line ...
+Defining \__peek_token_generic_aux:NNNTF on line ...
 Defining \__peek_token_generic:NNTF on line ...
 Defining \__peek_token_generic:NNT on line ...
 Defining \__peek_token_generic:NNF on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.uptex.tlg	2017-07-15 15:11:20 UTC (rev 7372)
+++ trunk/l3kernel/testfiles/m3expl001.uptex.tlg	2017-07-15 15:41:24 UTC (rev 7373)
@@ -2360,6 +2360,7 @@
 Defining \peek_after:Nw on line ...
 Defining \peek_gafter:Nw on line ...
 Defining \__peek_true_remove:w on line ...
+Defining \__peek_token_generic_aux:NNNTF on line ...
 Defining \__peek_token_generic:NNTF on line ...
 Defining \__peek_token_generic:NNT on line ...
 Defining \__peek_token_generic:NNF on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.xetex.tlg	2017-07-15 15:11:20 UTC (rev 7372)
+++ trunk/l3kernel/testfiles/m3expl001.xetex.tlg	2017-07-15 15:41:24 UTC (rev 7373)
@@ -2370,6 +2370,7 @@
 Defining \peek_after:Nw on line ...
 Defining \peek_gafter:Nw on line ...
 Defining \__peek_true_remove:w on line ...
+Defining \__peek_token_generic_aux:NNNTF on line ...
 Defining \__peek_token_generic:NNTF on line ...
 Defining \__peek_token_generic:NNT on line ...
 Defining \__peek_token_generic:NNF on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.luatex.tlg	2017-07-15 15:11:20 UTC (rev 7372)
+++ trunk/l3kernel/testfiles/m3expl003.luatex.tlg	2017-07-15 15:41:24 UTC (rev 7373)
@@ -2372,6 +2372,7 @@
 Defining \peek_after:Nw on line ...
 Defining \peek_gafter:Nw on line ...
 Defining \__peek_true_remove:w on line ...
+Defining \__peek_token_generic_aux:NNNTF on line ...
 Defining \__peek_token_generic:NNTF on line ...
 Defining \__peek_token_generic:NNT on line ...
 Defining \__peek_token_generic:NNF on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.ptex.tlg	2017-07-15 15:11:20 UTC (rev 7372)
+++ trunk/l3kernel/testfiles/m3expl003.ptex.tlg	2017-07-15 15:41:24 UTC (rev 7373)
@@ -2360,6 +2360,7 @@
 Defining \peek_after:Nw on line ...
 Defining \peek_gafter:Nw on line ...
 Defining \__peek_true_remove:w on line ...
+Defining \__peek_token_generic_aux:NNNTF on line ...
 Defining \__peek_token_generic:NNTF on line ...
 Defining \__peek_token_generic:NNT on line ...
 Defining \__peek_token_generic:NNF on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.tlg	2017-07-15 15:11:20 UTC (rev 7372)
+++ trunk/l3kernel/testfiles/m3expl003.tlg	2017-07-15 15:41:24 UTC (rev 7373)
@@ -2360,6 +2360,7 @@
 Defining \peek_after:Nw on line ...
 Defining \peek_gafter:Nw on line ...
 Defining \__peek_true_remove:w on line ...
+Defining \__peek_token_generic_aux:NNNTF on line ...
 Defining \__peek_token_generic:NNTF on line ...
 Defining \__peek_token_generic:NNT on line ...
 Defining \__peek_token_generic:NNF on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.uptex.tlg	2017-07-15 15:11:20 UTC (rev 7372)
+++ trunk/l3kernel/testfiles/m3expl003.uptex.tlg	2017-07-15 15:41:24 UTC (rev 7373)
@@ -2360,6 +2360,7 @@
 Defining \peek_after:Nw on line ...
 Defining \peek_gafter:Nw on line ...
 Defining \__peek_true_remove:w on line ...
+Defining \__peek_token_generic_aux:NNNTF on line ...
 Defining \__peek_token_generic:NNTF on line ...
 Defining \__peek_token_generic:NNT on line ...
 Defining \__peek_token_generic:NNF on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.xetex.tlg	2017-07-15 15:11:20 UTC (rev 7372)
+++ trunk/l3kernel/testfiles/m3expl003.xetex.tlg	2017-07-15 15:41:24 UTC (rev 7373)
@@ -2370,6 +2370,7 @@
 Defining \peek_after:Nw on line ...
 Defining \peek_gafter:Nw on line ...
 Defining \__peek_true_remove:w on line ...
+Defining \__peek_token_generic_aux:NNNTF on line ...
 Defining \__peek_token_generic:NNTF on line ...
 Defining \__peek_token_generic:NNT on line ...
 Defining \__peek_token_generic:NNF on line ...



More information about the latex3-commits mailing list