[latex3-commits] [git/LaTeX3-latex3-latex3] cs-delimited-args: Change single-char to single-token (541b89d3c)

PhelypeOleinik tex.phelype at gmail.com
Tue Feb 25 18:16:27 CET 2020


Repository : https://github.com/latex3/latex3
On branch  : cs-delimited-args
Link       : https://github.com/latex3/latex3/commit/541b89d3ceb45e3d4f4b71779f08511ebe8d3aa0

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

commit 541b89d3ceb45e3d4f4b71779f08511ebe8d3aa0
Author: PhelypeOleinik <tex.phelype at gmail.com>
Date:   Tue Feb 25 14:16:27 2020 -0300

    Change single-char to single-token


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

541b89d3ceb45e3d4f4b71779f08511ebe8d3aa0
 l3packages/xparse/xparse.dtx | 41 +++++++++++++++--------------------------
 1 file changed, 15 insertions(+), 26 deletions(-)

diff --git a/l3packages/xparse/xparse.dtx b/l3packages/xparse/xparse.dtx
index 5a74dcbb2..4e6f4c7a0 100644
--- a/l3packages/xparse/xparse.dtx
+++ b/l3packages/xparse/xparse.dtx
@@ -1906,8 +1906,8 @@
 \cs_new_protected:Npn \@@_normalize_type_D:w #1#2#3
   {
     \quark_if_recursion_tail_stop_do:nn {#3} { \@@_bad_arg_spec:wn }
-    \@@_single_char_check:n {#1}
-    \@@_single_char_check:n {#2}
+    \@@_single_token_check:n {#1}
+    \@@_single_token_check:n {#2}
     \@@_add_arg_spec:n { D #1 #2 {#3} }
     \tl_put_right:Nn \l_@@_last_delimiters_tl {#1}
     \bool_set_false:N \l_@@_grab_expandably_bool
@@ -1917,7 +1917,7 @@
   {
     \quark_if_recursion_tail_stop_do:nn {#2} { \@@_bad_arg_spec:wn }
     \tl_if_blank:nT {#1} { \@@_bad_arg_spec:wn }
-    \tl_map_function:nN {#1} \@@_single_char_check:n
+    \tl_map_function:nN {#1} \@@_single_token_check:n
     \@@_normalize_E_unique_check:w #1 \q_nil \q_stop
     \int_compare:nNnT { \tl_count:n {#2} } > { \tl_count:n {#1} }
       { \@@_bad_arg_spec:wn }
@@ -1946,7 +1946,7 @@
 \cs_new_protected:Npn \@@_normalize_type_t:w #1
   {
     \quark_if_recursion_tail_stop_do:Nn #1 { \@@_bad_arg_spec:wn }
-    \@@_single_char_check:n {#1}
+    \@@_single_token_check:n {#1}
     \tl_put_right:Nx \l_@@_arg_spec_tl
       {
         \bool_if:NT \l_@@_obey_spaces_bool { ! }
@@ -1994,8 +1994,8 @@
 \cs_new_protected:Npn \@@_normalize_type_R:w #1#2#3
   {
     \quark_if_recursion_tail_stop_do:nn {#3} { \@@_bad_arg_spec:wn }
-    \@@_single_char_check:n {#1}
-    \@@_single_char_check:n {#2}
+    \@@_single_token_check:n {#1}
+    \@@_single_token_check:n {#2}
     \@@_delimiter_check:nnn {#1} { R/r } { \tl_to_str:n {#1} }
     \bool_set_false:N \l_@@_grab_expandably_bool
     \@@_add_arg_spec_mandatory:n { R #1 #2 {#3} }
@@ -2042,26 +2042,15 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\@@_single_char_check:n}
-%   Checks that what should be single characters really are single
-%   characters (possibly surrounded by spaces).
+% \begin{macro}{\@@_single_token_check:n}
+%   Checks that the argument is a single token (possibly surrounded by
+%   spaces), and aborts the definition otherwise.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_single_char_check:n #1
+\cs_new_protected:Npn \@@_single_token_check:n #1
   {
-    \tl_trim_spaces_apply:nN {#1} \tl_if_single_token:nTF
+    \tl_trim_spaces_apply:nN {#1} \tl_if_single_token:nF
       {
-        \group_begin:
-        \tex_escapechar:D = 92 \scan_stop:
-        \exp_args:Nx \tl_if_single_token:nF
-          { \exp_args:No \tl_to_str:n { \use:nn #1 { } } }
-          {
-            \__kernel_msg_warning:nnxx { xparse } { not-single-char }
-              { \@@_environment_or_command: } { \tl_to_str:n {#1} }
-          }
-        \group_end:
-      }
-      {
-        \__kernel_msg_error:nnxx { xparse } { not-single-char }
+        \__kernel_msg_error:nnxx { xparse } { not-single-token }
           { \@@_environment_or_command: } { \tl_to_str:n {#1} }
         \@@_bad_def:wn
       }
@@ -4506,14 +4495,14 @@
     token.~Perhaps~a~backslash~is~missing?
     \c_@@_ignore_def_tl
   }
-\__kernel_msg_new:nnnn { xparse } { not-single-char }
+\__kernel_msg_new:nnnn { xparse } { not-single-token }
   {
     Argument~delimiter~'#2'~for~the~#1~should~be~
-    a~single~character.
+    a~single~token.
   }
   {
     The~argument~specification~provided~was~not~valid:~in~a~place~
-    where~a~single~character~is~required,~LaTeX~found~'#2'.
+    where~a~single~token~is~required,~LaTeX~found~'#2'.
     \c_@@_ignore_def_tl
   }
 \__kernel_msg_new:nnnn { xparse } { processor-in-expandable }





More information about the latex3-commits mailing list.