[latex3-commits] [git/latex3] master: Reorder variants by N, c, n, o, V, v, f, x in l3expan (a2fbeca)

Bruno Le Floch bruno at le-floch.fr
Mon Nov 27 23:20:51 CET 2017


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

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

commit a2fbeca5acfddc79a3677b83f1db1210102e88aa
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Mon Nov 27 15:05:15 2017 -0500

    Reorder variants by N,c,n,o,V,v,f,x in l3expan
    
    The order was a mess.


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

a2fbeca5acfddc79a3677b83f1db1210102e88aa
 l3kernel/l3expan.dtx |  231 ++++++++++++++++++++++++--------------------------
 1 file changed, 111 insertions(+), 120 deletions(-)

diff --git a/l3kernel/l3expan.dtx b/l3kernel/l3expan.dtx
index dff2509..744a11d 100644
--- a/l3kernel/l3expan.dtx
+++ b/l3kernel/l3expan.dtx
@@ -258,17 +258,6 @@
 % These functions are described in detail: expansion of multiple tokens follows
 % the same rules but is described in a shorter fashion.
 %
-% \begin{function}[EXP]{\exp_args:No}
-%   \begin{syntax}
-%     \cs{exp_args:No} \meta{function} \Arg{tokens} ...
-%   \end{syntax}
-%   This function absorbs two arguments (the \meta{function} name and
-%   the \meta{tokens}). The \meta{tokens} are expanded once, and the result
-%   is inserted in braces into the input stream \emph{after} reinsertion
-%   of the \meta{function}. Thus the \meta{function} may take more than
-%   one argument: all others are left unchanged.
-% \end{function}
-%
 % \begin{function}[EXP]{\exp_args:Nc, \exp_args:cc}
 %   \begin{syntax}
 %     \cs{exp_args:Nc} \meta{function} \Arg{tokens}
@@ -285,6 +274,17 @@
 %   manner as described for the \meta{tokens}.
 % \end{function}
 %
+% \begin{function}[EXP]{\exp_args:No}
+%   \begin{syntax}
+%     \cs{exp_args:No} \meta{function} \Arg{tokens} ...
+%   \end{syntax}
+%   This function absorbs two arguments (the \meta{function} name and
+%   the \meta{tokens}). The \meta{tokens} are expanded once, and the result
+%   is inserted in braces into the input stream \emph{after} reinsertion
+%   of the \meta{function}. Thus the \meta{function} may take more than
+%   one argument: all others are left unchanged.
+% \end{function}
+%
 % \begin{function}[EXP]{\exp_args:NV}
 %   \begin{syntax}
 %     \cs{exp_args:NV} \meta{function} \meta{variable}
@@ -340,16 +340,16 @@
 %
 % \begin{function}[EXP]
 %   {
-%     \exp_args:NNo,
 %     \exp_args:NNc,
-%     \exp_args:NNv,
+%     \exp_args:NNo,
 %     \exp_args:NNV,
+%     \exp_args:NNv,
 %     \exp_args:NNf,
-%     \exp_args:Nco,
-%     \exp_args:Ncf,
 %     \exp_args:Ncc,
+%     \exp_args:Nco,
 %     \exp_args:NcV,
 %     \exp_args:Ncv,
+%     \exp_args:Ncf,
 %     \exp_args:NVV
 %   }
 %   \begin{syntax}
@@ -363,17 +363,17 @@
 %
 % \begin{function}[EXP, updated = 2012-01-14]
 %   {
+%     \exp_args:Nnc,
 %     \exp_args:Nno,
 %     \exp_args:NnV,
 %     \exp_args:Nnv,
 %     \exp_args:Nnf,
+%     \exp_args:Noc,
 %     \exp_args:Noo,
 %     \exp_args:Nof,
-%     \exp_args:Noc,
+%     \exp_args:NVo,
 %     \exp_args:Nfo,
 %     \exp_args:Nff,
-%     \exp_args:NVo,
-%     \exp_args:Nnc
 %   }
 %   \begin{syntax}
 %     \cs{exp_args:Noo} \meta{token} \Arg{tokens_1} \Arg{tokens_2}
