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 | 65 |
1 files changed, 36 insertions, 29 deletions
diff --git a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty index d42c43a7064..a5b1d40d9f5 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-2017 The LaTeX3 Project -\RequirePackage{expl3}[2018/02/21] -\@ifpackagelater{expl3}{2018/02/21} +%% (C) Copyright 2009-2018 The LaTeX3 Project +\RequirePackage{expl3}[2018-04-12] +\@ifpackagelater{expl3}{2018-04-12} {} {% \PackageError{xparse}{Support package l3kernel too old} @@ -36,7 +36,7 @@ }% \endinput } -\ProvidesExplPackage{xparse}{2018/02/21}{} +\ProvidesExplPackage{xparse}{2018-04-30}{} {L3 Experimental document command parser} \tl_new:N \l__xparse_arg_spec_tl \tl_new:N \l__xparse_args_tl @@ -60,6 +60,7 @@ \bool_new:N \l__xparse_grab_expandably_bool \tl_new:N \l__xparse_last_delimiters_tl \bool_new:N \l__xparse_long_bool +\bool_new:N \l__xparse_ignore_spaces_bool \int_new:N \l__xparse_m_args_int \int_new:N \l__xparse_mandatory_args_int \bool_new:N \l__xparse_prefixed_bool @@ -364,6 +365,7 @@ \bool_set_false:N \l__xparse_long_bool \bool_set_false:N \l__xparse_some_long_bool \bool_set_false:N \l__xparse_some_short_bool + \bool_set_false:N \l__xparse_ignore_spaces_bool \__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 @@ -446,6 +448,13 @@ \int_decr:N \l__xparse_current_arg_int \__xparse_normalize_arg_spec_loop:n {#1} } +\cs_new_protected:cpn { __xparse_normalize_type_!:w } #1 + { + \quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn } + \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_normalize_type_D:w #1#2#3 { \quark_if_recursion_tail_stop_do:nn {#3} { \__xparse_bad_arg_spec:wn } @@ -543,7 +552,7 @@ } \cs_new_protected:Npn \__xparse_single_char_check:n #1 { - \exp_args:Nx \tl_if_single_token:nTF { \tl_trim_spaces:n {#1} } + \tl_trim_spaces_apply:nN {#1} \tl_if_single_token:nTF { \group_begin: \tex_escapechar:D = 92 \scan_stop: @@ -626,6 +635,7 @@ { \int_zero:N \l__xparse_current_arg_int \bool_set_false:N \l__xparse_long_bool + \bool_set_false:N \l__xparse_ignore_spaces_bool \int_zero:N \l__xparse_m_args_int \bool_set_false:N \l__xparse_defaults_bool \tl_clear:N \l__xparse_defaults_tl @@ -658,6 +668,13 @@ \bool_set_true:N \l__xparse_prefixed_bool \__xparse_prepare_signature_bypass:N } +\cs_new_protected:cpn { __xparse_add_type_!:w } + { + \__xparse_flush_m_args: + \bool_set_true:N \l__xparse_ignore_spaces_bool + \bool_set_true:N \l__xparse_prefixed_bool + \__xparse_prepare_signature_bypass:N + } \cs_new_protected:cpn { __xparse_add_type_>:w } #1 { \__xparse_flush_m_args: @@ -768,12 +785,15 @@ { __xparse_grab_ #1 \bool_if:NT \l__xparse_long_bool { _long } - \int_compare:nNnF \l__xparse_mandatory_args_int > 0 - { _trailing } + \bool_lazy_and:nnT + { \l__xparse_ignore_spaces_bool } + { \int_compare_p:nNn \l__xparse_mandatory_args_int = 0 } + { _ignore_spaces } :w } } \bool_set_false:N \l__xparse_long_bool + \bool_set_false:N \l__xparse_ignore_spaces_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 @@ -941,9 +961,9 @@ \__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 \__xparse_run_code: +\cs_new_protected:Npn \__xparse_grab_D_ignore_spaces: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: +\cs_new_protected:Npn \__xparse_grab_D_long_ignore_spaces: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 { @@ -1033,13 +1053,13 @@ \cs_set_protected:Npn { _ignore_spaces } } -\cs_new_protected:Npn \__xparse_grab_E_trailing:w #1#2 \__xparse_run_code: +\cs_new_protected:Npn \__xparse_grab_E_ignore_spaces:w #1#2 \__xparse_run_code: { \__xparse_grab_E:nnNn {#1} {#2} \cs_set_protected_nopar:Npn { } } -\cs_new_protected:Npn \__xparse_grab_E_long_trailing:w #1#2 \__xparse_run_code: +\cs_new_protected:Npn \__xparse_grab_E_long_ignore_spaces:w #1#2 \__xparse_run_code: { \__xparse_grab_E:nnNn {#1} {#2} \cs_set_protected:Npn @@ -1087,9 +1107,9 @@ { \__xparse_grab_G_aux:nNn {#1} \cs_set_protected:Npn { _ignore_spaces } } -\cs_new_protected:Npn \__xparse_grab_G_trailing:w #1 \__xparse_run_code: +\cs_new_protected:Npn \__xparse_grab_G_ignore_spaces: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: +\cs_new_protected:Npn \__xparse_grab_G_long_ignore_spaces: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 { @@ -1203,9 +1223,9 @@ \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 +\cs_new_protected:Npn \__xparse_grab_t_ignore_spaces: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_eq:NN \__xparse_grab_t_long_ignore_spaces:w \__xparse_grab_t_ignore_spaces:w \cs_new_protected:Npn \__xparse_grab_t_aux:NNw #1#2#3 \__xparse_run_code: { \tl_set:Nn \l__xparse_signature_tl {#3} @@ -1717,7 +1737,7 @@ { \__xparse_get_arg_spec_error:n {#1} } } \cs_new_protected:Npn \__xparse_check_definable:nNT #1 - { \exp_args:Nx \__xparse_check_definable_aux:nN { \tl_trim_spaces:n {#1} } } + { \tl_trim_spaces_apply:nN {#1} \__xparse_check_definable_aux:nN } \group_begin: \char_set_catcode_active:n { `? } \cs_new_protected:Npn \__xparse_check_definable_aux:nN #1#2 @@ -1793,7 +1813,6 @@ \__kernel_msg_new:nnnn { xparse } { bad-arg-spec } { Bad~argument~specification~'#2'~for~command~'#1'. } { - \c__msg_coding_error_text_tl The~argument~specification~provided~was~not~valid:~ one~or~more~mandatory~pieces~of~information~were~missing. \\ \\ LaTeX~will~ignore~this~entire~definition. @@ -1832,7 +1851,6 @@ ends~with~optional~argument. } { - \c__msg_coding_error_text_tl Expandable~commands~must~have~a~final~mandatory~argument~ (or~no~arguments~at~all).~You~cannot~have~a~terminal~optional~ argument~with~expandable~commands. @@ -1840,21 +1858,18 @@ \__kernel_msg_new:nnnn { xparse } { if-boolean } { Invalid~use~\iow_char:N\\IfBooleanTF~{#1} } { - \c__msg_coding_error_text_tl The~first~argument~of~\iow_char:N\\IfBoolean(TF/T/F)~must~be~ a~boolean~argument~obtained~from~parsing~'s'~or~'t'~arguments. } \__kernel_msg_new:nnnn { xparse } { inconsistent-long } { Inconsistent~long~arguments~for~expandable~command~'#1'. } { - \c__msg_coding_error_text_tl The~arguments~for~an~expandable~command~must~not~involve~short~ arguments~after~long~arguments.~You~have~tried~to~mix~the~two~types. } \__kernel_msg_new:nnnn { xparse } { invalid-expandable-argument-type } { Argument~type~'#2'~not~available~for~expandable~command~'#1'. } { - \c__msg_coding_error_text_tl The~letter~'#2'~does~not~specify~an~argument~type~which~can~be~used~ in~an~expandable~command. \\ \\ @@ -1866,7 +1881,6 @@ for~expandable~command~'#1'. } { - \c__msg_coding_error_text_tl The~letter~'#2'~does~not~specify~an~argument~type~which~can~be~used~ in~an~expandable~command~after~an~optional~argument. \\ \\ @@ -1875,7 +1889,6 @@ \__kernel_msg_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. } @@ -1900,7 +1913,6 @@ \__kernel_msg_new:nnnn { xparse } { not-definable } { First~argument~of~'#2'~must~be~a~command. } { - \c__msg_coding_error_text_tl The~first~argument~of~'#2'~should~be~the~document~command~that~will~ be~defined.~The~provided~argument~'#1'~is~a~character.~Perhaps~a~ backslash~is~missing? @@ -1910,7 +1922,6 @@ \__kernel_msg_new:nnnn { xparse } { not-one-token } { First~argument~of~'#2'~must~be~a~command. } { - \c__msg_coding_error_text_tl The~first~argument~of~'#2'~should~be~the~document~command~that~will~ be~defined.~The~provided~argument~'#1'~contains~more~than~one~ token. @@ -1923,7 +1934,6 @@ a~single~character. } { - \c__msg_coding_error_text_tl The~argument~specification~provided~was~not~valid:~in~a~place~ where~a~single~character~is~required,~LaTeX~found~'#2'. \\ \\ LaTeX~will~ignore~this~entire~definition. @@ -1931,7 +1941,6 @@ \__kernel_msg_new:nnnn { xparse } { processor-in-expandable } { 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~commands. \\ \\ LaTeX~will~ignore~this~entire~definition. @@ -1946,7 +1955,6 @@ \__kernel_msg_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. @@ -1954,7 +1962,6 @@ \__kernel_msg_new:nnnn { xparse } { unknown-argument-type } { Unknown~argument~type~'#2'~for~the~command~'#1'. } { - \c__msg_coding_error_text_tl The~letter~'#2'~does~not~specify~a~known~argument~type.~ LaTeX~will~ignore~this~entire~definition. } |