diff options
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3tl.dtx')
-rw-r--r-- | macros/latex/contrib/l3kernel/l3tl.dtx | 47 |
1 files changed, 8 insertions, 39 deletions
diff --git a/macros/latex/contrib/l3kernel/l3tl.dtx b/macros/latex/contrib/l3kernel/l3tl.dtx index 6f0eb9f39e..958273893b 100644 --- a/macros/latex/contrib/l3kernel/l3tl.dtx +++ b/macros/latex/contrib/l3kernel/l3tl.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-05-11} +% \date{Released 2023-05-15} % % \maketitle % @@ -2882,49 +2882,18 @@ % empty result. The result is returned within the \tn{unexpanded} primitive. % The approach here is to use \cs{if_false:} to allow us to use |}| as % the closing delimiter: this is the only safe choice, as any other token -% would not be able to parse it's own code. If the \tn{expanded} primitive -% is available it is used to get a fast and safe code variant in which we -% don't have to ensure that the left-most token is an internal to not break -% in an |f|-type expansion. If \tn{expanded} isn't available, using a marker, -% we can see if what we are grabbing is exactly the marker, or there is -% anything else to deal with. If there is, there is a loop. If not, tidy up -% and leave the item in the output stream. More detail in +% would not be able to parse it's own code. More detail in % \url{http://tex.stackexchange.com/a/70168}. % \begin{macrocode} -\cs_if_exist:NTF \tex_expanded:D +\cs_new:Npn \tl_head:n #1 { - \cs_new:Npn \tl_head:n #1 - { - \__kernel_exp_not:w \tex_expanded:D - { { \if_false: { \fi: \@@_head_aux:n #1 { } } } } - } - \cs_new:Npn \@@_head_aux:n #1 - { - \__kernel_exp_not:w {#1} - \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: - } + \__kernel_exp_not:w \tex_expanded:D + { { \if_false: { \fi: \@@_head_aux:n #1 { } } } } } +\cs_new:Npn \@@_head_aux:n #1 { - \cs_new:Npn \tl_head:n #1 - { - \__kernel_exp_not:w - \if_false: { \fi: \@@_head_auxi:nw #1 { } \s_@@_stop } - } - \cs_new:Npn \@@_head_auxi:nw #1#2 \s_@@_stop - { - \exp_after:wN \@@_head_auxii:n \exp_after:wN { - \if_false: } \fi: {#1} - } - \exp_args:Nno \use:n - { \cs_new:Npn \@@_head_auxii:n #1 } - { - \@@_if_empty_if:o { \use_none:n #1 } - \exp_after:wN \use_ii:nnn - \fi: - \use_ii:nn - {#1} - { \if_false: { \fi: \@@_head_auxi:nw #1 } } - } + \__kernel_exp_not:w {#1} + \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: } \cs_generate_variant:Nn \tl_head:n { V , v , f } \cs_new:Npn \tl_head:w #1#2 \q_stop {#1} |