@@ -388,8 +388,8 @@
 % \begin{function}
 %   {
 %     \exp_args:NNx,
-%     \exp_args:Nnx,
 %     \exp_args:Ncx,
+%     \exp_args:Nnx,
 %     \exp_args:Nox,
 %     \exp_args:Nxo,
 %     \exp_args:Nxx
@@ -435,8 +435,8 @@
 %     \exp_args:NcnV,
 %     \exp_args:Ncoo,
 %     \exp_args:NcVV,
-%     \exp_args:Nnno,
 %     \exp_args:Nnnc,
+%     \exp_args:Nnno,
 %     \exp_args:Nnnf,
 %     \exp_args:Nnff,
 %     \exp_args:Nooo,
@@ -458,11 +458,11 @@
 %     \exp_args:NNNx,
 %     \exp_args:NNnx,
 %     \exp_args:NNox,
+%     \exp_args:Nccx,
+%     \exp_args:Ncnx,
 %     \exp_args:Nnnx,
 %     \exp_args:Nnox,
 %     \exp_args:Noox,
-%     \exp_args:Ncnx,
-%     \exp_args:Nccx
 %   }
 %   \begin{syntax}
 %     \cs{exp_args:NNnx} \meta{token_1} \meta{token_2} \Arg{tokens_1} \Arg{tokens_2}
@@ -477,19 +477,19 @@
 %
 % \begin{function}[EXP, updated = 2012-02-12]
 %   {
-%     \exp_last_unbraced:NV,
-%     \exp_last_unbraced:Nf,
 %     \exp_last_unbraced:No,
+%     \exp_last_unbraced:NV,
 %     \exp_last_unbraced:Nv,
+%     \exp_last_unbraced:Nf,
+%     \exp_last_unbraced:NNo,
+%     \exp_last_unbraced:NNV,
 %     \exp_last_unbraced:Nco,
 %     \exp_last_unbraced:NcV,
-%     \exp_last_unbraced:NNV,
-%     \exp_last_unbraced:NNo,
 %     \exp_last_unbraced:Nno,
 %     \exp_last_unbraced:Noo,
 %     \exp_last_unbraced:Nfo,
-%     \exp_last_unbraced:NNNV,
 %     \exp_last_unbraced:NNNo,
+%     \exp_last_unbraced:NNNV,
 %     \exp_last_unbraced:NnNo
 %     }
 %   \begin{syntax}
@@ -599,6 +599,14 @@
 %   \end{texnote}
 % \end{function}
 %
+% \begin{function}[EXP]{\exp_not:o}
+%   \begin{syntax}
+%     \cs{exp_not:o} \Arg{tokens}
+%   \end{syntax}
+%   Expands the \meta{tokens} once, then prevents any further expansion
+%   in |x|-type arguments using \cs{exp_not:n}.
+% \end{function}
+%
 % \begin{function}[EXP]{\exp_not:V}
 %   \begin{syntax}
 %     \cs{exp_not:V} \meta{variable}
@@ -619,14 +627,6 @@
 %   expansion in |x|-type arguments is prevented using \cs{exp_not:n}.
 % \end{function}
 %
-% \begin{function}[EXP]{\exp_not:o}
-%   \begin{syntax}
-%     \cs{exp_not:o} \Arg{tokens}
-%   \end{syntax}
-%   Expands the \meta{tokens} once, then prevents any further expansion
-%   in |x|-type arguments using \cs{exp_not:n}.
-% \end{function}
-%
 % \begin{function}[EXP]{\exp_not:f}
 %   \begin{syntax}
 %     \cs{exp_not:f} \Arg{tokens}
@@ -1056,21 +1056,6 @@
 % One of the most important features of these functions is that they
 % are fully expandable.
 %
