diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty | 1495 |
1 files changed, 763 insertions, 732 deletions
diff --git a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty index 2af1a14b3c9..c5eb78daecf 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty @@ -50,159 +50,168 @@ %% %% ----------------------------------------------------------------------- %% -\RequirePackage{expl3}[2012/04/23] -\@ifpackagelater{expl3}{2012/04/23} +\RequirePackage{expl3}[2012/07/16] +\@ifpackagelater{expl3}{2012/07/16} {} - { + {% \PackageError{xparse}{Support package l3kernel too old.} - { + {% Please install an up to date version of l3kernel using your TeX package manager or from CTAN.\\ \\ - Loading xparse will abort! - } + Loading xparse will abort!% + }% \endinput } -\GetIdInfo$Id: xparse.dtx 3570 2012-04-23 13:24:55Z joseph $ +\GetIdInfo$Id: xparse.dtx 3990 2012-07-16 07:46:03Z joseph $ {L3 Experimental document command parser} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\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 -\tl_new:N \l_xparse_args_tl -\prop_new:N \l_xparse_command_arg_specs_prop -\int_new:N \l_xparse_current_arg_int -\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 - { - \l_xparse_function_tl \c_space_tl - ( arg~ \int_use:N \l_xparse_current_arg_int ) - } -\tl_new:N \l_xparse_fn_tl -\tl_new:N \l_xparse_function_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 -\tl_new:N \l_xparse_signature_tl -\tl_new:N \l_xparse_tmp_tl -\cs_new_protected_nopar:Npn \xparse_declare_cmd:Nnn - { - \bool_set_false:N \l_xparse_expandable_bool - \xparse_declare_cmd_aux:Nnn - } -\cs_new_protected_nopar:Npn \xparse_declare_expandable_cmd:Nnn - { - \bool_set_true:N \l_xparse_expandable_bool - \xparse_declare_cmd_aux:Nnn - } -\cs_new_protected:Npn \xparse_declare_cmd_aux:Nnn #1#2 +\group_begin: +\char_set_lccode:nn { `\Q } { `\- } +\char_set_lccode:nn { `\N } { `\N } +\char_set_lccode:nn { `\V } { `\V } +\tl_to_lowercase:n + { + \group_end: + \tl_const:Nn \c__xparse_no_value_tl { QNoValue- } + } +\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 +\tl_new:N \l__xparse_args_tl +\prop_new:N \l__xparse_command_arg_specs_prop +\int_new:N \l__xparse_current_arg_int +\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 + { + \l__xparse_function_tl \c_space_tl + ( arg~ \int_use:N \l__xparse_current_arg_int ) + } +\tl_new:N \l__xparse_fn_tl +\tl_new:N \l__xparse_function_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 +\tl_new:N \l__xparse_signature_tl +\tl_new:N \l__xparse_tmp_tl +\cs_new_protected_nopar:Npn \__xparse_declare_cmd:Nnn + { + \bool_set_false:N \l__xparse_expandable_bool + \__xparse_declare_cmd_aux:Nnn + } +\cs_new_protected_nopar:Npn \__xparse_declare_expandable_cmd:Nnn + { + \bool_set_true:N \l__xparse_expandable_bool + \__xparse_declare_cmd_aux:Nnn + } +\cs_new_protected:Npn \__xparse_declare_cmd_aux:Nnn #1#2 { \cs_if_exist:NTF #1 { - \msg_kernel_warning:nnxx { xparse } { redefine-command } + \__msg_kernel_warning:nnxx { xparse } { redefine-command } { \token_to_str:N #1 } { \tl_to_str:n {#2} } } { - \msg_kernel_info:nnxx { xparse } { define-command } + \__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} + \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 +\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 + \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} } + \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_break_point:n {#2} + { \__xparse_declare_cmd_mixed:Nn #1 {#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_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 } + \bool_if:NF \l__xparse_expandable_bool { _protected } + \bool_if:NF \l__xparse_all_long_bool { _nopar } :Npn } - \l_xparse_current_arg_int {#2} + \l__xparse_current_arg_int {#2} } -\cs_new_protected:Npn \xparse_declare_cmd_mixed:Nn +\cs_new_protected:Npn \__xparse_declare_cmd_mixed:Nn { - \bool_if:NTF \l_xparse_expandable_bool - { \xparse_declare_cmd_mixed_expandable:Nn } - { \xparse_declare_cmd_mixed_aux:Nn } + \bool_if:NTF \l__xparse_expandable_bool + { \__xparse_declare_cmd_mixed_expandable:Nn } + { \__xparse_declare_cmd_mixed_aux:Nn } } -\cs_new_protected:Npn \xparse_declare_cmd_mixed_aux:Nn #1#2 +\cs_new_protected:Npn \__xparse_declare_cmd_mixed_aux:Nn #1#2 { - \xparse_flush_m_args: + \__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} + { \l__xparse_function_tl \c_space_tl code } + \cs_set_protected:Npn \l__xparse_current_arg_int {#2} \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 + \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 } } -\cs_new_protected:Npn \xparse_declare_cmd_mixed_expandable:Nn #1#2 +\cs_new_protected:Npn \__xparse_declare_cmd_mixed_expandable:Nn #1#2 { \cs_generate_from_arg_count:cNnn - { \l_xparse_function_tl \c_space_tl code } - \cs_set:Npn \l_xparse_current_arg_int {#2} + { \l__xparse_function_tl \c_space_tl code } + \cs_set:Npn \l__xparse_current_arg_int {#2} \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: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 } } - \bool_if:NTF \l_xparse_long_bool + \bool_if:NTF \l__xparse_all_long_bool { \cs_set:cpx } { \cs_set_nopar:cpx } - { \l_xparse_function_tl \c_space_tl } ##1##2 { ##1 {##2} } + { \l__xparse_function_tl \c_space_tl } ##1##2 { ##1 {##2} } } -\cs_new_protected:Npn \xparse_declare_env:nnnn #1#2 +\cs_new_protected:Npn \__xparse_declare_env:nnnn #1#2 { \cs_if_exist:cTF {#1} { - \msg_kernel_warning:nnxx { xparse } { redefine-environment } + \__msg_kernel_warning:nnxx { xparse } { redefine-environment } {#1} { \tl_to_str:n {#2} } } { - \msg_kernel_info:nnxx { xparse } { define-environment } + \__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_true:N \l_xparse_environment_bool - \xparse_declare_env_internal:nnnn {#1} {#2} + \prop_put:Nnn \l__xparse_environment_arg_specs_prop {#1} {#2} + \bool_set_true:N \l__xparse_environment_bool + \__xparse_declare_env_internal:nnnn {#1} {#2} } -\cs_new_protected:Npn \xparse_declare_env_internal:nnnn #1#2#3#4 +\cs_new_protected:Npn \__xparse_declare_env_internal:nnnn #1#2#3#4 { - \xparse_declare_cmd_internal:cnx { environment~ #1 } {#2} + \__xparse_declare_cmd_internal:cnx { environment~ #1 } {#2} { \group_begin: \cs_set_protected_nopar:Npx \exp_not:c { environment_ #1 _end_aux: } @@ -211,7 +220,7 @@ \exp_not:n { \exp_args:No \exp_not:o - { \exp_after:wN \use_none:n \l_xparse_args_tl } + { \exp_after:wN \use_none:n \l__xparse_args_tl } \exp_not:n { \if@endpe @@ -229,442 +238,448 @@ { \exp_not:c { environment_ #1 _end_aux: } } \cs_generate_from_arg_count:cNnn { environment_ #1 _end_aux:w } \cs_set_protected:Npn - \l_xparse_current_arg_int {#4} + \l__xparse_current_arg_int {#4} \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_count_mandatory:n #1 { - \int_zero:N \l_xparse_mandatory_args_int - \xparse_count_mandatory:N #1 + \int_zero:N \l__xparse_mandatory_args_int + \__xparse_count_mandatory:N #1 \q_recursion_tail \q_recursion_tail \q_recursion_tail \q_recursion_stop } -\cs_new_protected:Npn \xparse_count_mandatory:N #1 +\cs_new_protected:Npn \__xparse_count_mandatory:N #1 { \quark_if_recursion_tail_stop:N #1 - \prop_get:NnNTF \c_xparse_shorthands_prop {#1} \l_xparse_tmp_tl - { \exp_after:wN \xparse_count_mandatory:N \l_xparse_tmp_tl } - { \xparse_count_mandatory_aux:N #1 } + \prop_get:NnNTF \c__xparse_shorthands_prop {#1} \l__xparse_tmp_tl + { \exp_after:wN \__xparse_count_mandatory:N \l__xparse_tmp_tl } + { \__xparse_count_mandatory_aux:N #1 } } -\cs_new_protected:Npn \xparse_count_mandatory_aux:N #1 +\cs_new_protected:Npn \__xparse_count_mandatory_aux:N #1 { - \cs_if_free:cTF { xparse_count_type_ \token_to_str:N #1 :w } - { \xparse_count_type_m:w } - { \use:c { xparse_count_type_ \token_to_str:N #1 :w } } + \cs_if_free:cTF { __xparse_count_type_ \token_to_str:N #1 :w } + { \__xparse_count_type_m:w } + { \use:c { __xparse_count_type_ \token_to_str:N #1 :w } } } -\cs_new_protected:cpn { xparse_count_type_>:w } #1 +\cs_new_protected:cpn { __xparse_count_type_>:w } #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_count_mandatory:N } -\cs_new_protected_nopar:cpn { xparse_count_type_+:w } - { \xparse_count_mandatory:N } -\cs_new_protected:Npn \xparse_count_type_d:w #1#2 +\cs_new_protected_nopar:cpn { __xparse_count_type_+:w } + { \__xparse_count_mandatory:N } +\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 + \__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 } -\cs_new_protected:Npn \xparse_count_type_D:w #1#2#3 +\cs_new_protected:Npn \__xparse_count_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 + \__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 } -\cs_new_protected_nopar:Npn \xparse_count_type_g:w - { \xparse_count_mandatory:N } -\cs_new_protected:Npn \xparse_count_type_G:w #1 +\cs_new_protected_nopar:Npn \__xparse_count_type_g:w + { \__xparse_count_mandatory:N } +\cs_new_protected:Npn \__xparse_count_type_G:w #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_count_mandatory:N } -\cs_new_protected_nopar:Npn \xparse_count_type_m:w +\cs_new_protected_nopar:Npn \__xparse_count_type_m:w { - \int_incr:N \l_xparse_mandatory_args_int - \xparse_count_mandatory:N + \int_incr:N \l__xparse_mandatory_args_int + \__xparse_count_mandatory:N } -\cs_new_protected:Npn \xparse_count_type_r:w #1#2 +\cs_new_protected:Npn \__xparse_count_type_r: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 } - \int_incr:N \l_xparse_mandatory_args_int - \xparse_count_mandatory:N + \__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 } + \int_incr:N \l__xparse_mandatory_args_int + \__xparse_count_mandatory:N } -\cs_new_protected:Npn \xparse_count_type_R:w #1#2#3 +\cs_new_protected:Npn \__xparse_count_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 } - \int_incr:N \l_xparse_mandatory_args_int - \xparse_count_mandatory:N + \__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 } + \int_incr:N \l__xparse_mandatory_args_int + \__xparse_count_mandatory:N } -\cs_new_protected:Npn \xparse_count_type_t:w #1 +\cs_new_protected:Npn \__xparse_count_type_t: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 + \__xparse_single_token_check:n {#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_u:w #1 +\cs_new_protected:Npn \__xparse_count_type_u:w #1 { - \quark_if_recursion_tail_stop_do:nn {#1} { \xparse_bad_arg_spec:wn } - \int_incr:N \l_xparse_mandatory_args_int - \xparse_count_mandatory:N + \quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn } + \int_incr:N \l__xparse_mandatory_args_int + \__xparse_count_mandatory:N } -\cs_new_protected:Npn \xparse_single_token_check:n #1 +\cs_new_protected:Npn \__xparse_single_token_check:n #1 { \tl_if_single:nF {#1} - { \xparse_single_token_check_aux:nwn {#1} } + { \__xparse_single_token_check_aux:nwn {#1} } } -\cs_new_protected:Npn \xparse_single_token_check_aux:nwn - #1#2 \xparse_break_point:n #3 +\cs_new_protected:Npn \__xparse_single_token_check_aux:nwn + #1#2 \__xparse_break_point:n #3 { - \msg_kernel_error:nnx { xparse } { not-single-token } + \__msg_kernel_error:nnx { xparse } { not-single-token } { \tl_to_str:n {#1} } { \tl_to_str:n {#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} } } -\cs_new_protected:Npn \xparse_prepare_signature:n #1 +\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} } } +\cs_new_protected:Npn \__xparse_prepare_signature:n #1 { - \bool_set_false:N \l_xparse_all_long_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 - \tl_clear:N \l_xparse_signature_tl - \xparse_prepare_signature:N #1 \q_recursion_tail \q_recursion_stop + \bool_set_false:N \l__xparse_all_long_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 + \tl_clear:N \l__xparse_signature_tl + \__xparse_prepare_signature:N #1 \q_recursion_tail \q_recursion_stop } -\cs_new_protected_nopar:Npn \xparse_prepare_signature:N +\cs_new_protected_nopar:Npn \__xparse_prepare_signature:N { - \bool_set_false:N \l_xparse_processor_bool - \xparse_prepare_signature_bypass:N + \bool_set_false:N \l__xparse_processor_bool + \__xparse_prepare_signature_bypass:N } -\cs_new_protected:Npn \xparse_prepare_signature_bypass:N #1 +\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_tmp_tl - { \exp_after:wN \xparse_prepare_signature:N \l_xparse_tmp_tl } + \prop_get:NnNTF \c__xparse_shorthands_prop {#1} \l__xparse_tmp_tl + { \exp_after:wN \__xparse_prepare_signature:N \l__xparse_tmp_tl } { - \int_incr:N \l_xparse_current_arg_int - \xparse_prepare_signature_add:N #1 + \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_new_protected:Npn \__xparse_prepare_signature_add:N #1 { \cs_if_exist_use:cF { - xparse_add - \bool_if:NT \l_xparse_expandable_bool { _expandable } + __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 } + \__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 } + \bool_if:NTF \l__xparse_expandable_bool + { \__xparse_add_expandable_type_m:w } + { \__xparse_add_type_m:w } } } -\cs_new_protected_nopar:cpn { xparse_add_type_+:w } +\cs_new_protected_nopar:cpn { __xparse_add_type_+:w } { - \xparse_flush_m_args: - \bool_set_true:N \l_xparse_long_bool - \int_decr:N \l_xparse_current_arg_int - \xparse_prepare_signature:N + \__xparse_flush_m_args: + \bool_set_true:N \l__xparse_long_bool + \int_decr:N \l__xparse_current_arg_int + \__xparse_prepare_signature:N } -\cs_new_protected:cpn { xparse_add_type_>:w } #1 +\cs_new_protected:cpn { __xparse_add_type_>:w } #1 { - \bool_set_true:N \l_xparse_processor_bool - \xparse_flush_m_args: - \int_decr:N \l_xparse_current_arg_int - \tl_put_right:Nn \l_xparse_signature_tl { \xparse_process_arg:n {#1} } - \xparse_prepare_signature_bypass:N + \bool_set_true:N \l__xparse_processor_bool + \__xparse_flush_m_args: + \int_decr:N \l__xparse_current_arg_int + \tl_put_right:Nn \l__xparse_signature_tl { \__xparse_process_arg:n {#1} } + \__xparse_prepare_signature_bypass:N } -\cs_new_protected:Npn \xparse_add_type_d:w #1#2 - { \xparse_add_type_D:w #1 #2 { \NoValue } } -\cs_new_protected:Npn \xparse_add_type_D:w #1#2#3 +\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_grabber_optional:N D - \tl_put_right:Nn \l_xparse_signature_tl { #1 #2 {#3} } - \xparse_prepare_signature:N + \__xparse_flush_m_args: + \__xparse_add_grabber_optional:N D + \tl_put_right:Nn \l__xparse_signature_tl { #1 #2 {#3} } + \__xparse_prepare_signature:N } -\cs_new_protected_nopar:Npn \xparse_add_type_g:w - { \xparse_add_type_G:w { \NoValue } } -\cs_new_protected:Npn \xparse_add_type_G:w #1 +\cs_new_protected_nopar: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_grabber_optional:N G - \tl_put_right:Nn \l_xparse_signature_tl { {#1} } - \xparse_prepare_signature:N + \__xparse_flush_m_args: + \__xparse_add_grabber_optional:N G + \tl_put_right:Nn \l__xparse_signature_tl { {#1} } + \__xparse_prepare_signature:N } -\cs_new_protected_nopar:Npn \xparse_add_type_l:w +\cs_new_protected_nopar:Npn \__xparse_add_type_l:w { - \xparse_flush_m_args: - \xparse_add_grabber_mandatory:N l - \xparse_prepare_signature:N + \__xparse_flush_m_args: + \__xparse_add_grabber_mandatory:N l + \__xparse_prepare_signature:N } -\cs_new_protected_nopar:Npn \xparse_add_type_m:w +\cs_new_protected_nopar:Npn \__xparse_add_type_m:w { - \bool_if:nTF { \l_xparse_long_bool || \l_xparse_processor_bool } + \bool_if:nTF { \l__xparse_long_bool || \l__xparse_processor_bool } { - \xparse_flush_m_args: - \xparse_add_grabber_mandatory:N m + \__xparse_flush_m_args: + \__xparse_add_grabber_mandatory:N m } - { \int_incr:N \l_xparse_m_args_int } - \xparse_prepare_signature:N + { \int_incr:N \l__xparse_m_args_int } + \__xparse_prepare_signature:N } -\cs_new_protected:Npn \xparse_add_type_r:w #1#2 - { \xparse_add_type_R:w #1 #2 { \NoValue } } -\cs_new_protected:Npn \xparse_add_type_R:w #1#2#3 +\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_grabber_mandatory:N R - \tl_put_right:Nn \l_xparse_signature_tl { #1 #2 {#3} } - \xparse_prepare_signature:N + \__xparse_flush_m_args: + \__xparse_add_grabber_mandatory:N R + \tl_put_right:Nn \l__xparse_signature_tl { #1 #2 {#3} } + \__xparse_prepare_signature:N } -\cs_new_protected:Npn \xparse_add_type_t:w #1 +\cs_new_protected:Npn \__xparse_add_type_t:w #1 { - \xparse_flush_m_args: - \xparse_add_grabber_optional:N t - \tl_put_right:Nn \l_xparse_signature_tl { #1 } - \xparse_prepare_signature:N + \__xparse_flush_m_args: + \__xparse_add_grabber_optional:N t + \tl_put_right:Nn \l__xparse_signature_tl { #1 } + \__xparse_prepare_signature:N } -\cs_new_protected:Npn \xparse_add_type_u:w #1 +\cs_new_protected:Npn \__xparse_add_type_u:w #1 { - \xparse_flush_m_args: - \xparse_add_grabber_mandatory:N u - \tl_put_right:Nn \l_xparse_signature_tl { {#1} } - \xparse_prepare_signature:N + \__xparse_flush_m_args: + \__xparse_add_grabber_mandatory:N u + \tl_put_right:Nn \l__xparse_signature_tl { {#1} } + \__xparse_prepare_signature:N } -\cs_new_protected_nopar:Npn \xparse_add_type_v:w +\cs_new_protected_nopar:Npn \__xparse_add_type_v:w { - \xparse_flush_m_args: - \xparse_add_grabber_mandatory:N v - \xparse_prepare_signature:N + \__xparse_flush_m_args: + \__xparse_add_grabber_mandatory:N v + \__xparse_prepare_signature:N } -\cs_new_protected_nopar:Npn \xparse_flush_m_args: +\cs_new_protected_nopar:Npn \__xparse_flush_m_args: { - \int_compare:nNnT \l_xparse_m_args_int > \c_zero + \int_compare:nNnT \l__xparse_m_args_int > \c_zero { - \tl_put_right:Nx \l_xparse_signature_tl - { \exp_not:c { xparse_grab_m_ \int_use:N \l_xparse_m_args_int :w } } - \int_set:Nn \l_xparse_mandatory_args_int - { \l_xparse_mandatory_args_int - \l_xparse_m_args_int } + \tl_put_right:Nx \l__xparse_signature_tl + { \exp_not:c { __xparse_grab_m_ \int_use:N \l__xparse_m_args_int :w } } + \int_set:Nn \l__xparse_mandatory_args_int + { \l__xparse_mandatory_args_int - \l__xparse_m_args_int } } - \int_zero:N \l_xparse_m_args_int + \int_zero:N \l__xparse_m_args_int } -\cs_new_protected_nopar:Npn \xparse_add_grabber_mandatory:N #1 +\cs_new_protected_nopar:Npn \__xparse_add_grabber_mandatory:N #1 { - \tl_put_right:Nx \l_xparse_signature_tl + \tl_put_right:Nx \l__xparse_signature_tl { \exp_not:c - { xparse_grab_ #1 \bool_if:NT \l_xparse_long_bool { _long } :w } + { __xparse_grab_ #1 \bool_if:NT \l__xparse_long_bool { _long } :w } } - \bool_set_false:N \l_xparse_long_bool - \int_decr:N \l_xparse_mandatory_args_int + \bool_set_false:N \l__xparse_long_bool + \int_decr:N \l__xparse_mandatory_args_int } -\cs_new_protected_nopar:Npn \xparse_add_grabber_optional:N #1 +\cs_new_protected_nopar:Npn \__xparse_add_grabber_optional:N #1 { - \tl_put_right:Nx \l_xparse_signature_tl + \tl_put_right:Nx \l__xparse_signature_tl { \exp_not:c { - xparse_grab_ #1 - \bool_if:NT \l_xparse_long_bool { _long } - \int_compare:nNnF \l_xparse_mandatory_args_int > \c_zero + __xparse_grab_ #1 + \bool_if:NT \l__xparse_long_bool { _long } + \int_compare:nNnF \l__xparse_mandatory_args_int > \c_zero { _trailing } :w } } - \bool_set_false:N \l_xparse_long_bool + \bool_set_false:N \l__xparse_long_bool } -\cs_new_protected_nopar:cpn { xparse_add_expandable_type_+:w } +\cs_new_protected_nopar:cpn { __xparse_add_expandable_type_+:w } { - \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_long_bool + \int_compare:nNnTF \l__xparse_current_arg_int = \c_one + { \bool_set_true:N \l__xparse_all_long_bool } { - \bool_if:NF \l_xparse_all_long_bool - { \msg_kernel_error:nn { xparse } { inconsistent-long } } + \bool_if:NF \l__xparse_all_long_bool + { \__msg_kernel_error:nn { xparse } { inconsistent-long } } } - \int_decr:N \l_xparse_current_arg_int - \xparse_prepare_signature:N + \int_decr:N \l__xparse_current_arg_int + \__xparse_prepare_signature:N } -\cs_new_protected:cpn { xparse_add_expandable_type_>:w } #1 +\cs_new_protected:cpn { __xparse_add_expandable_type_>:w } #1 { - \msg_kernel_error:nnx { xparse } { processor-in-expandable } - { \token_to_str:c { \l_xparse_function_tl } } - \int_decr:N \l_xparse_current_arg_int - \xparse_prepare_signature:N + \__msg_kernel_error:nnx { xparse } { processor-in-expandable } + { \token_to_str:c { \l__xparse_function_tl } } + \int_decr:N \l__xparse_current_arg_int + \__xparse_prepare_signature:N } -\cs_new_protected:Npn \xparse_add_expandable_type_d:w #1#2 - { \xparse_add_expandable_type_D:w #1 #2 { \NoValue } } -\cs_new_protected:Npn \xparse_add_expandable_type_D:w #1#2 +\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 { \token_if_eq_meaning: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_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_expandable_grabber_optional:n { D } + \__xparse_add_expandable_type_D_aux:NNn #1#2 } } -\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 { - \bool_if:NTF \l_xparse_long_bool + \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 #1 ##3 \q__xparse ##4 #2 { ##1 {##2} {##3} {##4} } - \tl_put_right:Nx \l_xparse_signature_tl + \tl_put_right:Nx \l__xparse_signature_tl { - \exp_not:c { \l_xparse_expandable_aux_name_tl } + \exp_not:c { \l__xparse_expandable_aux_name_tl } \exp_not:n { #1 #2 {#3} } } - \bool_set_false:N \l_xparse_long_bool - \xparse_prepare_signature:N + \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 { - \bool_if:NTF \l_xparse_long_bool + \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 #1 ##2 #1 { ##1 {##2} } - \tl_put_right:Nx \l_xparse_signature_tl + \tl_put_right:Nx \l__xparse_signature_tl { - \exp_not:c { \l_xparse_expandable_aux_name_tl } + \exp_not:c { \l__xparse_expandable_aux_name_tl } \exp_not:n { #1 {#2} } } - \bool_set_false:N \l_xparse_long_bool - \xparse_prepare_signature:N + \bool_set_false:N \l__xparse_long_bool + \__xparse_prepare_signature:N } -\cs_new_protected_nopar:Npn \xparse_add_expandable_type_g:w +\cs_new_protected_nopar:Npn \__xparse_add_expandable_type_g:w { - \msg_kernel_error:nnx { xparse } { invalid-expandable-argument-type } { g } - \xparse_add_expandable_type_m:w + \__msg_kernel_error:nnx { xparse } { invalid-expandable-argument-type } { g } + \__xparse_add_expandable_type_m:w } -\cs_new_protected_nopar:Npn \xparse_add_expandable_type_G:w #1 +\cs_new_protected_nopar:Npn \__xparse_add_expandable_type_G:w #1 { - \msg_kernel_error:nnx { xparse } { invalid-expandable-argument-type } { G } - \xparse_add_expandable_type_m:w + \__msg_kernel_error:nnx { xparse } { invalid-expandable-argument-type } { G } + \__xparse_add_expandable_type_m:w } -\cs_new_protected_nopar:Npn \xparse_add_expandable_type_l:w +\cs_new_protected_nopar:Npn \__xparse_add_expandable_type_l:w { - \msg_kernel_error:nnx { xparse } { invalid-expandable-argument-type } { l } - \xparse_add_expandable_type_m:w + \__msg_kernel_error:nnx { xparse } { invalid-expandable-argument-type } { l } + \__xparse_add_expandable_type_m:w } -\cs_new_protected_nopar:Npn \xparse_add_expandable_type_m:w +\cs_new_protected_nopar:Npn \__xparse_add_expandable_type_m:w { - \int_incr:N \l_xparse_m_args_int - \xparse_add_expandable_grabber_mandatory:n { m } - \bool_set_false:N \l_xparse_long_bool - \xparse_prepare_signature:N + \int_incr:N \l__xparse_m_args_int + \__xparse_add_expandable_grabber_mandatory:n { m } + \bool_set_false:N \l__xparse_long_bool + \__xparse_prepare_signature:N } -\cs_new_protected:Npn \xparse_add_expandable_type_r:w #1#2 - { \xparse_add_expandable_type_R:w #1 #2 { \NoValue } } -\cs_new_protected:Npn \xparse_add_expandable_type_R:w #1#2 +\cs_new_protected:Npn \__xparse_add_expandable_type_r:w #1#2 + { + \exp_args:NNNo + \__xparse_add_expandable_type_R:w #1 #2 \c__xparse_no_value_tl + } +\cs_new_protected:Npn \__xparse_add_expandable_type_R:w #1#2 { \token_if_eq_meaning:NNTF #1 #2 { - \xparse_add_expandable_grabber_optional:n { R_alt } - \xparse_add_expandable_type_D_aux:Nn #1 + \__xparse_add_expandable_grabber_optional:n { R_alt } + \__xparse_add_expandable_type_D_aux:Nn #1 } { - \xparse_add_expandable_grabber_optional:n { R } - \xparse_add_expandable_type_D_aux:NNn #1#2 + \__xparse_add_expandable_grabber_optional:n { R } + \__xparse_add_expandable_type_D_aux:NNn #1#2 } } -\cs_new_protected_nopar:Npn \xparse_add_expandable_type_t:w #1 +\cs_new_protected_nopar:Npn \__xparse_add_expandable_type_t:w #1 { - \xparse_add_expandable_grabber_optional:n { t } - \bool_if:NTF \l_xparse_long_bool + \__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} - \tl_put_right:Nx \l_xparse_signature_tl + { \l__xparse_expandable_aux_name_tl } ##1 #1 {##1} + \tl_put_right:Nx \l__xparse_signature_tl { - \exp_not:c { \l_xparse_expandable_aux_name_tl } + \exp_not:c { \l__xparse_expandable_aux_name_tl } \exp_not:N #1 } - \bool_set_false:N \l_xparse_long_bool - \xparse_prepare_signature:N + \bool_set_false:N \l__xparse_long_bool + \__xparse_prepare_signature:N } -\cs_new_protected_nopar:Npn \xparse_add_expandable_type_u:w #1 +\cs_new_protected_nopar:Npn \__xparse_add_expandable_type_u:w #1 { - \msg_kernel_error:nnx { xparse } { invalid-expandable-argument-type } { u } - \xparse_add_expandable_type_m:w + \__msg_kernel_error:nnx { xparse } { invalid-expandable-argument-type } { u } + \__xparse_add_expandable_type_m:w } -\cs_new_protected_nopar:Npn \xparse_add_expandable_type_v:w +\cs_new_protected_nopar:Npn \__xparse_add_expandable_type_v:w { - \msg_kernel_error:nnx { xparse } { invalid-expandable-argument-type } { v } - \xparse_add_expandable_type_m:w + \__msg_kernel_error:nnx { xparse } { invalid-expandable-argument-type } { v } + \__xparse_add_expandable_type_m:w } -\cs_new_protected_nopar:Npn \xparse_add_expandable_grabber_mandatory:n #1 +\cs_new_protected_nopar:Npn \__xparse_add_expandable_grabber_mandatory:n #1 { - \xparse_add_expandable_long_check: - \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 + \__xparse_add_expandable_long_check: + \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_nopar:Npn \xparse_add_expandable_grabber_optional:n #1 +\cs_new_protected_nopar:Npn \__xparse_add_expandable_grabber_optional:n #1 { - \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 } } - \bool_set_false:N \l_xparse_long_bool + \__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 } } + \bool_set_false:N \l__xparse_long_bool } -\cs_new_protected_nopar:Npn \xparse_add_expandable_long_check: +\cs_new_protected_nopar:Npn \__xparse_add_expandable_long_check: { - \bool_if:nT { \l_xparse_all_long_bool && ! ( \l_xparse_long_bool ) } - { \msg_kernel_error:nn { xparse } { inconsistent-long } } + \bool_if:nT { \l__xparse_all_long_bool && ! ( \l__xparse_long_bool ) } + { \__msg_kernel_error:nn { xparse } { inconsistent-long } } } -\cs_new_protected:Npn \xparse_grab_arg:w { } -\cs_new_protected:Npn \xparse_grab_arg_aux_i:w { } -\cs_new_protected:Npn \xparse_grab_arg_aux_ii:w { } -\cs_new_protected:Npn \xparse_grab_D:w #1#2#3#4 \l_xparse_args_tl +\cs_new_protected:Npn \__xparse_grab_arg:w { } +\cs_new_protected:Npn \__xparse_grab_arg_aux_i:w { } +\cs_new_protected:Npn \__xparse_grab_arg_aux_ii:w { } +\cs_new_protected:Npn \__xparse_grab_D:w #1#2#3#4 \l__xparse_args_tl { - \xparse_grab_D_aux:NNnnNn #1 #2 {#3} {#4} \cs_set_protected_nopar:Npn + \__xparse_grab_D_aux:NNnnNn #1 #2 {#3} {#4} \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#4 \l__xparse_args_tl { - \xparse_grab_D_aux:NNnnNn #1 #2 {#3} {#4} \cs_set_protected:Npn + \__xparse_grab_D_aux:NNnnNn #1 #2 {#3} {#4} \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#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 { - \xparse_grab_D_aux:NNnN #1#2 {#4} #5 + \__xparse_grab_D_aux:NNnN #1#2 {#4} #5 \use:c { peek_meaning_remove #6 :NTF } #1 - { \xparse_grab_arg:w } + { \__xparse_grab_arg:w } { - \xparse_add_arg:n {#3} - #4 \l_xparse_args_tl + \__xparse_add_arg:n {#3} + #4 \l__xparse_args_tl } } -\cs_new_protected:Npn \xparse_grab_D_aux:NNnN #1#2#3#4 +\cs_new_protected:Npn \__xparse_grab_D_aux:NNnN #1#2#3#4 { - \cs_set_protected_nopar:Npn \xparse_grab_arg:w + \cs_set_protected_nopar:Npn \__xparse_grab_arg:w { - \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:NNnnN #1 #2 {####1} {#3} #4 } + { \__xparse_grab_D_nested:NNnnN #1 #2 {####1} {#3} #4 } { - \xparse_add_arg:o { \use_none:n ####1 } - #3 \l_xparse_args_tl + \__xparse_add_arg:o { \use_none:n ####1 } + #3 \l__xparse_args_tl } } \group_begin: @@ -674,7 +689,7 @@ \tl_to_lowercase:n { \group_end: - \l_xparse_fn_tl A + \l__xparse_fn_tl A } } { @@ -682,585 +697,585 @@ \tl_to_lowercase:n { \group_end: - \l_xparse_fn_tl ^ + \l__xparse_fn_tl ^ } } } } -\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 +\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 { - \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 + \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 { - \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 } + \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 } \tl_if_in:nnTF {##2} {#1} { - \l_xparse_fn_tl - \q_nil ##2 \q_xparse \ERROR + \l__xparse_fn_tl + \q_nil ##2 \q__xparse \ERROR } { - \tl_put_right:Nx \l_xparse_nesting_a_tl - { \xparse_grab_D_nested:w \q_nil ##2 \q_stop } - \tl_if_in:NnTF \l_xparse_nesting_b_tl {#1} + \tl_put_right:Nx \l__xparse_nesting_a_tl + { \__xparse_grab_D_nested:w \q_nil ##2 \q_stop } + \tl_if_in:NnTF \l__xparse_nesting_b_tl {#1} { - \tl_set_eq:NN \l_xparse_tmp_tl \l_xparse_nesting_b_tl - \tl_clear:N \l_xparse_nesting_b_tl - \exp_after:wN \l_xparse_fn_tl \exp_after:wN - \q_nil \l_xparse_tmp_tl \q_nil \q_xparse \ERROR + \tl_set_eq:NN \l__xparse_tmp_tl \l__xparse_nesting_b_tl + \tl_clear:N \l__xparse_nesting_b_tl + \exp_after:wN \l__xparse_fn_tl \exp_after:wN + \q_nil \l__xparse_tmp_tl \q_nil \q__xparse \ERROR } { - \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 + \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 } } } - \l_xparse_fn_tl #3 \q_nil \q_xparse \ERROR + \l__xparse_fn_tl #3 \q_nil \q__xparse \ERROR } -\cs_new:Npn \xparse_grab_D_nested:w #1 \q_nil \q_stop +\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_G:w #1#2 \l_xparse_args_tl +\cs_new_protected:Npn \__xparse_grab_G:w #1#2 \l__xparse_args_tl { - \xparse_grab_G_aux:nnNn {#1} {#2} \cs_set_protected_nopar:Npn + \__xparse_grab_G_aux:nnNn {#1} {#2} \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#2 \l__xparse_args_tl { - \xparse_grab_G_aux:nnNn {#1} {#2} \cs_set_protected:Npn { _ignore_spaces } + \__xparse_grab_G_aux:nnNn {#1} {#2} \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#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 { - \exp_after:wN #3 \l_xparse_fn_tl ##1 + \exp_after:wN #3 \l__xparse_fn_tl ##1 { - \xparse_add_arg:n {##1} - #2 \l_xparse_args_tl + \__xparse_add_arg:n {##1} + #2 \l__xparse_args_tl } \use:c { peek_meaning #4 :NTF } \c_group_begin_token - { \l_xparse_fn_tl } + { \l__xparse_fn_tl } { - \xparse_add_arg:n {#1} - #2 \l_xparse_args_tl + \__xparse_add_arg:n {#1} + #2 \l__xparse_args_tl } } -\cs_new_protected:Npn \xparse_grab_l:w #1 \l_xparse_args_tl - { \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 - { \xparse_grab_l_aux:nN {#1} \cs_set_protected:Npn } -\cs_new_protected:Npn \xparse_grab_l_aux:nN #1#2 +\cs_new_protected:Npn \__xparse_grab_l:w #1 \l__xparse_args_tl + { \__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 + { \__xparse_grab_l_aux:nN {#1} \cs_set_protected:Npn } +\cs_new_protected:Npn \__xparse_grab_l_aux:nN #1#2 { - \exp_after:wN #2 \l_xparse_fn_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} + #1 \l__xparse_args_tl } - \l_xparse_fn_tl + \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 \l__xparse_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_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} + #1 \l__xparse_args_tl } - \l_xparse_fn_tl + \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 \l__xparse_args_tl { - \exp_after:wN \cs_set_protected:Npn \l_xparse_fn_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} + #1 \l__xparse_args_tl } - \l_xparse_fn_tl + \l__xparse_fn_tl } -\cs_new_protected:cpn { xparse_grab_m_1:w } #1 \l_xparse_args_tl +\cs_new_protected:cpn { __xparse_grab_m_1:w } #1 \l__xparse_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl ##1 + \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 + \tl_put_right:Nn \l__xparse_args_tl { {##1} } + #1 \l__xparse_args_tl } - \l_xparse_fn_tl + \l__xparse_fn_tl } -\cs_new_protected:cpn { xparse_grab_m_2:w } #1 \l_xparse_args_tl +\cs_new_protected:cpn { __xparse_grab_m_2:w } #1 \l__xparse_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl + \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 + \tl_put_right:Nn \l__xparse_args_tl { {##1} {##2} } + #1 \l__xparse_args_tl } - \l_xparse_fn_tl + \l__xparse_fn_tl } -\cs_new_protected:cpn { xparse_grab_m_3:w } #1 \l_xparse_args_tl +\cs_new_protected:cpn { __xparse_grab_m_3:w } #1 \l__xparse_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl + \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 + \tl_put_right:Nn \l__xparse_args_tl { {##1} {##2} {##3} } + #1 \l__xparse_args_tl } - \l_xparse_fn_tl + \l__xparse_fn_tl } -\cs_new_protected:cpn { xparse_grab_m_4:w } #1 \l_xparse_args_tl +\cs_new_protected:cpn { __xparse_grab_m_4:w } #1 \l__xparse_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl + \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 + \tl_put_right:Nn \l__xparse_args_tl { {##1} {##2} {##3} {##4} } + #1 \l__xparse_args_tl } - \l_xparse_fn_tl + \l__xparse_fn_tl } -\cs_new_protected:cpn { xparse_grab_m_5:w } #1 \l_xparse_args_tl +\cs_new_protected:cpn { __xparse_grab_m_5:w } #1 \l__xparse_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl + \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 + \tl_put_right:Nn \l__xparse_args_tl { {##1} {##2} {##3} {##4} {##5} } + #1 \l__xparse_args_tl } - \l_xparse_fn_tl + \l__xparse_fn_tl } -\cs_new_protected:cpn { xparse_grab_m_6:w } #1 \l_xparse_args_tl +\cs_new_protected:cpn { __xparse_grab_m_6:w } #1 \l__xparse_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl + \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 + \tl_put_right:Nn \l__xparse_args_tl { {##1} {##2} {##3} {##4} {##5} {##6} } - #1 \l_xparse_args_tl + #1 \l__xparse_args_tl } - \l_xparse_fn_tl + \l__xparse_fn_tl } -\cs_new_protected:cpn { xparse_grab_m_7:w } #1 \l_xparse_args_tl +\cs_new_protected:cpn { __xparse_grab_m_7:w } #1 \l__xparse_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl + \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 + \tl_put_right:Nn \l__xparse_args_tl { {##1} {##2} {##3} {##4} {##5} {##6} {##7} } - #1 \l_xparse_args_tl + #1 \l__xparse_args_tl } - \l_xparse_fn_tl + \l__xparse_fn_tl } -\cs_new_protected:cpn { xparse_grab_m_8:w } #1 \l_xparse_args_tl +\cs_new_protected:cpn { __xparse_grab_m_8:w } #1 \l__xparse_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl + \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 + \tl_put_right:Nn \l__xparse_args_tl { {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8} } - #1 \l_xparse_args_tl + #1 \l__xparse_args_tl } - \l_xparse_fn_tl + \l__xparse_fn_tl } -\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: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 { - \xparse_grab_D_aux:NNnN #1 #2 {#4} #5 + \__xparse_grab_D_aux:NNnN #1 #2 {#4} #5 \peek_meaning_remove_ignore_spaces:NTF #1 - { \xparse_grab_arg:w } + { \__xparse_grab_arg:w } { - \msg_kernel_error:nnxx { xparse } { missing-required } + \__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 + \__xparse_add_arg:n {#3} + #4 \l__xparse_args_tl } } -\cs_new_protected:Npn \xparse_grab_t:w #1#2 \l_xparse_args_tl +\cs_new_protected:Npn \__xparse_grab_t:w #1#2 \l__xparse_args_tl { - \xparse_grab_t_aux:NnNn #1 {#2} \cs_set_protected_nopar:Npn + \__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 +\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 + \exp_after:wN #3 \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 { \BooleanTrue } + #2 \l__xparse_args_tl } { - \xparse_add_arg:n { \BooleanFalse } - #2 \l_xparse_args_tl + \__xparse_add_arg:n { \BooleanFalse } + #2 \l__xparse_args_tl } } - \l_xparse_fn_tl + \l__xparse_fn_tl } -\cs_new_protected:Npn \xparse_grab_u:w #1#2 \l_xparse_args_tl - { \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 - { \xparse_grab_u_aux:nnN {#1} {#2} \cs_set_protected:Npn } -\cs_new_protected:Npn \xparse_grab_u_aux:nnN #1#2#3 +\cs_new_protected:Npn \__xparse_grab_u:w #1#2 \l__xparse_args_tl + { \__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 + { \__xparse_grab_u_aux:nnN {#1} {#2} \cs_set_protected:Npn } +\cs_new_protected:Npn \__xparse_grab_u_aux:nnN #1#2#3 { - \exp_after:wN #3 \l_xparse_fn_tl ##1 #1 + \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} + #2 \l__xparse_args_tl } - \l_xparse_fn_tl + \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_nopar:Npn \xparse_grab_v:w +\tl_new:N \l__xparse_v_rest_of_signature_tl +\tl_new:N \l__xparse_v_arg_tl +\cs_new_protected_nopar:Npn \__xparse_grab_v:w { - \bool_set_false:N \l_xparse_long_bool - \xparse_grab_v_aux:w + \bool_set_false:N \l__xparse_long_bool + \__xparse_grab_v_aux:w } -\cs_new_protected_nopar:Npn \xparse_grab_v_long:w +\cs_new_protected_nopar:Npn \__xparse_grab_v_long:w { - \bool_set_true:N \l_xparse_long_bool - \xparse_grab_v_aux:w + \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 \l__xparse_args_tl { - \tl_set:Nn \l_xparse_v_rest_of_signature_tl {#1} + \tl_set:Nn \l__xparse_v_rest_of_signature_tl {#1} \group_begin: \group_align_safe_begin: \tex_escapechar:D = 92 \scan_stop: - \tl_clear:N \l_xparse_v_arg_tl + \tl_clear:N \l__xparse_v_arg_tl \peek_N_type:TF - { \xparse_grab_v_aux_test:N } + { \__xparse_grab_v_aux_test:N } { \peek_meaning_remove:NTF \c_group_begin_token { \group_align_safe_end: - \xparse_grab_v_bgroup: + \__xparse_grab_v_bgroup: } - { \xparse_grab_v_aux_abort: } + { \__xparse_grab_v_aux_abort: } } } -\cs_new_protected_nopar:Npn \xparse_grab_v_group_end: +\cs_new_protected_nopar:Npn \__xparse_grab_v_group_end: { \group_align_safe_end: \exp_args:NNNo \group_end: - \tl_set:Nn \l_xparse_v_arg_tl { \l_xparse_v_arg_tl } + \tl_set:Nn \l__xparse_v_arg_tl { \l__xparse_v_arg_tl } } -\cs_new_protected:Npn \xparse_grab_v_aux_test:N #1 +\cs_new_protected:Npn \__xparse_grab_v_aux_test:N #1 { - \xparse_grab_v_aux_put:N #1 - \xparse_grab_v_token_if_char:NTF #1 + \__xparse_grab_v_aux_put:N #1 + \__xparse_grab_v_token_if_char:NTF #1 { - \xparse_grab_v_aux_catcodes: - \xparse_grab_v_aux_loop:N #1 + \__xparse_grab_v_aux_catcodes: + \__xparse_grab_v_aux_loop:N #1 } - { \xparse_grab_v_aux_abort: } + { \__xparse_grab_v_aux_abort: } } -\cs_new_protected:Npn \xparse_grab_v_aux_loop:N #1 +\cs_new_protected:Npn \__xparse_grab_v_aux_loop:N #1 { \peek_N_type:TF - { \xparse_grab_v_aux_loop_ii:NN #1 } - { \xparse_grab_v_aux_abort: } + { \__xparse_grab_v_aux_loop_ii:NN #1 } + { \__xparse_grab_v_aux_abort: } } -\cs_new_protected:Npn \xparse_grab_v_aux_loop_ii:NN #1 #2 +\cs_new_protected:Npn \__xparse_grab_v_aux_loop_ii:NN #1 #2 { - \xparse_grab_v_token_if_char:NTF #2 + \__xparse_grab_v_token_if_char:NTF #2 { \token_if_eq_charcode:NNTF #1 #2 - { \xparse_grab_v_aux_loop_end: } + { \__xparse_grab_v_aux_loop_end: } { - \xparse_grab_v_aux_put:N #2 - \xparse_grab_v_aux_loop:N #1 + \__xparse_grab_v_aux_put:N #2 + \__xparse_grab_v_aux_loop:N #1 } } - { \xparse_grab_v_aux_abort: #2 } + { \__xparse_grab_v_aux_abort: #2 } } -\cs_new_protected_nopar:Npn \xparse_grab_v_aux_loop_end: +\cs_new_protected_nopar: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_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 } -\int_new:N \l_xparse_v_nesting_int -\cs_new_protected_nopar:Npx \xparse_grab_v_bgroup: +\int_new:N \l__xparse_v_nesting_int +\cs_new_protected_nopar:Npx \__xparse_grab_v_bgroup: { - \exp_not:N \xparse_grab_v_aux_catcodes: - \exp_not:n { \int_set_eq:NN \l_xparse_v_nesting_int \c_one } - \exp_not:N \xparse_grab_v_aux_put:N \iow_char:N \{ - \exp_not:N \xparse_grab_v_bgroup_loop: + \exp_not:N \__xparse_grab_v_aux_catcodes: + \exp_not:n { \int_set_eq:NN \l__xparse_v_nesting_int \c_one } + \exp_not:N \__xparse_grab_v_aux_put:N \iow_char:N \{ + \exp_not:N \__xparse_grab_v_bgroup_loop: } -\cs_new_protected:Npn \xparse_grab_v_bgroup_loop: +\cs_new_protected:Npn \__xparse_grab_v_bgroup_loop: { \peek_N_type:TF - { \xparse_grab_v_bgroup_loop_ii:N } - { \xparse_grab_v_aux_abort: } + { \__xparse_grab_v_bgroup_loop_ii:N } + { \__xparse_grab_v_aux_abort: } } -\cs_new_protected:Npn \xparse_grab_v_bgroup_loop_ii:N #1 +\cs_new_protected:Npn \__xparse_grab_v_bgroup_loop_ii:N #1 { - \xparse_grab_v_token_if_char:NTF #1 + \__xparse_grab_v_token_if_char:NTF #1 { \token_if_eq_charcode:NNTF \c_group_end_token #1 { - \int_decr:N \l_xparse_v_nesting_int - \int_compare:nNnTF \l_xparse_v_nesting_int > \c_zero + \int_decr:N \l__xparse_v_nesting_int + \int_compare:nNnTF \l__xparse_v_nesting_int > \c_zero { - \xparse_grab_v_aux_put:N #1 - \xparse_grab_v_bgroup_loop: + \__xparse_grab_v_aux_put:N #1 + \__xparse_grab_v_bgroup_loop: } - { \xparse_grab_v_aux_loop_end: } + { \__xparse_grab_v_aux_loop_end: } } { \token_if_eq_charcode:NNT \c_group_begin_token #1 - { \int_incr:N \l_xparse_v_nesting_int } - \xparse_grab_v_aux_put:N #1 - \xparse_grab_v_bgroup_loop: + { \int_incr:N \l__xparse_v_nesting_int } + \__xparse_grab_v_aux_put:N #1 + \__xparse_grab_v_bgroup_loop: } } - { \xparse_grab_v_aux_abort: #1 } + { \__xparse_grab_v_aux_abort: #1 } } -\cs_new_protected_nopar:Npn \xparse_grab_v_aux_catcodes: +\cs_new_protected_nopar:Npn \__xparse_grab_v_aux_catcodes: { \cs_set_eq:NN \do \char_set_catcode_other:N \dospecials \tex_endlinechar:D = `\^^M \scan_stop: - \bool_if:NTF \l_xparse_long_bool + \bool_if:NTF \l__xparse_long_bool { \char_set_catcode_other:n { \tex_endlinechar:D } } { \char_set_catcode_parameter:n { \tex_endlinechar:D } } } -\cs_new_protected_nopar:Npn \xparse_grab_v_aux_abort: +\cs_new_protected_nopar:Npn \__xparse_grab_v_aux_abort: { - \xparse_grab_v_group_end: - \xparse_add_arg:n { \NoValue } - \exp_after:wN \xparse_grab_v_aux_abort_ii:w \l_xparse_args_tl \q_stop + \__xparse_grab_v_group_end: + \__xparse_add_arg:o \c__xparse_no_value_tl + \exp_after:wN \__xparse_grab_v_aux_abort_ii:w \l__xparse_args_tl \q_stop } -\cs_new_protected:Npn \xparse_grab_v_aux_abort_ii:w #1 #2 \q_stop +\cs_new_protected:Npn \__xparse_grab_v_aux_abort_ii:w #1 #2 \q_stop { \group_begin: \char_set_lccode:nn { `\# } { \tex_endlinechar:D } \tl_to_lowercase:n { \group_end: \peek_meaning_remove:NTF ## } { - \msg_kernel_error:nnxx { xparse } { verbatim-newline } + \__msg_kernel_error:nnxx { xparse } { verbatim-newline } { \token_to_str:N #1 } - { \tl_to_str:N \l_xparse_v_arg_tl } - \l_xparse_v_rest_of_signature_tl \l_xparse_args_tl + { \tl_to_str:N \l__xparse_v_arg_tl } + \l__xparse_v_rest_of_signature_tl \l__xparse_args_tl } { - \msg_kernel_error:nnxx { xparse } { verbatim-already-tokenized } + \__msg_kernel_error:nnxx { xparse } { verbatim-already-tokenized } { \token_to_str:N #1 } - { \tl_to_str:N \l_xparse_v_arg_tl } - \l_xparse_v_rest_of_signature_tl \l_xparse_args_tl + { \tl_to_str:N \l__xparse_v_arg_tl } + \l__xparse_v_rest_of_signature_tl \l__xparse_args_tl } } -\cs_new_protected:Npn \xparse_grab_v_aux_put:N #1 +\cs_new_protected:Npn \__xparse_grab_v_aux_put:N #1 { - \tl_put_right:Nx \l_xparse_v_arg_tl + \tl_put_right:Nx \l__xparse_v_arg_tl { \token_if_active:NTF #1 { \exp_not:N #1 } { \token_to_str:N #1 } } } -\cs_new_protected:Npn \xparse_grab_v_token_if_char:NTF #1 - { \str_if_eq:xxTF { } { \str_tail:n {#1} } } -\cs_new_protected:Npn \xparse_add_arg:n #1 +\cs_new_protected:Npn \__xparse_grab_v_token_if_char:NTF #1 + { \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} } } + \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} + \__xparse_if_no_value:nTF {#1} { - \int_zero:N \l_xparse_processor_int - \tl_put_right:Nn \l_xparse_args_tl { {#1} } + \int_zero:N \l__xparse_processor_int + \tl_put_right:Nn \l__xparse_args_tl { {#1} } } - { \xparse_add_arg_aux:n {#1} } + { \__xparse_add_arg_aux:n {#1} } } } -\cs_generate_variant:Nn \xparse_add_arg:n { V , o } -\cs_new_protected:Npn \xparse_add_arg_aux:n #1 +\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 + \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 + \tl_put_right:Nx \l__xparse_args_tl { { \exp_not:V \ProcessedArgument } } } - { \xparse_add_arg_aux:V \ProcessedArgument } + { \__xparse_add_arg_aux:V \ProcessedArgument } } -\cs_generate_variant:Nn \xparse_add_arg_aux:n { V } -\cs_new:Npn \xparse_expandable_grab_D:w #1 \q_xparse #2 - { #2 { \xparse_expandable_grab_D_i:NNNnwNn #1 \q_xparse #2 } } -\cs_new:Npn \xparse_expandable_grab_D_i:NNNnwNn #1#2#3#4#5 \q_xparse #6#7 +\cs_generate_variant:Nn \__xparse_add_arg_aux:n { V } +\cs_new:Npn \__xparse_expandable_grab_D:w #1 \q__xparse #2 + { #2 { \__xparse_expandable_grab_D_i:NNNnwNn #1 \q__xparse #2 } } +\cs_new:Npn \__xparse_expandable_grab_D_i:NNNnwNn #1#2#3#4#5 \q__xparse #6#7 { \str_if_eq:onTF - { #1 { } { } #7 #2 \q_xparse #3 } + { #1 { } { } #7 #2 \q__xparse #3 } { { } { #2 } { } } { #1 - { \xparse_expandable_grab_D_ii:NNNwNnnn #1#2#3#5 \q_xparse #6 } - \q_nil { } #2 \ERROR \q_xparse \ERROR + { \__xparse_expandable_grab_D_ii:NNNwNnnn #1#2#3#5 \q__xparse #6 } + \q_nil { } #2 \ERROR \q__xparse \ERROR } - { #5 {#4} \q_xparse #6 {#7} } + { #5 {#4} \q__xparse #6 {#7} } } -\cs_new:Npn \xparse_expandable_grab_D_ii:NNNwNnnn #1#2#3#4 \q_xparse #5#6#7#8 +\cs_new:Npn \__xparse_expandable_grab_D_ii:NNNwNnnn #1#2#3#4 \q__xparse #5#6#7#8 { - \exp_args:Nof \xparse_expandable_grab_D_iv:nnNNNwN + \exp_args:Nof \__xparse_expandable_grab_D_iv:nnNNNwN { \use_ii:nn #6 #2 } - { \xparse_expandable_grab_D_iii:Nw #3 \exp_stop_f: #7 #8 } - #1#2#3 #4 \q_xparse #5 + { \__xparse_expandable_grab_D_iii:Nw #3 \exp_stop_f: #7 #8 } + #1#2#3 #4 \q__xparse #5 } -\cs_new:Npn \xparse_expandable_grab_D_iii:Nw #1#2 \ERROR \ERROR { #2 #1 } -\cs_new:Npn \xparse_expandable_grab_D_iv:nnNNNwN #1#2#3#4#5#6 \q_xparse #7 +\cs_new:Npn \__xparse_expandable_grab_D_iii:Nw #1#2 \ERROR \ERROR { #2 #1 } +\cs_new:Npn \__xparse_expandable_grab_D_iv:nnNNNwN #1#2#3#4#5#6 \q__xparse #7 { \exp_args:No \tl_if_empty:oTF - { #3 { \use_none:nnn } #2 \q_xparse #5 #4 \q_xparse #5 } + { #3 { \use_none:nnn } #2 \q__xparse #5 #4 \q__xparse #5 } { - \xparse_put_arg_expandable:ow { \use_none:nn #1#2 } - #6 \q_xparse #7 + \__xparse_put_arg_expandable:ow { \use_none:nn #1#2 } + #6 \q__xparse #7 } { #3 - { \xparse_expandable_grab_D_ii:NNNwNnnn #3#4#5#6 \q_xparse #7 } - \q_nil {#1} #2 \ERROR \q_xparse \ERROR + { \__xparse_expandable_grab_D_ii:NNNwNnnn #3#4#5#6 \q__xparse #7 } + \q_nil {#1} #2 \ERROR \q__xparse \ERROR } } -\cs_new:Npn \xparse_expandable_grab_D_alt:w #1 \q_xparse #2 - { #2 { \xparse_expandable_grab_D_alt_i:NNnwNn #1 \q_xparse #2 } } -\cs_new:Npn \xparse_expandable_grab_D_alt_i:NNnwNn #1#2#3#4 \q_xparse #5#6 +\cs_new:Npn \__xparse_expandable_grab_D_alt:w #1 \q__xparse #2 + { #2 { \__xparse_expandable_grab_D_alt_i:NNnwNn #1 \q__xparse #2 } } +\cs_new:Npn \__xparse_expandable_grab_D_alt_i:NNnwNn #1#2#3#4 \q__xparse #5#6 { \str_if_eq:onTF { #1 { } #6 #2 #2 } { { } #2 } { #1 - { \xparse_expandable_grab_D_alt_ii:Nwn #5 #4 \q_xparse } + { \__xparse_expandable_grab_D_alt_ii:Nwn #5 #4 \q__xparse } #6 \ERROR } - { #4 {#3} \q_xparse #5 {#6} } + { #4 {#3} \q__xparse #5 {#6} } } -\cs_new:Npn \xparse_expandable_grab_D_alt_ii:Nwn #1#2 \q_xparse #3 - { \xparse_put_arg_expandable:ow { \use_none:n #3 } #2 \q_xparse #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 +\cs_new:Npn \__xparse_expandable_grab_D_alt_ii:Nwn #1#2 \q__xparse #3 + { \__xparse_put_arg_expandable:ow { \use_none:n #3 } #2 \q__xparse #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 { \str_if_eq:onTF - { #1 { } { } #7 #2 \q_xparse #3 } + { #1 { } { } #7 #2 \q__xparse #3 } { { } { #2 } { } } { #1 - { \xparse_expandable_grab_D_ii:NNNwNnnn #1#2#3#5 \q_xparse #6 } - \q_nil { } #2 \ERROR \q_xparse \ERROR + { \__xparse_expandable_grab_D_ii:NNNwNnnn #1#2#3#5 \q__xparse #6 } + \q_nil { } #2 \ERROR \q__xparse \ERROR } { - \msg_expandable_kernel_error:nnn + \__msg_kernel_expandable_error:nnn { xparse } { missing-required } {#2} - #5 {#4} \q_xparse #6 {#7} + #5 {#4} \q__xparse #6 {#7} } } -\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_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 { \str_if_eq:onTF { #1 { } #6 #2 #2 } { { } #2 } { #1 - { \xparse_expandable_grab_D_alt_ii:Nwn #5 #4 \q_xparse } + { \__xparse_expandable_grab_D_alt_ii:Nwn #5 #4 \q__xparse } #6 \ERROR } { - \msg_expandable_kernel_error:nnn + \__msg_kernel_expandable_error:nnn { xparse } { missing-required } {#2} - #4 {#3} \q_xparse #5 {#6} + #4 {#3} \q__xparse #5 {#6} } } -\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 +\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 { \str_if_eq:onTF { #1 { } #5 #2 } { #2 } - { #3 { \BooleanTrue } \q_xparse #4 } - { #3 { \BooleanFalse } \q_xparse #4 {#5} } + { #3 { \BooleanTrue } \q__xparse #4 } + { #3 { \BooleanFalse } \q__xparse #4 {#5} } } -\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 +\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:cpn { xparse_processor_ \int_use:N \l_xparse_processor_int :n } ##1 + \int_incr:N \l__xparse_processor_int + \cs_set:cpn { __xparse_processor_ \int_use:N \l__xparse_processor_int :n } ##1 { #1 {##1} } } -\cs_new_protected:Npn \xparse_process_to_str:n #1 +\cs_new_protected:Npn \__xparse_process_to_str:n #1 { \tl_set:Nx \ProcessedArgument { \tl_to_str:n {#1} } } -\cs_new_protected:Npn \xparse_bool_reverse:N #1 +\cs_new_protected:Npn \__xparse_bool_reverse:N #1 { \bool_if:NTF #1 { \tl_set:Nn \ProcessedArgument { \c_false_bool } } { \tl_set:Nn \ProcessedArgument { \c_true_bool } } } -\seq_new:N \l_xparse_split_list_seq -\tl_new:N \l_xparse_split_list_tl -\cs_new_protected:Npn \xparse_split_list:nn #1#2 +\seq_new:N \l__xparse_split_list_seq +\tl_new:N \l__xparse_split_list_tl +\cs_new_protected:Npn \__xparse_split_list:nn #1#2 { \bool_if:nTF { \tl_if_single_p:n {#1} && ! ( \token_if_cs_p:N #1 ) } - { \xparse_split_list_single:Nn #1 {#2} } - { \xparse_split_list_multi:nn {#1} {#2} } + { \__xparse_split_list_single:Nn #1 {#2} } + { \__xparse_split_list_multi:nn {#1} {#2} } } -\cs_set_protected:Npn \xparse_split_list_multi:nn #1#2 +\cs_set_protected:Npn \__xparse_split_list_multi:nn #1#2 { - \seq_set_split:Nnn \l_xparse_split_list_seq {#1} {#2} + \seq_set_split:Nnn \l__xparse_split_list_seq {#1} {#2} \tl_clear:N \ProcessedArgument - \seq_map_inline:Nn \l_xparse_split_list_seq + \seq_map_inline:Nn \l__xparse_split_list_seq { \tl_put_right:Nn \ProcessedArgument { {##1} } } } -\cs_generate_variant:Nn \xparse_split_list_multi:nn { nV } +\cs_generate_variant:Nn \__xparse_split_list_multi:nn { nV } \group_begin: \char_set_catcode_active:N \@ -\cs_new_protected:Npn \xparse_split_list_single:Nn #1#2 +\cs_new_protected:Npn \__xparse_split_list_single:Nn #1#2 { - \tl_set:Nn \l_xparse_split_list_tl {#2} + \tl_set:Nn \l__xparse_split_list_tl {#2} \group_begin: \char_set_lccode:nn { `\@ } { `#1 } \tl_to_lowercase:n { \group_end: - \tl_replace_all:Nnn \l_xparse_split_list_tl { @ } {#1} + \tl_replace_all:Nnn \l__xparse_split_list_tl { @ } {#1} } - \xparse_split_list_multi:nV {#1} \l_xparse_split_list_tl + \__xparse_split_list_multi:nV {#1} \l__xparse_split_list_tl } \group_end: -\cs_new_protected:Npn \xparse_split_argument:nnn #1#2#3 +\cs_new_protected:Npn \__xparse_split_argument:nnn #1#2#3 { - \xparse_split_list:nn {#2} {#3} - \exp_args:Nf \xparse_split_argument_aux:nnnn - { \tl_length:N \ProcessedArgument } + \__xparse_split_list:nn {#2} {#3} + \exp_args:Nf \__xparse_split_argument_aux:nnnn + { \tl_count:N \ProcessedArgument } {#1} {#2} {#3} } -\cs_new_protected:Npn \xparse_split_argument_aux:nnnn #1#2#3#4 +\cs_new_protected:Npn \__xparse_split_argument_aux:nnnn #1#2#3#4 { \int_compare:nNnF {#1} = { #2 + \c_one } { @@ -1269,13 +1284,13 @@ \tl_set:Nx \ProcessedArgument { \exp_last_unbraced:NnNo - \xparse_split_argument_aux:n + \__xparse_split_argument_aux:n { #2 + \c_one } \use_none_delimit_by_q_stop:w \ProcessedArgument \q_stop } - \msg_kernel_error:nnxxx { xparse } { split-excess-tokens } + \__msg_kernel_error:nnxxx { xparse } { split-excess-tokens } { \tl_to_str:n {#3} } { \int_eval:n { #2 + \c_one } } { \tl_to_str:n {#4} } } @@ -1283,63 +1298,80 @@ \tl_put_right:Nx \ProcessedArgument { \prg_replicate:nn { #2 + \c_one - (#1) } - { { \exp_not:n { \NoValue } } } + { { \exp_not:V \c__xparse_no_value_tl } } } } } } -\cs_new:Npn \xparse_split_argument_aux:n #1 - { \prg_replicate:nn {#1} { \xparse_split_argument_aux:wn } } -\cs_new:Npn \xparse_split_argument_aux:wn #1 \use_none_delimit_by_q_stop:w #2 +\cs_new:Npn \__xparse_split_argument_aux:n #1 + { \prg_replicate:nn {#1} { \__xparse_split_argument_aux:wn } } +\cs_new:Npn \__xparse_split_argument_aux:wn #1 \use_none_delimit_by_q_stop:w #2 { \exp_not:n { {#2} } #1 \use_none_delimit_by_q_stop:w } -\cs_new_protected:Npn \xparse_trim_spaces:n #1 +\cs_new_protected:Npn \__xparse_trim_spaces:n #1 { \tl_set:Nx \ProcessedArgument { \tl_trim_spaces:n {#1} } } -\cs_new_protected:Npn \xparse_get_arg_spec:N #1 +\cs_new_protected:Npn \__xparse_get_arg_spec:N #1 { - \prop_get:NnNF \l_xparse_command_arg_specs_prop {#1} + \prop_get:NnNF \l__xparse_command_arg_specs_prop {#1} \ArgumentSpecification { - \msg_kernel_error:nnx { xparse } { unknown-document-command } + \__msg_kernel_error:nnx { xparse } { unknown-document-command } { \token_to_str:N #1 } } } -\cs_new_protected:Npn \xparse_get_arg_spec:n #1 +\cs_new_protected:Npn \__xparse_get_arg_spec:n #1 { - \prop_get:NnNF \l_xparse_environment_arg_specs_prop {#1} + \prop_get:NnNF \l__xparse_environment_arg_specs_prop {#1} \ArgumentSpecification { - \msg_kernel_error:nnx { xparse } { unknown-document-environment } + \__msg_kernel_error:nnx { xparse } { unknown-document-environment } { \tl_to_str:n {#1} } } } \tl_new:N \ArgumentSpecification -\cs_new_protected:Npn \xparse_show_arg_spec:N #1 +\cs_new_protected:Npn \__xparse_show_arg_spec:N #1 { - \prop_get:NnNTF \l_xparse_command_arg_specs_prop {#1} + \prop_get:NnNTF \l__xparse_command_arg_specs_prop {#1} \ArgumentSpecification { \tl_show:N \ArgumentSpecification } { - \msg_kernel_error:nnx { xparse } { unknown-document-command } + \__msg_kernel_error:nnx { xparse } { unknown-document-command } { \token_to_str:N #1 } } } -\cs_new_protected:Npn \xparse_show_arg_spec:n #1 +\cs_new_protected:Npn \__xparse_show_arg_spec:n #1 { - \prop_get:NnNTF \l_xparse_environment_arg_specs_prop {#1} + \prop_get:NnNTF \l__xparse_environment_arg_specs_prop {#1} \ArgumentSpecification { \tl_show:N \ArgumentSpecification } { - \msg_kernel_error:nnx { xparse } { unknown-document-environment } + \__msg_kernel_error:nnx { xparse } { unknown-document-environment } { \tl_to_str:n {#1} } } } -\prg_new_conditional:Npnn \xparse_if_no_value:n #1 { T , F , TF } - { \str_if_eq:nnTF {#1} { \NoValue } \prg_return_true: \prg_return_false: } -\msg_kernel_new:nnnn { xparse } { bad-arg-spec } +\group_begin: +\char_set_lccode:nn { `\Q } { `\- } +\char_set_lccode:nn { `\F } { `\F } +\char_set_lccode:nn { `\N } { `\N } +\char_set_lccode:nn { `\T } { `\T } +\char_set_lccode:nn { `\V } { `\V } +\tl_to_lowercase:n + { + \group_end: + \prg_new_conditional:Npnn \__xparse_if_no_value:n #1 { T , F , TF } + { + \str_if_eq:onTF + { \__xparse_if_value_aux:w ? #1 { } QNoValue- } + { ? { } QNoValue- } + { \prg_return_true: } + { \prg_return_false: } + } + \cs_new:Npn \__xparse_if_value_aux:w #1 QNoValue- { #1 } + } +\__msg_kernel_new:nnnn { xparse } { bad-arg-spec } { Bad~argument~specification~'#1'. } { \c_msg_coding_error_text_tl @@ -1347,48 +1379,48 @@ one~or~more~mandatory~pieces~of~information~were~missing. \\ \\ LaTeX~will~ignore~this~entire~definition. } -\msg_kernel_new:nnnn { xparse } { command-already-defined } +\__msg_kernel_new:nnnn { xparse } { command-already-defined } { Command~'#1'~already~defined! } { You~have~used~\NewDocumentCommand with~a~command~that~already~has~a~definition. \\ The~existing~definition~of~'#1'~will~be~overwritten. } -\msg_kernel_new:nnnn { xparse } { command-not-yet-defined } +\__msg_kernel_new:nnnn { xparse } { command-not-yet-defined } { Command ~'#1'~not~yet~defined! } { You~have~used~\RenewDocumentCommand with~a~command~that~was~never~defined.\\ A~new~command~'#1'~will~be~created. } -\msg_kernel_new:nnnn { xparse } { environment-already-defined } +\__msg_kernel_new:nnnn { xparse } { environment-already-defined } { Environment~'#1'~already~defined! } { You~have~used~\NewDocumentEnvironment with~an~environment~that~already~has~a~definition.\\ The~existing~definition~of~'#1'~will~be~overwritten. } -\msg_kernel_new:nnnn { xparse } { environment-mismatch } +\__msg_kernel_new:nnnn { xparse } { environment-mismatch } { Mismatch~between~start~and~end~of~environment. } { The~current~environment~is~called~'#1',~but~you~have~tried~to~ end~one~called~'#2'.~Environments~have~to~be~properly~nested. } -\msg_kernel_new:nnnn { xparse } { environment-not-yet-defined } +\__msg_kernel_new:nnnn { xparse } { environment-not-yet-defined } { Environment~'#1'~not~yet~defined! } { You~have~used~\RenewDocumentEnvironment with~an~environment~that~was~never~defined.\\ A~new~environment~'#1'~will~be~created. } -\msg_kernel_new:nnnn { xparse } { environment-unknown } +\__msg_kernel_new:nnnn { xparse } { environment-unknown } { Environment~'#1'~undefined. } { You~have~tried~to~start~an~environment~called~'#1',~ but~this~has~never~been~defined.\\ The~command~will~be~ignored. } -\msg_kernel_new:nnnn { xparse } { expandable-ending-optional } +\__msg_kernel_new:nnnn { xparse } { expandable-ending-optional } { Argument~specification~for~expandable~command~ends~with~optional~argument. } { \c_msg_coding_error_text_tl @@ -1396,14 +1428,14 @@ (or~no~arguments~at~all).~You~cannot~have~a~terminal~optional~ argument~with~expandable~commands. } -\msg_kernel_new:nnnn { xparse } { inconsistent-long } +\__msg_kernel_new:nnnn { xparse } { inconsistent-long } { Inconsistent~long~arguments~for~expandable~command. } { \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 } +\__msg_kernel_new:nnnn { xparse } { invalid-expandable-argument-type } { Argument~type~'#1'~not~available~for~an~expandable~function. } { \c_msg_coding_error_text_tl @@ -1412,14 +1444,14 @@ \\ \\ LaTeX~will~assume~you~want~a~standard~mandatory~argument~(type~'m'). } -\msg_kernel_new:nnnn { xparse } { missing-required } +\__msg_kernel_new:nnnn { xparse } { missing-required } { Failed~to~find~required~argument~starting~with~'#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. } -\msg_kernel_new:nnnn { xparse } { not-single-token } +\__msg_kernel_new:nnnn { xparse } { not-single-token } { Argument~delimiter~should~be~a~single~token:~'#1'. } { \c_msg_coding_error_text_tl @@ -1427,40 +1459,40 @@ in~a~place~where~a~single~token~is~required,~LaTeX~found~'#1'. \\ \\ LaTeX~will~ignore~this~entire~definition. } -\msg_kernel_new:nnnn { xparse } { processor-in-expandable } +\__msg_kernel_new:nnnn { xparse } { processor-in-expandable } { Argument~processors~cannot~be~used~with~expandable~functions. } { \c_msg_coding_error_text_tl The~argument~specification~for~#1~contains~a~processor~function:~ this~is~only~supported~for~standard~robust~functions. } -\msg_kernel_new:nnnn { xparse } { split-excess-tokens } +\__msg_kernel_new:nnnn { xparse } { split-excess-tokens } { Too~many~'#1'~tokens~when~trying~to~split~argument. } { LaTeX~was~asked~to~split~the~input~'#3'~ 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 } { unknown-argument-type } +\__msg_kernel_new:nnnn { xparse } { unknown-argument-type } { Unknown~argument~type~'#1'~replaced~by~'m'. } { \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'). } -\msg_kernel_new:nnnn { xparse } { unknown-document-command } +\__msg_kernel_new:nnnn { xparse } { unknown-document-command } { Unknown~document~command~'#1'. } { You~have~asked~for~the~argument~specification~for~a~command~'#1',~ but~this~is~not~a~document~command. } -\msg_kernel_new:nnnn { xparse } { unknown-document-environment } +\__msg_kernel_new:nnnn { xparse } { unknown-document-environment } { Unknown~document~environment~'#1'. } { You~have~asked~for~the~argument~specification~for~a~command~'#1',~ but~this~is~not~a~document~environment. } -\msg_kernel_new:nnnn { xparse } { verbatim-newline } +\__msg_kernel_new:nnnn { xparse } { verbatim-newline } { Verbatim~argument~of~#1~ended~by~end~of~line. } { The~verbatim~argument~of~#1~cannot~contain~more~than~one~line,~but~the~end~ @@ -1469,7 +1501,7 @@ \\ \\ LaTeX~will~ignored~'#2'. } -\msg_kernel_new:nnnn { xparse } { verbatim-already-tokenized } +\__msg_kernel_new:nnnn { xparse } { verbatim-already-tokenized } { Verbatim~command~#1~illegal~in~command~argument. } { The~command~#1~takes~a~verbatim~argument.~It~may~not~appear~within~ @@ -1477,22 +1509,22 @@ \\ \\ LaTeX~will~ignore~'#2'. } -\msg_kernel_new:nnn { xparse } { define-command } +\__msg_kernel_new:nnn { xparse } { define-command } { Defining~document~command~#1~ with~arg.~spec.~'#2'~\msg_line_context:. } -\msg_kernel_new:nnn { xparse } { define-environment } +\__msg_kernel_new:nnn { xparse } { define-environment } { Defining~document~environment~'#1'~ with~arg.~spec.~'#2'~\msg_line_context:. } -\msg_kernel_new:nnn { xparse } { redefine-command } +\__msg_kernel_new:nnn { xparse } { redefine-command } { Redefining~document~command~#1~ with~arg.~spec.~'#2'~\msg_line_context:. } -\msg_kernel_new:nnn { xparse } { redefine-environment } +\__msg_kernel_new:nnn { xparse } { redefine-environment } { Redefining~document~environment~'#1'~ with~arg.~spec.~'#2'~\msg_line_context:. @@ -1500,65 +1532,64 @@ \cs_new_eq:NN \BooleanFalse \c_false_bool \cs_new_eq:NN \BooleanTrue \c_true_bool \cs_new_protected:Npn \DeclareDocumentCommand #1#2#3 - { \xparse_declare_cmd:Nnn #1 {#2} {#3} } + { \__xparse_declare_cmd:Nnn #1 {#2} {#3} } \cs_new_protected:Npn \NewDocumentCommand #1#2#3 { \cs_if_exist:NTF #1 { - \msg_kernel_error:nnx { xparse } { command-already-defined } + \__msg_kernel_error:nnx { xparse } { command-already-defined } { \token_to_str:N #1 } } - { \xparse_declare_cmd:Nnn #1 {#2} {#3} } + { \__xparse_declare_cmd:Nnn #1 {#2} {#3} } } \cs_new_protected:Npn \RenewDocumentCommand #1#2#3 { \cs_if_exist:NTF #1 - { \xparse_declare_cmd:Nnn #1 {#2} {#3} } + { \__xparse_declare_cmd:Nnn #1 {#2} {#3} } { - \msg_kernel_error:nnx { xparse } { command-not-yet-defined } + \__msg_kernel_error:nnx { xparse } { command-not-yet-defined } { \token_to_str:N #1 } } } \cs_new_protected:Npn \ProvideDocumentCommand #1#2#3 - { \cs_if_exist:NF #1 { \xparse_declare_cmd:Nnn #1 {#2} {#3} } } + { \cs_if_exist:NF #1 { \__xparse_declare_cmd:Nnn #1 {#2} {#3} } } \cs_new_protected:Npn \DeclareDocumentEnvironment #1#2#3#4 - { \xparse_declare_env:nnnn {#1} {#2} {#3} {#4} } + { \__xparse_declare_env:nnnn {#1} {#2} {#3} {#4} } \cs_new_protected:Npn \NewDocumentEnvironment #1#2#3#4 { \cs_if_exist:cTF {#1} - { \msg_kernel_error:nnx { xparse } { environment-already-defined } {#1} } - { \xparse_declare_env:nnnn {#1} {#2} {#3} {#4} } + { \__msg_kernel_error:nnx { xparse } { environment-already-defined } {#1} } + { \__xparse_declare_env:nnnn {#1} {#2} {#3} {#4} } } \cs_new_protected:Npn \RenewDocumentEnvironment #1#2#3#4 { \cs_if_exist:cTF {#1} - { \xparse_declare_env:nnnn {#1} {#2} {#3} {#4} } - { \msg_kernel_error:nnx { xparse } { environment-not-yet-defined } {#1} } + { \__xparse_declare_env:nnnn {#1} {#2} {#3} {#4} } + { \__msg_kernel_error:nnx { xparse } { environment-not-yet-defined } {#1} } } \cs_new_protected:Npn \ProvideDocumentEnvironment #1#2#3#4 - { \cs_if_exist:cF { #1 } { \xparse_declare_env:nnnn {#1} {#2} {#3} {#4} } } + { \cs_if_exist:cF { #1 } { \__xparse_declare_env:nnnn {#1} {#2} {#3} {#4} } } \cs_new_protected:Npn \DeclareExpandableDocumentCommand #1#2#3 - { \xparse_declare_expandable_cmd:Nnn #1 {#2} {#3} } + { \__xparse_declare_expandable_cmd:Nnn #1 {#2} {#3} } \cs_new_eq:NN \IfBooleanTF \bool_if:NTF \cs_new_eq:NN \IfBooleanT \bool_if:NT \cs_new_eq:NN \IfBooleanF \bool_if:NF -\cs_new_eq:NN \IfNoValueF \xparse_if_no_value:nF -\cs_new_eq:NN \IfNoValueT \xparse_if_no_value:nT -\cs_new_eq:NN \IfNoValueTF \xparse_if_no_value:nTF -\cs_set:Npn \IfValueF { \xparse_if_no_value:nT } -\cs_set:Npn \IfValueT { \xparse_if_no_value:nF } -\cs_set:Npn \IfValueTF #1#2#3 { \xparse_if_no_value:nTF {#1} {#3} {#2} } -\cs_new_protected:Npn \NoValue { -NoValue- } +\cs_new_eq:NN \IfNoValueF \__xparse_if_no_value:nF +\cs_new_eq:NN \IfNoValueT \__xparse_if_no_value:nT +\cs_new_eq:NN \IfNoValueTF \__xparse_if_no_value:nTF +\cs_set:Npn \IfValueF { \__xparse_if_no_value:nT } +\cs_set:Npn \IfValueT { \__xparse_if_no_value:nF } +\cs_set:Npn \IfValueTF #1#2#3 { \__xparse_if_no_value:nTF {#1} {#3} {#2} } \tl_new:N \ProcessedArgument -\cs_new_eq:NN \ReverseBoolean \xparse_bool_reverse:N -\cs_new_eq:NN \SplitArgument \xparse_split_argument:nnn -\cs_new_eq:NN \SplitList \xparse_split_list:nn -\cs_new_eq:NN \TrimSpaces \xparse_trim_spaces:n +\cs_new_eq:NN \ReverseBoolean \__xparse_bool_reverse:N +\cs_new_eq:NN \SplitArgument \__xparse_split_argument:nnn +\cs_new_eq:NN \SplitList \__xparse_split_list:nn +\cs_new_eq:NN \TrimSpaces \__xparse_trim_spaces:n \cs_new_eq:NN \ProcessList \tl_map_function:nN -\cs_new_eq:NN \GetDocumentCommandArgSpec \xparse_get_arg_spec:N -\cs_new_eq:NN \GetDocumentEnvironmmentArgSpec \xparse_get_arg_spec:n -\cs_new_eq:NN \ShowDocumentCommandArgSpec \xparse_show_arg_spec:N -\cs_new_eq:NN \ShowDocumentEnvironmentArgSpec \xparse_show_arg_spec:n +\cs_new_eq:NN \GetDocumentCommandArgSpec \__xparse_get_arg_spec:N +\cs_new_eq:NN \GetDocumentEnvironmmentArgSpec \__xparse_get_arg_spec:n +\cs_new_eq:NN \ShowDocumentCommandArgSpec \__xparse_show_arg_spec:N +\cs_new_eq:NN \ShowDocumentEnvironmentArgSpec \__xparse_show_arg_spec:n \DeclareOption { log-declarations = true } { } \DeclareOption { log-declarations = false } { |