diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3tl.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3tl.dtx | 464 |
1 files changed, 278 insertions, 186 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index 06226fd7bad..e606c3c5587 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-08-29} +% \date{Released 2023-10-10} % % \maketitle % @@ -97,7 +97,11 @@ % \meta{tl~var} is initially empty. % \end{function} % -% \begin{function}{\tl_const:Nn, \tl_const:Nx, \tl_const:cn, \tl_const:cx} +% \begin{function} +% { +% \tl_const:Nn, \tl_const:Ne, +% \tl_const:cn, \tl_const:ce +% } % \begin{syntax} % \cs{tl_const:Nn} \meta{tl~var} \Arg{token list} % \end{syntax} @@ -161,12 +165,12 @@ % % \begin{function} % { -% \tl_set:Nn, \tl_set:NV, \tl_set:Nv, \tl_set:No, \tl_set:Ne, \tl_set:Nf, \tl_set:Nx, -% \tl_set:cn, \tl_set:cV, \tl_set:cv, \tl_set:co, \tl_set:ce, \tl_set:cf, \tl_set:cx, +% \tl_set:Nn, \tl_set:NV, \tl_set:Nv, \tl_set:No, \tl_set:Ne, \tl_set:Nf, +% \tl_set:cn, \tl_set:cV, \tl_set:cv, \tl_set:co, \tl_set:ce, \tl_set:cf, % \tl_gset:Nn, \tl_gset:NV, \tl_gset:Nv, -% \tl_gset:No, \tl_gset:Ne, \tl_gset:Nf, \tl_gset:Nx, +% \tl_gset:No, \tl_gset:Ne, \tl_gset:Nf, % \tl_gset:cn, \tl_gset:cV, \tl_gset:cv, -% \tl_gset:co, \tl_gset:ce, \tl_gset:cf, \tl_gset:cx +% \tl_gset:co, \tl_gset:ce, \tl_gset:cf % } % \begin{syntax} % \cs{tl_set:Nn} \meta{tl~var} \Arg{tokens} @@ -177,10 +181,14 @@ % % \begin{function} % { -% \tl_put_left:Nn, \tl_put_left:NV, \tl_put_left:Nv, \tl_put_left:No, \tl_put_left:Nx, -% \tl_put_left:cn, \tl_put_left:cV, \tl_put_left:cv, \tl_put_left:co, \tl_put_left:cx, -% \tl_gput_left:Nn, \tl_gput_left:NV, \tl_gput_left:Nv, \tl_gput_left:No, \tl_gput_left:Nx, -% \tl_gput_left:cn, \tl_gput_left:cV, \tl_gput_left:cv, \tl_gput_left:co, \tl_gput_left:cx +% \tl_put_left:Nn, \tl_put_left:NV, \tl_put_left:Nv, \tl_put_left:Ne, +% \tl_put_left:No, +% \tl_put_left:cn, \tl_put_left:cV, \tl_put_left:cv, \tl_put_left:ce, +% \tl_put_left:co, +% \tl_gput_left:Nn, \tl_gput_left:NV, \tl_gput_left:Nv, \tl_gput_left:Ne, +% \tl_gput_left:No, +% \tl_gput_left:cn, \tl_gput_left:cV, \tl_gput_left:cv, \tl_gput_left:ce +% \tl_gput_left:co % } % \begin{syntax} % \cs{tl_put_left:Nn} \meta{tl~var} \Arg{tokens} @@ -191,10 +199,14 @@ % % \begin{function} % { -% \tl_put_right:Nn, \tl_put_right:NV, \tl_put_right:Nv, \tl_put_right:No, \tl_put_right:Nx, -% \tl_put_right:cn, \tl_put_right:cV, \tl_put_right:cv, \tl_put_right:co, \tl_put_right:cx, -% \tl_gput_right:Nn, \tl_gput_right:NV, \tl_gput_right:Nv, \tl_gput_right:No, \tl_gput_right:Nx, -% \tl_gput_right:cn, \tl_gput_right:cV, \tl_gput_right:cv, \tl_gput_right:co, \tl_gput_right:cx +% \tl_put_right:Nn, \tl_put_right:NV, \tl_put_right:Nv, \tl_put_right:Ne, +% \tl_put_right:No, +% \tl_put_right:cn, \tl_put_right:cV, \tl_put_right:cv, \tl_put_right:ce, +% \tl_put_right:co, +% \tl_gput_right:Nn, \tl_gput_right:NV, \tl_gput_right:Nv, \tl_gput_right:Ne, +% \tl_gput_right:No, +% \tl_gput_right:cn, \tl_gput_right:cV, \tl_gput_right:cv, \tl_gput_right:ce +% \tl_gput_right:co % } % \begin{syntax} % \cs{tl_put_right:Nn} \meta{tl~var} \Arg{tokens} @@ -249,7 +261,7 @@ % contain and the category codes of those characters). Thus for example % \begin{verbatim} % \tl_set:Nn \l_tmpa_tl { abc } -% \tl_set:Nx \l_tmpb_tl { \tl_to_str:n { abc } } +% \tl_set:Ne \l_tmpb_tl { \tl_to_str:n { abc } } % \tl_if_eq:NNTF \l_tmpa_tl \l_tmpb_tl { true } { false } % \end{verbatim} % yields \texttt{false}. @@ -269,7 +281,10 @@ % \end{function} % % \begin{function}[TF] -% {\tl_if_eq:nn, \tl_if_eq:Vn, \tl_if_eq:nV, \tl_if_eq:xn, \tl_if_eq:nx} +% { +% \tl_if_eq:nn, \tl_if_eq:nV, \tl_if_eq:ne, \tl_if_eq:Vn, \tl_if_eq:en, +% \tl_if_eq:ee +% } % \begin{syntax} % \cs{tl_if_eq:nnTF} \Arg{token list_1} \Arg{token list_2} \Arg{true code} \Arg{false code} % \end{syntax} @@ -594,7 +609,11 @@ % \end{function} % % \begin{function}[added = 2011-07-09, updated = 2012-06-25, EXP] -% {\tl_trim_spaces:n, \tl_trim_spaces:o} +% { +% \tl_trim_spaces:n, \tl_trim_spaces:V, \tl_trim_spaces:v, +% \tl_trim_spaces:e, +% \tl_trim_spaces:o +% } % \begin{syntax} % \cs{tl_trim_spaces:n} \Arg{token list} % \end{syntax} @@ -646,7 +665,7 @@ % \end{texnote} % \end{function} % -% \begin{function}[updated = 2015-08-07]{\tl_show:n, \tl_show:x} +% \begin{function}[updated = 2015-08-07]{\tl_show:n, \tl_show:e} % \begin{syntax} % \cs{tl_show:n} \Arg{token list} % \end{syntax} @@ -665,7 +684,8 @@ % \cs{tl_show:N} which displays the result in the terminal. % \end{function} % -% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\tl_log:n, \tl_log:x} +% \begin{function}[added = 2014-08-22, updated = 2015-08-07] +% {\tl_log:n, \tl_log:e, \tl_log:x} % \begin{syntax} % \cs{tl_log:n} \Arg{token list} % \end{syntax} @@ -997,17 +1017,17 @@ % \end{verbatim} % Here are some more interesting examples. The calls % \begin{verbatim} -% \iow_term:x { \tl_range:nnn { abcd{e{}}fg } { 2 } { 5 } } -% \iow_term:x { \tl_range:nnn { abcd{e{}}fg } { 2 } { -3 } } -% \iow_term:x { \tl_range:nnn { abcd{e{}}fg } { -6 } { 5 } } -% \iow_term:x { \tl_range:nnn { abcd{e{}}fg } { -6 } { -3 } } +% \iow_term:e { \tl_range:nnn { abcd{e{}}fg } { 2 } { 5 } } +% \iow_term:e { \tl_range:nnn { abcd{e{}}fg } { 2 } { -3 } } +% \iow_term:e { \tl_range:nnn { abcd{e{}}fg } { -6 } { 5 } } +% \iow_term:e { \tl_range:nnn { abcd{e{}}fg } { -6 } { -3 } } % \end{verbatim} % are all equivalent and will print |bcd{e{}}| on the terminal; similarly % \begin{verbatim} -% \iow_term:x { \tl_range:nnn { abcd~{e{}}fg } { 2 } { 5 } } -% \iow_term:x { \tl_range:nnn { abcd~{e{}}fg } { 2 } { -3 } } -% \iow_term:x { \tl_range:nnn { abcd~{e{}}fg } { -6 } { 5 } } -% \iow_term:x { \tl_range:nnn { abcd~{e{}}fg } { -6 } { -3 } } +% \iow_term:e { \tl_range:nnn { abcd~{e{}}fg } { 2 } { 5 } } +% \iow_term:e { \tl_range:nnn { abcd~{e{}}fg } { 2 } { -3 } } +% \iow_term:e { \tl_range:nnn { abcd~{e{}}fg } { -6 } { 5 } } +% \iow_term:e { \tl_range:nnn { abcd~{e{}}fg } { -6 } { -3 } } % \end{verbatim} % are all equivalent and will print |bcd {e{}}| on the % terminal (note the space in the middle). To the contrary, @@ -1074,13 +1094,13 @@ % \begin{function}[updated = 2011-08-11] % { % \tl_replace_once:Nnn, \tl_replace_once:NVn, \tl_replace_once:NnV, -% \tl_replace_once:Nxn, \tl_replace_once:Nnx, \tl_replace_once:Nxx, +% \tl_replace_once:Nen, \tl_replace_once:Nne, \tl_replace_once:Nee, % \tl_replace_once:cnn, \tl_replace_once:cVn, \tl_replace_once:cnV, -% \tl_replace_once:cxn, \tl_replace_once:cnx, \tl_replace_once:cxx, -% \tl_greplace_once:Nnn, \tl_greplace_once:NVn, \tl_rgeplace_once:NnV, -% \tl_greplace_once:Nxn, \tl_greplace_once:Nnx, \tl_greplace_once:Nxx, +% \tl_replace_once:cen, \tl_replace_once:cne, \tl_replace_once:cee, +% \tl_greplace_once:Nnn, \tl_greplace_once:NVn, \tl_greplace_once:NnV, +% \tl_greplace_once:Nen, \tl_greplace_once:Nne, \tl_greplace_once:Nee, % \tl_greplace_once:cnn, \tl_greplace_once:cVn, \tl_greplace_once:cnV, -% \tl_greplace_once:cxn, \tl_greplace_once:cnx, \tl_greplace_once:cxx +% \tl_greplace_once:cen, \tl_greplace_once:cne, \tl_greplace_once:cee % } % \begin{syntax} % \cs{tl_replace_once:Nnn} \meta{tl~var} \Arg{old tokens} \Arg{new tokens} @@ -1094,14 +1114,14 @@ % % \begin{function}[updated = 2011-08-11] % { -% \tl_replace_all:Nnn, \tl_replace_all:NVn, \tl_replace_all:NnV, -% \tl_replace_all:Nxn, \tl_replace_all:Nnx, \tl_replace_all:Nxx, -% \tl_replace_all:cnn, \tl_replace_all:cVn, \tl_replace_all:cnV, -% \tl_replace_all:cxn, \tl_replace_all:cnx, \tl_replace_all:cxx, -% \tl_greplace_all:Nnn, \tl_greplace_all:NVn, \tl_greplace_all:cnV, -% \tl_greplace_all:Nxn, \tl_greplace_all:Nnx, \tl_greplace_all:Nxx, -% \tl_greplace_all:cnn, \tl_greplace_all:cVn, \tl_greplace_all:cnV, -% \tl_greplace_all:cxn, \tl_greplace_all:cnx, \tl_greplace_all:cxx +% \tl_replace_all:Nnn, \tl_replace_all:NVn, \tl_replace_all:NnV, +% \tl_replace_all:Nen, \tl_replace_all:Nne, \tl_replace_all:Nee, +% \tl_replace_all:cnn, \tl_replace_all:cVn, \tl_replace_all:cnV, +% \tl_replace_all:cen, \tl_replace_all:cne, \tl_replace_all:cee, +% \tl_greplace_all:Nnn, \tl_greplace_all:NVn, \tl_greplace_all:NnV, +% \tl_greplace_all:Nen, \tl_greplace_all:Nne, \tl_greplace_all:Nee, +% \tl_greplace_all:cnn, \tl_greplace_all:cVn, \tl_greplace_all:cnV, +% \tl_greplace_all:cen, \tl_greplace_all:cne, \tl_greplace_all:cee % } % \begin{syntax} % \cs{tl_replace_all:Nnn} \meta{tl~var} \Arg{old tokens} \Arg{new tokens} @@ -1119,10 +1139,10 @@ % % \begin{function}[updated = 2011-08-11] % { -% \tl_remove_once:Nn, \tl_remove_once:NV, \tl_remove_once:Nx, -% \tl_remove_once:cn, \tl_remove_once:cV, \tl_remove_once:cx, -% \tl_gremove_once:Nn, \tl_gremove_once:NV, \tl_gremove_once:Nx -% \tl_gremove_once:cn, \tl_gremove_once:cV, \tl_gremove_once:cx +% \tl_remove_once:Nn, \tl_remove_once:NV, \tl_remove_once:Ne, +% \tl_remove_once:cn, \tl_remove_once:cV, \tl_remove_once:ce, +% \tl_gremove_once:Nn, \tl_gremove_once:NV, \tl_gremove_once:Ne, +% \tl_gremove_once:cn, \tl_gremove_once:cV, \tl_gremove_once:ce % } % \begin{syntax} % \cs{tl_remove_once:Nn} \meta{tl~var} \Arg{tokens} @@ -1135,10 +1155,10 @@ % % \begin{function}[updated = 2011-08-11] % { -% \tl_remove_all:Nn, \tl_remove_all:NV, \tl_remove_all:Nx, -% \tl_remove_all:cn, \tl_remove_all:cV, \tl_remove_all:cx, -% \tl_gremove_all:Nn, \tl_gremove_all:NV, \tl_gremove_all:Nx -% \tl_gremove_all:cn, \tl_gremove_all:cV, \tl_gremove_all:cx +% \tl_remove_all:Nn, \tl_remove_all:NV, \tl_remove_all:Ne, +% \tl_remove_all:cn, \tl_remove_all:cV, \tl_remove_all:ce, +% \tl_gremove_all:Nn, \tl_gremove_all:NV, \tl_gremove_all:Ne, +% \tl_gremove_all:cn, \tl_gremove_all:cV, \tl_gremove_all:ce, % } % \begin{syntax} % \cs{tl_remove_all:Nn} \meta{tl~var} \Arg{tokens} @@ -1169,10 +1189,14 @@ % % \begin{function}[updated = 2015-08-11] % { -% \tl_set_rescan:Nnn, \tl_set_rescan:NnV, \tl_set_rescan:Nno, \tl_set_rescan:Nnx, -% \tl_set_rescan:cnn, \tl_set_rescan:cnV, \tl_set_rescan:cno, \tl_set_rescan:cnx, -% \tl_gset_rescan:Nnn, \tl_gset_rescan:NnV, \tl_gset_rescan:Nno, \tl_gset_rescan:Nnx, -% \tl_gset_rescan:cnn, \tl_gset_rescan:cnV, \tl_gset_rescan:cno, \tl_gset_rescan:cnx +% \tl_set_rescan:Nnn, \tl_set_rescan:NnV, \tl_set_rescan:Nne, +% \tl_set_rescan:Nno, +% \tl_set_rescan:cnn, \tl_set_rescan:cnV, \tl_set_rescan:cne, +% \tl_set_rescan:cno, +% \tl_gset_rescan:Nnn, \tl_gset_rescan:NnV, \tl_gset_rescan:Nne, +% \tl_gset_rescan:Nno, +% \tl_gset_rescan:cnn, \tl_gset_rescan:cnV, \tl_gset_rescan:cne, +% \tl_gset_rescan:cno, % } % \begin{syntax} % \cs{tl_set_rescan:Nnn} \meta{tl~var} \Arg{setup} \Arg{tokens} @@ -1300,12 +1324,12 @@ % % \subsection{Functions} % -% \begin{macro}{\__kernel_tl_set:Nx,\__kernel_tl_gset:Nx} +% \begin{macro}{\__kernel_tl_set:Ne,\__kernel_tl_gset:Ne} % These two are supplied to get better performance for macros which would -% otherwise use \cs{tl_set:Nx} or \cs{tl_gset:Nx} internally. +% otherwise use \cs{tl_set:Ne} or \cs{tl_gset:Ne} internally. % \begin{macrocode} -\cs_new_eq:NN \__kernel_tl_set:Nx \cs_set_nopar:Npx -\cs_new_eq:NN \__kernel_tl_gset:Nx \cs_gset_nopar:Npx +\cs_new_eq:NN \__kernel_tl_set:Ne \cs_set_nopar:Npe +\cs_new_eq:NN \__kernel_tl_gset:Ne \cs_gset_nopar:Npe % \end{macrocode} % \end{macro} % @@ -1322,23 +1346,22 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\tl_const:Nn, \tl_const:Nx, \tl_const:cn, \tl_const:cx} -% Constants are also easy to generate. They use \cs{cs_gset_nopar:Npx} instead -% of \cs{__kernel_tl_gset:Nx} so that the correct scope checking is applied if +% \begin{macro} +% { +% \tl_const:Nn, \tl_const:Ne, \tl_const:Nx, +% \tl_const:cn, \tl_const:ce, \tl_const:cx +% } +% Constants are also easy to generate. They use \cs{cs_gset_nopar:Npe} instead +% of \cs{__kernel_tl_gset:Ne} so that the correct scope checking is applied if % \pkg{l3debug} is used. % \begin{macrocode} \cs_new_protected:Npn \tl_const:Nn #1#2 { \__kernel_chk_if_free_cs:N #1 - \cs_gset_nopar:Npx #1 { \__kernel_exp_not:w {#2} } - } -\cs_new_protected:Npn \tl_const:Nx #1#2 - { - \__kernel_chk_if_free_cs:N #1 - \cs_gset_nopar:Npx #1 {#2} + \cs_gset_nopar:Npe #1 { \__kernel_exp_not:w {#2} } } -\cs_generate_variant:Nn \tl_const:Nn { c } -\cs_generate_variant:Nn \tl_const:Nx { c } +\cs_generate_variant:Nn \tl_const:Nn { Ne , c , ce } +\cs_generate_variant:Nn \tl_const:Nn { Nx , cx } % \end{macrocode} % \end{macro} % @@ -1396,7 +1419,7 @@ % \begin{macrocode} \cs_new_protected:Npn \tl_concat:NNN #1#2#3 { - \__kernel_tl_set:Nx #1 + \__kernel_tl_set:Ne #1 { \__kernel_exp_not:w \exp_after:wN {#2} \__kernel_exp_not:w \exp_after:wN {#3} @@ -1404,7 +1427,7 @@ } \cs_new_protected:Npn \tl_gconcat:NNN #1#2#3 { - \__kernel_tl_gset:Nx #1 + \__kernel_tl_gset:Ne #1 { \__kernel_exp_not:w \exp_after:wN {#2} \__kernel_exp_not:w \exp_after:wN {#3} @@ -1439,7 +1462,7 @@ % \begin{macrocode} \group_begin: \tex_catcode:D `- = 11 ~ -\tl_const:Nx \c_novalue_tl { - NoValue \token_to_str:N - } +\tl_const:Ne \c_novalue_tl { - NoValue \token_to_str:N - } \group_end: % \end{macrocode} % \end{variable} @@ -1471,173 +1494,203 @@ % by hand as it is used quite a lot. % \begin{macrocode} \cs_new_protected:Npn \tl_set:Nn #1#2 - { \__kernel_tl_set:Nx #1 { \__kernel_exp_not:w {#2} } } + { \__kernel_tl_set:Ne #1 { \__kernel_exp_not:w {#2} } } \cs_new_protected:Npn \tl_set:No #1#2 - { \__kernel_tl_set:Nx #1 { \__kernel_exp_not:w \exp_after:wN {#2} } } -\cs_new_protected:Npn \tl_set:Nx #1#2 - { \__kernel_tl_set:Nx #1 {#2} } + { \__kernel_tl_set:Ne #1 { \__kernel_exp_not:w \exp_after:wN {#2} } } \cs_new_protected:Npn \tl_gset:Nn #1#2 - { \__kernel_tl_gset:Nx #1 { \__kernel_exp_not:w {#2} } } + { \__kernel_tl_gset:Ne #1 { \__kernel_exp_not:w {#2} } } \cs_new_protected:Npn \tl_gset:No #1#2 - { \__kernel_tl_gset:Nx #1 { \__kernel_exp_not:w \exp_after:wN {#2} } } -\cs_new_protected:Npn \tl_gset:Nx #1#2 - { \__kernel_tl_gset:Nx #1 {#2} } + { \__kernel_tl_gset:Ne #1 { \__kernel_exp_not:w \exp_after:wN {#2} } } \cs_generate_variant:Nn \tl_set:Nn { NV , Nv , Ne , Nf } \cs_generate_variant:Nn \tl_set:Nn { c, cV , cv , ce , cf } -\cs_generate_variant:Nn \tl_set:Nx { c } \cs_generate_variant:Nn \tl_set:No { c } +\cs_generate_variant:Nn \tl_set:Nn { Nx , cx } \cs_generate_variant:Nn \tl_gset:Nn { NV , Nv , Ne , Nf } \cs_generate_variant:Nn \tl_gset:Nn { c, cV , cv , ce , cf } -\cs_generate_variant:Nn \tl_gset:Nx { c } \cs_generate_variant:Nn \tl_gset:No { c } +\cs_generate_variant:Nn \tl_gset:Nn { Nx , cx } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro} % { -% \tl_put_left:Nn, \tl_put_left:NV, \tl_put_left:Nv, \tl_put_left:No, \tl_put_left:Nx, -% \tl_put_left:cn, \tl_put_left:cV, \tl_put_left:cv, \tl_put_left:co, \tl_put_left:cx +% \tl_put_left:Nn, \tl_put_left:NV, \tl_put_left:Nv, \tl_put_left:Ne, +% \tl_put_left:No, \tl_put_left:Nx, +% \tl_put_left:cn, \tl_put_left:cV, \tl_put_left:cv, \tl_put_left:ce, +% \tl_put_left:co, \tl_put_left:cx % } % \begin{macro} % { -% \tl_gput_left:Nn, \tl_gput_left:NV, \tl_gput_left:Nv, \tl_gput_left:No, \tl_gput_left:Nx, -% \tl_gput_left:cn, \tl_gput_left:cV, \tl_gput_left:cv, \tl_gput_left:co, \tl_gput_left:cx +% \tl_gput_left:Nn, \tl_gput_left:NV, \tl_gput_left:Nv, \tl_gput_left:Ne, +% \tl_gput_left:No, \tl_gput_left:Nx, +% \tl_gput_left:cn, \tl_gput_left:cV, \tl_gput_left:cv, \tl_gput_left:ce, +% \tl_gput_left:co, \tl_gput_left:cx % } % Adding to the left is done directly to gain a little performance. % \begin{macrocode} \cs_new_protected:Npn \tl_put_left:Nn #1#2 { - \__kernel_tl_set:Nx #1 + \__kernel_tl_set:Ne #1 { \__kernel_exp_not:w {#2} \__kernel_exp_not:w \exp_after:wN {#1} } } \cs_new_protected:Npn \tl_put_left:NV #1#2 { - \__kernel_tl_set:Nx #1 + \__kernel_tl_set:Ne #1 { \exp_not:V #2 \__kernel_exp_not:w \exp_after:wN {#1} } } \cs_new_protected:Npn \tl_put_left:Nv #1#2 { - \__kernel_tl_set:Nx #1 + \__kernel_tl_set:Ne #1 { \exp_not:v {#2} \__kernel_exp_not:w \exp_after:wN {#1} } } +\cs_new_protected:Npn \tl_put_left:Ne #1#2 + { + \__kernel_tl_set:Ne #1 + { + \__kernel_exp_not:w \tex_expanded:D { {#2} } + \__kernel_exp_not:w \exp_after:wN {#1} + } + } \cs_new_protected:Npn \tl_put_left:No #1#2 { - \__kernel_tl_set:Nx #1 + \__kernel_tl_set:Ne #1 { \__kernel_exp_not:w \exp_after:wN {#2} \__kernel_exp_not:w \exp_after:wN {#1} } } -\cs_new_protected:Npn \tl_put_left:Nx #1#2 - { \__kernel_tl_set:Nx #1 { #2 \__kernel_exp_not:w \exp_after:wN {#1} } } \cs_new_protected:Npn \tl_gput_left:Nn #1#2 { - \__kernel_tl_gset:Nx #1 + \__kernel_tl_gset:Ne #1 { \__kernel_exp_not:w {#2} \__kernel_exp_not:w \exp_after:wN {#1} } } \cs_new_protected:Npn \tl_gput_left:NV #1#2 { - \__kernel_tl_gset:Nx #1 + \__kernel_tl_gset:Ne #1 { \exp_not:V #2 \__kernel_exp_not:w \exp_after:wN {#1} } } \cs_new_protected:Npn \tl_gput_left:Nv #1#2 { - \__kernel_tl_gset:Nx #1 + \__kernel_tl_gset:Ne #1 { \exp_not:v {#2} \__kernel_exp_not:w \exp_after:wN {#1} } } +\cs_new_protected:Npn \tl_gput_left:Ne #1#2 + { + \__kernel_tl_gset:Ne #1 + { + \__kernel_exp_not:w \tex_expanded:D { {#2} } + \__kernel_exp_not:w \exp_after:wN {#1} + } + } \cs_new_protected:Npn \tl_gput_left:No #1#2 { - \__kernel_tl_gset:Nx #1 + \__kernel_tl_gset:Ne #1 { \__kernel_exp_not:w \exp_after:wN {#2} \__kernel_exp_not:w \exp_after:wN {#1} } } -\cs_new_protected:Npn \tl_gput_left:Nx #1#2 - { \__kernel_tl_gset:Nx #1 { #2 \__kernel_exp_not:w \exp_after:wN {#1} } } \cs_generate_variant:Nn \tl_put_left:Nn { c } \cs_generate_variant:Nn \tl_put_left:NV { c } \cs_generate_variant:Nn \tl_put_left:Nv { c } +\cs_generate_variant:Nn \tl_put_left:Ne { c } \cs_generate_variant:Nn \tl_put_left:No { c } -\cs_generate_variant:Nn \tl_put_left:Nx { c } +\cs_generate_variant:Nn \tl_put_left:Nn { Nx, cx } \cs_generate_variant:Nn \tl_gput_left:Nn { c } \cs_generate_variant:Nn \tl_gput_left:NV { c } -\cs_generate_variant:Nn \tl_gput_left:NV { c } +\cs_generate_variant:Nn \tl_gput_left:Nv { c } +\cs_generate_variant:Nn \tl_gput_left:Ne { c } \cs_generate_variant:Nn \tl_gput_left:No { c } -\cs_generate_variant:Nn \tl_gput_left:Nx { c } +\cs_generate_variant:Nn \tl_gput_left:Nn { Nx , cx } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro} % { -% \tl_put_right:Nn, \tl_put_right:NV, \tl_put_right:Nv, \tl_put_right:No, \tl_put_right:Nx, -% \tl_put_right:cn, \tl_put_right:cV, \tl_put_right:cv, \tl_put_right:co, \tl_put_right:cx +% \tl_put_right:Nn, \tl_put_right:NV, \tl_put_right:Nv, \tl_put_right:Ne, +% \tl_put_right:No, \tl_put_right:Nx, +% \tl_put_right:cn, \tl_put_right:cV, \tl_put_right:cv, \tl_put_right:ce, +% \tl_put_right:co, \tl_put_right:cx % } % \begin{macro} % { -% \tl_gput_right:Nn, \tl_gput_right:NV, \tl_gput_right:Nv, \tl_gput_right:No, -% \tl_gput_right:Nx, -% \tl_gput_right:cn, \tl_gput_right:cV, \tl_gput_right:cv, \tl_gput_right:co, -% \tl_gput_right:cx +% \tl_gput_right:Nn, \tl_gput_right:NV, \tl_gput_right:Nv, \tl_gput_right:Ne, +% \tl_gput_right:No, \tl_gput_right:Nx, +% \tl_gput_right:cn, \tl_gput_right:cV, \tl_gput_right:cv, \tl_gput_right:ce, +% \tl_gput_right:co, \tl_gput_right:cx % } % The same on the right. % \begin{macrocode} \cs_new_protected:Npn \tl_put_right:Nn #1#2 - { \__kernel_tl_set:Nx #1 { \__kernel_exp_not:w \exp_after:wN { #1 #2 } } } + { \__kernel_tl_set:Ne #1 { \__kernel_exp_not:w \exp_after:wN { #1 #2 } } } \cs_new_protected:Npn \tl_put_right:NV #1#2 { - \__kernel_tl_set:Nx #1 + \__kernel_tl_set:Ne #1 { \__kernel_exp_not:w \exp_after:wN {#1} \exp_not:V #2 } } \cs_new_protected:Npn \tl_put_right:Nv #1#2 { - \__kernel_tl_set:Nx #1 + \__kernel_tl_set:Ne #1 { \__kernel_exp_not:w \exp_after:wN {#1} \exp_not:v {#2} } } +\cs_new_protected:Npn \tl_put_right:Ne #1#2 + { + \__kernel_tl_set:Ne #1 + { + \__kernel_exp_not:w \exp_after:wN {#1} + \__kernel_exp_not:w \tex_expanded:D { {#2} } + } + } \cs_new_protected:Npn \tl_put_right:No #1#2 { - \__kernel_tl_set:Nx #1 + \__kernel_tl_set:Ne #1 { \__kernel_exp_not:w \exp_after:wN {#1} \__kernel_exp_not:w \exp_after:wN {#2} } } -\cs_new_protected:Npn \tl_put_right:Nx #1#2 - { \__kernel_tl_set:Nx #1 { \__kernel_exp_not:w \exp_after:wN {#1} #2 } } \cs_new_protected:Npn \tl_gput_right:Nn #1#2 - { \__kernel_tl_gset:Nx #1 { \__kernel_exp_not:w \exp_after:wN { #1 #2 } } } + { \__kernel_tl_gset:Ne #1 { \__kernel_exp_not:w \exp_after:wN { #1 #2 } } } \cs_new_protected:Npn \tl_gput_right:NV #1#2 { - \__kernel_tl_gset:Nx #1 + \__kernel_tl_gset:Ne #1 { \__kernel_exp_not:w \exp_after:wN {#1} \exp_not:V #2 } } \cs_new_protected:Npn \tl_gput_right:Nv #1#2 { - \__kernel_tl_gset:Nx #1 + \__kernel_tl_gset:Ne #1 { \__kernel_exp_not:w \exp_after:wN {#1} \exp_not:v {#2} } } +\cs_new_protected:Npn \tl_gput_right:Ne #1#2 + { + \__kernel_tl_gset:Ne #1 + { + \__kernel_exp_not:w \exp_after:wN {#1} + \__kernel_exp_not:w \tex_expanded:D { {#2} } + } + } \cs_new_protected:Npn \tl_gput_right:No #1#2 { - \__kernel_tl_gset:Nx #1 + \__kernel_tl_gset:Ne #1 { \__kernel_exp_not:w \exp_after:wN {#1} \__kernel_exp_not:w \exp_after:wN {#2} } } -\cs_new_protected:Npn \tl_gput_right:Nx #1#2 - { \__kernel_tl_gset:Nx #1 { \__kernel_exp_not:w \exp_after:wN {#1} #2 } } \cs_generate_variant:Nn \tl_put_right:Nn { c } \cs_generate_variant:Nn \tl_put_right:NV { c } \cs_generate_variant:Nn \tl_put_right:Nv { c } +\cs_generate_variant:Nn \tl_put_right:Ne { c } \cs_generate_variant:Nn \tl_put_right:No { c } -\cs_generate_variant:Nn \tl_put_right:Nx { c } +\cs_generate_variant:Nn \tl_put_right:Nn { Nx , cx } \cs_generate_variant:Nn \tl_gput_right:Nn { c } \cs_generate_variant:Nn \tl_gput_right:NV { c } \cs_generate_variant:Nn \tl_gput_right:Nv { c } +\cs_generate_variant:Nn \tl_gput_right:Ne { c } \cs_generate_variant:Nn \tl_gput_right:No { c } -\cs_generate_variant:Nn \tl_gput_right:Nx { c } +\cs_generate_variant:Nn \tl_gput_right:Nn { Nx, cx } % \end{macrocode} % \end{macro} % \end{macro} @@ -1679,19 +1732,23 @@ % codes: it cannot appear in the tokens being rescanned since all % colons have the same category code. % \begin{macrocode} -\tl_const:Nx \c_@@_rescan_marker_tl { : \token_to_str:N : } +\tl_const:Ne \c_@@_rescan_marker_tl { : \token_to_str:N : } % \end{macrocode} % \end{variable} % % \begin{macro} % { -% \tl_set_rescan:Nnn, \tl_set_rescan:NnV, \tl_set_rescan:Nno, \tl_set_rescan:Nnx, -% \tl_set_rescan:cnn, \tl_set_rescan:cnV, \tl_set_rescan:cno, \tl_set_rescan:cnx +% \tl_set_rescan:Nnn, \tl_set_rescan:NnV, \tl_set_rescan:Nne, +% \tl_set_rescan:Nno, \tl_set_rescan:Nnx, +% \tl_set_rescan:cnn, \tl_set_rescan:cnV, \tl_set_rescan:cne, +% \tl_set_rescan:cno, \tl_set_rescan:cnx, % } % \begin{macro} % { -% \tl_gset_rescan:Nnn, \tl_gset_rescan:NnV, \tl_gset_rescan:Nno, \tl_gset_rescan:Nnx, -% \tl_gset_rescan:cnn, \tl_gset_rescan:cnV, \tl_gset_rescan:cno, \tl_gset_rescan:cnx +% \tl_gset_rescan:Nnn, \tl_gset_rescan:NnV, \tl_gset_rescan:Nne, +% \tl_gset_rescan:Nno, \tl_gset_rescan:Nnx, +% \tl_gset_rescan:cnn, \tl_gset_rescan:cnV, \tl_gset_rescan:cne, +% \tl_gset_rescan:cno, \tl_gset_rescan:cnx % } % \begin{macro}{\tl_rescan:nn, \tl_rescan:nV} % \begin{macro}{\@@_rescan_aux:} @@ -1790,10 +1847,10 @@ \group_end: #1 #2 {#3} } -\cs_generate_variant:Nn \tl_set_rescan:Nnn { NnV , Nno , Nnx } -\cs_generate_variant:Nn \tl_set_rescan:Nnn { c , cnV , cno , cnx } -\cs_generate_variant:Nn \tl_gset_rescan:Nnn { NnV , Nno , Nnx } -\cs_generate_variant:Nn \tl_gset_rescan:Nnn { c , cnV , cno , cnx } +\cs_generate_variant:Nn \tl_set_rescan:Nnn { NnV , Nne , c , cnV , cne } +\cs_generate_variant:Nn \tl_set_rescan:Nnn { Nno , Nnx , cno , cnx } +\cs_generate_variant:Nn \tl_gset_rescan:Nnn { NnV , Nne , c , cnV , cne } +\cs_generate_variant:Nn \tl_gset_rescan:Nnn { Nno , Nnx , cno , cnx } % \end{macrocode} % \end{macro} % \end{macro} @@ -1913,59 +1970,75 @@ % % \begin{macro} % { -% \tl_replace_all:Nnn, \tl_replace_all:NVn, \tl_replace_all:NnV, -% \tl_replace_all:Nxn, \tl_replace_all:Nnx, \tl_replace_all:Nxx, -% \tl_replace_all:cnn, \tl_replace_all:cVn, \tl_replace_all:cnV, -% \tl_replace_all:cxn, \tl_replace_all:cnx, \tl_replace_all:cxx +% \tl_replace_once:Nnn, \tl_replace_once:NVn, \tl_replace_once:NnV, +% \tl_replace_once:Nen, \tl_replace_once:Nne, \tl_replace_once:Nee, +% \tl_replace_once:Nxn, \tl_replace_once:Nnx, \tl_replace_once:Nxx, +% \tl_replace_once:cnn, \tl_replace_once:cVn, \tl_replace_once:cnV, +% \tl_replace_once:cen, \tl_replace_once:cne, \tl_replace_once:cee, +% \tl_replace_once:cxn, \tl_replace_once:cnx, \tl_replace_once:cxx % } % \begin{macro} % { -% \tl_greplace_all:Nnn, \tl_greplace_all:NVn, \tl_greplace_all:NnV, -% \tl_greplace_all:Nxn, \tl_greplace_all:Nnx, \tl_greplace_all:Nxx, -% \tl_greplace_all:cnn, \tl_greplace_all:cVn, \tl_greplace_all:cnV, -% \tl_greplace_all:cxn, \tl_greplace_all:cnx, \tl_greplace_all:cxx +% \tl_greplace_once:Nnn, \tl_greplace_once:NVn, \tl_greplace_once:NnV, +% \tl_greplace_once:Nen, \tl_greplace_once:Nne, \tl_greplace_once:Nee, +% \tl_greplace_once:Nxn, \tl_greplace_once:Nnx, \tl_greplace_once:Nxx, +% \tl_greplace_once:cnn, \tl_greplace_once:cVn, \tl_greplace_once:cnV, +% \tl_greplace_once:cen, \tl_greplace_once:cne, \tl_greplace_once:cee, +% \tl_greplace_once:cxn, \tl_greplace_once:cnx, \tl_greplace_once:cxx % } % \begin{macro} % { -% \tl_replace_once:Nnn, \tl_replace_once:NVn, \tl_replace_once:NnV, -% \tl_replace_once:Nxn, \tl_replace_once:Nnx, \tl_replace_once:Nxx, -% \tl_replace_once:cnn, \tl_replace_once:cVn, \tl_replace_once:cnV, -% \tl_replace_once:cxn, \tl_replace_once:cnx, \tl_replace_once:cxx +% \tl_replace_all:Nnn, \tl_replace_all:NVn, \tl_replace_all:NnV, +% \tl_replace_all:Nen, \tl_replace_all:Nne, \tl_replace_all:Nee, +% \tl_replace_all:Nxn, \tl_replace_all:Nnx, \tl_replace_all:Nxx, +% \tl_replace_all:cnn, \tl_replace_all:cVn, \tl_replace_all:cnV, +% \tl_replace_all:cen, \tl_replace_all:cne, \tl_replace_all:cee, +% \tl_replace_all:cxn, \tl_replace_all:cnx, \tl_replace_all:cxx % } % \begin{macro} % { -% \tl_greplace_once:Nnn, \tl_greplace_once:NVn, \tl_replace_once:NnV, -% \tl_greplace_once:Nxn, \tl_greplace_once:Nnx, \tl_greplace_once:Nxx, -% \tl_greplace_once:cnn, \tl_greplace_once:cVn, \tl_replace_once:cnV, -% \tl_greplace_once:cxn, \tl_greplace_once:cnx, \tl_greplace_once:cxx +% \tl_greplace_all:Nnn, \tl_greplace_all:NVn, \tl_greplace_all:NnV, +% \tl_greplace_all:Nen, \tl_greplace_all:Nne, \tl_greplace_all:Nee, +% \tl_greplace_all:Nxn, \tl_greplace_all:Nnx, \tl_greplace_all:Nxx, +% \tl_greplace_all:cnn, \tl_greplace_all:cVn, \tl_greplace_all:cnV, +% \tl_greplace_all:cen, \tl_greplace_all:cne, \tl_greplace_all:cee, +% \tl_greplace_all:cxn, \tl_greplace_all:cnx, \tl_greplace_all:cxx % } % All of the \texttt{replace} functions call \cs{@@_replace:NnNNNnn} % with appropriate arguments. The first two arguments are explained % later. The next controls whether the replacement function calls % itself (\cs{@@_replace_next:w}) or stops (\cs{@@_replace_wrap:w}) -% after the first replacement. Next comes an \texttt{x}-type -% assignment function \cs{tl_set:Nx} or \cs{tl_gset:Nx} for local or +% after the first replacement. Next comes an \texttt{e}-type +% assignment function \cs{tl_set:Ne} or \cs{tl_gset:Ne} for local or % global replacements. Finally, the three arguments \meta{tl~var} % \Arg{pattern} \Arg{replacement} provided by the user. When % describing the auxiliary functions below, we denote the contents of % the \meta{tl~var} by \meta{token list}. % \begin{macrocode} \cs_new_protected:Npn \tl_replace_once:Nnn - { \@@_replace:NnNNNnn \q_@@_mark ? \@@_replace_wrap:w \__kernel_tl_set:Nx } + { \@@_replace:NnNNNnn \q_@@_mark ? \@@_replace_wrap:w \__kernel_tl_set:Ne } \cs_new_protected:Npn \tl_greplace_once:Nnn - { \@@_replace:NnNNNnn \q_@@_mark ? \@@_replace_wrap:w \__kernel_tl_gset:Nx } + { \@@_replace:NnNNNnn \q_@@_mark ? \@@_replace_wrap:w \__kernel_tl_gset:Ne } \cs_new_protected:Npn \tl_replace_all:Nnn - { \@@_replace:NnNNNnn \q_@@_mark ? \@@_replace_next:w \__kernel_tl_set:Nx } + { \@@_replace:NnNNNnn \q_@@_mark ? \@@_replace_next:w \__kernel_tl_set:Ne } \cs_new_protected:Npn \tl_greplace_all:Nnn - { \@@_replace:NnNNNnn \q_@@_mark ? \@@_replace_next:w \__kernel_tl_gset:Nx } + { \@@_replace:NnNNNnn \q_@@_mark ? \@@_replace_next:w \__kernel_tl_gset:Ne } +\cs_generate_variant:Nn \tl_replace_once:Nnn + { NnV , Nne , NV , Ne , Nee , c , cnV , cne , cV , ce , cee } \cs_generate_variant:Nn \tl_replace_once:Nnn - { NV , NnV , Nx , Nnx , Nxx , c , cV , cnV , cx , cnx , cxx } + { Nx , Nnx , Nxx , cxn , cnx , cxx } \cs_generate_variant:Nn \tl_greplace_once:Nnn - { NV , NnV , Nx , Nnx , Nxx , c , cV , cnV , cx , cnx , cxx } + { NnV , Nne , NV , Ne , Nee , c , cnV , cne , cV , ce , cee } +\cs_generate_variant:Nn \tl_greplace_once:Nnn + { Nx , Nnx , Nxx , cxn , cnx , cxx } +\cs_generate_variant:Nn \tl_replace_all:Nnn + { NnV , Nne , NV , Ne , Nee , c , cnV , cne , cV , ce , cee } \cs_generate_variant:Nn \tl_replace_all:Nnn - { NV , NnV , Nx , Nnx , Nxx , c , cV , cnV , cx , cnx , cxx } + { Nx , Nnx , Nxx , cxn , cnx , cxx } \cs_generate_variant:Nn \tl_greplace_all:Nnn - { NV , NnV , Nx , Nnx , Nxx , c , cV , cnV , cx , cnx , cxx } + { NnV , Nne , NV , Ne , Nee , c , cnV , cne , cV , ce , cee } +\cs_generate_variant:Nn \tl_greplace_all:Nnn + { Nx , Nnx , Nxx , cxn , cnx , cxx } % \end{macrocode} % \end{macro} % \end{macro} @@ -2046,7 +2119,7 @@ { \tl_if_empty:nTF {#6} { - \msg_error:nnx { kernel } { empty-search-pattern } + \msg_error:nne { kernel } { empty-search-pattern } { \tl_to_str:n {#7} } } { @@ -2124,7 +2197,7 @@ \group_align_safe_begin: \cs_set:Npn \@@_replace_wrap:w ##1 #1 ##2 { \__kernel_exp_not:w \exp_after:wN { \use_none:nn ##1 } ##2 } - \cs_set:Npx \@@_replace_next:w ##1 #5 + \cs_set:Npe \@@_replace_next:w ##1 #5 { \exp_not:N \@@_replace_wrap:w ##1 \exp_not:n { #1 } @@ -2152,13 +2225,13 @@ % % \begin{macro} % { -% \tl_remove_once:Nn, \tl_remove_once:NV, \tl_remove_once:Nx, -% \tl_remove_once:cn, \tl_remove_once:cV, \tl_remove_once:cx +% \tl_remove_once:Nn, \tl_remove_once:NV, \tl_remove_once:Ne, +% \tl_remove_once:cn, \tl_remove_once:cV, \tl_remove_once:ce % } % \begin{macro} % { -% \tl_gremove_once:Nn, \tl_gremove_once:NV, \tl_gremove_once:Nx, -% \tl_gremove_once:cn, \tl_gremove_once:cV, \tl_gremove_once:cx +% \tl_gremove_once:Nn, \tl_gremove_once:NV, +% \tl_gremove_once:cn, \tl_gremove_once:cV, % } % Removal is just a special case of replacement. % \begin{macrocode} @@ -2166,21 +2239,25 @@ { \tl_replace_once:Nnn #1 {#2} { } } \cs_new_protected:Npn \tl_gremove_once:Nn #1#2 { \tl_greplace_once:Nnn #1 {#2} { } } -\cs_generate_variant:Nn \tl_remove_once:Nn { NV , Nx , c , cV , cx } -\cs_generate_variant:Nn \tl_gremove_once:Nn { NV , Nx , c , cV , cx } +\cs_generate_variant:Nn \tl_remove_once:Nn { NV , Ne , c , cV , ce } +\cs_generate_variant:Nn \tl_gremove_once:Nn { NV , Ne , c , cV , ce } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro} % { -% \tl_remove_all:Nn, \tl_remove_all:NV, \tl_remove_all:Nx, -% \tl_remove_all:cn, \tl_remove_all:cV, \tl_remove_all:cx +% \tl_remove_all:Nn, \tl_remove_all:NV, \tl_remove_all:Ne, +% \tl_remove_all:Nx, +% \tl_remove_all:cn, \tl_remove_all:cV, \tl_remove_all:ce, +% \tl_remove_all:cx, % } % \begin{macro} % { -% \tl_gremove_all:Nn, \tl_gremove_all:NV, \tl_gremove_all:Nx, -% \tl_gremove_all:cn, \tl_gremove_all:cV, \tl_gremove_all:cx +% \tl_gremove_all:Nn, \tl_gremove_all:NV, \tl_gremove_all:Ne, +% \tl_gremove_all:Nx, +% \tl_gremove_all:cn, \tl_gremove_all:cV, \tl_gremove_all:ce, +% \tl_gremove_all:cx, % } % Removal is just a special case of replacement. % \begin{macrocode} @@ -2188,8 +2265,10 @@ { \tl_replace_all:Nnn #1 {#2} { } } \cs_new_protected:Npn \tl_gremove_all:Nn #1#2 { \tl_greplace_all:Nnn #1 {#2} { } } -\cs_generate_variant:Nn \tl_remove_all:Nn { NV , Nx , c , cV , cx } -\cs_generate_variant:Nn \tl_gremove_all:Nn { NV , Nx , c , cV , cx } +\cs_generate_variant:Nn \tl_remove_all:Nn { NV , Ne , c , cV , ce } +\cs_generate_variant:Nn \tl_remove_all:Nn { Nx , cx } +\cs_generate_variant:Nn \tl_gremove_all:Nn { NV , Ne , c , cV , ce } +\cs_generate_variant:Nn \tl_gremove_all:Nn { Nx , cx } % \end{macrocode} % \end{macro} % \end{macro} @@ -2328,7 +2407,12 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[TF]{\tl_if_eq:nn, \tl_if_eq:Vn, \tl_if_eq:nV, \tl_if_eq:xn, \tl_if_eq:nx} +% \begin{macro}[TF] +% { +% \tl_if_eq:nn, \tl_if_eq:nV, \tl_if_eq:ne, \tl_if_eq:Vn, \tl_if_eq:en, +% \tl_if_eq:ee, +% \tl_if_eq:xn, \tl_if_eq:nx, \tl_if_eq:xx, +% } % A simple store and compare routine. % \begin{macrocode} \prg_new_protected_conditional:Npnn \tl_if_eq:nn #1#2 { T , F , TF } @@ -2344,7 +2428,9 @@ \prg_return_false: \fi: } -\prg_generate_conditional_variant:Nnn \tl_if_eq:nn { V , nV , x , nx } { TF , T , F } +\prg_generate_conditional_variant:Nnn \tl_if_eq:nn + { nV , ne , nx , e , ee , x , xx } + { TF , T , F } % \end{macrocode} % \end{macro} % @@ -2423,13 +2509,14 @@ % \end{macro} % \end{macro} % -% \begin{macro}[EXP,pTF]{\tl_if_single:N} +% \begin{macro}[EXP,pTF]{\tl_if_single:N, \tl_if_single:c} % Expand the token list and feed it to \cs{tl_if_single:nTF}. % \begin{macrocode} \cs_new:Npn \tl_if_single_p:N { \exp_args:No \tl_if_single_p:n } \cs_new:Npn \tl_if_single:NT { \exp_args:No \tl_if_single:nT } \cs_new:Npn \tl_if_single:NF { \exp_args:No \tl_if_single:nF } \cs_new:Npn \tl_if_single:NTF { \exp_args:No \tl_if_single:nTF } +\prg_generate_conditional_variant:Nnn \tl_if_single:N {c} { p , T , F , TF } % \end{macrocode} % \end{macro} % @@ -2751,7 +2838,12 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\tl_trim_spaces:n, \tl_trim_spaces:o} +% \begin{macro} +% { +% \tl_trim_spaces:n, \tl_trim_spaces:V, \tl_trim_spaces:v, +% \tl_trim_spaces:e, +% \tl_trim_spaces:o, +% } % \begin{macro}{\tl_trim_spaces_apply:nN, \tl_trim_spaces_apply:oN} % \begin{macro} % { @@ -2774,14 +2866,14 @@ { \@@_trim_mark: #1 } { \__kernel_exp_not:w \exp_after:wN } } -\cs_generate_variant:Nn \tl_trim_spaces:n { o } +\cs_generate_variant:Nn \tl_trim_spaces:n { V , v , e , o } \cs_new:Npn \tl_trim_spaces_apply:nN #1#2 { \@@_trim_spaces:nn { \@@_trim_mark: #1 } { \exp_args:No #2 } } \cs_generate_variant:Nn \tl_trim_spaces_apply:nN { o } \cs_new_protected:Npn \tl_trim_spaces:N #1 - { \__kernel_tl_set:Nx #1 { \exp_args:No \tl_trim_spaces:n {#1} } } + { \__kernel_tl_set:Ne #1 { \exp_args:No \tl_trim_spaces:n {#1} } } \cs_new_protected:Npn \tl_gtrim_spaces:N #1 - { \__kernel_tl_gset:Nx #1 { \exp_args:No \tl_trim_spaces:n {#1} } } + { \__kernel_tl_gset:Ne #1 { \exp_args:No \tl_trim_spaces:n {#1} } } \cs_generate_variant:Nn \tl_trim_spaces:N { c } \cs_generate_variant:Nn \tl_gtrim_spaces:N { c } % \end{macrocode} @@ -3237,7 +3329,7 @@ % or with a space, making sure that % \cs{@@_act_space:wwNNN} gobbles the space. % \begin{macrocode} -\exp_args:Nnx \use:n { \cs_new:Npn \@@_act_loop:w #1 \s_@@_act_stop } +\exp_args:Nne \use:n { \cs_new:Npn \@@_act_loop:w #1 \s_@@_act_stop } { \exp_not:o { \@@_act_if_head_is_space:nTF {#1} } \exp_not:N \@@_act_space:wwNNN @@ -3346,9 +3438,9 @@ % which stops the \texttt{f}-expansion. % \begin{macrocode} \cs_new_protected:Npn \tl_reverse:N #1 - { \__kernel_tl_set:Nx #1 { \exp_args:No \tl_reverse:n { #1 } } } + { \__kernel_tl_set:Ne #1 { \exp_args:No \tl_reverse:n { #1 } } } \cs_new_protected:Npn \tl_greverse:N #1 - { \__kernel_tl_gset:Nx #1 { \exp_args:No \tl_reverse:n { #1 } } } + { \__kernel_tl_gset:Ne #1 { \exp_args:No \tl_reverse:n { #1 } } } \cs_generate_variant:Nn \tl_reverse:N { c } \cs_generate_variant:Nn \tl_greverse:N { c } % \end{macrocode} @@ -3563,7 +3655,7 @@ { \token_to_str:N #2 = \__kernel_exp_not:w \exp_after:wN {#2} } } { - \msg_error:nnxxx { kernel } { bad-type } + \msg_error:nneee { kernel } { bad-type } { \token_to_str:N #2 } { \token_to_meaning:N #2 } { tl } } } @@ -3571,7 +3663,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\tl_show:n, \tl_show:x, \@@_show:n} +% \begin{macro}{\tl_show:n, \tl_show:e, \tl_show:x, \@@_show:n} % \begin{macro}[EXP]{\@@_show:w} % Many |show| functions are based on \cs{tl_show:n}. % The argument of \cs{tl_show:n} is line-wrapped using @@ -3591,7 +3683,7 @@ % \begin{macrocode} \cs_new_protected:Npn \tl_show:n #1 { \iow_wrap:nnnN { >~ \tl_to_str:n {#1} . } { } { } \@@_show:n } -\cs_generate_variant:Nn \tl_show:n { x } +\cs_generate_variant:Nn \tl_show:n { e , x } \cs_new_protected:Npn \@@_show:n #1 { \tl_set:Nf \l_@@_internal_a_tl { \@@_show:w #1 \s_@@_stop } @@ -3609,13 +3701,13 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\tl_log:n, \tl_log:x} +% \begin{macro}{\tl_log:n, \tl_log:e, \tl_log:x} % Logging is much easier, simply line-wrap. The |>~| and trailing % period is there to match the output of \cs{tl_show:n}. % \begin{macrocode} \cs_new_protected:Npn \tl_log:n #1 { \iow_wrap:nnnN { > ~ \tl_to_str:n {#1} . } { } { } \iow_log:n } -\cs_generate_variant:Nn \tl_log:n { x } +\cs_generate_variant:Nn \tl_log:n { e , x } % \end{macrocode} % \end{macro} % @@ -3635,17 +3727,17 @@ \exp_args:Nf \tl_if_empty:nTF { \cs_prefix_spec:N #1 \cs_parameter_spec:N #1 } { - \tl_set:Nx \l_@@_internal_a_tl {#3} + \tl_set:Ne \l_@@_internal_a_tl {#3} \tl_if_eq:NNTF #1 \l_@@_internal_a_tl {#4} { - \msg_error:nnxxxx { kernel } { bad-type } + \msg_error:nneeee { kernel } { bad-type } { \token_to_str:N #1 } { \tl_to_str:N #1 } {#2} { \tl_to_str:N \l_@@_internal_a_tl } } } { - \msg_error:nnxxx { kernel } { bad-type } + \msg_error:nneee { kernel } { bad-type } { \token_to_str:N #1 } { \token_to_meaning:N #1 } {#2} } } |