-% \begin{macro}[EXP]{\exp_args:No}
-% \begin{macro}[EXP]{\exp_args:NNo}
-% \begin{macro}[EXP]{\exp_args:NNNo}
-%   Those lovely runs of expansion!
-%    \begin{macrocode}
-\cs_new:Npn \exp_args:No #1#2 { \exp_after:wN #1 \exp_after:wN {#2} }
-\cs_new:Npn \exp_args:NNo #1#2#3
-  { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN {#3} }
-\cs_new:Npn \exp_args:NNNo #1#2#3#4
-  { \exp_after:wN #1 \exp_after:wN#2 \exp_after:wN #3 \exp_after:wN {#4} }
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
 % \begin{macro}[EXP]{\exp_args:Nc, \exp_args:cc}
 %   In \pkg{l3basics}.
 % \end{macro}
@@ -1093,6 +1078,21 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}[EXP]{\exp_args:No}
+% \begin{macro}[EXP]{\exp_args:NNo}
+% \begin{macro}[EXP]{\exp_args:NNNo}
+%   Those lovely runs of expansion!
+%    \begin{macrocode}
+\cs_new:Npn \exp_args:No #1#2 { \exp_after:wN #1 \exp_after:wN {#2} }
+\cs_new:Npn \exp_args:NNo #1#2#3
+  { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN {#3} }
+\cs_new:Npn \exp_args:NNNo #1#2#3#4
+  { \exp_after:wN #1 \exp_after:wN#2 \exp_after:wN #3 \exp_after:wN {#4} }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
 % \begin{macro}[EXP]{\exp_args:Nf, \exp_args:NV, \exp_args:Nv}
 %    \begin{macrocode}
 \cs_new:Npn \exp_args:Nf #1#2
@@ -1113,19 +1113,19 @@
 % \begin{macro}[EXP]
 %   {
 %     \exp_args:NNV, \exp_args:NNv, \exp_args:NNf,
+%     \exp_args:Nco, \exp_args:NcV, \exp_args:Ncv, \exp_args:Ncf,
 %     \exp_args:NVV,
-%     \exp_args:Ncf, \exp_args:Nco, \exp_args:NcV, \exp_args:NcV
 %   }
 %   Some more hand-tuned function with three arguments.
 %   If we forced that an |o| argument always has braces,
 %   we could implement \cs{exp_args:Nco} with less tokens
 %   and only two arguments.
 %    \begin{macrocode}
-\cs_new:Npn \exp_args:NNf #1#2#3
+\cs_new:Npn \exp_args:NNV #1#2#3
   {
     \exp_after:wN #1
     \exp_after:wN #2
-    \exp_after:wN { \exp:w \exp_end_continue_f:w #3 }
+    \exp_after:wN { \exp:w \@@_eval_register:N #3 }
   }
 \cs_new:Npn \exp_args:NNv #1#2#3
   {
@@ -1133,11 +1133,11 @@
     \exp_after:wN #2
     \exp_after:wN { \exp:w \@@_eval_register:c {#3} }
   }
-\cs_new:Npn \exp_args:NNV #1#2#3
+\cs_new:Npn \exp_args:NNf #1#2#3
   {
     \exp_after:wN #1
     \exp_after:wN #2
-    \exp_after:wN { \exp:w \@@_eval_register:N #3 }
+    \exp_after:wN { \exp:w \exp_end_continue_f:w #3 }
   }
 \cs_new:Npn \exp_args:Nco #1#2#3
   {
@@ -1145,12 +1145,6 @@
     \cs:w #2 \exp_after:wN \cs_end:
     \exp_after:wN {#3}
   }
-\cs_new:Npn \exp_args:Ncf #1#2#3
-  {
-    \exp_after:wN #1
-    \cs:w #2 \exp_after:wN \cs_end:
-    \exp_after:wN { \exp:w \exp_end_continue_f:w #3 }
-  }
 \cs_new:Npn \exp_args:NcV #1#2#3
   {
     \exp_after:wN #1
@@ -1163,6 +1157,12 @@
     \cs:w #2 \exp_after:wN \cs_end:
     \exp_after:wN { \exp:w \@@_eval_register:c {#3} }
   }
+\cs_new:Npn \exp_args:Ncf #1#2#3
+  {
+    \exp_after:wN #1
+    \cs:w #2 \exp_after:wN \cs_end:
+    \exp_after:wN { \exp:w \exp_end_continue_f:w #3 }
+  }
 \cs_new:Npn \exp_args:NVV #1#2#3
   {
     \exp_after:wN #1
@@ -1175,8 +1175,8 @@
 %
 % \begin{macro}[EXP]
 %   {
-%     \exp_args:Ncco, \exp_args:NcNc, \exp_args:NcNo,
-%     \exp_args:NNNV
+%     \exp_args:NNNV, \exp_args:NcNc, \exp_args:NcNo,
+%     \exp_args:Ncco,
 %   }
 %   A few more that we can hand-tune.
 %    \begin{macrocode}
@@ -1226,10 +1226,9 @@
 %
 % \begin{macro}[EXP]
 %   {
-%     \exp_args:Nnc, \exp_args:Nfo, \exp_args:Nff, \exp_args:Nnf,
-%     \exp_args:NVo,
-%     \exp_args:Nno, \exp_args:NnV, \exp_args:Nnv, \exp_args:Noo, \exp_args:Nof,
-%     \exp_args:Noc
+%     \exp_args:Nnc, \exp_args:Nno, \exp_args:NnV, \exp_args:Nnv, \exp_args:Nnf,
+%     \exp_args:Noc, \exp_args:Noo, \exp_args:Nof,
+%     \exp_args:NVo, \exp_args:Nfo, \exp_args:Nff,
 %   }
 % \begin{macro}
 %   {
@@ -1240,16 +1239,16 @@
 %   above.
 %    \begin{macrocode}
 \cs_new:Npn \exp_args:Nnc { \::n \::c \::: }
-\cs_new:Npn \exp_args:Nfo { \::f \::o \::: }
-\cs_new:Npn \exp_args:Nff { \::f \::f \::: }
-\cs_new:Npn \exp_args:Nnf { \::n \::f \::: }
 \cs_new:Npn \exp_args:Nno { \::n \::o \::: }
 \cs_new:Npn \exp_args:NnV { \::n \::V \::: }
 \cs_new:Npn \exp_args:Nnv { \::n \::v \::: }
+\cs_new:Npn \exp_args:Nnf { \::n \::f \::: }
+\cs_new:Npn \exp_args:Noc { \::o \::c \::: }
 \cs_new:Npn \exp_args:Noo { \::o \::o \::: }
 \cs_new:Npn \exp_args:Nof { \::o \::f \::: }
-\cs_new:Npn \exp_args:Noc { \::o \::c \::: }
 \cs_new:Npn \exp_args:NVo { \::V \::o \::: }
+\cs_new:Npn \exp_args:Nfo { \::f \::o \::: }
+\cs_new:Npn \exp_args:Nff { \::f \::f \::: }
 \cs_new_protected:Npn \exp_args:NNx { \::N \::x \::: }
 \cs_new_protected:Npn \exp_args:Ncx { \::c \::x \::: }
 \cs_new_protected:Npn \exp_args:Nnx { \::n \::x \::: }
@@ -1270,9 +1269,9 @@
 %   }
 % \begin{macro}
 %   {
-%     \exp_args:NNNx,
-%     \exp_args:NNnx, \exp_args:NNox, \exp_args:Nnnx, \exp_args:Nnox,
-%     \exp_args:Nccx, \exp_args:Ncnx, \exp_args:Noox,
+%     \exp_args:NNNx, \exp_args:NNnx, \exp_args:NNox,
+%     \exp_args:Nccx, \exp_args:Ncnx,
+%     \exp_args:Nnnx, \exp_args:Nnox, \exp_args:Noox,
 %   }
 %    \begin{macrocode}
 \cs_new:Npn \exp_args:NNcf { \::N \::c \::f \::: }
@@ -1306,20 +1305,15 @@
 % \subsection{Last-unbraced versions}
 %
 % \begin{macro}[aux, EXP]{\@@_arg_last_unbraced:nn}
-% \begin{macro}[aux, EXP]{\::f_unbraced}
 % \begin{macro}[aux, EXP]{\::o_unbraced}
 % \begin{macro}[aux, EXP]{\::V_unbraced}
 % \begin{macro}[aux, EXP]{\::v_unbraced}
+% \begin{macro}[aux, EXP]{\::f_unbraced}
 % \begin{macro}[aux, EXP]{\::x_unbraced}
 %   There are a few places where the last argument needs to be available
 %   unbraced. First some helper macros.
 %    \begin{macrocode}
 \cs_new:Npn \@@_arg_last_unbraced:nn #1#2 { #2#1 }
-\cs_new:Npn \::f_unbraced \::: #1#2
-  {
-    \exp_after:wN \@@_arg_last_unbraced:nn
-      \exp_after:wN { \exp:w \exp_end_continue_f:w #2 } {#1}
-  }
 \cs_new:Npn \::o_unbraced \::: #1#2
   { \exp_after:wN \@@_arg_last_unbraced:nn \exp_after:wN {#2} {#1} }
 \cs_new:Npn \::V_unbraced \::: #1#2
@@ -1332,6 +1326,11 @@
     \exp_after:wN \@@_arg_last_unbraced:nn
       \exp_after:wN { \exp:w \@@_eval_register:c {#2} } {#1}
   }
+\cs_new:Npn \::f_unbraced \::: #1#2
+  {
+    \exp_after:wN \@@_arg_last_unbraced:nn
+      \exp_after:wN { \exp:w \exp_end_continue_f:w #2 } {#1}
+  }
 \cs_new_protected:Npn \::x_unbraced \::: #1#2
   {
     \cs_set_nopar:Npx \l_@@_internal_tl { \exp_not:n {#1} #2 }
@@ -1345,47 +1344,52 @@
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}[EXP]{\exp_last_unbraced:NV}
-% \begin{macro}[EXP]{\exp_last_unbraced:Nv}
-% \begin{macro}[EXP]{\exp_last_unbraced:Nf}
-% \begin{macro}[EXP]{\exp_last_unbraced:No}
-% \begin{macro}[EXP]{\exp_last_unbraced:Nco}
-% \begin{macro}[EXP]{\exp_last_unbraced:NcV}
-% \begin{macro}[EXP]{\exp_last_unbraced:NNV}
-% \begin{macro}[EXP]{\exp_last_unbraced:NNo}
-% \begin{macro}[EXP]{\exp_last_unbraced:NNNV}
-% \begin{macro}[EXP]{\exp_last_unbraced:NNNo}
-% \begin{macro}[EXP]{\exp_last_unbraced:Nno}
-% \begin{macro}[EXP]{\exp_last_unbraced:Noo}
-% \begin{macro}[EXP]{\exp_last_unbraced:Nfo}
-% \begin{macro}[EXP]{\exp_last_unbraced:NnNo}
+% \begin{macro}[EXP]
+%   {
+%     \exp_last_unbraced:No,
+%     \exp_last_unbraced:NV,
+%     \exp_last_unbraced:Nv,
+%     \exp_last_unbraced:Nf,
+%     \exp_last_unbraced:NNo,
+%     \exp_last_unbraced:NNV,
+%     \exp_last_unbraced:Nco,
+%     \exp_last_unbraced:NcV,
+%     \exp_last_unbraced:NNNo,
+%     \exp_last_unbraced:NNNV,
+%     \exp_last_unbraced:Nno,
+%     \exp_last_unbraced:Noo,
+%     \exp_last_unbraced:Nfo,
+%     \exp_last_unbraced:NnNo
+%   }
 % \begin{macro}{\exp_last_unbraced:Nx}
 %   Now the business end: most of these are hand-tuned for speed, but the
 %   general system is in place.
 %    \begin{macrocode}
+\cs_new:Npn \exp_last_unbraced:No #1#2 { \exp_after:wN #1 #2 }
 \cs_new:Npn \exp_last_unbraced:NV #1#2
   { \exp_after:wN #1 \exp:w \@@_eval_register:N #2 }
 \cs_new:Npn \exp_last_unbraced:Nv #1#2
   { \exp_after:wN #1 \exp:w \@@_eval_register:c {#2} }
-\cs_new:Npn \exp_last_unbraced:No #1#2 { \exp_after:wN #1 #2 }
 \cs_new:Npn \exp_last_unbraced:Nf #1#2
   { \exp_after:wN #1 \exp:w \exp_end_continue_f:w #2 }
-\cs_new:Npn \exp_last_unbraced:Nco #1#2#3
-  { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: #3 }
-\cs_new:Npn \exp_last_unbraced:NcV #1#2#3
+\cs_new:Npn \exp_last_unbraced:NNo #1#2#3
+  { \exp_after:wN #1 \exp_after:wN #2 #3 }
+\cs_new:Npn \exp_last_unbraced:NNV #1#2#3
   {
     \exp_after:wN #1
-    \cs:w #2 \exp_after:wN \cs_end:
+    \exp_after:wN #2
     \exp:w \@@_eval_register:N #3
   }
-\cs_new:Npn \exp_last_unbraced:NNV #1#2#3
+\cs_new:Npn \exp_last_unbraced:Nco #1#2#3
+  { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: #3 }
+\cs_new:Npn \exp_last_unbraced:NcV #1#2#3
   {
     \exp_after:wN #1
-    \exp_after:wN #2
+    \cs:w #2 \exp_after:wN \cs_end:
     \exp:w \@@_eval_register:N #3
   }
-\cs_new:Npn \exp_last_unbraced:NNo #1#2#3
-  { \exp_after:wN #1 \exp_after:wN #2 #3 }
+\cs_new:Npn \exp_last_unbraced:NNNo #1#2#3#4
+  { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 #4 }
 \cs_new:Npn \exp_last_unbraced:NNNV #1#2#3#4
   {
     \exp_after:wN #1
@@ -1393,8 +1397,6 @@
     \exp_after:wN #3
     \exp:w \@@_eval_register:N #4
   }
-\cs_new:Npn \exp_last_unbraced:NNNo #1#2#3#4
-  { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 #4 }
 \cs_new:Npn \exp_last_unbraced:Nno { \::n \::o_unbraced \::: }
 \cs_new:Npn \exp_last_unbraced:Noo { \::o \::o_unbraced \::: }
 \cs_new:Npn \exp_last_unbraced:Nfo { \::f \::o_unbraced \::: }
@@ -1403,19 +1405,6 @@
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
 %
 % \begin{macro}[EXP]{\exp_last_two_unbraced:Noo}
 % \begin{macro}[EXP, aux]{\@@_last_two_unbraced:noN}
@@ -1437,14 +1426,16 @@
 %
 % \subsection{Preventing expansion}
 %
-% \begin{macro}[EXP]{\exp_not:o}
 % \begin{macro}[EXP]{\exp_not:c}
+% \begin{macro}[EXP]{\exp_not:o}
 % \begin{macro}[EXP]{\exp_not:f}
 % \begin{macro}[EXP]{\exp_not:V}
 % \begin{macro}[EXP]{\exp_not:v}
+%   All these except \cs{exp_not:c} call the primitive
+%   \cs{etex_unexpanded:D} namely \cs{exp_not:n}.
 %    \begin{macrocode}
-\cs_new:Npn \exp_not:o #1 { \etex_unexpanded:D \exp_after:wN {#1} }
 \cs_new:Npn \exp_not:c #1 { \exp_after:wN \exp_not:N \cs:w #1 \cs_end: }
+\cs_new:Npn \exp_not:o #1 { \etex_unexpanded:D \exp_after:wN {#1} }
 \cs_new:Npn \exp_not:f #1
   { \etex_unexpanded:D \exp_after:wN { \exp:w \exp_end_continue_f:w #1 } }
 \cs_new:Npn \exp_not:V #1





More information about the latex3-commits mailing list