[latex3-commits] [git/LaTeX3-latex3-latex3] master: private quarks in keyval (896642539)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Mar 3 17:59:10 CET 2020


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

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

commit 89664253952c635e52de044449b622651b10c0f5
Author: Jonathan Spratte <jspratte at yahoo.de>
Date:   Thu Feb 20 20:09:40 2020 +0100

    private quarks in keyval


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

89664253952c635e52de044449b622651b10c0f5
 l3kernel/l3keys.dtx | 118 ++++++++++++++++++++++++++++------------------------
 1 file changed, 64 insertions(+), 54 deletions(-)

diff --git a/l3kernel/l3keys.dtx b/l3kernel/l3keys.dtx
index c8126fcbc..c856d4e87 100644
--- a/l3kernel/l3keys.dtx
+++ b/l3kernel/l3keys.dtx
@@ -951,6 +951,16 @@
 %<@@=keyval>
 %    \end{macrocode}
 %
+% \begin{variable}{\q_@@_nil,\q_@@_mark,\q_@@_stop,\q_@@_tail}
+%    \begin{macrocode}
+\quark_new:N \q_@@_nil
+\quark_new:N \q_@@_mark
+\quark_new:N \q_@@_stop
+\quark_new:N \q_@@_tail
+%    \end{macrocode}
+% \end{variable}
+%
+%
 % \begin{macro}{\@@_tmp:NN}
 %   This temporary macro will be used since some of the definitions will need an
 %   active comma or equals sign. Inside of this macro |#1| will be the active
@@ -970,7 +980,7 @@
 %    \begin{macrocode}
     \cs_new:Npn \keyval_parse:NNn ##1 ##2 ##3
       {
-        \@@_loop_active:NNw ##1 ##2 \q_mark ##3 #1 \q_recursion_tail #1
+        \@@_loop_active:NNw ##1 ##2 \q_@@_mark ##3 #1 \q_@@_tail #1
       }
 %    \end{macrocode}
 % \end{macro}
@@ -986,9 +996,9 @@
     \cs_new:Npn \@@_loop_active:NNw ##1 ##2 ##3 #1
       {
         \@@_if_recursion_tail:w ##3
-          \@@_end_loop_active:w \q_mark \q_recursion_tail
-        \@@_loop_other:NNw ##1 ##2 ##3 , \q_recursion_tail ,
-        \@@_loop_active:NNw ##1 ##2 \q_mark
+          \@@_end_loop_active:w \q_@@_mark \q_@@_tail
+        \@@_loop_other:NNw ##1 ##2 ##3 , \q_@@_tail ,
+        \@@_loop_active:NNw ##1 ##2 \q_@@_mark
       }
 %    \end{macrocode}
 % \end{macro}
