[latex3-commits] [latex3/latex3] main: Deprecate \tl_case:Nn(TF) (abae08290)

github at latex-project.org github at latex-project.org
Tue May 23 10:14:39 CEST 2023


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/abae082902e6cd9f4694932e605b7660e3e88495

>---------------------------------------------------------------

commit abae082902e6cd9f4694932e605b7660e3e88495
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue May 23 08:37:46 2023 +0100

    Deprecate \tl_case:Nn(TF)
    
    This closes #1071: all tasks done.


>---------------------------------------------------------------

abae082902e6cd9f4694932e605b7660e3e88495
 l3kernel/CHANGELOG.md          |  3 ++
 l3kernel/doc/l3obsolete.txt    |  8 ++++
 l3kernel/l3deprecation.dtx     | 16 ++++++++
 l3kernel/l3tl.dtx              | 87 ------------------------------------------
 l3kernel/testfiles/m3tl009.lvt | 25 +-----------
 l3kernel/testfiles/m3tl009.tlg | 16 +++-----
 6 files changed, 33 insertions(+), 122 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 1b057d4d9..e703f9855 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -7,6 +7,9 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+## Deprecated
+- `\tl_case:Nn(TF)`
+
 ### Fixed
 
 - Set `\l_keys_value_tl` in `.initial:n` (issue \#1013)
diff --git a/l3kernel/doc/l3obsolete.txt b/l3kernel/doc/l3obsolete.txt
index 0be4e4d5e..3efe2a869 100644
--- a/l3kernel/doc/l3obsolete.txt
+++ b/l3kernel/doc/l3obsolete.txt
@@ -53,6 +53,14 @@ Function                            Date deprecated
 \seq_indexed_map_inline:Nn               2020-06-18
 \seq_indexed_map_function:NN             2020-06-18
 \sys_load_deprecation:                   2021-01-11
+\tl_case:cn                              2023-05-23
+\tl_case:cnF                             2023-05-23
+\tl_case:cnT                             2023-05-23
+\tl_case:cnTF                            2023-05-23
+\tl_case:Nn                              2023-05-23
+\tl_case:NnF                             2023-05-23
+\tl_case:NnT                             2023-05-23
+\tl_case:NnTF                            2023-05-23
 \tl_lower_case:n                         2020-01-03
 \tl_lower_case:nn                        2020-01-03
 \tl_mixed_case:n                         2020-01-03
diff --git a/l3kernel/l3deprecation.dtx b/l3kernel/l3deprecation.dtx
index 05264251e..1107d8374 100644
--- a/l3kernel/l3deprecation.dtx
+++ b/l3kernel/l3deprecation.dtx
@@ -583,6 +583,22 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}[noTF]{\tl_case:Nn, \tl_case:cn}
+%    \begin{macrocode}
+\__kernel_patch_deprecation:nnNNpn { 2022-05-23 } { \token_case_meaning:Nn }
+\cs_gset:Npn \tl_case:Nn { \token_case_meaning:Nn }
+\__kernel_patch_deprecation:nnNNpn { 2022-05-23 } { \token_case_meaning:NnT }
+\cs_gset:Npn \tl_case:NnT { \token_case_meaning:NnT }
+\__kernel_patch_deprecation:nnNNpn { 2022-05-23 } { \token_case_meaning:NnF }
+\cs_gset:Npn \tl_case:NnF { \token_case_meaning:NnF }
+\__kernel_patch_deprecation:nnNNpn { 2022-05-23 } { \token_case_meaning:NnTF }
+\cs_gset:Npn \tl_case:NnTF { \token_case_meaning:NnTF }
+\cs_generate_variant:Nn \tl_case:Nn   { c }
+\prg_generate_conditional_variant:Nnn \tl_case:Nn
+  { c } { T , F , TF }
+%    \end{macrocode}
+% \end{macro}
+%
 % \subsection{Deprecated \pkg{l3token} functions}
 %
 % \begin{macro}[EXP]{\char_to_utfviii_bytes:n}
diff --git a/l3kernel/l3tl.dtx b/l3kernel/l3tl.dtx
index 79350555d..0794a8cce 100644
--- a/l3kernel/l3tl.dtx
+++ b/l3kernel/l3tl.dtx
@@ -350,30 +350,6 @@
 %   Token groups (|{|\ldots|}|) are not single tokens.
 % \end{function}
 %
