MMCT TEAM
Server IP : 111.118.215.189  /  Your IP : 216.73.216.27
Web Server : Apache
System : Linux md-in-83.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : a1673wkz ( 2475)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /usr/share/texlive/texmf-dist/tex/latex/l3kernel/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //usr/share/texlive/texmf-dist/tex/latex/l3kernel/l3token.sty
%%
%% This is file `l3token.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% l3token.dtx  (with options: `package')
%% 
%% EXPERIMENTAL CODE
%% 
%% Do not distribute this file without also distributing the
%% source files specified above.
%% 
%% Do not distribute a modified version of this file.
%% 
%% File: l3token.dtx Copyright (C) 2005-2013 The LaTeX3 Project
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
%% license or (at your option) any later version.  The latest version
%% of this license is in the file
%%
%%    http://www.latex-project.org/lppl.txt
%%
%% This file is part of the "l3kernel bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%%
%% The released version of this bundle is available from CTAN.
%%
%% -----------------------------------------------------------------------
%%
%% The development version of the bundle can be found at
%%
%%    http://www.latex-project.org/svnroot/experimental/trunk/
%%
%% for those people who are interested.
%%
%%%%%%%%%%%
%% NOTE: %%
%%%%%%%%%%%
%%
%%   Snapshots taken from the repository represent work in progress and may
%%   not work or may contain conflicting material!  We therefore ask
%%   people _not_ to put them into distributions, archives, etc. without
%%   prior consultation with the LaTeX3 Project.
%%
%% -----------------------------------------------------------------------
\RequirePackage{l3bootstrap}
\GetIdInfo$Id: l3token.dtx 4428 2013-01-10 13:23:29Z bruno $
  {L3 Experimental token manipulation}
