summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3kernel/l3token.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel/l3token.sty')
-rw-r--r--Master/texmf-dist/tex/latex/l3kernel/l3token.sty739
1 files changed, 739 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3token.sty b/Master/texmf-dist/tex/latex/l3kernel/l3token.sty
new file mode 100644
index 00000000000..c4ca0549b2f
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/l3kernel/l3token.sty
@@ -0,0 +1,739 @@
+%%
+%% 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-2011 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 "expl3 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{l3names}
+\GetIdInfo$Id: l3token.dtx 2491 2011-07-02 11:49:37Z joseph $
+ {L3 Experimental token manipulation}
+%% \begin{function}[EXP,pTF]{\token_if_protected_long_macro:N}
+\ProvidesExplPackage
+ {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
+\package_check_loaded_expl:
+\cs_new_protected_nopar:Npn \char_set_catcode:nn #1#2
+ { \tex_catcode:D #1 = \int_eval:w #2 \int_eval_end: }
+\cs_new_nopar:Npn \char_value_catcode:n #1
+ { \tex_the:D \tex_catcode:D \int_eval:w #1\int_eval_end: }
+\cs_new_nopar:Npn \char_show_value_catcode:n #1
+ { \tex_showthe:D \tex_catcode:D \int_eval:w #1 \int_eval_end: }
+\cs_new_protected_nopar:Npn \char_set_catcode_escape:N #1
+ { \char_set_catcode:nn { `#1 } \c_zero }
+\cs_new_protected_nopar:Npn \char_set_catcode_group_begin:N #1
+ { \char_set_catcode:nn { `#1 } \c_one }
+\cs_new_protected_nopar:Npn \char_set_catcode_group_end:N #1
+ { \char_set_catcode:nn { `#1 } \c_two }
+\cs_new_protected_nopar:Npn \char_set_catcode_math_toggle:N #1
+ { \char_set_catcode:nn { `#1 } \c_three }
+\cs_new_protected_nopar:Npn \char_set_catcode_alignment:N #1
+ { \char_set_catcode:nn { `#1 } \c_four }
+\cs_new_protected_nopar:Npn \char_set_catcode_end_line:N #1
+ { \char_set_catcode:nn { `#1 } \c_five }
+\cs_new_protected_nopar:Npn \char_set_catcode_parameter:N #1
+ { \char_set_catcode:nn { `#1 } \c_six }
+\cs_new_protected_nopar:Npn \char_set_catcode_math_superscript:N #1
+ { \char_set_catcode:nn { `#1 } \c_seven }
+\cs_new_protected_nopar:Npn \char_set_catcode_math_subscript:N #1
+ { \char_set_catcode:nn { `#1 } \c_eight }
+\cs_new_protected_nopar:Npn \char_set_catcode_ignore:N #1
+ { \char_set_catcode:nn { `#1 } \c_nine }
+\cs_new_protected_nopar:Npn \char_set_catcode_space:N #1
+ { \char_set_catcode:nn { `#1 } \c_ten }
+\cs_new_protected_nopar:Npn \char_set_catcode_letter:N #1
+ { \char_set_catcode:nn { `#1 } \c_eleven }
+\cs_new_protected_nopar:Npn \char_set_catcode_other:N #1
+ { \char_set_catcode:nn { `#1 } \c_twelve }
+\cs_new_protected_nopar:Npn \char_set_catcode_active:N #1
+ { \char_set_catcode:nn { `#1 } \c_thirteen }
+\cs_new_protected_nopar:Npn \char_set_catcode_comment:N #1
+ { \char_set_catcode:nn { `#1 } \c_fourteen }
+\cs_new_protected_nopar:Npn \char_set_catcode_invalid:N #1
+ { \char_set_catcode:nn { `#1 } \c_fifteen }
+\cs_new_protected_nopar:Npn \char_set_catcode_escape:n #1
+ { \char_set_catcode:nn {#1} \c_zero }
+\cs_new_protected_nopar:Npn \char_set_catcode_group_begin:n #1
+ { \char_set_catcode:nn {#1} \c_one }
+\cs_new_protected_nopar:Npn \char_set_catcode_group_end:n #1
+ { \char_set_catcode:nn {#1} \c_two }
+\cs_new_protected_nopar:Npn \char_set_catcode_math_toggle:n #1
+ { \char_set_catcode:nn {#1} \c_three }
+\cs_new_protected_nopar:Npn \char_set_catcode_alignment:n #1
+ { \char_set_catcode:nn {#1} \c_four }
+\cs_new_protected_nopar:Npn \char_set_catcode_end_line:n #1
+ { \char_set_catcode:nn {#1} \c_five }
+\cs_new_protected_nopar:Npn \char_set_catcode_parameter:n #1
+ { \char_set_catcode:nn {#1} \c_six }
+\cs_new_protected_nopar:Npn \char_set_catcode_math_superscript:n #1
+ { \char_set_catcode:nn {#1} \c_seven }
+\cs_new_protected_nopar:Npn \char_set_catcode_math_subscript:n #1
+ { \char_set_catcode:nn {#1} \c_eight }
+\cs_new_protected_nopar:Npn \char_set_catcode_ignore:n #1
+ { \char_set_catcode:nn {#1} \c_nine }
+\cs_new_protected_nopar:Npn \char_set_catcode_space:n #1
+ { \char_set_catcode:nn {#1} \c_ten }
+\cs_new_protected_nopar:Npn \char_set_catcode_letter:n #1
+ { \char_set_catcode:nn {#1} \c_eleven }
+\cs_new_protected_nopar:Npn \char_set_catcode_other:n #1
+ { \char_set_catcode:nn {#1} \c_twelve }
+\cs_new_protected_nopar:Npn \char_set_catcode_active:n #1
+ { \char_set_catcode:nn {#1} \c_thirteen }
+\cs_new_protected_nopar:Npn \char_set_catcode_comment:n #1
+ { \char_set_catcode:nn {#1} \c_fourteen }
+\cs_new_protected_nopar:Npn \char_set_catcode_invalid:n #1
+ { \char_set_catcode:nn {#1} \c_fifteen }
+\cs_new_protected_nopar:Npn \char_set_mathcode:nn #1#2
+ { \tex_mathcode:D #1 = \int_eval:w #2 \int_eval_end: }
+\cs_new_nopar:Npn \char_value_mathcode:n #1
+ { \tex_the:D \tex_mathcode:D \int_eval:w #1\int_eval_end: }
+\cs_new_nopar:Npn \char_show_value_mathcode:n #1
+ { \tex_showthe:D \tex_mathcode:D \int_eval:w #1 \int_eval_end: }
+\cs_new_protected_nopar:Npn \char_set_lccode:nn #1#2
+ { \tex_lccode:D #1 = \int_eval:w #2 \int_eval_end: }
+\cs_new_nopar:Npn \char_value_lccode:n #1
+ { \tex_the:D \tex_lccode:D \int_eval:w #1\int_eval_end: }
+\cs_new_nopar:Npn \char_show_value_lccode:n #1
+ { \tex_showthe:D \tex_lccode:D \int_eval:w #1 \int_eval_end: }
+\cs_new_protected_nopar:Npn \char_set_uccode:nn #1#2
+ { \tex_uccode:D #1 = \int_eval:w #2 \int_eval_end: }
+\cs_new_nopar:Npn \char_value_uccode:n #1
+ { \tex_the:D \tex_uccode:D \int_eval:w #1\int_eval_end: }
+\cs_new_nopar:Npn \char_show_value_uccode:n #1
+ { \tex_showthe:D \tex_uccode:D \int_eval:w #1 \int_eval_end: }
+\cs_new_protected_nopar:Npn \char_set_sfcode:nn #1#2
+ { \tex_sfcode:D #1 = \int_eval:w #2 \int_eval_end: }
+\cs_new_nopar:Npn \char_value_sfcode:n #1
+ { \tex_the:D \tex_sfcode:D \int_eval:w #1\int_eval_end: }
+\cs_new_nopar:Npn \char_show_value_sfcode:n #1
+ { \tex_showthe:D \tex_sfcode:D \int_eval:w #1 \int_eval_end: }
+\cs_new_protected_nopar: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 \*
+ \cs_new_nopar:Npn \c_catcode_active_tl { \exp_not:N * }
+\group_end:
+\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_aux:w
+ \token_to_meaning:N #1 MA; \q_stop
+ }
+ \cs_new_nopar:Npn \token_if_macro_p_aux: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 }
+ {
+ \cs_if_exist:NTF #1
+ {
+ \exp_after:wN \if_meaning:w \exp_not:N #1 #1
+ \prg_return_false: \else: \prg_return_true: \fi:
+ }
+ { \prg_return_false: }
+ }
+\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 }
+ \char_set_lccode:nn { `\? } { `\\ }
+ \tl_map_inline:nn { \X \Y \Z \M \C \H \A \R \O \U \S \K \I \P \L \G \P \E }
+ { \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 }
+ {
+ \exp_after:wN \token_if_chardef_aux:w
+ \token_to_meaning:N #1 ?CHAR" \q_stop
+ }
+ \cs_new_nopar:Npn \token_if_chardef_aux:w #1 ?CHAR" #2 \q_stop
+ { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } }
+ \prg_new_conditional:Npnn \token_if_mathchardef:N #1 { p , T , F , TF }
+ {
+ \exp_after:wN \token_if_mathchardef_aux:w
+ \token_to_meaning:N #1 ?MAYHCHAR" \q_stop
+ }
+ \cs_new_nopar:Npn \token_if_mathchardef_aux:w #1 ?MAYHCHAR" #2 \q_stop
+ { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } }
+ \prg_new_conditional:Npnn \token_if_int_register:N #1 { p , T , F , TF }
+ {
+ \if_meaning:w \tex_countdef:D #1
+ \prg_return_false:
+ \else:
+ \exp_after:wN \token_if_int_register_aux:w
+ \token_to_meaning:N #1 ?COUXY \q_stop
+ \fi:
+ }
+ \cs_new_nopar:Npn \token_if_int_register_aux:w #1 ?COUXY #2 \q_stop
+ { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } }
+ \prg_new_conditional:Npnn \token_if_skip_register:N #1 { p , T , F , TF }
+ {
+ \if_meaning:w \tex_skipdef:D #1
+ \prg_return_false:
+ \else:
+ \exp_after:wN \token_if_skip_register_aux:w
+ \token_to_meaning:N #1?SKIP\q_stop
+ \fi:
+ }
+ \cs_new_nopar:Npn \token_if_skip_register_aux:w #1 ?SKIP #2 \q_stop
+ { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } }
+ \prg_new_conditional:Npnn \token_if_dim_register:N #1 { p , T , F , TF }
+ {
+ \if_meaning:w \tex_dimendef:D #1
+ \c_false_bool
+ \else:
+ \exp_after:wN \token_if_dim_register_aux:w
+ \token_to_meaning:N #1 ?ZIMEX \q_stop
+ \fi:
+ }
+ \cs_new_nopar:Npn \token_if_dim_register_aux:w #1 ?ZIMEX #2 \q_stop
+ { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } }
+ \prg_new_conditional:Npnn \token_if_toks_register:N #1 { p , T , F , TF }
+ {
+ \if_meaning:w \tex_toksdef:D #1
+ \prg_return_false:
+ \else:
+ \exp_after:wN \token_if_toks_register_aux:w
+ \token_to_meaning:N #1 ?YOKS \q_stop
+ \fi:
+ }
+ \cs_new_nopar:Npn \token_if_toks_register_aux:w #1 ?YOKS #2 \q_stop
+ { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } }
+ \prg_new_conditional:Npnn \token_if_protected_macro:N #1
+ { p , T , F , TF }
+ {
+ \exp_after:wN \token_if_protected_macro_aux:w
+ \token_to_meaning:N #1 ?PROYECYEZ~MACRO \q_stop
+ }
+ \cs_new_nopar:Npn \token_if_protected_macro_aux:w
+ #1 ?PROYECYEZ~MACRO #2 \q_stop
+ { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } }
+ \prg_new_conditional:Npnn \token_if_long_macro:N #1 { p , T , F , TF }
+ {
+ \exp_after:wN \token_if_long_macro_aux:w
+ \token_to_meaning:N #1 ?LOXG~MACRO \q_stop
+ }
+ \cs_new_nopar:Npn \token_if_long_macro_aux:w #1 ?LOXG~MACRO #2 \q_stop
+ { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } }
+ \prg_new_conditional:Npnn \token_if_protected_long_macro:N #1
+ { p , T , F , TF }
+ {
+ \exp_after:wN \token_if_protected_long_macro_aux:w
+ \token_to_meaning:N #1 ?PROYECYEZ?LOXG~MACRO \q_stop
+ }
+ \cs_new_nopar:Npn \token_if_protected_long_macro_aux:w
+ #1 ?PROYECYEZ?LOXG~MACRO #2 \q_stop
+ { \tl_if_empty:nTF {#1} { \prg_return_true: } { \prg_return_false: } }
+ }
+\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_aux:NNw
+ \token_to_meaning:N #1 ; ; ; \q_stop #1
+ }
+ }
+ \cs_new_nopar:Npn \token_if_primitive_aux:NNw #1#2 #3 ; #4 \q_stop
+ {
+ \tl_if_empty:oTF { \token_if_primitive_aux_space:w #3 ~ }
+ { \token_if_primitive_aux_loop:N #3 ; \q_stop }
+ { \token_if_primitive_aux_nullfont:N }
+ }
+}
+\cs_new_nopar:Npn \token_if_primitive_aux_space:w #1 ~ { }
+\cs_new:Npn \token_if_primitive_aux_nullfont:N #1
+ {
+ \if_meaning:w \tex_nullfont:D #1
+ \prg_return_true:
+ \else:
+ \prg_return_false:
+ \fi:
+ }
+\cs_new_nopar:Npn \token_if_primitive_aux_loop:N #1
+ {
+ \if_num:w `#1 < \c_token_A_int %
+ \exp_after:wN \token_if_primitive_auxii:Nw
+ \exp_after:wN #1
+ \else:
+ \exp_after:wN \token_if_primitive_aux_loop:N
+ \fi:
+ }
+\cs_new_nopar:Npn \token_if_primitive_auxii:Nw #1 #2 \q_stop
+ {
+ \if:w : #1
+ \exp_after:wN \token_if_primitive_aux_undefined:N
+ \else:
+ \prg_return_false:
+ \exp_after:wN \use_none:n
+ \fi:
+ }
+\cs_new:Npn \token_if_primitive_aux_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 ?
+\cs_new_nopar:Npn \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
+ { \pref_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_catcode:
+ {
+ \if_catcode:w
+ \exp_not:N \l_peek_token \exp_not:N \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_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_charcode:
+ {
+ \bool_if:nTF
+ {
+ \token_if_eq_catcode_p:NN \l_peek_token \c_group_begin_token
+ || \token_if_eq_catcode_p:NN \l_peek_token \c_group_end_token
+ || \token_if_eq_meaning_p:NN \l_peek_token \c_space_token
+ }
+ { \peek_false:w }
+ {
+ \exp_after:wN \peek_execute_branches_charcode_aux:NN
+ \l_peek_search_tl
+ }
+ }
+\cs_new:Npn \peek_execute_branches_charcode_aux:NN #1#2
+ {
+ \if:w \exp_not:N #1 \exp_not:N #2
+ \exp_after:wN \peek_true:w
+ \else:
+ \exp_after:wN \peek_false:w
+ \fi:
+ #2
+ }
+\cs_new_protected_nopar:Npn \peek_ignore_spaces_execute_branches:
+ {
+ \token_if_eq_meaning:NNTF \l_peek_token \c_space_token
+ {
+ \tex_afterassignment:D \peek_ignore_spaces_execute_branches_aux:
+ \cs_set_eq:NN \peek_tmp:w
+ }
+ { \peek_execute_branches: }
+ }
+\cs_new_protected_nopar:Npn \peek_ignore_spaces_execute_branches_aux:
+ { \peek_after:Nw \peek_ignore_spaces_execute_branches: }
+\group_begin:
+ \cs_set_nopar:Npn \peek_def:nnnn #1#2#3#4
+ {
+ \peek_def_aux:nnnnn {#1} {#2} {#3} {#4} { TF }
+ \peek_def_aux:nnnnn {#1} {#2} {#3} {#4} { T }
+ \peek_def_aux:nnnnn {#1} {#2} {#3} {#4} { F }
+ }
+ \cs_set_nopar:Npn \peek_def_aux:nnnnn #1#2#3#4#5
+ {
+ \cs_gset_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_nopar:Npn \token_get_prefix_arg_replacement_aux: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 \token_get_prefix_arg_replacement_aux: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 \token_get_prefix_arg_replacement_aux: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 \token_get_prefix_arg_replacement_aux:wN
+ \token_to_meaning:N #1 \q_stop \use_iii:nnn
+ }
+ { \scan_stop: }
+ }
+\group_begin:
+ \char_set_catcode_active:N \^^@
+ \cs_set:Npn \char_tmp:NN #1#2
+ {
+ \cs_new:Npn #1 ##1
+ {
+ \char_set_catcode_active:n { `##1 }
+ \group_begin:
+ \char_set_lccode:nn { `\^^@ } { `##1 }
+ \tl_to_lowercase:n { \group_end: #2 ^^@ }
+ }
+ }
+ \char_tmp:NN \char_active_set:Npn \cs_set:Npn
+ \char_tmp:NN \char_active_set:Npx \cs_set:Npx
+ \char_tmp:NN \char_active_gset:Npn \cs_gset:Npn
+ \char_tmp:NN \char_active_gset:Npx \cs_gset:Npx
+ \char_tmp:NN \char_active_set_eq:NN \cs_set_eq:NN
+ \char_tmp:NN \char_active_gset_eq:NN \cs_gset_eq:NN
+\group_end:
+\cs_new_eq:NN \char_set_catcode:w \tex_catcode:D
+\cs_new_eq:NN \char_set_mathcode:w \tex_mathcode:D
+\cs_new_eq:NN \char_set_lccode:w \tex_lccode:D
+\cs_new_eq:NN \char_set_uccode:w \tex_uccode:D
+\cs_new_eq:NN \char_set_sfcode:w \tex_sfcode:D
+\cs_new_nopar:Npn \char_value_catcode:w { \tex_the:D \char_set_catcode:w }
+\cs_new_nopar:Npn \char_show_value_catcode:w
+ { \tex_showthe:D \char_set_catcode:w }
+\cs_new_nopar:Npn \char_value_mathcode:w { \tex_the:D \char_set_mathcode:w }
+\cs_new_nopar:Npn \char_show_value_mathcode:w
+ { \tex_showthe:D \char_set_mathcode:w }
+\cs_new_nopar:Npn \char_value_lccode:w { \tex_the:D \char_set_lccode:w }
+\cs_new_nopar:Npn \char_show_value_lccode:w
+ { \tex_showthe:D \char_set_lccode:w }
+\cs_new_nopar:Npn \char_value_uccode:w { \tex_the:D \char_set_uccode:w }
+\cs_new_nopar:Npn \char_show_value_uccode:w
+ { \tex_showthe:D \char_set_uccode:w }
+\cs_new_nopar:Npn \char_value_sfcode:w { \tex_the:D \char_set_sfcode:w }
+\cs_new_nopar:Npn \char_show_value_sfcode:w
+ { \tex_showthe:D \char_set_sfcode:w }
+\cs_new_eq:NN \peek_after:NN \peek_after:Nw
+\cs_new_eq:NN \peek_gafter:NN \peek_gafter:Nw
+\cs_new_eq:NN \c_alignment_tab_token \c_alignment_token
+\cs_new_eq:NN \c_math_shift_token \c_math_toggle_token
+\cs_new_eq:NN \c_letter_token \c_catcode_letter_token
+\cs_new_eq:NN \c_other_char_token \c_catcode_other_token
+\cs_new_eq:NN \c_active_char_token \c_catcode_active_tl
+\cs_new_eq:NN \char_make_escape:N \char_set_catcode_escape:N
+\cs_new_eq:NN \char_make_begin_group:N \char_set_catcode_group_begin:N
+\cs_new_eq:NN \char_make_end_group:N \char_set_catcode_group_end:N
+\cs_new_eq:NN \char_make_math_shift:N \char_set_catcode_math_toggle:N
+\cs_new_eq:NN \char_make_alignment_tab:N \char_set_catcode_alignment:N
+\cs_new_eq:NN \char_make_end_line:N \char_set_catcode_end_line:N
+\cs_new_eq:NN \char_make_parameter:N \char_set_catcode_parameter:N
+\cs_new_eq:NN \char_make_math_superscript:N
+ \char_set_catcode_math_superscript:N
+\cs_new_eq:NN \char_make_math_subscript:N
+ \char_set_catcode_math_subscript:N
+\cs_new_eq:NN \char_make_ignore:N \char_set_catcode_ignore:N
+\cs_new_eq:NN \char_make_space:N \char_set_catcode_space:N
+\cs_new_eq:NN \char_make_letter:N \char_set_catcode_letter:N
+\cs_new_eq:NN \char_make_other:N \char_set_catcode_other:N
+\cs_new_eq:NN \char_make_active:N \char_set_catcode_active:N
+\cs_new_eq:NN \char_make_comment:N \char_set_catcode_comment:N
+\cs_new_eq:NN \char_make_invalid:N \char_set_catcode_invalid:N
+\cs_new_eq:NN \char_make_escape:n \char_set_catcode_escape:n
+\cs_new_eq:NN \char_make_begin_group:n \char_set_catcode_group_begin:n
+\cs_new_eq:NN \char_make_end_group:n \char_set_catcode_group_end:n
+\cs_new_eq:NN \char_make_math_shift:n \char_set_catcode_math_toggle:n
+\cs_new_eq:NN \char_make_alignment_tab:n \char_set_catcode_alignment:n
+\cs_new_eq:NN \char_make_end_line:n \char_set_catcode_end_line:n
+\cs_new_eq:NN \char_make_parameter:n \char_set_catcode_parameter:n
+\cs_new_eq:NN \char_make_math_superscript:n
+ \char_set_catcode_math_superscript:n
+\cs_new_eq:NN \char_make_math_subscript:n
+ \char_set_catcode_math_subscript:n
+\cs_new_eq:NN \char_make_ignore:n \char_set_catcode_ignore:n
+\cs_new_eq:NN \char_make_space:n \char_set_catcode_space:n
+\cs_new_eq:NN \char_make_letter:n \char_set_catcode_letter:n
+\cs_new_eq:NN \char_make_other:n \char_set_catcode_other:n
+\cs_new_eq:NN \char_make_active:n \char_set_catcode_active:n
+\cs_new_eq:NN \char_make_comment:n \char_set_catcode_comment:n
+\cs_new_eq:NN \char_make_invalid:n \char_set_catcode_invalid:n
+\cs_new_eq:NN \token_if_alignment_tab_p:N \token_if_alignment_p:N
+\cs_new_eq:NN \token_if_alignment_tab:NT \token_if_alignment:NT
+\cs_new_eq:NN \token_if_alignment_tab:NF \token_if_alignment:NF
+\cs_new_eq:NN \token_if_alignment_tab:NTF \token_if_alignment:NTF
+\cs_new_eq:NN \token_if_math_shift_p:N \token_if_math_toggle_p:N
+\cs_new_eq:NN \token_if_math_shift:NT \token_if_math_toggle:NT
+\cs_new_eq:NN \token_if_math_shift:NF \token_if_math_toggle:NF
+\cs_new_eq:NN \token_if_math_shift:NTF \token_if_math_toggle:NTF
+\cs_new_eq:NN \token_if_other_char_p:N \token_if_other_p:N
+\cs_new_eq:NN \token_if_other_char:NT \token_if_other:NT
+\cs_new_eq:NN \token_if_other_char:NF \token_if_other:NF
+\cs_new_eq:NN \token_if_other_char:NTF \token_if_other:NTF
+\cs_new_eq:NN \token_if_active_char_p:N \token_if_active_p:N
+\cs_new_eq:NN \token_if_active_char:NT \token_if_active:NT
+\cs_new_eq:NN \token_if_active_char:NF \token_if_active:NF
+\cs_new_eq:NN \token_if_active_char:NTF \token_if_active:NTF
+%%
+%%
+%% End of file `l3token.sty'.