[latex3-commits] [latex3/latex3] flag-N-type: Render l3flag against unbalanced primitive TeX conditionals (e6a6d80c9)

github at latex-project.org github at latex-project.org
Fri Jan 12 13:36:56 CET 2024


Repository : https://github.com/latex3/latex3
On branch  : flag-N-type
Link       : https://github.com/latex3/latex3/commit/e6a6d80c928a2c9da29c385a8a8336f0e8a180c1

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

commit e6a6d80c928a2c9da29c385a8a8336f0e8a180c1
Author: Bruno Le Floch <blflatex at gmail.com>
Date:   Fri Jan 12 13:36:56 2024 +0100

    Render l3flag against unbalanced primitive TeX conditionals
    
    If a flag name contained (before expansion) unbalanced TeX conditionals,
    then \flag_clear:n would break because the flag name was nested inside
    an ifcsname test.


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

e6a6d80c928a2c9da29c385a8a8336f0e8a180c1
 l3kernel/l3flag.dtx | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/l3kernel/l3flag.dtx b/l3kernel/l3flag.dtx
index 05768ae06..e1d9808b8 100644
--- a/l3kernel/l3flag.dtx
+++ b/l3kernel/l3flag.dtx
@@ -212,13 +212,15 @@
 \cs_new_protected:Npn \@@_clear:wn #1 ; #2
   {
     \if_cs_exist:w flag~#2~#1 \cs_end:
-      \cs_set_eq:cN { flag~#2~#1 } \tex_undefined:D
-      \exp_after:wN \@@_clear:wn
-      \int_value:w \int_eval:w 1 + #1
+      \exp_after:wN \use:n
     \else:
-      \use_i:nnn
+      \exp_after:wN \use_none:n
     \fi:
-    ; {#2}
+    {
+      \cs_set_eq:cN { flag~#2~#1 } \tex_undefined:D
+      \exp_after:wN \@@_clear:wn
+      \int_value:w \int_eval:w 1 + #1 ; {#2}
+    }
   }
 %    \end{macrocode}
 % \end{macro}
@@ -310,18 +312,11 @@
 % \end{macro}
 %
 % \begin{macro}[EXP]{\flag_ensure_raised:n}
-%   It might be faster to just call the \enquote{trap} function in all
-%   cases but conceptually the function name suggests we should only run
-%   it if the flag is zero in case the \enquote{trap} made customizable
-%   in the future.
+%   It is simplest to just call the \enquote{trap} function in all
+%   cases.
 %    \begin{macrocode}
 \cs_new:Npn \flag_ensure_raised:n #1
-  {
-    \if_cs_exist:w flag~#1~0 \cs_end:
-    \else:
-      \cs:w flag~#1 \cs_end: 0 ;
-    \fi:
-  }
+  { \cs:w flag~#1 \cs_end: 0 ; }
 %    \end{macrocode}
 % \end{macro}
 %





More information about the latex3-commits mailing list.