[latex3-commits] [git/LaTeX3-latex3-latex3] master: Move use of \etex_detokenize:D to \__kernel_tl_to_str:w (d10823d)

Joseph Wright joseph.wright at morningstar2.co.uk
Thu Apr 12 10:47:23 CEST 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/d10823d3cf435952ab878e943d3049fc1d1085f6

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

commit d10823d3cf435952ab878e943d3049fc1d1085f6
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Thu Apr 12 09:47:23 2018 +0100

    Move use of \etex_detokenize:D to \__kernel_tl_to_str:w
    
    Same logic as for \etex_unexpanded:D - we need this a
    few times.


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

d10823d3cf435952ab878e943d3049fc1d1085f6
 l3kernel/l3basics.dtx           |    7 ++++---
 l3kernel/l3kernel-functions.dtx |   11 +++++++++++
 l3kernel/l3keys.dtx             |    4 ++--
 l3kernel/l3quark.dtx            |    2 +-
 l3kernel/l3str.dtx              |    5 +++--
 l3kernel/l3tl.dtx               |    6 ++----
 6 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/l3kernel/l3basics.dtx b/l3kernel/l3basics.dtx
index 9ab18d2..e1818b4 100644
--- a/l3kernel/l3basics.dtx
+++ b/l3kernel/l3basics.dtx
@@ -1250,11 +1250,12 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}[EXP]{\tl_to_str:n, \token_to_str:N}
+% \begin{macro}[EXP]{\tl_to_str:n, \token_to_str:N, \__kernel_tl_to_str:w}
 %   Making strings.
 %    \begin{macrocode}
-\tex_let:D \tl_to_str:n        \etex_detokenize:D
-\tex_let:D \token_to_str:N     \tex_string:D
+\tex_let:D \tl_to_str:n          \etex_detokenize:D
+\tex_let:D \token_to_str:N       \tex_string:D
+\tex_let:D \__kernel_tl_to_str:w \etex_detokenize:D
 %    \end{macrocode}
 % \end{macro}
 %
diff --git a/l3kernel/l3kernel-functions.dtx b/l3kernel/l3kernel-functions.dtx
index 8850cba..6f6ba37 100644
--- a/l3kernel/l3kernel-functions.dtx
+++ b/l3kernel/l3kernel-functions.dtx
@@ -460,6 +460,17 @@
 %   It takes a time linear in the character count of the string.
 % \end{function}
 %
+% \begin{function}[EXP]{\__kernel_tl_to_str:w}
+%   \begin{syntax}
+%     \cs{__kernel_tl_to_str:w} \meta{expandable tokens} \Arg{tokens}
+%   \end{syntax}
+%   Carries out expansion on the \meta{expandable tokens} before conversion of
+%   the \meta{tokens} to a string as describe for \cs{tl_to_str:n}. Typically,
+%   the \meta{expandable tokens} will alter the nature of the \meta{tokens},
+%   \emph{i.e.}~allow it to be generated in some way. This function requires
+%   only a single expansion.
+% \end{function}
+%
 % \end{implementation}
 %
 % \PrintIndex
diff --git a/l3kernel/l3keys.dtx b/l3kernel/l3keys.dtx
index c5c5278..4009970 100644
--- a/l3kernel/l3keys.dtx
+++ b/l3kernel/l3keys.dtx
@@ -1051,7 +1051,7 @@
       \cs_set:Npx \@@_action:
         { \exp_not:N #1 { \exp_not:o \l_@@_key_tl } }
     \else:
-      \if:w \scan_stop: \etex_detokenize:D \exp_after:wN { \use_none:n #4 }
+      \if:w \scan_stop: \__kernel_tl_to_str:w \exp_after:wN { \use_none:n #4 }
         \scan_stop:
         \@@_def:Nn \l_@@_value_tl {#3}
         \cs_set:Npx \@@_action:
@@ -1069,7 +1069,7 @@
   }
 \cs_new_protected:Npn \@@_split_tidy:w #1 \q_stop
   {
-    \if:w \scan_stop: \etex_detokenize:D \exp_after:wN { \use_none:n #1 }
+    \if:w \scan_stop: \__kernel_tl_to_str:w \exp_after:wN { \use_none:n #1 }
       \scan_stop:
     \else:
       \exp_after:wN \@@_empty_key:
diff --git a/l3kernel/l3quark.dtx b/l3kernel/l3quark.dtx
index acd97b7..d10e6ce 100644
--- a/l3kernel/l3quark.dtx
+++ b/l3kernel/l3quark.dtx
@@ -559,7 +559,7 @@
 \cs_new:Npn \@@_if_empty_return:o #1
   {
     \exp_after:wN \if_meaning:w \exp_after:wN \q_nil
-      \etex_detokenize:D \exp_after:wN {#1} \q_nil
+      \__kernel_tl_to_str:w \exp_after:wN {#1} \q_nil
       \prg_return_true:
     \else:
       \prg_return_false:
diff --git a/l3kernel/l3str.dtx b/l3kernel/l3str.dtx
index c4592d7..e7989e8 100644
--- a/l3kernel/l3str.dtx
+++ b/l3kernel/l3str.dtx
@@ -1054,7 +1054,8 @@
        {
          \luatex_luaescapestring:D
            {
-             \etex_detokenize:D \exp_after:wN { \luatex_expanded:D {#1} }
+             \__kernel_tl_to_str:w \exp_after:wN
+               { \luatex_expanded:D {#1} }
            }
        }
    }
@@ -1235,7 +1236,7 @@
   {
     \exp_after:wN \@@_map_function:w
     \exp_after:wN \@@_map_function:Nn \exp_after:wN #2
-      \etex_detokenize:D {#1}
+      \__kernel_tl_to_str:w {#1}
       \q_recursion_tail ? ~
     \prg_break_point:Nn \str_map_break: { }
   }
diff --git a/l3kernel/l3tl.dtx b/l3kernel/l3tl.dtx
index 5c8c72c..b6b85ac 100644
--- a/l3kernel/l3tl.dtx
+++ b/l3kernel/l3tl.dtx
@@ -1954,13 +1954,11 @@
 %   The test for emptiness is based on \cs{tl_if_empty:nTF}, but
 %   the expansion is hard-coded for efficiency, as this auxiliary
 %   function is used in many places.
-%   Note that this works because \cs{etex_detokenize:D} expands tokens
-%   that follow until reading a catcode $1$ (begin-group) token.
 %    \begin{macrocode}
 \cs_new:Npn \@@_if_empty_return:o #1
   {
     \exp_after:wN \if_meaning:w \exp_after:wN \q_nil
-      \etex_detokenize:D \exp_after:wN {#1} \q_nil
+      \__kernel_tl_to_str:w \exp_after:wN {#1} \q_nil
       \prg_return_true:
     \else:
       \prg_return_false:
@@ -2290,7 +2288,7 @@
 %    These functions return the replacement text of a token list as a
 %    string.
 %    \begin{macrocode}
-\cs_new:Npn \tl_to_str:N #1 { \etex_detokenize:D \exp_after:wN {#1} }
+\cs_new:Npn \tl_to_str:N #1 { \__kernel_tl_to_str:w \exp_after:wN {#1} }
 \cs_generate_variant:Nn \tl_to_str:N { c }
 %    \end{macrocode}
 % \end{macro}





More information about the latex3-commits mailing list