From bffbeb435746ef4bfc3abbbce80006f657360f3a Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 11 May 2020 20:47:47 +0000
Subject: l3kernel (11may20)

git-svn-id: svn://tug.org/texlive/trunk@55101 c570f23f-e606-0410-a88d-b1316a301751
---
 .../source/latex/l3kernel/l3str-convert.dtx        | 150 +++++++++++----------
 1 file changed, 82 insertions(+), 68 deletions(-)

(limited to 'Master/texmf-dist/source/latex/l3kernel/l3str-convert.dtx')

diff --git a/Master/texmf-dist/source/latex/l3kernel/l3str-convert.dtx b/Master/texmf-dist/source/latex/l3kernel/l3str-convert.dtx
index 9092f8fdbc4..4620342091a 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3str-convert.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3str-convert.dtx
@@ -44,7 +44,7 @@
 %    }^^A
 % }
 %
-% \date{Released 2020-05-05}
+% \date{Released 2020-05-11}
 %
 % \maketitle
 %
@@ -286,6 +286,20 @@
 %    \end{macrocode}
 % \end{variable}
 %
+% \begin{variable}{\s_@@}
+%   Internal scan marks.
+%    \begin{macrocode}
+\scan_new:N \s_@@
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\q_@@_nil}
+%   Internal quarks.
+%    \begin{macrocode}
+\quark_new:N \q_@@_nil
+%    \end{macrocode}
+% \end{variable}
+%
 % \begin{variable}{\g_@@_alias_prop}
 %   To avoid needing one file per encoding/escaping alias, we keep track
 %   of those in a property list.
@@ -557,13 +571,13 @@
       {
         \exp_after:wN \@@_convert_gmap_internal_loop:Nww
         \exp_after:wN #1
-          \g_@@_result_tl \s__tl \q_stop \prg_break: \s__tl
+          \g_@@_result_tl \s_@@ \s_@@_stop \prg_break: \s_@@
         \prg_break_point:
       }
   }
-\cs_new:Npn \@@_convert_gmap_internal_loop:Nww #1 #2 \s__tl #3 \s__tl
+\cs_new:Npn \@@_convert_gmap_internal_loop:Nww #1 #2 \s_@@ #3 \s_@@
   {
-    \use_none_delimit_by_q_stop:w #3 \q_stop
+    \@@_use_none_delimit_by_s_stop:w #3 \s_@@_stop
     #1 {#3}
     \@@_convert_gmap_internal_loop:Nww #1
   }
@@ -626,7 +640,7 @@
 %     to a list of Unicode characters in an internal representation,
 %     with items of the form
 %     \begin{quote}
