[latex3-commits] [l3svn] r6853 - In xparse, distinguish argument specification from signature

noreply at latex-project.org noreply at latex-project.org
Wed Feb 8 19:47:13 CET 2017


Author: bruno
Date: 2017-02-08 19:47:13 +0100 (Wed, 08 Feb 2017)
New Revision: 6853

Modified:
   trunk/l3packages/xparse/xparse.dtx
Log:
In xparse, distinguish argument specification from signature

We've consistently called the list of letters describing arguments
an "argument specification" and the code to grab arguments a "signature".
It's a somewhat arbitrary naming but I made sure new additions follow it.


Modified: trunk/l3packages/xparse/xparse.dtx
===================================================================
--- trunk/l3packages/xparse/xparse.dtx	2017-02-08 15:00:22 UTC (rev 6852)
+++ trunk/l3packages/xparse/xparse.dtx	2017-02-08 18:47:13 UTC (rev 6853)
@@ -184,7 +184,8 @@
 %   \item[e] An optional set of \emph{embellishments}, each of which requires a
 %     \emph{value}. If a key is not present, |-NoValue-| is returned.
 %     The returned data is a token list comprising one braced entry per key,
-%     ordered as for the key list in the signature.  Given as \texttt{e}\marg{tokens}.
+%     ordered as for the key list in the argument specification.  Given as
+%     \texttt{e}\marg{tokens}.
 %     \emph{This is an experimental type}.
 %   \item[E] As for \texttt{e} but returns one or more \meta{defaults}
 %     if values are not given: \texttt{E}\marg{tokens}\marg{defaults}. See
@@ -794,6 +795,13 @@
 %    \end{macrocode}
 % \end{variable}
 %
+% \begin{variable}{\l_@@_arg_spec_tl}
+%   Holds the argument specification after normalization of shorthands.
+%    \begin{macrocode}
+\tl_new:N \l_@@_arg_spec_tl
+%    \end{macrocode}
+% \end{variable}
+%
 % \begin{variable}{\l_@@_args_tl}
 %   Token list variable for grabbed arguments.
 %    \begin{macrocode}
@@ -1009,14 +1017,14 @@
   }
 %    \end{macrocode}
 %   The real business of defining a document command starts with setting up