\ProvidesExplPackage
  {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\__expl_package_check:
\cs_new_protected:Npn \char_set_catcode:nn #1#2
  { \tex_catcode:D #1 = \__int_eval:w #2 \__int_eval_end: }
\cs_new:Npn \char_value_catcode:n #1
  { \tex_the:D \tex_catcode:D \__int_eval:w #1\__int_eval_end: }
\cs_new_protected:Npn \char_show_value_catcode:n #1
  { \tex_showthe:D \tex_catcode:D \__int_eval:w #1 \__int_eval_end: }
\cs_new_protected:Npn \char_set_catcode_escape:N #1
  { \char_set_catcode:nn { `#1 } \c_zero }
\cs_new_protected:Npn \char_set_catcode_group_begin:N #1
  { \char_set_catcode:nn { `#1 } \c_one }
\cs_new_protected:Npn \char_set_catcode_group_end:N #1
  { \char_set_catcode:nn { `#1 } \c_two }
\cs_new_protected:Npn \char_set_catcode_math_toggle:N #1
  { \char_set_catcode:nn { `#1 } \c_three }
\cs_new_protected:Npn \char_set_catcode_alignment:N #1
  { \char_set_catcode:nn { `#1 } \c_four }
\cs_new_protected:Npn \char_set_catcode_end_line:N #1
  { \char_set_catcode:nn { `#1 } \c_five }
\cs_new_protected:Npn \char_set_catcode_parameter:N #1
  { \char_set_catcode:nn { `#1 } \c_six }
\cs_new_protected:Npn \char_set_catcode_math_superscript:N #1
  { \char_set_catcode:nn { `#1 } \c_seven }
\cs_new_protected:Npn \char_set_catcode_math_subscript:N #1
  { \char_set_catcode:nn { `#1 } \c_eight }
\cs_new_protected:Npn \char_set_catcode_ignore:N #1
  { \char_set_catcode:nn { `#1 } \c_nine }
\cs_new_protected:Npn \char_set_catcode_space:N #1
  { \char_set_catcode:nn { `#1 } \c_ten }
\cs_new_protected:Npn \char_set_catcode_letter:N #1
  { \char_set_catcode:nn { `#1 } \c_eleven }
\cs_new_protected:Npn \char_set_catcode_other:N #1
  { \char_set_catcode:nn { `#1 } \c_twelve }
\cs_new_protected:Npn \char_set_catcode_active:N #1
  { \char_set_catcode:nn { `#1 } \c_thirteen }
\cs_new_protected:Npn \char_set_catcode_comment:N #1
  { \char_set_catcode:nn { `#1 } \c_fourteen }
\cs_new_protected:Npn \char_set_catcode_invalid:N #1
  { \char_set_catcode:nn { `#1 } \c_fifteen }
\cs_new_protected:Npn \char_set_catcode_escape:n #1
  { \char_set_catcode:nn {#1} \c_zero }
\cs_new_protected:Npn \char_set_catcode_group_begin:n #1
  { \char_set_catcode:nn {#1} \c_one }
\cs_new_protected:Npn \char_set_catcode_group_end:n #1
  { \char_set_catcode:nn {#1} \c_two }
\cs_new_protected:Npn \char_set_catcode_math_toggle:n #1
  { \char_set_catcode:nn {#1} \c_three }
\cs_new_protected:Npn \char_set_catcode_alignment:n #1
  { \char_set_catcode:nn {#1} \c_four }
\cs_new_protected:Npn \char_set_catcode_end_line:n #1
  { \char_set_catcode:nn {#1} \c_five }
\cs_new_protected:Npn \char_set_catcode_parameter:n #1
  { \char_set_catcode:nn {#1} \c_six }
\cs_new_protected:Npn \char_set_catcode_math_superscript:n #1
  { \char_set_catcode:nn {#1} \c_seven }
\cs_new_protected:Npn \char_set_catcode_math_subscript:n #1
  { \char_set_catcode:nn {#1} \c_eight }
\cs_new_protected:Npn \char_set_catcode_ignore:n #1
  { \char_set_catcode:nn {#1} \c_nine }
\cs_new_protected:Npn \char_set_catcode_space:n #1
  { \char_set_catcode:nn {#1} \c_ten }
\cs_new_protected:Npn \char_set_catcode_letter:n #1
  { \char_set_catcode:nn {#1} \c_eleven }
\cs_new_protected:Npn \char_set_catcode_other:n #1
  { \char_set_catcode:nn {#1} \c_twelve }
\cs_new_protected:Npn \char_set_catcode_active:n #1
  { \char_set_catcode:nn {#1} \c_thirteen }
\cs_new_protected:Npn \char_set_catcode_comment:n #1
  { \char_set_catcode:nn {#1} \c_fourteen }
\cs_new_protected:Npn \char_set_catcode_invalid:n #1
  { \char_set_catcode:nn {#1} \c_fifteen }
\cs_new_protected:Npn \char_set_mathcode:nn #1#2
  { \tex_mathcode:D #1 = \__int_eval:w #2 \__int_eval_end: }
\cs_new:Npn \char_value_mathcode:n #1
  { \tex_the:D \tex_mathcode:D \__int_eval:w #1\__int_eval_end: }
\cs_new_protected:Npn \char_show_value_mathcode:n #1
  { \tex_showthe:D \tex_mathcode:D \__int_eval:w #1 \__int_eval_end: }
\cs_new_protected:Npn \char_set_lccode:nn #1#2
  { \tex_lccode:D #1 = \__int_eval:w #2 \__int_eval_end: }
\cs_new:Npn \char_value_lccode:n #1
  { \tex_the:D \tex_lccode:D \__int_eval:w #1\__int_eval_end: }
\cs_new_protected:Npn \char_show_value_lccode:n #1
  { \tex_showthe:D \tex_lccode:D \__int_eval:w #1 \__int_eval_end: }
\cs_new_protected:Npn \char_set_uccode:nn #1#2
  { \tex_uccode:D #1 = \__int_eval:w #2 \__int_eval_end: }
\cs_new:Npn \char_value_uccode:n #1
  { \tex_the:D \tex_uccode:D \__int_eval:w #1\__int_eval_end: }
\cs_new_protected:Npn \char_show_value_uccode:n #1
  { \tex_showthe:D \tex_uccode:D \__int_eval:w #1 \__int_eval_end: }
\cs_new_protected:Npn \char_set_sfcode:nn #1#2
  { \tex_sfcode:D #1 = \__int_eval:w #2 \__int_eval_end: }
\cs_new:Npn \char_value_sfcode:n #1
  { \tex_the:D \tex_sfcode:D \__int_eval:w #1\__int_eval_end: }
\cs_new_protected:Npn \char_show_value_sfcode:n #1
  { \tex_showthe:D \tex_sfcode:D \__int_eval:w #1 \__int_eval_end: }
\cs_new_protected:Npn \token_new:Nn #1#2 { \cs_new_eq:NN #1 #2 }
\cs_new_eq:NN \c_group_begin_token {
\cs_new_eq:NN \c_group_end_token }
\group_begin:
  \char_set_catcode_math_toggle:N \*
  \token_new:Nn \c_math_toggle_token { * }
  \char_set_catcode_alignment:N \*
  \token_new:Nn \c_alignment_token { * }
  \token_new:Nn \c_parameter_token { # }
  \token_new:Nn \c_math_superscript_token { ^ }
  \char_set_catcode_math_subscript:N \*
  \token_new:Nn \c_math_subscript_token { * }
  \token_new:Nn \c_space_token { ~ }
  \token_new:Nn \c_catcode_letter_token { a }
  \token_new:Nn \c_catcode_other_token { 1 }
\group_end:
\group_begin:
  \char_set_catcode_active:N \*
  \tl_const:Nn \c_catcode_active_tl { \exp_not:N * }
\group_end:
\seq_new:N \l_char_active_seq
\use:n
  {
    \group_begin:
    \char_set_catcode_active:N \"
    \char_set_catcode_active:N \$
    \char_set_catcode_active:N \&
    \char_set_catcode_active:N \^
    \char_set_catcode_active:N \_
    \char_set_catcode_active:N \~
    \use:nn
      {
        \group_end:
        \seq_set_split:Nnn \l_char_active_seq { }
      }
  }
    { { " $ & ^ _ ~ } } %$
\seq_new:N \l_char_special_seq
\seq_set_split:Nnn \l_char_special_seq { }
  { \  \" \# \$ \% \& \\ \^ \_ \{ \} \~ }
\prg_new_conditional:Npnn \token_if_group_begin:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_group_begin_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_group_end:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_group_end_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_math_toggle:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_math_toggle_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_alignment:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_alignment_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\group_begin:
\cs_set_eq:NN \c_parameter_token \scan_stop:
\prg_new_conditional:Npnn \token_if_parameter:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_parameter_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\group_end:
\prg_new_conditional:Npnn \token_if_math_superscript:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_math_superscript_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_math_subscript:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_math_subscript_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_space:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_space_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_letter:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_catcode_letter_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_other:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_catcode_other_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_active:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_catcode_active_tl
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_eq_meaning:NN #1#2 { p , T ,  F , TF }
  {
    \if_meaning:w  #1  #2
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_eq_catcode:NN #1#2 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \exp_not:N #2
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_eq_charcode:NN #1#2 { p , T ,  F , TF }
  {
    \if_charcode:w \exp_not:N #1 \exp_not:N #2
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\group_begin:
\char_set_catcode_other:N \M
\char_set_catcode_other:N \A
\char_set_lccode:nn { `\; } { `\: }
\char_set_lccode:nn { `\T } { `\T }
\char_set_lccode:nn { `\F } { `\F }
\tl_to_lowercase:n
  {
    \group_end:
    \prg_new_conditional:Npnn \token_if_macro:N #1 { p , T ,  F , TF }
      {
        \exp_after:wN \__token_if_macro_p:w
        \token_to_meaning:N #1 MA; \q_stop
      }
    \cs_new:Npn \__token_if_macro_p:w #1 MA #2 ; #3 \q_stop
      {
        \if_int_compare:w \pdftex_strcmp:D { #2 } { cro } = \c_zero
            \prg_return_true:
        \else:
            \prg_return_false:
        \fi:
      }
  }
\prg_new_conditional:Npnn \token_if_cs:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \scan_stop:
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_expandable:N #1 { p , T ,  F , TF }
  {
    \exp_after:wN \if_meaning:w \exp_not:N #1 #1
      \prg_return_false:
    \else:
      \if_cs_exist:N #1
        \prg_return_true:
      \else:
        \prg_return_false:
      \fi:
    \fi:
  }
\group_begin:
  \char_set_lccode:nn { `T } { `T }
  \char_set_lccode:nn { `F } { `F }
  \char_set_lccode:nn { `X } { `n }
  \char_set_lccode:nn { `Y } { `t }
  \char_set_lccode:nn { `Z } { `d }
  \tl_map_inline:nn { A C E G H I K L M O P R S U X Y Z R " }
    { \char_set_catcode:nn { `#1 } \c_twelve }
\tl_to_lowercase:n
  {
    \group_end:
    \prg_new_conditional:Npnn \token_if_chardef:N #1 { p , T ,  F , TF }
      {
        \__str_if_eq_x_return:nn
          {
            \exp_after:wN \__token_if_chardef:w
              \token_to_meaning:N #1 CHAR" \q_stop
          }
          { \token_to_str:N \char }
      }
    \prg_new_conditional:Npnn \token_if_mathchardef:N #1 { p , T ,  F , TF }
      {
        \__str_if_eq_x_return:nn
          {
            \exp_after:wN \__token_if_chardef:w
              \token_to_meaning:N #1 CHAR" \q_stop
          }
          { \token_to_str:N \mathchar }
      }
    \cs_new:Npn \__token_if_chardef:w #1 CHAR" #2 \q_stop { #1 CHAR }
    \prg_new_conditional:Npnn \token_if_dim_register:N #1 { p , T ,  F , TF }
      {
        \if_meaning:w \tex_dimen:D #1
          \prg_return_false:
        \else:
          \if_meaning:w \tex_dimendef:D #1
            \prg_return_false:
          \else:
            \__str_if_eq_x_return:nn
              {
                \exp_after:wN \__token_if_dim_register:w
                  \token_to_meaning:N #1 ZIMEX \q_stop
              }
              { \token_to_str:N \  }
          \fi:
        \fi:
      }
    \cs_new:Npn \__token_if_dim_register:w #1 ZIMEX #2 \q_stop { #1 ~ }
    \prg_new_conditional:Npnn \token_if_int_register:N #1 { p , T ,  F , TF }
      {
        % \token_if_chardef:NTF #1 { \prg_return_true: }
        %   {
        %     \token_if_mathchardef:NTF #1 { \prg_return_true: }
        %       {
        \if_meaning:w \tex_count:D #1
          \prg_return_false:
        \else:
          \if_meaning:w \tex_countdef:D #1
            \prg_return_false:
          \else:
            \__str_if_eq_x_return:nn
              {
                \exp_after:wN \__token_if_int_register:w
                  \token_to_meaning:N #1 COUXY \q_stop
              }
              { \token_to_str:N \  }
          \fi:
        \fi:
        %       }
        %   }
      }
    \cs_new:Npn \__token_if_int_register:w #1 COUXY #2 \q_stop { #1 ~ }
    \prg_new_conditional:Npnn \token_if_muskip_register:N #1 { p , T ,  F , TF }
      {
        \if_meaning:w \tex_muskip:D #1
          \prg_return_false:
        \else:
          \if_meaning:w \tex_muskipdef:D #1
            \prg_return_false:
          \else:
            \__str_if_eq_x_return:nn
              {
                \exp_after:wN \__token_if_muskip_register:w
                  \token_to_meaning:N #1 MUSKIP \q_stop
              }
              { \token_to_str:N \  }
          \fi:
        \fi:
      }
    \cs_new:Npn \__token_if_muskip_register:w #1 MUSKIP #2 \q_stop { #1 ~ }
    \prg_new_conditional:Npnn \token_if_skip_register:N #1 { p , T ,  F , TF }
      {
        \if_meaning:w \tex_skip:D #1
          \prg_return_false:
        \else:
          \if_meaning:w \tex_skipdef:D #1
            \prg_return_false:
          \else:
            \__str_if_eq_x_return:nn
              {
                \exp_after:wN \__token_if_skip_register:w
                  \token_to_meaning:N #1 SKIP \q_stop
              }
              { \token_to_str:N \  }
          \fi:
        \fi:
      }
    \cs_new:Npn \__token_if_skip_register:w #1 SKIP #2 \q_stop { #1 ~ }
    \prg_new_conditional:Npnn \token_if_toks_register:N #1 { p , T ,  F , TF }
      {
        \if_meaning:w \tex_toks:D #1
          \prg_return_false:
        \else:
          \if_meaning:w \tex_toksdef:D #1
            \prg_return_false:
          \else:
            \__str_if_eq_x_return:nn
              {
                \exp_after:wN \__token_if_toks_register:w
                  \token_to_meaning:N #1 YOKS \q_stop
              }
              { \token_to_str:N \  }
          \fi:
        \fi:
      }
     \cs_new:Npn \__token_if_toks_register:w #1 YOKS #2 \q_stop { #1 ~ }
    \prg_new_conditional:Npnn \token_if_protected_macro:N #1
      { p , T ,  F , TF }
      {
        \__str_if_eq_x_return:nn
          {
            \exp_after:wN \__token_if_protected_macro:w
              \token_to_meaning:N #1 PROYECYEZ~MACRO \q_stop
          }
          { \token_to_str:N \  }
      }
    \cs_new:Npn \__token_if_protected_macro:w
      #1 PROYECYEZ~MACRO #2 \q_stop { #1 ~ }
    \prg_new_conditional:Npnn \token_if_long_macro:N #1 { p , T ,  F , TF }
      {
        \__str_if_eq_x_return:nn
          {
            \exp_after:wN \__token_if_long_macro:w
              \token_to_meaning:N #1 LOXG~MACRO \q_stop
          }
          { \token_to_str:N \  }
      }
    \prg_new_conditional:Npnn \token_if_protected_long_macro:N #1
      { p , T ,  F , TF }
      {
        \__str_if_eq_x_return:nn
          {
            \exp_after:wN \__token_if_long_macro:w
              \token_to_meaning:N #1 LOXG~MACRO \q_stop
          }
          { \token_to_str:N \protected \token_to_str:N \  }
      }
    \cs_new:Npn \__token_if_long_macro:w #1 LOXG~MACRO #2 \q_stop { #1 ~ }
  }
\tex_chardef:D \c_token_A_int = `A ~ %
\group_begin:
\char_set_catcode_other:N \;
\char_set_lccode:nn { `\; } { `\: }
\char_set_lccode:nn { `\T } { `\T }
\char_set_lccode:nn { `\F } { `\F }
\tl_to_lowercase:n {
  \group_end:
  \prg_new_conditional:Npnn \token_if_primitive:N #1 { p , T , F , TF }
    {
      \token_if_macro:NTF #1
        \prg_return_false:
        {
          \exp_after:wN \__token_if_primitive:NNw
          \token_to_meaning:N #1 ; ; ; \q_stop #1
        }
    }
  \cs_new:Npn \__token_if_primitive:NNw #1#2 #3 ; #4 \q_stop
    {
      \tl_if_empty:oTF { \__token_if_primitive_space:w #3 ~ }
        { \__token_if_primitive_loop:N #3 ; \q_stop }
        { \__token_if_primitive_nullfont:N }
    }
}
\cs_new:Npn \__token_if_primitive_space:w #1 ~ { }
\cs_new:Npn \__token_if_primitive_nullfont:N #1
  {
    \if_meaning:w \tex_nullfont:D #1
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \__token_if_primitive_loop:N #1
  {
    \if_int_compare:w `#1 < \c_token_A_int %
      \exp_after:wN \__token_if_primitive:Nw
      \exp_after:wN #1
    \else:
      \exp_after:wN \__token_if_primitive_loop:N
    \fi:
  }
\cs_new:Npn \__token_if_primitive:Nw #1 #2 \q_stop
  {
    \if:w : #1
      \exp_after:wN \__token_if_primitive_undefined:N
    \else:
      \prg_return_false:
      \exp_after:wN \use_none:n
    \fi:
  }
\cs_new:Npn \__token_if_primitive_undefined:N #1
  {
    \if_cs_exist:N #1
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new_eq:NN \l_peek_token ?
\cs_new_eq:NN \g_peek_token ?
\cs_new_eq:NN \l__peek_search_token ?
\tl_new:N \l__peek_search_tl
\cs_new_nopar:Npn \__peek_true:w  { }
\cs_new_nopar:Npn \__peek_true_aux:w  { }
\cs_new_nopar:Npn \__peek_false:w { }
\cs_new:Npn \__peek_tmp:w { }
\cs_new_protected_nopar:Npn \peek_after:Nw
  { \tex_futurelet:D \l_peek_token }
\cs_new_protected_nopar:Npn \peek_gafter:Nw
  { \tex_global:D \tex_futurelet:D \g_peek_token }
\cs_new_protected:Npn \__peek_true_remove:w
  {
    \group_align_safe_end:
    \tex_afterassignment:D \__peek_true_aux:w
    \cs_set_eq:NN \__peek_tmp:w
  }
\cs_new_protected:Npn \__peek_token_generic:NNTF #1#2#3#4
  {
    \cs_set_eq:NN \l__peek_search_token #2
    \tl_set:Nn \l__peek_search_tl {#2}
    \cs_set_nopar:Npx \__peek_true:w
      {
        \exp_not:N \group_align_safe_end:
        \exp_not:n {#3}
      }
    \cs_set_nopar:Npx \__peek_false:w
      {
        \exp_not:N \group_align_safe_end:
        \exp_not:n {#4}
      }
    \group_align_safe_begin:
      \peek_after:Nw #1
  }
\cs_new_protected:Npn \__peek_token_generic:NNT #1#2#3
  { \__peek_token_generic:NNTF #1 #2 {#3} { } }
\cs_new_protected:Npn \__peek_token_generic:NNF #1#2#3
  { \__peek_token_generic:NNTF #1 #2 { } {#3} }
\cs_new_protected:Npn \__peek_token_remove_generic:NNTF #1#2#3#4
  {
    \cs_set_eq:NN \l__peek_search_token #2
    \tl_set:Nn \l__peek_search_tl {#2}
    \cs_set_eq:NN \__peek_true:w \__peek_true_remove:w
    \cs_set_nopar:Npx \__peek_true_aux:w { \exp_not:n {#3} }
    \cs_set_nopar:Npx \__peek_false:w
      {
        \exp_not:N \group_align_safe_end:
        \exp_not:n {#4}
      }
    \group_align_safe_begin:
      \peek_after:Nw #1
  }
\cs_new_protected:Npn \__peek_token_remove_generic:NNT #1#2#3
  { \__peek_token_remove_generic:NNTF #1 #2 {#3} { } }
\cs_new_protected:Npn \__peek_token_remove_generic:NNF #1#2#3
  { \__peek_token_remove_generic:NNTF #1 #2 { } {#3} }
\cs_new_nopar:Npn \__peek_execute_branches_meaning:
  {
    \if_meaning:w \l_peek_token \l__peek_search_token
      \exp_after:wN \__peek_true:w
    \else:
      \exp_after:wN \__peek_false:w
    \fi:
  }
\cs_new_nopar:Npn \__peek_execute_branches_catcode:
  { \if_catcode:w \__peek_execute_branches_catcode_aux: }
\cs_new_nopar:Npn \__peek_execute_branches_charcode:
  { \if_charcode:w \__peek_execute_branches_catcode_aux: }
\cs_new_nopar:Npn \__peek_execute_branches_catcode_aux:
  {
        \if_catcode:w \exp_not:N \l_peek_token \scan_stop:
          \exp_after:wN \exp_after:wN
          \exp_after:wN \__peek_execute_branches_catcode_auxii:N
          \exp_after:wN \exp_not:N
        \else:
          \exp_after:wN \__peek_execute_branches_catcode_auxiii:
        \fi:
  }
\cs_new:Npn \__peek_execute_branches_catcode_auxii:N #1
  {
        \exp_not:N #1
        \exp_after:wN \exp_not:N \l__peek_search_tl
      \exp_after:wN \__peek_true:w
    \else:
      \exp_after:wN \__peek_false:w
    \fi:
    #1
  }
\cs_new_nopar:Npn \__peek_execute_branches_catcode_auxiii:
  {
        \exp_not:N \l_peek_token
        \exp_after:wN \exp_not:N \l__peek_search_tl
      \exp_after:wN \__peek_true:w
    \else:
      \exp_after:wN \__peek_false:w
    \fi:
  }
\cs_new_protected_nopar:Npn \__peek_ignore_spaces_execute_branches:
  {
    \if_meaning:w \l_peek_token \c_space_token
      \exp_after:wN \peek_after:Nw
      \exp_after:wN \__peek_ignore_spaces_execute_branches:
      \tex_romannumeral:D -`0
    \else:
      \exp_after:wN \__peek_execute_branches:
    \fi:
  }
\group_begin:
  \cs_set:Npn \__peek_def:nnnn #1#2#3#4
    {
      \__peek_def:nnnnn {#1} {#2} {#3} {#4} { TF }
      \__peek_def:nnnnn {#1} {#2} {#3} {#4} { T }
      \__peek_def:nnnnn {#1} {#2} {#3} {#4} { F }
    }
  \cs_set:Npn \__peek_def:nnnnn #1#2#3#4#5
    {
      \cs_new_protected_nopar:cpx { #1 #5 }
        {
          \tl_if_empty:nF {#2}
            { \exp_not:n { \cs_set_eq:NN \__peek_execute_branches: #2 } }
          \exp_not:c { #3 #5 }
          \exp_not:n {#4}
        }
    }
  \__peek_def:nnnn { peek_catcode:N }
    { }
    { __peek_token_generic:NN }
    { \__peek_execute_branches_catcode: }
  \__peek_def:nnnn { peek_catcode_ignore_spaces:N }
    { \__peek_execute_branches_catcode: }
    { __peek_token_generic:NN }
    { \__peek_ignore_spaces_execute_branches: }
  \__peek_def:nnnn { peek_catcode_remove:N }
    { }
    { __peek_token_remove_generic:NN }
    { \__peek_execute_branches_catcode: }
  \__peek_def:nnnn { peek_catcode_remove_ignore_spaces:N }
    { \__peek_execute_branches_catcode: }
    { __peek_token_remove_generic:NN }
    { \__peek_ignore_spaces_execute_branches: }
  \__peek_def:nnnn { peek_charcode:N }
    { }
    { __peek_token_generic:NN }
    { \__peek_execute_branches_charcode: }
  \__peek_def:nnnn { peek_charcode_ignore_spaces:N }
    { \__peek_execute_branches_charcode: }
    { __peek_token_generic:NN }
    { \__peek_ignore_spaces_execute_branches: }
  \__peek_def:nnnn { peek_charcode_remove:N }
    { }
    { __peek_token_remove_generic:NN }
    { \__peek_execute_branches_charcode: }
  \__peek_def:nnnn { peek_charcode_remove_ignore_spaces:N }
    { \__peek_execute_branches_charcode: }
    { __peek_token_remove_generic:NN }
    { \__peek_ignore_spaces_execute_branches: }
  \__peek_def:nnnn { peek_meaning:N }
    { }
    { __peek_token_generic:NN }
    { \__peek_execute_branches_meaning: }
  \__peek_def:nnnn { peek_meaning_ignore_spaces:N }
    { \__peek_execute_branches_meaning: }
    { __peek_token_generic:NN }
    { \__peek_ignore_spaces_execute_branches: }
  \__peek_def:nnnn { peek_meaning_remove:N }
    { }
    { __peek_token_remove_generic:NN }
    { \__peek_execute_branches_meaning: }
  \__peek_def:nnnn { peek_meaning_remove_ignore_spaces:N }
    { \__peek_execute_branches_meaning: }
    { __peek_token_remove_generic:NN }
    { \__peek_ignore_spaces_execute_branches: }
\group_end:
\exp_args:Nno \use:nn
  { \cs_new:Npn \__peek_get_prefix_arg_replacement:wN #1 }
  { \tl_to_str:n { macro : } #2 -> #3 \q_stop #4 }
  { #4 {#1} {#2} {#3} }
\cs_new:Npn \token_get_prefix_spec:N #1
  {
    \token_if_macro:NTF #1
      {
        \exp_after:wN \__peek_get_prefix_arg_replacement:wN
          \token_to_meaning:N #1 \q_stop \use_i:nnn
      }
      { \scan_stop: }
  }
\cs_new:Npn \token_get_arg_spec:N #1
  {
    \token_if_macro:NTF #1
      {
        \exp_after:wN \__peek_get_prefix_arg_replacement:wN
          \token_to_meaning:N #1 \q_stop \use_ii:nnn
      }
      { \scan_stop: }
  }
\cs_new:Npn \token_get_replacement_spec:N #1
  {
    \token_if_macro:NTF #1
      {
        \exp_after:wN \__peek_get_prefix_arg_replacement:wN
          \token_to_meaning:N #1 \q_stop \use_iii:nnn
      }
      { \scan_stop: }
  }
%% 
%%
%% End of file `l3token.sty'.

MMCT - 2023