summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3str.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3str.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3str.dtx189
1 files changed, 103 insertions, 86 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx
index 56e01c67d4e..af918d1d164 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx
@@ -41,7 +41,7 @@
% }^^A
% }
%
-% \date{Released 2018-06-14}
+% \date{Released 2018-08-23}
%
% \maketitle
%
@@ -104,8 +104,11 @@
% initially empty.
% \end{function}
%
-% \begin{function}[added = 2015-09-18]
-% {\str_const:Nn, \str_const:Nx, \str_const:cn, \str_const:cx}
+% \begin{function}[added = 2015-09-18, updated = 2018-07-28]
+% {
+% \str_const:Nn, \str_const:NV, \str_const:Nx,
+% \str_const:cn, \str_const:cV, \str_const:cx
+% }
% \begin{syntax}
% \cs{str_const:Nn} \meta{str~var} \Arg{token list}
% \end{syntax}
@@ -161,10 +164,12 @@
%
% \section{Adding data to string variables}
%
-% \begin{function}[added = 2015-09-18]
+% \begin{function}[added = 2015-09-18, updated = 2018-07-28]
% {
-% \str_set:Nn, \str_set:Nx, \str_set:cn, \str_set:cx,
-% \str_gset:Nn, \str_gset:Nx, \str_gset:cn, \str_gset:cx
+% \str_set:Nn, \str_set:NV, \str_set:Nx,
+% \str_set:cn, \str_set:cV, \str_set:cx,
+% \str_gset:Nn, \str_gset:NV, \str_gset:Nx,
+% \str_gset:cn, \str_gset:cV, \str_gset:cx
% }
% \begin{syntax}
% \cs{str_set:Nn} \meta{str var} \Arg{token list}
@@ -173,12 +178,12 @@
% result in \meta{str var}.
% \end{function}
%
-% \begin{function}[added = 2015-09-18]
+% \begin{function}[added = 2015-09-18, updated = 2018-07-28]
% {
-% \str_put_left:Nn, \str_put_left:Nx,
-% \str_put_left:cn, \str_put_left:cx,
-% \str_gput_left:Nn, \str_gput_left:Nx,
-% \str_gput_left:cn, \str_gput_left:cx
+% \str_put_left:Nn, \str_put_left:NV, \str_put_left:Nx,
+% \str_put_left:cn, \str_put_left:cV, \str_put_left:cx,
+% \str_gput_left:Nn, \str_gput_left:NV, \str_gput_left:Nx,
+% \str_gput_left:cn, \str_gput_left:cV, \str_gput_left:cx
% }
% \begin{syntax}
% \cs{str_put_left:Nn} \meta{str var} \Arg{token list}
@@ -188,12 +193,12 @@
% var} are not automatically converted to a string.
% \end{function}
%
-% \begin{function}[added = 2015-09-18]
+% \begin{function}[added = 2015-09-18, updated = 2018-07-28]
% {
-% \str_put_right:Nn, \str_put_right:Nx,
-% \str_put_right:cn, \str_put_right:cx,
-% \str_gput_right:Nn, \str_gput_right:Nx,
-% \str_gput_right:cn, \str_gput_right:cx
+% \str_put_right:Nn, \str_put_right:NV, \str_put_right:Nx,
+% \str_put_right:cn, \str_put_right:cV, \str_put_right:cx,
+% \str_gput_right:Nn, \str_gput_right:NV, \str_gput_right:Nx,
+% \str_gput_right:cn, \str_gput_right:cV, \str_gput_right:cx
% }
% \begin{syntax}
% \cs{str_put_right:Nn} \meta{str var} \Arg{token list}
@@ -302,10 +307,11 @@
% in the same order.
% \end{function}
%
-% \begin{function}[EXP,pTF]
+% \begin{function}[EXP,pTF, updated = 2018-06-18]
% {
% \str_if_eq:nn, \str_if_eq:Vn, \str_if_eq:on, \str_if_eq:no,
-% \str_if_eq:nV, \str_if_eq:VV
+% \str_if_eq:nV, \str_if_eq:VV, \str_if_eq:vn, \str_if_eq:nv,
+% \str_if_eq:ee
% }
% \begin{syntax}
% \cs{str_if_eq_p:nn} \Arg{tl_1} \Arg{tl_2}
@@ -321,21 +327,6 @@
% is logically \texttt{true}.
% \end{function}
%
-% \begin{function}[EXP,pTF, added = 2012-06-05]{\str_if_eq_x:nn}
-% \begin{syntax}
-% \cs{str_if_eq_x_p:nn} \Arg{tl_1} \Arg{tl_2}
-% \cs{str_if_eq_x:nnTF} \Arg{tl_1} \Arg{tl_2} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Fully expands the two \meta{token lists} and converts them to \meta{strings}, then
-% compares these on a character by character basis:
-% it is \texttt{true} if the two \meta{strings} contain the same
-% characters in the same order. Thus for example
-% \begin{verbatim}
-% \str_if_eq_x_p:nn { abc } { \tl_to_str:n { abc } }
-% \end{verbatim}
-% is logically \texttt{true}.
-% \end{function}
-%
% \begin{function}[TF, added = 2017-10-08]{\str_if_in:Nn, \str_if_in:cn}
% \begin{syntax}
% \cs{str_if_in:NnTF} \meta{str~var} \Arg{token list} \Arg{true code} \Arg{false code}
@@ -378,9 +369,9 @@
% available.
% \end{function}
%
-% \begin{function}[added = 2013-07-24, EXP, noTF]{\str_case_x:nn}
+% \begin{function}[added = 2018-06-19, EXP, noTF]{\str_case_e:nn}
% \begin{syntax}
-% \cs{str_case_x:nnTF} \Arg{test string} \\
+% \cs{str_case_e:nnTF} \Arg{test string} \\
% ~~|{| \\
% ~~~~\Arg{string case_1} \Arg{code case_1} \\
% ~~~~\Arg{string case_2} \Arg{code case_2} \\
@@ -399,7 +390,7 @@
% 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{str_case_x:nn}, which does nothing if there is no match, is also
+% \cs{str_case_e:nn}, which does nothing if there is no match, is also
% available.
% The \meta{test string} is expanded in each comparison, and must
% always yield the same result: for example, random numbers must
@@ -868,20 +859,20 @@
%
% \begin{macro}
% {
-% \str_set:Nn, \str_set:Nx,
-% \str_set:cn, \str_set:cx,
-% \str_gset:Nn, \str_gset:Nx,
-% \str_gset:cn, \str_gset:cx,
-% \str_const:Nn, \str_const:Nx,
-% \str_const:cn, \str_const:cx,
-% \str_put_left:Nn, \str_put_left:Nx,
-% \str_put_left:cn, \str_put_left:cx,
-% \str_gput_left:Nn, \str_gput_left:Nx,
-% \str_gput_left:cn, \str_gput_left:cx,
-% \str_put_right:Nn, \str_put_right:Nx,
-% \str_put_right:cn, \str_put_right:cx,
-% \str_gput_right:Nn, \str_gput_right:Nx,
-% \str_gput_right:cn, \str_gput_right:cx,
+% \str_set:Nn, \str_set:NV, \str_set:Nx,
+% \str_set:cn, \str_set:cV, \str_set:cx,
+% \str_gset:Nn, \str_gset:NV, \str_gset:Nx,
+% \str_gset:cn, \str_gset:cV, \str_gset:cx,
+% \str_const:Nn, \str_const:NV, \str_const:Nx,
+% \str_const:cn, \str_const:cV, \str_const:cx,
+% \str_put_left:Nn, \str_put_left:NV, \str_put_left:Nx,
+% \str_put_left:cn, \str_put_left:cV, \str_put_left:cx,
+% \str_gput_left:Nn, \str_gput_left:NV, \str_gput_left:Nx,
+% \str_gput_left:cn, \str_gput_left:cV, \str_gput_left:cx,
+% \str_put_right:Nn, \str_put_right:NV, \str_put_right:Nx,
+% \str_put_right:cn, \str_put_right:cV, \str_put_right:cx,
+% \str_gput_right:Nn, \str_gput_right:NV, \str_gput_right:Nx,
+% \str_gput_right:cn, \str_gput_right:cV, \str_gput_right:cx
% }
% Simply convert the token list inputs to \meta{strings}.
% \begin{macrocode}
@@ -895,7 +886,7 @@
\exp_not:c { tl_ #1 :Nx } ##1
{ \exp_not:N \tl_to_str:n {##2} }
}
- \cs_generate_variant:cn { str_ #1 :Nn } { Nx , cn , cx }
+ \cs_generate_variant:cn { str_ #1 :Nn } { NV , Nx , cn , cV , cx }
\@@_tmp:n
}
}
@@ -1029,8 +1020,8 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[EXP]{\@@_if_eq_x:nn}
-% \begin{macro}[EXP]{\@@_escape_x:n}
+% \begin{macro}[EXP]{\@@_if_eq:nn}
+% \begin{macro}[EXP]{\@@_escape:n}
% String comparisons rely on the primitive \cs[index=pdfstrcmp]{(pdf)strcmp} if available:
% \LuaTeX{} does not have it, so emulation is required. As the net result
% is that we do not \emph{always} use the primitive, the correct approach
@@ -1039,30 +1030,30 @@
% the necessary Lua code is loaded in \pkg{l3boostrap}.
% The need to detokenize and force
% expansion of input arises from the case where a |#| token is used in the
-% input, \emph{e.g.}~|\__str_if_eq_x:nn {#} { \tl_to_str:n {#} }|, which
+% input, \emph{e.g.}~|\__str_if_eq:nn {#} { \tl_to_str:n {#} }|, which
% otherwise would fail as \cs{tex_luaescapestring:D} does not double
% such tokens.
% \begin{macrocode}
-\cs_new:Npn \@@_if_eq_x:nn #1#2 { \tex_strcmp:D {#1} {#2} }
+\cs_new:Npn \@@_if_eq:nn #1#2 { \tex_strcmp:D {#1} {#2} }
\cs_if_exist:NT \tex_luatexversion:D
{
- \cs_set_eq:NN \lua_escape_x:n \tex_luaescapestring:D
- \cs_set_eq:NN \lua_now_x:n \tex_directlua:D
- \cs_set:Npn \@@_if_eq_x:nn #1#2
+ \cs_set_eq:NN \lua_escape:e \tex_luaescapestring:D
+ \cs_set_eq:NN \lua_now:e \tex_directlua:D
+ \cs_set:Npn \@@_if_eq:nn #1#2
{
- \lua_now_x:n
+ \lua_now:e
{
l3kernel.strcmp
(
- " \@@_escape_x:n {#1} " ,
- " \@@_escape_x:n {#2} "
+ " \@@_escape:n {#1} " ,
+ " \@@_escape:n {#2} "
)
}
}
- \cs_new:Npn \@@_escape_x:n #1
+ \cs_new:Npn \@@_escape:n #1
{
- \lua_escape_x:n
- { \__kernel_tl_to_str:w \use_x:n { {#1} } }
+ \lua_escape:e
+ { \__kernel_tl_to_str:w \use:e { {#1} } }
}
}
% \end{macrocode}
@@ -1073,7 +1064,7 @@
% {
% \str_if_eq:nn, \str_if_eq:Vn, \str_if_eq:on, \str_if_eq:nV,
% \str_if_eq:no, \str_if_eq:VV,
-% \str_if_eq_x:nn
+% \str_if_eq:ee
% }
% Modern engines provide a direct way of comparing two token lists,
% but returning a number. This set of conditionals therefore make life
@@ -1083,15 +1074,15 @@
\prg_new_conditional:Npnn \str_if_eq:nn #1#2 { p , T , F , TF }
{
\if_int_compare:w
- \@@_if_eq_x:nn { \exp_not:n {#1} } { \exp_not:n {#2} }
+ \@@_if_eq:nn { \exp_not:n {#1} } { \exp_not:n {#2} }
= 0 \exp_stop_f:
\prg_return_true: \else: \prg_return_false: \fi:
}
\prg_generate_conditional_variant:Nnn \str_if_eq:nn
- { V , o , nV , no , VV } { p , T , F , TF }
-\prg_new_conditional:Npnn \str_if_eq_x:nn #1#2 { p , T , F , TF }
+ { V , v , o , nV , no , VV , nv } { p , T , F , TF }
+\prg_new_conditional:Npnn \str_if_eq:ee #1#2 { p , T , F , TF }
{
- \if_int_compare:w \@@_if_eq_x:nn {#1} {#2} = 0 \exp_stop_f:
+ \if_int_compare:w \@@_if_eq:nn {#1} {#2} = 0 \exp_stop_f:
\prg_return_true: \else: \prg_return_false: \fi:
}
% \end{macrocode}
@@ -1105,7 +1096,7 @@
\prg_new_conditional:Npnn \str_if_eq:NN #1#2 { p , TF , T , F }
{
\if_int_compare:w
- \@@_if_eq_x:nn { \tl_to_str:N #1 } { \tl_to_str:N #2 }
+ \@@_if_eq:nn { \tl_to_str:N #1 } { \tl_to_str:N #2 }
= 0 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi:
}
\prg_generate_conditional_variant:Nnn \str_if_eq:NN
@@ -1137,10 +1128,10 @@
% \end{macro}
%
% \begin{macro}[EXP, noTF]
-% {\str_case:nn, \str_case:on, \str_case:nV, \str_case:nv, \str_case_x:nn}
-% \begin{macro}[EXP]{\@@_case:nnTF, \@@_case_x:nnTF}
+% {\str_case:nn, \str_case:on, \str_case:nV, \str_case:nv, \str_case_e:nn}
+% \begin{macro}[EXP]{\@@_case:nnTF, \@@_case_e:nnTF}
% \begin{macro}[EXP]
-% {\@@_case:nw, \@@_case_x:nw, \@@_case_end:nw}
+% {\@@_case:nw, \@@_case_e:nw, \@@_case_end:nw}
% Much the same as \cs[index=tl_case:nn]{tl_case:nn(TF)} here:
% just a change in the internal comparison.
% \begin{macrocode}
@@ -1175,33 +1166,33 @@
{ \@@_case_end:nw {#3} }
{ \@@_case:nw {#1} }
}
-\cs_new:Npn \str_case_x:nn #1#2
+\cs_new:Npn \str_case_e:nn #1#2
{
\exp:w
- \@@_case_x:nnTF {#1} {#2} { } { }
+ \@@_case_e:nnTF {#1} {#2} { } { }
}
-\cs_new:Npn \str_case_x:nnT #1#2#3
+\cs_new:Npn \str_case_e:nnT #1#2#3
{
\exp:w
- \@@_case_x:nnTF {#1} {#2} {#3} { }
+ \@@_case_e:nnTF {#1} {#2} {#3} { }
}
-\cs_new:Npn \str_case_x:nnF #1#2
+\cs_new:Npn \str_case_e:nnF #1#2
{
\exp:w
- \@@_case_x:nnTF {#1} {#2} { }
+ \@@_case_e:nnTF {#1} {#2} { }
}
-\cs_new:Npn \str_case_x:nnTF #1#2
+\cs_new:Npn \str_case_e:nnTF #1#2
{
\exp:w
- \@@_case_x:nnTF {#1} {#2}
+ \@@_case_e:nnTF {#1} {#2}
}
-\cs_new:Npn \@@_case_x:nnTF #1#2#3#4
- { \@@_case_x:nw {#1} #2 {#1} { } \q_mark {#3} \q_mark {#4} \q_stop }
-\cs_new:Npn \@@_case_x:nw #1#2#3
+\cs_new:Npn \@@_case_e:nnTF #1#2#3#4
+ { \@@_case_e:nw {#1} #2 {#1} { } \q_mark {#3} \q_mark {#4} \q_stop }
+\cs_new:Npn \@@_case_e:nw #1#2#3
{
- \str_if_eq_x:nnTF {#1} {#2}
+ \str_if_eq:eeTF {#1} {#2}
{ \@@_case_end:nw {#3} }
- { \@@_case_x:nw {#1} }
+ { \@@_case_e:nw {#1} }
}
\cs_new:Npn \@@_case_end:nw #1#2#3 \q_mark #4#5 \q_stop
{ \exp_end: #1 #4 }
@@ -1921,6 +1912,32 @@
% \end{macrocode}
% \end{macro}
%
+% \subsection{Deprecated functions}
+%
+% \begin{macro}[EXP, deprecated = 2019-12-31, noTF]{\str_case_x:nn}
+% \begin{macro}[EXP, deprecated = 2019-12-31, pTF]{\str_if_eq_x:nn}
+% For removal after 2019-12-31.
+% \begin{macrocode}
+\__kernel_patch_deprecation:nnNNpn { 2019-12-31 } { \str_case_e:nn }
+\cs_new:Npn \str_case_x:nn { \str_case_e:nn }
+\__kernel_patch_deprecation:nnNNpn { 2019-12-31 } { \str_case_e:nnT }
+\cs_new:Npn \str_case_x:nnT { \str_case_e:nnT }
+\__kernel_patch_deprecation:nnNNpn { 2019-12-31 } { \str_case_e:nnF }
+\cs_new:Npn \str_case_x:nnF { \str_case_e:nnF }
+\__kernel_patch_deprecation:nnNNpn { 2019-12-31 } { \str_case_e:nnTF }
+\cs_new:Npn \str_case_x:nnTF { \str_case_e:nnTF }
+\__kernel_patch_deprecation:nnNNpn { 2019-12-31 } { \str_if_eq_p:ee }
+\cs_new:Npn \str_if_eq_x_p:nn { \str_if_eq_p:ee }
+\__kernel_patch_deprecation:nnNNpn { 2019-12-31 } { \str_if_eq:eeT }
+\cs_new:Npn \str_if_eq_x:nnT { \str_if_eq:eeT }
+\__kernel_patch_deprecation:nnNNpn { 2019-12-31 } { \str_if_eq:eeF }
+\cs_new:Npn \str_if_eq_x:nnF { \str_if_eq:eeF }
+\__kernel_patch_deprecation:nnNNpn { 2019-12-31 } { \str_if_eq:eeTF }
+\cs_new:Npn \str_if_eq_x:nnTF { \str_if_eq:eeTF }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \begin{macrocode}
%</initex|package>
% \end{macrocode}