summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty')
-rw-r--r--Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty218
1 files changed, 120 insertions, 98 deletions
diff --git a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
index 9631935b752..eb1ba7110ab 100644
--- a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
+++ b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
@@ -6,7 +6,7 @@
%%
%% xparse.dtx (with options: `package')
%%
-%% Copyright (C) 2009-2020 The LaTeX3 Project
+%% Copyright (C) 2009-2021 The LaTeX Project
%%
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
@@ -32,141 +32,163 @@
}%
\endinput
}
-\ProvidesExplPackage{xparse}{2020-10-27}{}
+\ExplSyntaxOn
+\cs_if_free:NTF \NewDocumentCommand
+ {
+ \ExplSyntaxOff
+ \ifnum\expandafter
+ \@parse@version\fmtversion//00\@nil <
+ \@parse@version 2020-10-01//00\@nil
+ \RequirePackage{xparse-2018-04-12}
+ \else
+ \RequirePackage{xparse-2020-10-01}
+ \fi
+ \file_input_stop:
+ }
+ {
+ \ExplSyntaxOff
+ \cs_if_exist:NF \__cmd_start:nNNnnn
+ {
+ \RequirePackage{xparse-2020-10-01}
+ \file_input_stop:
+ }
+ }
+\ExplSyntaxOff
+\ProvidesExplPackage{xparse}{2021-02-02}{}
{L3 Experimental document command parser}
-\clist_new:N \l__xparse_options_clist
-\DeclareOption* { \clist_put_right:NV \l__xparse_options_clist \CurrentOption }
+\clist_new:N \l__cmd_options_clist
+\DeclareOption* { \clist_put_right:NV \l__cmd_options_clist \CurrentOption }
\ProcessOptions \relax
-\keys_define:nn { xparse }
+\keys_define:nn { ltcmd }
{
- log-declarations .bool_set:N = \l__xparse_log_bool ,
+ log-declarations .bool_set:N = \l__cmd_log_bool ,
log-declarations .initial:n = false
}
-\keys_set:nV { xparse } \l__xparse_options_clist
-\bool_if:NF \l__xparse_log_bool
- { \msg_redirect_module:nnn { LaTeX / xparse } { info } { none } }
-\input xparse-generic.tex ~
-\cs_gset_protected:Npn \__xparse_normalize_arg_spec_loop:n #1
+\keys_set:nV { ltcmd } \l__cmd_options_clist
+\bool_if:NF \l__cmd_log_bool
+ { \msg_redirect_module:nnn { LaTeX / ltcmd } { info } { none } }
+\cs_gset_protected:Npn \__cmd_normalize_arg_spec_loop:n #1
{
\quark_if_recursion_tail_stop:n {#1}
- \int_incr:N \l__xparse_current_arg_int
- \cs_if_exist_use:cF { __xparse_normalize_type_ \tl_to_str:n {#1} :w }
+ \int_incr:N \l__cmd_current_arg_int
+ \cs_if_exist_use:cF { __cmd_normalize_type_ \tl_to_str:n {#1} :w }
{
- \__kernel_msg_error:nnxx { xparse } { unknown-argument-type }
- { \__xparse_environment_or_command: } { \tl_to_str:n {#1} }
- \__xparse_bad_def:wn
+ \__kernel_msg_error:nnxx { ltcmd } { unknown-argument-type }
+ { \__cmd_environment_or_command: } { \tl_to_str:n {#1} }
+ \__cmd_bad_def:wn
}
}
-\cs_new_protected:Npx \__xparse_normalize_type_g:w
- { \exp_not:N \__xparse_normalize_type_G:w { \exp_not:V \c_novalue_tl } }
-\cs_new_protected:Npn \__xparse_normalize_type_G:w #1
+\cs_new_protected:Npx \__cmd_normalize_type_g:w
+ { \exp_not:N \__cmd_normalize_type_G:w { \exp_not:V \c_novalue_tl } }
+\cs_new_protected:Npn \__cmd_normalize_type_G:w #1
{
- \quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn }
- \__xparse_normalize_check_gv:N G
- \__xparse_add_arg_spec:n { G {#1} }
- \tl_put_right:Nn \l__xparse_last_delimiters_tl { { } }
- \__xparse_normalize_arg_spec_loop:n
+ \quark_if_recursion_tail_stop_do:nn {#1} { \__cmd_bad_arg_spec:wn }
+ \__cmd_normalize_check_gv:N G
+ \__cmd_add_arg_spec:n { G {#1} }
+ \tl_put_right:Nn \l__cmd_last_delimiters_tl { { } }
+ \__cmd_normalize_arg_spec_loop:n
}
-\cs_new_protected:Npn \__xparse_normalize_type_l:w
+\cs_new_protected:Npn \__cmd_normalize_type_l:w
{
- \__xparse_normalize_check_lu:N l
- \__xparse_add_arg_spec_mandatory:n { l }
- \__xparse_normalize_arg_spec_loop:n
+ \__cmd_normalize_check_lu:N l
+ \__cmd_add_arg_spec_mandatory:n { l }
+ \__cmd_normalize_arg_spec_loop:n
}
-\cs_new_protected:Npn \__xparse_normalize_type_u:w #1
+\cs_new_protected:Npn \__cmd_normalize_type_u:w #1
{
- \quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn }
- \__xparse_normalize_check_lu:N u
- \__xparse_add_arg_spec_mandatory:n { u {#1} }
- \__xparse_normalize_arg_spec_loop:n
+ \quark_if_recursion_tail_stop_do:nn {#1} { \__cmd_bad_arg_spec:wn }
+ \__cmd_normalize_check_lu:N u
+ \__cmd_add_arg_spec_mandatory:n { u {#1} }
+ \__cmd_normalize_arg_spec_loop:n
}
-\cs_new_protected:Npn \__xparse_add_type_G:w #1
+\cs_new_protected:Npn \__cmd_add_type_G:w #1
{
- \__xparse_flush_m_args:
- \__xparse_add_default:n {#1}
- \__xparse_add_grabber:N G
- \__xparse_prepare_signature:N
+ \__cmd_flush_m_args:
+ \__cmd_add_default:n {#1}
+ \__cmd_add_grabber:N G
+ \__cmd_prepare_signature:N
}
-\cs_new_protected:Npn \__xparse_add_type_l:w
+\cs_new_protected:Npn \__cmd_add_type_l:w
{
- \__xparse_flush_m_args:
- \__xparse_add_default:
- \__xparse_add_grabber:N l
- \__xparse_prepare_signature:N
+ \__cmd_flush_m_args:
+ \__cmd_add_default:
+ \__cmd_add_grabber:N l
+ \__cmd_prepare_signature:N
}
-\cs_new_protected:Npn \__xparse_add_type_u:w #1
+\cs_new_protected:Npn \__cmd_add_type_u:w #1
{
- \__xparse_flush_m_args:
- \__xparse_add_default:
- \__xparse_add_grabber:N u
- \tl_put_right:Nn \l__xparse_signature_tl { {#1} }
- \__xparse_prepare_signature:N
+ \__cmd_flush_m_args:
+ \__cmd_add_default:
+ \__cmd_add_grabber:N u
+ \tl_put_right:Nn \l__cmd_signature_tl { {#1} }
+ \__cmd_prepare_signature:N
}
-\cs_new_protected:Npn \__xparse_add_expandable_type_l:w
- { \__xparse_add_expandable_type_u:w ## }
-\cs_new_protected:Npn \__xparse_add_expandable_type_u:w #1
+\cs_new_protected:Npn \__cmd_add_expandable_type_l:w
+ { \__cmd_add_expandable_type_u:w ## }
+\cs_new_protected:Npn \__cmd_add_expandable_type_u:w #1
{
- \__xparse_add_default:
- \bool_if:NTF \l__xparse_long_bool
+ \__cmd_add_default:
+ \bool_if:NTF \l__cmd_long_bool
{ \cs_set:cpn }
{ \cs_set_nopar:cpn }
- { \l__xparse_expandable_aux_name_tl } ##1 \q__xparse ##2 ##3 ##4 #1
- { ##1 {##4} \q__xparse ##2 ##3 }
- \__xparse_add_expandable_grabber:nn { u }
- { \exp_not:c { \l__xparse_expandable_aux_name_tl } }
- \__xparse_prepare_signature:N
+ { \l__cmd_expandable_aux_name_tl } ##1 \q__cmd ##2 ##3 ##4 #1
+ { ##1 {##4} \q__cmd ##2 ##3 }
+ \__cmd_add_expandable_grabber:nn { u }
+ { \exp_not:c { \l__cmd_expandable_aux_name_tl } }
+ \__cmd_prepare_signature:N
}
-\cs_new_protected:Npn \__xparse_grab_G:w #1 \__xparse_run_code:
+\cs_new_protected:Npn \__cmd_grab_G:w #1 \__cmd_run_code:
{
- \__xparse_grab_G_aux:nNN {#1} \cs_set_protected_nopar:Npn
- \__xparse_peek_nonspace:NTF
+ \__cmd_grab_G_aux:nNN {#1} \cs_set_protected_nopar:Npn
+ \__cmd_peek_nonspace:NTF
}
-\cs_new_protected:Npn \__xparse_grab_G_long:w #1 \__xparse_run_code:
+\cs_new_protected:Npn \__cmd_grab_G_long:w #1 \__cmd_run_code:
{
- \__xparse_grab_G_aux:nNN {#1} \cs_set_protected:Npn
- \__xparse_peek_nonspace:NTF
+ \__cmd_grab_G_aux:nNN {#1} \cs_set_protected:Npn
+ \__cmd_peek_nonspace:NTF
}
-\cs_new_protected:Npn \__xparse_grab_G_obey_spaces:w #1 \__xparse_run_code:
+\cs_new_protected:Npn \__cmd_grab_G_obey_spaces:w #1 \__cmd_run_code:
{
- \__xparse_grab_G_aux:nNN {#1} \cs_set_protected_nopar:Npn
+ \__cmd_grab_G_aux:nNN {#1} \cs_set_protected_nopar:Npn
\peek_meaning:NTF
}
-\cs_new_protected:Npn \__xparse_grab_G_long_obey_spaces:w #1 \__xparse_run_code:
+\cs_new_protected:Npn \__cmd_grab_G_long_obey_spaces:w #1 \__cmd_run_code:
{
- \__xparse_grab_G_aux:nNN {#1} \cs_set_protected:Npn
+ \__cmd_grab_G_aux:nNN {#1} \cs_set_protected:Npn
\peek_meaning:NTF
}
-\cs_new_protected:Npn \__xparse_grab_G_aux:nNN #1#2#3
+\cs_new_protected:Npn \__cmd_grab_G_aux:nNN #1#2#3
{
- \tl_set:Nn \l__xparse_signature_tl {#1}
- \exp_after:wN #2 \l__xparse_fn_tl ##1
- { \__xparse_add_arg:n {##1} }
+ \tl_set:Nn \l__cmd_signature_tl {#1}
+ \exp_after:wN #2 \l__cmd_fn_tl ##1
+ { \__cmd_add_arg:n {##1} }
#3 \c_group_begin_token
- { \l__xparse_fn_tl }
- { \__xparse_add_arg:o \c_novalue_tl }
- }
-\cs_new_protected:Npn \__xparse_grab_l:w #1 \__xparse_run_code:
- { \__xparse_grab_l_aux:nN {#1} \cs_set_protected_nopar:Npn }
-\cs_new_protected:Npn \__xparse_grab_l_long:w #1 \__xparse_run_code:
- { \__xparse_grab_l_aux:nN {#1} \cs_set_protected:Npn }
-\cs_new_protected:Npn \__xparse_grab_l_aux:nN #1#2
- {
- \tl_set:Nn \l__xparse_signature_tl {#1}
- \exp_after:wN #2 \l__xparse_fn_tl ##1##
- { \__xparse_add_arg:n {##1} }
- \l__xparse_fn_tl
- }
-\cs_new_protected:Npn \__xparse_grab_u:w #1#2 \__xparse_run_code:
- { \__xparse_grab_u_aux:nnN {#1} {#2} \cs_set_protected_nopar:Npn }
-\cs_new_protected:Npn \__xparse_grab_u_long:w #1#2 \__xparse_run_code:
- { \__xparse_grab_u_aux:nnN {#1} {#2} \cs_set_protected:Npn }
-\cs_new_protected:Npn \__xparse_grab_u_aux:nnN #1#2#3
- {
- \tl_set:Nn \l__xparse_signature_tl {#2}
- \exp_after:wN #3 \l__xparse_fn_tl ##1 #1
- { \__xparse_add_arg:n {##1} }
- \l__xparse_fn_tl
- }
+ { \l__cmd_fn_tl }
+ { \__cmd_add_arg:o \c_novalue_tl }
+ }
+\cs_new_protected:Npn \__cmd_grab_l:w #1 \__cmd_run_code:
+ { \__cmd_grab_l_aux:nN {#1} \cs_set_protected_nopar:Npn }
+\cs_new_protected:Npn \__cmd_grab_l_long:w #1 \__cmd_run_code:
+ { \__cmd_grab_l_aux:nN {#1} \cs_set_protected:Npn }
+\cs_new_protected:Npn \__cmd_grab_l_aux:nN #1#2
+ {
+ \tl_set:Nn \l__cmd_signature_tl {#1}
+ \exp_after:wN #2 \l__cmd_fn_tl ##1##
+ { \__cmd_add_arg:n {##1} }
+ \l__cmd_fn_tl
+ }
+\cs_new_protected:Npn \__cmd_grab_u:w #1#2 \__cmd_run_code:
+ { \__cmd_grab_u_aux:nnN {#1} {#2} \cs_set_protected_nopar:Npn }
+\cs_new_protected:Npn \__cmd_grab_u_long:w #1#2 \__cmd_run_code:
+ { \__cmd_grab_u_aux:nnN {#1} {#2} \cs_set_protected:Npn }
+\cs_new_protected:Npn \__cmd_grab_u_aux:nnN #1#2#3
+ {
+ \tl_set:Nn \l__cmd_signature_tl {#2}
+ \exp_after:wN #3 \l__cmd_fn_tl ##1 #1
+ { \__cmd_add_arg:n {##1} }
+ \l__cmd_fn_tl
+ }
+\cs_new_eq:NN \__cmd_expandable_grab_u:w \prg_do_nothing:
%%
%%
%% End of file `xparse.sty'.