Skip to content

Commit

Permalink
Rename \str_case_x:nn(TF) to \str_case:ee(TF)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Jun 18, 2018
1 parent bd413bc commit 3cca096
Show file tree
Hide file tree
Showing 18 changed files with 174 additions and 119 deletions.
2 changes: 1 addition & 1 deletion l3experimental/l3str/l3str-convert.dtx
Expand Up @@ -1547,7 +1547,7 @@
{ \@@_unescape_string_repeat:NNNNNN ?? }
}
{
\str_case_x:nnF {#2}
\str_case:eeF {#2}
{
{ \c_backslash_str } { 134 }
{ ( } { 50 }
Expand Down
2 changes: 2 additions & 0 deletions l3kernel/CHANGELOG.md
Expand Up @@ -9,9 +9,11 @@ this project uses date-based 'snapshot' version identifiers.

## Added
- `\lua_escape:e`, `\lua_now:e` and `\lua_shipout_e:n`
- `\str_case:ee(TF)`

## Deprecated
- `\lua_escape_x:n`, `\lua_now_x:n` and `\lua_shipout_x:n`
- `\str_case_x:nn(TF)`

## [2018-06-14]

Expand Down
2 changes: 1 addition & 1 deletion l3kernel/l3deprecation.dtx
Expand Up @@ -138,7 +138,7 @@
\__kernel_deprecation_error:Nnn \str_case:onn
{ \str_case:onF } { 2015-07-14 }
\__kernel_deprecation_error:Nnn \str_case_x:nnn
{ \str_case_x:nnF } { 2015-07-14 }
{ \str_case:eeF } { 2015-07-14 }
\__kernel_deprecation_error:Nnn \tl_case:cnn
{ \tl_case:cnF } { 2015-07-14 }
\__kernel_deprecation_error:Nnn \tl_case:Nnn
Expand Down
4 changes: 4 additions & 0 deletions l3kernel/l3obsolete.txt
Expand Up @@ -61,6 +61,10 @@ Function Expires end
\ptex_...:D 2019
\sort_ordered: 2018
\sort_reversed: 2018
\str_case_x:nn 2019
\str_case_x:nnF 2019
\str_case_x:nnT 2019
\str_case_x:nnTF 2019
\tl_show_analysis:N 2019
\tl_show_analysis:n 2019
\token_new:Nn 2018
Expand Down
2 changes: 1 addition & 1 deletion l3kernel/l3regex.dtx
Expand Up @@ -2421,7 +2421,7 @@
}
\cs_new_protected:Npn \@@_compile_quantifier_braced_auxi:w #1#2
{
\str_case_x:nnF { #1 #2 }
\str_case:eeF { #1 #2 }
{
{ \@@_compile_special:N \c_right_brace_str }
{
Expand Down
93 changes: 51 additions & 42 deletions l3kernel/l3str.dtx
Expand Up @@ -353,8 +353,8 @@
% tests whether \meta{string_2} is found inside \meta{string_1}.
% \end{function}
%
% \begin{function}[added = 2013-07-24, updated = 2015-02-28, EXP, noTF]
% {\str_case:nn, \str_case:on, \str_case:nV, \str_case:nv}
% \begin{function}[added = 2013-07-24, updated = 2018-06-18, EXP, noTF]
% {\str_case:nn, \str_case:on, \str_case:nV, \str_case:nv, \str_case:ee}
% \begin{syntax}
% \cs{str_case:nnTF} \Arg{test string} \\
% ~~|{| \\
Expand All @@ -376,32 +376,9 @@
% match then the \meta{false code} is inserted. The function
% \cs{str_case:nn}, which does nothing if there is no match, is also
% available.
% \end{function}
%
% \begin{function}[added = 2013-07-24, EXP, noTF]{\str_case_x:nn}
% \begin{syntax}
% \cs{str_case_x:nnTF} \Arg{test string} \\
% ~~|{| \\
% ~~~~\Arg{string case_1} \Arg{code case_1} \\
% ~~~~\Arg{string case_2} \Arg{code case_2} \\
% ~~~~\ldots \\
% ~~~~\Arg{string case_n} \Arg{code case_n} \\
% ~~|}| \\
% ~~\Arg{true code}
% ~~\Arg{false code}
% \end{syntax}
% Compares the full expansion of the \meta{test string}
% in turn with the full expansion of the \meta{string cases}
% (all token lists are converted to strings). If the two
% full expansions are equal (as described for \cs{str_if_eq:nnTF}) then the
% associated \meta{code} is left in the input stream
% and other cases are discarded. 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{str_case_x:nn}, which does nothing if there is no match, is also
% available.
% The \meta{test string} is expanded in each comparison, and must
% For technical reasons, in the \texttt{e}-type variant,
% the \meta{test string} is expanded in each comparison, and must
% always yield the same result: for example, random numbers must
% not be used within this string.
% \end{function}
Expand Down Expand Up @@ -1137,10 +1114,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:ee}
% \begin{macro}[EXP]{\@@_case:nnTF, \@@_case:eeTF}
% \begin{macro}[EXP]
% {\@@_case:nw, \@@_case_x:nw, \@@_case_end:nw}
% {\@@_case:nw, \@@_case:ew, \@@_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}
Expand Down Expand Up @@ -1175,33 +1152,33 @@
{ \@@_case_end:nw {#3} }
{ \@@_case:nw {#1} }
}
\cs_new:Npn \str_case_x:nn #1#2
\cs_new:Npn \str_case:ee #1#2
{
\exp:w
\@@_case_x:nnTF {#1} {#2} { } { }
\@@_case:eeTF {#1} {#2} { } { }
}
\cs_new:Npn \str_case_x:nnT #1#2#3
\cs_new:Npn \str_case:eeT #1#2#3
{
\exp:w
\@@_case_x:nnTF {#1} {#2} {#3} { }
\@@_case:eeTF {#1} {#2} {#3} { }
}
\cs_new:Npn \str_case_x:nnF #1#2
\cs_new:Npn \str_case:eeF #1#2
{
\exp:w
\@@_case_x:nnTF {#1} {#2} { }
\@@_case:eeTF {#1} {#2} { }
}
\cs_new:Npn \str_case_x:nnTF #1#2
\cs_new:Npn \str_case:eeTF #1#2
{
\exp:w
\@@_case_x:nnTF {#1} {#2}
\@@_case:eeTF {#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:eeTF #1#2#3#4
{ \@@_case:ew {#1} #2 {#1} { } \q_mark {#3} \q_mark {#4} \q_stop }
\cs_new:Npn \@@_case:ew #1#2#3
{
\str_if_eq_x:nnTF {#1} {#2}
{ \@@_case_end:nw {#3} }
{ \@@_case_x:nw {#1} }
{ \@@_case:ew {#1} }
}
\cs_new:Npn \@@_case_end:nw #1#2#3 \q_mark #4#5 \q_stop
{ \exp_end: #1 #4 }
Expand Down Expand Up @@ -1921,6 +1898,38 @@
% \end{macrocode}
% \end{macro}
%
% \subsection{Deprecated functions}
%
% \begin{macro}[EXP, deprecated = 2019-12-31, noTF]{\str_case_x:nn}
% For removal after 2019-12-31.
% \begin{macrocode}
\__kernel_patch_deprecation:nnNNpn { 2019-12-31 } { \str_case:ee }
\cs_new:Npn \str_case_x:nn #1#2
{
\exp:w
\@@_case:eeTF {#1} {#2} { } { }
}
\__kernel_patch_deprecation:nnNNpn { 2019-12-31 } { \str_case:eeT }
\cs_new:Npn \str_case_x:nnT #1#2#3
{
\exp:w
\@@_case:eeTF {#1} {#2} {#3} { }
}
\__kernel_patch_deprecation:nnNNpn { 2019-12-31 } { \str_case:eeF }
\cs_new:Npn \str_case_x:nnF #1#2
{
\exp:w
\@@_case:eeTF {#1} {#2} { }
}
\__kernel_patch_deprecation:nnNNpn { 2019-12-31 } { \str_case:eeTF }
\cs_new:Npn \str_case_x:nnTF #1#2
{
\exp:w
\@@_case:eeTF {#1} {#2}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
%</initex|package>
% \end{macrocode}
Expand Down
6 changes: 3 additions & 3 deletions l3kernel/testfiles/m3basics001.lvt
Expand Up @@ -130,7 +130,7 @@
{ { x } { \NO } }
{ \YES }
\NEWLINE
\str_case_x:nnF { \tmp }
\str_case:eeF { \tmp }
{
{ x } { \NO }
{ y } { \NO }
Expand All @@ -139,7 +139,7 @@
}
{ \NO }
\NEWLINE
\str_case_x:nnF { yz }
\str_case:eeF { yz }
{
{ x } { \NO }
{ y } { \NO }
Expand All @@ -148,7 +148,7 @@
}
{ \NO }
\NEWLINE
\str_case_x:nnF { x\tmp }
\str_case:eeF { x\tmp }
{
{ x } { \NO }
{ y } { \NO }
Expand Down
18 changes: 11 additions & 7 deletions l3kernel/testfiles/m3expl001.luatex.tlg
Expand Up @@ -807,12 +807,12 @@ Defining \str_case:onTF on line ...
Defining \str_case:nVTF on line ...
Defining \str_case:nvTF on line ...
Defining \__str_case:nw on line ...
Defining \str_case_x:nn on line ...
Defining \str_case_x:nnT on line ...
Defining \str_case_x:nnF on line ...
Defining \str_case_x:nnTF on line ...
Defining \__str_case_x:nnTF on line ...
Defining \__str_case_x:nw on line ...
Defining \str_case:ee on line ...
Defining \str_case:eeT on line ...
Defining \str_case:eeF on line ...
Defining \str_case:eeTF on line ...
Defining \__str_case:eeTF on line ...
Defining \__str_case:ew on line ...
Defining \__str_case_end:nw on line ...
Defining \str_map_function:nN on line ...
Defining \str_map_function:NN on line ...
Expand Down Expand Up @@ -913,6 +913,10 @@ Defining \g_tmpb_str on line ...
Defining \str_show:n on line ...
Defining \str_show:N on line ...
Defining \str_show:c on line ...
Defining \str_case_x:nn on line ...
Defining \str_case_x:nnT on line ...
Defining \str_case_x:nnF on line ...
Defining \str_case_x:nnTF on line ...
Defining \quark_new:N on line ...
Defining \q_nil on line ...
Defining \q_mark on line ...
Expand Down Expand Up @@ -6069,7 +6073,7 @@ Defining key expl/log-functions/true on line ...
Defining key expl/log-functions/false on line ...
Defining \c__expl_def_ext_tl on line ...
(l3pdfmode.def
Defining \__driver_literal_x:n on line ...
Defining \__driver_literal:e on line ...
Defining \__driver_literal:n on line ...
Defining \__driver_literal:x on line ...
Defining \driver_color_pickup:N on line ...
Expand Down
18 changes: 11 additions & 7 deletions l3kernel/testfiles/m3expl001.ptex.tlg
Expand Up @@ -843,12 +843,12 @@ Defining \str_case:onTF on line ...
Defining \str_case:nVTF on line ...
Defining \str_case:nvTF on line ...
Defining \__str_case:nw on line ...
Defining \str_case_x:nn on line ...
Defining \str_case_x:nnT on line ...
Defining \str_case_x:nnF on line ...
Defining \str_case_x:nnTF on line ...
Defining \__str_case_x:nnTF on line ...
Defining \__str_case_x:nw on line ...
Defining \str_case:ee on line ...
Defining \str_case:eeT on line ...
Defining \str_case:eeF on line ...
Defining \str_case:eeTF on line ...
Defining \__str_case:eeTF on line ...
Defining \__str_case:ew on line ...
Defining \__str_case_end:nw on line ...
Defining \str_map_function:nN on line ...
Defining \str_map_function:NN on line ...
Expand Down Expand Up @@ -949,6 +949,10 @@ Defining \g_tmpb_str on line ...
Defining \str_show:n on line ...
Defining \str_show:N on line ...
Defining \str_show:c on line ...
Defining \str_case_x:nn on line ...
Defining \str_case_x:nnT on line ...
Defining \str_case_x:nnF on line ...
Defining \str_case_x:nnTF on line ...
Defining \quark_new:N on line ...
Defining \q_nil on line ...
Defining \q_mark on line ...
Expand Down Expand Up @@ -6106,7 +6110,7 @@ Defining key expl/log-functions/true on line ...
Defining key expl/log-functions/false on line ...
Defining \c__expl_def_ext_tl on line ...
(l3dvipdfmx.def
Defining \__driver_literal_x:n on line ...
Defining \__driver_literal:e on line ...
Defining \__driver_literal:n on line ...
Defining \__driver_literal:x on line ...
Defining \driver_color_pickup:N on line ...
Expand Down
18 changes: 11 additions & 7 deletions l3kernel/testfiles/m3expl001.tlg
Expand Up @@ -843,12 +843,12 @@ Defining \str_case:onTF on line ...
Defining \str_case:nVTF on line ...
Defining \str_case:nvTF on line ...
Defining \__str_case:nw on line ...
Defining \str_case_x:nn on line ...
Defining \str_case_x:nnT on line ...
Defining \str_case_x:nnF on line ...
Defining \str_case_x:nnTF on line ...
Defining \__str_case_x:nnTF on line ...
Defining \__str_case_x:nw on line ...
Defining \str_case:ee on line ...
Defining \str_case:eeT on line ...
Defining \str_case:eeF on line ...
Defining \str_case:eeTF on line ...
Defining \__str_case:eeTF on line ...
Defining \__str_case:ew on line ...
Defining \__str_case_end:nw on line ...
Defining \str_map_function:nN on line ...
Defining \str_map_function:NN on line ...
Expand Down Expand Up @@ -949,6 +949,10 @@ Defining \g_tmpb_str on line ...
Defining \str_show:n on line ...
Defining \str_show:N on line ...
Defining \str_show:c on line ...
Defining \str_case_x:nn on line ...
Defining \str_case_x:nnT on line ...
Defining \str_case_x:nnF on line ...
Defining \str_case_x:nnTF on line ...
Defining \quark_new:N on line ...
Defining \q_nil on line ...
Defining \q_mark on line ...
Expand Down Expand Up @@ -6307,7 +6311,7 @@ Defining key expl/log-functions/true on line ...
Defining key expl/log-functions/false on line ...
Defining \c__expl_def_ext_tl on line ...
(l3pdfmode.def
Defining \__driver_literal_x:n on line ...
Defining \__driver_literal:e on line ...
Defining \__driver_literal:n on line ...
Defining \__driver_literal:x on line ...
Defining \driver_color_pickup:N on line ...
Expand Down
18 changes: 11 additions & 7 deletions l3kernel/testfiles/m3expl001.uptex.tlg
Expand Up @@ -843,12 +843,12 @@ Defining \str_case:onTF on line ...
Defining \str_case:nVTF on line ...
Defining \str_case:nvTF on line ...
Defining \__str_case:nw on line ...
Defining \str_case_x:nn on line ...
Defining \str_case_x:nnT on line ...
Defining \str_case_x:nnF on line ...
Defining \str_case_x:nnTF on line ...
Defining \__str_case_x:nnTF on line ...
Defining \__str_case_x:nw on line ...
Defining \str_case:ee on line ...
Defining \str_case:eeT on line ...
Defining \str_case:eeF on line ...
Defining \str_case:eeTF on line ...
Defining \__str_case:eeTF on line ...
Defining \__str_case:ew on line ...
Defining \__str_case_end:nw on line ...
Defining \str_map_function:nN on line ...
Defining \str_map_function:NN on line ...
Expand Down Expand Up @@ -949,6 +949,10 @@ Defining \g_tmpb_str on line ...
Defining \str_show:n on line ...
Defining \str_show:N on line ...
Defining \str_show:c on line ...
Defining \str_case_x:nn on line ...
Defining \str_case_x:nnT on line ...
Defining \str_case_x:nnF on line ...
Defining \str_case_x:nnTF on line ...
Defining \quark_new:N on line ...
Defining \q_nil on line ...
Defining \q_mark on line ...
Expand Down Expand Up @@ -6304,7 +6308,7 @@ Defining key expl/log-functions/true on line ...
Defining key expl/log-functions/false on line ...
Defining \c__expl_def_ext_tl on line ...
(l3dvipdfmx.def
Defining \__driver_literal_x:n on line ...
Defining \__driver_literal:e on line ...
Defining \__driver_literal:n on line ...
Defining \__driver_literal:x on line ...
Defining \driver_color_pickup:N on line ...
Expand Down

0 comments on commit 3cca096

Please sign in to comment.