From 8e9d8b027e86eefeb1788f42ec5fc0a8c76548ba Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Tue, 16 May 2023 20:22:00 +0000
Subject: l3kernel (16may23)

git-svn-id: svn://tug.org/texlive/trunk@67134 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/source/latex/l3kernel/l3expan.dtx   | 562 +--------------------
 1 file changed, 19 insertions(+), 543 deletions(-)

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

diff --git a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx
index 8e6e06deeb1..28ac1c8123f 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx
@@ -43,7 +43,7 @@
 %    }^^A
 % }
 %
-% \date{Released 2023-05-11}
+% \date{Released 2023-05-15}
 %
 % \maketitle
 %
@@ -1043,18 +1043,10 @@
 % \end{macro}
 %
 % \begin{macro}[EXP]{\::e}
-%   With the \tn{expanded} primitive available, just expand.  Otherwise
-%   defer to \cs{exp_args:Ne} implemented later.
+%   With the \tn{expanded} primitive available, just expand.
 %    \begin{macrocode}
-\cs_if_exist:NTF \tex_expanded:D
-  {
-    \cs_new:Npn \::e #1 \::: #2#3
-      { \tex_expanded:D { \exp_not:n { #1 \::: } { \exp_not:n {#2} {#3} } } }
-  }
-  {
-    \cs_new:Npn \::e #1 \::: #2#3
-      { \exp_args:Ne \@@_arg_next:nnn {#3} {#1} {#2} }
-  }
+\cs_new:Npn \::e #1 \::: #2#3
+  { \tex_expanded:D { \exp_not:n { #1 \::: } { \exp_not:n {#2} {#3} } } }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1242,21 +1234,10 @@
 % \end{macro}
 %
 % \begin{macro}[EXP]{\exp_args:Ne}
-%   When the \tn{expanded} primitive is available, use it.  Otherwise
-%   use \cs{@@_e:nn}, defined later, to fully expand tokens.
+%   When the \tn{expanded} primitive is available, use it.
 %    \begin{macrocode}
-\cs_if_exist:NTF \tex_expanded:D
-  {
-    \cs_new:Npn \exp_args:Ne #1#2
-      { \exp_after:wN #1 \tex_expanded:D { {#2} } }
-  }
-  {
-    \cs_new:Npn \exp_args:Ne #1#2
-      {
-        \exp_after:wN #1 \exp_after:wN
-          { \exp:w \@@_e:nn {#2} { } }
-      }
-  }
+\cs_new:Npn \exp_args:Ne #1#2
+  { \exp_after:wN #1 \tex_expanded:D { {#2} } }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1300,16 +1281,12 @@
     \exp_after:wN #2
     \exp_after:wN { \exp:w \@@_eval_register:c {#3} }
   }
-\cs_if_exist:NTF \tex_expanded:D
+\cs_new:Npn \exp_args:NNe #1#2#3
   {
-    \cs_new:Npn \exp_args:NNe #1#2#3
-      {
-        \exp_after:wN #1
-        \exp_after:wN #2
-        \tex_expanded:D { {#3} }
-      }
+    \exp_after:wN #1
+    \exp_after:wN #2
+    \tex_expanded:D { {#3} }
   }
-  { \cs_new:Npn \exp_args:NNe { \::N \::e \::: } }
 \cs_new:Npn \exp_args:NNf #1#2#3
   {
     \exp_after:wN #1
@@ -1428,15 +1405,8 @@
     \exp_after:wN \@@_arg_last_unbraced:nn
       \exp_after:wN { \exp:w \@@_eval_register:c {#2} } {#1}
   }
-\cs_if_exist:NTF \tex_expanded:D
-  {
-    \cs_new:Npn \::e_unbraced \::: #1#2
-      { \tex_expanded:D { \exp_not:n {#1} #2 } }
-  }
-  {
-    \cs_new:Npn \::e_unbraced \::: #1#2
-      { \exp:w \@@_e:nn {#2} {#1} }
-  }
+\cs_new:Npn \::e_unbraced \::: #1#2
+  { \tex_expanded:D { \exp_not:n {#1} #2 } }
 \cs_new:Npn \::f_unbraced \::: #1#2
   {
     \exp_after:wN \@@_arg_last_unbraced:nn
@@ -1487,12 +1457,8 @@
   { \exp_after:wN #1 \exp:w \@@_eval_register:N #2 }
 \cs_new:Npn \exp_last_unbraced:Nv #1#2
   { \exp_after:wN #1 \exp:w \@@_eval_register:c {#2} }
-\cs_if_exist:NTF \tex_expanded:D
-  {
-    \cs_new:Npn \exp_last_unbraced:Ne #1#2
-      { \exp_after:wN #1 \tex_expanded:D {#2} }
-  }
-  { \cs_new:Npn \exp_last_unbraced:Ne { \::e_unbraced \::: } }
+\cs_new:Npn \exp_last_unbraced:Ne #1#2
+  { \exp_after:wN #1 \tex_expanded:D {#2} }
 \cs_new:Npn \exp_last_unbraced:Nf #1#2
   { \exp_after:wN #1 \exp:w \exp_end_continue_f:w #2 }
 \cs_new:Npn \exp_last_unbraced:NNo #1#2#3
@@ -1591,15 +1557,8 @@
 %    \begin{macrocode}
 \cs_new:Npn \exp_not:c #1 { \exp_after:wN \exp_not:N \cs:w #1 \cs_end: }
 \cs_new:Npn \exp_not:o #1 { \__kernel_exp_not:w \exp_after:wN {#1} }
-\cs_if_exist:NTF \tex_expanded:D
-  {
-    \cs_new:Npn \exp_not:e #1
-      { \__kernel_exp_not:w \tex_expanded:D { {#1} } }
-  }
-  {
-    \cs_new:Npn \exp_not:e
-      { \__kernel_exp_not:w \exp_args:Ne \prg_do_nothing: }
-  }
+\cs_new:Npn \exp_not:e #1
+  { \__kernel_exp_not:w \tex_expanded:D { {#1} } }
 \cs_new:Npn \exp_not:f #1
   { \__kernel_exp_not:w \exp_after:wN { \exp:w \exp_end_continue_f:w #1 } }
 \cs_new:Npn \exp_not:V #1
@@ -1685,475 +1644,6 @@
 % \end{macro}
 % \end{macro}
 %
-%
-% \subsection{Emulating \texttt{e}-type expansion}
-%
-% When the \tn{expanded} primitive is available it is used to implement
-% \texttt{e}-type expansion; otherwise we emulate it.
-%
-%    \begin{macrocode}
-\cs_if_exist:NF \tex_expanded:D
-  {
-%    \end{macrocode}
-%
-% \begin{macro}[EXP]{\@@_e:nn, \@@_e_end:nn}
-%   Repeatedly expand tokens, keeping track of fully-expanded tokens in
-%   the second argument to \cs{@@_e:nn}; this function eventually
-%   calls \cs{@@_e_end:nn} to leave \cs{exp_end:} in the input
-%   stream, followed by the result of the expansion.  There are many
-%   special cases: spaces, brace groups, \tn{noexpand}, \tn{unexpanded},
-%   \tn{the}, \tn{primitive}.
-%   While we use brace tricks \cs{if_false:} |{| \cs{fi:}, the expansion
-%   of this function is always triggered by \cs{exp:w} so brace balance
-%   is eventually restored after that is hit with a single step of
-%   expansion.  Otherwise we could not nest \texttt{e}-type expansions
-%   within each other.
-%    \begin{macrocode}
-    \cs_new:Npn \@@_e:nn #1
-      {
-        \if_false: { \fi:
-          \tl_if_head_is_N_type:nTF {#1}
-            { \@@_e:N }
-            {
-              \tl_if_head_is_group:nTF {#1}
-                { \@@_e_group:n }
-                {
-                  \tl_if_empty:nTF {#1}
-                    { \exp_after:wN \@@_e_end:nn }
-                    { \exp_after:wN \@@_e_space:nn }
-                  \exp_after:wN { \if_false: } \fi:
-                }
-            }
-          #1
-        }
-      }
-    \cs_new:Npn \@@_e_end:nn #1#2 { \exp_end: #2 }
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[EXP]{\@@_e_space:nn}
-%   For an explicit space character, remove it by \texttt{f}-expansion
-%   and put it in the (future) output.
-%    \begin{macrocode}
-    \cs_new:Npn \@@_e_space:nn #1#2
-      { \exp_args:Nf \@@_e:nn {#1} { #2 ~ } }
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[EXP]{\@@_e_group:n, \@@_e_put:nn, \@@_e_put:nnn}
-%   For a group, expand its contents, wrap it in two pairs of braces,
-%   and call \cs{@@_e_put:nn}.  This function places the first item (the
-%   double-brace wrapped result) into the output.  Importantly,
-%   \cs{tl_head:n} works even if the input contains quarks.
-%    \begin{macrocode}
-    \cs_new:Npn \@@_e_group:n #1
-      {
-        \exp_after:wN \@@_e_put:nn
-        \exp_after:wN { \exp_after:wN { \exp_after:wN {
-              \exp:w \if_false: } \fi: \@@_e:nn {#1} { } } }
-      }
-    \cs_new:Npn \@@_e_put:nn #1
-      {
-        \exp_args:NNo \exp_args:No \@@_e_put:nnn
-          { \tl_head:n {#1} } {#1}
-      }
-    \cs_new:Npn \@@_e_put:nnn #1#2#3
-      { \exp_args:No \@@_e:nn { \use_none:n #2 } { #3 #1 } }
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[EXP]
-%   {\@@_e:N, \@@_e:Nnn, \@@_e_protected:Nnn, \@@_e_expandable:Nnn}
-%   For an \texttt{N}-type token, call \cs{@@_e:Nnn} with arguments the
-%   \meta{first token}, the remaining tokens to expand and what's
-%   already been expanded.  If the \meta{first token} is non-expandable,
-%   including \tn{protected} (\tn{long} or not) macros, it is put in the
-%   result by \cs{@@_e_protected:Nnn}.  The four special primitives
-%   \tn{unexpanded}, \tn{noexpand}, \tn{the}, \tn{primitive} are
-%   detected; otherwise the token is expanded by
-%   \cs{@@_e_expandable:Nnn}.
-%    \begin{macrocode}
-    \cs_new:Npn \@@_e:N #1
-      {
-        \exp_after:wN \@@_e:Nnn
-        \exp_after:wN #1
-        \exp_after:wN { \if_false: } \fi:
-      }
-    \cs_new:Npn \@@_e:Nnn #1
-      {
-        \if_case:w
-          \exp_after:wN \if_meaning:w \exp_not:N #1 #1 1 ~ \fi:
-          \token_if_protected_macro:NT #1 { 1 ~ }
-          \token_if_protected_long_macro:NT #1 { 1 ~ }
-          \if_meaning:w \exp_not:n #1 2 ~ \fi:
-          \if_meaning:w \exp_not:N #1 3 ~ \fi:
-          \if_meaning:w \tex_the:D #1 4 ~ \fi:
-          \if_meaning:w \tex_primitive:D #1 5 ~ \fi:
-          0 ~
-          \exp_after:wN \@@_e_expandable:Nnn
-        \or: \exp_after:wN \@@_e_protected:Nnn
-        \or: \exp_after:wN \@@_e_unexpanded:Nnn
-        \or: \exp_after:wN \@@_e_noexpand:Nnn
-        \or: \exp_after:wN \@@_e_the:Nnn
-        \or: \exp_after:wN \@@_e_primitive:Nnn
-        \fi:
-        #1
-      }
-    \cs_new:Npn \@@_e_protected:Nnn #1#2#3
-      { \@@_e:nn {#2} { #3 #1 } }
-    \cs_new:Npn \@@_e_expandable:Nnn #1#2
-      { \exp_args:No \@@_e:nn { #1 #2 } }
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[EXP]
-%   {
-%     \@@_e_primitive:Nnn,
-%     \@@_e_primitive_aux:NNw,
-%     \@@_e_primitive_aux:NNnn,
-%     \@@_e_primitive_other:NNnn,
-%     \@@_e_primitive_other_aux:nNNnn
-%   }
-%   We don't try hard to make sensible error recovery since the error
-%   recovery of \cs{tex_primitive:D} when followed by something else
-%   than a primitive depends on the engine.  The only valid case is when
-%   what follows is \texttt{N}-type.  Then distinguish special
-%   primitives \tn{unexpanded}, \tn{noexpand}, \tn{the}, \tn{primitive}
-%   from other primitives.  In the \enquote{other} case, the only
-%   reasonable way to check if the primitive that follows
-%   \cs{tex_primitive:D} is expandable is to expand and compare the
-%   before-expansion and after-expansion results.  If they coincide then
-%   probably the primitive is non-expandable and should be put in the
-%   output together with \cs{tex_primitive:D} (one can cook up contrived
-%   counter-examples where the true \tn{expanded} would have an infinite
-%   loop), and otherwise one should continue expanding.
-%    \begin{macrocode}
-    \cs_new:Npn \@@_e_primitive:Nnn #1#2
-      {
-        \if_false: { \fi:
-          \tl_if_head_is_N_type:nTF {#2}
-            { \@@_e_primitive_aux:NNw #1 }
-            {
-              \msg_expandable_error:nnn { kernel } { e-type }
-                { Missing~primitive~name }
-              \@@_e_primitive_aux:NNw #1 \c_empty_tl
-            }
-          #2
-        }
-      }
-    \cs_new:Npn \@@_e_primitive_aux:NNw #1#2
-      {
-        \exp_after:wN \@@_e_primitive_aux:NNnn
-        \exp_after:wN #1
-        \exp_after:wN #2
-        \exp_after:wN { \if_false: } \fi:
-      }
-    \cs_new:Npn \@@_e_primitive_aux:NNnn #1#2
-      {
-        \exp_args:Nf \str_case_e:nnTF { \cs_to_str:N #2 }
-          {
-            { unexpanded } { \@@_e_unexpanded:Nnn \exp_not:n }
-            { noexpand } { \@@_e_noexpand:Nnn \exp_not:N }
-            { the } { \@@_e_the:Nnn \tex_the:D }
-            {
-              \sys_if_engine_xetex:T { pdf }
-              \sys_if_engine_luatex:T { pdf }
-              primitive
-            } { \@@_e_primitive:Nnn #1 }
-          }
-          { \@@_e_primitive_other:NNnn #1 #2 }
-      }
-    \cs_new:Npn \@@_e_primitive_other:NNnn #1#2#3
-      {
-        \exp_args:No \@@_e_primitive_other_aux:nNNnn
-          { #1 #2 #3 }
-          #1 #2 {#3}
-      }
-    \cs_new:Npn \@@_e_primitive_other_aux:nNNnn #1#2#3#4#5
-      {
-        \str_if_eq:nnTF {#1} { #2 #3 #4 }
-          { \@@_e:nn {#4} { #5 #2 #3 } }
-          { \@@_e:nn {#1} {#5} }
-      }
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[EXP]{\@@_e_noexpand:Nnn}
-%   The \tn{noexpand} primitive has no effect when followed by a token
-%   that is not \texttt{N}-type; otherwise \cs{@@_e_put:nn} can grab the
-%   next token and put it in the result unchanged.
-%    \begin{macrocode}
-    \cs_new:Npn \@@_e_noexpand:Nnn #1#2
-      {
-        \tl_if_head_is_N_type:nTF {#2}
-          { \@@_e_put:nn } { \@@_e:nn } {#2}
-      }
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[EXP]
-%   {
-%     \@@_e_unexpanded:Nnn, \@@_e_unexpanded:nn,
-%     \@@_e_unexpanded:nN, \@@_e_unexpanded:N
-%   }
-%   The \tn{unexpanded} primitive expands and ignores any space,
-%   \cs{scan_stop:}, or token affected by \cs{exp_not:N}, then expects a
-%   brace group.  Since we only support brace-balanced token lists it is
-%   impossible to support the case where the argument of \tn{unexpanded}
-%   starts with an implicit brace.  Even though we want to expand and
-%   ignore spaces we cannot blindly \texttt{f}-expand because tokens
-%   affected by \cs{exp_not:N} should discarded without being expanded
-%   further.
-%
-%   As usual distinguish four cases: brace group (the normal case, where
-%   we just put the item in the result), space (just \texttt{f}-expand
-%   to remove the space), empty (an error), or \texttt{N}-type
-%   \meta{token}.  In the last case call \cs{@@_e_unexpanded:nN}
-%   triggered by an \texttt{f}-expansion.  Having a non-expandable
-%   \meta{token} after \tn{unexpanded} is an error (we recover by
-%   passing |{}| to \tn{unexpanded}; this is different from \TeX{}
-%   because the error recovery of \tn{unexpanded} changes the balance of
-%   braces), unless that \meta{token} is \cs{scan_stop:} or a space
-%   (recall that we don't implement the case of an implicit begin-group
-%   token).  An expandable \meta{token} is instead expanded, unless it
-%   is \tn{noexpand}.  The latter primitive can be followed by an expandable
-%   \texttt{N}-type token (removed), by a non-expandable one (kept
-%   and later causing an error), by a space (removed by
-%   \texttt{f}-expansion), or by a brace group or nothing (later causing
-%   an error).
-%    \begin{macrocode}
-    \cs_new:Npn \@@_e_unexpanded:Nnn #1 { \@@_e_unexpanded:nn }
-    \cs_new:Npn \@@_e_unexpanded:nn #1
-      {
-        \tl_if_head_is_N_type:nTF {#1}
-          {
-            \exp_args:Nf \@@_e_unexpanded:nn
-              { \@@_e_unexpanded:nN {#1} #1 }
-          }
-          {
-            \tl_if_head_is_group:nTF {#1}
-              { \@@_e_put:nn }
-              {
-                \tl_if_empty:nTF {#1}
-                  {
-                    \msg_expandable_error:nnn
-                      { kernel } { e-type }
-                      { \unexpanded missing~brace }
-                    \@@_e_end:nn
-                  }
-                  { \exp_args:Nf \@@_e_unexpanded:nn }
-              }
-            {#1}
-          }
-      }
-    \cs_new:Npn \@@_e_unexpanded:nN #1#2
-      {
-        \exp_after:wN \if_meaning:w \exp_not:N #2 #2
-          \exp_after:wN \use_i:nn
-        \else:
-          \exp_after:wN \use_ii:nn
-        \fi:
-        {
-          \token_if_eq_catcode:NNTF #2 \c_space_token
-            { \exp_stop_f: }
-            {
-              \token_if_eq_meaning:NNTF #2 \scan_stop:
-                { \exp_stop_f: }
-                {
-                  \msg_expandable_error:nnn
-                    { kernel } { e-type }
-                    { \unexpanded missing~brace }
-                  { }
-                }
-            }
-        }
-        {
-          \token_if_eq_meaning:NNTF #2 \exp_not:N
-            {
-              \exp_args:No \tl_if_head_is_N_type:nT { \use_none:n #1 }
-                { \@@_e_unexpanded:N }
-            }
-            { \exp_after:wN \exp_stop_f: #2 }
-        }
-      }
-    \cs_new:Npn \@@_e_unexpanded:N #1
-      {
-        \exp_after:wN \if_meaning:w \exp_not:N #1 #1 \else:
-          \exp_after:wN \use_i:nn
-        \fi:
-        \exp_stop_f: #1
-      }
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[EXP]{\@@_e_the:Nnn, \@@_e_the:N, \@@_e_the_toks_reg:N}
-%   Finally implement \tn{the}.  Followed by anything other than an
-%   \texttt{N}-type \meta{token} this causes an error (we just let
-%   \TeX{} make one), otherwise we test the \meta{token}.  If the
-%   \meta{token} is expandable, expand it.  Otherwise it could be any
-%   kind of register, or things like \tn{numexpr}, so there is no way to
-%   deal with all cases.  Thankfully, only \tn{toks} data needs to be
-%   protected from expansion since everything else gives a string of
-%   characters.  If the \meta{token} is \tn{toks} we find a number and
-%   unpack using the |the_toks| functions.  If it is a token register we
-%   unpack it in a brace group and call \cs{@@_e_put:nn} to move it to
-%   the result.  Otherwise we unpack and continue expanding (useless but
-%   safe) since it is basically impossible to have a handle on where the
-%   result of \tn{the} ends.
-%    \begin{macrocode}
-    \cs_new:Npn \@@_e_the:Nnn #1#2
-      {
-        \tl_if_head_is_N_type:nTF {#2}
-          { \if_false: { \fi: \@@_e_the:N #2 } }
-          { \exp_args:No \@@_e:nn { \tex_the:D #2 } }
-      }
-    \cs_new:Npn \@@_e_the:N #1
-      {
-        \exp_after:wN \if_meaning:w \exp_not:N #1 #1
-          \exp_after:wN \use_i:nn
-        \else:
-          \exp_after:wN \use_ii:nn
-        \fi:
-        {
-          \if_meaning:w \tex_toks:D #1
-            \exp_after:wN \@@_e_the_toks:wnn \int_value:w
-            \exp_after:wN \@@_e_the_toks:n
-            \exp_after:wN { \int_value:w \if_false: } \fi:
-          \else:
-            \@@_e_if_toks_register:NTF #1
-              { \exp_after:wN \@@_e_the_toks_reg:N }
-              {
-                \exp_after:wN \@@_e:nn \exp_after:wN {
-                  \tex_the:D \if_false: } \fi:
-              }
-            \exp_after:wN #1
-          \fi:
-        }
-        {
-          \exp_after:wN \@@_e_the:Nnn \exp_after:wN ?
-          \exp_after:wN { \exp:w \if_false: } \fi:
-          \exp_after:wN \exp_end: #1
-        }
-      }
-    \cs_new:Npn \@@_e_the_toks_reg:N #1
-      {
-        \exp_after:wN \@@_e_put:nn \exp_after:wN {
-          \exp_after:wN {
-            \tex_the:D \if_false: } \fi: #1 }
-      }
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[EXP]{\@@_e_the_toks:wnn, \@@_e_the_toks:n, \@@_e_the_toks:N}
-%   The calling function has applied \cs{int_value:w} so we collect
-%   digits with \cs{@@_e_the_toks:n} (which gets the token list as an
-%   argument) and \cs{@@_e_the_toks:N} (which gets the first token in
-%   case it is \texttt{N}-type).  The digits are themselves collected
-%   into an \cs{int_value:w} argument to \cs{@@_e_the_toks:wnn}.  Then
-%   that function unpacks the \tn{toks}\meta{number} into the result.
-%   We include |?| because \cs{@@_e_put:nnn} removes one item from its
-%   second argument.  Note that our approach is rather crude: in cases
-%   like |\the\toks12~34| the first \cs{int_value:w} removes the space
-%   and we will incorrectly unpack the |\the\toks1234|.
-%    \begin{macrocode}
-    \cs_new:Npn \@@_e_the_toks:wnn #1; #2
-      {
-        \exp_args:No \@@_e_put:nnn
-          { \tex_the:D \tex_toks:D #1 } { ? #2 }
-      }
-    \cs_new:Npn \@@_e_the_toks:n #1
-      {
-        \tl_if_head_is_N_type:nTF {#1}
-          { \exp_after:wN \@@_e_the_toks:N \if_false: { \fi: #1 } }
-          { ; {#1} }
-      }
-    \cs_new:Npn \@@_e_the_toks:N #1
-      {
-        \if_int_compare:w 10 < 9 \token_to_str:N #1 \exp_stop_f:
-          \exp_after:wN \use_i:nn
-        \else:
-          \exp_after:wN \use_ii:nn
-        \fi:
-        {
-          #1
-          \exp_after:wN \@@_e_the_toks:n
-          \exp_after:wN { \if_false: } \fi:
-        }
-        {
-          \exp_after:wN ;
-          \exp_after:wN { \if_false: } \fi: #1
-        }
-      }
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[EXP]{\@@_e_if_toks_register:NTF}
-% \begin{macro}[EXP]
-%   {
-%     \@@_e_the_XeTeXinterchartoks:,
-%     \@@_e_the_errhelp:,
-%     \@@_e_the_everycr:,
-%     \@@_e_the_everydisplay:,
-%     \@@_e_the_everyeof:,
-%     \@@_e_the_everyhbox:,
-%     \@@_e_the_everyjob:,
-%     \@@_e_the_everymath:,
-%     \@@_e_the_everypar:,
-%     \@@_e_the_everyvbox:,
-%     \@@_e_the_output:,
-%     \@@_e_the_pdfpageattr:,
-%     \@@_e_the_pdfpageresources:,
-%     \@@_e_the_pdfpagesattr:,
-%     \@@_e_the_pdfpkmode:
-%   }
-%   We need to detect both \tn{toks} registers like \tn{toks@} in
-%   \LaTeXe{} and parameters such as \tn{everypar}, as the result of
-%   unpacking the register should not expand further.  Registers are
-%   found by \cs{token_if_toks_register:NTF} by inspecting the meaning.
-%   The list of parameters is finite so we just use a
-%   \cs{cs_if_exist:cTF} test to look up in a table.  We abuse
-%   \cs{cs_to_str:N}'s ability to remove a leading escape character
-%   whatever it is.
-%    \begin{macrocode}
-    \prg_new_conditional:Npnn \@@_e_if_toks_register:N #1 { TF }
-      {
-        \token_if_toks_register:NTF #1 { \prg_return_true: }
-          {
-            \cs_if_exist:cTF
-              {
-                @@_e_the_
-                \exp_after:wN \cs_to_str:N
-                \token_to_meaning:N #1
-                :
-              } { \prg_return_true: } { \prg_return_false: }
-          }
-      }
-    \cs_new_eq:NN \@@_e_the_XeTeXinterchartoks: ?
-    \cs_new_eq:NN \@@_e_the_errhelp: ?
-    \cs_new_eq:NN \@@_e_the_everycr: ?
-    \cs_new_eq:NN \@@_e_the_everydisplay: ?
-    \cs_new_eq:NN \@@_e_the_everyeof: ?
-    \cs_new_eq:NN \@@_e_the_everyhbox: ?
-    \cs_new_eq:NN \@@_e_the_everyjob: ?
-    \cs_new_eq:NN \@@_e_the_everymath: ?
-    \cs_new_eq:NN \@@_e_the_everypar: ?
-    \cs_new_eq:NN \@@_e_the_everyvbox: ?
-    \cs_new_eq:NN \@@_e_the_output: ?
-    \cs_new_eq:NN \@@_e_the_pdfpageattr: ?
-    \cs_new_eq:NN \@@_e_the_pdfpageresources: ?
-    \cs_new_eq:NN \@@_e_the_pdfpagesattr: ?
-    \cs_new_eq:NN \@@_e_the_pdfpkmode: ?
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% We are done emulating \texttt{e}-type argument expansion when
-% \tn{expanded} is unavailable.
-%    \begin{macrocode}
-  }
-%    \end{macrocode}
-%
-%
 % \subsection{Defining function variants}
 %
 %    \begin{macrocode}
@@ -2638,22 +2128,8 @@
       }
     \cs_new_protected:Npn \@@_generate_internal_test_aux:w
         ##1 #1 ##2 \s_@@_mark ##3 ##4 \s_@@_stop {##3}
-    \cs_if_exist:NTF \tex_expanded:D
-      {
-        \cs_new_eq:NN \@@_generate_internal_test:Nw
-          \@@_generate_internal_test_aux:w
-      }
-      {
-        \cs_new_protected:Npn \@@_generate_internal_test:Nw ##1
-          {
-            \if_meaning:w \tex_expanded:D ##1
-              \exp_after:wN \@@_generate_internal_test_aux:w
-              \exp_after:wN #1
-            \else:
-              \exp_after:wN \@@_generate_internal_test_aux:w
-            \fi:
-          }
-      }
+    \cs_new_eq:NN \@@_generate_internal_test:Nw
+      \@@_generate_internal_test_aux:w
   }
 \exp_args:No \@@_tmp:w { \token_to_str:N p }
 \cs_new_protected:Npn \@@_generate_internal_one_go:NNn #1#2#3
-- 
cgit v1.2.3

