[latex3-commits] [git/LaTeX3-latex3-latex3] gh795: Add \@@_cmd_type_switch:NnnnF (787574bc2)
PhelypeOleinik
phelype.oleinik at latex-project.org
Thu Jan 14 19:30:18 CET 2021
Repository : https://github.com/latex3/latex3
On branch : gh795
Link : https://github.com/latex3/latex3/commit/787574bc23a40b6342db5c0c1471120d0fb9199c
>---------------------------------------------------------------
commit 787574bc23a40b6342db5c0c1471120d0fb9199c
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Thu Jan 14 15:30:18 2021 -0300
Add \@@_cmd_type_switch:NnnnF
and define \@@_cmd_if_xparse:NTF in terms of that
>---------------------------------------------------------------
787574bc23a40b6342db5c0c1471120d0fb9199c
l3packages/xparse/xparse.dtx | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/l3packages/xparse/xparse.dtx b/l3packages/xparse/xparse.dtx
index be204b65b..51809a9f9 100644
--- a/l3packages/xparse/xparse.dtx
+++ b/l3packages/xparse/xparse.dtx
@@ -4571,17 +4571,22 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\@@_cmd_type_switch:NnnnF}
% \begin{macro}{\@@_cmd_if_xparse:NTF}
-% \begin{macro}{\@@_cmd_if_xparse_aux:N}
+% \begin{macro}{\@@_cmd_if_xparse_aux:w}
% To determine whether the command is an \pkg{xparse} command check
% that its |arg_spec| is empty (this also excludes non-macros) and
% that its |replacement_spec| starts with either \cs{@@_start:nNNnnn}
% (non-expandable command) or \cs{@@_start_expandable:nNNNNn}
% (expandable command) or \cs{@@_start_env:nnnnn} (environment).
+% \cs{@@_cmd_type_switch:NnnnF} takes the command as the first
+% argument, and branches to the second, third, and fourth argument
+% if the command is of one of the types above, respectively.
+% Otherwise it branches to the fifth (|F|) argument.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_cmd_if_xparse:NTF #1
+\cs_new_protected:Npn \@@_cmd_type_switch:NnnnF #1
{
- \exp_args:Nf \str_case_e:nnTF
+ \exp_args:Nf \str_case_e:nnF
{
\exp_args:Nf \tl_if_empty:nT { \cs_argument_spec:N #1 }
{
@@ -4590,10 +4595,17 @@
}
}
{
- { \token_to_str:N \@@_start:nNNnnn } { }
- { \token_to_str:N \@@_start_expandable:nNNNNn } { }
- { \token_to_str:N \@@_start_env:nnnnn } { }
+ { \token_to_str:N \@@_start:nNNnnn } { \use_i:nnnn }
+ { \token_to_str:N \@@_start_expandable:nNNNNn } { \use_ii:nnnn }
+ { \token_to_str:N \@@_start_env:nnnnn } { \use_iii:nnnn }
}
+ { \use_iv:nnnn }
+ }
+\cs_new_protected:Npn \@@_cmd_if_xparse:NTF #1
+ {
+ \@@_cmd_type_switch:NnnnF #1
+ { \use_i:nn } { \use_i:nn } { \use_i:nn }
+ { \use_ii:nn }
}
\cs_new:Npn \@@_cmd_if_xparse_aux:w #1 ~ #2 \q_stop {#1}
% \end{macrocode}
More information about the latex3-commits
mailing list.