diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3tl.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3tl.dtx | 232 |
1 files changed, 45 insertions, 187 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index e4c1329a728..a9eb3dc4376 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3tl.dtx 4482 2013-04-24 21:05:12Z joseph $ +\GetIdInfo$Id: l3tl.dtx 4581 2013-07-28 08:38:50Z joseph $ {L3 Token lists} %</driver|package> %<*driver> @@ -153,8 +153,7 @@ % \begin{syntax} % \cs{tl_clear:N} \meta{tl~var} % \end{syntax} -% Clears all entries from the \meta{tl~var} within the scope of -% the current \TeX{} group. +% Clears all entries from the \meta{tl~var}. % \end{function} % % \begin{function} @@ -487,23 +486,28 @@ % token count $1$ according to \cs{tl_count:n}. % \end{function} % -% \begin{function}[added = 2012-06-03, EXP]{\tl_case:Nnn, \tl_case:cnn} +% \begin{function}[added = 2013-07-24, EXP, TF]{\tl_case:Nnn, \tl_case:cnn} % \begin{syntax} -% \cs{tl_case:Nnn} \meta{test token list variable} \\ +% \cs{tl_case:NnTF} \meta{test token list variable} \\ % ~~"{" \\ % ~~~~\meta{token list variable case_1} \Arg{code case_1} \\ % ~~~~\meta{token list variable case_2} \Arg{code case_2} \\ % ~~~~\ldots \\ % ~~~~\meta{token list variable case_n} \Arg{code case_n} \\ % ~~"}" \\ -% ~~\Arg{else code} +% ~~\Arg{true code} +% ~~\Arg{false code} % \end{syntax} % This function compares the \meta{test token list variable} in turn % with each of the \meta{token list variable cases}. If the two % are equal (as described for \cs{tl_if_eq:NNTF}) % then the associated \meta{code} is left in the input -% stream. If none of the tests are \texttt{true} then the -% \texttt{else code} will be left in the input stream. +% stream. If any of the +% cases are matched, the \meta{true code} is also inserted into the +% input stream (after the code for the appropriate case), while if none +% match then the \meta{false code} is inserted. The function +% \cs{tl_case:Nn}, which does nothing if there is no match, is also +% available. % \end{function} % % \section{Mapping to token lists} @@ -1775,27 +1779,52 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\tl_case:Nnn, \tl_case:cnn} +% \begin{macro}[EXP]{\tl_case:Nn, \tl_case:cn} +% \begin{macro}[EXP, TF]{\tl_case:Nn, \tl_case:cn} +% \begin{macro}[EXP, aux]{\@@_case:nnTF} % \begin{macro}[aux, EXP]{\@@_case:Nw} % \begin{macro}[aux, EXP]{\@@_case_end:nw} +% Similar set up to \cs{str_case:nn(TF)} as described in \pkg{l3basics}. % \begin{macrocode} -\cs_new:Npn \tl_case:Nnn #1#2#3 +\cs_new:Npn \tl_case:Nn #1#2 { \tex_romannumeral:D - \@@_case:Nw #1 #2 #1 {#3} \q_recursion_stop + \@@_case:NnTF #1 {#2} { } { } } +\cs_new:Npn \tl_case:NnT #1#2#3 + { + \tex_romannumeral:D + \@@_case:NnTF #1 {#2} {#3} { } + } +\cs_new:Npn \tl_case:NnF #1#2#3 + { + \tex_romannumeral:D + \@@_case:NnTF #1 {#2} { } {#3} + } +\cs_new:Npn \tl_case:NnTF #1#2 + { + \tex_romannumeral:D + \@@_case:NnTF #1 {#2} + } +\cs_new:Npn \@@_case:NnTF #1#2#3#4 + { \@@_case:Nw #1 #2 #1 { } \q_mark {#3} \q_mark {#4} \q_stop } \cs_new:Npn \@@_case:Nw #1#2#3 { \tl_if_eq:NNTF #1 #2 { \@@_case_end:nw {#3} } { \@@_case:Nw #1 } } -\cs_generate_variant:Nn \tl_case:Nnn { c } +\cs_generate_variant:Nn \tl_case:Nn { c } +\cs_generate_variant:Nn \tl_case:NnT { c } +\cs_generate_variant:Nn \tl_case:NnF { c } +\cs_generate_variant:Nn \tl_case:NnTF { c } \cs_new_eq:NN \@@_case_end:nw \__prg_case_end:nw % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % % \subsection{Mapping to token lists} % @@ -2585,182 +2614,11 @@ % % \subsection{Deprecated functions} % -% \begin{macro}{\tl_new:Nn, \tl_new:cn, \tl_new:Nx} -% Use either \cs{tl_const:Nn} or \cs{tl_new:N}. -% \begin{macrocode} -%<*deprecated> -\cs_new_protected:Npn \tl_new:Nn #1#2 - { - \tl_new:N #1 - \tl_gset:Nn #1 {#2} - } -\cs_generate_variant:Nn \tl_new:Nn { c } -\cs_generate_variant:Nn \tl_new:Nn { Nx } -%</deprecated> -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\tl_gset:Nc} -% \begin{macro}{\tl_set:Nc} -% This was useful once, but nowadays does not make much sense. -% \begin{macrocode} -%<*deprecated> -\cs_new_protected_nopar:Npn \tl_gset:Nc - { \tex_global:D \tl_set:Nc } -\cs_new_protected:Npn \tl_set:Nc #1#2 - { \tl_set:No #1 { \cs:w #2 \cs_end: } } -%</deprecated> -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\tl_replace_in:Nnn, \tl_replace_in:cnn} -% \begin{macro}{\tl_greplace_in:Nnn, \tl_greplace_in:cnn} -% \begin{macro}{\tl_replace_all_in:Nnn, \tl_replace_all_in:cnn} -% \begin{macro}{\tl_greplace_all_in:Nnn, \tl_greplace_all_in:cnn} -% These are renamed. -% \begin{macrocode} -%<*deprecated> -\cs_new_eq:NN \tl_replace_in:Nnn \tl_replace_once:Nnn -\cs_new_eq:NN \tl_replace_in:cnn \tl_replace_once:cnn -\cs_new_eq:NN \tl_greplace_in:Nnn \tl_greplace_once:Nnn -\cs_new_eq:NN \tl_greplace_in:cnn \tl_greplace_once:cnn -\cs_new_eq:NN \tl_replace_all_in:Nnn \tl_replace_all:Nnn -\cs_new_eq:NN \tl_replace_all_in:cnn \tl_replace_all:cnn -\cs_new_eq:NN \tl_greplace_all_in:Nnn \tl_greplace_all:Nnn -\cs_new_eq:NN \tl_greplace_all_in:cnn \tl_greplace_all:cnn -%</deprecated> -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\tl_remove_in:Nn, \tl_remove_in:cn} -% \begin{macro}{\tl_gremove_in:Nn, \tl_gremove_in:cn} -% \begin{macro}{\tl_remove_all_in:Nn, \tl_remove_all_in:cn} -% \begin{macro}{\tl_gremove_all_in:Nn, \tl_gremove_all_in:cn} -% Also renamed. -% \begin{macrocode} -%<*deprecated> -\cs_new_eq:NN \tl_remove_in:Nn \tl_remove_once:Nn -\cs_new_eq:NN \tl_remove_in:cn \tl_remove_once:cn -\cs_new_eq:NN \tl_gremove_in:Nn \tl_gremove_once:Nn -\cs_new_eq:NN \tl_gremove_in:cn \tl_gremove_once:cn -\cs_new_eq:NN \tl_remove_all_in:Nn \tl_remove_all:Nn -\cs_new_eq:NN \tl_remove_all_in:cn \tl_remove_all:cn -\cs_new_eq:NN \tl_gremove_all_in:Nn \tl_gremove_all:Nn -\cs_new_eq:NN \tl_gremove_all_in:cn \tl_gremove_all:cn -%</deprecated> -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\tl_elt_count:n, \tl_elt_count:V, \tl_elt_count:o} -% \begin{macro}{\tl_elt_count:N, \tl_elt_count:c} -% Another renaming job. -% \begin{macrocode} -%<*deprecated> -\cs_new_eq:NN \tl_elt_count:n \tl_count:n -\cs_new_eq:NN \tl_elt_count:V \tl_count:V -\cs_new_eq:NN \tl_elt_count:o \tl_count:o -\cs_new_eq:NN \tl_elt_count:N \tl_count:N -\cs_new_eq:NN \tl_elt_count:c \tl_count:c -%</deprecated> -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\tl_head_i:n} -% \begin{macro}{\tl_head_i:w} -% \begin{macro}{\tl_head_iii:n} -% \begin{macro}{\tl_head_iii:f} -% \begin{macro}{\tl_head_iii:w} -% Two renames, and a few that are rather too specialised. -% \begin{macrocode} -%<*deprecated> -\cs_new_eq:NN \tl_head_i:n \tl_head:n -\cs_new_eq:NN \tl_head_i:w \tl_head:w -\cs_new:Npn \tl_head_iii:n #1 { \tl_head_iii:w #1 \q_stop } -\cs_generate_variant:Nn \tl_head_iii:n { f } -\cs_new:Npn \tl_head_iii:w #1#2#3#4 \q_stop {#1#2#3} -%</deprecated> -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% Deprecated on 2012-05-13 for removal by 2012-08-31. -% -% \begin{macro}{\tl_length_tokens:n} -% \begin{macrocode} -%<*deprecated> -\cs_new_eq:NN \tl_length_tokens:n \tl_count_tokens:n -%</deprecated> -% \end{macrocode} -% \end{macro} -% -% Deprecated 2012-05-13 for removal by 2012-11-31. -% -% \begin{macro} -% {\tl_length:N, \tl_length:c, \tl_length:n, \tl_length:V, \tl_length:o} -% Renames. -% \begin{macrocode} -%<*deprecated> -\cs_new_eq:NN \tl_length:N \tl_count:N -\cs_new_eq:NN \tl_length:c \tl_count:c -\cs_new_eq:NN \tl_length:n \tl_count:n -\cs_new_eq:NN \tl_length:V \tl_count:V -\cs_new_eq:NN \tl_length:o \tl_count:o -%</deprecated> -% \end{macrocode} -% \end{macro} -% -% Deprecated 2012-06-05 for removal after 2012-12-31. -% -% \begin{macro}[pTF]{\tl_if_empty:x} -% We can test expandably the emptiness of an expanded token list -% thanks to the primitive \tn{pdfstrcmp} which expands its argument: -% a token list is empty if and only if its string representation is -% empty. -% \begin{macrocode} -%<*deprecated> -\prg_new_conditional:Npnn \tl_if_empty:x #1 { p , T , F , TF } - { \__str_if_eq_x_return:nn { } {#1} } -%</deprecated> -% \end{macrocode} -% \end{macro} -% -% Deprecated 2012-07-08 for removal after 2012-10-31. -% -% \begin{macro}[EXP, pTF]{\tl_if_head_group:n} -% \begin{macro}[EXP, pTF]{\tl_if_head_N_type:n} -% \begin{macro}[EXP, pTF]{\tl_if_head_space:n} -% \begin{macrocode} -%<*deprecated> -\prg_new_eq_conditional:NNn \tl_if_head_group:n \tl_if_head_is_group:n - { p , T , F , TF } -\prg_new_eq_conditional:NNn \tl_if_head_N_type:n \tl_if_head_is_N_type:n - { p , T , F , TF } -\prg_new_eq_conditional:NNn \tl_if_head_space:n \tl_if_head_is_space:n - { p , T , F , TF } -%</deprecated> -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\tl_tail:w} -% Deprecated 2012-09-01 for removal after 2012-12-31. This is broken as -% it will strip braces from a case such as |a{bc}|. +% \begin{macro}{\tl_case:Nnn, \tl_case:cnn} +% Deprecated 2013-07-15. % \begin{macrocode} -%<*deprecated> -\cs_new:Npn \tl_tail:w #1#2 \q_stop {#2} -%</deprecated> +\cs_new_eq:NN \tl_case:Nnn \tl_case:NnF +\cs_new_eq:NN \tl_case:cnn \tl_case:cnF % \end{macrocode} % \end{macro} % |