-%       \meta{bytes} \cs{s__tl} \meta{Unicode code point} \cs{s__tl}
+%       \meta{bytes} \cs{s_@@} \meta{Unicode code point} \cs{s_@@}
 %     \end{quote}
 %     where we have collected the \meta{bytes} which combined to form
 %     this particular Unicode character, and the \meta{Unicode code
@@ -679,12 +693,12 @@
       #1
       \tl_gset:Nx \g_@@_result_tl { \__kernel_str_to_other_fast:n {#4} }
       \exp_after:wN \@@_convert:wwwnn
-        \tl_to_str:n {#5} /// \q_stop
+        \tl_to_str:n {#5} /// \s_@@_stop
         { decode } { unescape }
         \prg_do_nothing:
         \@@_convert_decode_:
       \exp_after:wN \@@_convert:wwwnn
-        \tl_to_str:n {#6} /// \q_stop
+        \tl_to_str:n {#6} /// \s_@@_stop
         { encode } { escape }
         \use_ii_i:nn
         \@@_convert_encode_:
@@ -721,7 +735,7 @@
 %   was given, and only the encoding, |#1|, should be performed.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_convert:wwwnn
-    #1 / #2 // #3 \q_stop #4#5
+    #1 / #2 // #3 \s_@@_stop #4#5
   {
     \@@_convert:nnn {enc} {#4} {#1}
     \@@_convert:nnn {esc} {#5} {#2}
@@ -967,7 +981,7 @@
 \cs_new_protected:Npn \@@_convert_decode_:
   { \@@_convert_gmap:N \@@_decode_native_char:N }
 \cs_new:Npn \@@_decode_native_char:N #1
-  { #1 \s__tl \int_value:w `#1 \s__tl }
+  { #1 \s_@@ \int_value:w `#1 \s_@@ }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -1039,7 +1053,7 @@
       }
   }
 \cs_new:Npn \@@_decode_clist_char:n #1
-  { #1 \s__tl \int_eval:n {#1} \s__tl }
+  { #1 \s_@@ \int_eval:n {#1} \s_@@ }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -1115,11 +1129,11 @@
       \int_zero:N \l_@@_internal_int
       \exp_last_unbraced:Nx \@@_decode_eight_bit_load:nn
         { \tl_use:c { c_@@_encoding_#1_tl } }
-        { \q_stop \prg_break: } { }
+        { \s_@@_stop \prg_break: } { }
       \prg_break_point:
       \exp_last_unbraced:Nx \@@_decode_eight_bit_load_missing:n
         { \tl_use:c { c_@@_encoding_#1_missing_tl } }
-        { \q_stop \prg_break: }
+        { \s_@@_stop \prg_break: }
       \prg_break_point:
       \flag_clear:n { str_error }
       \@@_convert_gmap:N \@@_decode_eight_bit_char:N
@@ -1128,7 +1142,7 @@
   }
 \cs_new_protected:Npn \@@_decode_eight_bit_load:nn #1#2
   {
-    \use_none_delimit_by_q_stop:w #1 \q_stop
+    \@@_use_none_delimit_by_s_stop:w #1 \s_@@_stop
     \tex_dimen:D "#1 = \l_@@_internal_int sp \scan_stop:
     \tex_skip:D \l_@@_internal_int = "#1 sp \scan_stop:
     \tex_toks:D \l_@@_internal_int \exp_after:wN { \int_value:w "#2 }
@@ -1137,7 +1151,7 @@
   }
 \cs_new_protected:Npn \@@_decode_eight_bit_load_missing:n #1
   {
-    \use_none_delimit_by_q_stop:w #1 \q_stop
+    \@@_use_none_delimit_by_s_stop:w #1 \s_@@_stop
     \tex_dimen:D "#1 = \l_@@_internal_int sp \scan_stop:
     \tex_skip:D \l_@@_internal_int = "#1 sp \scan_stop:
     \tex_toks:D \l_@@_internal_int \exp_after:wN
@@ -1147,13 +1161,13 @@
   }
 \cs_new:Npn \@@_decode_eight_bit_char:N #1
   {
-    #1 \s__tl
+    #1 \s_@@
     \if_int_compare:w \tex_dimen:D `#1 < \l_@@_internal_int
       \if_int_compare:w \tex_skip:D \tex_dimen:D `#1 = `#1 \exp_stop_f:
         \tex_the:D \tex_toks:D \tex_dimen:D
       \fi:
     \fi:
-    \int_value:w `#1 \s__tl
+    \int_value:w `#1 \s_@@
   }
 %    \end{macrocode}
 % \end{macro}
@@ -1173,7 +1187,7 @@
       \int_zero:N \l_@@_internal_int
       \exp_last_unbraced:Nx \@@_encode_eight_bit_load:nn
         { \tl_use:c { c_@@_encoding_#1_tl } }
-        { \q_stop \prg_break: } { }
+        { \s_@@_stop \prg_break: } { }
       \prg_break_point:
       \flag_clear:n { str_error }
       \@@_convert_gmap_internal:N \@@_encode_eight_bit_char:n
@@ -1182,7 +1196,7 @@
   }
 \cs_new_protected:Npn \@@_encode_eight_bit_load:nn #1#2
   {
-    \use_none_delimit_by_q_stop:w #1 \q_stop
+    \@@_use_none_delimit_by_s_stop:w #1 \s_@@_stop
     \tex_dimen:D "#2 = \l_@@_internal_int sp \scan_stop:
     \tex_skip:D \l_@@_internal_int = "#2 sp \scan_stop:
     \exp_args:NNf \tex_toks:D \l_@@_internal_int
@@ -1762,17 +1776,17 @@
       {  32 } {     192 }
       {  16 } {     224 }
       {   8 } {     240 }
-    \q_stop
+    \s_@@_stop
   }
-\cs_new:Npn \@@_encode_utf_viii_loop:wwnnw #1; #2; #3#4 #5 \q_stop
+\cs_new:Npn \@@_encode_utf_viii_loop:wwnnw #1; #2; #3#4 #5 \s_@@_stop
   {
     \if_int_compare:w #1 < #3 \exp_stop_f:
       \@@_output_byte:n { #1 + #4 }
-      \exp_after:wN \use_none_delimit_by_q_stop:w
+      \exp_after:wN \@@_use_none_delimit_by_s_stop:w
     \fi:
     \exp_after:wN \@@_encode_utf_viii_loop:wwnnw
       \int_value:w \int_div_truncate:nn {#1} {64} ; #1 ;
-      #5 \q_stop
+      #5 \s_@@_stop
     \@@_output_byte:n { #2 - 64 * ( #1 - 2 ) }
   }
 %    \end{macrocode}
@@ -1949,7 +1963,7 @@
   {
     #1
     \if_int_compare:w `#1 < "C0 \exp_stop_f:
-      \s__tl
+      \s_@@
       \if_int_compare:w `#1 < "80 \exp_stop_f:
         \int_value:w `#1
       \else:
@@ -1961,12 +1975,12 @@
       \exp_after:wN \@@_decode_utf_viii_continuation:wwN
       \int_value:w \int_eval:n { `#1 - "C0 } \exp_after:wN
     \fi:
-    \s__tl
-    \use_none_delimit_by_q_stop:w {"80} {"800} {"10000} {"110000} \q_stop
+    \s_@@
+    \@@_use_none_delimit_by_s_stop:w {"80} {"800} {"10000} {"110000} \s_@@_stop
     \@@_decode_utf_viii_start:N
   }
 \cs_new:Npn \@@_decode_utf_viii_continuation:wwN
-    #1 \s__tl #2 \@@_decode_utf_viii_start:N #3
+    #1 \s_@@ #2 \@@_decode_utf_viii_start:N #3
   {
     \use_none:n #3
     \if_int_compare:w `#3 <
@@ -1976,20 +1990,20 @@
       \exp_after:wN \@@_decode_utf_viii_aux:wNnnwN
       \int_value:w \int_eval:n { #1 * "40 + `#3 - "80 } \exp_after:wN
     \else:
-      \s__tl
+      \s_@@
       \flag_raise:n { str_missing }
       \flag_raise:n { str_error }
       \int_use:N \c_@@_replacement_char_int
     \fi:
-    \s__tl
+    \s_@@
     #2
     \@@_decode_utf_viii_start:N #3
   }
 \cs_new:Npn \@@_decode_utf_viii_aux:wNnnwN
-    #1 \s__tl #2#3#4 #5 \@@_decode_utf_viii_start:N #6
+    #1 \s_@@ #2#3#4 #5 \@@_decode_utf_viii_start:N #6
   {
     \if_int_compare:w #1 < #4 \exp_stop_f:
-      \s__tl
+      \s_@@
       \if_int_compare:w #1 < #3 \exp_stop_f:
         \flag_raise:n { str_overlong }
         \flag_raise:n { str_error }
@@ -1998,13 +2012,13 @@
         #1
       \fi:
     \else:
-      \if_meaning:w \q_stop #5
+      \if_meaning:w \s_@@_stop #5
         \@@_decode_utf_viii_overflow:w #1
       \fi:
       \exp_after:wN \@@_decode_utf_viii_continuation:wwN
       \int_value:w \int_eval:n { #1 - #4 } \exp_after:wN
     \fi:
-    \s__tl
+    \s_@@
     #2 {#4} #5
     \@@_decode_utf_viii_start:N
   }
@@ -2017,10 +2031,10 @@
   }
 \cs_new:Npn \@@_decode_utf_viii_end:
   {
-    \s__tl
+    \s_@@
     \flag_raise:n { str_missing }
     \flag_raise:n { str_error }
-    \int_use:N \c_@@_replacement_char_int \s__tl
+    \int_use:N \c_@@_replacement_char_int \s_@@
     \prg_break:
   }
 %    \end{macrocode}
@@ -2192,7 +2206,7 @@
 %   big-endianness. The three endianness cases are based on a common
 %   auxiliary whose first argument is $1$ for big-endian and $2$ for
 %   little-endian, and whose second argument, delimited by the scan mark
-%   \cs{s_stop}, is expanded once (the string may be long; passing
+%   \cs{s_@@_stop}, is expanded once (the string may be long; passing
 %   \cs{g_@@_result_tl} as an argument before expansion is cheaper).
 %
 %   The \cs{@@_decode_utf_xvi:Nw} function defines \cs{@@_tmp:w} to
@@ -2202,13 +2216,13 @@
 %   \cs{@@_decode_utf_xvi_pair:NN} described below.
 %    \begin{macrocode}
   \cs_new_protected:cpn { @@_convert_decode_utf16be: }
-    { \@@_decode_utf_xvi:Nw 1 \g_@@_result_tl \s_stop }
+    { \@@_decode_utf_xvi:Nw 1 \g_@@_result_tl \s_@@_stop }
   \cs_new_protected:cpn { @@_convert_decode_utf16le: }
-    { \@@_decode_utf_xvi:Nw 2 \g_@@_result_tl \s_stop }
+    { \@@_decode_utf_xvi:Nw 2 \g_@@_result_tl \s_@@_stop }
   \cs_new_protected:cpn { @@_convert_decode_utf16: }
     {
       \exp_after:wN \@@_decode_utf_xvi_bom:NN
-        \g_@@_result_tl \s_stop \s_stop \s_stop
+        \g_@@_result_tl \s_@@_stop \s_@@_stop \s_@@_stop
     }
   \cs_new_protected:Npn \@@_decode_utf_xvi_bom:NN #1#2
     {
@@ -2220,7 +2234,7 @@
             { \@@_decode_utf_xvi:Nw 1 #1#2 }
         }
     }
-  \cs_new_protected:Npn \@@_decode_utf_xvi:Nw #1#2 \s_stop
+  \cs_new_protected:Npn \@@_decode_utf_xvi:Nw #1#2 \s_@@_stop
     {
       \flag_clear:n { str_error }
       \flag_clear:n { str_missing }
@@ -2230,7 +2244,7 @@
       \tl_gset:Nx \g_@@_result_tl
         {
           \exp_after:wN \@@_decode_utf_xvi_pair:NN
-            #2 \q_nil \q_nil
+            #2 \q_@@_nil \q_@@_nil
           \prg_break_point:
         }
       \@@_if_flag_error:nnx { str_error } { utf16-decode } { }
@@ -2271,8 +2285,8 @@
 %   range $[\hexnum{DC}, \hexnum{DF}]$ (trail surrogate). The test is
 %   similar to the test used for continuation bytes in the
 %   \textsc{utf-8} decoding functions. In the case where |#4#5| is
-%   indeed a trail surrogate, leave |#1#2#4#5| \cs{s__tl}
-%   \meta{code~point} \cs{s__tl}, and remove the pair |#4#5| before
+%   indeed a trail surrogate, leave |#1#2#4#5| \cs{s_@@}
+%   \meta{code~point} \cs{s_@@}, and remove the pair |#4#5| before
 %   looping with \cs{@@_decode_utf_xvi_pair:NN}. Otherwise, of course,
 %   complain about the missing surrogate.
 %
@@ -2281,13 +2295,13 @@
 %   \hexnum{DC00} - \hexnum{10000}$.
 %
 %   Every time we read a pair of bytes, we test for the end-marker
-%   \cs{q_nil}. When reaching the end, we additionally check that the
+%   \cs{q_@@_nil}. When reaching the end, we additionally check that the
 %   string had an even length. Also, if the end is reached when
 %   expecting a trail surrogate, we treat that as a missing surrogate.
 %    \begin{macrocode}
   \cs_new:Npn \@@_decode_utf_xvi_pair:NN #1#2
     {
-      \if_meaning:w \q_nil #2
+      \if_meaning:w \q_@@_nil #2
         \@@_decode_utf_xvi_pair_end:Nw #1
       \fi:
       \if_case:w
@@ -2295,14 +2309,14 @@
       \or: \exp_after:wN \@@_decode_utf_xvi_quad:NNwNN
       \or: \exp_after:wN \@@_decode_utf_xvi_extra:NNw
       \fi:
-      #1#2 \s__tl
-      \int_eval:n { "100 * \@@_tmp:w #1#2 + \@@_tmp:w #2#1 } \s__tl
+      #1#2 \s_@@
+      \int_eval:n { "100 * \@@_tmp:w #1#2 + \@@_tmp:w #2#1 } \s_@@
       \@@_decode_utf_xvi_pair:NN
     }
   \cs_new:Npn \@@_decode_utf_xvi_quad:NNwNN
       #1#2 #3 \@@_decode_utf_xvi_pair:NN #4#5
     {
-      \if_meaning:w \q_nil #5
+      \if_meaning:w \q_@@_nil #5
         \@@_decode_utf_xvi_error:nNN { missing } #1#2
         \@@_decode_utf_xvi_pair_end:Nw #4
       \fi:
@@ -2313,13 +2327,13 @@
             \@@_tmp:w #4#5 < "E0
           \fi:
           \exp_stop_f:
-        #1 #2 #4 #5 \s__tl
+        #1 #2 #4 #5 \s_@@
         \int_eval:n
           {
             ( "100 * \@@_tmp:w #1#2 + \@@_tmp:w #2#1 - "D7F7 ) * "400
             + "100 * \@@_tmp:w #4#5 + \@@_tmp:w #5#4
           }
-        \s__tl
+        \s_@@
         \exp_after:wN \use_i:nnn
       \else:
         \@@_decode_utf_xvi_error:nNN { missing } #1#2
@@ -2329,20 +2343,20 @@
   \cs_new:Npn \@@_decode_utf_xvi_pair_end:Nw #1 \fi:
     {
       \fi:
-      \if_meaning:w \q_nil #1
+      \if_meaning:w \q_@@_nil #1
       \else:
         \@@_decode_utf_xvi_error:nNN { end } #1 \prg_do_nothing:
       \fi:
       \prg_break:
     }
-  \cs_new:Npn \@@_decode_utf_xvi_extra:NNw #1#2 \s__tl #3 \s__tl
+  \cs_new:Npn \@@_decode_utf_xvi_extra:NNw #1#2 \s_@@ #3 \s_@@
     { \@@_decode_utf_xvi_error:nNN { extra } #1#2 }
   \cs_new:Npn \@@_decode_utf_xvi_error:nNN #1#2#3
     {
       \flag_raise:n { str_error }
       \flag_raise:n { str_#1 }
-      #2 #3 \s__tl
-      \int_use:N \c_@@_replacement_char_int \s__tl
+      #2 #3 \s_@@
+      \int_use:N \c_@@_replacement_char_int \s_@@
     }
 %    \end{macrocode}
 % \end{macro}
@@ -2470,7 +2484,7 @@
 %
 %   The structure is similar to \textsc{utf-16} decoding functions. If
 %   the endianness is not given, test the first $4$ bytes of the string
-%   (possibly \cs{s_stop} if the string is too short) for the presence
+%   (possibly \cs{s_@@_stop} if the string is too short) for the presence
 %   of a byte-order mark. If there is a byte-order mark, use that
 %   endianness, and remove the $4$ bytes, otherwise default to
 %   big-endian, and leave the $4$ bytes in place. The
@@ -2482,22 +2496,22 @@
 %   inside an \texttt{x}-expanding assignment to \cs{g_@@_result_tl}.
 %
 %   The \texttt{_loop} auxiliary first checks for the end-of-string
-%   marker \cs{s_stop}, calling the \texttt{_end} auxiliary if
-%   appropriate. Otherwise, leave the \meta{4~bytes} \cs{s__tl} behind,
+%   marker \cs{s_@@_stop}, calling the \texttt{_end} auxiliary if
+%   appropriate. Otherwise, leave the \meta{4~bytes} \cs{s_@@} behind,
 %   then check that the code point is not overflowing: the leading byte
 %   must be $0$, and the following byte at most $16$.
 %
 %   In the ending code, we check that there remains no byte: there
-%   should be nothing left until the first \cs{s_stop}. Break the map.
+%   should be nothing left until the first \cs{s_@@_stop}. Break the map.
 %    \begin{macrocode}
   \cs_new_protected:cpn { @@_convert_decode_utf32be: }
-    { \@@_decode_utf_xxxii:Nw 1 \g_@@_result_tl \s_stop }
+    { \@@_decode_utf_xxxii:Nw 1 \g_@@_result_tl \s_@@_stop }
   \cs_new_protected:cpn { @@_convert_decode_utf32le: }
-    { \@@_decode_utf_xxxii:Nw 2 \g_@@_result_tl \s_stop }
+    { \@@_decode_utf_xxxii:Nw 2 \g_@@_result_tl \s_@@_stop }
   \cs_new_protected:cpn { @@_convert_decode_utf32: }
     {
       \exp_after:wN \@@_decode_utf_xxxii_bom:NNNN \g_@@_result_tl
-        \s_stop \s_stop \s_stop \s_stop \s_stop
+        \s_@@_stop \s_@@_stop \s_@@_stop \s_@@_stop \s_@@_stop
     }
   \cs_new_protected:Npn \@@_decode_utf_xxxii_bom:NNNN #1#2#3#4
     {
@@ -2509,7 +2523,7 @@
             { \@@_decode_utf_xxxii:Nw 1 #1#2#3#4 }
         }
     }
-  \cs_new_protected:Npn \@@_decode_utf_xxxii:Nw #1#2 \s_stop
+  \cs_new_protected:Npn \@@_decode_utf_xxxii:Nw #1#2 \s_@@_stop
     {
       \flag_clear:n { str_overflow }
       \flag_clear:n { str_end }
@@ -2518,17 +2532,17 @@
       \tl_gset:Nx \g_@@_result_tl
         {
           \exp_after:wN \@@_decode_utf_xxxii_loop:NNNN
-            #2 \s_stop \s_stop \s_stop \s_stop
+            #2 \s_@@_stop \s_@@_stop \s_@@_stop \s_@@_stop
           \prg_break_point:
         }
       \@@_if_flag_error:nnx { str_error } { utf32-decode } { }
     }
   \cs_new:Npn \@@_decode_utf_xxxii_loop:NNNN #1#2#3#4
     {
-      \if_meaning:w \s_stop #4
+      \if_meaning:w \s_@@_stop #4
         \exp_after:wN \@@_decode_utf_xxxii_end:w
       \fi:
-      #1#2#3#4 \s__tl
+      #1#2#3#4 \s_@@
       \if_int_compare:w \@@_tmp:w #1#4 > 0 \exp_stop_f:
         \flag_raise:n { str_overflow }
         \flag_raise:n { str_error }
@@ -2543,17 +2557,17 @@
             { \@@_tmp:w #2#3*"10000 + \@@_tmp:w #3#2*"100 + \@@_tmp:w #4#1 }
         \fi:
       \fi:
-      \s__tl
+      \s_@@
       \@@_decode_utf_xxxii_loop:NNNN
     }
-  \cs_new:Npn \@@_decode_utf_xxxii_end:w #1 \s_stop
+  \cs_new:Npn \@@_decode_utf_xxxii_end:w #1 \s_@@_stop
     {
       \tl_if_empty:nF {#1}
         {
           \flag_raise:n { str_end }
           \flag_raise:n { str_error }
-          #1 \s__tl
-          \int_use:N \c_@@_replacement_char_int \s__tl
+          #1 \s_@@
+          \int_use:N \c_@@_replacement_char_int \s_@@
         }
       \prg_break:
     }
-- 
cgit v1.2.3