-% \begin{function}[added = 2013-07-24, EXP, noTF]{\tl_case:Nn, \tl_case:cn}
-%   \begin{syntax}
-%     \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{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 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{tl_case:Nn}, which does nothing if there is no match, is also
-%   available.
-% \end{function}
-%
 % \subsection{Testing the first token}
 %
 % \begin{function}[updated = 2012-07-09, EXP, pTF]
@@ -2430,69 +2406,6 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}[EXP, noTF]{\tl_case:Nn, \tl_case:cn}
-% \begin{macro}[EXP]{\@@_case:nnTF}
-% \begin{macro}[EXP]{\@@_case:Nw}
-% \begin{macro}[EXP]{\@@_case_end:nw}
-%   The aim here is to allow the case statement to be evaluated
-%   using a known number of expansion steps (two), and without
-%   needing to use an explicit \enquote{end of recursion} marker.
-%   That is achieved by using the test input as the final case,
-%   as this is always true. The trick is then to tidy up
-%   the output such that the appropriate case code plus either
-%   the \texttt{true} or \texttt{false} branch code is inserted.
-%    \begin{macrocode}
-\cs_new:Npn \tl_case:Nn #1#2
-  {
-    \exp:w
-    \@@_case:NnTF #1 {#2} { } { }
-  }
-\cs_new:Npn \tl_case:NnT #1#2#3
-  {
-    \exp:w
-    \@@_case:NnTF #1 {#2} {#3} { }
-  }
-\cs_new:Npn \tl_case:NnF #1#2#3
-  {
-    \exp:w
-    \@@_case:NnTF #1 {#2} { } {#3}
-  }
-\cs_new:Npn \tl_case:NnTF #1#2
-  {
-    \exp:w
-    \@@_case:NnTF #1 {#2}
-  }
-\cs_new:Npn \@@_case:NnTF #1#2#3#4
-  { \@@_case:Nw #1 #2 #1 { } \s_@@_mark {#3} \s_@@_mark {#4} \s_@@_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:Nn   { c }
-\prg_generate_conditional_variant:Nnn \tl_case:Nn
-  { c } { T , F , TF }
-%    \end{macrocode}
-%   To tidy up the recursion, there are two outcomes. If there was a hit to
-%   one of the cases searched for, then |#1| is the code to insert,
-%   |#2| is the \emph{next} case to check on and |#3| is all of
-%   the rest of the cases code. That means that |#4| is the \texttt{true}
-%   branch code, and |#5| tidies up the spare \cs{s_@@_mark} and the
-%   \texttt{false} branch. On the other hand, if none of the cases matched
-%   then we arrive here using the \enquote{termination} case of comparing
-%   the search with itself. That means that |#1| is empty, |#2| is
-%   the first \cs{s_@@_mark} and so |#4| is the \texttt{false} code (the
-%   \texttt{true} code is mopped up by |#3|).
-%    \begin{macrocode}
-\cs_new:Npn \@@_case_end:nw #1#2#3 \s_@@_mark #4#5 \s_@@_stop
-  { \exp_end: #1 #4 }
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
 % \subsection{Mapping over token lists}
 %
 % \begin{macro}
diff --git a/l3kernel/testfiles/m3tl009.lvt b/l3kernel/testfiles/m3tl009.lvt
index 98cffaf4a..265abca61 100644
--- a/l3kernel/testfiles/m3tl009.lvt
+++ b/l3kernel/testfiles/m3tl009.lvt
@@ -1,5 +1,5 @@
 %
-% Copyright (C) 2011-2016,2018-2021 The LaTeX Project
+% Copyright (C) 2011-2016,2018-2021,2023 The LaTeX Project
 %
 \documentclass{minimal}
 \input{regression-test}
@@ -131,29 +131,6 @@
     }
 }
 
-\OMIT
-  \tl_new:N  \tla
-  \tl_new:N  \tlb
-  \tl_new:N  \tlc
-  \tl_set:Nn \tla { x }
-  \tl_set:Nn \tlb { y }
-  \tl_set:Nn \tlc { y }
-\TIMO
-
-\TESTEXP { Tl~case~statement }
-  {
-    \tl_case:NnF \tlb
-      {
-        \tlc   { \YES }
-        \ERROR { \ERROR }
-      }
-      { \NO }
-    \NEWLINE
-    \tl_case:NnF \tla
-    { \tlb { \YES } }
-    { \YES }
-  }
-
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \TEST{tl~misc}{
   \tl_set:Nn \l_A_tl { & \tex_cr:D }
diff --git a/l3kernel/testfiles/m3tl009.tlg b/l3kernel/testfiles/m3tl009.tlg
index 725dbc611..6a1a56bcc 100644
--- a/l3kernel/testfiles/m3tl009.tlg
+++ b/l3kernel/testfiles/m3tl009.tlg
@@ -54,13 +54,7 @@ TRUE
 2
 ============================================================
 ============================================================
-TEST 5: Tl case statement
-============================================================
-YES
-YES
-============================================================
-============================================================
-TEST 6: tl misc
+TEST 5: tl misc
 ============================================================
 0
 1
@@ -72,7 +66,7 @@ TEST 6: tl misc
 2
 ============================================================
 ============================================================
-TEST 7: tl advanced conditionals
+TEST 6: tl advanced conditionals
 ============================================================
 0
 1
@@ -90,7 +84,7 @@ FALSE
 3
 ============================================================
 ============================================================
-TEST 8: tl advanced tests
+TEST 7: tl advanced tests
 ============================================================
 0
 1
@@ -104,7 +98,7 @@ TEST 8: tl advanced tests
 4
 ============================================================
 ============================================================
-TEST 9: tl if in
+TEST 8: tl if in
 ============================================================
 0
 TRUE
@@ -123,7 +117,7 @@ FALSE
 4
 ============================================================
 ============================================================
-TEST 10: tl head and tail
+TEST 9: tl head and tail
 ============================================================
 0
 1





More information about the latex3-commits mailing list.