[latex3-commits] [git/LaTeX3-latex3-latex2e] hook-args: Simplify more (ec76015b)
PhelypeOleinik
phelype.oleinik at latex-project.org
Tue Mar 28 05:02:58 CEST 2023
Repository : https://github.com/latex3/latex2e
On branch : hook-args
Link : https://github.com/latex3/latex2e/commit/ec76015bd9dabc500372fb8aabb9ec3ff71ae2c7
>---------------------------------------------------------------
commit ec76015bd9dabc500372fb8aabb9ec3ff71ae2c7
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Tue Mar 28 00:02:58 2023 -0300
Simplify more
>---------------------------------------------------------------
ec76015bd9dabc500372fb8aabb9ec3ff71ae2c7
base/lthooks.dtx | 35 +++++++++++++++--------------------
1 file changed, 15 insertions(+), 20 deletions(-)
diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index 393467b4..5728978f 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -4317,13 +4317,16 @@
{ \@@_code_gset_aux:nnn { _next } }
\cs_new_protected:Npn \@@_code_gset_aux:nnn #1 #2 #3
{
- \tl_if_exist:cTF { c_@@_#2_parameter_tl }
+ \cs_gset:cpn { @@#1~#2 \exp_last_unbraced:Nv }
{
- \@@_code_gset_auxi:veen { c_@@_#2_parameter_tl }
- { } { \@@_double_hashes:n {#3} } { @@#1~#2 }
+ c_@@_
+ \tl_if_exist:cTF { c_@@_#2_parameter_tl }
+ { #2_parameter } { empty }
+ _tl
}
- { \@@_tl_gset:cn { @@#1~#2 } {#3} }
+ {#3}
}
+\cs_generate_variant:Nn \@@_code_gset:nn { ne }
\cs_new_protected:Npn \@@_normalise_cs_args:nn #1 #2
{
\@@_code_gset_auxi:veen
@@ -4338,7 +4341,6 @@
{ }
{ @@#1~#2 }
}
-\cs_generate_variant:Nn \@@_code_gset:nn { ne }
% \end{macrocode}
% \end{macro}
%
@@ -4375,15 +4377,13 @@
% \end{macro}
%
% \begin{macro}{\@@_cs_gput_right:nnn}
-% \begin{macro}{\@@_braced_parameter:n,\@@_braced_loop:w}
+% \begin{macro}{\@@_braced_hidden_loop:w}
% Check if the expansion of a control sequence is empty by looking at
-% its replacement text.
+% its replacement text. \pho{can likely be optimised}
% \begin{macrocode}
-\cs_new_protected:Npn \@@_tl_gset_auxi:nnn #1 #2 #3
- { \@@_tl_gset:cn {#3} { #1 #2 } }
\cs_new:Npn \@@_braced_cs_parameter:n #1
{
- \exp_last_unbraced:Ne \@@_braced_loop:w
+ \exp_last_unbraced:Ne \@@_braced_hidden_loop:w
{
\if_case:w \@@_cs_parameter_count:c {#1} \exp_stop_f:
\or: ##1
@@ -4402,20 +4402,15 @@
}
?? \s_@@_mark
}
-\cs_new:Npn \@@_braced_parameter:n #1
- {
- \exp_last_unbraced:Nf \@@_braced_loop:w
- { \cs_if_exist_use:c { c_@@_#1_parameter_tl } } ?? \s_@@_mark
- }
-\cs_new:Npn \@@_braced_loop:w #1#2
+\cs_new:Npn \@@_braced_hidden_loop:w #1#2
{
\if:w ? #1
\@@_use_i_delimit_by_s_mark:nw
\fi:
{ \exp_not:N \c_@@_hash_tl #2 }
- \@@_braced_loop:w
+ \@@_braced_hidden_loop:w
}
-\cs_new:Npn \@@_braced_real_parameter:n #1
+\cs_new:Npn \@@_braced_parameter:n #1
{
\exp_last_unbraced:Nf \@@_braced_real_loop:w
{ \cs_if_exist_use:c { c_@@_#1_parameter_tl } } ?? \s_@@_mark
@@ -5096,9 +5091,9 @@
% chunk added). The |next| code is always added last.
% \begin{macrocode}
\exp_args:NNe \@@_tl_gput:Nn #1
- { \exp_not:c { @@_toplevel~#3 } \@@_braced_real_parameter:n {#3} }
+ { \exp_not:c { @@_toplevel~#3 } \@@_braced_parameter:n {#3} }
\@@_tl_gput_right:Ne #1
- { \exp_not:c { @@_next~#3 } \@@_braced_real_parameter:n {#3} }
+ { \exp_not:c { @@_next~#3 } \@@_braced_parameter:n {#3} }
\use:e
{
\cs_gset:cpn { @@~#3 } \use:c { c_@@_#3_parameter_tl }
More information about the latex3-commits
mailing list.