summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3packages
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-02-10 23:29:10 +0000
committerKarl Berry <karl@freefriends.org>2017-02-10 23:29:10 +0000
commitd12b5fe6d47c6b6188b48f5a442dc625b1eea5b1 (patch)
treea5bc026f17eac7f835275add9e1b4ab1b6e6519e /Master/texmf-dist/tex/latex/l3packages
parent8e54a5b67ae2ca6fd34f9e2ddb28e00e3454453b (diff)
l3 (10feb17)
git-svn-id: svn://tug.org/texlive/trunk@43183 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3packages')
-rw-r--r--Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty8
-rw-r--r--Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty8
-rw-r--r--Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty1432
-rw-r--r--Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty8
4 files changed, 874 insertions, 582 deletions
diff --git a/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty b/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty
index 41a1b17b6d9..0910faf247e 100644
--- a/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty
+++ b/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty
@@ -19,8 +19,8 @@
%% and all files in that bundle must be distributed together.
%%
%% File: l3keys2e.dtx (C) Copyright 2009,2011-2017 The LaTeX3 Project
-\RequirePackage{expl3}[2017/02/07]
-\@ifpackagelater{expl3}{2017/02/07}
+\RequirePackage{expl3}[2017/02/10]
+\@ifpackagelater{expl3}{2017/02/10}
{}
{%
\PackageError{l3keys2e}{Support package l3kernel too old}
@@ -34,8 +34,8 @@
}
\def\ExplFileName{l3keys2e}
\def\ExplFileDescription{LaTeX2e option processing using LaTeX3 keys}
-\def\ExplFileDate{2017/02/07}
-\def\ExplFileVersion{6846}
+\def\ExplFileDate{2017/02/10}
+\def\ExplFileVersion{6878}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\cs_generate_variant:Nn \clist_put_right:Nn { Nv }
diff --git a/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty b/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty
index c4db0d2403a..17f3d1bc319 100644
--- a/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty
+++ b/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty
@@ -20,8 +20,8 @@
%%
%% File: xfrac.dtx Copyright (C) 2004, 2008-2010 Morten Hoegholm
%% (C) 2011,2012,2014-2017 The LaTeX3 Project
-\RequirePackage{expl3}[2017/02/07]
-\@ifpackagelater{expl3}{2017/02/07}
+\RequirePackage{expl3}[2017/02/10]
+\@ifpackagelater{expl3}{2017/02/10}
{}
{%
\PackageError{xfrac}{Support package l3kernel too old}
@@ -36,8 +36,8 @@
\RequirePackage{amstext,graphicx,l3keys2e,textcomp,xparse,xtemplate}
\def\ExplFileName{xfrac}
\def\ExplFileDescription{L3 Experimental split-level fractions}
-\def\ExplFileDate{2017/02/07}
-\def\ExplFileVersion{6846}
+\def\ExplFileDate{2017/02/10}
+\def\ExplFileVersion{6878}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\keys_define:nn { xfrac }
diff --git a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
index 8ac9148a45c..08e27c11845 100644
--- a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
+++ b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
@@ -22,9 +22,9 @@
%% David Carlisle
%% (C) Copyright 2004-2008 Frank Mittelbach,
%% The LaTeX3 Project
-%% (C) Copyright 2009-2016 The LaTeX3 Project
-\RequirePackage{expl3}[2017/02/07]
-\@ifpackagelater{expl3}{2017/02/07}
+%% (C) Copyright 2009-2017 The LaTeX3 Project
+\RequirePackage{expl3}[2017/02/10]
+\@ifpackagelater{expl3}{2017/02/10}
{}
{%
\PackageError{xparse}{Support package l3kernel too old}
@@ -38,22 +38,22 @@
}
\def\ExplFileName{xparse}
\def\ExplFileDescription{L3 Experimental document command parser}
-\def\ExplFileDate{2017/02/07}
-\def\ExplFileVersion{6846}
+\def\ExplFileDate{2017/02/10}
+\def\ExplFileVersion{6878}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\tl_const:Nx \c__xparse_no_value_tl
{ \char_generate:nn { `\- } { 11 } NoValue- }
-\prop_new:N \c__xparse_shorthands_prop
-\prop_put:Nnn \c__xparse_shorthands_prop { o } { d[] }
-\prop_put:Nnn \c__xparse_shorthands_prop { O } { D[] }
-\prop_put:Nnn \c__xparse_shorthands_prop { s } { t* }
\bool_new:N \l__xparse_all_long_bool
+\bool_new:N \l__xparse_all_long_set_bool
+\tl_new:N \l__xparse_arg_spec_tl
\tl_new:N \l__xparse_args_tl
-\prop_new:N \l__xparse_command_arg_specs_prop
+\tl_new:N \l__xparse_args_i_tl
+\tl_new:N \l__xparse_args_ii_tl
\int_new:N \l__xparse_current_arg_int
+\bool_new:N \l__xparse_defaults_bool
+\tl_new:N \l__xparse_defaults_tl
\bool_new:N \l__xparse_environment_bool
-\prop_new:N \l__xparse_environment_arg_specs_prop
\bool_new:N \l__xparse_expandable_bool
\tl_new:N \l__xparse_expandable_aux_name_tl
\tl_set:Nn \l__xparse_expandable_aux_name_tl
@@ -61,17 +61,23 @@
\l__xparse_function_tl \c_space_tl
( arg~ \int_use:N \l__xparse_current_arg_int )
}
+\int_new:N \g__xparse_grabber_int
\tl_new:N \l__xparse_fn_tl
+\tl_new:N \l__xparse_fn_code_tl
\tl_new:N \l__xparse_function_tl
+\tl_new:N \l__xparse_last_delimiters_tl
\bool_new:N \l__xparse_long_bool
\int_new:N \l__xparse_m_args_int
\int_new:N \l__xparse_mandatory_args_int
-\bool_new:N \l__xparse_processor_bool
-\int_new:N \l__xparse_processor_int
+\bool_new:N \l__xparse_prefixed_bool
+\tl_new:N \l__xparse_process_all_tl
+\tl_new:N \l__xparse_process_one_tl
+\bool_new:N \l__xparse_process_some_bool
\tl_new:N \l__xparse_signature_tl
\prop_new:N \l__xparse_tmp_prop
\tl_new:N \l__xparse_tmpa_tl
\tl_new:N \l__xparse_tmpb_tl
+\cs_new_eq:NN \__xparse_tmp:w ?
\cs_new_protected:Npn \__xparse_declare_cmd:Nnn
{
\bool_set_false:N \l__xparse_expandable_bool
@@ -93,72 +99,70 @@
\__msg_kernel_info:nnxx { xparse } { define-command }
{ \token_to_str:N #1 } { \tl_to_str:n {#2} }
}
- \prop_put:Nnn \l__xparse_command_arg_specs_prop {#1} {#2}
\bool_set_false:N \l__xparse_environment_bool
\__xparse_declare_cmd_internal:Nnn #1 {#2}
}
\cs_new_protected:Npn \__xparse_declare_cmd_internal:Nnn #1#2#3
{
\tl_set:Nx \l__xparse_function_tl { \cs_to_str:N #1 }
- \__xparse_count_mandatory:n {#2}
- \__xparse_prepare_signature:n {#2}
- \int_compare:nNnTF \l__xparse_current_arg_int = \l__xparse_m_args_int
- {
- \bool_if:NTF \l__xparse_environment_bool
- { \__xparse_declare_cmd_mixed:Nn #1 {#3} }
- { \__xparse_declare_cmd_all_m:Nn #1 {#3} }
- }
- { \__xparse_declare_cmd_mixed:Nn #1 {#3} }
+ \__xparse_normalize_arg_spec:n {#2}
+ \exp_args:No \__xparse_prepare_signature:n \l__xparse_arg_spec_tl
+ \__xparse_declare_cmd_code:Nnn #1 {#2} {#3}
\__xparse_break_point:n {#2}
}
\cs_generate_variant:Nn \__xparse_declare_cmd_internal:Nnn { cnx }
\cs_new_eq:NN \__xparse_break_point:n \use_none:n
-\cs_new_protected:Npn \__xparse_declare_cmd_all_m:Nn #1#2
- {
- \cs_generate_from_arg_count:Ncnn #1
- {
- cs_set
- \bool_if:NF \l__xparse_expandable_bool { _protected }
- \bool_if:NF \l__xparse_all_long_bool { _nopar }
- :Npn
- }
- \l__xparse_current_arg_int {#2}
- }
-\cs_new_protected:Npn \__xparse_declare_cmd_mixed:Nn
+\cs_new_protected:Npn \__xparse_declare_cmd_code:Nnn
{
\bool_if:NTF \l__xparse_expandable_bool
- { \__xparse_declare_cmd_mixed_expandable:Nn }
- { \__xparse_declare_cmd_mixed_aux:Nn }
+ { \__xparse_declare_cmd_code_expandable:Nnn }
+ { \__xparse_declare_cmd_code_aux:Nnn }
}
-\cs_new_protected:Npn \__xparse_declare_cmd_mixed_aux:Nn #1#2
+\cs_new_protected:Npn \__xparse_declare_cmd_code_aux:Nnn #1#2#3
{
- \__xparse_flush_m_args:
\cs_generate_from_arg_count:cNnn
{ \l__xparse_function_tl \c_space_tl code }
- \cs_set_protected:Npn \l__xparse_current_arg_int {#2}
+ \cs_set_protected:Npn \l__xparse_current_arg_int {#3}
\cs_set_protected_nopar:Npx #1
{
- \int_zero:N \l__xparse_processor_int
- \tl_set:Nn \exp_not:N \l__xparse_args_tl
- { \exp_not:c { \l__xparse_function_tl \c_space_tl code } }
- \tl_set:Nn \exp_not:N \l__xparse_fn_tl
- { \exp_not:c { \l__xparse_function_tl \c_space_tl } }
- \exp_not:o \l__xparse_signature_tl
- \exp_not:N \l__xparse_args_tl
+ \__xparse_start:nNNnnn
+ { \exp_not:n {#2} }
+ \exp_not:c { \l__xparse_function_tl \c_space_tl }
+ \exp_not:c { \l__xparse_function_tl \c_space_tl code }
+ { \exp_not:o \l__xparse_signature_tl }
+ {
+ \bool_if:NT \l__xparse_defaults_bool
+ { \exp_not:o \l__xparse_defaults_tl }
+ }
+ {
+ \bool_if:NT \l__xparse_process_some_bool
+ { \exp_not:o \l__xparse_process_all_tl }
+ }
}
}
-\cs_new_protected:Npn \__xparse_declare_cmd_mixed_expandable:Nn #1#2
+\cs_new_protected:Npn \__xparse_declare_cmd_code_expandable:Nnn #1#2#3
{
\cs_generate_from_arg_count:cNnn
{ \l__xparse_function_tl \c_space_tl code }
- \cs_set:Npn \l__xparse_current_arg_int {#2}
+ \cs_set:Npn \l__xparse_current_arg_int {#3}
+ \bool_if:NT \l__xparse_defaults_bool
+ {
+ \use:x
+ {
+ \cs_generate_from_arg_count:cNnn
+ { \l__xparse_function_tl \c_space_tl defaults }
+ \cs_set:Npn \l__xparse_current_arg_int
+ { \exp_not:o \l__xparse_defaults_tl }
+ }
+ }
\cs_set_nopar:Npx #1
{
- \exp_not:o \l__xparse_signature_tl
- \exp_not:N \__xparse_grab_expandable_end:wN
- \exp_not:c { \l__xparse_function_tl \c_space_tl code }
- \exp_not:N \q__xparse
- \exp_not:c { \l__xparse_function_tl \c_space_tl }
+ \exp_not:N \__xparse_start_expandable:nNNNn
+ { \exp_not:n {#2} }
+ \exp_not:c { \l__xparse_function_tl \c_space_tl }
+ \exp_not:c { \l__xparse_function_tl \c_space_tl code }
+ \exp_not:c { \l__xparse_function_tl \c_space_tl defaults }
+ { \exp_not:o \l__xparse_signature_tl }
}
\bool_if:NTF \l__xparse_all_long_bool
{ \cs_set:cpx }
@@ -176,7 +180,6 @@
\__msg_kernel_info:nnxx { xparse } { define-environment }
{#1} { \tl_to_str:n {#2} }
}
- \prop_put:Nnn \l__xparse_environment_arg_specs_prop {#1} {#2}
\bool_set_false:N \l__xparse_expandable_bool
\bool_set_true:N \l__xparse_environment_bool
\__xparse_declare_env_internal:nnnn {#1} {#2}
@@ -188,7 +191,7 @@
\cs_set_nopar:Npx \exp_not:c { environment~ #1 ~end~aux }
{
\exp_not:N \exp_not:N \exp_not:c { environment~ #1~end~aux~ }
- \exp_not:n { \tl_tail:N \l__xparse_args_tl }
+ \exp_not:n { \exp_not:o \l__xparse_args_tl }
}
\exp_not:n {#3}
}
@@ -200,222 +203,467 @@
\cs_set_eq:cc {#1} { environment~ #1 }
\cs_set_eq:cc { end #1 } { environment~ #1 ~end }
}
-\cs_new_protected:Npn \__xparse_count_mandatory:n #1
+\cs_new_protected:Npn \__xparse_start:nNNnnn #1#2#3#4#5#6
+ {
+ \tl_clear:N \l__xparse_args_tl
+ \tl_set:Nn \l__xparse_fn_tl {#2}
+ \tl_set:Nn \l__xparse_fn_code_tl {#3}
+ \tl_set:Nn \l__xparse_defaults_tl {#5}
+ \tl_set:Nn \l__xparse_process_all_tl {#6}
+ #4 \__xparse_run_code:
+ }
+\cs_new_protected:Npn \__xparse_run_code:
+ {
+ \tl_if_empty:NF \l__xparse_defaults_tl { \__xparse_defaults: }
+ \tl_if_empty:NF \l__xparse_process_all_tl { \__xparse_args_process: }
+ \exp_after:wN \l__xparse_fn_code_tl \l__xparse_args_tl
+ }
+\cs_new_protected:Npn \__xparse_defaults:
+ {
+ \__xparse_defaults_def:
+ \tl_set_eq:NN \l__xparse_args_i_tl \l__xparse_args_tl
+ \__xparse_defaults_aux: \__xparse_defaults_aux: \__xparse_defaults_aux:
+ \__xparse_defaults_aux: \__xparse_defaults_aux: \__xparse_defaults_aux:
+ \__xparse_defaults_aux: \__xparse_defaults_aux: \__xparse_defaults_aux:
+ \__xparse_defaults_error:w
+ \q_recursion_stop
+ \tl_set_eq:NN \l__xparse_args_tl \l__xparse_args_i_tl
+ }
+\cs_new_protected:Npn \__xparse_defaults_aux:
+ {
+ \tl_set:Nx \l__xparse_args_ii_tl
+ { \exp_after:wN \__xparse_tmp:w \l__xparse_args_i_tl }
+ \tl_if_eq:NNT \l__xparse_args_ii_tl \l__xparse_args_i_tl
+ { \use_none_delimit_by_q_recursion_stop:w }
+ \tl_set_eq:NN \l__xparse_args_i_tl \l__xparse_args_ii_tl
+ }
+\cs_new_protected:Npn \__xparse_defaults_error:w \q_recursion_stop
+ {
+ \__msg_kernel_error:nnx { xparse } { loop-in-defaults }
+ { \exp_after:wN \token_to_str:N \l__xparse_fn_tl }
+ }
+\cs_new_protected:Npn \__xparse_defaults_def:
+ {
+ \tl_clear:N \l__xparse_tmpa_tl
+ \int_zero:N \l__xparse_current_arg_int
+ \__xparse_tl_mapthread_function:NNN \l__xparse_args_tl \l__xparse_defaults_tl
+ \__xparse_defaults_def:nn
+ \cs_generate_from_arg_count:NNVo \__xparse_tmp:w \cs_set:Npn
+ \l__xparse_current_arg_int \l__xparse_tmpa_tl
+ }
+\cs_generate_variant:Nn \cs_generate_from_arg_count:NNnn { NNVo }
+\cs_new_protected:Npn \__xparse_defaults_def:nn
+ {
+ \int_incr:N \l__xparse_current_arg_int
+ \exp_args:NV \__xparse_defaults_def:nnn \l__xparse_current_arg_int
+ }
+\cs_new_protected:Npn \__xparse_defaults_def:nnn #1#2#3
+ {
+ \tl_if_head_is_group:nTF {#3}
+ {
+ \tl_put_right:Nn \l__xparse_tmpa_tl
+ {
+ {
+ \exp_args:Nf \__xparse_tl_mapthread_function:nnN
+ { \tl_item:Nn \l__xparse_args_tl {#1} }
+ {#3}
+ \__xparse_defaults_def_aux:nn
+ }
+ }
+ }
+ {
+ \__xparse_if_no_value:nTF {#2}
+ {
+ \tl_put_right:Nx \l__xparse_tmpa_tl
+ { { \exp_not:N \exp_not:n { \exp_not:o { \use_none:n #3 } } } }
+ }
+ {
+ \tl_put_right:Nn \l__xparse_tmpa_tl
+ { { \exp_not:n { ## #1 } } }
+ }
+ }
+ }
+\cs_new:Npn \__xparse_defaults_def_aux:nn #1#2
+ {
+ \__xparse_if_no_value:nTF {#1}
+ { { \exp_not:n {#2} } }
+ { { \exp_not:n {#1} } }
+ }
+\cs_new_protected:Npn \__xparse_args_process:
+ {
+ \tl_clear:N \l__xparse_args_ii_tl
+ \__xparse_tl_mapthread_function:NNN
+ \l__xparse_args_tl
+ \l__xparse_process_all_tl
+ \__xparse_args_process_loop:nn
+ \tl_set_eq:NN \l__xparse_args_tl \l__xparse_args_ii_tl
+ }
+\cs_new_protected:Npn \__xparse_args_process_loop:nn #1#2
+ {
+ \tl_set:Nn \ProcessedArgument {#1}
+ \__xparse_if_no_value:nF {#1}
+ { \tl_map_function:nN {#2} \__xparse_args_process_aux:n }
+ \tl_put_right:No \l__xparse_args_ii_tl
+ { \exp_after:wN { \ProcessedArgument } }
+ }
+\cs_new_protected:Npn \__xparse_args_process_aux:n
+ { \exp_args:No \__xparse_args_process_aux:nn { \ProcessedArgument } }
+\cs_new_protected:Npn \__xparse_args_process_aux:nn #1#2 { #2 {#1} }
+\cs_new:Npn \__xparse_start_expandable:nNNNn #1#2#3#4#5
+ { #5 \__xparse_end_expandable:NNw #4 #3 \q__xparse #2 }
+\cs_new:Npn \__xparse_end_expandable:NNw #1#2
+ { \__xparse_end_expandable_aux:w #1#2 \prg_do_nothing: }
+\cs_new:Npn \__xparse_end_expandable_aux:w #1#2#3 \q__xparse #4
+ { \exp_args:No \__xparse_end_expandable_aux:nNNN {#3} #1 #2 #4 }
+\cs_new:Npn \__xparse_end_expandable_aux:nNNN #1#2#3#4
+ {
+ \cs_if_exist:NF #2 { \exp_after:wN \use_iv:nnnn }
+ \__xparse_end_expandable_defaults:nnnNNn {#1} { } {#1} #2#3
+ { } { } { } { } { } { } { } { } { } { }
+ {
+ \__msg_kernel_expandable_error:nnn
+ { xparse } { loop-in-defaults } {#4}
+ \use_iv:nnnn
+ }
+ \q_stop
+ }
+\cs_new:Npn \__xparse_end_expandable_defaults:nnnNNn #1#2#3#4#5#6
+ {
+ #6
+ \str_if_eq:nnTF {#1} {#2}
+ { \use_i_delimit_by_q_stop:nw { #5 #1 } }
+ {
+ \exp_args:No \__xparse_tl_mapthread_function:nnN
+ { #4 #1 } {#3}
+ \__xparse_end_expandable_defaults:nnw
+ \__xparse_end_expandable_defaults:nnnNNn { } {#1} {#3} #4 #5
+ }
+ }
+\cs_new:Npn \__xparse_end_expandable_defaults:nnw #1#2
+ {
+ \tl_if_head_is_group:nTF {#1}
+ {
+ \__xparse_end_expandable_defaults_E:nnw { }
+ #1 \q_nil \q_mark
+ #2 \q_nil
+ }
+ {
+ \__xparse_if_no_value:nTF {#2}
+ { \exp_args:No \__xparse_end_expandable_defaults:nw { \use_none:n #1 } }
+ { \__xparse_end_expandable_defaults:nw {#2} }
+ }
+ }
+\cs_new:Npn \__xparse_end_expandable_defaults_E:nnw #1#2#3 \q_mark #4
+ {
+ \quark_if_nil:nTF {#2}
+ { \__xparse_end_expandable_defaults:nw {#1} }
+ {
+ \__xparse_if_no_value:nTF {#4}
+ { \__xparse_end_expandable_defaults_E:nnw { #1 {#2} } }
+ { \__xparse_end_expandable_defaults_E:nnw { #1 {#4} } }
+ #3 \q_mark
+ }
+ }
+\cs_new:Npn \__xparse_end_expandable_defaults:nw
+ #1#2 \__xparse_end_expandable_defaults:nnnNNn #3
+ { #2 \__xparse_end_expandable_defaults:nnnNNn { #3 {#1} } }
+\cs_new_protected:Npn \__xparse_normalize_arg_spec:n #1
{
\int_zero:N \l__xparse_mandatory_args_int
- \__xparse_count_mandatory:N #1
+ \int_zero:N \l__xparse_current_arg_int
+ \tl_clear:N \l__xparse_last_delimiters_tl
+ \tl_clear:N \l__xparse_arg_spec_tl
+ \__xparse_normalize_arg_spec_loop:n #1
\q_recursion_tail \q_recursion_tail \q_recursion_tail \q_recursion_stop
+ \int_compare:nNnT \l__xparse_current_arg_int > 9
+ {
+ \__msg_kernel_error:nnxx { xparse } { too-many-arguments }
+ { \iow_char:N \\ \l__xparse_function_tl } { \tl_to_str:n {#1} }
+ \__xparse_bad_def:wn
+ }
+ \bool_if:NT \l__xparse_expandable_bool
+ {
+ \tl_if_empty:NF \l__xparse_last_delimiters_tl
+ {
+ \__msg_kernel_error:nnxx { xparse } { expandable-ending-optional }
+ { \iow_char:N \\ \l__xparse_function_tl } { \tl_to_str:n {#1} }
+ \__xparse_bad_def:wn
+ }
+ }
}
-\cs_new_protected:Npn \__xparse_count_mandatory:N #1
+\cs_new_protected:Npn \__xparse_normalize_arg_spec_loop:n #1
{
- \quark_if_recursion_tail_stop:N #1
- \prop_get:NnNTF \c__xparse_shorthands_prop {#1} \l__xparse_tmpa_tl
- { \exp_after:wN \__xparse_count_mandatory:N \l__xparse_tmpa_tl }
- { \__xparse_count_mandatory_aux: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 }
+ {
+ \__msg_kernel_error:nnxx { xparse } { unknown-argument-type }
+ { \iow_char:N \\ \l__xparse_function_tl } { \tl_to_str:n {#1} }
+ \__xparse_bad_def:wn
+ }
}
-\cs_new_protected:Npn \__xparse_count_mandatory_aux:N #1
+\cs_set_protected:Npn \__xparse_tmp:w #1
{
- \cs_if_exist_use:cF { __xparse_count_type_ \token_to_str:N #1 :w }
- { \__xparse_count_type_m:w }
+ \cs_new_protected:Npn \__xparse_normalize_type_d:w ##1##2
+ {
+ \quark_if_recursion_tail_stop_do:nn {##2} { \__xparse_bad_arg_spec:wn }
+ \__xparse_normalize_type_D:w {##1} {##2} {#1}
+ }
+ \cs_new_protected:Npn \__xparse_normalize_type_e:w ##1
+ {
+ \quark_if_recursion_tail_stop_do:nn {##1} { \__xparse_bad_arg_spec:wn }
+ \__xparse_normalize_type_E:w {##1} { }
+ }
+ \cs_new_protected:Npn \__xparse_normalize_type_g:w
+ { \__xparse_normalize_type_G:w {#1} }
+ \cs_new_protected:Npn \__xparse_normalize_type_o:w
+ { \__xparse_normalize_type_D:w [ ] {#1} }
+ \cs_new_protected:Npn \__xparse_normalize_type_O:w
+ { \__xparse_normalize_type_D:w [ ] }
+ \cs_new_protected:Npn \__xparse_normalize_type_r:w ##1##2
+ {
+ \quark_if_recursion_tail_stop_do:nn {##2} { \__xparse_bad_arg_spec:wn }
+ \__xparse_normalize_type_R:w {##1} {##2} {#1}
+ }
+ \cs_new_protected:Npn \__xparse_normalize_type_s:w
+ { \__xparse_normalize_type_t:w * }
}
-\cs_new_protected:cpn { __xparse_count_type_>:w } #1#2
+\exp_args:No \__xparse_tmp:w { \c__xparse_no_value_tl }
+\cs_new_protected:cpn { __xparse_normalize_type_>:w } #1#2
{
\quark_if_recursion_tail_stop_do:nn {#2} { \__xparse_bad_arg_spec:wn }
- \__xparse_count_mandatory:N #2
+ \bool_if:NT \l__xparse_expandable_bool
+ {
+ \__msg_kernel_error:nnxx { xparse } { processor-in-expandable }
+ { \iow_char:N \\ \l__xparse_function_tl } { \tl_to_str:n {#1} }
+ \__xparse_bad_def:wn
+ }
+ \tl_put_right:Nn \l__xparse_arg_spec_tl { > {#1} }
+ \int_decr:N \l__xparse_current_arg_int
+ \__xparse_normalize_arg_spec_loop:n {#2}
}
-\cs_new_protected:cpn { __xparse_count_type_+:w } #1
+\cs_new_protected:cpn { __xparse_normalize_type_+:w } #1
{
\quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn }
- \__xparse_count_mandatory:N #1
- }
-\cs_new_protected:Npn \__xparse_count_type_d:w #1#2
- {
- \__xparse_single_token_check:n {#1}
- \__xparse_single_token_check:n {#2}
- \quark_if_recursion_tail_stop_do:Nn #2 { \__xparse_bad_arg_spec:wn }
- \__xparse_count_mandatory:N
+ \tl_put_right:Nn \l__xparse_arg_spec_tl { + }
+ \int_decr:N \l__xparse_current_arg_int
+ \__xparse_normalize_arg_spec_loop:n {#1}
}
-\cs_new_protected:Npn \__xparse_count_type_D:w #1#2#3
+\cs_new_protected:Npn \__xparse_normalize_type_D:w #1#2#3
{
\__xparse_single_token_check:n {#1}
\__xparse_single_token_check:n {#2}
\quark_if_recursion_tail_stop_do:nn {#3} { \__xparse_bad_arg_spec:wn }
- \__xparse_count_mandatory:N
+ \tl_put_right:Nn \l__xparse_arg_spec_tl { D #1 #2 {#3} }
+ \tl_put_right:Nn \l__xparse_last_delimiters_tl {#1}
+ \__xparse_normalize_arg_spec_loop:n
}
-\cs_new_protected:Npn \__xparse_count_type_e:w #1
- {
- \quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn }
- \__xparse_count_mandatory:N
- }
-\cs_new_protected:Npn \__xparse_count_type_E:w #1#2
+\cs_new_protected:Npn \__xparse_normalize_type_E:w #1#2
{
\quark_if_recursion_tail_stop_do:nn {#2} { \__xparse_bad_arg_spec:wn }
- \__xparse_count_mandatory:N
+ \tl_if_blank:nT {#1} { \__xparse_bad_arg_spec:wn }
+ \tl_map_function:nN {#1} \__xparse_single_token_check:n
+ \int_compare:nNnT { \tl_count:n {#2} } > { \tl_count:n {#1} }
+ { \__xparse_bad_arg_spec:wn }
+ \tl_put_right:Nn \l__xparse_arg_spec_tl { E {#1} {#2} }
+ \tl_put_right:Nn \l__xparse_last_delimiters_tl {#1}
+ \__xparse_normalize_arg_spec_loop:n
}
-\cs_new_protected:Npn \__xparse_count_type_g:w
- { \__xparse_count_mandatory:N }
-\cs_new_protected:Npn \__xparse_count_type_G:w #1
+\cs_new_protected:Npn \__xparse_normalize_type_G:w #1
{
\quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn }
- \__xparse_count_mandatory:N
+ \__xparse_normalize_error_if_expandable:N G
+ \tl_put_right:Nn \l__xparse_arg_spec_tl { G {#1} }
+ \tl_put_right:Nn \l__xparse_last_delimiters_tl { { } }
+ \__xparse_normalize_arg_spec_loop:n
+ }
+\cs_new_protected:Npn \__xparse_normalize_type_t:w #1
+ {
+ \__xparse_single_token_check:n {#1}
+ \quark_if_recursion_tail_stop_do:Nn #1 { \__xparse_bad_arg_spec:wn }
+ \tl_put_right:Nn \l__xparse_arg_spec_tl { t #1 }
+ \tl_put_right:Nn \l__xparse_last_delimiters_tl {#1}
+ \__xparse_normalize_arg_spec_loop:n
}
-\cs_new_protected:Npn \__xparse_count_type_m:w
+\cs_new_protected:Npn \__xparse_normalize_type_l:w
{
+ \__xparse_normalize_error_if_expandable:N l
+ \tl_put_right:Nn \l__xparse_arg_spec_tl { l }
\int_incr:N \l__xparse_mandatory_args_int
- \__xparse_count_mandatory:N
+ \tl_clear:N \l__xparse_last_delimiters_tl
+ \__xparse_normalize_arg_spec_loop:n
}
-\cs_new_protected:Npn \__xparse_count_type_r:w #1#2
+\cs_new_protected:Npn \__xparse_normalize_type_m:w
{
- \__xparse_single_token_check:n {#1}
- \__xparse_single_token_check:n {#2}
- \quark_if_recursion_tail_stop_do:Nn #2 { \__xparse_bad_arg_spec:wn }
+ \__xparse_delimiter_check:nnn { } { m } { \iow_char:N \{ }
+ \tl_put_right:Nn \l__xparse_arg_spec_tl { m }
\int_incr:N \l__xparse_mandatory_args_int
- \__xparse_count_mandatory:N
+ \tl_clear:N \l__xparse_last_delimiters_tl
+ \__xparse_normalize_arg_spec_loop:n
}
-\cs_new_protected:Npn \__xparse_count_type_R:w #1#2#3
+\cs_new_protected:Npn \__xparse_normalize_type_R:w #1#2#3
{
\__xparse_single_token_check:n {#1}
\__xparse_single_token_check:n {#2}
\quark_if_recursion_tail_stop_do:nn {#3} { \__xparse_bad_arg_spec:wn }
+ \__xparse_delimiter_check:nnn {#1} { R/r } { \tl_to_str:n {#1} }
+ \tl_put_right:Nn \l__xparse_arg_spec_tl { R #1 #2 {#3} }
\int_incr:N \l__xparse_mandatory_args_int
- \__xparse_count_mandatory:N
+ \tl_clear:N \l__xparse_last_delimiters_tl
+ \__xparse_normalize_arg_spec_loop:n
}
-\cs_new_protected:Npn \__xparse_count_type_t:w #1
+\cs_new_protected:Npn \__xparse_normalize_type_u:w #1
{
- \__xparse_single_token_check:n {#1}
- \quark_if_recursion_tail_stop_do:Nn #1 { \__xparse_bad_arg_spec:wn }
- \__xparse_count_mandatory:N
+ \quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn }
+ \__xparse_normalize_error_if_expandable:N u
+ \tl_put_right:Nn \l__xparse_arg_spec_tl { u {#1} }
+ \int_incr:N \l__xparse_mandatory_args_int
+ \tl_clear:N \l__xparse_last_delimiters_tl
+ \__xparse_normalize_arg_spec_loop:n
}
-\cs_new_protected:Npn \__xparse_count_type_u:w #1
+\cs_new_protected:Npn \__xparse_normalize_type_v:w
{
- \quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn }
+ \__xparse_normalize_error_if_expandable:N v
+ \tl_put_right:Nn \l__xparse_arg_spec_tl { v }
\int_incr:N \l__xparse_mandatory_args_int
- \__xparse_count_mandatory:N
+ \tl_clear:N \l__xparse_last_delimiters_tl
+ \__xparse_normalize_arg_spec_loop:n
}
\cs_new_protected:Npn \__xparse_single_token_check:n #1
{
\exp_args:Nx \tl_if_single_token:nF { \tl_trim_spaces:n {#1} }
- { \__xparse_single_token_check_aux:nwn {#1} }
+ {
+ \__msg_kernel_error:nnxx { xparse } { not-single-token }
+ { \iow_char:N \\ \l__xparse_function_tl } { \tl_to_str:n {#1} }
+ \__xparse_bad_def:wn
+ }
}
-\cs_new_protected:Npn \__xparse_single_token_check_aux:nwn
- #1#2 \__xparse_break_point:n #3
+\cs_new_protected:Npn \__xparse_normalize_error_if_expandable:N #1
{
- \__msg_kernel_error:nnx { xparse } { not-single-token }
- { \tl_to_str:n {#1} } { \tl_to_str:n {#3} }
+ \bool_if:NT \l__xparse_expandable_bool
+ {
+ \__msg_kernel_error:nnxx
+ { xparse } { invalid-expandable-argument-type }
+ { \iow_char:N \\ \l__xparse_function_tl } { \tl_to_str:n {#1} }
+ \__xparse_bad_def:wn
+ }
+ }
+\cs_new_protected:Npn \__xparse_delimiter_check:nnn #1#2#3
+ {
+ \tl_map_inline:Nn \l__xparse_last_delimiters_tl
+ {
+ \tl_if_eq:nnT {##1} {#1}
+ {
+ \__msg_kernel_warning:nnxx { xparse } { optional-mandatory }
+ {#2} {#3}
+ }
+ }
}
\cs_new_protected:Npn \__xparse_bad_arg_spec:wn #1 \__xparse_break_point:n #2
- { \__msg_kernel_error:nnx { xparse } { bad-arg-spec } { \tl_to_str:n {#2} } }
+ {
+ \__msg_kernel_error:nnxx { xparse } { bad-arg-spec }
+ { \iow_char:N \\ \l__xparse_function_tl } { \tl_to_str:n {#2} }
+ }
+\cs_new_protected:Npn \__xparse_bad_def:wn #1 \__xparse_break_point:n #2 { }
\cs_new_protected:Npn \__xparse_prepare_signature:n #1
{
\bool_set_false:N \l__xparse_all_long_bool
+ \bool_set_false:N \l__xparse_all_long_set_bool
\int_zero:N \l__xparse_current_arg_int
\bool_set_false:N \l__xparse_long_bool
\int_zero:N \l__xparse_m_args_int
- \bool_set_false:N \l__xparse_processor_bool
+ \bool_set_false:N \l__xparse_defaults_bool
+ \tl_clear:N \l__xparse_defaults_tl
+ \tl_clear:N \l__xparse_process_all_tl
+ \tl_clear:N \l__xparse_process_one_tl
+ \bool_set_false:N \l__xparse_process_some_bool
\tl_clear:N \l__xparse_signature_tl
\__xparse_prepare_signature:N #1 \q_recursion_tail \q_recursion_stop
+ \bool_if:NF \l__xparse_expandable_bool { \__xparse_flush_m_args: }
}
\cs_new_protected:Npn \__xparse_prepare_signature:N
{
- \bool_set_false:N \l__xparse_processor_bool
+ \bool_set_false:N \l__xparse_prefixed_bool
\__xparse_prepare_signature_bypass:N
}
\cs_new_protected:Npn \__xparse_prepare_signature_bypass:N #1
{
\quark_if_recursion_tail_stop:N #1
- \prop_get:NnNTF \c__xparse_shorthands_prop {#1} \l__xparse_tmpa_tl
- { \exp_after:wN \__xparse_prepare_signature:N \l__xparse_tmpa_tl }
- {
- \int_incr:N \l__xparse_current_arg_int
- \__xparse_prepare_signature_add:N #1
- }
- }
-\cs_new_protected:Npn \__xparse_prepare_signature_add:N #1
- {
- \cs_if_exist_use:cF
+ \int_incr:N \l__xparse_current_arg_int
+ \use:c
{
__xparse_add
\bool_if:NT \l__xparse_expandable_bool { _expandable }
_type_ \token_to_str:N #1 :w
}
- {
- \__msg_kernel_error:nnx { xparse } { unknown-argument-type }
- { \token_to_str:N #1 }
- \bool_if:NTF \l__xparse_expandable_bool
- { \__xparse_add_expandable_type_m:w }
- { \__xparse_add_type_m:w }
- }
}
\cs_new_protected:cpn { __xparse_add_type_+:w }
{
\__xparse_flush_m_args:
\bool_set_true:N \l__xparse_long_bool
+ \bool_set_true:N \l__xparse_prefixed_bool
\int_decr:N \l__xparse_current_arg_int
- \__xparse_prepare_signature:N
+ \__xparse_prepare_signature_bypass:N
}
\cs_new_protected:cpn { __xparse_add_type_>:w } #1
{
\__xparse_flush_m_args:
- \bool_set_true:N \l__xparse_processor_bool
+ \bool_set_true:N \l__xparse_prefixed_bool
+ \bool_set_true:N \l__xparse_process_some_bool
\int_decr:N \l__xparse_current_arg_int
- \tl_put_right:Nn \l__xparse_signature_tl { \__xparse_process_arg:n {#1} }
+ \tl_put_right:Nn \l__xparse_process_one_tl { {#1} }
\__xparse_prepare_signature_bypass:N
}
-\cs_new_protected:Npn \__xparse_add_type_d:w #1#2
- { \exp_args:NNNo \__xparse_add_type_D:w #1 #2 \c__xparse_no_value_tl }
\cs_new_protected:Npn \__xparse_add_type_D:w #1#2#3
{
\__xparse_flush_m_args:
+ \__xparse_add_default:n {#3}
\__xparse_add_grabber_optional:N D
- \tl_put_right:Nn \l__xparse_signature_tl { #1 #2 {#3} }
+ \tl_put_right:Nn \l__xparse_signature_tl { #1 #2 }
\__xparse_prepare_signature:N
}
-\cs_new_protected:Npn \__xparse_add_type_e:w #1
- { \__xparse_add_type_E:w {#1} { } }
\cs_new_protected:Npn \__xparse_add_type_E:w #1#2
{
\__xparse_flush_m_args:
+ \__xparse_add_default_E:nn {#1} {#2}
\__xparse_add_grabber_optional:N E
- \tl_put_right:Nn \l__xparse_signature_tl { {#1} {#2} }
+ \tl_put_right:Nn \l__xparse_signature_tl { {#1} }
\__xparse_prepare_signature:N
}
-\cs_new_protected:Npn \__xparse_add_type_g:w
- { \exp_args:No \__xparse_add_type_G:w \c__xparse_no_value_tl }
\cs_new_protected:Npn \__xparse_add_type_G:w #1
{
\__xparse_flush_m_args:
+ \__xparse_add_default:n {#1}
\__xparse_add_grabber_optional:N G
- \tl_put_right:Nn \l__xparse_signature_tl { {#1} }
\__xparse_prepare_signature:N
}
\cs_new_protected:Npn \__xparse_add_type_l:w
{
\__xparse_flush_m_args:
+ \__xparse_add_default:
\__xparse_add_grabber_mandatory:N l
\__xparse_prepare_signature:N
}
\cs_new_protected:Npn \__xparse_add_type_m:w
{
- \bool_if:nTF { \l__xparse_long_bool || \l__xparse_processor_bool }
- {
- \__xparse_flush_m_args:
- \__xparse_add_grabber_mandatory:N m
- }
+ \__xparse_add_default:
+ \bool_if:NTF \l__xparse_prefixed_bool
+ { \__xparse_add_grabber_mandatory:N m }
{ \int_incr:N \l__xparse_m_args_int }
\__xparse_prepare_signature:N
}
-\cs_new_protected:Npn \__xparse_add_type_r:w #1#2
- { \exp_args:NNNo \__xparse_add_type_R:w #1 #2 \c__xparse_no_value_tl }
\cs_new_protected:Npn \__xparse_add_type_R:w #1#2#3
{
\__xparse_flush_m_args:
+ \__xparse_add_default:n {#3}
\__xparse_add_grabber_mandatory:N R
- \tl_put_right:Nn \l__xparse_signature_tl { #1 #2 {#3} }
+ \tl_put_right:Nn \l__xparse_signature_tl { #1 #2 }
\__xparse_prepare_signature:N
}
\cs_new_protected:Npn \__xparse_add_type_t:w #1
{
\__xparse_flush_m_args:
+ \__xparse_add_default:
\__xparse_add_grabber_optional:N t
\tl_put_right:Nn \l__xparse_signature_tl {#1}
\__xparse_prepare_signature:N
@@ -423,6 +671,7 @@
\cs_new_protected:Npn \__xparse_add_type_u:w #1
{
\__xparse_flush_m_args:
+ \__xparse_add_default:
\__xparse_add_grabber_mandatory:N u
\tl_put_right:Nn \l__xparse_signature_tl { {#1} }
\__xparse_prepare_signature:N
@@ -430,6 +679,7 @@
\cs_new_protected:Npn \__xparse_add_type_v:w
{
\__xparse_flush_m_args:
+ \exp_args:No \__xparse_add_default:n \c__xparse_no_value_tl
\__xparse_add_grabber_mandatory:N v
\__xparse_prepare_signature:N
}
@@ -440,6 +690,8 @@
\tl_put_right:Nx \l__xparse_signature_tl
{ \exp_not:c { __xparse_grab_m_ \int_use:N \l__xparse_m_args_int :w } }
\int_sub:Nn \l__xparse_mandatory_args_int { \l__xparse_m_args_int }
+ \tl_put_right:Nx \l__xparse_process_all_tl
+ { \prg_replicate:nn { \l__xparse_m_args_int } { { } } }
}
\int_zero:N \l__xparse_m_args_int
}
@@ -451,6 +703,9 @@
{ __xparse_grab_ #1 \bool_if:NT \l__xparse_long_bool { _long } :w }
}
\bool_set_false:N \l__xparse_long_bool
+ \tl_put_right:Nx \l__xparse_process_all_tl
+ { { \exp_not:o \l__xparse_process_one_tl } }
+ \tl_clear:N \l__xparse_process_one_tl
\int_decr:N \l__xparse_mandatory_args_int
}
\cs_new_protected:Npn \__xparse_add_grabber_optional:N #1
@@ -467,231 +722,229 @@
}
}
\bool_set_false:N \l__xparse_long_bool
+ \tl_put_right:Nx \l__xparse_process_all_tl
+ { { \exp_not:o \l__xparse_process_one_tl } }
+ \tl_clear:N \l__xparse_process_one_tl
}
-\cs_new_protected:cpn { __xparse_add_expandable_type_+:w }
+\cs_new_protected:Npn \__xparse_add_default:n #1
{
- \bool_set_true:N \l__xparse_long_bool
- \int_compare:nNnTF \l__xparse_current_arg_int = \c_one
- { \bool_set_true:N \l__xparse_all_long_bool }
+ \bool_set_true:N \l__xparse_defaults_bool
+ \tl_put_right:Nn \l__xparse_defaults_tl { { . #1} }
+ }
+\cs_new_protected:Npn \__xparse_add_default:
+ { \tl_put_right:Nn \l__xparse_defaults_tl { . } }
+\cs_new_protected:Npn \__xparse_add_default_E:nn #1#2
+ {
+ \bool_set_true:N \l__xparse_defaults_bool
+ \tl_set:Nx \l__xparse_tmpa_tl
{
- \bool_if:NF \l__xparse_all_long_bool
- { \__msg_kernel_error:nn { xparse } { inconsistent-long } }
+ \exp_not:n {#2}
+ \prg_replicate:nn
+ { \tl_count:n {#1} - \tl_count:n {#2} }
+ { { \c__xparse_no_value_tl } }
+ }
+ \tl_put_right:Nx \l__xparse_defaults_tl
+ {
+ {
+ \exp_not:f
+ { \exp_after:wN \__xparse_add_default_E_aux:n \l__xparse_tmpa_tl }
+ }
}
- \int_decr:N \l__xparse_current_arg_int
- \__xparse_prepare_signature:N
}
-\cs_new_protected:cpn { __xparse_add_expandable_type_>:w } #1
+\cs_new:Npn \__xparse_add_default_E_aux:n #1 { {#1} }
+\cs_new_protected:cpn { __xparse_add_expandable_type_+:w }
{
- \__msg_kernel_error:nnx { xparse } { processor-in-expandable }
- { \token_to_str:c { \l__xparse_function_tl } }
+ \bool_set_true:N \l__xparse_long_bool
\int_decr:N \l__xparse_current_arg_int
\__xparse_prepare_signature:N
}
-\cs_new_protected:Npn \__xparse_add_expandable_type_d:w #1#2
- {
- \exp_args:NNNo
- \__xparse_add_expandable_type_D:w #1 #2 \c__xparse_no_value_tl
- }
-\cs_new_protected:Npn \__xparse_add_expandable_type_D:w #1#2
+\cs_new_protected:Npn \__xparse_add_expandable_type_D:w
+ { \__xparse_add_expandable_type_D_aux:NNNn D }
+\cs_new_protected:Npn \__xparse_add_expandable_type_D_aux:NNNn #1#2#3#4
{
- \tl_if_eq:nnTF {#1} {#2}
- {
- \__xparse_add_expandable_grabber_optional:n { D_alt }
- \__xparse_add_expandable_type_D_aux:Nn #1
- }
- {
- \__xparse_add_expandable_grabber_optional:n { D }
- \__xparse_add_expandable_type_D_aux:NNn #1#2
- }
+ \__xparse_add_default:n {#4}
+ \tl_if_eq:nnTF {#2} {#3}
+ { \__xparse_add_expandable_type_D_aux:NN #1 #2 }
+ { \__xparse_add_expandable_type_D_aux:NNN #1 #2 #3 }
+ \bool_set_false:N \l__xparse_long_bool
+ \__xparse_prepare_signature:N
}
-\cs_new_protected:Npn \__xparse_add_expandable_type_D_aux:NNn #1#2#3
+\cs_new_protected:Npn \__xparse_add_expandable_type_D_aux:NNN #1#2#3
{
+ \__xparse_add_expandable_grabber:n {#1}
\bool_if:NTF \l__xparse_all_long_bool
{ \cs_set:cpx }
{ \cs_set_nopar:cpx }
- { \l__xparse_expandable_aux_name_tl } ##1 ##2 #1 ##3 \q__xparse ##4 #2
+ { \l__xparse_expandable_aux_name_tl } ##1 ##2 #2 ##3 \q__xparse ##4 #3
{ ##1 {##2} {##3} {##4} }
\tl_put_right:Nx \l__xparse_signature_tl
{
\exp_not:c { \l__xparse_expandable_aux_name_tl }
- \exp_not:n { #1 #2 {#3} }
+ \exp_not:n { #2 #3 }
}
- \bool_set_false:N \l__xparse_long_bool
- \__xparse_prepare_signature:N
}
-\cs_new_protected:Npn \__xparse_add_expandable_type_D_aux:Nn #1#2
+\cs_new_protected:Npn \__xparse_add_expandable_type_D_aux:NN #1#2
{
+ \__xparse_add_expandable_grabber:n { #1_alt }
\bool_if:NTF \l__xparse_all_long_bool
{ \cs_set:cpx }
{ \cs_set_nopar:cpx }
- { \l__xparse_expandable_aux_name_tl } ##1 #1 ##2 #1
+ { \l__xparse_expandable_aux_name_tl } ##1 #2 ##2 #2
{ ##1 {##2} }
\tl_put_right:Nx \l__xparse_signature_tl
{
\exp_not:c { \l__xparse_expandable_aux_name_tl }
- \exp_not:n { #1 {#2} }
+ \exp_not:n {#2}
}
- \bool_set_false:N \l__xparse_long_bool
- \__xparse_prepare_signature:N
}
-\cs_new_protected:Npn \__xparse_add_expandable_type_g:w
+\cs_new_protected:Npn \__xparse_add_expandable_type_E:w #1#2
{
- \__msg_kernel_error:nnx { xparse } { invalid-expandable-argument-type }
- { g }
- \__xparse_add_expandable_type_m:w
- }
-\cs_new_protected:Npn \__xparse_add_expandable_type_G:w #1
- {
- \__msg_kernel_error:nnx { xparse } { invalid-expandable-argument-type }
- { G }
- \__xparse_add_expandable_type_m:w
- }
-\cs_new_protected:Npn \__xparse_add_expandable_type_l:w
- {
- \__msg_kernel_error:nnx { xparse } { invalid-expandable-argument-type }
- { l }
- \__xparse_add_expandable_type_m:w
- }
-\cs_new_protected:Npn \__xparse_add_expandable_type_m:w
- {
- \int_incr:N \l__xparse_m_args_int
- \__xparse_add_expandable_grabber_mandatory:n { m }
+ \__xparse_add_default_E:nn {#1} {#2}
+ \__xparse_add_expandable_grabber:n { E }
+ \tl_clear:N \l__xparse_tmpb_tl
+ \tl_map_function:nN {#1} \__xparse_add_expandable_type_E_aux:n
+ \tl_put_right:Nx \l__xparse_signature_tl
+ {
+ { \exp_not:o \l__xparse_tmpb_tl }
+ {
+ \prg_replicate:nn { \tl_count:n {#1} }
+ { { \c__xparse_no_value_tl } }
+ }
+ }
\bool_set_false:N \l__xparse_long_bool
\__xparse_prepare_signature:N
}
-\cs_new_protected:Npn \__xparse_add_expandable_type_r:w #1#2
+\cs_new_protected:Npn \__xparse_add_expandable_type_E_aux:n #1
{
- \exp_args:NNNo
- \__xparse_add_expandable_type_R:w #1 #2 \c__xparse_no_value_tl
+ \__xparse_get_grabber:NN #1 \l__xparse_tmpa_tl
+ \tl_put_right:Nx \l__xparse_tmpb_tl
+ { \exp_not:o \l__xparse_tmpa_tl \exp_not:N #1 }
}
-\cs_new_protected:Npn \__xparse_add_expandable_type_R:w #1#2
+\cs_new_protected:Npn \__xparse_add_expandable_type_m:w
{
- \tl_if_eq:nnTF {#1} {#2}
- {
- \__xparse_add_expandable_grabber_mandatory:n { R_alt }
- \__xparse_add_expandable_type_D_aux:Nn #1
- }
- {
- \__xparse_add_expandable_grabber_mandatory:n { R }
- \__xparse_add_expandable_type_D_aux:NNn #1#2
- }
+ \__xparse_add_default:
+ \__xparse_add_expandable_grabber:n { m }
+ \__xparse_prepare_signature:N
}
+\cs_new_protected:Npn \__xparse_add_expandable_type_R:w
+ { \__xparse_add_expandable_type_D_aux:NNNn R }
\cs_new_protected:Npn \__xparse_add_expandable_type_t:w #1
{
- \__xparse_add_expandable_grabber_optional:n { t }
- \bool_if:NTF \l__xparse_all_long_bool
- { \cs_set:cpn }
- { \cs_set_nopar:cpn }
- { \l__xparse_expandable_aux_name_tl } ##1 #1 {##1}
+ \__xparse_add_default:
+ \__xparse_add_expandable_grabber_t:
+ \__xparse_get_grabber:NN #1 \l__xparse_tmpa_tl
\tl_put_right:Nx \l__xparse_signature_tl
{
- \exp_not:c { \l__xparse_expandable_aux_name_tl }
+ \exp_not:o \l__xparse_tmpa_tl
\exp_not:N #1
}
\bool_set_false:N \l__xparse_long_bool
\__xparse_prepare_signature:N
}
-\cs_new_protected:Npn \__xparse_add_expandable_type_u:w #1
- {
- \__msg_kernel_error:nnx { xparse } { invalid-expandable-argument-type }
- { u }
- \__xparse_add_expandable_type_m:w
- }
-\cs_new_protected:Npn \__xparse_add_expandable_type_v:w
+\cs_new_protected:Npn \__xparse_add_expandable_grabber:n #1
{
- \__msg_kernel_error:nnx { xparse } { invalid-expandable-argument-type }
- { v }
- \__xparse_add_expandable_type_m:w
- }
-\cs_new_protected:Npn \__xparse_add_expandable_grabber_mandatory:n #1
- {
- \__xparse_add_expandable_long_check:
+ \bool_if:NTF \l__xparse_all_long_set_bool
+ {
+ \bool_if:nT
+ { \bool_xor_p:nn { \l__xparse_all_long_bool } { \l__xparse_long_bool } }
+ {
+ \__msg_kernel_error:nnx { xparse } { inconsistent-long }
+ { \iow_char:N \\ \l__xparse_function_tl }
+ \__xparse_bad_def:wn
+ }
+ }
+ {
+ \bool_set:Nn \l__xparse_all_long_bool { \l__xparse_long_bool }
+ \bool_set_true:N \l__xparse_all_long_set_bool
+ }
\tl_put_right:Nx \l__xparse_signature_tl
{ \exp_not:c { __xparse_expandable_grab_ #1 :w } }
\bool_set_false:N \l__xparse_long_bool
- \int_decr:N \l__xparse_mandatory_args_int
}
-\cs_new_protected:Npn \__xparse_add_expandable_grabber_optional:n #1
+\cs_new_protected:Npn \__xparse_add_expandable_grabber_t:
{
- \__xparse_add_expandable_long_check:
- \int_compare:nNnF \l__xparse_mandatory_args_int > \c_zero
- { \__msg_kernel_error:nn { xparse } { expandable-ending-optional } }
- \tl_put_right:Nx \l__xparse_signature_tl
- { \exp_not:c { __xparse_expandable_grab_ #1 :w } }
+ \tl_put_right:Nn \l__xparse_signature_tl
+ { \__xparse_expandable_grab_t:w }
\bool_set_false:N \l__xparse_long_bool
}
-\cs_new_protected:Npn \__xparse_add_expandable_long_check:
+\cs_new_protected:Npn \__xparse_get_grabber:NN #1#2
{
- \bool_if:nT { \l__xparse_all_long_bool && ! \l__xparse_long_bool }
- { \__msg_kernel_error:nn { xparse } { inconsistent-long } }
+ \cs_set:Npn \__xparse_tmp:w ##1 #1 {##1}
+ \exp_args:Nc \__xparse_get_grabber_auxi:NN
+ { __xparse_grabber_ \token_to_str:N #1 :w } #2
}
-\cs_new_protected:Npn \__xparse_grab_arg:w { }
-\cs_new_protected:Npn \__xparse_grab_arg_auxi:w { }
-\cs_new_protected:Npn \__xparse_grab_arg_auxii:w { }
-\cs_new_protected:Npn \__xparse_grab_D:w #1#2#3#4 \l__xparse_args_tl
+\cs_new_protected:Npn \__xparse_get_grabber_auxi:NN #1#2
{
- \__xparse_grab_D_aux:NNnnNn #1 #2 {#3} {#4} \cs_set_protected_nopar:Npn
+ \cs_if_eq:NNTF \__xparse_tmp:w #1
+ { \tl_set:Nn #2 {#1} }
+ {
+ \cs_if_exist:NTF #1
+ {
+ \int_gincr:N \g__xparse_grabber_int
+ \exp_args:Nc \__xparse_get_grabber_auxi:NN
+ {
+ __xparse_grabber_
+ - \int_use:N \g__xparse_grabber_int :w
+ }
+ #2
+ }
+ { \__xparse_get_grabber_auxii:NN #1 #2 }
+ }
+ }
+\cs_new_protected:Npn \__xparse_get_grabber_auxii:NN #1#2
+ {
+ \cs_set_eq:NN #1 \__xparse_tmp:w
+ \tl_set:Nn #2 {#1}
+ }
+\cs_new_protected:Npn \__xparse_grab_D:w #1#2#3 \__xparse_run_code:
+ {
+ \__xparse_grab_D_aux:NNnNn #1 #2 {#3} \cs_set_protected_nopar:Npn
{ _ignore_spaces }
}
-\cs_new_protected:Npn \__xparse_grab_D_long:w #1#2#3#4 \l__xparse_args_tl
+\cs_new_protected:Npn \__xparse_grab_D_long:w #1#2#3 \__xparse_run_code:
{
- \__xparse_grab_D_aux:NNnnNn #1 #2 {#3} {#4} \cs_set_protected:Npn
+ \__xparse_grab_D_aux:NNnNn #1 #2 {#3} \cs_set_protected:Npn
{ _ignore_spaces }
}
-\cs_new_protected:Npn \__xparse_grab_D_trailing:w #1#2#3#4 \l__xparse_args_tl
- { \__xparse_grab_D_aux:NNnnNn #1 #2 {#3} {#4} \cs_set_protected_nopar:Npn { } }
-\cs_new_protected:Npn \__xparse_grab_D_long_trailing:w #1#2#3#4 \l__xparse_args_tl
- { \__xparse_grab_D_aux:NNnnNn #1 #2 {#3} {#4} \cs_set_protected:Npn { } }
-\cs_new_protected:Npn \__xparse_grab_D_aux:NNnnNn #1#2#3#4#5#6
+\cs_new_protected:Npn \__xparse_grab_D_trailing:w #1#2#3 \__xparse_run_code:
+ { \__xparse_grab_D_aux:NNnNn #1 #2 {#3} \cs_set_protected_nopar:Npn { } }
+\cs_new_protected:Npn \__xparse_grab_D_long_trailing:w #1#2#3 \__xparse_run_code:
+ { \__xparse_grab_D_aux:NNnNn #1 #2 {#3} \cs_set_protected:Npn { } }
+\cs_new_protected:Npn \__xparse_grab_D_aux:NNnNn #1#2#3#4#5
{
- \__xparse_grab_D_aux:NNnN #1#2 {#4} #5
- \use:c { peek_meaning_remove #6 :NTF } #1
- { \__xparse_grab_arg:w }
- {
- \__xparse_add_arg:n {#3}
- #4 \l__xparse_args_tl
- }
+ \__xparse_grab_D_aux:NNnN #1#2 {#3} #4
+ \use:c { peek_meaning_remove #5 :NTF } #1
+ { \__xparse_grab_D_call:Nw #1 }
+ { \__xparse_add_arg:o \c__xparse_no_value_tl }
}
\cs_new_protected:Npn \__xparse_grab_D_aux:NNnN #1#2#3#4
{
- \cs_set_protected_nopar:Npn \__xparse_grab_arg:w
+ \tl_set:Nn \l__xparse_signature_tl {#3}
+ \exp_after:wN #4 \l__xparse_fn_tl ##1 #2
{
- \exp_after:wN #4 \l__xparse_fn_tl ####1 #2
+ \tl_if_in:nnTF {##1} {#1}
+ { \__xparse_grab_D_nested:NNnN #1 #2 {##1} #4 }
{
- \tl_if_in:nnTF {####1} {#1}
- { \__xparse_grab_D_nested:NNnnN #1 #2 {####1} {#3} #4 }
+ \tl_if_blank:oTF { \use_none:n ##1 }
+ { \__xparse_add_arg:o { \use_none:n ##1 } }
{
- \tl_if_blank:oTF { \use_none:n ####1 }
- { \__xparse_add_arg:o { \use_none:n ####1 } }
- {
- \str_if_eq_x:nnTF
- { \exp_not:o { \use_none:n ####1 } }
- { { \exp_not:o { \use_ii:nnn ####1 \q_nil } } }
- { \__xparse_add_arg:o { \use_ii:nn ####1 } }
- { \__xparse_add_arg:o { \use_none:n ####1 } }
- }
- #3 \l__xparse_args_tl
+ \str_if_eq_x:nnTF
+ { \exp_not:o { \use_none:n ##1 } }
+ { { \exp_not:o { \use_ii:nnn ##1 \q_nil } } }
+ { \__xparse_add_arg:o { \use_ii:nn ##1 } }
+ { \__xparse_add_arg:o { \use_none:n ##1 } }
}
}
- \token_if_eq_catcode:NNTF + #1
- {
- \exp_after:wN \exp_after:wN \exp_after:wN
- \l__xparse_fn_tl \char_generate:nn { `#1 } { 11 }
- }
- {
- \exp_after:wN \l__xparse_fn_tl
- \token_to_str:N #1
- }
}
}
\tl_new:N \l__xparse_nesting_a_tl
\tl_new:N \l__xparse_nesting_b_tl
\quark_new:N \q__xparse
-\cs_new_protected:Npn \__xparse_grab_D_nested:NNnnN #1#2#3#4#5
+\cs_new_protected:Npn \__xparse_grab_D_nested:NNnN #1#2#3#4
{
\tl_clear:N \l__xparse_nesting_a_tl
\tl_clear:N \l__xparse_nesting_b_tl
- \exp_after:wN #5 \l__xparse_fn_tl ##1 #1 ##2 \q__xparse ##3 #2
+ \exp_after:wN #4 \l__xparse_fn_tl ##1 #1 ##2 \q__xparse ##3 #2
{
\tl_put_right:No \l__xparse_nesting_a_tl { \use_none:n ##1 #1 }
\tl_put_right:No \l__xparse_nesting_b_tl { \use_i:nn #2 ##3 }
@@ -714,7 +967,6 @@
\tl_put_right:No \l__xparse_nesting_a_tl
\l__xparse_nesting_b_tl
\__xparse_add_arg:V \l__xparse_nesting_a_tl
- #4 \l__xparse_args_tl
}
}
}
@@ -722,44 +974,51 @@
}
\cs_new:Npn \__xparse_grab_D_nested:w #1 \q_nil \q_stop
{ \exp_not:o { \use_none:n #1 } }
-\cs_new_protected:Npn \__xparse_grab_E:w #1#2#3 \l__xparse_args_tl
+\cs_set_protected_nopar:Npn \__xparse_grab_D_call:Nw #1
{
- \__xparse_grab_E:nnnNn
- {#1} {#2} {#3}
+ \token_if_eq_catcode:NNTF + #1
+ {
+ \exp_after:wN \exp_after:wN \exp_after:wN
+ \l__xparse_fn_tl \char_generate:nn { `#1 } { 11 }
+ }
+ {
+ \exp_after:wN \l__xparse_fn_tl
+ \token_to_str:N #1
+ }
+ }
+\cs_new_protected:Npn \__xparse_grab_E:w #1#2 \__xparse_run_code:
+ {
+ \__xparse_grab_E:nnNn {#1} {#2}
\cs_set_protected_nopar:Npn
{ _ignore_spaces }
}
-\cs_new_protected:Npn \__xparse_grab_E_long:w #1#2#3 \l__xparse_args_tl
+\cs_new_protected:Npn \__xparse_grab_E_long:w #1#2 \__xparse_run_code:
{
- \__xparse_grab_E:nnnNn
- {#1} {#2} {#3}
+ \__xparse_grab_E:nnNn {#1} {#2}
\cs_set_protected:Npn
{ _ignore_spaces }
}
-\cs_new_protected:Npn \__xparse_grab_E_trailing:w #1#2#3 \l__xparse_args_tl
+\cs_new_protected:Npn \__xparse_grab_E_trailing:w #1#2 \__xparse_run_code:
{
- \__xparse_grab_E:nnnNn
- {#1} {#2} {#3}
+ \__xparse_grab_E:nnNn {#1} {#2}
\cs_set_protected_nopar:Npn
{ }
}
-\cs_new_protected:Npn \__xparse_grab_E_long_trailing:w #1#2#3 \l__xparse_args_tl
+\cs_new_protected:Npn \__xparse_grab_E_long_trailing:w #1#2 \__xparse_run_code:
{
- \__xparse_grab_E:nnnNn
- {#1} {#2} {#3}
+ \__xparse_grab_E:nnNn {#1} {#2}
\cs_set_protected:Npn
{ }
}
-\cs_new_protected:Npn \__xparse_grab_E:nnnNn #1#2#3#4#5
+\cs_new_protected:Npn \__xparse_grab_E:nnNn #1#2#3#4
{
- \exp_after:wN #4 \l__xparse_fn_tl ##1##2##3
+ \exp_after:wN #3 \l__xparse_fn_tl ##1##2##3
{
\prop_put:Nnn \l__xparse_tmp_prop {##1} {##3}
- \__xparse_grab_E_loop:nnN {#5} { } ##2 \q_recursion_stop
+ \__xparse_grab_E_loop:nnN {#4} { } ##2 \q_recursion_stop
}
\prop_clear:N \l__xparse_tmp_prop
- \__xparse_grab_E_setup:Nw
- #1 \q_recursion_tail \q_mark #2 \q_recursion_tail \q_recursion_stop
+ \tl_set:Nn \l__xparse_signature_tl {#2}
\cs_set_protected:Npn \__xparse_grab_E_finalise:
{
\tl_clear:N \l__xparse_tmpa_tl
@@ -774,16 +1033,8 @@
}
}
\__xparse_add_arg:V \l__xparse_tmpa_tl
- #3 \l__xparse_args_tl
}
- \__xparse_grab_E_loop:nnN {#5} { } #1 \q_recursion_tail \q_recursion_stop
- }
-\cs_new_protected:Npn \__xparse_grab_E_setup:Nw #1#2 \q_mark #3
- {
- \quark_if_recursion_tail_stop:N #1
- \quark_if_recursion_tail_stop:n {#3}
- \prop_put:Nnn \l__xparse_tmp_prop {#1} {#3}
- \__xparse_grab_E_setup:Nw #2 \q_mark
+ \__xparse_grab_E_loop:nnN {#4} { } #1 \q_recursion_tail \q_recursion_stop
}
\cs_new_protected:Npn \__xparse_grab_E_loop:nnN #1#2#3#4 \q_recursion_stop
{
@@ -796,203 +1047,156 @@
}
}
\cs_new_protected:Npn \__xparse_grab_E_finalise: { }
-\cs_new_protected:Npn \__xparse_grab_G:w #1#2 \l__xparse_args_tl
+\cs_new_protected:Npn \__xparse_grab_G:w #1 \__xparse_run_code:
{
- \__xparse_grab_G_aux:nnNn {#1} {#2} \cs_set_protected_nopar:Npn
+ \__xparse_grab_G_aux:nNn {#1} \cs_set_protected_nopar:Npn
{ _ignore_spaces }
}
-\cs_new_protected:Npn \__xparse_grab_G_long:w #1#2 \l__xparse_args_tl
+\cs_new_protected:Npn \__xparse_grab_G_long:w #1 \__xparse_run_code:
{
- \__xparse_grab_G_aux:nnNn {#1} {#2} \cs_set_protected:Npn { _ignore_spaces }
+ \__xparse_grab_G_aux:nNn {#1} \cs_set_protected:Npn { _ignore_spaces }
}
-\cs_new_protected:Npn \__xparse_grab_G_trailing:w #1#2 \l__xparse_args_tl
- { \__xparse_grab_G_aux:nnNn {#1} {#2} \cs_set_protected_nopar:Npn { } }
-\cs_new_protected:Npn \__xparse_grab_G_long_trailing:w #1#2 \l__xparse_args_tl
- { \__xparse_grab_G_aux:nnNn {#1} {#2} \cs_set_protected:Npn { } }
-\cs_new_protected:Npn \__xparse_grab_G_aux:nnNn #1#2#3#4
+\cs_new_protected:Npn \__xparse_grab_G_trailing:w #1 \__xparse_run_code:
+ { \__xparse_grab_G_aux:nNn {#1} \cs_set_protected_nopar:Npn { } }
+\cs_new_protected:Npn \__xparse_grab_G_long_trailing:w #1 \__xparse_run_code:
+ { \__xparse_grab_G_aux:nNn {#1} \cs_set_protected:Npn { } }
+\cs_new_protected:Npn \__xparse_grab_G_aux:nNn #1#2#3
{
- \exp_after:wN #3 \l__xparse_fn_tl ##1
- {
- \__xparse_add_arg:n {##1}
- #2 \l__xparse_args_tl
- }
- \use:c { peek_meaning #4 :NTF } \c_group_begin_token
+ \tl_set:Nn \l__xparse_signature_tl {#1}
+ \exp_after:wN #2 \l__xparse_fn_tl ##1
+ { \__xparse_add_arg:n {##1} }
+ \use:c { peek_meaning #3 :NTF } \c_group_begin_token
{ \l__xparse_fn_tl }
- {
- \__xparse_add_arg:n {#1}
- #2 \l__xparse_args_tl
- }
+ { \__xparse_add_arg:o \c__xparse_no_value_tl }
}
-\cs_new_protected:Npn \__xparse_grab_l:w #1 \l__xparse_args_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 \l__xparse_args_tl
+\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}
- #1 \l__xparse_args_tl
- }
+ { \__xparse_add_arg:n {##1} }
\l__xparse_fn_tl
}
-\cs_new_protected:Npn \__xparse_grab_m:w #1 \l__xparse_args_tl
+\cs_new_protected:Npn \__xparse_grab_m:w #1 \__xparse_run_code:
{
+ \tl_set:Nn \l__xparse_signature_tl {#1}
\exp_after:wN \cs_set_protected_nopar:Npn \l__xparse_fn_tl ##1
- {
- \__xparse_add_arg:n {##1}
- #1 \l__xparse_args_tl
- }
+ { \__xparse_add_arg:n {##1} }
\l__xparse_fn_tl
}
-\cs_new_protected:Npn \__xparse_grab_m_long:w #1 \l__xparse_args_tl
+\cs_new_protected:Npn \__xparse_grab_m_long:w #1 \__xparse_run_code:
{
+ \tl_set:Nn \l__xparse_signature_tl {#1}
\exp_after:wN \cs_set_protected:Npn \l__xparse_fn_tl ##1
- {
- \__xparse_add_arg:n {##1}
- #1 \l__xparse_args_tl
- }
+ { \__xparse_add_arg:n {##1} }
\l__xparse_fn_tl
}
-\cs_new_protected:cpn { __xparse_grab_m_1:w } #1 \l__xparse_args_tl
+\cs_new_protected_nopar:Npn \__xparse_grab_m_aux:Nnnnnnnnn #1#2#3#4#5#6#7#8#9
{
- \exp_after:wN \cs_set_protected_nopar:Npn \l__xparse_fn_tl ##1
- {
- \tl_put_right:Nn \l__xparse_args_tl { {##1} }
- #1 \l__xparse_args_tl
- }
- \l__xparse_fn_tl
+ \tl_put_right:No \l__xparse_args_tl
+ { #1 {#2} {#3} {#4} {#5} {#6} {#7} {#8} {#9} }
+ \l__xparse_signature_tl \__xparse_run_code:
}
-\cs_new_protected:cpn { __xparse_grab_m_2:w } #1 \l__xparse_args_tl
+\cs_new_protected:cpn { __xparse_grab_m_1:w } #1 \__xparse_run_code:
{
- \exp_after:wN \cs_set_protected_nopar:Npn \l__xparse_fn_tl
- ##1##2
- {
- \tl_put_right:Nn \l__xparse_args_tl { {##1} {##2} }
- #1 \l__xparse_args_tl
- }
- \l__xparse_fn_tl
+ \tl_set:Nn \l__xparse_signature_tl {#1}
+ \exp_after:wN \cs_set_eq:NN \l__xparse_fn_tl \__xparse_grab_m_aux:Nnnnnnnnn
+ \l__xparse_fn_tl \use_none:nnnnnnn { } { } { } { } { } { } { }
}
-\cs_new_protected:cpn { __xparse_grab_m_3:w } #1 \l__xparse_args_tl
+\cs_new_protected:cpn { __xparse_grab_m_2:w } #1 \__xparse_run_code:
{
- \exp_after:wN \cs_set_protected_nopar:Npn \l__xparse_fn_tl
- ##1##2##3
- {
- \tl_put_right:Nn \l__xparse_args_tl { {##1} {##2} {##3} }
- #1 \l__xparse_args_tl
- }
- \l__xparse_fn_tl
+ \tl_set:Nn \l__xparse_signature_tl {#1}
+ \exp_after:wN \cs_set_eq:NN \l__xparse_fn_tl \__xparse_grab_m_aux:Nnnnnnnnn
+ \l__xparse_fn_tl \use_none:nnnnnn { } { } { } { } { } { }
}
-\cs_new_protected:cpn { __xparse_grab_m_4:w } #1 \l__xparse_args_tl
+\cs_new_protected:cpn { __xparse_grab_m_3:w } #1 \__xparse_run_code:
{
- \exp_after:wN \cs_set_protected_nopar:Npn \l__xparse_fn_tl
- ##1##2##3##4
- {
- \tl_put_right:Nn \l__xparse_args_tl { {##1} {##2} {##3} {##4} }
- #1 \l__xparse_args_tl
- }
- \l__xparse_fn_tl
+ \tl_set:Nn \l__xparse_signature_tl {#1}
+ \exp_after:wN \cs_set_eq:NN \l__xparse_fn_tl \__xparse_grab_m_aux:Nnnnnnnnn
+ \l__xparse_fn_tl \use_none:nnnnn { } { } { } { } { }
}
-\cs_new_protected:cpn { __xparse_grab_m_5:w } #1 \l__xparse_args_tl
+\cs_new_protected:cpn { __xparse_grab_m_4:w } #1 \__xparse_run_code:
{
- \exp_after:wN \cs_set_protected_nopar:Npn \l__xparse_fn_tl
- ##1##2##3##4##5
- {
- \tl_put_right:Nn \l__xparse_args_tl { {##1} {##2} {##3} {##4} {##5} }
- #1 \l__xparse_args_tl
- }
- \l__xparse_fn_tl
+ \tl_set:Nn \l__xparse_signature_tl {#1}
+ \exp_after:wN \cs_set_eq:NN \l__xparse_fn_tl \__xparse_grab_m_aux:Nnnnnnnnn
+ \l__xparse_fn_tl \use_none:nnnn { } { } { } { }
}
-\cs_new_protected:cpn { __xparse_grab_m_6:w } #1 \l__xparse_args_tl
+\cs_new_protected:cpn { __xparse_grab_m_5:w } #1 \__xparse_run_code:
{
- \exp_after:wN \cs_set_protected_nopar:Npn \l__xparse_fn_tl
- ##1##2##3##4##5##6
- {
- \tl_put_right:Nn \l__xparse_args_tl
- { {##1} {##2} {##3} {##4} {##5} {##6} }
- #1 \l__xparse_args_tl
- }
- \l__xparse_fn_tl
+ \tl_set:Nn \l__xparse_signature_tl {#1}
+ \exp_after:wN \cs_set_eq:NN \l__xparse_fn_tl \__xparse_grab_m_aux:Nnnnnnnnn
+ \l__xparse_fn_tl \use_none:nnn { } { } { }
}
-\cs_new_protected:cpn { __xparse_grab_m_7:w } #1 \l__xparse_args_tl
+\cs_new_protected:cpn { __xparse_grab_m_6:w } #1 \__xparse_run_code:
{
- \exp_after:wN \cs_set_protected_nopar:Npn \l__xparse_fn_tl
- ##1##2##3##4##5##6##7
- {
- \tl_put_right:Nn \l__xparse_args_tl
- { {##1} {##2} {##3} {##4} {##5} {##6} {##7} }
- #1 \l__xparse_args_tl
- }
- \l__xparse_fn_tl
+ \tl_set:Nn \l__xparse_signature_tl {#1}
+ \exp_after:wN \cs_set_eq:NN \l__xparse_fn_tl \__xparse_grab_m_aux:Nnnnnnnnn
+ \l__xparse_fn_tl \use_none:nn { } { }
}
-\cs_new_protected:cpn { __xparse_grab_m_8:w } #1 \l__xparse_args_tl
+\cs_new_protected:cpn { __xparse_grab_m_7:w } #1 \__xparse_run_code:
{
- \exp_after:wN \cs_set_protected_nopar:Npn \l__xparse_fn_tl
- ##1##2##3##4##5##6##7##8
- {
- \tl_put_right:Nn \l__xparse_args_tl
- { {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8} }
- #1 \l__xparse_args_tl
- }
- \l__xparse_fn_tl
+ \tl_set:Nn \l__xparse_signature_tl {#1}
+ \exp_after:wN \cs_set_eq:NN \l__xparse_fn_tl \__xparse_grab_m_aux:Nnnnnnnnn
+ \l__xparse_fn_tl \use_none:n { }
}
-\cs_new_protected:Npn \__xparse_grab_R:w #1#2#3#4 \l__xparse_args_tl
- { \__xparse_grab_R_aux:NNnnN #1 #2 {#3} {#4} \cs_set_protected_nopar:Npn }
-\cs_new_protected:Npn \__xparse_grab_R_long:w #1#2#3#4 \l__xparse_args_tl
- { \__xparse_grab_R_aux:NNnnN #1 #2 {#3} {#4} \cs_set_protected:Npn }
-\cs_new_protected:Npn \__xparse_grab_R_aux:NNnnN #1#2#3#4#5
+\cs_new_protected:cpn { __xparse_grab_m_8:w } #1 \__xparse_run_code:
{
- \__xparse_grab_D_aux:NNnN #1 #2 {#4} #5
+ \tl_set:Nn \l__xparse_signature_tl {#1}
+ \exp_after:wN \cs_set_eq:NN \l__xparse_fn_tl \__xparse_grab_m_aux:Nnnnnnnnn
+ \l__xparse_fn_tl \prg_do_nothing:
+ }
+\cs_new_protected:cpx { __xparse_grab_m_9:w }
+ {
+ \exp_not:c { __xparse_grab_m_5:w }
+ \exp_not:c { __xparse_grab_m_4:w }
+ }
+\cs_new_protected:Npn \__xparse_grab_R:w #1#2#3 \__xparse_run_code:
+ { \__xparse_grab_R_aux:NNnN #1 #2 {#3} \cs_set_protected_nopar:Npn }
+\cs_new_protected:Npn \__xparse_grab_R_long:w #1#2#3 \__xparse_run_code:
+ { \__xparse_grab_R_aux:NNnN #1 #2 {#3} \cs_set_protected:Npn }
+\cs_new_protected:Npn \__xparse_grab_R_aux:NNnN #1#2#3#4
+ {
+ \__xparse_grab_D_aux:NNnN #1 #2 {#3} #4
\peek_meaning_remove_ignore_spaces:NTF #1
- { \__xparse_grab_arg:w }
+ { \__xparse_grab_D_call:Nw #1 }
{
\__msg_kernel_error:nnxx { xparse } { missing-required }
- { \token_to_str:N #1 } { \tl_to_str:n {#3} }
- \__xparse_add_arg:n {#3}
- #4 \l__xparse_args_tl
+ { \exp_after:wN \token_to_str:N \l__xparse_fn_tl }
+ { \token_to_str:N #1 }
+ \__xparse_add_arg:o \c__xparse_no_value_tl
}
}
-\cs_new_protected:Npn \__xparse_grab_t:w #1#2 \l__xparse_args_tl
+\cs_new_protected:Npn \__xparse_grab_t:w
+ { \__xparse_grab_t_aux:NNw \peek_meaning_remove_ignore_spaces:NTF }
+\cs_new_eq:NN \__xparse_grab_t_long:w \__xparse_grab_t:w
+\cs_new_protected:Npn \__xparse_grab_t_trailing:w
+ { \__xparse_grab_t_aux:NNw \peek_meaning_remove:NTF }
+\cs_new_eq:NN \__xparse_grab_t_long_trailing:w \__xparse_grab_t_trailing:w
+\cs_new_protected:Npn \__xparse_grab_t_aux:NNw #1#2#3 \__xparse_run_code:
{
- \__xparse_grab_t_aux:NnNn #1 {#2} \cs_set_protected_nopar:Npn
- { _ignore_spaces }
- }
-\cs_new_protected:Npn \__xparse_grab_t_long:w #1#2 \l__xparse_args_tl
- { \__xparse_grab_t_aux:NnNn #1 {#2} \cs_set_protected:Npn { _ignore_spaces } }
-\cs_new_protected:Npn \__xparse_grab_t_trailing:w #1#2 \l__xparse_args_tl
- { \__xparse_grab_t_aux:NnNn #1 {#2} \cs_set_protected_nopar:Npn { } }
-\cs_new_protected:Npn \__xparse_grab_t_long_trailing:w #1#2 \l__xparse_args_tl
- { \__xparse_grab_t_aux:NnNn #1 {#2} \cs_set_protected:Npn { } }
-\cs_new_protected:Npn \__xparse_grab_t_aux:NnNn #1#2#3#4
- {
- \exp_after:wN #3 \l__xparse_fn_tl
+ \tl_set:Nn \l__xparse_signature_tl {#3}
+ \exp_after:wN \cs_set_protected:Npn \l__xparse_fn_tl
{
- \use:c { peek_meaning_remove #4 :NTF } #1
- {
- \__xparse_add_arg:n { \BooleanTrue }
- #2 \l__xparse_args_tl
- }
- {
- \__xparse_add_arg:n { \BooleanFalse }
- #2 \l__xparse_args_tl
- }
+ #1 #2
+ { \__xparse_add_arg:n { \BooleanTrue } }
+ { \__xparse_add_arg:n { \BooleanFalse } }
}
\l__xparse_fn_tl
}
-\cs_new_protected:Npn \__xparse_grab_u:w #1#2 \l__xparse_args_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 \l__xparse_args_tl
+\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}
- #2 \l__xparse_args_tl
- }
+ { \__xparse_add_arg:n {##1} }
\l__xparse_fn_tl
}
-\tl_new:N \l__xparse_v_rest_of_signature_tl
\tl_new:N \l__xparse_v_arg_tl
\cs_new_protected:Npn \__xparse_grab_v:w
{
@@ -1004,9 +1208,9 @@
\bool_set_true:N \l__xparse_long_bool
\__xparse_grab_v_aux:w
}
-\cs_new_protected:Npn \__xparse_grab_v_aux:w #1 \l__xparse_args_tl
+\cs_new_protected:Npn \__xparse_grab_v_aux:w #1 \__xparse_run_code:
{
- \tl_set:Nn \l__xparse_v_rest_of_signature_tl {#1}
+ \tl_set:Nn \l__xparse_signature_tl {#1}
\group_begin:
\group_align_safe_begin:
\tex_escapechar:D = 92 \scan_stop:
@@ -1061,8 +1265,7 @@
\cs_new_protected:Npn \__xparse_grab_v_aux_loop_end:
{
\__xparse_grab_v_group_end:
- \exp_args:Nx \__xparse_add_arg:n { \tl_tail:N \l__xparse_v_arg_tl }
- \l__xparse_v_rest_of_signature_tl \l__xparse_args_tl
+ \__xparse_add_arg:x { \tl_tail:N \l__xparse_v_arg_tl }
}
\int_new:N \l__xparse_v_nesting_int
\cs_new_protected:Npx \__xparse_grab_v_bgroup:
@@ -1113,7 +1316,6 @@
\cs_new_protected:Npn \__xparse_grab_v_aux_abort:n #1
{
\__xparse_grab_v_group_end:
- \__xparse_add_arg:o \c__xparse_no_value_tl
\exp_after:wN \exp_after:wN \exp_after:wN
\peek_meaning_remove:NTF \char_generate:nn { \tex_endlinechar:D } { 6 }
{
@@ -1121,14 +1323,14 @@
{ \exp_after:wN \token_to_str:N \l__xparse_fn_tl }
{ \tl_to_str:N \l__xparse_v_arg_tl }
{ \tl_to_str:n {#1} }
- \l__xparse_v_rest_of_signature_tl \l__xparse_args_tl
+ \__xparse_add_arg:o \c__xparse_no_value_tl
}
{
\__msg_kernel_error:nnxxx { xparse } { verbatim-tokenized }
{ \exp_after:wN \token_to_str:N \l__xparse_fn_tl }
{ \tl_to_str:N \l__xparse_v_arg_tl }
{ \tl_to_str:n {#1} }
- \l__xparse_v_rest_of_signature_tl \l__xparse_args_tl
+ \__xparse_add_arg:o \c__xparse_no_value_tl
}
}
\cs_new_protected:Npn \__xparse_grab_v_aux_put:N #1
@@ -1143,45 +1345,28 @@
{ \str_if_eq_x:nnTF { } { \str_tail:n {#1} } }
\cs_new_protected:Npn \__xparse_add_arg:n #1
{
- \int_compare:nNnTF \l__xparse_processor_int = \c_zero
- { \tl_put_right:Nn \l__xparse_args_tl { {#1} } }
- {
- \tl_clear:N \ProcessedArgument
- \__xparse_if_no_value:nTF {#1}
- {
- \int_zero:N \l__xparse_processor_int
- \tl_put_right:Nn \l__xparse_args_tl { {#1} }
- }
- { \__xparse_add_arg_aux:n {#1} }
- }
+ \tl_put_right:Nn \l__xparse_args_tl { {#1} }
+ \l__xparse_signature_tl \__xparse_run_code:
}
-\cs_generate_variant:Nn \__xparse_add_arg:n { V , o }
-\cs_new_protected:Npn \__xparse_add_arg_aux:n #1
- {
- \use:c { __xparse_processor_ \int_use:N \l__xparse_processor_int :n } {#1}
- \int_decr:N \l__xparse_processor_int
- \int_compare:nNnTF \l__xparse_processor_int = \c_zero
- {
- \tl_put_right:Nx \l__xparse_args_tl
- { { \exp_not:V \ProcessedArgument } }
- }
- { \__xparse_add_arg_aux:V \ProcessedArgument }
-}
-\cs_generate_variant:Nn \__xparse_add_arg_aux:n { V }
+\cs_generate_variant:Nn \__xparse_add_arg:n { V , o , x }
\cs_new:Npn \__xparse_expandable_grab_D:w #1 \q__xparse #2
- { #2 { \__xparse_expandable_grab_D:NNNnwNn #1 \q__xparse #2 } }
-\cs_new:Npn \__xparse_expandable_grab_D:NNNnwNn #1#2#3#4#5 \q__xparse #6#7
+ { #2 { \__xparse_expandable_grab_D:NNNwNn #1 \q__xparse #2 } }
+\cs_set_protected:Npn \__xparse_tmp:w #1
{
- \str_if_eq:onTF
- { #1 { } { } #7 #2 \q__xparse #3 }
- { { } {#2} { } }
+ \cs_new:Npn \__xparse_expandable_grab_D:NNNwNn ##1##2##3##4 \q__xparse ##5##6
{
- #1
- { \__xparse_expandable_grab_D:NNNwNnnn #1#2#3#5 \q__xparse #6 }
- \q_nil { } #2 \ERROR \q__xparse \ERROR
+ \str_if_eq:onTF
+ { ##1 { } { } ##6 ##2 \q__xparse ##3 }
+ { { } {##2} { } }
+ {
+ ##1
+ { \__xparse_expandable_grab_D:NNNwNnnn ##1##2##3##4 \q__xparse ##5 }
+ \q_nil { } ##2 \ERROR \q__xparse \ERROR
+ }
+ { ##4 {#1} \q__xparse ##5 {##6} }
}
- { #5 {#4} \q__xparse #6 {#7} }
}
+\exp_args:No \__xparse_tmp:w { \c__xparse_no_value_tl }
\cs_new:Npn \__xparse_expandable_grab_D:NNNwNnnn #1#2#3#4 \q__xparse #5#6#7#8
{
\exp_args:Nof \__xparse_expandable_grab_D:nnNNNwN
@@ -1213,19 +1398,23 @@
}
}
\cs_new:Npn \__xparse_expandable_grab_D_alt:w #1 \q__xparse #2
- { #2 { \__xparse_expandable_grab_D_alt:NNnwNn #1 \q__xparse #2 } }
-\cs_new:Npn \__xparse_expandable_grab_D_alt:NNnwNn #1#2#3#4 \q__xparse #5#6
+ { #2 { \__xparse_expandable_grab_D_alt:NNwNn #1 \q__xparse #2 } }
+\cs_set_protected:Npn \__xparse_tmp:w #1
{
- \str_if_eq:onTF
- { #1 { } #6 #2 #2 }
- { { } #2 }
+ \cs_new:Npn \__xparse_expandable_grab_D_alt:NNwNn ##1##2##3 \q__xparse ##4##5
{
- #1
- { \__xparse_expandable_grab_D_alt:Nwn #5 #4 \q__xparse }
- #6 \ERROR
+ \str_if_eq:onTF
+ { ##1 { } ##5 ##2 ##2 }
+ { { } ##2 }
+ {
+ ##1
+ { \__xparse_expandable_grab_D_alt:Nwn ##4 ##3 \q__xparse }
+ ##5 \ERROR
+ }
+ { ##3 {#1} \q__xparse ##4 {##5} }
}
- { #4 {#3} \q__xparse #5 {#6} }
}
+\exp_args:No \__xparse_tmp:w { \c__xparse_no_value_tl }
\cs_new:Npn \__xparse_expandable_grab_D_alt:Nwn #1#2 \q__xparse #3
{
\tl_if_blank:oTF { \use_none:n #3 }
@@ -1239,46 +1428,85 @@
}
#2 \q__xparse #1
}
+\cs_new:Npn \__xparse_expandable_grab_E:w #1 \q__xparse #2
+ { #2 { \__xparse_expandable_grab_E_test:nnwn #1 \q__xparse #2 } }
+\cs_new:Npn \__xparse_expandable_grab_E_test:nnwn #1#2#3 \q__xparse #4#5
+ {
+ \__xparse_expandable_grab_E_loop:nnnNNw {#5} { } { }
+ #1 \q_nil \q_nil \q_nil \q_mark #2 \q_nil
+ #3 \q__xparse #4
+ }
+\cs_new:Npn \__xparse_expandable_grab_E_loop:nnnNNw
+ #1#2#3#4#5#6 \q_nil #7 \q_mark #8
+ {
+ \quark_if_nil:NTF #4
+ { \__xparse_expandable_grab_E_end:nnw {#1} {#3} }
+ {
+ \__xparse_if_no_value:nTF {#8}
+ { \str_if_eq:onTF { #4 { } #1 #5 } {#5} }
+ { \use_ii:nn }
+ { \__xparse_expandable_grab_E_aux:w { #2 #4 #5 #6 } {#3} ~ }
+ {
+ \__xparse_expandable_grab_E_loop:nnnNNw
+ {#1} { #2 #4 #5 } { #3 {#8} }
+ #6 \q_nil #7 \q_mark
+ }
+ }
+ }
+\cs_new:Npn \__xparse_expandable_grab_E_aux:w #1 \q__xparse #2
+ { #2 { \__xparse_expandable_grab_E_aux:nnw #1 \q__xparse #2 } }
+\cs_new:Npn \__xparse_expandable_grab_E_aux:nnw #1#2#3 \q_nil #4 \q__xparse #5#6
+ { \__xparse_expandable_grab_E:w {#1} { #2 {#6} #3 } #4 \q__xparse #5 }
+\cs_new:Npn \__xparse_expandable_grab_E_end:nnw #1#2#3 \q__xparse #4
+ { #3 {#2} \q__xparse #4 {#1} }
\cs_new:Npn \__xparse_expandable_grab_m:w #1 \q__xparse #2
{ #2 { \__xparse_expandable_grab_m_aux:wNn #1 \q__xparse #2 } }
\cs_new:Npn \__xparse_expandable_grab_m_aux:wNn #1 \q__xparse #2#3
{ #1 {#3} \q__xparse #2 }
\cs_new:Npn \__xparse_expandable_grab_R:w #1 \q__xparse #2
- { #2 { \__xparse_expandable_grab_R_aux:NNNnwNn #1 \q__xparse #2 } }
-\cs_new:Npn \__xparse_expandable_grab_R_aux:NNNnwNn #1#2#3#4#5 \q__xparse #6#7
+ { #2 { \__xparse_expandable_grab_R_aux:NNNwNn #1 \q__xparse #2 } }
+\cs_set_protected:Npn \__xparse_tmp:w #1
{
- \str_if_eq:onTF
- { #1 { } { } #7 #2 \q__xparse #3 }
- { { } {#2} { } }
- {
- #1
- { \__xparse_expandable_grab_D:NNNwNnnn #1#2#3#5 \q__xparse #6 }
- \q_nil { } #2 \ERROR \q__xparse \ERROR
- }
+ \cs_new:Npn \__xparse_expandable_grab_R_aux:NNNwNn ##1##2##3##4 \q__xparse ##5##6
{
- \__msg_kernel_expandable_error:nnn
- { xparse } { missing-required } {#2}
- #5 {#4} \q__xparse #6 {#7}
+ \str_if_eq:onTF
+ { ##1 { } { } ##6 ##2 \q__xparse ##3 }
+ { { } {##2} { } }
+ {
+ ##1
+ { \__xparse_expandable_grab_D:NNNwNnnn ##1##2##3##4 \q__xparse ##5 }
+ \q_nil { } ##2 \ERROR \q__xparse \ERROR
+ }
+ {
+ \__msg_kernel_expandable_error:nnnn
+ { xparse } { missing-required } {##5} {##2}
+ ##4 {#1} \q__xparse ##5 {##6}
+ }
}
}
+\exp_args:No \__xparse_tmp:w { \c__xparse_no_value_tl }
\cs_new:Npn \__xparse_expandable_grab_R_alt:w #1 \q__xparse #2
{ #2 { \__xparse_expandable_grab_R_alt_aux:NNnwNn #1 \q__xparse #2 } }
-\cs_new:Npn \__xparse_expandable_grab_R_alt_aux:NNnwNn #1#2#3#4 \q__xparse #5#6
+\cs_set_protected:Npn \__xparse_tmp:w #1
{
- \str_if_eq:onTF
- { #1 { } #6 #2 #2 }
- { { } #2 }
- {
- #1
- { \__xparse_expandable_grab_D_alt:Nwn #5 #4 \q__xparse }
- #6 \ERROR
- }
+ \cs_new:Npn \__xparse_expandable_grab_R_alt_aux:NNwNn ##1##2##3 \q__xparse ##4##5
{
- \__msg_kernel_expandable_error:nnn
- { xparse } { missing-required } {#2}
- #4 {#3} \q__xparse #5 {#6}
+ \str_if_eq:onTF
+ { ##1 { } ##5 ##2 ##2 }
+ { { } ##2 }
+ {
+ ##1
+ { \__xparse_expandable_grab_D_alt:Nwn ##4 ##3 \q__xparse }
+ ##5 \ERROR
+ }
+ {
+ \__msg_kernel_expandable_error:nnnn
+ { xparse } { missing-required } {##4} {##2}
+ ##3 {#1} \q__xparse ##4 {##5}
+ }
}
}
+\exp_args:No \__xparse_tmp:w { \c__xparse_no_value_tl }
\cs_new:Npn \__xparse_expandable_grab_t:w #1 \q__xparse #2
{ #2 { \__xparse_expandable_grab_t_aux:NNwn #1 \q__xparse #2 } }
\cs_new:Npn \__xparse_expandable_grab_t_aux:NNwn #1#2#3 \q__xparse #4#5
@@ -1289,14 +1517,6 @@
}
\cs_new:Npn \__xparse_put_arg_expandable:nw #1#2 \q__xparse { #2 {#1} \q__xparse }
\cs_generate_variant:Nn \__xparse_put_arg_expandable:nw { o }
-\cs_new:Npn \__xparse_grab_expandable_end:wN #1 \q__xparse #2 {#1}
-\cs_new_protected:Npn \__xparse_process_arg:n #1
- {
- \int_incr:N \l__xparse_processor_int
- \cs_set_protected:cpx
- { __xparse_processor_ \int_use:N \l__xparse_processor_int :n } ##1
- { \exp_not:n {#1} {##1} }
- }
\cs_new_protected:Npn \__xparse_bool_reverse:N #1
{
\bool_if:NTF #1
@@ -1407,30 +1627,38 @@
{ \tl_to_str:n {#1} }
}
}
+\cs_new_protected:Npn \__xparse_get_arg_spec:NTF #1#2#3
+ {
+ \__xparse_cmd_if_xparse:NTF #1
+ {
+ \tl_set:Nx \ArgumentSpecification { \tl_item:Nn #1 { 2 } }
+ #2
+ }
+ {#3}
+ }
\cs_new_protected:Npn \__xparse_get_arg_spec:N #1
{
- \prop_get:NnNF \l__xparse_command_arg_specs_prop {#1}
- \ArgumentSpecification
+ \__xparse_get_arg_spec:NTF #1 { }
{ \__xparse_get_arg_spec_error:N #1 }
}
\cs_new_protected:Npn \__xparse_get_arg_spec:n #1
{
- \prop_get:NnNF \l__xparse_environment_arg_specs_prop {#1}
- \ArgumentSpecification
+ \exp_args:Nc \__xparse_get_arg_spec:NTF
+ { environment~ \tl_to_str:n {#1} }
+ { }
{ \__xparse_get_arg_spec_error:n {#1} }
}
\tl_new:N \ArgumentSpecification
\cs_new_protected:Npn \__xparse_show_arg_spec:N #1
{
- \prop_get:NnNTF \l__xparse_command_arg_specs_prop {#1}
- \ArgumentSpecification
+ \__xparse_get_arg_spec:NTF #1
{ \tl_show:N \ArgumentSpecification }
{ \__xparse_get_arg_spec_error:N #1 }
}
\cs_new_protected:Npn \__xparse_show_arg_spec:n #1
{
- \prop_get:NnNTF \l__xparse_environment_arg_specs_prop {#1}
- \ArgumentSpecification
+ \exp_args:Nc \__xparse_get_arg_spec:NTF
+ { environment~ \tl_to_str:n {#1} }
{ \tl_show:N \ArgumentSpecification }
{ \__xparse_get_arg_spec_error:n {#1} }
}
@@ -1483,8 +1711,50 @@
}
}
\group_end:
+\cs_new:Npn \__xparse_tl_mapthread_function:NNN #1#2#3
+ {
+ \exp_after:wN \exp_after:wN
+ \exp_after:wN \__xparse_tl_mapthread_loop:w
+ \exp_after:wN \exp_after:wN
+ \exp_after:wN #3
+ \exp_after:wN #1
+ \exp_after:wN \q_recursion_tail
+ \exp_after:wN \q_mark
+ #2
+ \q_recursion_tail
+ \q_recursion_stop
+ }
+\cs_new:Npn \__xparse_tl_mapthread_function:nnN #1#2#3
+ {
+ \__xparse_tl_mapthread_loop:w #3
+ #1 \q_recursion_tail \q_mark
+ #2 \q_recursion_tail \q_recursion_stop
+ }
+\cs_new:Npn \__xparse_tl_mapthread_loop:w #1#2#3 \q_mark #4
+ {
+ \quark_if_recursion_tail_stop:n {#2}
+ \quark_if_recursion_tail_stop:n {#4}
+ #1 {#2} {#4}
+ \__xparse_tl_mapthread_loop:w #1#3 \q_mark
+ }
+\cs_new_protected:Npn \__xparse_cmd_if_xparse:NTF #1
+ {
+ \exp_args:Nf \str_case_x:nnTF
+ {
+ \exp_args:Nf \tl_if_empty:nT { \token_get_arg_spec:N #1 }
+ {
+ \exp_last_unbraced:Nf \__xparse_cmd_if_xparse_aux:w
+ { \token_get_replacement_spec:N #1 } ~ \q_stop
+ }
+ }
+ {
+ { \token_to_str:N \__xparse_start:nNNnnn } { }
+ { \token_to_str:N \__xparse_start_expandable:nNNNn } { }
+ }
+ }
+\cs_new:Npn \__xparse_cmd_if_xparse_aux:w #1 ~ #2 \q_stop {#1}
\__msg_kernel_new:nnnn { xparse } { bad-arg-spec }
- { Bad~argument~specification~'#1'. }
+ { Bad~argument~specification~'#2'~for~command~'#1'. }
{
\c__msg_coding_error_text_tl
The~argument~specification~provided~was~not~valid:~
@@ -1521,7 +1791,8 @@
}
\__msg_kernel_new:nnnn { xparse } { expandable-ending-optional }
{
- Argument~specification~for~expandable~command~ends~with~optional~argument.
+ Argument~specification~'#2'~for~expandable~command~'#1'~
+ ends~with~optional~argument.
}
{
\c__msg_coding_error_text_tl
@@ -1530,27 +1801,33 @@
argument~with~expandable~commands.
}
\__msg_kernel_new:nnnn { xparse } { inconsistent-long }
- { Inconsistent~long~arguments~for~expandable~command. }
+ { Inconsistent~long~arguments~for~expandable~command~'#1'. }
{
\c__msg_coding_error_text_tl
The~arguments~for~an~expandable~command~must~either~all~be~
short~or~all~be~long.~You~have~tried~to~mix~the~two~types.
}
\__msg_kernel_new:nnnn { xparse } { invalid-expandable-argument-type }
- { Argument~type~'#1'~not~available~for~an~expandable~function. }
+ { Argument~type~'#2'~not~available~for~expandable~command~'#1'. }
{
\c__msg_coding_error_text_tl
- The~letter~'#1'~does~not~specify~an~argument~type~which~can~be~used~
- in~an~expandable~function.
+ The~letter~'#2'~does~not~specify~an~argument~type~which~can~be~used~
+ in~an~expandable~command.
\\ \\
- LaTeX~will~assume~you~want~a~standard~mandatory~argument~(type~'m').
+ LaTeX~will~ignore~this~entire~definition.
+ }
+\__msg_kernel_new:nnnn { xparse } { loop-in-defaults }
+ { Circular~dependency~in~defaults~of~'#1'. }
+ {
+ \c__msg_coding_error_text_tl
+ The~default~values~of~two~or~more~arguments~of~'#1'~depend~on~each~
+ other~in~a~way~that~cannot~be~resolved.
}
\__msg_kernel_new:nnnn { xparse } { missing-required }
- { Failed~to~find~required~argument~starting~with~'#1'. }
+ { Failed~to~find~required~argument~starting~with~'#2'~for~command~'#1'. }
{
- There~is~supposed~to~be~an~argument~to~the~current~function~starting~with~
- '#1'.~LaTeX~did~not~find~it,~and~will~insert~'#2'~as~the~value~to~be~
- processed.
+ The~current~command~'#1'~expects~an~argument~starting~with~'#2'.~
+ LaTeX~did~not~find~it,~and~will~insert~a~default~value~to~be~processed.
}
\__msg_kernel_new:nnnn { xparse } { non-xparse-command }
{ Command~'#1'~not~defined~using~xparse. }
@@ -1585,19 +1862,20 @@
LaTeX~will~ignore~this~entire~definition.
}
\__msg_kernel_new:nnnn { xparse } { not-single-token }
- { Argument~delimiter~should~be~a~single~token:~'#1'. }
+ { Argument~delimiter~'#2'~for~the~command~'#1'~should~be~a~single~token. }
{
\c__msg_coding_error_text_tl
The~argument~specification~provided~was~not~valid:~
- in~a~place~where~a~single~token~is~required,~LaTeX~found~'#1'. \\ \\
+ in~a~place~where~a~single~token~is~required,~LaTeX~found~'#2'. \\ \\
LaTeX~will~ignore~this~entire~definition.
}
\__msg_kernel_new:nnnn { xparse } { processor-in-expandable }
- { Argument~processors~cannot~be~used~with~expandable~functions. }
+ { Argument~processor~'>{#2}'~cannot~be~used~for~the~expandable~command~'#1'. }
{
\c__msg_coding_error_text_tl
The~argument~specification~for~#1~contains~a~processor~function:~
- this~is~only~supported~for~standard~robust~functions.
+ this~is~only~supported~for~standard~robust~commands. \\ \\
+ LaTeX~will~ignore~this~entire~definition.
}
\__msg_kernel_new:nnnn { xparse } { split-excess-tokens }
{ Too~many~'#1'~tokens~when~trying~to~split~argument. }
@@ -1606,12 +1884,20 @@
at~each~occurrence~of~the~token~'#1',~up~to~a~maximum~of~#2~parts.~
There~were~too~many~'#1'~tokens.
}
+\__msg_kernel_new:nnnn { xparse } { too-many-arguments }
+ { Too~many~arguments~in~argument~specification~'#2'~of~command~'#1'. }
+ {
+ \c__msg_coding_error_text_tl
+ The~argument~specification~provided~has~more~than~9~arguments.~
+ This~cannot~be~implemented. \\ \\
+ LaTeX~will~ignore~this~entire~definition.
+ }
\__msg_kernel_new:nnnn { xparse } { unknown-argument-type }
- { Unknown~argument~type~'#1'~replaced~by~'m'. }
+ { Unknown~argument~type~'#2'~for~the~command~'#1'. }
{
\c__msg_coding_error_text_tl
- The~letter~'#1'~does~not~specify~a~known~argument~type.~
- LaTeX~will~assume~you~want~a~standard~mandatory~argument~(type~'m').
+ The~letter~'#2'~does~not~specify~a~known~argument~type.~
+ LaTeX~will~ignore~this~entire~definition.
}
\__msg_kernel_new:nnnn { xparse } { unknown-command }
{ Unknown~document~command~'#1'. }
@@ -1666,6 +1952,12 @@
Redefining~environment~'#1'~
with~sig.~'#2'~\msg_line_context:.
}
+\__msg_kernel_new:nnn { xparse } { optional-mandatory }
+ {
+ Since~the~mandatory~argument~'#1'~has~the~same~delimiter~'#2'~
+ as~a~previous~optional~argument,~it~will~not~be~possible~to~
+ omit~all~optional~arguments~when~calling~this~command.
+ }
\cs_new_eq:NN \BooleanFalse \c_false_bool
\cs_new_eq:NN \BooleanTrue \c_true_bool
\cs_new_protected:Npn \DeclareDocumentCommand #1#2#3
diff --git a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty
index c26b9507975..47b2b06a1da 100644
--- a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty
+++ b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty
@@ -23,8 +23,8 @@
%% (C) Copyright 2004-2010 Frank Mittelbach,
%% The LaTeX3 Project
%% (C) Copyright 2011-2016 The LaTeX3 Project
-\RequirePackage{expl3}[2017/02/07]
-\@ifpackagelater{expl3}{2017/02/07}
+\RequirePackage{expl3}[2017/02/10]
+\@ifpackagelater{expl3}{2017/02/10}
{}
{%
\PackageError{xtemplate}{Support package l3kernel too old}
@@ -38,8 +38,8 @@
}
\def\ExplFileName{xtemplate}
\def\ExplFileDescription{L3 Experimental prototype document functions}
-\def\ExplFileDate{2017/02/07}
-\def\ExplFileVersion{6846}
+\def\ExplFileDate{2017/02/10}
+\def\ExplFileVersion{6878}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\tl_const:Nn \c__xtemplate_code_root_tl { template~code~>~ }