@@ -1003,26 +1013,26 @@
     \cs_new:Npn \@@_loop_other:NNw ##1 ##2 ##3 ,
       {
         \@@_if_recursion_tail:w ##3
-          \@@_end_loop_other:w \q_mark \q_recursion_tail
-        \@@_if_has_equal_other:w ##3 = \q_stop
-          \@@_has_false:w \q_mark \q_stop \use_i:nn
+          \@@_end_loop_other:w \q_@@_mark \q_@@_tail
+        \@@_if_has_equal_other:w ##3 = \q_@@_stop
+          \@@_has_false:w \q_@@_mark \q_@@_stop \use_i:nn
           {
-            \@@_if_has_equal_active:w ##3 #2 \q_stop
-              \@@_has_false:w \q_mark \q_stop \use_i:nn
+            \@@_if_has_equal_active:w ##3 #2 \q_@@_stop
+              \@@_has_false:w \q_@@_mark \q_@@_stop \use_i:nn
               \@@_misplaced_equal_error:
-              { \@@_split_other:wN ##3 = \q_stop ##2 }
+              { \@@_split_other:wN ##3 = \q_@@_stop ##2 }
           }
           {
-            \@@_if_has_equal_active:w ##3 #2 \q_stop
-              \@@_has_false:w \q_mark \q_stop \use_i:nn
-              { \@@_split_active:wN ##3 #2 \q_stop ##2 }
+            \@@_if_has_equal_active:w ##3 #2 \q_@@_stop
+              \@@_has_false:w \q_@@_mark \q_@@_stop \use_i:nn
+              { \@@_split_active:wN ##3 #2 \q_@@_stop ##2 }
               {
-                \@@_if_blank:w ##3 \q_nil \q_stop
-                  \@@_blank_true:w \q_mark \q_stop \use:n
+                \@@_if_blank:w ##3 \q_@@_nil \q_@@_stop
+                  \@@_blank_true:w \q_@@_mark \q_@@_stop \use:n
                   { \@@_trim:nN { ##3 } \@@_key:nN ##1 }
               }
           }
-        \@@_loop_other:NNw ##1 ##2 \q_mark
+        \@@_loop_other:NNw ##1 ##2 \q_@@_mark
       }
 %    \end{macrocode}
 % \end{macro}
@@ -1036,12 +1046,12 @@
 %    \begin{macrocode}
     \cs_new:Npn \@@_split_active:wN ##1 #2
       {
-        \@@_trim:nN { ##1 } \@@_split_active_aux:nwN \q_mark
+        \@@_trim:nN { ##1 } \@@_split_active_aux:nwN \q_@@_mark
       }
-      \cs_new:Npn \@@_split_active_aux:nwN ##1 ##2 #2 ##3 \q_stop
+      \cs_new:Npn \@@_split_active_aux:nwN ##1 ##2 #2 ##3 \q_@@_stop
         {
-          \@@_if_empty:w \q_mark ##3 \q_stop
-            \@@_has_false:w \q_mark \q_stop \use_i:nn
+          \@@_if_empty:w \q_@@_mark ##3 \q_@@_stop
+            \@@_has_false:w \q_@@_mark \q_@@_stop \use_i:nn
             { \@@_misplaced_equal_error: \use_none:n }
             { \@@_trim:nN { ##2 } \@@_key_val:nnN { ##1 } }
         }
@@ -1054,7 +1064,7 @@
 %    \begin{macrocode}
     \cs_new:Npn \@@_if_has_equal_active:w ##1 #2
       {
-        \@@_if_empty:w \q_mark
+        \@@_if_empty:w \q_@@_mark
       }
 %    \end{macrocode}
 % \end{macro}
@@ -1077,16 +1087,16 @@
 %   faster.
 %    \begin{macrocode}
 \cs_new:Npn \@@_end_loop_active:w
-    \q_mark \q_recursion_tail
-    \@@_loop_other:NNw #1 , \q_recursion_tail ,
-    \@@_loop_active:NNw #2 \q_mark
+    \q_@@_mark \q_@@_tail
+    \@@_loop_other:NNw #1 , \q_@@_tail ,
+    \@@_loop_active:NNw #2 \q_@@_mark
   {}
 \cs_new:Npn \@@_end_loop_other:w
-    \q_mark \q_recursion_tail
-    \@@_if_has_equal_other:w #1 = \q_stop
-    \@@_has_false:w \q_mark \q_stop \use_i:nn
+    \q_@@_mark \q_@@_tail
+    \@@_if_has_equal_other:w #1 = \q_@@_stop
+    \@@_has_false:w \q_@@_mark \q_@@_stop \use_i:nn
     #2
-    \@@_loop_other:NNw #3 \q_mark
+    \@@_loop_other:NNw #3 \q_@@_mark
   {}
 %    \end{macrocode}
 % \end{macro}
@@ -1097,12 +1107,12 @@
 %    \begin{macrocode}
 \cs_new:Npn \@@_split_other:wN #1 =
   {
-    \@@_trim:nN { #1 } \@@_split_other_aux:nwN \q_mark
+    \@@_trim:nN { #1 } \@@_split_other_aux:nwN \q_@@_mark
   }
-  \cs_new:Npn \@@_split_other_aux:nwN #1 #2 = #3 \q_stop
+  \cs_new:Npn \@@_split_other_aux:nwN #1 #2 = #3 \q_@@_stop
     {
-      \@@_if_empty:w \q_mark #3 \q_stop
-        \@@_has_false:w \q_mark \q_stop \use_i:nn
+      \@@_if_empty:w \q_@@_mark #3 \q_@@_stop
+        \@@_has_false:w \q_@@_mark \q_@@_stop \use_i:nn
         { \@@_misplaced_equal_error: \use_none:n }
         { \@@_trim:nN { #2 } \@@_key_val:nnN { #1 } }
     }
@@ -1129,8 +1139,8 @@
 %    \begin{macrocode}
 \cs_new:Npn \@@_key_val:nnN #1 #2 #3
   {
-    \@@_if_empty:w \q_mark #2 \q_stop
-      \@@_empty_key:w \q_mark \q_stop
+    \@@_if_empty:w \q_@@_mark #2 \q_@@_stop
+      \@@_empty_key:w \q_@@_mark \q_@@_stop
     \exp_not:n { #3 { #2 } { #1 } }
   }
 %    \end{macrocode}
@@ -1142,9 +1152,9 @@
 %   with an arbitrary token following the argument. Each of these utilize the
 %   fact that the argument will contain a leading \cs{q_mark}.
 %    \begin{macrocode}
-\cs_new:Npn \@@_if_empty:w #1 \q_mark \q_stop {}
-\cs_new:Npn \@@_if_blank:w \q_mark #1 { \@@_if_empty:w \q_mark }
-\cs_new:Npn \@@_if_recursion_tail:w #1 \q_mark \q_recursion_tail {}
+\cs_new:Npn \@@_if_empty:w #1 \q_@@_mark \q_@@_stop {}
+\cs_new:Npn \@@_if_blank:w \q_@@_mark #1 { \@@_if_empty:w \q_@@_mark }
+\cs_new:Npn \@@_if_recursion_tail:w #1 \q_@@_mark \q_@@_tail {}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1152,9 +1162,9 @@
 %   These macros will be called if the tests above didn't gobble them, they
 %   execute the branching.
 %    \begin{macrocode}
-\cs_new:Npn \@@_has_false:w \q_mark \q_stop \use_i:nn #1 #2 { #2 }
-\cs_new:Npn \@@_blank_true:w \q_mark \q_stop \use:n #1 {}
-\cs_new:Npn \@@_empty_key:w \q_mark \q_stop \exp_not:n #1
+\cs_new:Npn \@@_has_false:w \q_@@_mark \q_@@_stop \use_i:nn #1 #2 { #2 }
+\cs_new:Npn \@@_blank_true:w \q_@@_mark \q_@@_stop \use:n #1 {}
+\cs_new:Npn \@@_empty_key:w \q_@@_mark \q_@@_stop \exp_not:n #1
   {
     \@@_misplaced_equal_error:
   }
@@ -1165,7 +1175,7 @@
 %   If we know what to gobble (the \cs{q_mark}), it is faster to name it
 %   explicitly than to use \cs{use_none:n}.
 %    \begin{macrocode}
-\cs_new:Npn \@@_gobble_q_mark:w \q_mark {}
+\cs_new:Npn \@@_gobble_q_mark:w \q_@@_mark {}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1174,7 +1184,7 @@
 %    \begin{macrocode}
 \cs_new:Npn \@@_if_has_equal_other:w #1 =
   {
-    \@@_if_empty:w \q_mark
+    \@@_if_empty:w \q_@@_mark
   }
 %    \end{macrocode}
 % \end{macro}
@@ -1212,37 +1222,37 @@
       {
         \@@_trim_auxi:w
           ##1
-          \q_nil
-          \q_mark #1 {}
-          \q_mark \@@_trim_auxii:w
+          \q_@@_nil
+          \q_@@_mark #1 {}
+          \q_@@_mark \@@_trim_auxii:w
           \@@_trim_auxiii:w
-          #1 \q_nil
+          #1 \q_@@_nil
           \@@_trim_auxiv:w
-        \q_stop
+        \q_@@_stop
       }
-    \cs_new:Npn \@@_trim_auxi:w ##1 \q_mark #1 ##2 \q_mark ##3
+    \cs_new:Npn \@@_trim_auxi:w ##1 \q_@@_mark #1 ##2 \q_@@_mark ##3
       {
         ##3
         \@@_trim_auxi:w
-        \q_mark
+        \q_@@_mark
         ##2
-        \q_mark #1 {##1}
+        \q_@@_mark #1 {##1}
       }
-    \cs_new:Npn \@@_trim_auxii:w \@@_trim_auxi:w \q_mark \q_mark ##1
+    \cs_new:Npn \@@_trim_auxii:w \@@_trim_auxi:w \q_@@_mark \q_@@_mark ##1
       {
         \@@_trim_auxiii:w
         ##1
       }
-    \cs_new:Npn \@@_trim_auxiii:w ##1 #1 \q_nil ##2
+    \cs_new:Npn \@@_trim_auxiii:w ##1 #1 \q_@@_nil ##2
       {
         ##2
-        ##1 \q_nil
+        ##1 \q_@@_nil
         \@@_trim_auxiii:w
       }
 %    \end{macrocode}
 %   This is the one macro which differs from the original definition.
 %    \begin{macrocode}
-    \cs_new:Npn \@@_trim_auxiv:w \q_mark ##1 \q_nil ##2 \q_stop ##3
+    \cs_new:Npn \@@_trim_auxiv:w \q_@@_mark ##1 \q_@@_nil ##2 \q_@@_stop ##3
       {
         ##3 { ##1 }
       }





More information about the latex3-commits mailing list.