From c50b7eaa45c94a09e1087c6c31f144b497057444 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 21 Dec 2015 23:28:17 +0000 Subject: l3 (21dec15) git-svn-id: svn://tug.org/texlive/trunk@39162 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/l3experimental/l3sort/l3sort.sty | 6 +- .../tex/latex/l3experimental/l3str/l3flag.sty | 6 +- .../latex/l3experimental/l3str/l3regex-trace.sty | 12 +- .../tex/latex/l3experimental/l3str/l3regex.sty | 12 +- .../latex/l3experimental/l3str/l3tl-analysis.sty | 6 +- .../tex/latex/l3experimental/l3str/l3tl-build.sty | 6 +- .../tex/latex/l3experimental/xgalley/l3galley.sty | 6 +- .../tex/latex/l3packages/l3keys2e/l3keys2e.sty | 8 +- .../tex/latex/l3packages/xfrac/xfrac.sty | 8 +- .../tex/latex/l3packages/xparse/xparse.sty | 378 +++++++++++++++------ .../tex/latex/l3packages/xtemplate/xtemplate.sty | 8 +- 11 files changed, 320 insertions(+), 136 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3sort/l3sort.sty b/Master/texmf-dist/tex/latex/l3experimental/l3sort/l3sort.sty index 3ee6f2e63c1..e2a8a46711a 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3sort/l3sort.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3sort/l3sort.sty @@ -46,8 +46,8 @@ %% %% ----------------------------------------------------------------------- %% -\RequirePackage{expl3}[2015/11/04] -\@ifpackagelater{expl3}{2015/11/04} +\RequirePackage{expl3}[2015/12/20] +\@ifpackagelater{expl3}{2015/12/20} {} {% \PackageError{l3sort}{Support package l3kernel too old} @@ -59,7 +59,7 @@ }% \endinput } -\GetIdInfo$Id: l3sort.dtx 6224 2015-11-04 08:38:08Z joseph $ +\GetIdInfo$Id: l3sort.dtx 6326 2015-12-20 18:42:59Z joseph $ {L3 Experimental sorting functions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty index b5ac4c9b2cb..67475d776ec 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty @@ -45,8 +45,8 @@ %% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- -\RequirePackage{expl3}[2015/11/04] -\@ifpackagelater{expl3}{2015/11/04} +\RequirePackage{expl3}[2015/12/20] +\@ifpackagelater{expl3}{2015/12/20} {} {% \PackageError{l3flag}{Support package l3kernel too old} @@ -58,7 +58,7 @@ }% \endinput } -\GetIdInfo$Id: l3flag.dtx 6224 2015-11-04 08:38:08Z joseph $ +\GetIdInfo$Id: l3flag.dtx 6326 2015-12-20 18:42:59Z joseph $ {L3 Experimental flags} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty index fef1274ed3a..9503a1366e0 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty @@ -45,8 +45,8 @@ %% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- -\RequirePackage{expl3}[2015/11/04] -\@ifpackagelater{expl3}{2015/11/04} +\RequirePackage{expl3}[2015/12/20] +\@ifpackagelater{expl3}{2015/12/20} {} {% \PackageError{l3regex}{Support package l3kernel too old} @@ -58,7 +58,7 @@ }% \endinput } -\GetIdInfo$Id: l3regex.dtx 6224 2015-11-04 08:38:08Z joseph $ +\GetIdInfo$Id: l3regex.dtx 6326 2015-12-20 18:42:59Z joseph $ {L3 Experimental regular expressions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -363,7 +363,7 @@ } { \char_set_lccode:nn { \c_zero } {#1} - \tl_to_lowercase:n + \tex_lowercase:D { \tl_set:Nx \l__regex_internal_b_tl { \if_false: } \fi: @@ -2249,7 +2249,7 @@ \__msg_kernel_error:nn { regex } { replacement-catcode-end } \else: \tex_lccode:D \c_zero = `#3 \scan_stop: - \tl_to_lowercase:n { \__tl_build_one:n {#1} } + \tex_lowercase:D { \__tl_build_one:n {#1} } \fi: } \char_set_catcode_active:N \^^@ @@ -2302,7 +2302,7 @@ \__msg_kernel_error:nn { regex } { replacement-null-space } \fi: \tex_lccode:D 32 = `#2 \scan_stop: - \tl_to_lowercase:n { \__tl_build_one:n {~} } + \tex_lowercase:D { \__tl_build_one:n {~} } \fi: } \char_set_catcode_alignment:N \^^@ diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty index 9ea18098e46..a8b256be07f 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty @@ -45,8 +45,8 @@ %% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- -\RequirePackage{expl3}[2015/11/04] -\@ifpackagelater{expl3}{2015/11/04} +\RequirePackage{expl3}[2015/12/20] +\@ifpackagelater{expl3}{2015/12/20} {} {% \PackageError{l3regex}{Support package l3kernel too old} @@ -58,7 +58,7 @@ }% \endinput } -\GetIdInfo$Id: l3regex.dtx 6224 2015-11-04 08:38:08Z joseph $ +\GetIdInfo$Id: l3regex.dtx 6326 2015-12-20 18:42:59Z joseph $ {L3 Experimental regular expressions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -361,7 +361,7 @@ } { \char_set_lccode:nn { \c_zero } {#1} - \tl_to_lowercase:n + \tex_lowercase:D { \tl_set:Nx \l__regex_internal_b_tl { \if_false: } \fi: @@ -2222,7 +2222,7 @@ \__msg_kernel_error:nn { regex } { replacement-catcode-end } \else: \tex_lccode:D \c_zero = `#3 \scan_stop: - \tl_to_lowercase:n { \__tl_build_one:n {#1} } + \tex_lowercase:D { \__tl_build_one:n {#1} } \fi: } \char_set_catcode_active:N \^^@ @@ -2275,7 +2275,7 @@ \__msg_kernel_error:nn { regex } { replacement-null-space } \fi: \tex_lccode:D 32 = `#2 \scan_stop: - \tl_to_lowercase:n { \__tl_build_one:n {~} } + \tex_lowercase:D { \__tl_build_one:n {~} } \fi: } \char_set_catcode_alignment:N \^^@ diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty index bfa6d3c04d9..6d5715f7d48 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{expl3} -\GetIdInfo$Id: l3tl-analysis.dtx 6106 2015-09-26 08:54:30Z joseph $ +\GetIdInfo$Id: l3tl-analysis.dtx 6244 2015-11-09 13:33:20Z joseph $ {L3 Experimental token lists analysis} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -103,7 +103,7 @@ \cs_new_protected:Npn \__tl_analysis_disable_loop:N #1 { \tex_lccode:D \c_zero `#1 ~ - \tl_to_lowercase:n { \tex_let:D ^^@ } \tex_undefined:D + \tex_lowercase:D { \tex_let:D ^^@ } \tex_undefined:D \__tl_analysis_disable_loop:N } \group_end: @@ -171,7 +171,7 @@ \cs_new_protected:Npn \__tl_analysis_a_group:nw #1 { \tex_lccode:D \c_zero = \__tl_analysis_extract_charcode: \scan_stop: - \tl_to_lowercase:n { \tex_toks:D \l__tl_analysis_index_int {#1} } + \tex_lowercase:D { \tex_toks:D \l__tl_analysis_index_int {#1} } \if_int_compare:w \tex_lccode:D \c_zero = \tex_escapechar:D \int_set:Nn \tex_escapechar:D { 139 - \tex_escapechar:D } \fi: diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty index 73f0cadb652..a935ccd6758 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty @@ -45,8 +45,8 @@ %% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- -\RequirePackage{expl3}[2015/11/04] -\@ifpackagelater{expl3}{2015/11/04} +\RequirePackage{expl3}[2015/12/20] +\@ifpackagelater{expl3}{2015/12/20} {} {% \PackageError{l3tl-build}{Support package l3kernel too old} @@ -58,7 +58,7 @@ }% \endinput } -\GetIdInfo$Id: l3tl-build.dtx 6224 2015-11-04 08:38:08Z joseph $ +\GetIdInfo$Id: l3tl-build.dtx 6326 2015-12-20 18:42:59Z joseph $ {L3 Experimental token list construction} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty index 394acb36211..39a9930f190 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty @@ -47,8 +47,8 @@ %% %% ----------------------------------------------------------------------- %% -\RequirePackage{expl3}[2015/11/04] -\@ifpackagelater{expl3}{2015/11/04} +\RequirePackage{expl3}[2015/12/20] +\@ifpackagelater{expl3}{2015/12/20} {} {% \PackageError{l3galley}{Support package l3kernel too old} @@ -60,7 +60,7 @@ }% \endinput } -\GetIdInfo$Id: l3galley.dtx 6224 2015-11-04 08:38:08Z joseph $ +\GetIdInfo$Id: l3galley.dtx 6326 2015-12-20 18:42:59Z joseph $ {L3 Experimental galley code} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} diff --git a/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty b/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty index c9a3f80bc4a..d80a6bf71ea 100644 --- a/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty +++ b/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty @@ -46,8 +46,8 @@ %% %% ----------------------------------------------------------------------- %% -\RequirePackage{expl3}[2015/11/04] -\@ifpackagelater{expl3}{2015/11/04} +\RequirePackage{expl3}[2015/12/20] +\@ifpackagelater{expl3}{2015/12/20} {} {% \PackageError{l3keys2e}{Support package l3kernel too old} @@ -61,8 +61,8 @@ } \def\ExplFileName{l3keys2e} \def\ExplFileDescription{LaTeX2e option processing using LaTeX3 keys} -\def\ExplFileDate{2015/11/04} -\def\ExplFileVersion{6224} +\def\ExplFileDate{2015/12/20} +\def\ExplFileVersion{6326} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \cs_generate_variant:Nn \clist_put_right:Nn { Nv } diff --git a/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty b/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty index 2c0b6b615e5..55c4141728d 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty @@ -47,8 +47,8 @@ %% %% ----------------------------------------------------------------------- %% -\RequirePackage{expl3}[2015/11/04] -\@ifpackagelater{expl3}{2015/11/04} +\RequirePackage{expl3}[2015/12/20] +\@ifpackagelater{expl3}{2015/12/20} {} {% \PackageError{xfrac}{Support package l3kernel too old} @@ -63,8 +63,8 @@ \RequirePackage{amstext,graphicx,l3keys2e,textcomp,xparse,xtemplate} \def\ExplFileName{xfrac} \def\ExplFileDescription{L3 Experimental split-level fractions} -\def\ExplFileDate{2015/11/04} -\def\ExplFileVersion{6224} +\def\ExplFileDate{2015/12/20} +\def\ExplFileVersion{6326} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \keys_define:nn { xfrac } diff --git a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty index 983e184e387..db91163ba0c 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty @@ -50,8 +50,8 @@ %% %% ----------------------------------------------------------------------- %% -\RequirePackage{expl3}[2015/11/04] -\@ifpackagelater{expl3}{2015/11/04} +\RequirePackage{expl3}[2015/12/20] +\@ifpackagelater{expl3}{2015/12/20} {} {% \PackageError{xparse}{Support package l3kernel too old} @@ -65,8 +65,8 @@ } \def\ExplFileName{xparse} \def\ExplFileDescription{L3 Experimental document command parser} -\def\ExplFileDate{2015/11/04} -\def\ExplFileVersion{6224} +\def\ExplFileDate{2015/12/20} +\def\ExplFileVersion{6326} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \tl_const:Nx \c__xparse_no_value_tl @@ -240,17 +240,19 @@ } \cs_new_protected:Npn \__xparse_count_mandatory_aux:N #1 { - \cs_if_free:cTF { __xparse_count_type_ \token_to_str:N #1 :w } + \cs_if_exist_use:cF { __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#2 + { + \quark_if_recursion_tail_stop_do:nn {#2} { \__xparse_bad_arg_spec:wn } + \__xparse_count_mandatory:N #2 + } +\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 + \__xparse_count_mandatory:N #1 } -\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} @@ -272,6 +274,18 @@ \quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn } \__xparse_count_mandatory:N } +\cs_new_protected:Npn \__xparse_count_type_k: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 + } +\cs_new_protected:Npn \__xparse_count_type_K:w #1#2 + { + \__xparse_single_token_check:n {#1} + \quark_if_recursion_tail_stop_do:nn {#2} { \__xparse_bad_arg_spec:wn } + \__xparse_count_mandatory:N + } \cs_new_protected_nopar:Npn \__xparse_count_type_m:w { \int_incr:N \l__xparse_mandatory_args_int @@ -307,7 +321,7 @@ } \cs_new_protected:Npn \__xparse_single_token_check:n #1 { - \tl_if_single:nF {#1} + \exp_args:Nx \tl_if_single_token:nF { \tl_trim_spaces:n {#1} } { \__xparse_single_token_check_aux:nwn {#1} } } \cs_new_protected:Npn \__xparse_single_token_check_aux:nwn @@ -368,8 +382,8 @@ } \cs_new_protected:cpn { __xparse_add_type_>:w } #1 { - \bool_set_true:N \l__xparse_processor_bool \__xparse_flush_m_args: + \bool_set_true:N \l__xparse_processor_bool \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 @@ -392,6 +406,15 @@ \tl_put_right:Nn \l__xparse_signature_tl { {#1} } \__xparse_prepare_signature:N } +\cs_new_protected:Npn \__xparse_add_type_k:w #1 + { \exp_args:NNo \__xparse_add_type_K:w #1 \c__xparse_no_value_tl } +\cs_new_protected:Npn \__xparse_add_type_K:w #1#2 + { + \__xparse_flush_m_args: + \__xparse_add_grabber_optional:N K + \tl_put_right:Nn \l__xparse_signature_tl { #1 {#2} } + \__xparse_prepare_signature:N + } \cs_new_protected_nopar:Npn \__xparse_add_type_l:w { \__xparse_flush_m_args: @@ -421,7 +444,7 @@ { \__xparse_flush_m_args: \__xparse_add_grabber_optional:N t - \tl_put_right:Nn \l__xparse_signature_tl { #1 } + \tl_put_right:Nn \l__xparse_signature_tl {#1} \__xparse_prepare_signature:N } \cs_new_protected:Npn \__xparse_add_type_u:w #1 @@ -442,9 +465,8 @@ \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 } + { \exp_not:c { __xparse_grab_m_ \int_use:N \l__xparse_m_args_int :w } } + \int_sub:Nn \l__xparse_mandatory_args_int { \l__xparse_m_args_int } } \int_zero:N \l__xparse_m_args_int } @@ -499,7 +521,7 @@ } \cs_new_protected:Npn \__xparse_add_expandable_type_D:w #1#2 { - \token_if_eq_meaning:NNTF #1 #2 + \tl_if_eq:nnTF {#1} {#2} { \__xparse_add_expandable_grabber_optional:n { D_alt } \__xparse_add_expandable_type_D_aux:Nn #1 @@ -551,6 +573,27 @@ { G } \__xparse_add_expandable_type_m:w } +\cs_new_protected_nopar:Npn \__xparse_add_expandable_type_k:w #1 + { + \exp_args:NNo + \__xparse_add_expandable_type_K:w #1 \c__xparse_no_value_tl + } +\cs_new_protected_nopar:Npn \__xparse_add_expandable_type_K:w #1#2 + { + \__xparse_add_expandable_grabber_optional:n { K } + \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 {##2} } + \tl_put_right:Nx \l__xparse_signature_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 + } \cs_new_protected_nopar:Npn \__xparse_add_expandable_type_l:w { \__msg_kernel_error:nnx { xparse } { invalid-expandable-argument-type } @@ -571,13 +614,13 @@ } \cs_new_protected:Npn \__xparse_add_expandable_type_R:w #1#2 { - \token_if_eq_meaning:NNTF #1 #2 + \tl_if_eq:nnTF {#1} {#2} { - \__xparse_add_expandable_grabber_optional:n { R_alt } + \__xparse_add_expandable_grabber_mandatory:n { R_alt } \__xparse_add_expandable_type_D_aux:Nn #1 } { - \__xparse_add_expandable_grabber_optional:n { R } + \__xparse_add_expandable_grabber_mandatory:n { R } \__xparse_add_expandable_type_D_aux:NNn #1#2 } } @@ -590,7 +633,7 @@ { \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 @@ -627,7 +670,7 @@ } \cs_new_protected_nopar:Npn \__xparse_add_expandable_long_check: { - \bool_if:nT { \l__xparse_all_long_bool && ! ( \l__xparse_long_bool ) } + \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 { } @@ -759,6 +802,48 @@ #2 \l__xparse_args_tl } } +\cs_new_protected:Npn \__xparse_grab_K:w #1#2#3 \l__xparse_args_tl + { + \__xparse_grab_K_aux:nnnNn + {#1} {#2} {#3} + \cs_set_protected_nopar:Npn + { _ignore_spaces } + } +\cs_new_protected:Npn \__xparse_grab_K_long:w #1#2#3 \l__xparse_args_tl + { + \__xparse_grab_K_aux:nnnNn + {#1} {#2} {#3} + \cs_set_protected:Npn + { _ignore_spaces } + } +\cs_new_protected:Npn \__xparse_grab_K_trailing:w #1#2#3 \l__xparse_args_tl + { + \__xparse_grab_K_aux:nnnNn + {#1} {#2} {#3} + \cs_set_protected_nopar:Npn + { } + } +\cs_new_protected:Npn \__xparse_grab_K_long_trailing:w #1#2#3 \l__xparse_args_tl + { + \__xparse_grab_K_aux:nnnNn + {#1} {#2} {#3} + \cs_set_protected:Npn + { } + } +\cs_new_protected:Npn \__xparse_grab_K_aux:nnnNn #1#2#3#4#5 + { + \exp_after:wN #4 \l__xparse_fn_tl ##1 + { + \__xparse_add_arg:n {##1} + #3 \l__xparse_args_tl + } + \use:c { peek_meaning_remove #5 :NTF } #1 + { \l__xparse_fn_tl } + { + \__xparse_add_arg:n {#2} + #3 \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 @@ -981,7 +1066,7 @@ { \__xparse_grab_v_aux_loop:NN #1 } { \__xparse_grab_v_aux_abort:n { } } } -\cs_new_protected:Npn \__xparse_grab_v_aux_loop:NN #1 #2 +\cs_new_protected:Npn \__xparse_grab_v_aux_loop:NN #1#2 { \__xparse_grab_v_token_if_char:NTF #2 { @@ -1112,7 +1197,7 @@ { \str_if_eq:onTF { #1 { } { } #7 #2 \q__xparse #3 } - { { } { #2 } { } } + { { } {#2} { } } { #1 { \__xparse_expandable_grab_D:NNNwNnnn #1#2#3#5 \q__xparse #6 } @@ -1134,7 +1219,7 @@ { #3 { \use_none:nnn } #2 \q__xparse #5 #4 \q__xparse #5 } { \tl_if_blank:oTF { \use_none:nn #1#2 } - { \__xparse_put_arg_expandable:ow { } } + { \__xparse_put_arg_expandable:ow { \use_none:nn #1#2 } } { \str_if_eq_x:nnTF { \exp_not:o { \use_none:nn #1#2 } } @@ -1142,7 +1227,7 @@ { \__xparse_put_arg_expandable:ow { \use_iii:nnn #1#2 } } { \__xparse_put_arg_expandable:ow { \use_none:nn #1#2 } } } - #6 \q__xparse #7 + #6 \q__xparse #7 } { #3 @@ -1166,8 +1251,8 @@ } \cs_new:Npn \__xparse_expandable_grab_D_alt:Nwn #1#2 \q__xparse #3 { - \tl_if_blank:oTF { \use_none:nn #1#2 } - { \__xparse_put_arg_expandable:ow { } } + \tl_if_blank:oTF { \use_none:n #3 } + { \__xparse_put_arg_expandable:ow { \use_none:n #3 } } { \str_if_eq_x:nnTF { \exp_not:o { \use_none:n #3 } } @@ -1175,8 +1260,22 @@ { \__xparse_put_arg_expandable:ow { \use_ii:nn #3 } } { \__xparse_put_arg_expandable:ow { \use_none:n #3 } } } - #2 \q__xparse #1 + #2 \q__xparse #1 + } +\cs_new:Npn \__xparse_expandable_grab_K:w #1 \q__xparse #2 + { #2 { \__xparse_expandable_grab_K_aux:NNwn #1 \q__xparse #2 } } +\cs_new:Npn \__xparse_expandable_grab_K_aux:NNwn #1#2#3#4 \q__xparse #5#6 + { + \str_if_eq:onTF { #1 { } #6 { } #2 { } } { { } #2 { } } + { + #1 + { \__xparse_expandable_grab_K_aux:Nwn #5 #4 \q__xparse } + #6 + } + { #4 {#3} \q__xparse #5 {#6} } } +\cs_new:Npn \__xparse_expandable_grab_K_aux:Nwn #1#2 \q__xparse #3 + { #2 {#3} \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 @@ -1187,7 +1286,7 @@ { \str_if_eq:onTF { #1 { } { } #7 #2 \q__xparse #3 } - { { } { #2 } { } } + { { } {#2} { } } { #1 { \__xparse_expandable_grab_D:NNNwNnnn #1#2#3#5 \q__xparse #6 } @@ -1221,7 +1320,7 @@ { #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 } + \str_if_eq:onTF { #1 { } #5 #2 } {#2} { #3 { \BooleanTrue } \q__xparse #4 } { #3 { \BooleanFalse } \q__xparse #4 {#5} } } @@ -1231,11 +1330,10 @@ \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 - { #1 {##1} } + \cs_set_protected:cpx + { __xparse_processor_ \int_use:N \l__xparse_processor_int :n } ##1 + { \exp_not:n {#1} {##1} } } -\cs_new_protected:Npn \__xparse_process_to_str:n #1 - { \tl_set:Nx \ProcessedArgument { \tl_to_str:n {#1} } } \cs_new_protected:Npn \__xparse_bool_reverse:N #1 { \bool_if:NTF #1 @@ -1246,15 +1344,15 @@ \tl_new:N \l__xparse_split_list_tl \cs_new_protected:Npn \__xparse_split_list:nn #1#2 { - \bool_if:nTF + \tl_if_single:nTF {#1} { - \tl_if_single_p:n {#1} && - ! ( \token_if_cs_p:N #1 ) + \token_if_cs:NTF #1 + { \__xparse_split_list_multi:nn {#1} {#2} } + { \__xparse_split_list_single: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_new_protected:Npn \__xparse_split_list_multi:nn #1#2 { \seq_set_split:Nnn \l__xparse_split_list_seq {#1} {#2} \tl_clear:N \ProcessedArgument @@ -1263,16 +1361,16 @@ } \cs_generate_variant:Nn \__xparse_split_list_multi:nn { nV } \group_begin: -\char_set_catcode_active:N \@ +\char_set_catcode_active:N \^^@ \cs_new_protected:Npn \__xparse_split_list_single:Nn #1#2 { \tl_set:Nn \l__xparse_split_list_tl {#2} \group_begin: - \char_set_lccode:nn { `\@ } { `#1 } + \char_set_lccode:nn { `\^^@ } { `#1 } \tex_lowercase:D { \group_end: - \tl_replace_all:Nnn \l__xparse_split_list_tl { @ } + \tl_replace_all:Nnn \l__xparse_split_list_tl { ^^@ } } {#1} \__xparse_split_list_multi:nV {#1} \l__xparse_split_list_tl } @@ -1322,44 +1420,56 @@ } \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_error:N #1 { - \prop_get:NnNF \l__xparse_command_arg_specs_prop {#1} - \ArgumentSpecification + \cs_if_exist:NTF #1 + { + \__msg_kernel_error:nnx { xparse } { non-xparse-command } + { \token_to_str:N #1 } + } { - \__msg_kernel_error:nnx { xparse } { unknown-document-command } + \__msg_kernel_error:nnx { xparse } { unknown-command } { \token_to_str:N #1 } } } -\cs_new_protected:Npn \__xparse_get_arg_spec:n #1 +\cs_new_protected:Npn \__xparse_get_arg_spec_error:n #1 { - \prop_get:NnNF \l__xparse_environment_arg_specs_prop {#1} - \ArgumentSpecification + \cs_if_exist:cTF {#1} + { + \__msg_kernel_error:nnx { xparse } { non-xparse-environment } + { \tl_to_str:n {#1} } + } { - \__msg_kernel_error:nnx { xparse } { unknown-document-environment } + \__msg_kernel_error:nnx { xparse } { unknown-environment } { \tl_to_str:n {#1} } } } +\cs_new_protected:Npn \__xparse_get_arg_spec:N #1 + { + \prop_get:NnNF \l__xparse_command_arg_specs_prop {#1} + \ArgumentSpecification + { \__xparse_get_arg_spec_error:N #1 } + } +\cs_new_protected:Npn \__xparse_get_arg_spec:n #1 + { + \prop_get:NnNF \l__xparse_environment_arg_specs_prop {#1} + \ArgumentSpecification + { \__xparse_get_arg_spec_error:n {#1} } + } \tl_new:N \ArgumentSpecification \cs_new_protected:Npn \__xparse_show_arg_spec:N #1 { \prop_get:NnNTF \l__xparse_command_arg_specs_prop {#1} \ArgumentSpecification { \tl_show:N \ArgumentSpecification } - { - \__msg_kernel_error:nnx { xparse } { unknown-document-command } - { \token_to_str:N #1 } - } + { \__xparse_get_arg_spec_error:N #1 } } \cs_new_protected:Npn \__xparse_show_arg_spec:n #1 { \prop_get:NnNTF \l__xparse_environment_arg_specs_prop {#1} \ArgumentSpecification { \tl_show:N \ArgumentSpecification } - { - \__msg_kernel_error:nnx { xparse } { unknown-document-environment } - { \tl_to_str:n {#1} } - } + { \__xparse_get_arg_spec_error:n {#1} } } \use:x { @@ -1376,8 +1486,40 @@ { \exp_not:N \prg_return_false: } } \cs_new:Npn \exp_not:N \__xparse_if_value_aux:w ##1 \c__xparse_no_value_tl - { ##1 } + {##1} } +\cs_new_protected:Npn \__xparse_check_definable:nNT #1 + { \exp_args:Nx \__xparse_check_definable_aux:nN { \tl_trim_spaces:n {#1} } } +\group_begin: + \char_set_catcode_active:n { `? } + \cs_new_protected:Npn \__xparse_check_definable_aux:nN #1#2 + { + \group_begin: + \tl_if_single_token:nTF {#1} + { + \int_set:Nn \tex_escapechar:D { 92 } + \exp_args:Nx \tl_if_empty:nTF + { \exp_args:No \str_tail:n { \token_to_str:N #1 } } + { + \exp_args:Nx \char_set_lccode:nn + { ` \str_head:n {#1} } { `? } + \tex_lowercase:D { \tl_if_eq:nnTF {#1} } { ? } + { \group_end: \use_iii:nnn } + { \group_end: \use_i:nnn } + } + { \group_end: \use_iii:nnn } + } + { \group_end: \use_ii:nnn } + { + \__msg_kernel_error:nnxx { xparse } { not-definable } + { \tl_to_str:n {#1} } { \token_to_str:N #2 } + } + { + \__msg_kernel_error:nnxx { xparse } { not-one-token } + { \tl_to_str:n {#1} } { \token_to_str:N #2 } + } + } +\group_end: \__msg_kernel_new:nnnn { xparse } { bad-arg-spec } { Bad~argument~specification~'#1'. } { @@ -1407,12 +1549,6 @@ with~an~environment~that~already~has~a~definition. \\ The~existing~definition~of~'#1'~will~be~overwritten. } -\__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 } { Environment~'#1'~not~yet~defined! } { @@ -1420,13 +1556,6 @@ with~an~environment~that~was~never~defined. \\ A~new~environment~'#1'~will~be~created. } -\__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 } { Argument~specification~for~expandable~command~ends~with~optional~argument. @@ -1460,6 +1589,38 @@ '#1'.~LaTeX~did~not~find~it,~and~will~insert~'#2'~as~the~value~to~be~ processed. } +\__msg_kernel_new:nnnn { xparse } { non-xparse-command } + { Command~'#1'~not~defined~using~xparse. } + { + You~have~asked~for~the~argument~specification~for~a~command~'#1',~ + but~this~is~not~a~command~defined~using~xparse. + } +\__msg_kernel_new:nnnn { xparse } { non-xparse-environment } + { Environment~'#1'~not~defined~using~xparse. } + { + You~have~asked~for~the~argument~specification~for~an~environment~'#1',~ + but~this~is~not~an~environment~defined~using~xparse. + } +\__msg_kernel_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? + \\ \\ + LaTeX~will~ignore~this~entire~definition. + } +\__msg_kernel_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. + \\ \\ + LaTeX~will~ignore~this~entire~definition. + } \__msg_kernel_new:nnnn { xparse } { not-single-token } { Argument~delimiter~should~be~a~single~token:~'#1'. } { @@ -1489,17 +1650,17 @@ 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-command } { Unknown~document~command~'#1'. } { You~have~asked~for~the~argument~specification~for~a~command~'#1',~ - but~this~is~not~a~document~command. + but~it~is~not~defined. } -\__msg_kernel_new:nnnn { xparse } { unknown-document-environment } +\__msg_kernel_new:nnnn { xparse } { unknown-environment } { Unknown~document~environment~'#1'. } { - You~have~asked~for~the~argument~specification~for~a~command~'#1',~ - but~this~is~not~a~document~environment. + You~have~asked~for~the~argument~specification~for~an~environment~'#1',~ + but~it~is~not~defined. } \__msg_kernel_new:nnnn { xparse } { verbatim-newline } { Verbatim~argument~of~'#1'~ended~by~end~of~line. } @@ -1545,27 +1706,39 @@ \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_check_definable:nNT {#1} \DeclareDocumentCommand + { \__xparse_declare_cmd:Nnn #1 {#2} {#3} } + } \cs_new_protected:Npn \NewDocumentCommand #1#2#3 { - \cs_if_exist:NTF #1 + \__xparse_check_definable:nNT {#1} \NewDocumentCommand { - \__msg_kernel_error:nnx { xparse } { command-already-defined } - { \token_to_str:N #1 } + \cs_if_exist:NTF #1 + { + \__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_check_definable:nNT {#1} \RenewDocumentCommand { - \__msg_kernel_error:nnx { xparse } { command-not-yet-defined } - { \token_to_str:N #1 } + \cs_if_exist:NTF #1 + { \__xparse_declare_cmd:Nnn #1 {#2} {#3} } + { + \__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} } } + { + \__xparse_check_definable:nNT {#1} \ProvideDocumentCommand + { \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} } \cs_new_protected:Npn \NewDocumentEnvironment #1#2#3#4 @@ -1581,27 +1754,38 @@ { \__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_check_definable:nNT {#1} \DeclareExpandableDocumentCommand + { \__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_nopar:Npn \IfValueF { \__xparse_if_no_value:nT } +\cs_new_nopar:Npn \IfValueT { \__xparse_if_no_value:nF } +\cs_new: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 \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_protected:Npn \GetDocumentCommandArgSpec #1 + { + \__xparse_check_definable:nNT {#1} \GetDocumentCommandArgSpec + { \__xparse_get_arg_spec:N #1 } + } +\cs_new_eq:NN \GetDocumentEnvironmentArgSpec \__xparse_get_arg_spec:n +\cs_new_protected:Npn \ShowDocumentCommandArgSpec #1 + { + \__xparse_check_definable:nNT {#1} \ShowDocumentCommandArgSpec + { \__xparse_show_arg_spec:N #1 } + } \cs_new_eq:NN \ShowDocumentEnvironmentArgSpec \__xparse_show_arg_spec:n \clist_new:N \l__xparse_options_clist \DeclareOption* { \clist_put_right:NV \l__xparse_options_clist \CurrentOption } diff --git a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty index e02925f37f2..653fa0e2249 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty @@ -50,8 +50,8 @@ %% %% ----------------------------------------------------------------------- %% -\RequirePackage{expl3}[2015/11/04] -\@ifpackagelater{expl3}{2015/11/04} +\RequirePackage{expl3}[2015/12/20] +\@ifpackagelater{expl3}{2015/12/20} {} {% \PackageError{xtemplate}{Support package l3kernel too old} @@ -65,8 +65,8 @@ } \def\ExplFileName{xtemplate} \def\ExplFileDescription{L3 Experimental prototype document functions} -\def\ExplFileDate{2015/11/04} -\def\ExplFileVersion{6224} +\def\ExplFileDate{2015/12/20} +\def\ExplFileVersion{6326} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \tl_const:Nn \c__xtemplate_code_root_tl { template~code~>~ } -- cgit v1.2.3