-%   the appropriate name, then normalizing the signature to get rid of
+%   the appropriate name, then normalizing the argument specification to get rid of
 %   shorthands (this step also counts the number of mandatory arguments).
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_declare_cmd_internal:Nnn #1#2#3
   {
     \tl_set:Nx \l_@@_function_tl { \cs_to_str:N #1 }
-    \@@_normalize_signature:n {#2}
-    \exp_args:No \@@_prepare_signature:n \l_@@_signature_tl
+    \@@_normalize_arg_spec:n {#2}
+    \exp_args:No \@@_prepare_signature:n \l_@@_arg_spec_tl
     \int_compare:nNnTF \l_@@_current_arg_int = \l_@@_m_args_int
       {
         \bool_if:NTF \l_@@_environment_bool
@@ -1069,7 +1077,7 @@
       { \@@_declare_cmd_mixed_aux:Nn }
    }
 %    \end{macrocode}
-%   Standard functions with mixed arg.~specs call
+%   Standard functions with mixed argument specifications call
 %   \cs{@@_start_cmd:NNnnn}, which receives an auxiliary used for
 %   grabbing arguments, an auxiliary containing the code, and then the
 %   signature, default arguments, and processors.
@@ -1305,24 +1313,24 @@
 % \end{macro}
 % \end{macro}
 %
-% \subsection{Normalizing the signature}
+% \subsection{Normalizing the argument specifications}
 %
-% \begin{macro}{\@@_normalize_signature:n}
-% \begin{macro}{\@@_normalize_signature_loop:n}
-%   Loop through the signature to get rid of shorthands, check the
-%   signature is valid, and count up mandatory arguments before the main
+% \begin{macro}{\@@_normalize_arg_spec:n}
+% \begin{macro}{\@@_normalize_arg_spec_loop:n}
+%   Loop through the argument specification to get rid of shorthands, check the
+%   argument specification is valid, and count up mandatory arguments before the main
 %   parsing run.  While normally the auxiliary should only get single
-%   tokens, we allow multiple tokens to catch invalid signatures as
+%   tokens, we allow multiple tokens to catch invalid argument specifications as
 %   \enquote{unknown argument types}.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_normalize_signature:n #1
+\cs_new_protected:Npn \@@_normalize_arg_spec:n #1
   {
     \int_zero:N \l_@@_mandatory_args_int
-    \tl_clear:N \l_@@_signature_tl
-    \@@_normalize_signature_loop:n #1
+    \tl_clear:N \l_@@_arg_spec_tl
+    \@@_normalize_arg_spec_loop:n #1
       \q_recursion_tail \q_recursion_tail \q_recursion_tail \q_recursion_stop
   }
-\cs_new_protected:Npn \@@_normalize_signature_loop:n #1
+\cs_new_protected:Npn \@@_normalize_arg_spec_loop:n #1
   {
     \quark_if_recursion_tail_stop:n {#1}
     \cs_if_exist_use:cF { @@_normalize_type_ \tl_to_str:n {#1} :w }
@@ -1390,129 +1398,129 @@
           { \iow_char:N\\ \l_@@_function_tl }
         \@@_bad_arg_spec_no_error:wn
       }
-    \tl_put_right:Nn \l_@@_signature_tl { > {#1} }
-    \@@_normalize_signature_loop:n {#2}
+    \tl_put_right:Nn \l_@@_arg_spec_tl { > {#1} }
+    \@@_normalize_arg_spec_loop:n {#2}
   }
 \cs_new_protected:cpn { @@_normalize_type_+:w } #1
   {
     \quark_if_recursion_tail_stop_do:nn {#1} { \@@_bad_arg_spec:wn }
-    \tl_put_right:Nn \l_@@_signature_tl { + }
-    \@@_normalize_signature_loop:n {#1}
+    \tl_put_right:Nn \l_@@_arg_spec_tl { + }
+    \@@_normalize_arg_spec_loop:n {#1}
   }
 \cs_new_protected:Npn \@@_normalize_type_d:w #1#2
   {
     \@@_single_token_check:n {#1}
     \@@_single_token_check:n {#2}
     \quark_if_recursion_tail_stop_do:Nn #2 { \@@_bad_arg_spec:wn }
-    \tl_put_right:Nx \l_@@_signature_tl
+    \tl_put_right:Nx \l_@@_arg_spec_tl
       { \exp_not:n { D #1 #2 } { \c_@@_no_value_tl } }
-    \@@_normalize_signature_loop:n
+    \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_D:w #1#2#3
   {
     \@@_single_token_check:n {#1}
     \@@_single_token_check:n {#2}
     \quark_if_recursion_tail_stop_do:nn {#3} { \@@_bad_arg_spec:wn }
-    \tl_put_right:Nn \l_@@_signature_tl { D #1 #2 {#3} }
-    \@@_normalize_signature_loop:n
+    \tl_put_right:Nn \l_@@_arg_spec_tl { D #1 #2 {#3} }
+    \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_e:w #1
   {
     \quark_if_recursion_tail_stop_do:nn {#1} { \@@_bad_arg_spec:wn }
     \@@_normalize_error_if_expandable:N e
-    \tl_put_right:Nn \l_@@_signature_tl { E {#1} { } }
-    \@@_normalize_signature_loop:n
+    \tl_put_right:Nn \l_@@_arg_spec_tl { E {#1} { } }
+    \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_E:w #1#2
   {
     \quark_if_recursion_tail_stop_do:nn {#2} { \@@_bad_arg_spec:wn }
     \@@_normalize_error_if_expandable:N E
-    \tl_put_right:Nn \l_@@_signature_tl { E {#1} {#2} }
-    \@@_normalize_signature_loop:n
+    \tl_put_right:Nn \l_@@_arg_spec_tl { E {#1} {#2} }
+    \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_g:w
   {
     \@@_normalize_error_if_expandable:N g
-    \tl_put_right:Nx \l_@@_signature_tl { G { \c_@@_no_value_tl } }
-    \@@_normalize_signature_loop:n
+    \tl_put_right:Nx \l_@@_arg_spec_tl { G { \c_@@_no_value_tl } }
+    \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_G:w #1
   {
     \quark_if_recursion_tail_stop_do:nn {#1} { \@@_bad_arg_spec:wn }
     \@@_normalize_error_if_expandable:N G
-    \tl_put_right:Nn \l_@@_signature_tl { G {#1} }
-    \@@_normalize_signature_loop:n
+    \tl_put_right:Nn \l_@@_arg_spec_tl { G {#1} }
+    \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_l:w
   {
     \@@_normalize_error_if_expandable:N l
     \int_incr:N \l_@@_mandatory_args_int
-    \tl_put_right:Nn \l_@@_signature_tl { l }
-    \@@_normalize_signature_loop:n
+    \tl_put_right:Nn \l_@@_arg_spec_tl { l }
+    \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_m:w
   {
     \int_incr:N \l_@@_mandatory_args_int
-    \tl_put_right:Nn \l_@@_signature_tl { m }
-    \@@_normalize_signature_loop:n
+    \tl_put_right:Nn \l_@@_arg_spec_tl { m }
+    \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_o:w
   {
-    \tl_put_right:Nx \l_@@_signature_tl
+    \tl_put_right:Nx \l_@@_arg_spec_tl
       { \exp_not:n { D [ ] } { \c_@@_no_value_tl } }
-    \@@_normalize_signature_loop:n
+    \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_O:w #1
   {
     \quark_if_recursion_tail_stop_do:nn {#1} { \@@_bad_arg_spec:wn }
-    \tl_put_right:Nn \l_@@_signature_tl { D [ ] {#1} }
-    \@@_normalize_signature_loop:n
+    \tl_put_right:Nn \l_@@_arg_spec_tl { D [ ] {#1} }
+    \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_r:w #1#2
   {
     \@@_single_token_check:n {#1}
     \@@_single_token_check:n {#2}
     \quark_if_recursion_tail_stop_do:Nn #2 { \@@_bad_arg_spec:wn }
-    \tl_put_right:Nx \l_@@_signature_tl
+    \tl_put_right:Nx \l_@@_arg_spec_tl
       { \exp_not:n { R #1 #2 } { \c_@@_no_value_tl } }
     \int_incr:N \l_@@_mandatory_args_int
-    \@@_normalize_signature_loop:n
+    \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_R:w #1#2#3
   {
     \@@_single_token_check:n {#1}
     \@@_single_token_check:n {#2}
     \quark_if_recursion_tail_stop_do:nn {#3} { \@@_bad_arg_spec:wn }
-    \tl_put_right:Nn \l_@@_signature_tl { R #1 #2 {#3} }
+    \tl_put_right:Nn \l_@@_arg_spec_tl { R #1 #2 {#3} }
     \int_incr:N \l_@@_mandatory_args_int
-    \@@_normalize_signature_loop:n
+    \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_s:w
   {
-    \tl_put_right:Nn \l_@@_signature_tl { t * }
-    \@@_normalize_signature_loop:n
+    \tl_put_right:Nn \l_@@_arg_spec_tl { t * }
+    \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_t:w #1
   {
     \@@_single_token_check:n {#1}
     \quark_if_recursion_tail_stop_do:Nn #1 { \@@_bad_arg_spec:wn }
-    \tl_put_right:Nn \l_@@_signature_tl { t #1 }
-    \@@_normalize_signature_loop:n
+    \tl_put_right:Nn \l_@@_arg_spec_tl { t #1 }
+    \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_u:w #1
   {
     \quark_if_recursion_tail_stop_do:nn {#1} { \@@_bad_arg_spec:wn }
     \@@_normalize_error_if_expandable:N u
-    \tl_put_right:Nn \l_@@_signature_tl { u {#1} }
+    \tl_put_right:Nn \l_@@_arg_spec_tl { u {#1} }
     \int_incr:N \l_@@_mandatory_args_int
-    \@@_normalize_signature_loop:n
+    \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_v:w
   {
     \@@_normalize_error_if_expandable:N v
     \int_incr:N \l_@@_mandatory_args_int
-    \tl_put_right:Nn \l_@@_signature_tl { v }
-    \@@_normalize_signature_loop:n
+    \tl_put_right:Nn \l_@@_arg_spec_tl { v }
+    \@@_normalize_arg_spec_loop:n
   }
 %    \end{macrocode}
 % \end{macro}
@@ -1549,7 +1557,7 @@
 % \end{macro}
 %
 % \begin{macro}{\@@_bad_arg_spec:wn, \@@_bad_arg_spec_no_error:wn}
-%   If the signature is wrong, this provides an escape from the entire
+%   If the argument specification is wrong, this provides an escape from the entire
 %   definition process.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_bad_arg_spec:wn #1 \@@_break_point:n #2



More information about the latex3-commits mailing list