diff options
author | Karl Berry <karl@freefriends.org> | 2012-07-23 17:15:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-07-23 17:15:15 +0000 |
commit | dadf86ec2d90ed4529037604a8dcea9f660045b8 (patch) | |
tree | 819b3708bda1e2a087ebd5fb0f0f55ebe0b4d157 /Master | |
parent | 134349701bddf7cbbacf6030c6b9f9838aff96fa (diff) |
l3packages 3990 (17jul12)
git-svn-id: svn://tug.org/texlive/trunk@27109 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
16 files changed, 3454 insertions, 3355 deletions
diff --git a/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf b/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf Binary files differindex db76995c210..eccbb33be6e 100644 --- a/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf +++ b/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf diff --git a/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf b/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf Binary files differindex d46815b9acf..fc9e61ea408 100644 --- a/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf +++ b/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf diff --git a/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf b/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf Binary files differindex 86739872af7..51cb3e77105 100644 --- a/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf +++ b/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf diff --git a/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf b/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf Binary files differindex 3b0a33e0584..e6dbf6650d9 100644 --- a/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf +++ b/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf diff --git a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx index 6abaceee479..564a45a7ce5 100644 --- a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx +++ b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx @@ -37,20 +37,20 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2012/04/23] -%<package>\@ifpackagelater{expl3}{2012/04/23} +\RequirePackage{expl3}[2012/07/16] +%<package>\@ifpackagelater{expl3}{2012/07/16} %<package> {} -%<package> { +%<package> {% %<package> \PackageError{l3keys2e}{Support package l3kernel too old.} -%<package> { +%<package> {% %<package> Please install an up to date version of l3kernel %<package> using your TeX package manager or from CTAN.\\ \\ -%<package> Loading l3keys2e will abort! -%<package> } +%<package> Loading l3keys2e will abort!% +%<package> }% %<package> \endinput %<package> } \RequirePackage{xparse} -\GetIdInfo$Id: l3keys2e.dtx 3570 2012-04-23 13:24:55Z joseph $ +\GetIdInfo$Id: l3keys2e.dtx 3990 2012-07-16 07:46:03Z joseph $ {LaTeX2e option processing using LaTeX3 keys} %</driver|package> %<*driver> @@ -143,41 +143,45 @@ % \begin{macrocode} %<*package> % \end{macrocode} +% +% \begin{macrocode} +%<@@=keys> +% \end{macrocode} % % \begin{macrocode} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} % \end{macrocode} % -% \begin{macro}{\keys_latexe_options_clist} +% \begin{macro}{\@@_latexe_options_clist} % A single list is used for all options, into which they are collected % before processing. % \begin{macrocode} -\clist_new:N \keys_latexe_options_clist +\clist_new:N \@@_latexe_options_clist % \end{macrocode} % \end{macro} % -% \begin{macro}{\_l_keys_process_class_bool} +% \begin{macro}{\l_@@_process_class_bool} % A flag to indicate that class options should be processed for % packages. % \begin{macrocode} -\bool_new:N \_l_keys_process_class_bool +\bool_new:N \l_@@_process_class_bool % \end{macrocode} % \end{macro} % -% \begin{macro}{\keys_latexe_options:n} +% \begin{macro}{\@@_latexe_options:n} % The main function calls functions to collect up the global and local -% options into \cs{keys_latexe_options_clist} before calling the +% options into \cs{@@_latexe_options_clist} before calling the % underlying functions to actually do the processing. So that a suitable % message is produced if the option is unknown, the special % \texttt{unknown} key is set if it does not already exist for the % current module. % \begin{macrocode} -\cs_new_protected:Npn \keys_latexe_options:n #1 +\cs_new_protected:Npn \@@_latexe_options:n #1 { - \clist_clear:N \keys_latexe_options_clist - \keys_latexe_options_global:n {#1} - \keys_latexe_options_local: + \clist_clear:N \@@_latexe_options_clist + \@@_latexe_options_global:n {#1} + \@@_latexe_options_local: \keys_if_exist:nnF {#1} { unknown } { \keys_define:nn {#1} @@ -189,34 +193,34 @@ } } } - \keys_set:nV {#1} \keys_latexe_options_clist + \keys_set:nV {#1} \@@_latexe_options_clist \AtEndOfPackage { \cs_set_eq:NN \@unprocessedoptions \scan_stop: } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\keys_latexe_options_global:n} +% \begin{macro}{\@@_latexe_options_global:n} % Global (class) options are handled differently for \LaTeXe{} packages % and classes. Hence this function is essentially a check on the current % file type. The initial test is needed as \LaTeXe{} allows variables to % be equal to \cs{scan_stop:}, which is forbidden in \LaTeX3 code. % \begin{macrocode} -\cs_new_protected:Npn \keys_latexe_options_global:n #1 +\cs_new_protected:Npn \@@_latexe_options_global:n #1 { \cs_if_eq:NNF \@classoptionslist \scan_stop: { \cs_if_eq:NNTF \@currext \@clsextension - { \keys_latexe_options_class:n {#1} } + { \@@_latexe_options_class:n {#1} } { - \bool_if:NT \_l_keys_process_class_bool - { \keys_latexe_options_package:n {#1} } + \bool_if:NT \l_@@_process_class_bool + { \@@_latexe_options_package:n {#1} } } } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\keys_latexe_options_class:n} +% \begin{macro}{\@@_latexe_options_class:n} % For classes, each option (stripped of any content after |=|) % is checked for existence as a key. If found, the option is added to % the combined list for processing. On the other hand, unused options @@ -224,15 +228,15 @@ % there is a simple check to see if there is an |unknown| key. If there % is, then \emph{everything} will match and the mapping can be skipped. % \begin{macrocode} -\cs_new_protected:Npn \keys_latexe_options_class:n #1 +\cs_new_protected:Npn \@@_latexe_options_class:n #1 { \keys_if_exist:nnTF {#1} { unknown } - { \clist_put_right:No \keys_latexe_options_clist \@classoptionslist } + { \clist_put_right:No \@@_latexe_options_clist \@classoptionslist } { \clist_map_inline:Nn \@classoptionslist { - \keys_if_exist:nnTF {#1} { \keys_latexe_remove_equals:n {##1} } - { \clist_put_right:Nn \keys_latexe_options_clist {##1} } + \keys_if_exist:nnTF {#1} { \@@_latexe_remove_equals:n {##1} } + { \clist_put_right:Nn \@@_latexe_options_clist {##1} } { \clist_put_right:Nn \@unusedoptionlist {##1} } } } @@ -240,19 +244,19 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\keys_latexe_options_package:n} +% \begin{macro}{\@@_latexe_options_package:n} % For global options when processing a package, the tasks are slightly % different from those for a class. The check is the same, but here % there is nothing to do if the option is not applicable. Each valid % option also needs to be removed from \cs{@unusedoptionlist}. % \begin{macrocode} -\cs_new_protected:Npn \keys_latexe_options_package:n #1 +\cs_new_protected:Npn \@@_latexe_options_package:n #1 { \clist_map_inline:Nn \@classoptionslist { - \keys_if_exist:nnT {#1} { \keys_latexe_remove_equals:n {##1} } + \keys_if_exist:nnT {#1} { \@@_latexe_remove_equals:n {##1} } { - \clist_put_right:Nn \keys_latexe_options_clist {##1} + \clist_put_right:Nn \@@_latexe_options_clist {##1} \clist_remove_all:Nn \@unusedoptionlist {##1} } } @@ -260,18 +264,18 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\keys_latexe_options_local:} +% \begin{macro}{\@@_latexe_options_local:} % If local options are found, the are added to the processing list. % \LaTeXe{} stores options for each file in a macro which may or may not % exist, hence the need to use \cs{cs_if_exist:c}. % \begin{macrocode} -\cs_new_protected_nopar:Npn \keys_latexe_options_local: +\cs_new_protected_nopar:Npn \@@_latexe_options_local: { \cs_if_eq:NNF \@currext \@clsextension { \cs_if_exist:cT { opt@ \@currname . \@currext } { - \exp_args:NNc \clist_put_right:NV \keys_latexe_options_clist + \exp_args:NNc \clist_put_right:NV \@@_latexe_options_clist { opt@ \@currname . \@currext } } } @@ -279,15 +283,15 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\keys_latexe_remove_equals:n} -% \begin{macro}{\keys_latexe_remove_equals:w} +% \begin{macro}{\@@_latexe_remove_equals:n} +% \begin{macro}{\@@_latexe_remove_equals:w} % As the name suggests, this is a simple function to remove an equals % sign from the input. This is all wrapped up in an \texttt{n} function % so that there will always be a sign available. % \begin{macrocode} -\cs_new:Npn \keys_latexe_remove_equals:n #1 - { \keys_latexe_remove_equals:w #1 = \q_stop } -\cs_new:Npn \keys_latexe_remove_equals:w #1 = #2 \q_stop {#1} +\cs_new:Npn \@@_latexe_remove_equals:n #1 + { \@@_latexe_remove_equals:w #1 = \q_stop } +\cs_new:Npn \@@_latexe_remove_equals:w #1 = #2 \q_stop {#1} % \end{macrocode} % \end{macro} % \end{macro} @@ -300,13 +304,13 @@ % \begin{macrocode} \cs_new_protected_nopar:Npn \ProcessKeysOptions #1 { - \bool_set_true:N \_l_keys_process_class_bool - \keys_latexe_options:n {#1} + \bool_set_true:N \l_@@_process_class_bool + \@@_latexe_options:n {#1} } \cs_new_protected_nopar:Npn \ProcessKeysPackageOptions #1 { - \bool_set_false:N \_l_keys_process_class_bool - \keys_latexe_options:n {#1} + \bool_set_false:N \l_@@_process_class_bool + \@@_latexe_options:n {#1} } \@onlypreamble \ProcessKeysOptions \@onlypreamble \ProcessKeysPackageOptions diff --git a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.ins b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.ins index fa9b799b037..bf2f1b09d88 100644 --- a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.ins +++ b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.ins @@ -1,6 +1,6 @@ \iffalse meta-comment -File xparse.ins Copyright (C) 2009,2011 The LaTeX3 Project +File xparse.ins Copyright (C) 2009,2011,2012 The LaTeX3 Project It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this @@ -16,7 +16,7 @@ The released version of this bundle is available from CTAN. \fi -\input docstrip.tex +\input l3docstrip.tex \askforoverwritefalse \preamble diff --git a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx index ad2da510576..1ee8b2a7088 100644 --- a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % %% File: xfrac.dtx Copyright (C) 2004, 2008-2010 Morten Hoegholm -%% (C) 2011 The LaTeX3 Project +%% (C) 2011,2012 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -37,7 +37,7 @@ % %<*driver|package> \RequirePackage{amstext,graphicx,l3keys2e,textcomp,xparse,xtemplate} -\GetIdInfo$Id: xfrac.dtx 3465 2012-02-26 15:31:13Z bruno $ +\GetIdInfo$Id: xfrac.dtx 3875 2012-06-30 12:38:05Z joseph $ {L3 Experimental split-level fractions} %</driver|package> %<*driver> @@ -530,13 +530,17 @@ % \begin{macrocode} %<*package> % \end{macrocode} +% +% \begin{macrocode} +%<@@=xfrac> +% \end{macrocode} % % \begin{macrocode} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} % \end{macrocode} % -% \begin{variable}{\l_xfrac_cm_std_bool} +% \begin{variable}{\l_@@_cm_std_bool} % There is one option to support. % \begin{macrocode} \keys_define:nn { xfrac } @@ -544,34 +548,34 @@ cm-recommended .choice:, cm-recommended / false .code:n = - { \bool_set_true:N \l_xfrac_cm_std_bool }, + { \bool_set_true:N \l_@@_cm_std_bool }, cm-recommended / true .code:n = - { \bool_set_false:N \l_xfrac_cm_std_bool }, + { \bool_set_false:N \l_@@_cm_std_bool }, cm-recommended .default:n = { true }, - cm-standard .bool_set:N = \l_xfrac_cm_std_bool + cm-standard .bool_set:N = \l_@@_cm_std_bool } \ProcessKeysOptions { xfrac } % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xfrac_slash_box} -% \begin{variable}{\l_xfrac_tmp_box} +% \begin{variable}{\l_@@_slash_box} +% \begin{variable}{\l_@@_tmp_box} % In keeping with the \LaTeX3 philosophy, rather than use generic % scratch boxes and get confused, \pkg{xfrac} reserves its own named % working space. % \begin{macrocode} -\box_new:N \l_xfrac_slash_box -\box_new:N \l_xfrac_tmp_box +\box_new:N \l_@@_slash_box +\box_new:N \l_@@_tmp_box % \end{macrocode} % \end{variable} % \end{variable} % -% \begin{macro}[aux]{\xfrac_tmp:w} +% \begin{macro}[aux]{\@@_tmp:w} % Used for the raised boxes: weird as it does not take an argument % but the \cs{raisebox} does. % \begin{macrocode} -\cs_new:Npn \xfrac_tmp:w { } +\cs_new:Npn \@@_tmp:w { } % \end{macrocode} % \end{macro} % @@ -581,18 +585,18 @@ % Variables used in templates have to be set up: there is not % much to say about these, other than that they must exist. % -% \begin{variable}{\l_xfrac_denominator_bot_sep_dim} -% \begin{variable}{\l_xfrac_numerator_bot_sep_dim} -% \begin{variable}{\l_xfrac_numerator_top_sep_dim} -% \begin{variable}{\l_xfrac_slash_left_sep_dim} -% \begin{variable}{\l_xfrac_slash_right_sep_dim} +% \begin{variable}{\l_@@_denominator_bot_sep_dim} +% \begin{variable}{\l_@@_numerator_bot_sep_dim} +% \begin{variable}{\l_@@_numerator_top_sep_dim} +% \begin{variable}{\l_@@_slash_left_sep_dim} +% \begin{variable}{\l_@@_slash_right_sep_dim} % Fixed lengths. % \begin{macrocode} -\dim_new:N \l_xfrac_denominator_bot_sep_dim -\dim_new:N \l_xfrac_numerator_bot_sep_dim -\dim_new:N \l_xfrac_numerator_top_sep_dim -\dim_new:N \l_xfrac_slash_left_sep_dim -\dim_new:N \l_xfrac_slash_right_sep_dim +\dim_new:N \l_@@_denominator_bot_sep_dim +\dim_new:N \l_@@_numerator_bot_sep_dim +\dim_new:N \l_@@_numerator_top_sep_dim +\dim_new:N \l_@@_slash_left_sep_dim +\dim_new:N \l_@@_slash_right_sep_dim % \end{macrocode} % \end{variable} % \end{variable} @@ -600,42 +604,42 @@ % \end{variable} % \end{variable} % -% \begin{variable}{\l_xfrac_slash_left_muskip} -% \begin{variable}{\l_xfrac_slash_right_muskip} +% \begin{variable}{\l_@@_slash_left_muskip} +% \begin{variable}{\l_@@_slash_right_muskip} % Math mode skips. % \begin{macrocode} -\muskip_new:N \l_xfrac_slash_left_muskip -\muskip_new:N \l_xfrac_slash_right_muskip +\muskip_new:N \l_@@_slash_left_muskip +\muskip_new:N \l_@@_slash_right_muskip % \end{macrocode} % \end{variable} % \end{variable} % -% \begin{variable}{\l_xfrac_hscale_fp} -% \begin{variable}{\l_xfrac_scale_factor_fp} -% \begin{variable}{\l_xfrac_vscale_fp} +% \begin{variable}{\l_@@_hscale_fp} +% \begin{variable}{\l_@@_scale_factor_fp} +% \begin{variable}{\l_@@_vscale_fp} % Floating point values. % \begin{macrocode} -\fp_new:N \l_xfrac_hscale_fp -\fp_new:N \l_xfrac_scale_factor_fp -\fp_new:N \l_xfrac_vscale_fp +\fp_new:N \l_@@_hscale_fp +\fp_new:N \l_@@_scale_factor_fp +\fp_new:N \l_@@_vscale_fp % \end{macrocode} % \end{variable} % \end{variable} % \end{variable} % -% \begin{variable}{\l_xfrac_denominator_font_tl} -% \begin{variable}{\l_xfrac_numerator_font_tl} -% \begin{variable}{\l_xfrac_phantom_tl } -% \begin{variable}{\l_xfrac_slash_symbol_tl} -% \begin{variable}{\l_xfrac_slash_symbol_font_tl} +% \begin{variable}{\l_@@_denominator_font_tl} +% \begin{variable}{\l_@@_numerator_font_tl} +% \begin{variable}{\l_@@_phantom_tl } +% \begin{variable}{\l_@@_slash_symbol_tl} +% \begin{variable}{\l_@@_slash_symbol_font_tl} % Token lists, which include floating-point numbers and math(s) % skips. % \begin{macrocode} -\tl_new:N \l_xfrac_denominator_font_tl -\tl_new:N \l_xfrac_numerator_font_tl -\tl_new:N \l_xfrac_phantom_tl -\tl_new:N \l_xfrac_slash_symbol_tl -\tl_new:N \l_xfrac_slash_symbol_font_tl +\tl_new:N \l_@@_denominator_font_tl +\tl_new:N \l_@@_numerator_font_tl +\tl_new:N \l_@@_phantom_tl +\tl_new:N \l_@@_slash_symbol_tl +\tl_new:N \l_@@_slash_symbol_font_tl % \end{macrocode} % \end{variable} % \end{variable} @@ -643,30 +647,30 @@ % \end{variable} % \end{variable} % -% \begin{macro}{\xfrac_fontscale:} -% \begin{macro}{\xfrac_math:n} -% \begin{macro}{\xfrac_denominator_font_change:} -% \begin{macro}{\xfrac_denominator_format:n} -% \begin{macro}{\xfrac_numerator_font_change:} -% \begin{macro}{\xfrac_numerator_format:n} -% \begin{macro}{\xfrac_relscale:} -% \begin{macro}{\xfrac_slash_symbol_font_change:} -% \begin{macro}{\xfrac_slash_symbol_format:n} -% \begin{macro}{\xfrac_text_or_math:n} +% \begin{macro}{\@@_fontscale:} +% \begin{macro}{\@@_math:n} +% \begin{macro}{\@@_denominator_font_change:} +% \begin{macro}{\@@_denominator_format:n} +% \begin{macro}{\@@_numerator_font_change:} +% \begin{macro}{\@@_numerator_format:n} +% \begin{macro}{\@@_relscale:} +% \begin{macro}{\@@_slash_symbol_font_change:} +% \begin{macro}{\@@_slash_symbol_format:n} +% \begin{macro}{\@@_text_or_math:n} % Functions, either things which are calculated \enquote{on the fly} % (no argument required) or are functions taking one argument in the % code. % \begin{macrocode} -\cs_new_nopar:Npn \xfrac_fontscale: -\cs_new:Npn \xfrac_math:n #1 { } -\cs_new_nopar:Npn \xfrac_denominator_font_change: { } -\cs_new:Npn \xfrac_denominator_format:n #1 { } -\cs_new_nopar:Npn \xfrac_numerator_font_change: { } -\cs_new:Npn \xfrac_numerator_format:n #1 { } -\cs_new_nopar:Npn \xfrac_relscale: { } -\cs_new_nopar:Npn \xfrac_slash_symbol_font_change: { } -\cs_new:Npn \xfrac_slash_symbol_format:n #1 { } -\cs_new:Npn \xfrac_text_or_math:n #1 { } +\cs_new_nopar:Npn \@@_fontscale: +\cs_new:Npn \@@_math:n #1 { } +\cs_new_nopar:Npn \@@_denominator_font_change: { } +\cs_new:Npn \@@_denominator_format:n #1 { } +\cs_new_nopar:Npn \@@_numerator_font_change: { } +\cs_new:Npn \@@_numerator_format:n #1 { } +\cs_new_nopar:Npn \@@_relscale: { } +\cs_new_nopar:Npn \@@_slash_symbol_font_change: { } +\cs_new:Npn \@@_slash_symbol_format:n #1 { } +\cs_new:Npn \@@_text_or_math:n #1 { } % \end{macrocode} % \end{macro} % \end{macro} @@ -724,54 +728,54 @@ % \begin{macrocode} \DeclareTemplateCode { xfrac } { text } { 3 } { - denominator-bot-sep = \l_xfrac_denominator_bot_sep_dim , - denominator-font = \l_xfrac_denominator_font_tl , - denominator-format = \xfrac_denominator_format:n , - h-scale = \l_xfrac_hscale_fp , + denominator-bot-sep = \l_@@_denominator_bot_sep_dim , + denominator-font = \l_@@_denominator_font_tl , + denominator-format = \@@_denominator_format:n , + h-scale = \l_@@_hscale_fp , math-mode = { - false = \cs_set_eq:NN \xfrac_math:n \use:n, - true = \cs_set_eq:NN \xfrac_math:n \ensuremath + false = \cs_set_eq:NN \@@_math:n \use:n, + true = \cs_set_eq:NN \@@_math:n \ensuremath }, - numerator-font = \l_xfrac_numerator_font_tl , - numerator-format = \xfrac_numerator_format:n , - numerator-bot-sep = \l_xfrac_numerator_bot_sep_dim , - numerator-top-sep = \l_xfrac_numerator_top_sep_dim , - phantom = \l_xfrac_phantom_tl , - scale-factor = \l_xfrac_scale_factor_fp , + numerator-font = \l_@@_numerator_font_tl , + numerator-format = \@@_numerator_format:n , + numerator-bot-sep = \l_@@_numerator_bot_sep_dim , + numerator-top-sep = \l_@@_numerator_top_sep_dim , + phantom = \l_@@_phantom_tl , + scale-factor = \l_@@_scale_factor_fp , scale-relative = { false = - \cs_set_nopar:Npn \xfrac_relscale: + \cs_set_nopar:Npn \@@_relscale: { - \dim_eval:w - \box_ht:N \l_xfrac_tmp_box + \box_dp:N \l_xfrac_tmp_box - \dim_eval_end: + \__dim_eval:w + \box_ht:N \l_@@_tmp_box + \box_dp:N \l_@@_tmp_box + \__dim_eval_end: }, true = - \cs_set_nopar:Npn \xfrac_relscale: - { \box_ht:N \l_xfrac_slash_box } + \cs_set_nopar:Npn \@@_relscale: + { \box_ht:N \l_@@_slash_box } }, scaling = { - false = \cs_set_eq:NN \xfrac_fontscale: \prg_do_nothing:, + false = \cs_set_eq:NN \@@_fontscale: \prg_do_nothing:, true = - \cs_set_nopar:Npn \xfrac_fontscale: + \cs_set_nopar:Npn \@@_fontscale: { \fontsize - { \fp_use:N \l_xfrac_scale_factor_fp \xfrac_relscale: } + { \fp_use:N \l_@@_scale_factor_fp \@@_relscale: } { \c_zero_dim } \selectfont } }, - slash-left-kern = \l_xfrac_slash_left_sep_dim , - slash-left-mkern = \l_xfrac_slash_left_muskip , - slash-right-kern = \l_xfrac_slash_right_sep_dim , - slash-right-mkern = \l_xfrac_slash_right_muskip , - slash-symbol = \l_xfrac_slash_symbol_tl , - slash-symbol-font = \l_xfrac_slash_symbol_font_tl , - slash-symbol-format = \xfrac_slash_symbol_format:n , - v-scale = \l_xfrac_vscale_fp + slash-left-kern = \l_@@_slash_left_sep_dim , + slash-left-mkern = \l_@@_slash_left_muskip , + slash-right-kern = \l_@@_slash_right_sep_dim , + slash-right-mkern = \l_@@_slash_right_muskip , + slash-symbol = \l_@@_slash_symbol_tl , + slash-symbol-font = \l_@@_slash_symbol_font_tl , + slash-symbol-format = \@@_slash_symbol_format:n , + v-scale = \l_@@_vscale_fp } % \end{macrocode} % The implementation part starts with applying all of the settings @@ -782,29 +786,29 @@ \AssignTemplateKeys \mode_if_math:TF { - \cs_set_eq:NN \xfrac_text_or_math:n \text - \cs_set_nopar:Npx \xfrac_denominator_font_change: - { \tex_fam:D \l_xfrac_denominator_font_tl } - \cs_set_nopar:Npx \xfrac_numerator_font_change: - { \tex_fam:D \l_xfrac_numerator_font_tl } - \cs_set_nopar:Npx \xfrac_slash_symbol_font_change: - { \tex_fam:D \l_xfrac_slash_symbol_font_tl } + \cs_set_eq:NN \@@_text_or_math:n \text + \cs_set_nopar:Npx \@@_denominator_font_change: + { \tex_fam:D \l_@@_denominator_font_tl } + \cs_set_nopar:Npx \@@_numerator_font_change: + { \tex_fam:D \l_@@_numerator_font_tl } + \cs_set_nopar:Npx \@@_slash_symbol_font_change: + { \tex_fam:D \l_@@_slash_symbol_font_tl } } { - \cs_set_eq:NN \xfrac_text_or_math:n \mbox - \cs_set_nopar:Npn \xfrac_denominator_font_change: + \cs_set_eq:NN \@@_text_or_math:n \mbox + \cs_set_nopar:Npn \@@_denominator_font_change: { - \fontfamily { \l_xfrac_denominator_font_tl } + \fontfamily { \l_@@_denominator_font_tl } \selectfont } - \cs_set_nopar:Npn \xfrac_numerator_font_change: + \cs_set_nopar:Npn \@@_numerator_font_change: { - \fontfamily { \l_xfrac_numerator_font_tl } + \fontfamily { \l_@@_numerator_font_tl } \selectfont } - \cs_set_nopar:Npn \xfrac_slash_symbol_font_change: + \cs_set_nopar:Npn \@@_slash_symbol_font_change: { - \fontfamily { \l_xfrac_slash_symbol_font_tl } + \fontfamily { \l_@@_slash_symbol_font_tl } \selectfont } } @@ -812,22 +816,22 @@ % Everything is now either inside \cs{text} or an \cs{mbox}, depending % upon the surroundings. First, there are some boxes to set up. % \begin{macrocode} - \xfrac_text_or_math:n + \@@_text_or_math:n { \m@th - \hbox_set:Nn \l_xfrac_tmp_box - { \xfrac_math:n { \vphantom { ( ) } } } - \hbox_set:Nn \l_xfrac_slash_box + \hbox_set:Nn \l_@@_tmp_box + { \@@_math:n { \vphantom { ( ) } } } + \hbox_set:Nn \l_@@_slash_box { - \xfrac_math:n + \@@_math:n { - \xfrac_slash_symbol_format:n + \@@_slash_symbol_format:n { - \xfrac_math:n + \@@_math:n { - \xfrac_slash_symbol_font_change: + \@@_slash_symbol_font_change: \IfNoValueTF {#2} - { \l_xfrac_slash_symbol_tl } {#2} + { \l_@@_slash_symbol_tl } {#2} } } } @@ -838,43 +842,43 @@ % set up a default, which is also used when both values are set % erroneously. % \begin{macrocode} - \cs_set_nopar:Npn \xfrac_tmp:w + \cs_set_nopar:Npn \@@_tmp:w { \raisebox { - \dim_eval:w - \box_ht:N \l_xfrac_slash_box - - \box_dp:N \l_xfrac_slash_box + \__dim_eval:w + \box_ht:N \l_@@_slash_box + - \box_dp:N \l_@@_slash_box - \height - \dim_eval_end: + \__dim_eval_end: } } \dim_compare:nNnTF - { \l_xfrac_numerator_top_sep_dim } = { \c_max_dim } + { \l_@@_numerator_top_sep_dim } = { \c_max_dim } { \dim_compare:nNnF - { \l_xfrac_numerator_bot_sep_dim } = { \c_max_dim } + { \l_@@_numerator_bot_sep_dim } = { \c_max_dim } { - \cs_set_nopar:Npn \xfrac_tmp:w + \cs_set_nopar:Npn \@@_tmp:w { \raisebox - { \dim_use:N \l_xfrac_numerator_bot_sep_dim } + { \dim_use:N \l_@@_numerator_bot_sep_dim } } } } { \dim_compare:nNnTF - { \l_xfrac_numerator_bot_sep_dim } = { \c_max_dim } + { \l_@@_numerator_bot_sep_dim } = { \c_max_dim } { - \cs_set_nopar:Npn \xfrac_tmp:w + \cs_set_nopar:Npn \@@_tmp:w { \raisebox { - \dim_eval:w - \box_ht:N \l_xfrac_slash_box - - \dim_use:N \l_xfrac_numerator_top_sep_dim + \__dim_eval:w + \box_ht:N \l_@@_slash_box + - \dim_use:N \l_@@_numerator_top_sep_dim - \height - \dim_eval_end: + \__dim_eval_end: } } } @@ -886,73 +890,73 @@ % \end{macrocode} % Typeset the numerator. % \begin{macrocode} - \xfrac_tmp:w + \@@_tmp:w { - \xfrac_fontscale: - \xfrac_numerator_format:n + \@@_fontscale: + \@@_numerator_format:n { \scalebox - { \fp_use:N \l_xfrac_hscale_fp } - [ \fp_use:N \l_xfrac_vscale_fp ] + { \fp_use:N \l_@@_hscale_fp } + [ \fp_use:N \l_@@_vscale_fp ] { - \xfrac_math:n + \@@_math:n { - \xfrac_numerator_font_change: + \@@_numerator_font_change: { - \vphantom { \l_xfrac_phantom_tl } + \vphantom { \l_@@_phantom_tl } #1 } } } } } - \xfrac_math:n + \@@_math:n { % THIS IS JUST WRONG! \scan_align_safe_stop: \mode_if_math:TF - { \tex_mskip:D \l_xfrac_slash_right_muskip } - { \tex_hskip:D \l_xfrac_slash_right_sep_dim } + { \tex_mskip:D \l_@@_slash_right_muskip } + { \tex_hskip:D \l_@@_slash_right_sep_dim } } % \end{macrocode} % Typeset the separator. % \begin{macrocode} - \box_use:N \l_xfrac_slash_box - \xfrac_math:n + \box_use:N \l_@@_slash_box + \@@_math:n { \mode_if_math:TF - { \tex_mskip:D \l_xfrac_slash_left_muskip } - { \tex_hskip:D \l_xfrac_slash_left_sep_dim } + { \tex_mskip:D \l_@@_slash_left_muskip } + { \tex_hskip:D \l_@@_slash_left_sep_dim } } % \end{macrocode} % Typeset the denominator. % \begin{macrocode} \dim_compare:nNnTF - { \l_xfrac_denominator_bot_sep_dim } = { \c_max_dim } + { \l_@@_denominator_bot_sep_dim } = { \c_max_dim } { - \cs_set_nopar:Npn \xfrac_tmp:w - { \raisebox { - \box_dp:N \l_xfrac_slash_box } } + \cs_set_nopar:Npn \@@_tmp:w + { \raisebox { - \box_dp:N \l_@@_slash_box } } } { - \cs_set_nopar:Npn \xfrac_tmp:w + \cs_set_nopar:Npn \@@_tmp:w { \raisebox - { \dim_use:N \l_xfrac_denominator_bot_sep_dim } + { \dim_use:N \l_@@_denominator_bot_sep_dim } } } - \xfrac_tmp:w + \@@_tmp:w { - \xfrac_fontscale: - \xfrac_denominator_format:n + \@@_fontscale: + \@@_denominator_format:n { \scalebox - { \fp_use:N \l_xfrac_hscale_fp } - [ \fp_use:N \l_xfrac_vscale_fp ] + { \fp_use:N \l_@@_hscale_fp } + [ \fp_use:N \l_@@_vscale_fp ] { - \xfrac_math:n + \@@_math:n { - \xfrac_denominator_font_change: + \@@_denominator_font_change: { - \vphantom { \l_xfrac_phantom_tl } + \vphantom { \l_@@_phantom_tl } #3 } } @@ -1041,7 +1045,7 @@ % We can do better for the Computer Modern fonts. For cmr and cmss % we choose Times, and for cmtt use Palatino. % \begin{macrocode} -\bool_if:NF \l_xfrac_cm_std_bool +\bool_if:NF \l_@@_cm_std_bool { \DeclareInstance { xfrac } { cmr } { text } { slash-symbol-font = ptm } diff --git a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.ins b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.ins index c1ab6c55448..4c240c56648 100644 --- a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.ins +++ b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.ins @@ -1,7 +1,7 @@ \iffalse meta-comment File xfrac.ins Copyright (C) 2004, 2008-2010 Morten Hoegholm - (C) 2011 The LaTeX3 Project + (C) 2011,2012 The LaTeX3 Project It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this @@ -17,7 +17,7 @@ The released version of this bundle is available from CTAN. \fi -\input docstrip.tex +\input l3docstrip.tex \askforoverwritefalse \preamble diff --git a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx index a0b627b5e46..b003f5d012c 100644 --- a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx @@ -41,19 +41,19 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2012/04/23] -%<package>\@ifpackagelater{expl3}{2012/04/23} +\RequirePackage{expl3}[2012/07/16] +%<package>\@ifpackagelater{expl3}{2012/07/16} %<package> {} -%<package> { +%<package> {% %<package> \PackageError{xparse}{Support package l3kernel too old.} -%<package> { +%<package> {% %<package> Please install an up to date version of l3kernel %<package> using your TeX package manager or from CTAN.\\ \\ -%<package> Loading xparse will abort! -%<package> } +%<package> Loading xparse will abort!% +%<package> }% %<package> \endinput %<package> } -\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} %</driver|package> %<*driver> @@ -148,7 +148,7 @@ % \item[r] Reads a \enquote{required} delimited argument, where the % delimiters are given as \meta{token1} and \meta{token2}: % \texttt{r}\meta{token1}\meta{token2}. If the opening \meta{token} -% is missing, the default value \cs{NoValue} will be inserted after +% is missing, the default marker |-NoValue-| will be inserted after % a suitable error. % \item[R] As for \texttt{r}, this is a \enquote{required} delimited % argument but has a user-definable recovery \meta{default}, given @@ -170,11 +170,11 @@ % \begin{itemize}[font=\ttfamily] % \item[o] A standard \LaTeX{} optional argument, surrounded with square % brackets, which will supply -% the special \cs{NoValue} token if not given (as described later). +% the special |-NoValue-| marker if not given (as described later). % \item[d] An optional argument which is delimited by \meta{token1} % and \meta{token2}, which are given as arguments: % \texttt{d}\meta{token1}\meta{token2}. As with \texttt{o}, if no -% value is given the special token \cs{NoValue} is returned. +% value is given the special marker |-NoValue-| is returned. % \item[O] As for \texttt{o}, but returns \meta{default} if no % value is given. Should be given as \texttt{O}\marg{default}. % \item[D] As for \texttt{d}, but returns \meta{default} if no @@ -189,7 +189,7 @@ % otherwise. Given as \texttt{t}\meta{token}. % \item[g] An optional argument given inside a pair of \TeX{} group % tokens (in standard \LaTeX, |{| \ldots |}|), which returns -% \cs{NoValue} if not present. +% |-NoValue-| if not present. % \item[G] As for \texttt{g} but returns \meta{default} if no value % is given: \texttt{G}\marg{default}. % \end{itemize} @@ -200,7 +200,7 @@ % \begin{itemize}[nolistsep] % \item |#1| = |\BooleanTrue| % \item |#2| = |{Foo}| -% \item |#3| = |\NoValue| +% \item |#3| = |-NoValue-| % \item |#4| = |{Bar}| % \item |#5| = |{default}| % \end{itemize} @@ -217,6 +217,18 @@ % in the argument specifier. The \cs{BooleanTrue} and \cs{BooleanFalse} % tokens are passed without braces; all other arguments are passed as % brace groups. +% +% Delimited argument types (\texttt{d}, \texttt{o} and \texttt{r}) are +% defined such that they require matched pairs of delimiters when collecting +% an argument. For example +% \begin{verbatim} +% \DeclareDocumentCommand{\foo}{o}{#1} +% \foo[[content]] % #1 = "[content]" +% \foo[[] % Error: missing closing "]" +% \end{verbatim} +% Also note that |{| and |}| cannot be used as delimiters as they are used +% by \TeX{} as grouping tokens. Arguments to be grabbed inside these tokens +% must be created as either \texttt{m}- or \texttt{g}-type arguments. % % Two more tokens have a special meaning when creating an argument % specifier. First, \texttt{+} is used to make an argument long (to @@ -267,7 +279,7 @@ % \DeclareDocumentCommand\foo{r()m} % \foo{oops} % \end{verbatim} -% will lead to an error message being issued. The marker \cs{NoValue} +% will lead to an error message being issued. The marker |-NoValue-| % (\texttt{r}-type) or user-specified default (for \texttt{R}-type) will be % inserted to allow error recovery. % @@ -331,7 +343,7 @@ % essentially behave like the current \LaTeXe{} command (except that it % would accept an optional argument even when a \texttt{*} was parsed). % The \cs{typesetnormalchapter} could test its first argument for being -% \cs{NoValue} to see if an optional argument was present. +% |-NoValue-| to see if an optional argument was present. % % The difference between the \cs{Declare\ldots}, \cs{New\ldots} % \cs{Renew\ldots} and \cs{Provide\ldots} versions is the behaviour @@ -379,18 +391,12 @@ % variables to return information about the nature of the argument % received. % -% \begin{variable}{\NoValue} -% \cs{NoValue} is a special marker returned by \pkg{xparse} if no -% value is given for an optional argument. If typeset (which should -% not happen), it will print the value \texttt{-NoValue-}. -% \end{variable} -% % \begin{function}[EXP,TF]{\IfNoValue} % \begin{syntax} % \cs{IfNoValueTF} \Arg{argument} \Arg{true code} \Arg{false code} % \end{syntax} -% The \cs{IfNoValue} tests are used to check if <argument> (|#1|, -% |#2|, \emph{etc.}) is the special \cs{NoValue} token. For example +% The \cs{IfNoValue} tests are used to check if \meta{argument} (|#1|, +% |#2|, \emph{etc.}) is the special |-NoValue-| marker For example % \begin{verbatim} % \DeclareDocumentCommand \foo { o m } % { @@ -405,6 +411,14 @@ % As the \cs{IfNoValue(TF)} tests are expandable, it is possible to % test these values later, for example at the point of typesetting or % in an expansion context. +% +% It is important to note that |-NoValue-| is constructed such that it +% will \emph{not} match the simple text input |-NoValue-|, \emph{i.e.} +% that +% \begin{verbatim} +% \IfNoValueTF{-NoValue-} +% \end{verbatim} +% will be logically \texttt{false}. % \end{function} % % \begin{function}[EXP,TF]{\IfValue} @@ -668,6 +682,10 @@ % \begin{macrocode} %<*package> % \end{macrocode} +% +% \begin{macrocode} +%<@@=xparse> +% \end{macrocode} % % \begin{macrocode} \ProvidesExplPackage @@ -675,327 +693,344 @@ % \end{macrocode} % % \subsection{Variables and constants} +% +% \begin{variable}{\c_@@_no_value_tl} +% A special \enquote{awkward} token list: it contains two |-|~tokens with +% different category codes. This is used as the marker for nothing being +% returned when no optional argument is given. +% \begin{macrocode} +\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_@@_no_value_tl { QNoValue- } + } +% \end{macrocode} +% \end{variable} % -% \begin{variable}{\c_xparse_shorthands_prop} +% \begin{variable}{\c_@@_shorthands_prop} % Shorthands are stored as a property list: this is set up here as it % is a constant. % \begin{macrocode} -\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* } +\prop_new:N \c_@@_shorthands_prop +\prop_put:Nnn \c_@@_shorthands_prop { o } { d[] } +\prop_put:Nnn \c_@@_shorthands_prop { O } { D[] } +\prop_put:Nnn \c_@@_shorthands_prop { s } { t* } % \end{macrocode} % \end{variable} % -% \begin{variable}{\c_xparse_special_chars_seq} +% \begin{variable}{\c_@@_special_chars_seq} % In \IniTeX{} mode, we store special characters in a sequence. % Maybe |$| or |&| will have to be added later. % \begin{macrocode} %<*initex> -\seq_new:N \c_xparse_special_chars_seq -\seq_set_from_clist:Nn \c_xparse_special_chars_seq - { \ , \\ , \{ , \} , \# , \^ , \_ , \% , \~ } +\seq_new:N \c_@@_special_chars_seq +\seq_set_split:Nnn \c_@@_special_chars_seq { } + { \ \\ \{ \} \# \^ \_ \% \~ } %</initex> % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_all_long_bool} +% \begin{variable}{\l_@@_all_long_bool} % For expandable commands, all arguments have the same long status, but this % needs to be checked. A flag is therefore needed to track whether arguments % are long at all. % \begin{macrocode} -\bool_new:N \l_xparse_all_long_bool +\bool_new:N \l_@@_all_long_bool % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_args_tl} +% \begin{variable}{\l_@@_args_tl} % Token list variable for grabbed arguments. % \begin{macrocode} -\tl_new:N \l_xparse_args_tl +\tl_new:N \l_@@_args_tl % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_command_arg_specs_prop} +% \begin{variable}{\l_@@_command_arg_specs_prop} % Used to record all document commands created, and the argument % specifications that go with these. % \begin{macrocode} -\prop_new:N \l_xparse_command_arg_specs_prop +\prop_new:N \l_@@_command_arg_specs_prop % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_current_arg_int} +% \begin{variable}{\l_@@_current_arg_int} % The number of the current argument being set up: this is used for creating % the expandable auxiliary functions, and also to indicate if all arguments % are \texttt{m}-type. % \begin{macrocode} -\int_new:N \l_xparse_current_arg_int +\int_new:N \l_@@_current_arg_int % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_environment_bool} +% \begin{variable}{\l_@@_environment_bool} % Generating environments uses the same mechanism as generating functions. % However, full processing of arguments is always needed for environments, % and so the function-generating code needs to know this. % \begin{macrocode} -\bool_new:N \l_xparse_environment_bool +\bool_new:N \l_@@_environment_bool % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_environment_arg_specs_prop} +% \begin{variable}{\l_@@_environment_arg_specs_prop} % Used to record all document environment created, and the argument % specifications that go with these. % \begin{macrocode} -\prop_new:N \l_xparse_environment_arg_specs_prop +\prop_new:N \l_@@_environment_arg_specs_prop % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_expandable_bool} +% \begin{variable}{\l_@@_expandable_bool} % Used to indicate if an expandable command is begin generated, as this % affects both the acceptable argument types and how they are implemented. % \begin{macrocode} -\bool_new:N \l_xparse_expandable_bool +\bool_new:N \l_@@_expandable_bool % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_expandable_aux_name_tl} +% \begin{variable}{\l_@@_expandable_aux_name_tl} % Used to create pretty-printing names for the auxiliaries: although the % immediate definition does not vary, the full expansion does and so it % does not count as a constant. % \begin{macrocode} -\tl_new:N \l_xparse_expandable_aux_name_tl -\tl_set:Nn \l_xparse_expandable_aux_name_tl +\tl_new:N \l_@@_expandable_aux_name_tl +\tl_set:Nn \l_@@_expandable_aux_name_tl { - \l_xparse_function_tl \c_space_tl - ( arg~ \int_use:N \l_xparse_current_arg_int ) + \l_@@_function_tl \c_space_tl + ( arg~ \int_use:N \l_@@_current_arg_int ) } % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_fn_tl} +% \begin{variable}{\l_@@_fn_tl} % For passing the pre-formed name of the auxiliary to be used as the % parsing function. % \begin{macrocode} -\tl_new:N \l_xparse_fn_tl +\tl_new:N \l_@@_fn_tl % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_function_tl} +% \begin{variable}{\l_@@_function_tl} % Holds the control sequence name of the function currently being % defined: used to avoid passing this as an argument and to avoid repeated % use of \cs{cs_to_str:N}. % \begin{macrocode} -\tl_new:N \l_xparse_function_tl +\tl_new:N \l_@@_function_tl % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_long_bool} +% \begin{variable}{\l_@@_long_bool} % Used to indicate that an argument is long: this is used on a per-argument % basis for non-expandable functions, or for the entire set of arguments % when working expandably. % \begin{macrocode} -\bool_new:N \l_xparse_long_bool +\bool_new:N \l_@@_long_bool % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_m_args_int} +% \begin{variable}{\l_@@_m_args_int} % The number of \texttt{m} arguments: if this is the same as the total % number of arguments, then a short-cut can be taken in the creation of % the grabber code. % \begin{macrocode} -\int_new:N \l_xparse_m_args_int +\int_new:N \l_@@_m_args_int % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_mandatory_args_int} +% \begin{variable}{\l_@@_mandatory_args_int} % Holds the total number of mandatory arguments for a function, which is % needed to tell whether further mandatory arguments follow an optional % one. % \begin{macrocode} -\int_new:N \l_xparse_mandatory_args_int +\int_new:N \l_@@_mandatory_args_int % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_processor_bool} +% \begin{variable}{\l_@@_processor_bool} % Indicates that the current argument will be followed by one or more % processors. % \begin{macrocode} -\bool_new:N \l_xparse_processor_bool +\bool_new:N \l_@@_processor_bool % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_processor_int} +% \begin{variable}{\l_@@_processor_int} % In the grabber routine, each processor is saved with a number % recording the order it was found in. The total is then used to work % back through the grabbers so they apply to the argument right to left. % \begin{macrocode} -\int_new:N \l_xparse_processor_int +\int_new:N \l_@@_processor_int % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_signature_tl} +% \begin{variable}{\l_@@_signature_tl} % Used when constructing the signature (code for argument grabbing) to % hold what will become the implementation of the main function. % \begin{macrocode} -\tl_new:N \l_xparse_signature_tl +\tl_new:N \l_@@_signature_tl % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xparse_tmp_tl} +% \begin{variable}{\l_@@_tmp_tl} % Scratch space. % \begin{macrocode} -\tl_new:N \l_xparse_tmp_tl +\tl_new:N \l_@@_tmp_tl % \end{macrocode} % \end{variable} % % \subsection{Declaring commands and environments} % -% \begin{macro}{\xparse_declare_cmd:Nnn, \xparse_declare_expandable_cmd:Nnn} -% \begin{macro}[aux]{\xparse_declare_cmd_aux:Nnn} +% \begin{macro}{\@@_declare_cmd:Nnn, \@@_declare_expandable_cmd:Nnn} +% \begin{macro}[aux]{\@@_declare_cmd_aux:Nnn} % \begin{macro}[int] -% {\xparse_declare_cmd_internal:Nnn, \xparse_declare_cmd_internal:cnx} +% {\@@_declare_cmd_internal:Nnn, \@@_declare_cmd_internal:cnx} % The main functions for creating commands set the appropriate flag then % use the same internal code to do the definition. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xparse_declare_cmd:Nnn +\cs_new_protected_nopar:Npn \@@_declare_cmd:Nnn { - \bool_set_false:N \l_xparse_expandable_bool - \xparse_declare_cmd_aux:Nnn + \bool_set_false:N \l_@@_expandable_bool + \@@_declare_cmd_aux:Nnn } -\cs_new_protected_nopar:Npn \xparse_declare_expandable_cmd:Nnn +\cs_new_protected_nopar:Npn \@@_declare_expandable_cmd:Nnn { - \bool_set_true:N \l_xparse_expandable_bool - \xparse_declare_cmd_aux:Nnn + \bool_set_true:N \l_@@_expandable_bool + \@@_declare_cmd_aux:Nnn } % \end{macrocode} % The first stage is to log information, both for the user in the log and % for programmatic use in a property list of all declared commands. % \begin{macrocode} -\cs_new_protected:Npn \xparse_declare_cmd_aux:Nnn #1#2 +\cs_new_protected:Npn \@@_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_@@_command_arg_specs_prop {#1} {#2} + \bool_set_false:N \l_@@_environment_bool + \@@_declare_cmd_internal:Nnn #1 {#2} } % \end{macrocode} % The real business of defining a document command starts with setting up % the appropriate name, then counting up the number of mandatory arguments. % \begin{macrocode} -\cs_new_protected:Npn \xparse_declare_cmd_internal:Nnn #1#2#3 +\cs_new_protected:Npn \@@_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_@@_function_tl { \cs_to_str:N #1 } + \@@_count_mandatory:n {#2} + \@@_prepare_signature:n {#2} + \int_compare:nNnTF \l_@@_current_arg_int = \l_@@_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_@@_environment_bool + { \@@_declare_cmd_mixed:Nn #1 {#3} } + { \@@_declare_cmd_all_m:Nn #1 {#3} } } - { \xparse_declare_cmd_mixed:Nn #1 {#3} } - \xparse_break_point:n {#2} + { \@@_declare_cmd_mixed:Nn #1 {#3} } + \@@_break_point:n {#2} } -\cs_generate_variant:Nn \xparse_declare_cmd_internal:Nnn { cnx } +\cs_generate_variant:Nn \@@_declare_cmd_internal:Nnn { cnx } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_break_point:n} +% \begin{macro}{\@@_break_point:n} % A marker used to escape from creating a definition if necessary. % \begin{macrocode} -\cs_new_eq:NN \xparse_break_point:n \use_none:n +\cs_new_eq:NN \@@_break_point:n \use_none:n % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_declare_cmd_all_m:Nn, \xparse_declare_cmd_mixed:Nn} +% \begin{macro}{\@@_declare_cmd_all_m:Nn, \@@_declare_cmd_mixed:Nn} % \begin{macro}[aux] -% {\xparse_declare_cmd_mixed_aux:Nn, \xparse_declare_cmd_mixed_expandable:Nn} +% {\@@_declare_cmd_mixed_aux:Nn, \@@_declare_cmd_mixed_expandable:Nn} % When all of the arguments to grab are simple \texttt{m}-type, a short % cut can be taken to provide only a single function. In the case of % expandable commands, this can also happen for \texttt{+m} (as all arguments % in this case must be long). % \begin{macrocode} -\cs_new_protected:Npn \xparse_declare_cmd_all_m:Nn #1#2 +\cs_new_protected:Npn \@@_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_@@_expandable_bool { _protected } + \bool_if:NF \l_@@_all_long_bool { _nopar } :Npn } - \l_xparse_current_arg_int {#2} + \l_@@_current_arg_int {#2} } % \end{macrocode} % In the case of mixed arguments, any remaining \texttt{m}-type ones are % first added to the signature, then the appropriate auxiliary is called. % \begin{macrocode} -\cs_new_protected:Npn \xparse_declare_cmd_mixed:Nn +\cs_new_protected:Npn \@@_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_@@_expandable_bool + { \@@_declare_cmd_mixed_expandable:Nn } + { \@@_declare_cmd_mixed_aux:Nn } } % \end{macrocode} % Creating standard functions with mixed arg.~specs sets up the main function % to zero the number of processors, set the name of the function (for the % grabber) and clears the list of grabbed arguments. % \begin{macrocode} -\cs_new_protected:Npn \xparse_declare_cmd_mixed_aux:Nn #1#2 +\cs_new_protected:Npn \@@_declare_cmd_mixed_aux:Nn #1#2 { - \xparse_flush_m_args: + \@@_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_@@_function_tl \c_space_tl code } + \cs_set_protected:Npn \l_@@_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_@@_processor_int + \tl_set:Nn \exp_not:N \l_@@_args_tl + { \exp_not:c { \l_@@_function_tl \c_space_tl code } } + \tl_set:Nn \exp_not:N \l_@@_fn_tl + { \exp_not:c { \l_@@_function_tl \c_space_tl } } + \exp_not:o \l_@@_signature_tl + \exp_not:N \l_@@_args_tl } } -\cs_new_protected:Npn \xparse_declare_cmd_mixed_expandable:Nn #1#2 +\cs_new_protected:Npn \@@_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_@@_function_tl \c_space_tl code } + \cs_set:Npn \l_@@_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_@@_signature_tl + \exp_not:N \@@_grab_expandable_end:wN + \exp_not:c { \l_@@_function_tl \c_space_tl code } + \exp_not:N \q_@@ + \exp_not:c { \l_@@_function_tl \c_space_tl } } - \bool_if:NTF \l_xparse_long_bool + \bool_if:NTF \l_@@_all_long_bool { \cs_set:cpx } { \cs_set_nopar:cpx } - { \l_xparse_function_tl \c_space_tl } ##1##2 { ##1 {##2} } + { \l_@@_function_tl \c_space_tl } ##1##2 { ##1 {##2} } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_declare_env:nnnn} -% \begin{macro}[int]{\xparse_declare_env_internal:nnnn} +% \begin{macro}{\@@_declare_env:nnnn} +% \begin{macro}[int]{\@@_declare_env_internal:nnnn} % The lead-off to creating an environment is much the same as that for % creating a command: issue the appropriate message, store the argument % specification then hand off to an internal function. % \begin{macrocode} -\cs_new_protected:Npn \xparse_declare_env:nnnn #1#2 +\cs_new_protected:Npn \@@_declare_env:nnnn #1#2 { %<*initex> \cs_if_exist:cTF { environment~ #1 } @@ -1004,16 +1039,16 @@ \cs_if_exist:cTF {#1} %</package> { - \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_@@_environment_arg_specs_prop {#1} {#2} + \bool_set_true:N \l_@@_environment_bool + \@@_declare_env_internal:nnnn {#1} {#2} } % \end{macrocode} % Creating a document environment requires a few more steps than creating @@ -1024,9 +1059,9 @@ % of expansion at point of use, the code here is expanded now as well as % when used. % \begin{macrocode} -\cs_new_protected:Npn \xparse_declare_env_internal:nnnn #1#2#3#4 +\cs_new_protected:Npn \@@_declare_env_internal:nnnn #1#2#3#4 { - \xparse_declare_cmd_internal:cnx { environment~ #1 } {#2} + \@@_declare_cmd_internal:cnx { environment~ #1 } {#2} { \group_begin: \cs_set_protected_nopar:Npx \exp_not:c { environment_ #1 _end_aux: } @@ -1035,7 +1070,11 @@ \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_@@_args_tl } +%<*initex> + \group_end: +%</initex> +%<*package> \exp_not:n { \if@endpe @@ -1045,6 +1084,7 @@ \exp_after:wN \group_end: \fi } +%</package> } } \exp_not:n {#3} @@ -1053,7 +1093,7 @@ { \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_@@_current_arg_int {#4} %<*package> \cs_set_eq:cc {#1} { environment~ #1 } \cs_set_eq:cc { end #1 } { environment~ #1 ~end } @@ -1065,33 +1105,33 @@ % % \subsection{Counting mandatory arguments} % -% \begin{macro}{\xparse_count_mandatory:n} -% \begin{macro}{\xparse_count_mandatory:N} -% \begin{macro}[aux]{\xparse_count_mandatory:N} +% \begin{macro}{\@@_count_mandatory:n} +% \begin{macro}{\@@_count_mandatory:N} +% \begin{macro}[aux]{\@@_count_mandatory:N} % To count up mandatory arguments before the main parsing run, the same % approach is used. First, check if the current token is a short-cut for % another argument type. If it is, expand it and loop again. If not, then % look for a \enquote{counting} function to check the argument type. No error % is raised here if one is not found as one will be raised by later code. % \begin{macrocode} -\cs_new_protected:Npn \xparse_count_mandatory:n #1 +\cs_new_protected:Npn \@@_count_mandatory:n #1 { - \int_zero:N \l_xparse_mandatory_args_int - \xparse_count_mandatory:N #1 + \int_zero:N \l_@@_mandatory_args_int + \@@_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 \@@_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_@@_shorthands_prop {#1} \l_@@_tmp_tl + { \exp_after:wN \@@_count_mandatory:N \l_@@_tmp_tl } + { \@@_count_mandatory_aux:N #1 } } -\cs_new_protected:Npn \xparse_count_mandatory_aux:N #1 +\cs_new_protected:Npn \@@_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 { @@_count_type_ \token_to_str:N #1 :w } + { \@@_count_type_m:w } + { \use:c { @@_count_type_ \token_to_str:N #1 :w } } } % \end{macrocode} % \end{macro} @@ -1100,15 +1140,15 @@ % % \begin{macro} % { -% \xparse_count_type_>:w, -% \xparse_count_type_+:w, -% \xparse_count_type_d:w, -% \xparse_count_type_D:w, -% \xparse_count_type_g:w, -% \xparse_count_type_G:w, -% \xparse_count_type_m:w, -% \xparse_count_type_t:w, -% \xparse_count_type_u:w +% \@@_count_type_>:w, +% \@@_count_type_+:w, +% \@@_count_type_d:w, +% \@@_count_type_D:w, +% \@@_count_type_g:w, +% \@@_count_type_G:w, +% \@@_count_type_m:w, +% \@@_count_type_t:w, +% \@@_count_type_u:w % } % For counting the mandatory arguments, a function is provided for each % argument type that will mop any extra arguments and call the loop function. @@ -1124,118 +1164,118 @@ % errors. The opportunity is also taken to make sure that where a single % token is required, one has actually been supplied. % \begin{macrocode} -\cs_new_protected:cpn { xparse_count_type_>:w } #1 +\cs_new_protected:cpn { @@_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} { \@@_bad_arg_spec:wn } + \@@_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 { @@_count_type_+:w } + { \@@_count_mandatory:N } +\cs_new_protected:Npn \@@_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 + \@@_single_token_check:n {#1} + \@@_single_token_check:n {#2} + \quark_if_recursion_tail_stop_do:Nn #2 { \@@_bad_arg_spec:wn } + \@@_count_mandatory:N } -\cs_new_protected:Npn \xparse_count_type_D:w #1#2#3 +\cs_new_protected:Npn \@@_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 + \@@_single_token_check:n {#1} + \@@_single_token_check:n {#2} + \quark_if_recursion_tail_stop_do:nn {#3} { \@@_bad_arg_spec:wn } + \@@_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 \@@_count_type_g:w + { \@@_count_mandatory:N } +\cs_new_protected:Npn \@@_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} { \@@_bad_arg_spec:wn } + \@@_count_mandatory:N } -\cs_new_protected_nopar:Npn \xparse_count_type_m:w +\cs_new_protected_nopar:Npn \@@_count_type_m:w { - \int_incr:N \l_xparse_mandatory_args_int - \xparse_count_mandatory:N + \int_incr:N \l_@@_mandatory_args_int + \@@_count_mandatory:N } -\cs_new_protected:Npn \xparse_count_type_r:w #1#2 +\cs_new_protected:Npn \@@_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 + \@@_single_token_check:n {#1} + \@@_single_token_check:n {#2} + \quark_if_recursion_tail_stop_do:Nn #2 { \@@_bad_arg_spec:wn } + \int_incr:N \l_@@_mandatory_args_int + \@@_count_mandatory:N } -\cs_new_protected:Npn \xparse_count_type_R:w #1#2#3 +\cs_new_protected:Npn \@@_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 + \@@_single_token_check:n {#1} + \@@_single_token_check:n {#2} + \quark_if_recursion_tail_stop_do:nn {#3} { \@@_bad_arg_spec:wn } + \int_incr:N \l_@@_mandatory_args_int + \@@_count_mandatory:N } -\cs_new_protected:Npn \xparse_count_type_t:w #1 +\cs_new_protected:Npn \@@_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 + \@@_single_token_check:n {#1} + \quark_if_recursion_tail_stop_do:Nn #1 { \@@_bad_arg_spec:wn } + \@@_count_mandatory:N } -\cs_new_protected:Npn \xparse_count_type_u:w #1 +\cs_new_protected:Npn \@@_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} { \@@_bad_arg_spec:wn } + \int_incr:N \l_@@_mandatory_args_int + \@@_count_mandatory:N } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_single_token_check:n} -% \begin{macro}[aux]{\xparse_single_token_check_aux:nwn} +% \begin{macro}{\@@_single_token_check:n} +% \begin{macro}[aux]{\@@_single_token_check_aux:nwn} % A spin-out function to check that what should be single tokens really % are single tokens. % \begin{macrocode} -\cs_new_protected:Npn \xparse_single_token_check:n #1 +\cs_new_protected:Npn \@@_single_token_check:n #1 { \tl_if_single:nF {#1} - { \xparse_single_token_check_aux:nwn {#1} } + { \@@_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 \@@_single_token_check_aux:nwn + #1#2 \@@_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} } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_bad_arg_spec:wn} +% \begin{macro}{\@@_bad_arg_spec:wn} % If the signature is wrong, this provides an escape from the entire % definition process. % \begin{macrocode} -\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 \@@_bad_arg_spec:wn #1 \@@_break_point:n #2 + { \__msg_kernel_error:nnx { xparse } { bad-arg-spec } { \tl_to_str:n {#2} } } % \end{macrocode} % \end{macro} % % \subsection{Preparing the signature: general mechanism} % -% \begin{macro}{\xparse_prepare_signature:n} -% \begin{macro}{\xparse_prepare_signature:N} -% \begin{macro}{\xparse_prepare_signature_bypass:N} -% \begin{macro}[aux]{\xparse_prepare_signature_add:N} +% \begin{macro}{\@@_prepare_signature:n} +% \begin{macro}{\@@_prepare_signature:N} +% \begin{macro}{\@@_prepare_signature_bypass:N} +% \begin{macro}[aux]{\@@_prepare_signature_add:N} % Actually creating the signature uses the same loop approach as counting % up mandatory arguments. There are first a number of variables which need % to be set to track what is going on. % \begin{macrocode} -\cs_new_protected:Npn \xparse_prepare_signature:n #1 +\cs_new_protected:Npn \@@_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_@@_all_long_bool + \int_zero:N \l_@@_current_arg_int + \bool_set_false:N \l_@@_long_bool + \int_zero:N \l_@@_m_args_int + \bool_set_false:N \l_@@_processor_bool + \tl_clear:N \l_@@_signature_tl + \@@_prepare_signature:N #1 \q_recursion_tail \q_recursion_stop } % \end{macrocode} % The main looping function does not take an argument,but carries out the @@ -1243,19 +1283,19 @@ % process so that when actually setting up processors the flag-reset can % be bypassed. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xparse_prepare_signature:N +\cs_new_protected_nopar:Npn \@@_prepare_signature:N { - \bool_set_false:N \l_xparse_processor_bool - \xparse_prepare_signature_bypass:N + \bool_set_false:N \l_@@_processor_bool + \@@_prepare_signature_bypass:N } -\cs_new_protected:Npn \xparse_prepare_signature_bypass:N #1 +\cs_new_protected:Npn \@@_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_@@_shorthands_prop {#1} \l_@@_tmp_tl + { \exp_after:wN \@@_prepare_signature:N \l_@@_tmp_tl } { - \int_incr:N \l_xparse_current_arg_int - \xparse_prepare_signature_add:N #1 + \int_incr:N \l_@@_current_arg_int + \@@_prepare_signature_add:N #1 } } % \end{macrocode} @@ -1264,20 +1304,20 @@ % standard functions, as the approaches are different. Of course, if the type % is not known at all then a fall-back is needed. % \begin{macrocode} -\cs_new_protected:Npn \xparse_prepare_signature_add:N #1 +\cs_new_protected:Npn \@@_prepare_signature_add:N #1 { \cs_if_exist_use:cF { - xparse_add - \bool_if:NT \l_xparse_expandable_bool { _expandable } + @@_add + \bool_if:NT \l_@@_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_@@_expandable_bool + { \@@_add_expandable_type_m:w } + { \@@_add_type_m:w } } } % \end{macrocode} @@ -1293,195 +1333,195 @@ % arguments are added to the signature, then the appropriate grabber % is added to the signature. Some of the adding functions also pick up % one or more arguments, and are also added to the signature. All of the -% functions then call the loop function \cs{xparse_prepare_signature:N}. +% functions then call the loop function \cs{@@_prepare_signature:N}. % -% \begin{macro}{\xparse_add_type_+:w} +% \begin{macro}{\@@_add_type_+:w} % Making the next argument long means setting the flag and knocking one back % off the total argument count. The \texttt{m} arguments are recorded here as % this has to be done for every case where there is then a long argument. % \begin{macrocode} -\cs_new_protected_nopar:cpn { xparse_add_type_+:w } +\cs_new_protected_nopar:cpn { @@_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 + \@@_flush_m_args: + \bool_set_true:N \l_@@_long_bool + \int_decr:N \l_@@_current_arg_int + \@@_prepare_signature:N } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_type_>:w} -% When a processor is found, the function \cs{xparse_process_arg:n} is added +% \begin{macro}{\@@_add_type_>:w} +% When a processor is found, the function \cs{@@_process_arg:n} is added % to the signature along with the processor code itself. When the signature % is used, the code will be added to an execution list by -% \cs{xparse_process_arg:n}. Here, the loop calls -% \cs{xparse_prepare_signature_bypass:N} rather than -% \cs{xparse_prepare_signature:N} so that the flag is not reset. +% \cs{@@_process_arg:n}. Here, the loop calls +% \cs{@@_prepare_signature_bypass:N} rather than +% \cs{@@_prepare_signature:N} so that the flag is not reset. % \begin{macrocode} -\cs_new_protected:cpn { xparse_add_type_>:w } #1 +\cs_new_protected:cpn { @@_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_@@_processor_bool + \@@_flush_m_args: + \int_decr:N \l_@@_current_arg_int + \tl_put_right:Nn \l_@@_signature_tl { \@@_process_arg:n {#1} } + \@@_prepare_signature_bypass:N } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_type_d:w, \xparse_add_type_D:w} +% \begin{macro}{\@@_add_type_d:w, \@@_add_type_D:w} % To save on repeated code, \texttt{d} is actually turned into the same -% grabber as is used by \texttt{D}, by putting the \cs{NoValue} default in +% grabber as is used by \texttt{D}, by putting the |-NoValue-| default in % the correct place. % \begin{macrocode} -\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 \@@_add_type_d:w #1#2 + { \exp_args:NNNo \@@_add_type_D:w #1 #2 \c_@@_no_value_tl } +\cs_new_protected:Npn \@@_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 + \@@_flush_m_args: + \@@_add_grabber_optional:N D + \tl_put_right:Nn \l_@@_signature_tl { #1 #2 {#3} } + \@@_prepare_signature:N } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_type_g:w} +% \begin{macro}{\@@_add_type_g:w} % The \texttt{g} type is simply an alias for \texttt{G} with the correct % default built-in. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xparse_add_type_g:w - { \xparse_add_type_G:w { \NoValue } } +\cs_new_protected_nopar:Npn \@@_add_type_g:w + { \exp_args:No \@@_add_type_G:w \c_@@_no_value_tl } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_type_G:w} +% \begin{macro}{\@@_add_type_G:w} % For the \texttt{G} type, the grabber and the default are added to the % signature. % \begin{macrocode} -\cs_new_protected:Npn \xparse_add_type_G:w #1 +\cs_new_protected:Npn \@@_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 + \@@_flush_m_args: + \@@_add_grabber_optional:N G + \tl_put_right:Nn \l_@@_signature_tl { {#1} } + \@@_prepare_signature:N } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_type_l:w} +% \begin{macro}{\@@_add_type_l:w} % Finding \texttt{l} arguments is very simple: there is nothing to do % other than add the grabber. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xparse_add_type_l:w +\cs_new_protected_nopar:Npn \@@_add_type_l:w { - \xparse_flush_m_args: - \xparse_add_grabber_mandatory:N l - \xparse_prepare_signature:N + \@@_flush_m_args: + \@@_add_grabber_mandatory:N l + \@@_prepare_signature:N } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_type_m:w} +% \begin{macro}{\@@_add_type_m:w} % The \texttt{m} type is special as short arguments which are not % post-processed are simply counted at this stage. Thus there is a check % to see if either of these cases apply. If so, a one-argument grabber % is added to the signature. On the other hand, if a standard short % argument is required it is simply counted at this stage, to be -% added later using \cs{xparse_flush_m_args:}. +% added later using \cs{@@_flush_m_args:}. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xparse_add_type_m:w +\cs_new_protected_nopar:Npn \@@_add_type_m:w { - \bool_if:nTF { \l_xparse_long_bool || \l_xparse_processor_bool } + \bool_if:nTF { \l_@@_long_bool || \l_@@_processor_bool } { - \xparse_flush_m_args: - \xparse_add_grabber_mandatory:N m + \@@_flush_m_args: + \@@_add_grabber_mandatory:N m } - { \int_incr:N \l_xparse_m_args_int } - \xparse_prepare_signature:N + { \int_incr:N \l_@@_m_args_int } + \@@_prepare_signature:N } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_type_r:w, \xparse_add_type_R:w} +% \begin{macro}{\@@_add_type_r:w, \@@_add_type_R:w} % The \texttt{r}- and \texttt{R}-type arguments are very similar to the % \texttt{d}- and \texttt{D}-types. % \begin{macrocode} -\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 \@@_add_type_r:w #1#2 + { \exp_args:NNNo \@@_add_type_R:w #1 #2 \c_@@_no_value_tl } +\cs_new_protected:Npn \@@_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 + \@@_flush_m_args: + \@@_add_grabber_mandatory:N R + \tl_put_right:Nn \l_@@_signature_tl { #1 #2 {#3} } + \@@_prepare_signature:N } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_type_t:w} +% \begin{macro}{\@@_add_type_t:w} % Setting up a \texttt{t} argument means collecting one token for the test, % and adding it along with the grabber to the signature. % \begin{macrocode} -\cs_new_protected:Npn \xparse_add_type_t:w #1 +\cs_new_protected:Npn \@@_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 + \@@_flush_m_args: + \@@_add_grabber_optional:N t + \tl_put_right:Nn \l_@@_signature_tl { #1 } + \@@_prepare_signature:N } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_type_u:w} +% \begin{macro}{\@@_add_type_u:w} % At the set up stage, the \texttt{u} type argument is identical to the % \texttt{G} type except for the name of the grabber function. % \begin{macrocode} -\cs_new_protected:Npn \xparse_add_type_u:w #1 +\cs_new_protected:Npn \@@_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 + \@@_flush_m_args: + \@@_add_grabber_mandatory:N u + \tl_put_right:Nn \l_@@_signature_tl { {#1} } + \@@_prepare_signature:N } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_type_v:w} +% \begin{macro}{\@@_add_type_v:w} % At this stage, the \texttt{v} argument is identical to \texttt{l}. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xparse_add_type_v:w +\cs_new_protected_nopar:Npn \@@_add_type_v:w { - \xparse_flush_m_args: - \xparse_add_grabber_mandatory:N v - \xparse_prepare_signature:N + \@@_flush_m_args: + \@@_add_grabber_mandatory:N v + \@@_prepare_signature:N } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_flush_m_args:} +% \begin{macro}{\@@_flush_m_args:} % As \texttt{m} arguments are simply counted, there is a need to add % them to the token register in a block. As this function can only % be called if something other than \texttt{m} turns up, the flag can % be switched here. The total number of mandatory arguments added to % the signature is also decreased by the appropriate amount. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xparse_flush_m_args: +\cs_new_protected_nopar:Npn \@@_flush_m_args: { - \int_compare:nNnT \l_xparse_m_args_int > \c_zero + \int_compare:nNnT \l_@@_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_@@_signature_tl + { \exp_not:c { @@_grab_m_ \int_use:N \l_@@_m_args_int :w } } + \int_set:Nn \l_@@_mandatory_args_int + { \l_@@_mandatory_args_int - \l_@@_m_args_int } } - \int_zero:N \l_xparse_m_args_int + \int_zero:N \l_@@_m_args_int } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_grabber_mandatory:N} -% \begin{macro}{\xparse_add_grabber_optional:N} +% \begin{macro}{\@@_add_grabber_mandatory:N} +% \begin{macro}{\@@_add_grabber_optional:N} % To keep the various checks needed in one place, adding the grabber to % the signature is done here. For mandatory arguments, the only question % is whether to add a long grabber. For optional arguments, there is @@ -1489,30 +1529,30 @@ % This is used to determine whether to skip spaces or not where % searching for the argument. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xparse_add_grabber_mandatory:N #1 +\cs_new_protected_nopar:Npn \@@_add_grabber_mandatory:N #1 { - \tl_put_right:Nx \l_xparse_signature_tl + \tl_put_right:Nx \l_@@_signature_tl { \exp_not:c - { xparse_grab_ #1 \bool_if:NT \l_xparse_long_bool { _long } :w } + { @@_grab_ #1 \bool_if:NT \l_@@_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_@@_long_bool + \int_decr:N \l_@@_mandatory_args_int } -\cs_new_protected_nopar:Npn \xparse_add_grabber_optional:N #1 +\cs_new_protected_nopar:Npn \@@_add_grabber_optional:N #1 { - \tl_put_right:Nx \l_xparse_signature_tl + \tl_put_right:Nx \l_@@_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 + @@_grab_ #1 + \bool_if:NT \l_@@_long_bool { _long } + \int_compare:nNnF \l_@@_mandatory_args_int > \c_zero { _trailing } :w } } - \bool_set_false:N \l_xparse_long_bool + \bool_set_false:N \l_@@_long_bool } % \end{macrocode} % \end{macro} @@ -1525,94 +1565,97 @@ % also a need to define the per-function auxiliaries: this is done here, while % the general grabbers are dealt with later. % -% \begin{macro}{\xparse_add_expandable_type_+:w} +% \begin{macro}{\@@_add_expandable_type_+:w} % Check that a plus is given only if it occurs for every argument. % \begin{macrocode} -\cs_new_protected_nopar:cpn { xparse_add_expandable_type_+:w } +\cs_new_protected_nopar:cpn { @@_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_@@_long_bool + \int_compare:nNnTF \l_@@_current_arg_int = \c_one + { \bool_set_true:N \l_@@_all_long_bool } { - \bool_if:NF \l_xparse_all_long_bool - { \msg_kernel_error:nn { xparse } { inconsistent-long } } + \bool_if:NF \l_@@_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_@@_current_arg_int + \@@_prepare_signature:N } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_expandable_type_>:w} +% \begin{macro}{\@@_add_expandable_type_>:w} % No processors in expandable arguments, so this issues an error. % \begin{macrocode} -\cs_new_protected:cpn { xparse_add_expandable_type_>:w } #1 +\cs_new_protected:cpn { @@_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_@@_function_tl } } + \int_decr:N \l_@@_current_arg_int + \@@_prepare_signature:N } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_expandable_type_d:w} -% \begin{macro}{\xparse_add_expandable_type_D:w} -% \begin{macro}{\xparse_add_expandable_type_D_aux:NNn} -% \begin{macro}{\xparse_add_expandable_type_D_aux:Nn} +% \begin{macro}{\@@_add_expandable_type_d:w} +% \begin{macro}{\@@_add_expandable_type_D:w} +% \begin{macro}{\@@_add_expandable_type_D_aux:NNn} +% \begin{macro}{\@@_add_expandable_type_D_aux:Nn} % The set up for \texttt{d}- and \texttt{D}-type arguments is the same, % and involves constructing a rather complex auxiliary which is used % repeatedly when grabbing. There is an auxiliary here so that the % \texttt{R}-type can share code readily. % \begin{macrocode} -\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 \@@_add_expandable_type_d:w #1#2 + { + \exp_args:NNNo + \@@_add_expandable_type_D:w #1 #2 \c_@@_no_value_tl + } +\cs_new_protected:Npn \@@_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 + \@@_add_expandable_grabber_optional:n { D_alt } + \@@_add_expandable_type_D_aux:Nn #1 } { - \xparse_add_expandable_grabber_optional:n { D } - \xparse_add_expandable_type_D_aux:NNn #1#2 + \@@_add_expandable_grabber_optional:n { D } + \@@_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 \@@_add_expandable_type_D_aux:NNn #1#2#3 { - \bool_if:NTF \l_xparse_long_bool + \bool_if:NTF \l_@@_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_@@_expandable_aux_name_tl } ##1 ##2 #1 ##3 \q_@@ ##4 #2 { ##1 {##2} {##3} {##4} } - \tl_put_right:Nx \l_xparse_signature_tl + \tl_put_right:Nx \l_@@_signature_tl { - \exp_not:c { \l_xparse_expandable_aux_name_tl } + \exp_not:c { \l_@@_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_@@_long_bool + \@@_prepare_signature:N } % \end{macrocode} % This route is needed if the two delimiting tokens are identical: in % contrast to the non-expandable route, the grabber here has to act % differently for this case. % \begin{macrocode} -\cs_new_protected:Npn \xparse_add_expandable_type_D_aux:Nn #1#2 +\cs_new_protected:Npn \@@_add_expandable_type_D_aux:Nn #1#2 { - \bool_if:NTF \l_xparse_long_bool + \bool_if:NTF \l_@@_all_long_bool { \cs_set:cpx } { \cs_set_nopar:cpx } - { \l_xparse_expandable_aux_name_tl } ##1 #1 ##2 #1 + { \l_@@_expandable_aux_name_tl } ##1 #1 ##2 #1 { ##1 {##2} } - \tl_put_right:Nx \l_xparse_signature_tl + \tl_put_right:Nx \l_@@_signature_tl { - \exp_not:c { \l_xparse_expandable_aux_name_tl } + \exp_not:c { \l_@@_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_@@_long_bool + \@@_prepare_signature:N } % \end{macrocode} % \end{macro} @@ -1620,150 +1663,153 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_add_expandable_type_g:w} -% \begin{macro}{\xparse_add_expandable_type_G:w} +% \begin{macro}{\@@_add_expandable_type_g:w} +% \begin{macro}{\@@_add_expandable_type_G:w} % These are not allowed at all, so there is a complaint and a fall-back. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xparse_add_expandable_type_g:w +\cs_new_protected_nopar:Npn \@@_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 } + \@@_add_expandable_type_m:w } -\cs_new_protected_nopar:Npn \xparse_add_expandable_type_G:w #1 +\cs_new_protected_nopar:Npn \@@_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 } + \@@_add_expandable_type_m:w } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_add_expandable_type_l:w} +% \begin{macro}{\@@_add_expandable_type_l:w} % Invalid in expandable contexts (as the next left brace may have been % inserted by \pkg{xparse} due to a failed search for an optional argument). % \begin{macrocode} -\cs_new_protected_nopar:Npn \xparse_add_expandable_type_l:w +\cs_new_protected_nopar:Npn \@@_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 } + \@@_add_expandable_type_m:w } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_expandable_type_m:w} +% \begin{macro}{\@@_add_expandable_type_m:w} % Unlike the standard case, when working expandably each argument is always % grabbed separately unless the function takes only \texttt{m}-type % arguments. To deal with the latter case, the value of -% \cs{l_xparse_m_args_int} needs to be increased appropriately. +% \cs{l_@@_m_args_int} needs to be increased appropriately. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xparse_add_expandable_type_m:w +\cs_new_protected_nopar:Npn \@@_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_@@_m_args_int + \@@_add_expandable_grabber_mandatory:n { m } + \bool_set_false:N \l_@@_long_bool + \@@_prepare_signature:N } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_expandable_type_r:w} -% \begin{macro}{\xparse_add_expandable_type_R:w} +% \begin{macro}{\@@_add_expandable_type_r:w} +% \begin{macro}{\@@_add_expandable_type_R:w} % The \texttt{r}- and \texttt{R}-types are very similar to \texttt{D}-type % arguments, and so the same internals are used. % \begin{macrocode} -\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 \@@_add_expandable_type_r:w #1#2 + { + \exp_args:NNNo + \@@_add_expandable_type_R:w #1 #2 \c_@@_no_value_tl + } +\cs_new_protected:Npn \@@_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 + \@@_add_expandable_grabber_optional:n { R_alt } + \@@_add_expandable_type_D_aux:Nn #1 } { - \xparse_add_expandable_grabber_optional:n { R } - \xparse_add_expandable_type_D_aux:NNn #1#2 + \@@_add_expandable_grabber_optional:n { R } + \@@_add_expandable_type_D_aux:NNn #1#2 } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_add_expandable_type_t:w} +% \begin{macro}{\@@_add_expandable_type_t:w} % \begin{macrocode} -\cs_new_protected_nopar:Npn \xparse_add_expandable_type_t:w #1 +\cs_new_protected_nopar:Npn \@@_add_expandable_type_t:w #1 { - \xparse_add_expandable_grabber_optional:n { t } - \bool_if:NTF \l_xparse_long_bool + \@@_add_expandable_grabber_optional:n { t } + \bool_if:NTF \l_@@_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_@@_expandable_aux_name_tl } ##1 #1 {##1} + \tl_put_right:Nx \l_@@_signature_tl { - \exp_not:c { \l_xparse_expandable_aux_name_tl } + \exp_not:c { \l_@@_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_@@_long_bool + \@@_prepare_signature:N } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_expandable_type_u:w} +% \begin{macro}{\@@_add_expandable_type_u:w} % Invalid in an expandable context as any preceding optional argument may % wrap part of the delimiter up in braces. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xparse_add_expandable_type_u:w #1 +\cs_new_protected_nopar:Npn \@@_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 } + \@@_add_expandable_type_m:w } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_expandable_type_v:w} +% \begin{macro}{\@@_add_expandable_type_v:w} % Another forbidden type. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xparse_add_expandable_type_v:w +\cs_new_protected_nopar:Npn \@@_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 } + \@@_add_expandable_type_m:w } % \end{macrocode} % \end{macro} % % \begin{macro} % { -% \xparse_add_expandable_grabber_mandatory:n, -% \xparse_add_expandable_grabber_optional:n +% \@@_add_expandable_grabber_mandatory:n, +% \@@_add_expandable_grabber_optional:n % } -% \begin{macro}[aux]{\xparse_add_expandable_long_check:} +% \begin{macro}[aux]{\@@_add_expandable_long_check:} % Adding a grabber to the signature is very simple here, with only a test to % ensure that optional arguments still have mandatory ones to follow. This % is also a good place to check on the consistency of the long status of % arguments. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xparse_add_expandable_grabber_mandatory:n #1 +\cs_new_protected_nopar:Npn \@@_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 + \@@_add_expandable_long_check: + \tl_put_right:Nx \l_@@_signature_tl + { \exp_not:c { @@_expandable_grab_ #1 :w } } + \bool_set_false:N \l_@@_long_bool + \int_decr:N \l_@@_mandatory_args_int } -\cs_new_protected_nopar:Npn \xparse_add_expandable_grabber_optional:n #1 +\cs_new_protected_nopar:Npn \@@_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 + \@@_add_expandable_long_check: + \int_compare:nNnF \l_@@_mandatory_args_int > \c_zero + { \__msg_kernel_error:nn { xparse } { expandable-ending-optional } } + \tl_put_right:Nx \l_@@_signature_tl + { \exp_not:c { @@_expandable_grab_ #1 :w } } + \bool_set_false:N \l_@@_long_bool } -\cs_new_protected_nopar:Npn \xparse_add_expandable_long_check: +\cs_new_protected_nopar:Npn \@@_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_@@_all_long_bool && ! ( \l_@@_long_bool ) } + { \__msg_kernel_error:nn { xparse } { inconsistent-long } } } % \end{macrocode} % \end{macro} @@ -1776,11 +1822,11 @@ % \cs{parse_grab_arg:w} to grab the argument. This means determining % whether to use \cs{cs_set:Npn} or \cs{cs_set_nopar:Npn}, and for % optional arguments whether to skip spaces. In all cases, -% \cs{xparse_grab_arg:w} is then called to actually do the grabbing. +% \cs{@@_grab_arg:w} is then called to actually do the grabbing. % -% \begin{macro}{\xparse_grab_arg:w} -% \begin{macro}[aux]{\xparse_grab_arg_aux_i:w} -% \begin{macro}[aux]{\xparse_grab_arg_aux_ii:w} +% \begin{macro}{\@@_grab_arg:w} +% \begin{macro}[aux]{\@@_grab_arg_aux_i:w} +% \begin{macro}[aux]{\@@_grab_arg_aux_ii:w} % Each time an argument is actually grabbed, \pkg{xparse} defines a % function to do it. In that way, long arguments from previous functions % can be included in the definition of the grabber function, so that @@ -1788,39 +1834,39 @@ % for this is reserved here. A couple of auxiliary functions are also % needed in various places. % \begin{macrocode} -\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 \@@_grab_arg:w { } +\cs_new_protected:Npn \@@_grab_arg_aux_i:w { } +\cs_new_protected:Npn \@@_grab_arg_aux_ii:w { } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_grab_D:w} -% \begin{macro}{\xparse_grab_D_long:w} -% \begin{macro}{\xparse_grab_D_trailing:w} -% \begin{macro}{\xparse_grab_D_long_trailing:w} +% \begin{macro}{\@@_grab_D:w} +% \begin{macro}{\@@_grab_D_long:w} +% \begin{macro}{\@@_grab_D_trailing:w} +% \begin{macro}{\@@_grab_D_long_trailing:w} % The generic delimited argument grabber. The auxiliary function does -% a peek test before calling \cs{xparse_grab_arg:w}, so that the +% a peek test before calling \cs{@@_grab_arg:w}, so that the % optional nature of the argument works as expected. % \begin{macrocode} -\cs_new_protected:Npn \xparse_grab_D:w #1#2#3#4 \l_xparse_args_tl +\cs_new_protected:Npn \@@_grab_D:w #1#2#3#4 \l_@@_args_tl { - \xparse_grab_D_aux:NNnnNn #1 #2 {#3} {#4} \cs_set_protected_nopar:Npn + \@@_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 \@@_grab_D_long:w #1#2#3#4 \l_@@_args_tl { - \xparse_grab_D_aux:NNnnNn #1 #2 {#3} {#4} \cs_set_protected:Npn + \@@_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 \@@_grab_D_trailing:w #1#2#3#4 \l_@@_args_tl + { \@@_grab_D_aux:NNnnNn #1 #2 {#3} {#4} \cs_set_protected_nopar:Npn { } } +\cs_new_protected:Npn \@@_grab_D_long_trailing:w #1#2#3#4 \l_@@_args_tl + { \@@_grab_D_aux:NNnnNn #1 #2 {#3} {#4} \cs_set_protected:Npn { } } % \end{macrocode} -% \begin{macro}[aux]{\xparse_grab_D_aux:NNnnNn} -% \begin{macro}[aux]{\xparse_grab_D_aux:NNnN} +% \begin{macro}[aux]{\@@_grab_D_aux:NNnnNn} +% \begin{macro}[aux]{\@@_grab_D_aux:NNnN} % This is a bit complicated. The idea is that, in order to check for % nested optional argument tokens (\texttt{[[...]]} and so on) the % argument needs to be grabbed without removing any braces at all. If @@ -1829,27 +1875,27 @@ % prevents loss of braces, and there is then a test to see if there are % nested delimiters to handle. % \begin{macrocode} -\cs_new_protected:Npn \xparse_grab_D_aux:NNnnNn #1#2#3#4#5#6 +\cs_new_protected:Npn \@@_grab_D_aux:NNnnNn #1#2#3#4#5#6 { - \xparse_grab_D_aux:NNnN #1#2 {#4} #5 + \@@_grab_D_aux:NNnN #1#2 {#4} #5 \use:c { peek_meaning_remove #6 :NTF } #1 - { \xparse_grab_arg:w } + { \@@_grab_arg:w } { - \xparse_add_arg:n {#3} - #4 \l_xparse_args_tl + \@@_add_arg:n {#3} + #4 \l_@@_args_tl } } -\cs_new_protected:Npn \xparse_grab_D_aux:NNnN #1#2#3#4 +\cs_new_protected:Npn \@@_grab_D_aux:NNnN #1#2#3#4 { - \cs_set_protected_nopar:Npn \xparse_grab_arg:w + \cs_set_protected_nopar:Npn \@@_grab_arg:w { - \exp_after:wN #4 \l_xparse_fn_tl ####1 #2 + \exp_after:wN #4 \l_@@_fn_tl ####1 #2 { \tl_if_in:nnTF {####1} {#1} - { \xparse_grab_D_nested:NNnnN #1 #2 {####1} {#3} #4 } + { \@@_grab_D_nested:NNnnN #1 #2 {####1} {#3} #4 } { - \xparse_add_arg:o { \use_none:n ####1 } - #3 \l_xparse_args_tl + \@@_add_arg:o { \use_none:n ####1 } + #3 \l_@@_args_tl } } % \end{macrocode} @@ -1873,7 +1919,7 @@ \tl_to_lowercase:n { \group_end: - \l_xparse_fn_tl A + \l_@@_fn_tl A } } { @@ -1881,7 +1927,7 @@ \tl_to_lowercase:n { \group_end: - \l_xparse_fn_tl ^ + \l_@@_fn_tl ^ } } } @@ -1893,11 +1939,11 @@ % \end{macro} % \end{macro} % \end{macro} -% \begin{macro}[aux]{\xparse_grab_D_nested:NNnnN} -% \begin{macro}[aux]{\xparse_grab_D_nested:w} -% \begin{macro}{\l_xparse_nesting_a_tl} -% \begin{macro}{\l_xparse_nesting_b_tl} -% \begin{macro}{\q_xparse} +% \begin{macro}[aux]{\@@_grab_D_nested:NNnnN} +% \begin{macro}[aux]{\@@_grab_D_nested:w} +% \begin{macro}{\l_@@_nesting_a_tl} +% \begin{macro}{\l_@@_nesting_b_tl} +% \begin{macro}{\q_@@} % Catching nested optional arguments means more work. The aim here is % to collect up each pair of optional tokens without \TeX{} helping out, % and without counting anything. The code above will already have @@ -1915,43 +1961,43 @@ % loss of any braces, hence the insertion and removal of quarks along the % way. % \begin{macrocode} -\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_@@_nesting_a_tl +\tl_new:N \l_@@_nesting_b_tl +\quark_new:N \q_@@ +\cs_new_protected:Npn \@@_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_@@_nesting_a_tl + \tl_clear:N \l_@@_nesting_b_tl + \exp_after:wN #5 \l_@@_fn_tl ##1 #1 ##2 \q_@@ ##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_@@_nesting_a_tl { \use_none:n ##1 #1 } + \tl_put_right:No \l_@@_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_@@_fn_tl + \q_nil ##2 \q_@@ \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_@@_nesting_a_tl + { \@@_grab_D_nested:w \q_nil ##2 \q_stop } + \tl_if_in:NnTF \l_@@_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_@@_tmp_tl \l_@@_nesting_b_tl + \tl_clear:N \l_@@_nesting_b_tl + \exp_after:wN \l_@@_fn_tl \exp_after:wN + \q_nil \l_@@_tmp_tl \q_nil \q_@@ \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_@@_nesting_a_tl + \l_@@_nesting_b_tl + \@@_add_arg:V \l_@@_nesting_a_tl + #4 \l_@@_args_tl } } } - \l_xparse_fn_tl #3 \q_nil \q_xparse \ERROR + \l_@@_fn_tl #3 \q_nil \q_@@ \ERROR } -\cs_new:Npn \xparse_grab_D_nested:w #1 \q_nil \q_stop +\cs_new:Npn \@@_grab_D_nested:w #1 \q_nil \q_stop { \exp_not:o { \use_none:n #1 } } % \end{macrocode} % \end{macro} @@ -1960,39 +2006,39 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_grab_G:w} -% \begin{macro}{\xparse_grab_G_long:w} -% \begin{macro}{\xparse_grab_G_trailing:w} -% \begin{macro}{\xparse_grab_G_long_trailing:w} -% \begin{macro}[aux]{\xparse_grab_G_aux:nnNn} +% \begin{macro}{\@@_grab_G:w} +% \begin{macro}{\@@_grab_G_long:w} +% \begin{macro}{\@@_grab_G_trailing:w} +% \begin{macro}{\@@_grab_G_long_trailing:w} +% \begin{macro}[aux]{\@@_grab_G_aux:nnNn} % Optional groups are checked by meaning, so that the same code will % work with, for example, Con\TeX{}t-like input. % \begin{macrocode} -\cs_new_protected:Npn \xparse_grab_G:w #1#2 \l_xparse_args_tl +\cs_new_protected:Npn \@@_grab_G:w #1#2 \l_@@_args_tl { - \xparse_grab_G_aux:nnNn {#1} {#2} \cs_set_protected_nopar:Npn + \@@_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 \@@_grab_G_long:w #1#2 \l_@@_args_tl { - \xparse_grab_G_aux:nnNn {#1} {#2} \cs_set_protected:Npn { _ignore_spaces } + \@@_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 \@@_grab_G_trailing:w #1#2 \l_@@_args_tl + { \@@_grab_G_aux:nnNn {#1} {#2} \cs_set_protected_nopar:Npn { } } +\cs_new_protected:Npn \@@_grab_G_long_trailing:w #1#2 \l_@@_args_tl + { \@@_grab_G_aux:nnNn {#1} {#2} \cs_set_protected:Npn { } } +\cs_new_protected:Npn \@@_grab_G_aux:nnNn #1#2#3#4 { - \exp_after:wN #3 \l_xparse_fn_tl ##1 + \exp_after:wN #3 \l_@@_fn_tl ##1 { - \xparse_add_arg:n {##1} - #2 \l_xparse_args_tl + \@@_add_arg:n {##1} + #2 \l_@@_args_tl } \use:c { peek_meaning #4 :NTF } \c_group_begin_token - { \l_xparse_fn_tl } + { \l_@@_fn_tl } { - \xparse_add_arg:n {#1} - #2 \l_xparse_args_tl + \@@_add_arg:n {#1} + #2 \l_@@_args_tl } } % \end{macrocode} @@ -2002,149 +2048,149 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_grab_l:w} -% \begin{macro}{\xparse_grab_l_long:w} -% \begin{macro}[aux]{\xparse_grab_l_aux:nN} +% \begin{macro}{\@@_grab_l:w} +% \begin{macro}{\@@_grab_l_long:w} +% \begin{macro}[aux]{\@@_grab_l_aux:nN} % Argument grabbers for mandatory \TeX{} arguments are pretty simple. % \begin{macrocode} -\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 \@@_grab_l:w #1 \l_@@_args_tl + { \@@_grab_l_aux:nN {#1} \cs_set_protected_nopar:Npn } +\cs_new_protected:Npn \@@_grab_l_long:w #1 \l_@@_args_tl + { \@@_grab_l_aux:nN {#1} \cs_set_protected:Npn } +\cs_new_protected:Npn \@@_grab_l_aux:nN #1#2 { - \exp_after:wN #2 \l_xparse_fn_tl ##1## + \exp_after:wN #2 \l_@@_fn_tl ##1## { - \xparse_add_arg:n {##1} - #1 \l_xparse_args_tl + \@@_add_arg:n {##1} + #1 \l_@@_args_tl } - \l_xparse_fn_tl + \l_@@_fn_tl } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_grab_m:w} -% \begin{macro}{\xparse_grab_m_long:w} +% \begin{macro}{\@@_grab_m:w} +% \begin{macro}{\@@_grab_m_long:w} % Collecting a single mandatory argument is quite easy. % \begin{macrocode} -\cs_new_protected:Npn \xparse_grab_m:w #1 \l_xparse_args_tl +\cs_new_protected:Npn \@@_grab_m:w #1 \l_@@_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl ##1 + \exp_after:wN \cs_set_protected_nopar:Npn \l_@@_fn_tl ##1 { - \xparse_add_arg:n {##1} - #1 \l_xparse_args_tl + \@@_add_arg:n {##1} + #1 \l_@@_args_tl } - \l_xparse_fn_tl + \l_@@_fn_tl } -\cs_new_protected:Npn \xparse_grab_m_long:w #1 \l_xparse_args_tl +\cs_new_protected:Npn \@@_grab_m_long:w #1 \l_@@_args_tl { - \exp_after:wN \cs_set_protected:Npn \l_xparse_fn_tl ##1 + \exp_after:wN \cs_set_protected:Npn \l_@@_fn_tl ##1 { - \xparse_add_arg:n {##1} - #1 \l_xparse_args_tl + \@@_add_arg:n {##1} + #1 \l_@@_args_tl } - \l_xparse_fn_tl + \l_@@_fn_tl } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_grab_m_1:w} -% \begin{macro}{\xparse_grab_m_2:w} -% \begin{macro}{\xparse_grab_m_3:w} -% \begin{macro}{\xparse_grab_m_4:w} -% \begin{macro}{\xparse_grab_m_5:w} -% \begin{macro}{\xparse_grab_m_6:w} -% \begin{macro}{\xparse_grab_m_7:w} -% \begin{macro}{\xparse_grab_m_8:w} +% \begin{macro}{\@@_grab_m_1:w} +% \begin{macro}{\@@_grab_m_2:w} +% \begin{macro}{\@@_grab_m_3:w} +% \begin{macro}{\@@_grab_m_4:w} +% \begin{macro}{\@@_grab_m_5:w} +% \begin{macro}{\@@_grab_m_6:w} +% \begin{macro}{\@@_grab_m_7:w} +% \begin{macro}{\@@_grab_m_8:w} % Grabbing 1--8 mandatory arguments. We don't need to worry about % nine arguments as this is only possible if everything is % mandatory. Each function has an auxiliary so that \cs{par} tokens % from other arguments still work. % \begin{macrocode} -\cs_new_protected:cpn { xparse_grab_m_1:w } #1 \l_xparse_args_tl +\cs_new_protected:cpn { @@_grab_m_1:w } #1 \l_@@_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl ##1 + \exp_after:wN \cs_set_protected_nopar:Npn \l_@@_fn_tl ##1 { - \tl_put_right:Nn \l_xparse_args_tl { {##1} } - #1 \l_xparse_args_tl + \tl_put_right:Nn \l_@@_args_tl { {##1} } + #1 \l_@@_args_tl } - \l_xparse_fn_tl + \l_@@_fn_tl } -\cs_new_protected:cpn { xparse_grab_m_2:w } #1 \l_xparse_args_tl +\cs_new_protected:cpn { @@_grab_m_2:w } #1 \l_@@_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl + \exp_after:wN \cs_set_protected_nopar:Npn \l_@@_fn_tl ##1##2 { - \tl_put_right:Nn \l_xparse_args_tl { {##1} {##2} } - #1 \l_xparse_args_tl + \tl_put_right:Nn \l_@@_args_tl { {##1} {##2} } + #1 \l_@@_args_tl } - \l_xparse_fn_tl + \l_@@_fn_tl } -\cs_new_protected:cpn { xparse_grab_m_3:w } #1 \l_xparse_args_tl +\cs_new_protected:cpn { @@_grab_m_3:w } #1 \l_@@_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl + \exp_after:wN \cs_set_protected_nopar:Npn \l_@@_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_@@_args_tl { {##1} {##2} {##3} } + #1 \l_@@_args_tl } - \l_xparse_fn_tl + \l_@@_fn_tl } -\cs_new_protected:cpn { xparse_grab_m_4:w } #1 \l_xparse_args_tl +\cs_new_protected:cpn { @@_grab_m_4:w } #1 \l_@@_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl + \exp_after:wN \cs_set_protected_nopar:Npn \l_@@_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_@@_args_tl { {##1} {##2} {##3} {##4} } + #1 \l_@@_args_tl } - \l_xparse_fn_tl + \l_@@_fn_tl } -\cs_new_protected:cpn { xparse_grab_m_5:w } #1 \l_xparse_args_tl +\cs_new_protected:cpn { @@_grab_m_5:w } #1 \l_@@_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl + \exp_after:wN \cs_set_protected_nopar:Npn \l_@@_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_@@_args_tl { {##1} {##2} {##3} {##4} {##5} } + #1 \l_@@_args_tl } - \l_xparse_fn_tl + \l_@@_fn_tl } -\cs_new_protected:cpn { xparse_grab_m_6:w } #1 \l_xparse_args_tl +\cs_new_protected:cpn { @@_grab_m_6:w } #1 \l_@@_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl + \exp_after:wN \cs_set_protected_nopar:Npn \l_@@_fn_tl ##1##2##3##4##5##6 { - \tl_put_right:Nn \l_xparse_args_tl + \tl_put_right:Nn \l_@@_args_tl { {##1} {##2} {##3} {##4} {##5} {##6} } - #1 \l_xparse_args_tl + #1 \l_@@_args_tl } - \l_xparse_fn_tl + \l_@@_fn_tl } -\cs_new_protected:cpn { xparse_grab_m_7:w } #1 \l_xparse_args_tl +\cs_new_protected:cpn { @@_grab_m_7:w } #1 \l_@@_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl + \exp_after:wN \cs_set_protected_nopar:Npn \l_@@_fn_tl ##1##2##3##4##5##6##7 { - \tl_put_right:Nn \l_xparse_args_tl + \tl_put_right:Nn \l_@@_args_tl { {##1} {##2} {##3} {##4} {##5} {##6} {##7} } - #1 \l_xparse_args_tl + #1 \l_@@_args_tl } - \l_xparse_fn_tl + \l_@@_fn_tl } -\cs_new_protected:cpn { xparse_grab_m_8:w } #1 \l_xparse_args_tl +\cs_new_protected:cpn { @@_grab_m_8:w } #1 \l_@@_args_tl { - \exp_after:wN \cs_set_protected_nopar:Npn \l_xparse_fn_tl + \exp_after:wN \cs_set_protected_nopar:Npn \l_@@_fn_tl ##1##2##3##4##5##6##7##8 { - \tl_put_right:Nn \l_xparse_args_tl + \tl_put_right:Nn \l_@@_args_tl { {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8} } - #1 \l_xparse_args_tl + #1 \l_@@_args_tl } - \l_xparse_fn_tl + \l_@@_fn_tl } % \end{macrocode} % \end{macro} @@ -2156,66 +2202,66 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_grab_R:w, \xparse_grab_R_long:w} -% \begin{macro}[aux]{\xparse_grab_R_aux:NNnnN} +% \begin{macro}{\@@_grab_R:w, \@@_grab_R_long:w} +% \begin{macro}[aux]{\@@_grab_R_aux:NNnnN} % The grabber for \texttt{R}-type arguments is basically the same as % that for \texttt{D}-type ones, but always skips spaces (as it is mandatory) % and has a hard-coded error message. % \begin{macrocode} -\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 \@@_grab_R:w #1#2#3#4 \l_@@_args_tl + { \@@_grab_R_aux:NNnnN #1 #2 {#3} {#4} \cs_set_protected_nopar:Npn } +\cs_new_protected:Npn \@@_grab_R_long:w #1#2#3#4 \l_@@_args_tl + { \@@_grab_R_aux:NNnnN #1 #2 {#3} {#4} \cs_set_protected:Npn } +\cs_new_protected:Npn \@@_grab_R_aux:NNnnN #1#2#3#4#5 { - \xparse_grab_D_aux:NNnN #1 #2 {#4} #5 + \@@_grab_D_aux:NNnN #1 #2 {#4} #5 \peek_meaning_remove_ignore_spaces:NTF #1 - { \xparse_grab_arg:w } + { \@@_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 + \@@_add_arg:n {#3} + #4 \l_@@_args_tl } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_grab_t:w} -% \begin{macro}{\xparse_grab_t_long:w} -% \begin{macro}{\xparse_grab_t_trailing:w} -% \begin{macro}{\xparse_grab_t_long_trailing:w} -% \begin{macro}[aux]{\xparse_grab_t_aux:NnNn} +% \begin{macro}{\@@_grab_t:w} +% \begin{macro}{\@@_grab_t_long:w} +% \begin{macro}{\@@_grab_t_trailing:w} +% \begin{macro}{\@@_grab_t_long_trailing:w} +% \begin{macro}[aux]{\@@_grab_t_aux:NnNn} % Dealing with a token is quite easy. Check the match, remove the % token if needed and add a flag to the output. % \begin{macrocode} -\cs_new_protected:Npn \xparse_grab_t:w #1#2 \l_xparse_args_tl +\cs_new_protected:Npn \@@_grab_t:w #1#2 \l_@@_args_tl { - \xparse_grab_t_aux:NnNn #1 {#2} \cs_set_protected_nopar:Npn + \@@_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 \@@_grab_t_long:w #1#2 \l_@@_args_tl + { \@@_grab_t_aux:NnNn #1 {#2} \cs_set_protected:Npn { _ignore_spaces } } +\cs_new_protected:Npn \@@_grab_t_trailing:w #1#2 \l_@@_args_tl + { \@@_grab_t_aux:NnNn #1 {#2} \cs_set_protected_nopar:Npn { } } +\cs_new_protected:Npn \@@_grab_t_long_trailing:w #1#2 \l_@@_args_tl + { \@@_grab_t_aux:NnNn #1 {#2} \cs_set_protected:Npn { } } +\cs_new_protected:Npn \@@_grab_t_aux:NnNn #1#2#3#4 { - \exp_after:wN #3 \l_xparse_fn_tl + \exp_after:wN #3 \l_@@_fn_tl { \use:c { peek_meaning_remove #4 :NTF } #1 { - \xparse_add_arg:n { \BooleanTrue } - #2 \l_xparse_args_tl + \@@_add_arg:n { \BooleanTrue } + #2 \l_@@_args_tl } { - \xparse_add_arg:n { \BooleanFalse } - #2 \l_xparse_args_tl + \@@_add_arg:n { \BooleanFalse } + #2 \l_@@_args_tl } } - \l_xparse_fn_tl + \l_@@_fn_tl } % \end{macrocode} % \end{macro} @@ -2224,36 +2270,36 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_grab_u:w} -% \begin{macro}{\xparse_grab_u_long:w} -% \begin{macro}[aux]{\xparse_grab_u_aux:nnN} +% \begin{macro}{\@@_grab_u:w} +% \begin{macro}{\@@_grab_u_long:w} +% \begin{macro}[aux]{\@@_grab_u_aux:nnN} % Grabbing up to a list of tokens is quite easy: define the grabber, % and then collect. % \begin{macrocode} -\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 \@@_grab_u:w #1#2 \l_@@_args_tl + { \@@_grab_u_aux:nnN {#1} {#2} \cs_set_protected_nopar:Npn } +\cs_new_protected:Npn \@@_grab_u_long:w #1#2 \l_@@_args_tl + { \@@_grab_u_aux:nnN {#1} {#2} \cs_set_protected:Npn } +\cs_new_protected:Npn \@@_grab_u_aux:nnN #1#2#3 { - \exp_after:wN #3 \l_xparse_fn_tl ##1 #1 + \exp_after:wN #3 \l_@@_fn_tl ##1 #1 { - \xparse_add_arg:n {##1} - #2 \l_xparse_args_tl + \@@_add_arg:n {##1} + #2 \l_@@_args_tl } - \l_xparse_fn_tl + \l_@@_fn_tl } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_grab_v:w} -% \begin{macro}{\xparse_grab_v_long:w} -% \begin{macro}{\xparse_grab_v_aux:w} -% \begin{macro}{\xparse_grab_v_group_end:} -% \begin{variable}{\l_xparse_v_rest_of_signature_tl} -% \begin{variable}{\l_xparse_v_arg_tl} +% \begin{macro}{\@@_grab_v:w} +% \begin{macro}{\@@_grab_v_long:w} +% \begin{macro}{\@@_grab_v_aux:w} +% \begin{macro}{\@@_grab_v_group_end:} +% \begin{variable}{\l_@@_v_rest_of_signature_tl} +% \begin{variable}{\l_@@_v_arg_tl} % The opening delimiter is never read verbatim, for consistency: if the % preceeding argument was optional and absent, then \TeX{} has already read % that token when looking for the optional argument. The first thing @@ -2261,50 +2307,50 @@ % case of a left brace (in that case, \cs{group_align_safe_end:} % is needed to compensate for the begin-group character that was % just seen). -% Then set verbatim catcodes with \cs{xparse_grab_v_aux_catcodes:}. +% Then set verbatim catcodes with \cs{@@_grab_v_aux_catcodes:}. % % The group keep catcode changes local, and % \cs{group_align_safe_begin/end:} allow to use a character % with category code $4$ (normally |&|) as the delimiter. -% It is ended by \cs{xparse_grab_v_group_end:}, which smuggles +% It is ended by \cs{@@_grab_v_group_end:}, which smuggles % the collected argument out of the group. % \begin{macrocode} -\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_@@_v_rest_of_signature_tl +\tl_new:N \l_@@_v_arg_tl +\cs_new_protected_nopar:Npn \@@_grab_v:w { - \bool_set_false:N \l_xparse_long_bool - \xparse_grab_v_aux:w + \bool_set_false:N \l_@@_long_bool + \@@_grab_v_aux:w } -\cs_new_protected_nopar:Npn \xparse_grab_v_long:w +\cs_new_protected_nopar:Npn \@@_grab_v_long:w { - \bool_set_true:N \l_xparse_long_bool - \xparse_grab_v_aux:w + \bool_set_true:N \l_@@_long_bool + \@@_grab_v_aux:w } -\cs_new_protected:Npn \xparse_grab_v_aux:w #1 \l_xparse_args_tl +\cs_new_protected:Npn \@@_grab_v_aux:w #1 \l_@@_args_tl { - \tl_set:Nn \l_xparse_v_rest_of_signature_tl {#1} + \tl_set:Nn \l_@@_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_@@_v_arg_tl \peek_N_type:TF - { \xparse_grab_v_aux_test:N } + { \@@_grab_v_aux_test:N } { \peek_meaning_remove:NTF \c_group_begin_token { \group_align_safe_end: - \xparse_grab_v_bgroup: + \@@_grab_v_bgroup: } - { \xparse_grab_v_aux_abort: } + { \@@_grab_v_aux_abort: } } } -\cs_new_protected_nopar:Npn \xparse_grab_v_group_end: +\cs_new_protected_nopar:Npn \@@_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_@@_v_arg_tl { \l_@@_v_arg_tl } } % \end{macrocode} % \end{variable} @@ -2314,12 +2360,12 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_grab_v_aux_test:N} +% \begin{macro}{\@@_grab_v_aux_test:N} % \begin{macro} % { -% \xparse_grab_v_aux_loop:N, -% \xparse_grab_v_aux_loop_ii:NN, -% \xparse_grab_v_aux_loop_end: +% \@@_grab_v_aux_loop:N, +% \@@_grab_v_aux_loop_ii:NN, +% \@@_grab_v_aux_loop_end: % } % Check that the opening delimiter is a character, setup category codes, % then start reading tokens one by one, keeping the delimiter as an argument. @@ -2332,104 +2378,104 @@ % or $6$ (macro parameter), nor the space character, % with category code~$10$ and character code~$32$, % nor a control sequence. -% The partially built argument is stored in \cs{l_xparse_v_arg_tl}. +% The partially built argument is stored in \cs{l_@@_v_arg_tl}. % If we ever meet a token which we cannot grab (non-N-type), % or which is not a character according to -% \cs{xparse_grab_v_token_if_char:NTF}, then we bail out with -% \cs{xparse_grab_v_aux_abort:}. Otherwise, we stop at the first +% \cs{@@_grab_v_token_if_char:NTF}, then we bail out with +% \cs{@@_grab_v_aux_abort:}. Otherwise, we stop at the first % character matching the delimiter. % \begin{macrocode} -\cs_new_protected:Npn \xparse_grab_v_aux_test:N #1 +\cs_new_protected:Npn \@@_grab_v_aux_test:N #1 { - \xparse_grab_v_aux_put:N #1 - \xparse_grab_v_token_if_char:NTF #1 + \@@_grab_v_aux_put:N #1 + \@@_grab_v_token_if_char:NTF #1 { - \xparse_grab_v_aux_catcodes: - \xparse_grab_v_aux_loop:N #1 + \@@_grab_v_aux_catcodes: + \@@_grab_v_aux_loop:N #1 } - { \xparse_grab_v_aux_abort: } + { \@@_grab_v_aux_abort: } } -\cs_new_protected:Npn \xparse_grab_v_aux_loop:N #1 +\cs_new_protected:Npn \@@_grab_v_aux_loop:N #1 { \peek_N_type:TF - { \xparse_grab_v_aux_loop_ii:NN #1 } - { \xparse_grab_v_aux_abort: } + { \@@_grab_v_aux_loop_ii:NN #1 } + { \@@_grab_v_aux_abort: } } -\cs_new_protected:Npn \xparse_grab_v_aux_loop_ii:NN #1 #2 +\cs_new_protected:Npn \@@_grab_v_aux_loop_ii:NN #1 #2 { - \xparse_grab_v_token_if_char:NTF #2 + \@@_grab_v_token_if_char:NTF #2 { \token_if_eq_charcode:NNTF #1 #2 - { \xparse_grab_v_aux_loop_end: } + { \@@_grab_v_aux_loop_end: } { - \xparse_grab_v_aux_put:N #2 - \xparse_grab_v_aux_loop:N #1 + \@@_grab_v_aux_put:N #2 + \@@_grab_v_aux_loop:N #1 } } - { \xparse_grab_v_aux_abort: #2 } + { \@@_grab_v_aux_abort: #2 } } -\cs_new_protected_nopar:Npn \xparse_grab_v_aux_loop_end: +\cs_new_protected_nopar:Npn \@@_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 + \@@_grab_v_group_end: + \exp_args:Nx \@@_add_arg:n { \tl_tail:N \l_@@_v_arg_tl } + \l_@@_v_rest_of_signature_tl \l_@@_args_tl } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_grab_v_bgroup:} -% \begin{macro}{\xparse_grab_v_bgroup_loop:} -% \begin{macro}{\xparse_grab_v_bgroup_loop_ii:N} -% \begin{variable}{\l_xparse_v_nesting_int} +% \begin{macro}{\@@_grab_v_bgroup:} +% \begin{macro}{\@@_grab_v_bgroup_loop:} +% \begin{macro}{\@@_grab_v_bgroup_loop_ii:N} +% \begin{variable}{\l_@@_v_nesting_int} % If the opening delimiter is a left brace, we keep track of % how many left and right braces were encountered so far in -% \cs{l_xparse_v_nesting_int} (the methods used for optional +% \cs{l_@@_v_nesting_int} (the methods used for optional % arguments cannot apply here), and stop as soon as it reaches~$0$. % % Some care was needed when removing the opening delimiter, which % has already been assigned category code~$1$: using -% \cs{peek_meaning_remove:NTF} in the \cs{xparse_grab_v_aux:w} +% \cs{peek_meaning_remove:NTF} in the \cs{@@_grab_v_aux:w} % function would break within alignments. Instead, we first % convert that token to a string, and remove the result as a % normal undelimited argument. % \begin{macrocode} -\int_new:N \l_xparse_v_nesting_int -\cs_new_protected_nopar:Npx \xparse_grab_v_bgroup: +\int_new:N \l_@@_v_nesting_int +\cs_new_protected_nopar:Npx \@@_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 \@@_grab_v_aux_catcodes: + \exp_not:n { \int_set_eq:NN \l_@@_v_nesting_int \c_one } + \exp_not:N \@@_grab_v_aux_put:N \iow_char:N \{ + \exp_not:N \@@_grab_v_bgroup_loop: } -\cs_new_protected:Npn \xparse_grab_v_bgroup_loop: +\cs_new_protected:Npn \@@_grab_v_bgroup_loop: { \peek_N_type:TF - { \xparse_grab_v_bgroup_loop_ii:N } - { \xparse_grab_v_aux_abort: } + { \@@_grab_v_bgroup_loop_ii:N } + { \@@_grab_v_aux_abort: } } -\cs_new_protected:Npn \xparse_grab_v_bgroup_loop_ii:N #1 +\cs_new_protected:Npn \@@_grab_v_bgroup_loop_ii:N #1 { - \xparse_grab_v_token_if_char:NTF #1 + \@@_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_@@_v_nesting_int + \int_compare:nNnTF \l_@@_v_nesting_int > \c_zero { - \xparse_grab_v_aux_put:N #1 - \xparse_grab_v_bgroup_loop: + \@@_grab_v_aux_put:N #1 + \@@_grab_v_bgroup_loop: } - { \xparse_grab_v_aux_loop_end: } + { \@@_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_@@_v_nesting_int } + \@@_grab_v_aux_put:N #1 + \@@_grab_v_bgroup_loop: } } - { \xparse_grab_v_aux_abort: #1 } + { \@@_grab_v_aux_abort: #1 } } % \end{macrocode} % \end{variable} @@ -2437,22 +2483,22 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_grab_v_aux_catcodes:} -% \begin{macro}{\xparse_grab_v_aux_abort:} -% \begin{macro}{\xparse_grab_v_aux_abort_ii:w} +% \begin{macro}{\@@_grab_v_aux_catcodes:} +% \begin{macro}{\@@_grab_v_aux_abort:} +% \begin{macro}{\@@_grab_v_aux_abort_ii:w} % In a standalone format, the list of special characters is kept -% as a sequence, \cs{c_xparse_special_chars_seq}, and we use +% as a sequence, \cs{c_@@_special_chars_seq}, and we use % \tn{dospecials} in package mode. % The approach for short verbatim arguments is to make the end-line % character a macro parameter character: this is forbidden by the % rest of the code. Then the error branch can check what caused the % bail out and give the appropriate error message. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xparse_grab_v_aux_catcodes: +\cs_new_protected_nopar:Npn \@@_grab_v_aux_catcodes: { %<*initex> \seq_map_function:NN - \c_xparse_special_chars_seq + \c_@@_special_chars_seq \char_set_catcode_other:N %</initex> %<*package> @@ -2460,33 +2506,33 @@ \dospecials %</package> \tex_endlinechar:D = `\^^M \scan_stop: - \bool_if:NTF \l_xparse_long_bool + \bool_if:NTF \l_@@_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 \@@_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 + \@@_grab_v_group_end: + \@@_add_arg:o \c_@@_no_value_tl + \exp_after:wN \@@_grab_v_aux_abort_ii:w \l_@@_args_tl \q_stop } -\cs_new_protected:Npn \xparse_grab_v_aux_abort_ii:w #1 #2 \q_stop +\cs_new_protected:Npn \@@_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_@@_v_arg_tl } + \l_@@_v_rest_of_signature_tl \l_@@_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_@@_v_arg_tl } + \l_@@_v_rest_of_signature_tl \l_@@_args_tl } } % \end{macrocode} @@ -2494,14 +2540,14 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_grab_v_aux_put:N} +% \begin{macro}{\@@_grab_v_aux_put:N} % Storing one token in the collected argument. Most tokens are % converted to category code $12$, with the exception of active % characters, and spaces (not sure what should be done for those). % \begin{macrocode} -\cs_new_protected:Npn \xparse_grab_v_aux_put:N #1 +\cs_new_protected:Npn \@@_grab_v_aux_put:N #1 { - \tl_put_right:Nx \l_xparse_v_arg_tl + \tl_put_right:Nx \l_@@_v_arg_tl { \token_if_active:NTF #1 { \exp_not:N #1 } { \token_to_str:N #1 } @@ -2510,7 +2556,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_grab_v_token_if_char:NTF} +% \begin{macro}{\@@_grab_v_token_if_char:NTF} % This function assumes that the escape character is printable. % Then the string representation of control sequences is at least % two characters, and \cs{str_tail:n} only removes the escape @@ -2518,13 +2564,13 @@ % \cs{tl_to_str:n}, and will also yield a non-empty result, % hence are not considered as characters. % \begin{macrocode} -\cs_new_protected:Npn \xparse_grab_v_token_if_char:NTF #1 - { \str_if_eq:xxTF { } { \str_tail:n {#1} } } +\cs_new_protected:Npn \@@_grab_v_token_if_char:NTF #1 + { \str_if_eq_x:nnTF { } { \str_tail:n {#1} } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_add_arg:n, \xparse_add_arg:V, \xparse_add_arg:o} -% \begin{macro}[aux]{\xparse_add_arg_aux:n, \xparse_add_arg_aux:V} +% \begin{macro}{\@@_add_arg:n, \@@_add_arg:V, \@@_add_arg:o} +% \begin{macro}[aux]{\@@_add_arg_aux:n, \@@_add_arg_aux:V} % The argument-storing system provides a single point for interfacing % with processors. They are done in a loop, counting downward. In this % way, the processor which was found last is executed first. The result @@ -2533,50 +2579,50 @@ % the internal function will correctly pick up one argument for each % input argument. % \begin{macrocode} -\cs_new_protected:Npn \xparse_add_arg:n #1 +\cs_new_protected:Npn \@@_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_@@_processor_int = \c_zero + { \tl_put_right:Nn \l_@@_args_tl { {#1} } } { \tl_clear:N \ProcessedArgument - \xparse_if_no_value:nTF {#1} + \@@_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_@@_processor_int + \tl_put_right:Nn \l_@@_args_tl { {#1} } } - { \xparse_add_arg_aux:n {#1} } + { \@@_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 \@@_add_arg:n { V , o } +\cs_new_protected:Npn \@@_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 { @@_processor_ \int_use:N \l_@@_processor_int :n } {#1} + \int_decr:N \l_@@_processor_int + \int_compare:nNnTF \l_@@_processor_int = \c_zero { - \tl_put_right:Nx \l_xparse_args_tl + \tl_put_right:Nx \l_@@_args_tl { { \exp_not:V \ProcessedArgument } } } - { \xparse_add_arg_aux:V \ProcessedArgument } + { \@@_add_arg_aux:V \ProcessedArgument } } -\cs_generate_variant:Nn \xparse_add_arg_aux:n { V } +\cs_generate_variant:Nn \@@_add_arg_aux:n { V } % \end{macrocode} % \end{macro} % \end{macro} % % \subsection{Grabbing arguments expandably} % -% \begin{macro}[EXP]{\xparse_expandable_grab_D:w} -% \begin{macro}[EXP, aux]{\xparse_expandable_grab_D_i:NNNnwN} -% \begin{macro}[EXP, aux]{\xparse_expandable_grab_D_ii:NNNwNnnn} -% \begin{macro}[EXP, aux]{\xparse_expandable_grab_D_iii:Nw} -% \begin{macro}[EXP, aux]{\xparse_expandable_grab_D_iv:nnNNNwN} +% \begin{macro}[EXP]{\@@_expandable_grab_D:w} +% \begin{macro}[EXP, aux]{\@@_expandable_grab_D_i:NNNnwN} +% \begin{macro}[EXP, aux]{\@@_expandable_grab_D_ii:NNNwNnnn} +% \begin{macro}[EXP, aux]{\@@_expandable_grab_D_iii:Nw} +% \begin{macro}[EXP, aux]{\@@_expandable_grab_D_iv:nnNNNwN} % The first step is to grab the first token or group. The generic grabber -% \cs{\meta{function}}\verb*| | is just after \cs{q_xparse}, we go and find +% \cs{\meta{function}}\verb*| | is just after \cs{q_@@}, we go and find % it. % \begin{macrocode} -\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 \@@_expandable_grab_D:w #1 \q_@@ #2 + { #2 { \@@_expandable_grab_D_i:NNNnwNn #1 \q_@@ #2 } } % \end{macrocode} % We then wish to test whether |#7|, which we just grabbed, is exactly |#2|. % Expand the only grabber function we have, |#1|, once: the two strings below @@ -2587,7 +2633,7 @@ % everything as its arguments. The first brace group can only be empty if % \texttt{\#7} starts with \texttt{\#2}, otherwise the brace group preceding % \texttt{\#7} would not vanish. The third brace group is empty, thus the -% \cs{q_xparse} that was used by our grabber \texttt{\#1} must be the one +% \cs{q_@@} that was used by our grabber \texttt{\#1} must be the one % that we inserted (not some token in \texttt{\#7}), hence the second brace % group contains the end of \texttt{\#7} followed by \texttt{\#2}. Since this % is \texttt{\#2} on the right-hand-side, and no brace can be lost there, @@ -2600,11 +2646,11 @@ % argument piece by piece, with the following pattern: % \begin{quote} % \meta{grabber} \Arg{tokens} \\ -% ~~\cs{q_nil} \Arg{piece 1} \meta{piece 2} \cs{ERROR} \cs{q_xparse}\\ +% ~~\cs{q_nil} \Arg{piece 1} \meta{piece 2} \cs{ERROR} \cs{q_@@}\\ % ~~\cs{q_nil} \meta{input stream} % \end{quote} % The \meta{grabber} will find an opening delimiter in \meta{piece 2}, take -% the \cs{q_xparse} as a second delimiter, and find more material delimited +% the \cs{q_@@} as a second delimiter, and find more material delimited % by the closing delimiter in the \meta{input stream}. We then move the part % before the opening delimiter from \meta{piece 2} to \meta{piece 1}, and the % material taken from the \meta{input stream} to the \meta{piece 2}. Thus, @@ -2617,17 +2663,17 @@ % no opening delimiter any more, hence the balance is reached, and the final % argument is \meta{piece 1} \meta{piece 2}. % \begin{macrocode} -\cs_new:Npn \xparse_expandable_grab_D_i:NNNnwNn #1#2#3#4#5 \q_xparse #6#7 +\cs_new:Npn \@@_expandable_grab_D_i:NNNnwNn #1#2#3#4#5 \q_@@ #6#7 { \str_if_eq:onTF - { #1 { } { } #7 #2 \q_xparse #3 } + { #1 { } { } #7 #2 \q_@@ #3 } { { } { #2 } { } } { #1 - { \xparse_expandable_grab_D_ii:NNNwNnnn #1#2#3#5 \q_xparse #6 } - \q_nil { } #2 \ERROR \q_xparse \ERROR + { \@@_expandable_grab_D_ii:NNNwNnnn #1#2#3#5 \q_@@ #6 } + \q_nil { } #2 \ERROR \q_@@ \ERROR } - { #5 {#4} \q_xparse #6 {#7} } + { #5 {#4} \q_@@ #6 {#7} } } % \end{macrocode} % At this stage, |#6| is \cs{q_nil} \Arg{piece 1} \meta{more for piece 1}, @@ -2637,14 +2683,14 @@ % for piece 2}. We concatenate those, replacing the two \cs{ERROR} by the % closing delimiter |#3|. % \begin{macrocode} -\cs_new:Npn \xparse_expandable_grab_D_ii:NNNwNnnn #1#2#3#4 \q_xparse #5#6#7#8 +\cs_new:Npn \@@_expandable_grab_D_ii:NNNwNnnn #1#2#3#4 \q_@@ #5#6#7#8 { - \exp_args:Nof \xparse_expandable_grab_D_iv:nnNNNwN + \exp_args:Nof \@@_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 + { \@@_expandable_grab_D_iii:Nw #3 \exp_stop_f: #7 #8 } + #1#2#3 #4 \q_@@ #5 } -\cs_new:Npn \xparse_expandable_grab_D_iii:Nw #1#2 \ERROR \ERROR { #2 #1 } +\cs_new:Npn \@@_expandable_grab_D_iii:Nw #1#2 \ERROR \ERROR { #2 #1 } % \end{macrocode} % Armed with our two new \meta{pieces}, we are ready to loop. However, we % must first see if \meta{piece 2} (here |#2|) contains any opening @@ -2654,20 +2700,20 @@ % delimiter. In that case, we are done, and put the argument (from which we % remove a spurious pair of delimiters coming from how we started the loop). % Otherwise, we go back to looping with -% \cs{xparse_expandable_grab_D_ii:NNNwNnnn}. +% \cs{@@_expandable_grab_D_ii:NNNwNnnn}. % \begin{macrocode} -\cs_new:Npn \xparse_expandable_grab_D_iv:nnNNNwN #1#2#3#4#5#6 \q_xparse #7 +\cs_new:Npn \@@_expandable_grab_D_iv:nnNNNwN #1#2#3#4#5#6 \q_@@ #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_@@ #5 #4 \q_@@ #5 } { - \xparse_put_arg_expandable:ow { \use_none:nn #1#2 } - #6 \q_xparse #7 + \@@_put_arg_expandable:ow { \use_none:nn #1#2 } + #6 \q_@@ #7 } { #3 - { \xparse_expandable_grab_D_ii:NNNwNnnn #3#4#5#6 \q_xparse #7 } - \q_nil {#1} #2 \ERROR \q_xparse \ERROR + { \@@_expandable_grab_D_ii:NNNwNnnn #3#4#5#6 \q_@@ #7 } + \q_nil {#1} #2 \ERROR \q_@@ \ERROR } } % \end{macrocode} @@ -2677,163 +2723,163 @@ % \end{macro} % \end{macro} % -% \begin{macro}[EXP]{\xparse_expandable_grab_D_alt:w} -% \begin{macro}[EXP]{\xparse_expandable_grab_D_alt_i:NNnwNn} -% \begin{macro}[EXP]{\xparse_expandable_grab_D_alt_ii:Nw} +% \begin{macro}[EXP]{\@@_expandable_grab_D_alt:w} +% \begin{macro}[EXP]{\@@_expandable_grab_D_alt_i:NNnwNn} +% \begin{macro}[EXP]{\@@_expandable_grab_D_alt_ii:Nw} % When the delimiters are identical, nesting is not possble and a simplified % approach is used. The test concept here is the same as for the case where % the delimiters are different. % \begin{macrocode} -\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 \@@_expandable_grab_D_alt:w #1 \q_@@ #2 + { #2 { \@@_expandable_grab_D_alt_i:NNnwNn #1 \q_@@ #2 } } +\cs_new:Npn \@@_expandable_grab_D_alt_i:NNnwNn #1#2#3#4 \q_@@ #5#6 { \str_if_eq:onTF { #1 { } #6 #2 #2 } { { } #2 } { #1 - { \xparse_expandable_grab_D_alt_ii:Nwn #5 #4 \q_xparse } + { \@@_expandable_grab_D_alt_ii:Nwn #5 #4 \q_@@ } #6 \ERROR } - { #4 {#3} \q_xparse #5 {#6} } + { #4 {#3} \q_@@ #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 \@@_expandable_grab_D_alt_ii:Nwn #1#2 \q_@@ #3 + { \@@_put_arg_expandable:ow { \use_none:n #3 } #2 \q_@@ #1 } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}[EXP]{\xparse_expandable_grab_m:w} -% \begin{macro}[EXP, aux]{\xparse_expandable_grab_m_aux:wNn} -% The mandatory case is easy: find the auxiliary after the \cs{q_xparse}, and +% \begin{macro}[EXP]{\@@_expandable_grab_m:w} +% \begin{macro}[EXP, aux]{\@@_expandable_grab_m_aux:wNn} +% The mandatory case is easy: find the auxiliary after the \cs{q_@@}, and % use it directly to grab the argument. % \begin{macrocode} -\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 \@@_expandable_grab_m:w #1 \q_@@ #2 + { #2 { \@@_expandable_grab_m_aux:wNn #1 \q_@@ #2 } } +\cs_new:Npn \@@_expandable_grab_m_aux:wNn #1 \q_@@ #2#3 + { #1 {#3} \q_@@ #2 } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[EXP]{\xparse_expandable_grab_R:w} -% \begin{macro}[EXP, aux]{\xparse_expandable_grab_R_aux:NNwn} +% \begin{macro}[EXP]{\@@_expandable_grab_R:w} +% \begin{macro}[EXP, aux]{\@@_expandable_grab_R_aux:NNwn} % Much the same as for the \texttt{D}-type argument, with only the lead-off % function varying. % \begin{macrocode} -\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 \@@_expandable_grab_R:w #1 \q_@@ #2 + { #2 { \@@_expandable_grab_R_aux:NNNnwNn #1 \q_@@ #2 } } +\cs_new:Npn \@@_expandable_grab_R_aux:NNNnwNn #1#2#3#4#5 \q_@@ #6#7 { \str_if_eq:onTF - { #1 { } { } #7 #2 \q_xparse #3 } + { #1 { } { } #7 #2 \q_@@ #3 } { { } { #2 } { } } { #1 - { \xparse_expandable_grab_D_ii:NNNwNnnn #1#2#3#5 \q_xparse #6 } - \q_nil { } #2 \ERROR \q_xparse \ERROR + { \@@_expandable_grab_D_ii:NNNwNnnn #1#2#3#5 \q_@@ #6 } + \q_nil { } #2 \ERROR \q_@@ \ERROR } { - \msg_expandable_kernel_error:nnn + \__msg_kernel_expandable_error:nnn { xparse } { missing-required } {#2} - #5 {#4} \q_xparse #6 {#7} + #5 {#4} \q_@@ #6 {#7} } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[EXP]{\xparse_expandable_grab_R_alt:w} -% \begin{macro}[EXP]{\xparse_expandable_grab_R_alt_aux:NNnwNn} +% \begin{macro}[EXP]{\@@_expandable_grab_R_alt:w} +% \begin{macro}[EXP]{\@@_expandable_grab_R_alt_aux:NNnwNn} % When the delimiters are identical, nesting is not possble and a simplified % approach is used. The test concept here is the same as for the case where % the delimiters are different. % \begin{macrocode} -\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 \@@_expandable_grab_R_alt:w #1 \q_@@ #2 + { #2 { \@@_expandable_grab_R_alt_aux:NNnwNn #1 \q_@@ #2 } } +\cs_new:Npn \@@_expandable_grab_R_alt_aux:NNnwNn #1#2#3#4 \q_@@ #5#6 { \str_if_eq:onTF { #1 { } #6 #2 #2 } { { } #2 } { #1 - { \xparse_expandable_grab_D_alt_ii:Nwn #5 #4 \q_xparse } + { \@@_expandable_grab_D_alt_ii:Nwn #5 #4 \q_@@ } #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_@@ #5 {#6} } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[EXP]{\xparse_expandable_grab_t:w} -% \begin{macro}[EXP, aux]{\xparse_expandable_grab_t_aux:NNwn} +% \begin{macro}[EXP]{\@@_expandable_grab_t:w} +% \begin{macro}[EXP, aux]{\@@_expandable_grab_t_aux:NNwn} % As for a \texttt{D}-type argument, here we compare the grabbed tokens using % the only parser we have in order to work out if |#2| is exactly equal to % the output of the grabber. % \begin{macrocode} -\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 \@@_expandable_grab_t:w #1 \q_@@ #2 + { #2 { \@@_expandable_grab_t_aux:NNwn #1 \q_@@ #2 } } +\cs_new:Npn \@@_expandable_grab_t_aux:NNwn #1#2#3 \q_@@ #4#5 { \str_if_eq:onTF { #1 { } #5 #2 } { #2 } - { #3 { \BooleanTrue } \q_xparse #4 } - { #3 { \BooleanFalse } \q_xparse #4 {#5} } + { #3 { \BooleanTrue } \q_@@ #4 } + { #3 { \BooleanFalse } \q_@@ #4 {#5} } } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}[EXP] -% {\xparse_put_arg_expandable:nw, \xparse_put_arg_expandable:ow} +% {\@@_put_arg_expandable:nw, \@@_put_arg_expandable:ow} % A useful helper, to store arguments when they are ready. % \begin{macrocode} -\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 \@@_put_arg_expandable:nw #1#2 \q_@@ { #2 {#1} \q_@@ } +\cs_generate_variant:Nn \@@_put_arg_expandable:nw { o } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\xparse_grab_expandable_end:wN} +% \begin{macro}[EXP]{\@@_grab_expandable_end:wN} % For the end of the grabbing sequence: get rid of the generic grabber and % insert the code function followed by its arguments. % \begin{macrocode} -\cs_new:Npn \xparse_grab_expandable_end:wN #1 \q_xparse #2 {#1} +\cs_new:Npn \@@_grab_expandable_end:wN #1 \q_@@ #2 {#1} % \end{macrocode} % \end{macro} % % \subsection{Argument processors} % -% \begin{macro}{\xparse_process_arg:n} +% \begin{macro}{\@@_process_arg:n} % Processors are saved for use later during the grabbing process. % \begin{macrocode} -\cs_new_protected:Npn \xparse_process_arg:n #1 +\cs_new_protected:Npn \@@_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_@@_processor_int + \cs_set:cpn { @@_processor_ \int_use:N \l_@@_processor_int :n } ##1 { #1 {##1} } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_process_to_str:n} +% \begin{macro}{\@@_process_to_str:n} % A basic argument processor: as much an example as anything else. % \begin{macrocode} -\cs_new_protected:Npn \xparse_process_to_str:n #1 +\cs_new_protected:Npn \@@_process_to_str:n #1 { \tl_set:Nx \ProcessedArgument { \tl_to_str:n {#1} } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xparse_bool_reverse:N} +% \begin{macro}{\@@_bool_reverse:N} % A simple reversal. % \begin{macrocode} -\cs_new_protected:Npn \xparse_bool_reverse:N #1 +\cs_new_protected:Npn \@@_bool_reverse:N #1 { \bool_if:NTF #1 { \tl_set:Nn \ProcessedArgument { \c_false_bool } } @@ -2842,47 +2888,47 @@ % \end{macrocode} % \end{macro} % -% \begin{variable}{\l_xparse_split_list_seq, \l_xparse_split_list_tl} -% \begin{macro}{\xparse_split_list:nn} -% \begin{macro}[aux]{\xparse_split_list_multi:nn, \xparse_split_list_multi:nV} -% \begin{macro}[aux]{\xparse_split_list_single:Nn} +% \begin{variable}{\l_@@_split_list_seq, \l_@@_split_list_tl} +% \begin{macro}{\@@_split_list:nn} +% \begin{macro}[aux]{\@@_split_list_multi:nn, \@@_split_list_multi:nV} +% \begin{macro}[aux]{\@@_split_list_single:Nn} % Splitting can take place either at a single token or at a longer % identifier. To deal with single active tokens, a two-part procedure is % needed. % \begin{macrocode} -\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_@@_split_list_seq +\tl_new:N \l_@@_split_list_tl +\cs_new_protected:Npn \@@_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} } + { \@@_split_list_single:Nn #1 {#2} } + { \@@_split_list_multi:nn {#1} {#2} } } -\cs_set_protected:Npn \xparse_split_list_multi:nn #1#2 +\cs_set_protected:Npn \@@_split_list_multi:nn #1#2 { - \seq_set_split:Nnn \l_xparse_split_list_seq {#1} {#2} + \seq_set_split:Nnn \l_@@_split_list_seq {#1} {#2} \tl_clear:N \ProcessedArgument - \seq_map_inline:Nn \l_xparse_split_list_seq + \seq_map_inline:Nn \l_@@_split_list_seq { \tl_put_right:Nn \ProcessedArgument { {##1} } } } -\cs_generate_variant:Nn \xparse_split_list_multi:nn { nV } +\cs_generate_variant:Nn \@@_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 \@@_split_list_single:Nn #1#2 { - \tl_set:Nn \l_xparse_split_list_tl {#2} + \tl_set:Nn \l_@@_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_@@_split_list_tl { @ } {#1} } - \xparse_split_list_multi:nV {#1} \l_xparse_split_list_tl + \@@_split_list_multi:nV {#1} \l_@@_split_list_tl } \group_end: % \end{macrocode} @@ -2891,23 +2937,23 @@ % \end{macro} % \end{variable} % -% \begin{macro}{\xparse_split_argument:nnn} -% \begin{macro}[aux]{\xparse_split_argument_aux:nnnn} -% \begin{macro}[aux, EXP]{\xparse_split_argument_aux:n} -% \begin{macro}[aux, EXP]{\xparse_split_argument_aux:wn} +% \begin{macro}{\@@_split_argument:nnn} +% \begin{macro}[aux]{\@@_split_argument_aux:nnnn} +% \begin{macro}[aux, EXP]{\@@_split_argument_aux:n} +% \begin{macro}[aux, EXP]{\@@_split_argument_aux:wn} % Splitting to a known number of items is a special version of splitting % a list, in which the limit is hard-coded and where there will always be % exactly the correct number of output items. An auxiliary function is % used to save on working out the token list length several times. % \begin{macrocode} -\cs_new_protected:Npn \xparse_split_argument:nnn #1#2#3 +\cs_new_protected:Npn \@@_split_argument:nnn #1#2#3 { - \xparse_split_list:nn {#2} {#3} - \exp_args:Nf \xparse_split_argument_aux:nnnn - { \tl_length:N \ProcessedArgument } + \@@_split_list:nn {#2} {#3} + \exp_args:Nf \@@_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 \@@_split_argument_aux:nnnn #1#2#3#4 { \int_compare:nNnF {#1} = { #2 + \c_one } { @@ -2916,13 +2962,13 @@ \tl_set:Nx \ProcessedArgument { \exp_last_unbraced:NnNo - \xparse_split_argument_aux:n + \@@_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} } } @@ -2930,7 +2976,7 @@ \tl_put_right:Nx \ProcessedArgument { \prg_replicate:nn { #2 + \c_one - (#1) } - { { \exp_not:n { \NoValue } } } + { { \exp_not:V \c_@@_no_value_tl } } } } } @@ -2939,9 +2985,9 @@ % Auxiliaries to leave exactly the correct number of arguments in % \cs{ProcessedArgument}. % \begin{macrocode} -\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 \@@_split_argument_aux:n #1 + { \prg_replicate:nn {#1} { \@@_split_argument_aux:wn } } +\cs_new:Npn \@@_split_argument_aux:wn #1 \use_none_delimit_by_q_stop:w #2 { \exp_not:n { {#2} } #1 @@ -2953,37 +2999,37 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_trim_spaces:n} +% \begin{macro}{\@@_trim_spaces:n} % This one is almost trivial. % \begin{macrocode} -\cs_new_protected:Npn \xparse_trim_spaces:n #1 +\cs_new_protected:Npn \@@_trim_spaces:n #1 { \tl_set:Nx \ProcessedArgument { \tl_trim_spaces:n {#1} } } % \end{macrocode} % \end{macro} % % \subsection{Access to the argument specification} % -% \begin{macro}{\xparse_get_arg_spec:N} -% \begin{macro}{\xparse_get_arg_spec:n} +% \begin{macro}{\@@_get_arg_spec:N} +% \begin{macro}{\@@_get_arg_spec:n} % \begin{macro}{\ArgumentSpecification} % Recovering the argument specification is also trivial, using the % \cs{tl_set_eq:cN} function. % \begin{macrocode} -\cs_new_protected:Npn \xparse_get_arg_spec:N #1 +\cs_new_protected:Npn \@@_get_arg_spec:N #1 { - \prop_get:NnNF \l_xparse_command_arg_specs_prop {#1} + \prop_get:NnNF \l_@@_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 \@@_get_arg_spec:n #1 { - \prop_get:NnNF \l_xparse_environment_arg_specs_prop {#1} + \prop_get:NnNF \l_@@_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} } } } @@ -2993,28 +3039,28 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xparse_show_arg_spec:N} -% \begin{macro}{\xparse_show_arg_spec:n} +% \begin{macro}{\@@_show_arg_spec:N} +% \begin{macro}{\@@_show_arg_spec:n} % Showing the argument specification simply means finding it and then % calling the \cs{tl_show:N} function. % \begin{macrocode} -\cs_new_protected:Npn \xparse_show_arg_spec:N #1 +\cs_new_protected:Npn \@@_show_arg_spec:N #1 { - \prop_get:NnNTF \l_xparse_command_arg_specs_prop {#1} + \prop_get:NnNTF \l_@@_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 \@@_show_arg_spec:n #1 { - \prop_get:NnNTF \l_xparse_environment_arg_specs_prop {#1} + \prop_get:NnNTF \l_@@_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} } } } @@ -3024,11 +3070,30 @@ % % \subsection{Utilities} % -% \begin{macro}[TF]{\xparse_if_no_value:n} -% Tests for \cs{NoValue}. +% \begin{macro}[TF]{\@@_if_no_value:n} +% Tests for |-NoValue-|: this is similar to \cs{tl_if_in:nn} but set +% up to be expandable. The question mark prevents the auxiliary from +% losing braces. % \begin{macrocode} -\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: } +\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 \@@_if_no_value:n #1 { T , F , TF } + { + \str_if_eq:onTF + { \@@_if_value_aux:w ? #1 { } QNoValue- } + { ? { } QNoValue- } + { \prg_return_true: } + { \prg_return_false: } + } + \cs_new:Npn \@@_if_value_aux:w #1 QNoValue- { #1 } + } % \end{macrocode} % \end{macro} % @@ -3038,7 +3103,7 @@ % % Some messages intended as errors. % \begin{macrocode} -\msg_kernel_new:nnnn { xparse } { bad-arg-spec } +\__msg_kernel_new:nnnn { xparse } { bad-arg-spec } { Bad~argument~specification~'#1'. } { \c_msg_coding_error_text_tl @@ -3046,48 +3111,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 @@ -3095,14 +3160,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 @@ -3111,14 +3176,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 @@ -3126,40 +3191,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~ @@ -3168,7 +3233,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~ @@ -3180,22 +3245,22 @@ % % Intended more for information. % \begin{macrocode} -\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:. @@ -3224,27 +3289,27 @@ % The user macros are pretty simple wrappers around the internal ones. % \begin{macrocode} \cs_new_protected:Npn \DeclareDocumentCommand #1#2#3 - { \xparse_declare_cmd:Nnn #1 {#2} {#3} } + { \@@_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} } + { \@@_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} } + { \@@_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 { \@@_declare_cmd:Nnn #1 {#2} {#3} } } % \end{macrocode} % \end{macro} % \end{macro} @@ -3258,21 +3323,21 @@ % Very similar for environments. % \begin{macrocode} \cs_new_protected:Npn \DeclareDocumentEnvironment #1#2#3#4 - { \xparse_declare_env:nnnn {#1} {#2} {#3} {#4} } + { \@@_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} } + { \@@_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} } + { \@@_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 } { \@@_declare_env:nnnn {#1} {#2} {#3} {#4} } } % \end{macrocode} % \end{macro} % \end{macro} @@ -3283,7 +3348,7 @@ % The expandable version of the basic function is essentially the same. % \begin{macrocode} \cs_new_protected:Npn \DeclareExpandableDocumentCommand #1#2#3 - { \xparse_declare_expandable_cmd:Nnn #1 {#2} {#3} } + { \@@_declare_expandable_cmd:Nnn #1 {#2} {#3} } % \end{macrocode} % \end{macro} % @@ -3301,29 +3366,20 @@ % \begin{macro}[TF]{\IfNoValue} % Simple re-naming. % \begin{macrocode} -\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_new_eq:NN \IfNoValueF \@@_if_no_value:nF +\cs_new_eq:NN \IfNoValueT \@@_if_no_value:nT +\cs_new_eq:NN \IfNoValueTF \@@_if_no_value:nTF % \end{macrocode} % \end{macro} % \begin{macro}[TF]{\IfValue} % Inverted logic. % \begin{macrocode} -\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_set:Npn \IfValueF { \@@_if_no_value:nT } +\cs_set:Npn \IfValueT { \@@_if_no_value:nF } +\cs_set:Npn \IfValueTF #1#2#3 { \@@_if_no_value:nTF {#1} {#3} {#2} } % \end{macrocode} % \end{macro} % -% \begin{variable}{\NoValue} -% The marker for no value being give: this can be typeset safely. -% This is coded by hand as making it \cs{protected} ensures that it -% will not turn into anything else by accident. -% \begin{macrocode} -\cs_new_protected:Npn \NoValue { -NoValue- } -% \end{macrocode} -% \end{variable} -% % \begin{macro}{\ProcessedArgument} % Processed arguments are returned using this name, which is reserved % here although the definition will change. @@ -3335,10 +3391,10 @@ % \begin{macro}{\ReverseBoolean, \SplitArgument, \SplitList, \TrimSpaces} % Simple copies. % \begin{macrocode} -\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 \@@_bool_reverse:N +\cs_new_eq:NN \SplitArgument \@@_split_argument:nnn +\cs_new_eq:NN \SplitList \@@_split_list:nn +\cs_new_eq:NN \TrimSpaces \@@_trim_spaces:n % \end{macrocode} % \end{macro} % @@ -3355,10 +3411,10 @@ % \begin{macro}{\ShowDocumentEnvironmentArgSpec} % More simple mappings. % \begin{macrocode} -\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 \@@_get_arg_spec:N +\cs_new_eq:NN \GetDocumentEnvironmmentArgSpec \@@_get_arg_spec:n +\cs_new_eq:NN \ShowDocumentCommandArgSpec \@@_show_arg_spec:N +\cs_new_eq:NN \ShowDocumentEnvironmentArgSpec \@@_show_arg_spec:n % \end{macrocode} % \end{macro} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.ins b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.ins index 995ddbb8ff0..bec43149679 100644 --- a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.ins +++ b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.ins @@ -1,6 +1,6 @@ \iffalse meta-comment -File xparse.ins Copyright (C) 2000-2011 The LaTeX3 Project +File xparse.ins Copyright (C) 2000-2012 The LaTeX3 Project It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this @@ -16,7 +16,7 @@ The released version of this bundle is available from CTAN. \fi -\input docstrip.tex +\input l3docstrip.tex \askforoverwritefalse \preamble diff --git a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx index c8131b218c1..790c5667742 100644 --- a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx @@ -41,19 +41,19 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2012/04/23] -%<package>\@ifpackagelater{expl3}{2012/04/23} +\RequirePackage{expl3}[2012/07/16] +%<package>\@ifpackagelater{expl3}{2012/07/16} %<package> {} -%<package> { +%<package> {% %<package> \PackageError{xtemplate}{Support package l3kernel too old.} -%<package> { +%<package> {% %<package> Please install an up to date version of l3kernel %<package> using your TeX package manager or from CTAN.\\ \\ -%<package> Loading xtemplate will abort! -%<package> } +%<package> Loading xtemplate will abort!% +%<package> }% %<package> \endinput %<package> } -\GetIdInfo$Id: xtemplate.dtx 3570 2012-04-23 13:24:55Z joseph $ +\GetIdInfo$Id: xtemplate.dtx 3990 2012-07-16 07:46:03Z joseph $ {L3 Experimental prototype document functions} %</driver|package> %<*driver> @@ -666,6 +666,10 @@ % \begin{macrocode} %<*package> % \end{macrocode} +% +% \begin{macrocode} +%<@@=xtemplate> +% \end{macrocode} % % \begin{macrocode} \ProvidesExplPackage @@ -674,24 +678,24 @@ % % \subsection{Variables and constants} % -% \begin{variable}{\c_xtemplate_code_root_tl} -% \begin{variable}{\c_xtemplate_defaults_root_tl} -% \begin{variable}{\c_xtemplate_instances_root_tl} -% \begin{variable}{\c_xtemplate_keytypes_root_tl} -% \begin{variable}{\c_xtemplate_key_order_root_tl} -% \begin{variable}{\c_xtemplate_restrict_root_tl} -% \begin{variable}{\c_xtemplate_values_root_tl} -% \begin{variable}{\c_xtemplate_vars_root_tl} +% \begin{variable}{\c_@@_code_root_tl} +% \begin{variable}{\c_@@_defaults_root_tl} +% \begin{variable}{\c_@@_instances_root_tl} +% \begin{variable}{\c_@@_keytypes_root_tl} +% \begin{variable}{\c_@@_key_order_root_tl} +% \begin{variable}{\c_@@_restrict_root_tl} +% \begin{variable}{\c_@@_values_root_tl} +% \begin{variable}{\c_@@_vars_root_tl} % So that literal values are kept to a minimum. % \begin{macrocode} -\tl_const:Nn \c_xtemplate_code_root_tl { template~code~>~ } -\tl_const:Nn \c_xtemplate_defaults_root_tl { template~defaults~>~ } -\tl_const:Nn \c_xtemplate_instances_root_tl { template~instance~>~ } -\tl_const:Nn \c_xtemplate_keytypes_root_tl { template~key~types~>~ } -\tl_const:Nn \c_xtemplate_key_order_root_tl { template~key~order~>~ } -\tl_const:Nn \c_xtemplate_restrict_root_tl { template~restrictions~>~ } -\tl_const:Nn \c_xtemplate_values_root_tl { template~values~>~ } -\tl_const:Nn \c_xtemplate_vars_root_tl { template~vars~>~ } +\tl_const:Nn \c_@@_code_root_tl { template~code~>~ } +\tl_const:Nn \c_@@_defaults_root_tl { template~defaults~>~ } +\tl_const:Nn \c_@@_instances_root_tl { template~instance~>~ } +\tl_const:Nn \c_@@_keytypes_root_tl { template~key~types~>~ } +\tl_const:Nn \c_@@_key_order_root_tl { template~key~order~>~ } +\tl_const:Nn \c_@@_restrict_root_tl { template~restrictions~>~ } +\tl_const:Nn \c_@@_values_root_tl { template~values~>~ } +\tl_const:Nn \c_@@_vars_root_tl { template~vars~>~ } % \end{macrocode} % \end{variable} % \end{variable} @@ -702,96 +706,96 @@ % \end{variable} % \end{variable} % -% \begin{variable}{\c_xtemplate_keytypes_arg_seq} +% \begin{variable}{\c_@@_keytypes_arg_seq} % A list of keytypes which also need additional data (an argument), used % to parse the keytype correctly. % \begin{macrocode} -\seq_new:N \c_xtemplate_keytypes_arg_seq -\seq_put_right:Nn \c_xtemplate_keytypes_arg_seq { choice } -\seq_put_right:Nn \c_xtemplate_keytypes_arg_seq { function } -\seq_put_right:Nn \c_xtemplate_keytypes_arg_seq { instance } +\seq_new:N \c_@@_keytypes_arg_seq +\seq_put_right:Nn \c_@@_keytypes_arg_seq { choice } +\seq_put_right:Nn \c_@@_keytypes_arg_seq { function } +\seq_put_right:Nn \c_@@_keytypes_arg_seq { instance } % \end{macrocode} % \end{variable} % -% \begin{variable}{\g_xtemplate_object_type_prop} +% \begin{variable}{\g_@@_object_type_prop} % For storing types and the associated number of arguments. % \begin{macrocode} -\prop_new:N \g_xtemplate_object_type_prop +\prop_new:N \g_@@_object_type_prop % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xtemplate_assignments_tl} +% \begin{variable}{\l_@@_assignments_tl} % When creating an instance, the assigned values are collected here. % \begin{macrocode} -\tl_new:N \l_xtemplate_assignments_tl +\tl_new:N \l_@@_assignments_tl % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xtemplate_collection_tl} +% \begin{variable}{\l_@@_collection_tl} % The current instance collection name is stored here. % \begin{macrocode} -\tl_new:N \l_xtemplate_collection_tl +\tl_new:N \l_@@_collection_tl % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xtemplate_collections_prop} +% \begin{variable}{\l_@@_collections_prop} % Lists current collection in force, indexed by object type. % \begin{macrocode} -\prop_new:N \l_xtemplate_collections_prop +\prop_new:N \l_@@_collections_prop % \end{macrocode} % \end{variable} % -% \begin{macro}{\l_xtemplate_default_tl} +% \begin{macro}{\l_@@_default_tl} % The default value for a key is recovered here from the property list % in which it is stored. The internal implementation of property lists % means that this is safe even with un-escaped |#| tokens. % \begin{macrocode} -\tl_new:N \l_xtemplate_default_tl +\tl_new:N \l_@@_default_tl % \end{macrocode} %\ end{macro} % -% \begin{variable}{\l_xtemplate_error_bool} +% \begin{variable}{\l_@@_error_bool} % A flag for errors to be carried forward. % \begin{macrocode} -\bool_new:N \l_xtemplate_error_bool +\bool_new:N \l_@@_error_bool % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xtemplate_global_bool} +% \begin{variable}{\l_@@_global_bool} % Used to indicate that assignments should be global. % \begin{macrocode} -\bool_new:N \l_xtemplate_global_bool +\bool_new:N \l_@@_global_bool % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xtemplate_restrict_bool} +% \begin{variable}{\l_@@_restrict_bool} % A flag to indicate that a template is being restricted. % \begin{macrocode} -\bool_new:N \l_xtemplate_restrict_bool +\bool_new:N \l_@@_restrict_bool % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xtemplate_restrict_clist} +% \begin{variable}{\l_@@_restrict_clist} % A scratch list for restricting templates. % \begin{macrocode} -\clist_new:N \l_xtemplate_restrict_clist +\clist_new:N \l_@@_restrict_clist % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_xtemplate_key_name_tl} -% \begin{variable}{\l_xtemplate_keytype_tl} -% \begin{variable}{\l_xtemplate_keytype_arg_tl} -% \begin{variable}{\l_xtemplate_value_tl} -% \begin{variable}{\l_xtemplate_var_tl} +% \begin{variable}{\l_@@_key_name_tl} +% \begin{variable}{\l_@@_keytype_tl} +% \begin{variable}{\l_@@_keytype_arg_tl} +% \begin{variable}{\l_@@_value_tl} +% \begin{variable}{\l_@@_var_tl} % When defining each key in a template, the name and type of the key % need to be separated and stored. Any argument needed by the % keytype is also stored separately. % \begin{macrocode} -\tl_new:N \l_xtemplate_key_name_tl -\tl_new:N \l_xtemplate_keytype_tl -\tl_new:N \l_xtemplate_keytype_arg_tl -\tl_new:N \l_xtemplate_value_tl -\tl_new:N \l_xtemplate_var_tl +\tl_new:N \l_@@_key_name_tl +\tl_new:N \l_@@_keytype_tl +\tl_new:N \l_@@_keytype_arg_tl +\tl_new:N \l_@@_value_tl +\tl_new:N \l_@@_var_tl % \end{macrocode} % \end{variable} % \end{variable} @@ -799,38 +803,38 @@ % \end{variable} % \end{variable} % -% \begin{variable}{\l_xtemplate_keytypes_prop} -% \begin{variable}{\l_xtemplate_key_order_seq} -% \begin{variable}{\l_xtemplate_values_prop} -% \begin{variable}{\l_xtemplate_vars_prop} +% \begin{variable}{\l_@@_keytypes_prop} +% \begin{variable}{\l_@@_key_order_seq} +% \begin{variable}{\l_@@_values_prop} +% \begin{variable}{\l_@@_vars_prop} % To avoid needing too many difficult-to-follow csname assignments, % various scratch token registers are used to build up data, which is % then transferred % \begin{macrocode} -\prop_new:N \l_xtemplate_keytypes_prop -\seq_new:N \l_xtemplate_key_order_seq -\prop_new:N \l_xtemplate_values_prop -\prop_new:N \l_xtemplate_vars_prop +\prop_new:N \l_@@_keytypes_prop +\seq_new:N \l_@@_key_order_seq +\prop_new:N \l_@@_values_prop +\prop_new:N \l_@@_vars_prop % \end{macrocode} % \end{variable} % \end{variable} % \end{variable} % \end{variable} % -% \begin{variable}{\l_xtemplate_tmp_clist} -% \begin{variable}{\l_xtemplate_tmp_dim} -% \begin{variable}{\l_xtemplate_tmp_int} -% \begin{variable}{\l_xtemplate_tmp_muskip} -% \begin{variable}{\l_xtemplate_tmp_skip} +% \begin{variable}{\l_@@_tmp_clist} +% \begin{variable}{\l_@@_tmp_dim} +% \begin{variable}{\l_@@_tmp_int} +% \begin{variable}{\l_@@_tmp_muskip} +% \begin{variable}{\l_@@_tmp_skip} % For pre-processing the data stored by \pkg{xtemplate}, a number of % scratch variables are needed. The assignments are made to these in the % first instance, unless evaluation is delayed. % \begin{macrocode} -\clist_new:N \l_xtemplate_tmp_clist -\dim_new:N \l_xtemplate_tmp_dim -\int_new:N \l_xtemplate_tmp_int -\muskip_new:N \l_xtemplate_tmp_muskip -\skip_new:N \l_xtemplate_tmp_skip +\clist_new:N \l_@@_tmp_clist +\dim_new:N \l_@@_tmp_dim +\int_new:N \l_@@_tmp_int +\muskip_new:N \l_@@_tmp_muskip +\skip_new:N \l_@@_tmp_skip % \end{macrocode} % \end{variable} % \end{variable} @@ -838,10 +842,10 @@ % \end{variable} % \end{variable} % -% \begin{variable}{\l_xtemplate_tmp_tl} +% \begin{variable}{\l_@@_tmp_tl} % A scratch variable for comparisons and so on. % \begin{macrocode} -\tl_new:N \l_xtemplate_tmp_tl +\tl_new:N \l_@@_tmp_tl % \end{macrocode} % \end{variable} % @@ -863,31 +867,31 @@ % a object type, template or instance. There are also some for the % validity of a particular call. All of these are collected up here. % -% \begin{macro}{\xtemplate_execute_if_arg_agree:nnT} +% \begin{macro}{\@@_execute_if_arg_agree:nnT} % A test agreement between the number of arguments for the template % type and that specified when creating a template. This is not done as a % separate conditional for efficiency and better error message % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_execute_if_arg_agree:nnT #1#2#3 +\cs_new_protected:Npn \@@_execute_if_arg_agree:nnT #1#2#3 { - \prop_get:NnN \g_xtemplate_object_type_prop {#1} \l_xtemplate_tmp_tl - \int_compare:nNnTF {#2} = \l_xtemplate_tmp_tl + \prop_get:NnN \g_@@_object_type_prop {#1} \l_@@_tmp_tl + \int_compare:nNnTF {#2} = \l_@@_tmp_tl {#3} { \msg_error:nnxxx { xtemplate } - { argument-number-mismatch } {#1} { \l_xtemplate_tmp_tl } {#2} + { argument-number-mismatch } {#1} { \l_@@_tmp_tl } {#2} } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_execute_if_code_exist:nnT} +% \begin{macro}{\@@_execute_if_code_exist:nnT} % A template is only fully declared if the code has been set up, % which can be checked by looking for the template function itself. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_execute_if_code_exist:nnT #1#2#3 +\cs_new_protected:Npn \@@_execute_if_code_exist:nnT #1#2#3 { - \cs_if_exist:cTF { \c_xtemplate_code_root_tl #1 / #2 } + \cs_if_exist:cTF { \c_@@_code_root_tl #1 / #2 } {#3} { \msg_error:nnxx { xtemplate } { no-template-code } @@ -897,43 +901,43 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_execute_if_keytype_exist:nT} -% \begin{macro}{\xtemplate_execute_if_keytype_exist:oT} +% \begin{macro}{\@@_execute_if_keytype_exist:nT} +% \begin{macro}{\@@_execute_if_keytype_exist:oT} % The test for valid keytypes looks for a function to set up the key, % which is part of the \enquote{code} side of the template definition. % This avoids having different lists for the two parts of the process. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_execute_if_keytype_exist:nT #1#2 +\cs_new_protected:Npn \@@_execute_if_keytype_exist:nT #1#2 { - \cs_if_exist:cTF { xtemplate_store_value_ #1 :n } + \cs_if_exist:cTF { @@_store_value_ #1 :n } {#2} { \msg_error:nnx { xtemplate } { unknown-keytype } {#1} } } -\cs_generate_variant:Nn \xtemplate_execute_if_keytype_exist:nT { o } +\cs_generate_variant:Nn \@@_execute_if_keytype_exist:nT { o } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_execute_if_type_exist:nT} +% \begin{macro}{\@@_execute_if_type_exist:nT} % To check that a particular object type is valid. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_execute_if_type_exist:nT #1#2 +\cs_new_protected:Npn \@@_execute_if_type_exist:nT #1#2 { - \prop_if_in:NnTF \g_xtemplate_object_type_prop {#1} + \prop_if_in:NnTF \g_@@_object_type_prop {#1} {#2} { \msg_error:nnx { xtemplate } { unknown-object-type } {#1} } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_execute_if_keys_exist:nnT} +% \begin{macro}{\@@_execute_if_keys_exist:nnT} % To check that the keys for a template have been set up before trying % to create any code, a simple check for the correctly-named keytype % property list. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_if_keys_exist:nnT #1#2#3 +\cs_new_protected:Npn \@@_if_keys_exist:nnT #1#2#3 { - \cs_if_exist:cTF { \c_xtemplate_keytypes_root_tl #1 / #2 } + \cs_if_exist:cTF { \c_@@_keytypes_root_tl #1 / #2 } {#3} { \msg_error:nnxx { xtemplate } { unknown-template } @@ -943,24 +947,24 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_if_key_value:nT, \xtemplate_if_key_value:oT} +% \begin{macro}{\@@_if_key_value:nT, \@@_if_key_value:oT} % Tests for the first token in a string being \cs{KeyValue}, where % \cs{EvaluateNow} is not important. % \begin{macrocode} -\prg_new_conditional:Npnn \xtemplate_if_key_value:n #1 { T } +\prg_new_conditional:Npnn \@@_if_key_value:n #1 { T } { \str_if_eq:noTF { \KeyValue } { \tl_head:w #1 \q_nil \q_stop } {\prg_return_true: } { \prg_return_false: } } -\cs_generate_variant:Nn \xtemplate_if_key_value:nT { o } +\cs_generate_variant:Nn \@@_if_key_value:nT { o } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_if_eval_now:nTF} +% \begin{macro}{\@@_if_eval_now:nTF} % Tests for the first token in a string being \cs{EvaluateNow}. % \begin{macrocode} -\prg_new_conditional:Npnn \xtemplate_if_eval_now:n #1 { TF } +\prg_new_conditional:Npnn \@@_if_eval_now:n #1 { TF } { \str_if_eq:noTF { \EvaluateNow } { \tl_head:w #1 \q_nil \q_stop } { \prg_return_true: } @@ -969,23 +973,23 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[TF]{\xtemplate_if_instance_exist:nnn} +% \begin{macro}[TF]{\@@_if_instance_exist:nnn} % Testing for an instance is collection dependent. % \begin{macrocode} -\prg_new_conditional:Npnn \xtemplate_if_instance_exist:nnn #1#2#3 +\prg_new_conditional:Npnn \@@_if_instance_exist:nnn #1#2#3 { T, F, TF } { - \cs_if_exist:cTF { \c_xtemplate_instances_root_tl #1 / #2 / #3 } + \cs_if_exist:cTF { \c_@@_instances_root_tl #1 / #2 / #3 } { \prg_return_true: } { \prg_return_false: } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_if_use_template:nTF} +% \begin{macro}{\@@_if_use_template:nTF} % Tests for the first token in a string being \cs{UseTemplate}. % \begin{macrocode} -\prg_new_conditional:Npnn \xtemplate_if_use_template:n #1 { TF } +\prg_new_conditional:Npnn \@@_if_use_template:n #1 { TF } { \str_if_eq:noTF { \UseTemplate } { \tl_head:w #1 \q_nil \q_stop } { \prg_return_true: } @@ -999,46 +1003,46 @@ % The various property lists for templates have to be shuffled in % and out of storage. % -% \begin{macro}{\xtemplate_store_defaults:n} -% \begin{macro}{\xtemplate_store_keytypes:n} -% \begin{macro}{\xtemplate_store_restrictions:n} -% \begin{macro}{\xtemplate_store_values:n} -% \begin{macro}{\xtemplate_store_vars:n} +% \begin{macro}{\@@_store_defaults:n} +% \begin{macro}{\@@_store_keytypes:n} +% \begin{macro}{\@@_store_restrictions:n} +% \begin{macro}{\@@_store_values:n} +% \begin{macro}{\@@_store_vars:n} % The defaults and keytypes are transferred from the scratch property % lists to the \enquote{proper} lists for the template being created. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_store_defaults:n #1 +\cs_new_protected:Npn \@@_store_defaults:n #1 { - \prop_gclear_new:c { \c_xtemplate_defaults_root_tl #1 } - \prop_gset_eq:cN { \c_xtemplate_defaults_root_tl #1 } - \l_xtemplate_values_prop + \prop_gclear_new:c { \c_@@_defaults_root_tl #1 } + \prop_gset_eq:cN { \c_@@_defaults_root_tl #1 } + \l_@@_values_prop } -\cs_new_protected:Npn \xtemplate_store_keytypes:n #1 +\cs_new_protected:Npn \@@_store_keytypes:n #1 { - \prop_gclear_new:c { \c_xtemplate_keytypes_root_tl #1 } - \prop_gset_eq:cN { \c_xtemplate_keytypes_root_tl #1 } - \l_xtemplate_keytypes_prop - \seq_gclear_new:c { \c_xtemplate_key_order_root_tl #1 } - \seq_gset_eq:cN { \c_xtemplate_key_order_root_tl #1 } - \l_xtemplate_key_order_seq + \prop_gclear_new:c { \c_@@_keytypes_root_tl #1 } + \prop_gset_eq:cN { \c_@@_keytypes_root_tl #1 } + \l_@@_keytypes_prop + \seq_gclear_new:c { \c_@@_key_order_root_tl #1 } + \seq_gset_eq:cN { \c_@@_key_order_root_tl #1 } + \l_@@_key_order_seq } -\cs_new_protected:Npn \xtemplate_store_values:n #1 +\cs_new_protected:Npn \@@_store_values:n #1 { - \prop_clear_new:c { \c_xtemplate_values_root_tl #1 } - \prop_set_eq:cN { \c_xtemplate_values_root_tl #1 } - \l_xtemplate_values_prop + \prop_clear_new:c { \c_@@_values_root_tl #1 } + \prop_set_eq:cN { \c_@@_values_root_tl #1 } + \l_@@_values_prop } -\cs_new_protected:Npn \xtemplate_store_restrictions:n #1 +\cs_new_protected:Npn \@@_store_restrictions:n #1 { - \clist_gclear_new:c { \c_xtemplate_restrict_root_tl #1 } - \clist_gset_eq:cN { \c_xtemplate_restrict_root_tl #1 } - \l_xtemplate_restrict_clist + \clist_gclear_new:c { \c_@@_restrict_root_tl #1 } + \clist_gset_eq:cN { \c_@@_restrict_root_tl #1 } + \l_@@_restrict_clist } -\cs_new_protected:Npn \xtemplate_store_vars:n #1 +\cs_new_protected:Npn \@@_store_vars:n #1 { - \prop_gclear_new:c { \c_xtemplate_vars_root_tl #1 } - \prop_gset_eq:cN { \c_xtemplate_vars_root_tl #1 } - \l_xtemplate_vars_prop + \prop_gclear_new:c { \c_@@_vars_root_tl #1 } + \prop_gset_eq:cN { \c_@@_vars_root_tl #1 } + \l_@@_vars_prop } % \end{macrocode} % \end{macro} @@ -1047,41 +1051,41 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_recover_defaults:n} -% \begin{macro}{\xtemplate_recover_keytypes:n} -% \begin{macro}{\xtemplate_recover_restrictions:n} -% \begin{macro}{\xtemplate_recover_values:n} -% \begin{macro}{\xtemplate_recover_vars:n} +% \begin{macro}{\@@_recover_defaults:n} +% \begin{macro}{\@@_recover_keytypes:n} +% \begin{macro}{\@@_recover_restrictions:n} +% \begin{macro}{\@@_recover_values:n} +% \begin{macro}{\@@_recover_vars:n} % Recovering the stored data for a template is rather less complex % than storing it. All that happens is the data is transferred from % the permanent to the scratch storage. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_recover_defaults:n #1 +\cs_new_protected:Npn \@@_recover_defaults:n #1 { - \prop_set_eq:Nc \l_xtemplate_values_prop - { \c_xtemplate_defaults_root_tl #1 } + \prop_set_eq:Nc \l_@@_values_prop + { \c_@@_defaults_root_tl #1 } } -\cs_new_protected:Npn \xtemplate_recover_keytypes:n #1 +\cs_new_protected:Npn \@@_recover_keytypes:n #1 { - \prop_set_eq:Nc \l_xtemplate_keytypes_prop - { \c_xtemplate_keytypes_root_tl #1 } - \seq_set_eq:Nc \l_xtemplate_key_order_seq - { \c_xtemplate_key_order_root_tl #1 } + \prop_set_eq:Nc \l_@@_keytypes_prop + { \c_@@_keytypes_root_tl #1 } + \seq_set_eq:Nc \l_@@_key_order_seq + { \c_@@_key_order_root_tl #1 } } -\cs_new_protected:Npn \xtemplate_recover_restrictions:n #1 +\cs_new_protected:Npn \@@_recover_restrictions:n #1 { - \clist_set_eq:Nc \l_xtemplate_restrict_clist - { \c_xtemplate_restrict_root_tl #1 } + \clist_set_eq:Nc \l_@@_restrict_clist + { \c_@@_restrict_root_tl #1 } } -\cs_new_protected:Npn \xtemplate_recover_values:n #1 +\cs_new_protected:Npn \@@_recover_values:n #1 { - \prop_set_eq:Nc \l_xtemplate_values_prop - { \c_xtemplate_values_root_tl #1 } + \prop_set_eq:Nc \l_@@_values_prop + { \c_@@_values_root_tl #1 } } -\cs_new_protected:Npn \xtemplate_recover_vars:n #1 +\cs_new_protected:Npn \@@_recover_vars:n #1 { - \prop_set_eq:Nc \l_xtemplate_vars_prop - { \c_xtemplate_vars_root_tl #1 } + \prop_set_eq:Nc \l_@@_vars_prop + { \c_@@_vars_root_tl #1 } } % \end{macrocode} % \end{macro} @@ -1092,15 +1096,15 @@ % % \subsection{Creating new object types} % -% \begin{macro}{\xtemplate_declare_object_type:nn} +% \begin{macro}{\@@_declare_object_type:nn} % Although the object type is the \enquote{top level} of the template % system, it is actually very easy to implement. All that happens is that % the number of arguments required is recorded, indexed by the name of the % object type. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_declare_object_type:nn #1#2 +\cs_new_protected:Npn \@@_declare_object_type:nn #1#2 { - \int_set:Nn \l_xtemplate_tmp_int {#2} + \int_set:Nn \l_@@_tmp_int {#2} \bool_if:nTF { \int_compare_p:nNn {#2} > \c_nine || @@ -1108,13 +1112,13 @@ } { \msg_error:nnxx { xtemplate } { bad-number-of-arguments } - {#1} { \exp_not:V \l_xtemplate_tmp_int } + {#1} { \exp_not:V \l_@@_tmp_int } } { \msg_info:nnxx { xtemplate } { declare-object-type } {#1} {#2} - \prop_gput:NnV \g_xtemplate_object_type_prop {#1} - \l_xtemplate_tmp_int + \prop_gput:NnV \g_@@_object_type_prop {#1} + \l_@@_tmp_int } } % \end{macrocode} @@ -1128,7 +1132,7 @@ % the two properties are saved to appropriate lists, which can then % be used later to recover the information when implementing the keys. % -% \begin{macro}{\xtemplate_declare_template_keys:nnnn} +% \begin{macro}{\@@_declare_template_keys:nnnn} % The main function for the \enquote{design} part of creating a template % starts by checking that the object type exists and that the number of % arguments required agree. If that is all fine, then the two storage @@ -1137,28 +1141,28 @@ % Finally, the code hands of to the storage routine to save the parsed % information properly. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_declare_template_keys:nnnn #1#2#3#4 +\cs_new_protected:Npn \@@_declare_template_keys:nnnn #1#2#3#4 { - \xtemplate_execute_if_type_exist:nT {#1} + \@@_execute_if_type_exist:nT {#1} { - \xtemplate_execute_if_arg_agree:nnT {#1} {#3} + \@@_execute_if_arg_agree:nnT {#1} {#3} { - \prop_clear:N \l_xtemplate_values_prop - \prop_clear:N \l_xtemplate_keytypes_prop - \seq_clear:N \l_xtemplate_key_order_seq + \prop_clear:N \l_@@_values_prop + \prop_clear:N \l_@@_keytypes_prop + \seq_clear:N \l_@@_key_order_seq \keyval_parse:NNn - \xtemplate_parse_keys_elt:n \xtemplate_parse_keys_elt:nn {#4} - \xtemplate_store_defaults:n { #1 / #2 } - \xtemplate_store_keytypes:n { #1 / #2 } + \@@_parse_keys_elt:n \@@_parse_keys_elt:nn {#4} + \@@_store_defaults:n { #1 / #2 } + \@@_store_keytypes:n { #1 / #2 } } } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_parse_keys_elt:n} -% \begin{macro}[aux]{\xtemplate_parse_keys_elt_aux:n} -% \begin{macro}[aux]{\xtemplate_parse_keys_elt_aux:} +% \begin{macro}{\@@_parse_keys_elt:n} +% \begin{macro}[aux]{\@@_parse_keys_elt_aux:n} +% \begin{macro}[aux]{\@@_parse_keys_elt_aux:} % Processing the key part of the key--value pair is always carried out % using this function, even if a value was found. First, the key name % is separated from the keytype, and if necessary the keytype is @@ -1168,56 +1172,56 @@ % (in braces) in the token list to record the order the keys are defined % in. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_parse_keys_elt:n #1 +\cs_new_protected:Npn \@@_parse_keys_elt:n #1 { - \xtemplate_split_keytype:n {#1} - \bool_if:NF \l_xtemplate_error_bool + \@@_split_keytype:n {#1} + \bool_if:NF \l_@@_error_bool { - \xtemplate_execute_if_keytype_exist:oT \l_xtemplate_keytype_tl + \@@_execute_if_keytype_exist:oT \l_@@_keytype_tl { - \seq_map_function:NN \c_xtemplate_keytypes_arg_seq - \xtemplate_parse_keys_elt_aux:n - \bool_if:NF \l_xtemplate_error_bool + \seq_map_function:NN \c_@@_keytypes_arg_seq + \@@_parse_keys_elt_aux:n + \bool_if:NF \l_@@_error_bool { - \seq_if_in:NoTF \l_xtemplate_key_order_seq - \l_xtemplate_key_name_tl + \seq_if_in:NoTF \l_@@_key_order_seq + \l_@@_key_name_tl { \msg_error:nnx { xtemplate } { duplicate-key-interface } - { \l_xtemplate_key_name_tl } + { \l_@@_key_name_tl } } - { \xtemplate_parse_keys_elt_aux: } + { \@@_parse_keys_elt_aux: } } } } } -\cs_new_protected_nopar:Npn \xtemplate_parse_keys_elt_aux:n #1 +\cs_new_protected_nopar:Npn \@@_parse_keys_elt_aux:n #1 { - \str_if_eq:onT \l_xtemplate_keytype_tl {#1} + \str_if_eq:onT \l_@@_keytype_tl {#1} { - \tl_if_empty:NT \l_xtemplate_keytype_arg_tl + \tl_if_empty:NT \l_@@_keytype_arg_tl { \msg_error:nnx { xtemplate } { keytype-requires-argument } {#1} - \bool_set_true:N \l_xtemplate_error_bool + \bool_set_true:N \l_@@_error_bool \seq_map_break: } } } -\cs_new_nopar:Npn \xtemplate_parse_keys_elt_aux: +\cs_new_nopar:Npn \@@_parse_keys_elt_aux: { - \tl_set:Nx \l_xtemplate_tmp_tl + \tl_set:Nx \l_@@_tmp_tl { - \l_xtemplate_keytype_tl - \tl_if_empty:NF \l_xtemplate_keytype_arg_tl - { { \l_xtemplate_keytype_arg_tl } } + \l_@@_keytype_tl + \tl_if_empty:NF \l_@@_keytype_arg_tl + { { \l_@@_keytype_arg_tl } } } - \prop_put:Noo \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - \seq_put_right:No \l_xtemplate_key_order_seq \l_xtemplate_key_name_tl - \str_if_eq:onT \l_xtemplate_keytype_tl { choice } + \prop_put:Noo \l_@@_keytypes_prop \l_@@_key_name_tl + \l_@@_tmp_tl + \seq_put_right:No \l_@@_key_order_seq \l_@@_key_name_tl + \str_if_eq:onT \l_@@_keytype_tl { choice } { - \clist_if_in:NnT \l_xtemplate_keytype_arg_tl { unknown } + \clist_if_in:NnT \l_@@_keytype_arg_tl { unknown } { \msg_error:nn { xtemplate } { choice-unknown-reserved } } } } @@ -1226,21 +1230,21 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_parse_keys_elt:nn} +% \begin{macro}{\@@_parse_keys_elt:nn} % For keys which have a default, the keytype and key name are first -% separated out by the \cs{xtemplate_parse_keys_elt:n} +% separated out by the \cs{@@_parse_keys_elt:n} % routine, before storing the default value in the scratch property list. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_parse_keys_elt:nn #1#2 +\cs_new_protected:Npn \@@_parse_keys_elt:nn #1#2 { - \xtemplate_parse_keys_elt:n {#1} - \use:c { xtemplate_store_value_ \l_xtemplate_keytype_tl :n } {#2} + \@@_parse_keys_elt:n {#1} + \use:c { @@_store_value_ \l_@@_keytype_tl :n } {#2} } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_split_keytype:n} -% \begin{macro}[aux]{\xtemplate_split_keytype_aux:w} +% \begin{macro}{\@@_split_keytype:n} +% \begin{macro}[aux]{\@@_split_keytype_aux:w} % The keytype and key name should be separated by |:|. As the % definition might be given inside or outside of a code block, spaces % are removed and the category code of colons is standardised. After @@ -1253,35 +1257,35 @@ \tl_to_lowercase:n { \group_end: - \cs_new_protected:Npn \xtemplate_split_keytype:n #1 + \cs_new_protected:Npn \@@_split_keytype:n #1 { - \bool_set_false:N \l_xtemplate_error_bool - \tl_set:Nn \l_xtemplate_tmp_tl {#1} - \tl_remove_all:Nn \l_xtemplate_tmp_tl { ~ } - \tl_replace_all:Nnn \l_xtemplate_tmp_tl { : } { @ } - \tl_if_in:onTF \l_xtemplate_tmp_tl { @ } + \bool_set_false:N \l_@@_error_bool + \tl_set:Nn \l_@@_tmp_tl {#1} + \tl_remove_all:Nn \l_@@_tmp_tl { ~ } + \tl_replace_all:Nnn \l_@@_tmp_tl { : } { @ } + \tl_if_in:onTF \l_@@_tmp_tl { @ } { - \tl_clear:N \l_xtemplate_key_name_tl - \exp_after:wN \xtemplate_split_keytype_aux:w - \l_xtemplate_tmp_tl \q_stop + \tl_clear:N \l_@@_key_name_tl + \exp_after:wN \@@_split_keytype_aux:w + \l_@@_tmp_tl \q_stop } { - \bool_set_true:N \l_xtemplate_error_bool + \bool_set_true:N \l_@@_error_bool \msg_error:nnx { xtemplate } { missing-keytype } {#1} } } - \cs_new_protected:Npn \xtemplate_split_keytype_aux:w #1 @ #2 \q_stop + \cs_new_protected:Npn \@@_split_keytype_aux:w #1 @ #2 \q_stop { - \tl_put_right:Nx \l_xtemplate_key_name_tl { \tl_to_str:n {#1} } + \tl_put_right:Nx \l_@@_key_name_tl { \tl_to_str:n {#1} } \tl_if_in:nnTF {#2} { @ } { - \tl_put_right:Nn \l_xtemplate_key_name_tl { @ } - \xtemplate_split_keytype_aux:w #2 \q_stop + \tl_put_right:Nn \l_@@_key_name_tl { @ } + \@@_split_keytype_aux:w #2 \q_stop } { - \tl_if_empty:NTF \l_xtemplate_key_name_tl + \tl_if_empty:NTF \l_@@_key_name_tl { \msg_error:nnx { xtemplate } { empty-key-name } { @ #2 } } - { \xtemplate_split_keytype_arg:n {#2} } + { \@@_split_keytype_arg:n {#2} } } } } @@ -1289,9 +1293,9 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_split_keytype_arg:n, \xtemplate_split_keytype_arg:o} -% \begin{macro}[aux]{\xtemplate_split_keytype_arg_aux:n} -% \begin{macro}[aux]{\xtemplate_split_keytype_arg_aux:w} +% \begin{macro}{\@@_split_keytype_arg:n, \@@_split_keytype_arg:o} +% \begin{macro}[aux]{\@@_split_keytype_arg_aux:n} +% \begin{macro}[aux]{\@@_split_keytype_arg_aux:w} % The second stage of sorting out the keytype is to check for an % argument. As there is no convenient delimiting token to look for, % a check is made instead for each possible text value for the keytype. @@ -1302,33 +1306,33 @@ % be \enquote{correct} as given, and are left alone (this is checked by % other code). % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_split_keytype_arg:n #1 +\cs_new_protected:Npn \@@_split_keytype_arg:n #1 { - \tl_set:Nn \l_xtemplate_keytype_tl {#1} - \tl_clear:N \l_xtemplate_keytype_arg_tl - \cs_set_protected_nopar:Npn \xtemplate_split_keytype_arg_aux:n ##1 + \tl_set:Nn \l_@@_keytype_tl {#1} + \tl_clear:N \l_@@_keytype_arg_tl + \cs_set_protected_nopar:Npn \@@_split_keytype_arg_aux:n ##1 { \tl_if_in:nnT {#1} {##1} { - \cs_set:Npn \xtemplate_split_keytype_arg_aux:w + \cs_set:Npn \@@_split_keytype_arg_aux:w ####1 ##1 ####2 \q_stop { \tl_if_empty:nT {####1} { - \tl_set:Nn \l_xtemplate_keytype_tl {##1} - \tl_set:Nn \l_xtemplate_keytype_arg_tl {####2} + \tl_set:Nn \l_@@_keytype_tl {##1} + \tl_set:Nn \l_@@_keytype_arg_tl {####2} \seq_map_break: } } - \xtemplate_split_keytype_arg_aux:w #1 \q_stop + \@@_split_keytype_arg_aux:w #1 \q_stop } } - \seq_map_function:NN \c_xtemplate_keytypes_arg_seq - \xtemplate_split_keytype_arg_aux:n + \seq_map_function:NN \c_@@_keytypes_arg_seq + \@@_split_keytype_arg_aux:n } -\cs_generate_variant:Nn \xtemplate_split_keytype_arg:n { o } -\cs_new_nopar:Npn \xtemplate_split_keytype_arg_aux:n #1 { } -\cs_new_nopar:Npn \xtemplate_split_keytype_arg_aux:w #1 \q_stop { } +\cs_generate_variant:Nn \@@_split_keytype_arg:n { o } +\cs_new_nopar:Npn \@@_split_keytype_arg_aux:n #1 { } +\cs_new_nopar:Npn \@@_split_keytype_arg_aux:w #1 \q_stop { } % \end{macrocode} % \end{macro} % \end{macro} @@ -1350,52 +1354,52 @@ % to store the data, meaning that the only argument required is the % value to be processed and potentially stored. % -% \begin{macro}{\xtemplate_store_value_boolean:n} +% \begin{macro}{\@@_store_value_boolean:n} % Storing Boolean values requires a test for delayed evaluation, but % is different to the various numerical variable types as there are % only two possible values to store. So the code here tests the default % switch and then records the meaning (either \texttt{true} or % \texttt{false}). % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_store_value_boolean:n #1 +\cs_new_protected:Npn \@@_store_value_boolean:n #1 { - \xtemplate_if_eval_now:nTF {#1} + \@@_if_eval_now:nTF {#1} { \bool_if:cTF { c_ #1 _bool } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl + \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl { true } } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl + \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl { false } } } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl {#1} } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_store_value_code:n} -% \begin{macro}{\xtemplate_store_value_choice:n} -% \begin{macro}{\xtemplate_store_value_commalist:n} -% \begin{macro}{\xtemplate_store_value_function:n} -% \begin{macro}{\xtemplate_store_value_instance:n} -% \begin{macro}{\xtemplate_store_value_real:n} -% \begin{macro}{\xtemplate_store_value_tokenlist:n} +% \begin{macro}{\@@_store_value_code:n} +% \begin{macro}{\@@_store_value_choice:n} +% \begin{macro}{\@@_store_value_commalist:n} +% \begin{macro}{\@@_store_value_function:n} +% \begin{macro}{\@@_store_value_instance:n} +% \begin{macro}{\@@_store_value_real:n} +% \begin{macro}{\@@_store_value_tokenlist:n} % With no need to worry about delayed evaluation, these keytypes all % just store the input directly. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_store_value_code:n #1 - { \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} } -\cs_new_eq:NN \xtemplate_store_value_choice:n \xtemplate_store_value_code:n -\cs_new_eq:NN \xtemplate_store_value_commalist:n \xtemplate_store_value_code:n -\cs_new_eq:NN \xtemplate_store_value_function:n \xtemplate_store_value_code:n -\cs_new_eq:NN \xtemplate_store_value_instance:n \xtemplate_store_value_code:n -\cs_new_eq:NN \xtemplate_store_value_real:n \xtemplate_store_value_code:n -\cs_new_eq:NN \xtemplate_store_value_tokenlist:n \xtemplate_store_value_code:n +\cs_new_protected:Npn \@@_store_value_code:n #1 + { \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl {#1} } +\cs_new_eq:NN \@@_store_value_choice:n \@@_store_value_code:n +\cs_new_eq:NN \@@_store_value_commalist:n \@@_store_value_code:n +\cs_new_eq:NN \@@_store_value_function:n \@@_store_value_code:n +\cs_new_eq:NN \@@_store_value_instance:n \@@_store_value_code:n +\cs_new_eq:NN \@@_store_value_real:n \@@_store_value_code:n +\cs_new_eq:NN \@@_store_value_tokenlist:n \@@_store_value_code:n % \end{macrocode} % \end{macro} % \end{macro} @@ -1405,61 +1409,61 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_store_value_integer:n} -% \begin{macro}{\xtemplate_store_value_length:n} -% \begin{macro}{\xtemplate_store_value_muskip:n} -% \begin{macro}{\xtemplate_store_value_skip:n} +% \begin{macro}{\@@_store_value_integer:n} +% \begin{macro}{\@@_store_value_length:n} +% \begin{macro}{\@@_store_value_muskip:n} +% \begin{macro}{\@@_store_value_skip:n} % Storing the value of a number is in all cases more or less the same. % If evaluation is taking place now, assignment is made to a scratch % variable, and this result is then stored. On the other hand, if % evaluation is delayed the current data is simply stored \enquote{as is}. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_store_value_integer:n #1 +\cs_new_protected:Npn \@@_store_value_integer:n #1 { - \xtemplate_if_eval_now:nTF {#1} + \@@_if_eval_now:nTF {#1} { - \int_set:Nn \l_xtemplate_tmp_int {#1} - \prop_put:NVV \l_xtemplate_values_prop \l_xtemplate_key_name_int - \l_xtemplate_tmp_int + \int_set:Nn \l_@@_tmp_int {#1} + \prop_put:NVV \l_@@_values_prop \l_@@_key_name_int + \l_@@_tmp_int } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl {#1} } } -\cs_new_protected:Npn \xtemplate_store_value_length:n #1 +\cs_new_protected:Npn \@@_store_value_length:n #1 { - \xtemplate_if_eval_now:nTF {#1} + \@@_if_eval_now:nTF {#1} { - \dim_set:Nn \l_xtemplate_tmp_dim {#1} - \prop_put:NVV \l_xtemplate_values_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_dim + \dim_set:Nn \l_@@_tmp_dim {#1} + \prop_put:NVV \l_@@_values_prop \l_@@_key_name_tl + \l_@@_tmp_dim } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl {#1} } } -\cs_new_protected:Npn \xtemplate_store_value_muskip:n #1 +\cs_new_protected:Npn \@@_store_value_muskip:n #1 { - \xtemplate_if_eval_now:nTF {#1} + \@@_if_eval_now:nTF {#1} { - \muskip_set:Nn \l_xtemplate_tmp_muskip {#1} - \prop_put:NVV \l_xtemplate_values_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_muskip + \muskip_set:Nn \l_@@_tmp_muskip {#1} + \prop_put:NVV \l_@@_values_prop \l_@@_key_name_tl + \l_@@_tmp_muskip } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl {#1} } } -\cs_new_protected:Npn \xtemplate_store_value_skip:n #1 +\cs_new_protected:Npn \@@_store_value_skip:n #1 { - \xtemplate_if_eval_now:nTF {#1} + \@@_if_eval_now:nTF {#1} { - \skip_set:Nn \l_xtemplate_tmp_skip {#1} - \prop_put:NVV \l_xtemplate_values_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_skip + \skip_set:Nn \l_@@_tmp_skip {#1} + \prop_put:NVV \l_@@_values_prop \l_@@_key_name_tl + \l_@@_tmp_skip } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl {#1} } } % \end{macrocode} @@ -1470,23 +1474,23 @@ % % \subsection{Implementation part of template declaration} % -% \begin{macro}{\xtemplate_declare_template_code:nnnnn} +% \begin{macro}{\@@_declare_template_code:nnnnn} % The main function for implementing a template starts with a couple of % simple checks to make sure that there are no obvious mistakes: the % number of arguments must agree and the template keys must have been % declared. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_declare_template_code:nnnnn #1#2#3#4#5 +\cs_new_protected:Npn \@@_declare_template_code:nnnnn #1#2#3#4#5 { - \xtemplate_execute_if_type_exist:nT {#1} + \@@_execute_if_type_exist:nT {#1} { - \xtemplate_execute_if_arg_agree:nnT {#1}{#3} + \@@_execute_if_arg_agree:nnT {#1}{#3} { - \xtemplate_if_keys_exist:nnT {#1} {#2} + \@@_if_keys_exist:nnT {#1} {#2} { - \xtemplate_store_key_implementation:nnn {#1} {#2} {#4} + \@@_store_key_implementation:nnn {#1} {#2} {#4} \cs_generate_from_arg_count:cNnn - { \c_xtemplate_code_root_tl #1 / #2 } + { \c_@@_code_root_tl #1 / #2 } \cs_gset_protected:Npn {#3} {#5} } } @@ -1495,7 +1499,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_store_key_implementation:nnn} +% \begin{macro}{\@@_store_key_implementation:nnn} % Actually storing the implementation part of a template is quite easy % as it only requires the list of keys given to be turned into a % property list. There is also some error-checking to do, hence the need @@ -1503,17 +1507,17 @@ % (when choices are involved) parsing the key results in changes to the % default values. That is why they are loaded and then saved again. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_store_key_implementation:nnn #1#2#3 +\cs_new_protected:Npn \@@_store_key_implementation:nnn #1#2#3 { - \xtemplate_recover_defaults:n { #1 / #2 } - \xtemplate_recover_keytypes:n { #1 / #2 } - \prop_clear:N \l_xtemplate_vars_prop + \@@_recover_defaults:n { #1 / #2 } + \@@_recover_keytypes:n { #1 / #2 } + \prop_clear:N \l_@@_vars_prop \keyval_parse:NNn - \xtemplate_parse_vars_elt:n \xtemplate_parse_vars_elt:nn {#3} - \xtemplate_store_vars:n { #1 / #2 } - \clist_clear:N \l_xtemplate_restrict_clist - \xtemplate_store_restrictions:n { #1 / #2 } - \prop_map_inline:Nn \l_xtemplate_keytypes_prop + \@@_parse_vars_elt:n \@@_parse_vars_elt:nn {#3} + \@@_store_vars:n { #1 / #2 } + \clist_clear:N \l_@@_restrict_clist + \@@_store_restrictions:n { #1 / #2 } + \prop_map_inline:Nn \l_@@_keytypes_prop { \msg_error:nnxxx { xtemplate } { key-not-implemented } {##1} {#2} {#1} @@ -1522,67 +1526,67 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_parse_vars_elt:n} +% \begin{macro}{\@@_parse_vars_elt:n} % At the implementation stage, every key must have a value given. So % this is an error function. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_parse_vars_elt:n #1 +\cs_new_protected:Npn \@@_parse_vars_elt:n #1 { \msg_error:nnx { xtemplate } { key-no-variable } {#1} } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_parse_vars_elt:nn} +% \begin{macro}{\@@_parse_vars_elt:nn} % The actual storage part here is very simple: the storage bin name % is placed into the property list. At the same time, a comparison is % made with the keytypes defined earlier: if there is a mismatch then % an error is raised. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_parse_vars_elt:nn #1#2 +\cs_new_protected:Npn \@@_parse_vars_elt:nn #1#2 { - \tl_set:Nx \l_xtemplate_key_name_tl { \tl_to_str:n {#1} } - \tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ } + \tl_set:Nx \l_@@_key_name_tl { \tl_to_str:n {#1} } + \tl_remove_all:Nn \l_@@_key_name_tl { ~ } \prop_get:NoNTF - \l_xtemplate_keytypes_prop - \l_xtemplate_key_name_tl - \l_xtemplate_keytype_tl + \l_@@_keytypes_prop + \l_@@_key_name_tl + \l_@@_keytype_tl { - \xtemplate_split_keytype_arg:o \l_xtemplate_keytype_tl - \xtemplate_parse_vars_elt_aux:n {#2} - \prop_del:NV \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl + \@@_split_keytype_arg:o \l_@@_keytype_tl + \@@_parse_vars_elt_aux:n {#2} + \prop_remove:NV \l_@@_keytypes_prop \l_@@_key_name_tl } { \msg_error:nnx { xtemplate } { unknown-key } {#1} } } % \end{macrocode} % \end{macro} -% \begin{macro}[aux]{\xtemplate_parse_vars_elt_aux:n} -% \begin{macro}[aux]{\xtemplate_parse_vars_elt_aux:w} +% \begin{macro}[aux]{\@@_parse_vars_elt_aux:n} +% \begin{macro}[aux]{\@@_parse_vars_elt_aux:w} % There now needs to be some sanity checking on the variable name % given. This does not apply for \texttt{choice} or % \texttt{code} \enquote{variables}, but in all other cases the variable % needs to exist. Also, the only prefix acceptable is \texttt{global}. So % there are a few related checks to make. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_parse_vars_elt_aux:n #1 +\cs_new_protected:Npn \@@_parse_vars_elt_aux:n #1 { - \str_if_eq:onTF \l_xtemplate_keytype_tl { choice } - { \xtemplate_implement_choices:n {#1} } + \str_if_eq:onTF \l_@@_keytype_tl { choice } + { \@@_implement_choices:n {#1} } { - \str_if_eq:onTF \l_xtemplate_keytype_tl { code } + \str_if_eq:onTF \l_@@_keytype_tl { code } { - \prop_put:Non \l_xtemplate_vars_prop - \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l_@@_vars_prop + \l_@@_key_name_tl {#1} } { \tl_if_single:nTF {#1} { \cs_if_exist:NF #1 - { \xtemplate_create_variable:N #1 } - \prop_put:Non \l_xtemplate_vars_prop - \l_xtemplate_key_name_tl {#1} + { \@@_create_variable:N #1 } + \prop_put:Non \l_@@_vars_prop + \l_@@_key_name_tl {#1} } { \tl_if_in:nnTF {#1} { global } - { \xtemplate_parse_vars_elt_aux:w #1 \q_stop } + { \@@_parse_vars_elt_aux:w #1 \q_stop } { \msg_error:nnx { xtemplate } { bad-variable } { \tl_to_str:n {#1} } @@ -1591,16 +1595,16 @@ } } } -\cs_new_protected:Npn \xtemplate_parse_vars_elt_aux:w #1 global #2 \q_stop +\cs_new_protected:Npn \@@_parse_vars_elt_aux:w #1 global #2 \q_stop { \tl_if_empty:nTF {#1} { \tl_if_single:nTF {#2} { \cs_if_exist:NF #2 - { \xtemplate_create_variable:N #2 } - \prop_put:Non \l_xtemplate_vars_prop - \l_xtemplate_key_name_tl { #1 global #2 } + { \@@_create_variable:N #2 } + \prop_put:Non \l_@@_vars_prop + \l_@@_key_name_tl { #1 global #2 } } { \msg_error:nnx { xtemplate } { bad-variable } @@ -1616,13 +1620,13 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_create_variable:N} +% \begin{macro}{\@@_create_variable:N} % A shortcut to create non-declared variables. Some types need a name % mapping, others can be used directly. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_create_variable:N #1 +\cs_new_protected_nopar:Npn \@@_create_variable:N #1 { - \prg_case_str:onn \l_xtemplate_keytype_tl + \str_case:onn \l_@@_keytype_tl { { boolean } { \bool_new:N #1 } { commalist } { \clist_new:N #1 } @@ -1633,29 +1637,29 @@ { real } { \fp_new:N #1 } { tokenlist } { \tl_new:N #1 } } - { \use:c { \l_xtemplate_keytype_tl _ new:N } #1 } + { \use:c { \l_@@_keytype_tl _ new:N } #1 } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_implement_choices:n} -% \begin{macro}[aux]{\xtemplate_implement_choices_default:} +% \begin{macro}{\@@_implement_choices:n} +% \begin{macro}[aux]{\@@_implement_choices_default:} % Implementing choices requires a second key--value loop. So after a % little set-up, the standard parser is called. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_implement_choices:n #1 +\cs_new_protected:Npn \@@_implement_choices:n #1 { - \clist_set_eq:NN \l_xtemplate_tmp_clist \l_xtemplate_keytype_arg_tl - \prop_put:Non \l_xtemplate_vars_prop \l_xtemplate_key_name_tl { } + \clist_set_eq:NN \l_@@_tmp_clist \l_@@_keytype_arg_tl + \prop_put:Non \l_@@_vars_prop \l_@@_key_name_tl { } \keyval_parse:NNn - \xtemplate_implement_choice_elt:n \xtemplate_implement_choice_elt:nn + \@@_implement_choice_elt:n \@@_implement_choice_elt:nn {#1} - \prop_get:NoNT \l_xtemplate_values_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - { \xtemplate_implement_choices_default: } - \clist_if_empty:NF \l_xtemplate_tmp_clist + \prop_get:NoNT \l_@@_values_prop \l_@@_key_name_tl + \l_@@_tmp_tl + { \@@_implement_choices_default: } + \clist_if_empty:NF \l_@@_tmp_clist { - \clist_map_inline:Nn \l_xtemplate_tmp_clist + \clist_map_inline:Nn \l_@@_tmp_clist { \msg_error:nnx { xtemplate } { choice-not-implemented } {##1} @@ -1666,24 +1670,24 @@ % A sanity check for the default value, so that an error is raised % now and not when converting to assignments. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_implement_choices_default: +\cs_new_protected_nopar:Npn \@@_implement_choices_default: { - \tl_set:Nx \l_xtemplate_tmp_tl - { \l_xtemplate_key_name_tl \c_space_tl \l_xtemplate_tmp_tl } - \prop_if_in:NoF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl + \tl_set:Nx \l_@@_tmp_tl + { \l_@@_key_name_tl \c_space_tl \l_@@_tmp_tl } + \prop_if_in:NoF \l_@@_vars_prop \l_@@_tmp_tl { - \tl_set:Nx \l_xtemplate_tmp_tl - { \l_xtemplate_key_name_tl \c_space_tl \l_xtemplate_tmp_tl } - \prop_if_in:NoF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl + \tl_set:Nx \l_@@_tmp_tl + { \l_@@_key_name_tl \c_space_tl \l_@@_tmp_tl } + \prop_if_in:NoF \l_@@_vars_prop \l_@@_tmp_tl { - \prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - \xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl - \prop_get:NoN \l_xtemplate_values_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl + \prop_get:NoN \l_@@_keytypes_prop \l_@@_key_name_tl + \l_@@_tmp_tl + \@@_split_keytype_arg:o \l_@@_tmp_tl + \prop_get:NoN \l_@@_values_prop \l_@@_key_name_tl + \l_@@_tmp_tl \msg_error:nnxxx { xtemplate } { unknown-default-choice } - { \l_xtemplate_key_name_tl } { \l_xtemplate_key_name_tl } - { \l_xtemplate_keytype_arg_tl } + { \l_@@_key_name_tl } { \l_@@_key_name_tl } + { \l_@@_keytype_arg_tl } } } } @@ -1691,47 +1695,47 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_implement_choice_elt:n} -% \begin{macro}{\xtemplate_implement_choice_elt:nn} +% \begin{macro}{\@@_implement_choice_elt:n} +% \begin{macro}{\@@_implement_choice_elt:nn} % The actual storage of the implementation of a choice is mainly about % error checking. The code here ensures that all choices have to have % been declared, apart from the special \texttt{unknown} choice, which % must come last. The code for each choice is stored along with the % key name in the variables property list. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_implement_choice_elt:n #1 +\cs_new_protected:Npn \@@_implement_choice_elt:n #1 { - \clist_if_empty:NTF \l_xtemplate_tmp_clist + \clist_if_empty:NTF \l_@@_tmp_clist { \str_if_eq:nnF {#1} { unknown } { - \prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - \xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl + \prop_get:NoN \l_@@_keytypes_prop \l_@@_key_name_tl + \l_@@_tmp_tl + \@@_split_keytype_arg:o \l_@@_tmp_tl \msg_error:nnxxx { xtemplate } { unknown-choice } - { \l_xtemplate_key_name_tl } {#1} - { \l_xtemplate_keytype_arg_tl } + { \l_@@_key_name_tl } {#1} + { \l_@@_keytype_arg_tl } } } { - \clist_if_in:NnTF \l_xtemplate_tmp_clist {#1} - { \clist_remove_all:Nn \l_xtemplate_tmp_clist {#1} } + \clist_if_in:NnTF \l_@@_tmp_clist {#1} + { \clist_remove_all:Nn \l_@@_tmp_clist {#1} } { - \prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - \xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl + \prop_get:NoN \l_@@_keytypes_prop \l_@@_key_name_tl + \l_@@_tmp_tl + \@@_split_keytype_arg:o \l_@@_tmp_tl \msg_error:nnxxx { xtemplate } { unknown-choice } - { \l_xtemplate_key_name_tl } {#1} - { \l_xtemplate_keytype_arg_tl } + { \l_@@_key_name_tl } {#1} + { \l_@@_keytype_arg_tl } } } } -\cs_new_protected:Npn \xtemplate_implement_choice_elt:nn #1#2 +\cs_new_protected:Npn \@@_implement_choice_elt:nn #1#2 { - \xtemplate_implement_choice_elt:n {#1} - \tl_set:Nx \l_xtemplate_tmp_tl - { \l_xtemplate_key_name_tl \c_space_tl #1 } - \prop_put:Non \l_xtemplate_vars_prop \l_xtemplate_tmp_tl {#2} + \@@_implement_choice_elt:n {#1} + \tl_set:Nx \l_@@_tmp_tl + { \l_@@_key_name_tl \c_space_tl #1 } + \prop_put:Non \l_@@_vars_prop \l_@@_tmp_tl {#2} } % \end{macrocode} % \end{macro} @@ -1744,135 +1748,135 @@ % In the later case, a new template results, whereas simple editing % does not produce a new template name. % -% \begin{macro}{\xtemplate_declare_restricted:nnnn} +% \begin{macro}{\@@_declare_restricted:nnnn} % Creating a restricted template means copying the old template to the % new one first. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_declare_restricted:nnnn #1#2#3#4 +\cs_new_protected:Npn \@@_declare_restricted:nnnn #1#2#3#4 { - \xtemplate_if_keys_exist:nnT {#1} {#2} + \@@_if_keys_exist:nnT {#1} {#2} { - \xtemplate_set_template_eq:nn { #1 / #3 } { #1 / #2 } - \bool_set_true:N \l_xtemplate_restrict_bool - \xtemplate_edit_defaults_aux:nnn {#1} {#3} {#4} + \@@_set_template_eq:nn { #1 / #3 } { #1 / #2 } + \bool_set_true:N \l_@@_restrict_bool + \@@_edit_defaults_aux:nnn {#1} {#3} {#4} } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_edit_defaults:nnn} -% \begin{macro}[aux]{\xtemplate_edit_defaults_aux:nnn} +% \begin{macro}{\@@_edit_defaults:nnn} +% \begin{macro}[aux]{\@@_edit_defaults_aux:nnn} % Editing the template defaults means getting the values back out % of the store, then parsing the list of new values before putting % the updated list back into storage. The auxiliary function is used % to allow code-sharing with the template-restriction system. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_edit_defaults:nnn +\cs_new_protected:Npn \@@_edit_defaults:nnn { - \bool_set_false:N \l_xtemplate_restrict_bool - \xtemplate_edit_defaults_aux:nnn + \bool_set_false:N \l_@@_restrict_bool + \@@_edit_defaults_aux:nnn } -\cs_new_protected:Npn \xtemplate_edit_defaults_aux:nnn #1#2#3 +\cs_new_protected:Npn \@@_edit_defaults_aux:nnn #1#2#3 { - \xtemplate_if_keys_exist:nnT {#1} {#2} + \@@_if_keys_exist:nnT {#1} {#2} { - \xtemplate_recover_defaults:n { #1 / #2 } - \xtemplate_recover_restrictions:n { #1 / #2 } - \xtemplate_parse_values:nn { #1 / #2 } {#3} - \xtemplate_store_defaults:n { #1 / #2 } - \xtemplate_store_restrictions:n { #1 / #2 } + \@@_recover_defaults:n { #1 / #2 } + \@@_recover_restrictions:n { #1 / #2 } + \@@_parse_values:nn { #1 / #2 } {#3} + \@@_store_defaults:n { #1 / #2 } + \@@_store_restrictions:n { #1 / #2 } } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_parse_values:nn} +% \begin{macro}{\@@_parse_values:nn} % The routine to parse values is the same for both editing a % template and setting up an instance. So the code here does only the % minimum necessary for reading the values. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_parse_values:nn #1#2 +\cs_new_protected:Npn \@@_parse_values:nn #1#2 { - \xtemplate_recover_keytypes:n {#1} - \clist_clear:N \l_xtemplate_restrict_clist + \@@_recover_keytypes:n {#1} + \clist_clear:N \l_@@_restrict_clist \keyval_parse:NNn - \xtemplate_parse_values_elt:n \xtemplate_parse_values_elt:nn {#2} + \@@_parse_values_elt:n \@@_parse_values_elt:nn {#2} } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_parse_values_elt:n} +% \begin{macro}{\@@_parse_values_elt:n} % Every key needs a value, so this is just an error routine. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_parse_values_elt:n #1 +\cs_new_protected:Npn \@@_parse_values_elt:n #1 { - \bool_set_true:N \l_xtemplate_error_bool + \bool_set_true:N \l_@@_error_bool \msg_error:nnx { xtemplate } { key-no-value } {#1} } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_parse_values_elt:nn} -% \begin{macro}[aux]{\xtemplate_parse_values_elt_aux:n} +% \begin{macro}{\@@_parse_values_elt:nn} +% \begin{macro}[aux]{\@@_parse_values_elt_aux:n} % To store the value, find the keytype then call the saving function. -% These need the current key name saved as \cs{l_xtemplate_key_name_tl}. +% These need the current key name saved as \cs{l_@@_key_name_tl}. % When a template is being restricted, the setting code will be % skipped for restricted keys. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_parse_values_elt:nn #1#2 +\cs_new_protected:Npn \@@_parse_values_elt:nn #1#2 { - \tl_set:Nx \l_xtemplate_key_name_tl { \tl_to_str:n {#1} } - \tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ } - \prop_get:NoNTF \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl + \tl_set:Nx \l_@@_key_name_tl { \tl_to_str:n {#1} } + \tl_remove_all:Nn \l_@@_key_name_tl { ~ } + \prop_get:NoNTF \l_@@_keytypes_prop \l_@@_key_name_tl + \l_@@_tmp_tl { - \bool_if:NTF \l_xtemplate_restrict_bool + \bool_if:NTF \l_@@_restrict_bool { - \clist_if_in:NoF \l_xtemplate_restrict_clist - \l_xtemplate_key_name_tl - { \xtemplate_parse_values_elt_aux:n {#2} } + \clist_if_in:NoF \l_@@_restrict_clist + \l_@@_key_name_tl + { \@@_parse_values_elt_aux:n {#2} } } - { \xtemplate_parse_values_elt_aux:n {#2} } + { \@@_parse_values_elt_aux:n {#2} } } { \msg_error:nnx { xtemplate } { unknown-key } - { \l_xtemplate_key_name_tl } + { \l_@@_key_name_tl } } } -\cs_new_protected:Npn \xtemplate_parse_values_elt_aux:n #1 +\cs_new_protected:Npn \@@_parse_values_elt_aux:n #1 { - \clist_put_right:No \l_xtemplate_restrict_clist \l_xtemplate_key_name_tl - \xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl - \use:c { xtemplate_store_value_ \l_xtemplate_keytype_tl :n } {#1} + \clist_put_right:No \l_@@_restrict_clist \l_@@_key_name_tl + \@@_split_keytype_arg:o \l_@@_tmp_tl + \use:c { @@_store_value_ \l_@@_keytype_tl :n } {#1} } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_set_template_eq:nn} +% \begin{macro}{\@@_set_template_eq:nn} % To copy a template, each of the lists plus the code has to be copied % across. To keep this independent of the list storage system, it is % all done with two-part shuffles. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_set_template_eq:nn #1#2 +\cs_new_protected:Npn \@@_set_template_eq:nn #1#2 { - \xtemplate_recover_defaults:n {#2} - \xtemplate_store_defaults:n {#1} - \xtemplate_recover_keytypes:n {#2} - \xtemplate_store_keytypes:n {#1} - \xtemplate_recover_vars:n {#2} - \xtemplate_store_vars:n {#1} - \cs_gset_eq:cc { \c_xtemplate_code_root_tl #1 } - { \c_xtemplate_code_root_tl #2 } + \@@_recover_defaults:n {#2} + \@@_store_defaults:n {#1} + \@@_recover_keytypes:n {#2} + \@@_store_keytypes:n {#1} + \@@_recover_vars:n {#2} + \@@_store_vars:n {#1} + \cs_gset_eq:cc { \c_@@_code_root_tl #1 } + { \c_@@_code_root_tl #2 } } % \end{macrocode} % \end{macro} % %\subsection{Creating instances of templates} % -% \begin{macro}{\xtemplate_declare_instance:nnnnn} -% \begin{macro}[aux]{\xtemplate_declare_instance_aux:nnnnn} +% \begin{macro}{\@@_declare_instance:nnnnn} +% \begin{macro}[aux]{\@@_declare_instance_aux:nnnnn} % Making an instance has two distinct parts. First, the keys given are % parsed to transfer the values into the structured data format used % internally. This allows the default and given values to be combined @@ -1881,35 +1885,35 @@ % in the function for the instance. A final check is also made so that % there is always an instance \enquote{outside} of any collection. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_declare_instance:nnnnn #1#2#3#4#5 +\cs_new_protected:Npn \@@_declare_instance:nnnnn #1#2#3#4#5 { - \xtemplate_execute_if_code_exist:nnT {#1} {#2} + \@@_execute_if_code_exist:nnT {#1} {#2} { - \xtemplate_recover_defaults:n { #1 / #2 } - \xtemplate_recover_vars:n { #1 / #2 } - \xtemplate_declare_instance_aux:nnnnn {#1} {#2} {#3} {#4} {#5} + \@@_recover_defaults:n { #1 / #2 } + \@@_recover_vars:n { #1 / #2 } + \@@_declare_instance_aux:nnnnn {#1} {#2} {#3} {#4} {#5} } } -\cs_new_protected:Npn \xtemplate_declare_instance_aux:nnnnn #1#2#3#4#5 +\cs_new_protected:Npn \@@_declare_instance_aux:nnnnn #1#2#3#4#5 { - \bool_set_false:N \l_xtemplate_error_bool - \xtemplate_parse_values:nn { #1 / #2 } {#5} - \bool_if:NF \l_xtemplate_error_bool + \bool_set_false:N \l_@@_error_bool + \@@_parse_values:nn { #1 / #2 } {#5} + \bool_if:NF \l_@@_error_bool { - \prop_put:Nnn \l_xtemplate_values_prop { from~template } {#2} - \xtemplate_store_values:n { #1 / #3 / #4 } - \xtemplate_convert_to_assignments: - \cs_set_protected:cpx { \c_xtemplate_instances_root_tl #1 / #3 / #4 } + \prop_put:Nnn \l_@@_values_prop { from~template } {#2} + \@@_store_values:n { #1 / #3 / #4 } + \@@_convert_to_assignments: + \cs_set_protected:cpx { \c_@@_instances_root_tl #1 / #3 / #4 } { - \exp_not:N \xtemplate_assignments_push:n - { \exp_not:o \l_xtemplate_assignments_tl } - \exp_not:c { \c_xtemplate_code_root_tl #1 / #2 } + \exp_not:N \@@_assignments_push:n + { \exp_not:o \l_@@_assignments_tl } + \exp_not:c { \c_@@_code_root_tl #1 / #2 } } - \xtemplate_if_instance_exist:nnnF {#1} { } {#4} + \@@_if_instance_exist:nnnF {#1} { } {#4} { \cs_set_eq:cc - { \c_xtemplate_instances_root_tl #1 / / #4 } - { \c_xtemplate_instances_root_tl #1 / #3 / #4 } + { \c_@@_instances_root_tl #1 / / #4 } + { \c_@@_instances_root_tl #1 / #3 / #4 } } } } @@ -1917,21 +1921,21 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_edit_instance:nnnn} -% \begin{macro}[aux]{\xtemplate_edit_instance_aux:nnnnn} -% \begin{macro}[aux]{\xtemplate_edit_instance_aux:nonnn} +% \begin{macro}{\@@_edit_instance:nnnn} +% \begin{macro}[aux]{\@@_edit_instance_aux:nnnnn} +% \begin{macro}[aux]{\@@_edit_instance_aux:nonnn} % Editing an instance is almost identical to declaring one. The only % variation is the source of the values to use. When editing, they are % recovered from the previous instance run. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_edit_instance:nnnn #1#2#3 +\cs_new_protected:Npn \@@_edit_instance:nnnn #1#2#3 { - \xtemplate_if_instance_exist:nnnTF {#1} {#2} {#3} + \@@_if_instance_exist:nnnTF {#1} {#2} {#3} { - \xtemplate_recover_values:n { #1 / #2 / #3 } - \prop_get:NnN \l_xtemplate_values_prop { from~template } - \l_xtemplate_tmp_tl - \xtemplate_edit_instance_aux:nonnn {#1} \l_xtemplate_tmp_tl + \@@_recover_values:n { #1 / #2 / #3 } + \prop_get:NnN \l_@@_values_prop { from~template } + \l_@@_tmp_tl + \@@_edit_instance_aux:nonnn {#1} \l_@@_tmp_tl {#2} {#3} } { @@ -1939,36 +1943,36 @@ {#1} {#3} } } -\cs_new_protected:Npn \xtemplate_edit_instance_aux:nnnnn #1#2 +\cs_new_protected:Npn \@@_edit_instance_aux:nnnnn #1#2 { - \xtemplate_recover_vars:n { #1 / #2 } - \xtemplate_declare_instance_aux:nnnnn {#1} {#2} + \@@_recover_vars:n { #1 / #2 } + \@@_declare_instance_aux:nnnnn {#1} {#2} } -\cs_generate_variant:Nn \xtemplate_edit_instance_aux:nnnnn { no } +\cs_generate_variant:Nn \@@_edit_instance_aux:nnnnn { no } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_convert_to_assignments:} -% \begin{macro}[aux]{\xtemplate_convert_to_assignments_aux:n} -% \begin{macro}[aux]{\xtemplate_convert_to_assignments_aux:nn} -% \begin{macro}[aux]{\xtemplate_convert_to_assignments_aux:no} +% \begin{macro}{\@@_convert_to_assignments:} +% \begin{macro}[aux]{\@@_convert_to_assignments_aux:n} +% \begin{macro}[aux]{\@@_convert_to_assignments_aux:nn} +% \begin{macro}[aux]{\@@_convert_to_assignments_aux:no} % The idea on converting to a set of assignments is to loop over each % key, so that the loop order follows the declaration order of the keys. % This is done using a sequence as property lists are not % \enquote{ordered}. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_convert_to_assignments: +\cs_new_protected_nopar:Npn \@@_convert_to_assignments: { - \tl_clear:N \l_xtemplate_assignments_tl - \seq_map_function:NN \l_xtemplate_key_order_seq - \xtemplate_convert_to_assignments_aux:n + \tl_clear:N \l_@@_assignments_tl + \seq_map_function:NN \l_@@_key_order_seq + \@@_convert_to_assignments_aux:n } -\cs_new_protected:Npn \xtemplate_convert_to_assignments_aux:n #1 +\cs_new_protected:Npn \@@_convert_to_assignments_aux:n #1 { - \prop_get:NnN \l_xtemplate_keytypes_prop {#1} \l_xtemplate_tmp_tl - \xtemplate_convert_to_assignments_aux:no {#1} \l_xtemplate_tmp_tl + \prop_get:NnN \l_@@_keytypes_prop {#1} \l_@@_tmp_tl + \@@_convert_to_assignments_aux:no {#1} \l_@@_tmp_tl } % \end{macrocode} % The second auxiliary function actually does the work. The @@ -1979,48 +1983,48 @@ % global assignments. Once that is done, a hand-off can be made to the % handler for the relevant keytype. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_convert_to_assignments_aux:nn #1#2 +\cs_new_protected:Npn \@@_convert_to_assignments_aux:nn #1#2 { - \prop_get:NnNT \l_xtemplate_values_prop {#1} \l_xtemplate_value_tl + \prop_get:NnNT \l_@@_values_prop {#1} \l_@@_value_tl { - \prop_get:NnNTF \l_xtemplate_vars_prop {#1} \l_xtemplate_var_tl + \prop_get:NnNTF \l_@@_vars_prop {#1} \l_@@_var_tl { - \xtemplate_split_keytype_arg:n {#2} - \str_if_eq:onF \l_xtemplate_keytype_tl { choice } + \@@_split_keytype_arg:n {#2} + \str_if_eq:onF \l_@@_keytype_tl { choice } { - \str_if_eq:onF \l_xtemplate_keytype_tl { code } - { \xtemplate_find_global: } + \str_if_eq:onF \l_@@_keytype_tl { code } + { \@@_find_global: } } - \tl_set:Nn \l_xtemplate_key_name_tl {#1} - \use:c { xtemplate_assign_ \l_xtemplate_keytype_tl : } + \tl_set:Nn \l_@@_key_name_tl {#1} + \use:c { @@_assign_ \l_@@_keytype_tl : } } { \msg_error:nnx { xtemplate } { unknown-attribute } {#1} } } } -\cs_generate_variant:Nn \xtemplate_convert_to_assignments_aux:nn { no } +\cs_generate_variant:Nn \@@_convert_to_assignments_aux:nn { no } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_find_global:} -% \begin{macro}[aux]{\xtemplate_find_global_aux:w} +% \begin{macro}{\@@_find_global:} +% \begin{macro}[aux]{\@@_find_global_aux:w} % Global assignments should have the phrase |global| at the front. % This is pretty easy to find: no other error checking, though. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_find_global: +\cs_new_protected_nopar:Npn \@@_find_global: { - \bool_set_false:N \l_xtemplate_global_bool - \tl_if_in:onT \l_xtemplate_var_tl { global } + \bool_set_false:N \l_@@_global_bool + \tl_if_in:onT \l_@@_var_tl { global } { - \exp_after:wN \xtemplate_find_global_aux:w \l_xtemplate_var_tl \q_stop + \exp_after:wN \@@_find_global_aux:w \l_@@_var_tl \q_stop } } -\cs_new_protected:Npn \xtemplate_find_global_aux:w #1 global #2 \q_stop +\cs_new_protected:Npn \@@_find_global_aux:w #1 global #2 \q_stop { - \tl_set:Nn \l_xtemplate_var_tl {#2} - \bool_set_true:N \l_xtemplate_global_bool + \tl_set:Nn \l_@@_var_tl {#2} + \bool_set_true:N \l_@@_global_bool } % \end{macrocode} % \end{macro} @@ -2028,21 +2032,21 @@ % % \subsection{Using templates directly} % -% \begin{macro}{\xtemplate_use_template:nnn} +% \begin{macro}{\@@_use_template:nnn} % Directly use a template with a particular parameter setting. % This is also picked up if used in a nested fashion inside a parameter % list. The idea is essentially the same as creating an instance, % just with no saving of the result. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_use_template:nnn #1#2#3 +\cs_new_protected:Npn \@@_use_template:nnn #1#2#3 { - \xtemplate_execute_if_code_exist:nnT {#1} {#2} + \@@_execute_if_code_exist:nnT {#1} {#2} { - \xtemplate_recover_defaults:n { #1 / #2 } - \xtemplate_recover_vars:n { #1 / #2 } - \xtemplate_parse_values:nn { #1 / #2 } {#3} - \xtemplate_convert_to_assignments: - \use:c { \c_xtemplate_code_root_tl #1 / #2 } + \@@_recover_defaults:n { #1 / #2 } + \@@_recover_vars:n { #1 / #2 } + \@@_parse_values:nn { #1 / #2 } {#3} + \@@_convert_to_assignments: + \use:c { \c_@@_code_root_tl #1 / #2 } } } % \end{macrocode} @@ -2050,135 +2054,135 @@ % % \subsection{Assigning values to variables} % -% \begin{macro}{\xtemplate_assign_boolean:} -% \begin{macro}[aux]{\xtemplate_assign_boolean_aux:n} +% \begin{macro}{\@@_assign_boolean:} +% \begin{macro}[aux]{\@@_assign_boolean_aux:n} % Setting a Boolean value is slightly different to everything else % as the value can be used to work out which \texttt{set} function to % call. As long as there is no need to recover things from another % variable, everything is pretty easy. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_assign_boolean: +\cs_new_protected_nopar:Npn \@@_assign_boolean: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_boolean_aux:n { bool_gset } } - { \xtemplate_assign_boolean_aux:n { bool_set } } + \bool_if:NTF \l_@@_global_bool + { \@@_assign_boolean_aux:n { bool_gset } } + { \@@_assign_boolean_aux:n { bool_set } } } -\cs_new_protected_nopar:Npn \xtemplate_assign_boolean_aux:n #1 +\cs_new_protected_nopar:Npn \@@_assign_boolean_aux:n #1 { - \xtemplate_if_key_value:oT \l_xtemplate_value_tl - { \xtemplate_key_to_value: } - \tl_put_left:Nx \l_xtemplate_assignments_tl + \@@_if_key_value:oT \l_@@_value_tl + { \@@_key_to_value: } + \tl_put_left:Nx \l_@@_assignments_tl { - \exp_not:c { #1 _ \l_xtemplate_value_tl :N } - \exp_not:o \l_xtemplate_var_tl + \exp_not:c { #1 _ \l_@@_value_tl :N } + \exp_not:o \l_@@_var_tl } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_assign_choice:} +% \begin{macro}{\@@_assign_choice:} % \begin{macro}[aux] -% {\xtemplate_assign_choice_aux:n, \xtemplate_assign_choice_aux:o} +% {\@@_assign_choice_aux:n, \@@_assign_choice_aux:o} % The idea here is to find either the choice as-given or else the % special |unknown| choice, and to copy the appropriate code across. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_assign_choice: +\cs_new_protected_nopar:Npn \@@_assign_choice: { - \xtemplate_assign_choice_aux:xF - { \l_xtemplate_key_name_tl \c_space_tl \l_xtemplate_value_tl } + \@@_assign_choice_aux:xF + { \l_@@_key_name_tl \c_space_tl \l_@@_value_tl } { - \xtemplate_assign_choice_aux:xF - { \l_xtemplate_key_name_tl \c_space_tl unknown } + \@@_assign_choice_aux:xF + { \l_@@_key_name_tl \c_space_tl unknown } { - \prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - \xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl + \prop_get:NoN \l_@@_keytypes_prop \l_@@_key_name_tl + \l_@@_tmp_tl + \@@_split_keytype_arg:o \l_@@_tmp_tl \msg_error:nnxxx { xtemplate } { unknown-choice } - { \l_xtemplate_key_name_tl } { \l_xtemplate_value_tl } - { \l_xtemplate_keytype_arg_tl } + { \l_@@_key_name_tl } { \l_@@_value_tl } + { \l_@@_keytype_arg_tl } } } } -\cs_new_protected_nopar:Npn \xtemplate_assign_choice_aux:nF #1 +\cs_new_protected_nopar:Npn \@@_assign_choice_aux:nF #1 { \prop_get:NnNTF - \l_xtemplate_vars_prop + \l_@@_vars_prop {#1} - \l_xtemplate_tmp_tl - { \tl_put_right:No \l_xtemplate_assignments_tl \l_xtemplate_tmp_tl } + \l_@@_tmp_tl + { \tl_put_right:No \l_@@_assignments_tl \l_@@_tmp_tl } } -\cs_generate_variant:Nn \xtemplate_assign_choice_aux:nF { x } +\cs_generate_variant:Nn \@@_assign_choice_aux:nF { x } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_assign_code:} -% \begin{macro}{\xtemplate_assign_code:n} +% \begin{macro}{\@@_assign_code:} +% \begin{macro}{\@@_assign_code:n} % Assigning general code to a key needs a scratch function to be created % and run when \cs{AssignTemplateKeys} is called. So the appropriate % definition then use is created in the token list variable. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_assign_code: +\cs_new_protected_nopar:Npn \@@_assign_code: { - \tl_put_left:Nx \l_xtemplate_assignments_tl + \tl_put_left:Nx \l_@@_assignments_tl { - \cs_set_protected:Npn \xtemplate_assign_code:n \exp_not:n {##1} - { \exp_not:o \l_xtemplate_var_tl } - \xtemplate_assign_code:n { \exp_not:o \l_xtemplate_value_tl } + \cs_set_protected:Npn \@@_assign_code:n \exp_not:n {##1} + { \exp_not:o \l_@@_var_tl } + \@@_assign_code:n { \exp_not:o \l_@@_value_tl } } } -\cs_new_protected:Npn \xtemplate_assign_code:n #1 { } +\cs_new_protected:Npn \@@_assign_code:n #1 { } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_assign_function:} -% \begin{macro}[aux]{\xtemplate_assign_function_aux:N} +% \begin{macro}{\@@_assign_function:} +% \begin{macro}[aux]{\@@_assign_function_aux:N} % This looks a bit messy but is only actually one function. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_assign_function: +\cs_new_protected_nopar:Npn \@@_assign_function: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_function_aux:N \cs_gset:Npn } - { \xtemplate_assign_function_aux:N \cs_set:Npn } + \bool_if:NTF \l_@@_global_bool + { \@@_assign_function_aux:N \cs_gset:Npn } + { \@@_assign_function_aux:N \cs_set:Npn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_function_aux:N #1 +\cs_new_protected_nopar:Npn \@@_assign_function_aux:N #1 { - \tl_put_left:Nx \l_xtemplate_assignments_tl + \tl_put_left:Nx \l_@@_assignments_tl { \cs_generate_from_arg_count:NNnn - \exp_not:o \l_xtemplate_var_tl + \exp_not:o \l_@@_var_tl \exp_not:N #1 - { \exp_not:o \l_xtemplate_keytype_arg_tl } - { \exp_not:o \l_xtemplate_value_tl } + { \exp_not:o \l_@@_keytype_arg_tl } + { \exp_not:o \l_@@_value_tl } } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_assign_instance:} -% \begin{macro}[aux]{\xtemplate_assign_instance_aux:N} +% \begin{macro}{\@@_assign_instance:} +% \begin{macro}[aux]{\@@_assign_instance_aux:N} % Using an instance means adding the appropriate function creation to % the tl. No checks are made at this stage, so if the instance is % not valid then errors will arise later. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_assign_instance: +\cs_new_protected_nopar:Npn \@@_assign_instance: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_instance_aux:N \cs_gset_protected:Npn } - { \xtemplate_assign_instance_aux:N \cs_set_protected:Npn } + \bool_if:NTF \l_@@_global_bool + { \@@_assign_instance_aux:N \cs_gset_protected:Npn } + { \@@_assign_instance_aux:N \cs_set_protected:Npn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_instance_aux:N #1 +\cs_new_protected_nopar:Npn \@@_assign_instance_aux:N #1 { - \tl_put_left:Nx \l_xtemplate_assignments_tl + \tl_put_left:Nx \l_@@_assignments_tl { - \exp_not:N #1 \exp_not:o \l_xtemplate_var_tl + \exp_not:N #1 \exp_not:o \l_@@_var_tl { - \xtemplate_use_instance:nn - { \exp_not:o \l_xtemplate_keytype_arg_tl } - { \exp_not:o \l_xtemplate_value_tl } + \@@_use_instance:nn + { \exp_not:o \l_@@_keytype_arg_tl } + { \exp_not:o \l_@@_value_tl } } } } @@ -2186,43 +2190,43 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_assign_integer:} -% \begin{macro}{\xtemplate_assign_length:} -% \begin{macro}{\xtemplate_assign_muskip:} -% \begin{macro}{\xtemplate_assign_real:} -% \begin{macro}{\xtemplate_assign_skip:} +% \begin{macro}{\@@_assign_integer:} +% \begin{macro}{\@@_assign_length:} +% \begin{macro}{\@@_assign_muskip:} +% \begin{macro}{\@@_assign_real:} +% \begin{macro}{\@@_assign_skip:} % All of the calculated assignments use the same underlying code, with % only the low-level assignment function changing. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_assign_integer: +\cs_new_protected_nopar:Npn \@@_assign_integer: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_variable:N \int_gset:Nn } - { \xtemplate_assign_variable:N \int_set:Nn } + \bool_if:NTF \l_@@_global_bool + { \@@_assign_variable:N \int_gset:Nn } + { \@@_assign_variable:N \int_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_length: +\cs_new_protected_nopar:Npn \@@_assign_length: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_variable:N \dim_gset:Nn } - { \xtemplate_assign_variable:N \dim_set:Nn } + \bool_if:NTF \l_@@_global_bool + { \@@_assign_variable:N \dim_gset:Nn } + { \@@_assign_variable:N \dim_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_muskip: +\cs_new_protected_nopar:Npn \@@_assign_muskip: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_variable:N \muskip_gset:Nn } - { \xtemplate_assign_variable:N \muskip_set:Nn } + \bool_if:NTF \l_@@_global_bool + { \@@_assign_variable:N \muskip_gset:Nn } + { \@@_assign_variable:N \muskip_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_real: +\cs_new_protected_nopar:Npn \@@_assign_real: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_variable:N \fp_gset:Nn } - { \xtemplate_assign_variable:N \fp_set:Nn } + \bool_if:NTF \l_@@_global_bool + { \@@_assign_variable:N \fp_gset:Nn } + { \@@_assign_variable:N \fp_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_skip: +\cs_new_protected_nopar:Npn \@@_assign_skip: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_variable:N \skip_gset:Nn } - { \xtemplate_assign_variable:N \skip_set:Nn } + \bool_if:NTF \l_@@_global_bool + { \@@_assign_variable:N \skip_gset:Nn } + { \@@_assign_variable:N \skip_set:Nn } } % \end{macrocode} % \end{macro} @@ -2231,82 +2235,82 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_assign_tokenlist:} -% \begin{macro}[aux]{\xtemplate_assign_tokenlist_aux:N} +% \begin{macro}{\@@_assign_tokenlist:} +% \begin{macro}[aux]{\@@_assign_tokenlist_aux:N} % Storing lists of tokens is easy: no complex calculations and no % need to worry about numbers of arguments. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_assign_tokenlist: +\cs_new_protected_nopar:Npn \@@_assign_tokenlist: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_tokenlist_aux:N \tl_gset:Nn } - { \xtemplate_assign_tokenlist_aux:N \tl_set:Nn } + \bool_if:NTF \l_@@_global_bool + { \@@_assign_tokenlist_aux:N \tl_gset:Nn } + { \@@_assign_tokenlist_aux:N \tl_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_tokenlist_aux:N #1 +\cs_new_protected_nopar:Npn \@@_assign_tokenlist_aux:N #1 { - \xtemplate_if_key_value:oT \l_xtemplate_value_tl - { \xtemplate_key_to_value: } - \tl_put_left:Nx \l_xtemplate_assignments_tl + \@@_if_key_value:oT \l_@@_value_tl + { \@@_key_to_value: } + \tl_put_left:Nx \l_@@_assignments_tl { - #1 \exp_not:o \l_xtemplate_var_tl - { \exp_not:o \l_xtemplate_value_tl } + #1 \exp_not:o \l_@@_var_tl + { \exp_not:o \l_@@_value_tl } } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_assign_commalist:} +% \begin{macro}{\@@_assign_commalist:} % Very similar for commas lists, so some code is shared. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_assign_commalist: +\cs_new_protected_nopar:Npn \@@_assign_commalist: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_tokenlist_aux:N \clist_gset:Nn } - { \xtemplate_assign_tokenlist_aux:N \clist_set:Nn } + \bool_if:NTF \l_@@_global_bool + { \@@_assign_tokenlist_aux:N \clist_gset:Nn } + { \@@_assign_tokenlist_aux:N \clist_set:Nn } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_assign_variable:N} +% \begin{macro}{\@@_assign_variable:N} % A general-purpose function for all of the numerical assignments. % As long as the value is not coming from another variable, the stored % value is simply transferred for output. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_assign_variable:N #1 +\cs_new_protected_nopar:Npn \@@_assign_variable:N #1 { - \xtemplate_if_key_value:oT \l_xtemplate_value_tl - { \xtemplate_key_to_value: } - \tl_put_left:Nx \l_xtemplate_assignments_tl + \@@_if_key_value:oT \l_@@_value_tl + { \@@_key_to_value: } + \tl_put_left:Nx \l_@@_assignments_tl { - #1 \exp_not:o \l_xtemplate_var_tl - { \exp_not:o \l_xtemplate_value_tl } + #1 \exp_not:o \l_@@_var_tl + { \exp_not:o \l_@@_value_tl } } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_key_to_value:} -% \begin{macro}[aux]{\xtemplate_key_to_value_aux:w} +% \begin{macro}{\@@_key_to_value:} +% \begin{macro}[aux]{\@@_key_to_value_aux:w} % The idea here is to recover the attribute value of another key. To % do that, the marker is removed and a look up takes place. If this % is successful, then the name of the variable of the attribute is % returned. This assumes that the value will be used in context where % it will be converted to a value, for example when setting a number. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_key_to_value: - { \exp_after:wN \xtemplate_key_to_value_aux:w \l_xtemplate_value_tl } -\cs_new_protected:Npn \xtemplate_key_to_value_aux:w \KeyValue #1 +\cs_new_protected_nopar:Npn \@@_key_to_value: + { \exp_after:wN \@@_key_to_value_aux:w \l_@@_value_tl } +\cs_new_protected:Npn \@@_key_to_value_aux:w \KeyValue #1 { - \tl_set:Nx \l_xtemplate_tmp_tl { \tl_to_str:n {#1} } - \tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ } + \tl_set:Nx \l_@@_tmp_tl { \tl_to_str:n {#1} } + \tl_remove_all:Nn \l_@@_key_name_tl { ~ } \prop_get:NoNF - \l_xtemplate_vars_prop - \l_xtemplate_tmp_tl - \l_xtemplate_value_tl + \l_@@_vars_prop + \l_@@_tmp_tl + \l_@@_value_tl { \msg_error:nnx { xtemplate } { unknown-attribute } - { \l_xtemplate_tmp_tl } + { \l_@@_tmp_tl } } } % \end{macrocode} @@ -2315,9 +2319,9 @@ % % \subsection{Using instances} % -% \begin{macro}{\xtemplate_use_instance:nn} -% \begin{macro}[aux]{\xtemplate_use_instance_aux:nNnnn} -% \begin{macro}[aux]{\xtemplate_use_instance_aux:nn} +% \begin{macro}{\@@_use_instance:nn} +% \begin{macro}[aux]{\@@_use_instance_aux:nNnnn} +% \begin{macro}[aux]{\@@_use_instance_aux:nn} % Using an instance is just a question of finding the appropriate % function. There is the possibility that a collection instance exists, % so this is checked before trying the general instance. If nothing is @@ -2326,33 +2330,33 @@ % is also valid. There is an error-test to make sure that the % types agree, and if so the template is used directly. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_use_instance:nn #1#2 +\cs_new_protected:Npn \@@_use_instance:nn #1#2 { - \xtemplate_if_use_template:nTF {#2} - { \xtemplate_use_instance_aux:nNnnn {#1} #2 } - { \xtemplate_use_instance_aux:nn {#1} {#2} } + \@@_if_use_template:nTF {#2} + { \@@_use_instance_aux:nNnnn {#1} #2 } + { \@@_use_instance_aux:nn {#1} {#2} } } -\cs_new_protected:Npn \xtemplate_use_instance_aux:nNnnn #1#2#3#4#5 +\cs_new_protected:Npn \@@_use_instance_aux:nNnnn #1#2#3#4#5 { \str_if_eq:nnTF {#1} {#3} - { \xtemplate_use_template:nnn {#3} {#4} {#5} } + { \@@_use_template:nnn {#3} {#4} {#5} } { \msg_error:nnxx { xtemplate } { type-mismatch } {#1} {#3} } } -\cs_new_protected:Npn \xtemplate_use_instance_aux:nn #1#2 +\cs_new_protected:Npn \@@_use_instance_aux:nn #1#2 { - \xtemplate_get_collection:n {#1} - \xtemplate_if_instance_exist:nnnTF - {#1} { \l_xtemplate_collection_tl } {#2} + \@@_get_collection:n {#1} + \@@_if_instance_exist:nnnTF + {#1} { \l_@@_collection_tl } {#2} { \use:c { - \c_xtemplate_instances_root_tl #1 / - \l_xtemplate_collection_tl / #2 + \c_@@_instances_root_tl #1 / + \l_@@_collection_tl / #2 } } { - \xtemplate_if_instance_exist:nnnTF {#1} { } {#2} - { \use:c { \c_xtemplate_instances_root_tl #1 / / #2 } } + \@@_if_instance_exist:nnnTF {#1} { } {#2} + { \use:c { \c_@@_instances_root_tl #1 / / #2 } } { \msg_error:nnxx { xtemplate } { unknown-instance } {#1} {#2} @@ -2364,24 +2368,24 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\xtemplate_use_collection:nn} +% \begin{macro}{\@@_use_collection:nn} % Switching to an instance collection is just a question of setting the % appropriate list. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_use_collection:nn #1#2 - { \prop_put:Nnn \l_xtemplate_collections_prop {#1} {#2} } +\cs_new_protected:Npn \@@_use_collection:nn #1#2 + { \prop_put:Nnn \l_@@_collections_prop {#1} {#2} } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_get_collection:n} +% \begin{macro}{\@@_get_collection:n} % Recovering the collection for a given type is pretty easy: just a read % from the list. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_get_collection:n #1 +\cs_new_protected:Npn \@@_get_collection:n #1 { - \prop_get:NnNF \l_xtemplate_collections_prop {#1} - \l_xtemplate_collection_tl - { \tl_clear:N \l_xtemplate_collection_tl } + \prop_get:NnNF \l_@@_collections_prop {#1} + \l_@@_collection_tl + { \tl_clear:N \l_@@_collection_tl } } % \end{macrocode} % \end{macro} @@ -2391,76 +2395,76 @@ % A few functions to transfer assignments about, as this is needed by % \cs{AssignTemplateKeys}. % -% \begin{macro}{\xtemplate_assignments_pop:} +% \begin{macro}{\@@_assignments_pop:} % To actually use the assignments. % \begin{macrocode} -\cs_new_nopar:Npn \xtemplate_assignments_pop: { \l_xtemplate_assignments_tl } +\cs_new_nopar:Npn \@@_assignments_pop: { \l_@@_assignments_tl } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xtemplate_assignments_push:n} +% \begin{macro}{\@@_assignments_push:n} % Here, the assignments are stored for later use. % \begin{macrocode} -\cs_new_protected:Npn \xtemplate_assignments_push:n #1 - { \tl_set:Nn \l_xtemplate_assignments_tl {#1} } +\cs_new_protected:Npn \@@_assignments_push:n #1 + { \tl_set:Nn \l_@@_assignments_tl {#1} } % \end{macrocode} % \end{macro} % % \subsection{Showing templates and instances} % -% \begin{macro}{\xtemplate_show_code:nn} +% \begin{macro}{\@@_show_code:nn} % Showing the code for a template is just a translation of % \cs{cs_show:c}. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_show_code:nn #1#2 - { \cs_show:c { \c_xtemplate_code_root_tl #1 / #2 } } +\cs_new_protected_nopar:Npn \@@_show_code:nn #1#2 + { \cs_show:c { \c_@@_code_root_tl #1 / #2 } } % \end{macrocode} % \end{macro} % % \begin{macro} % { -% \xtemplate_show_defaults:nn, \xtemplate_show_keytypes:nn, -% \xtemplate_show_vars:nn +% \@@_show_defaults:nn, \@@_show_keytypes:nn, +% \@@_show_vars:nn % } -% \begin{macro}[int]{\xtemplate_show:Nnnn} +% \begin{macro}[int]{\@@_show:Nnnn} % A modified version of the property-list printing code, such that % the output refers to templates and instances rather than to the % underlying structures. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_show_defaults:nn #1#2 +\cs_new_protected_nopar:Npn \@@_show_defaults:nn #1#2 { - \xtemplate_if_keys_exist:nnT {#1} {#2} + \@@_if_keys_exist:nnT {#1} {#2} { - \xtemplate_recover_defaults:n { #1 / #2 } - \xtemplate_show:Nnnn \l_xtemplate_values_prop + \@@_recover_defaults:n { #1 / #2 } + \@@_show:Nnnn \l_@@_values_prop {#1} {#2} { default~values } } } -\cs_new_protected_nopar:Npn \xtemplate_show_keytypes:nn #1#2 +\cs_new_protected_nopar:Npn \@@_show_keytypes:nn #1#2 { - \xtemplate_if_keys_exist:nnT {#1} {#2} + \@@_if_keys_exist:nnT {#1} {#2} { - \xtemplate_recover_keytypes:n { #1 / #2 } - \xtemplate_show:Nnnn \l_xtemplate_keytypes_prop + \@@_recover_keytypes:n { #1 / #2 } + \@@_show:Nnnn \l_@@_keytypes_prop {#1} {#2} { interface } } } -\cs_new_protected_nopar:Npn \xtemplate_show_vars:nn #1#2 +\cs_new_protected_nopar:Npn \@@_show_vars:nn #1#2 { - \xtemplate_execute_if_code_exist:nnT {#1} {#2} + \@@_execute_if_code_exist:nnT {#1} {#2} { - \xtemplate_recover_vars:n { #1 / #2 } - \xtemplate_show:Nnnn \l_xtemplate_vars_prop + \@@_recover_vars:n { #1 / #2 } + \@@_show:Nnnn \l_@@_vars_prop {#1} {#2} { variable~mapping } } } -\cs_new_protected_nopar:Npn \xtemplate_show:Nnnn #1#2#3#4 +\cs_new_protected_nopar:Npn \@@_show:Nnnn #1#2#3#4 { - \msg_aux_use:nnxxxx { xtemplate } + \__msg_term:nnnnn { xtemplate } { \prop_if_empty:NTF #1 { show-no-attribute } { show-attribute } } - {#2} {#3} {#4} { } - \msg_aux_show:x - { \prop_map_function:NN #1 \msg_aux_show_unbraced:nn } + {#2} {#3} {#4} + \__msg_show_variable:x + { \prop_map_function:NN #1 \__msg_show_item_unbraced:nn } } % \end{macrocode} % \end{macro} @@ -2470,26 +2474,26 @@ % Instance values are a little more complex, as there are the collection % and template to consider. % \begin{macrocode} -\cs_new_protected_nopar:Npn \xtemplate_show_values:nnn #1#2#3 +\cs_new_protected_nopar:Npn \@@_show_values:nnn #1#2#3 { - \xtemplate_if_instance_exist:nnnT {#1} {#2} {#3} + \@@_if_instance_exist:nnnT {#1} {#2} {#3} { - \xtemplate_recover_values:n { #1 / #2 / #3 } - \prop_if_empty:NTF \l_xtemplate_values_prop + \@@_recover_values:n { #1 / #2 / #3 } + \prop_if_empty:NTF \l_@@_values_prop { - \msg_aux_use:nnxxxx { xtemplate } { show-no-values } - {#1} {#2} {#3} { } - \msg_aux_show:x { } + \__msg_term:nnnnn { xtemplate } { show-no-values } + {#1} {#2} {#3} + \__msg_show_variable:x { } } { - \prop_pop:NnN \l_xtemplate_values_prop { from~template } - \l_xtemplate_tmp_tl - \msg_aux_use:nnxxxx { xtemplate } { show-values } - {#1} {#2} {#3} { \l_xtemplate_tmp_tl } - \msg_aux_show:x + \prop_pop:NnN \l_@@_values_prop { from~template } + \l_@@_tmp_tl + \__msg_term:nnnnnV { xtemplate } { show-values } + {#1} {#2} {#3} \l_@@_tmp_tl + \__msg_show_variable:x { - \prop_map_function:NN \l_xtemplate_values_prop - \msg_aux_show_unbraced:nn + \prop_map_function:NN \l_@@_values_prop + \__msg_show_item_unbraced:nn } } } @@ -2702,7 +2706,7 @@ The~ \tl_if_empty:nF {#2} {collection~} instance~'#3'~ \tl_if_empty:nF {#2} { (from~collection~'#2')~ } of~object~type~'#1'~ - \quark_if_no_value:NF #4 { (from~template~'#4')~ } + \str_if_eq:nnF { \q_no_value } {#4} { (from~template~'#4')~ } has~values: } % \end{macrocode} @@ -2729,29 +2733,29 @@ % filtering. % \begin{macrocode} \cs_new_protected_nopar:Npn \DeclareObjectType #1#2 - { \xtemplate_declare_object_type:nn {#1} {#2} } + { \@@_declare_object_type:nn {#1} {#2} } \cs_new_protected:Npn \DeclareTemplateInterface #1#2#3#4 - { \xtemplate_declare_template_keys:nnnn {#1} {#2} {#3} {#4} } + { \@@_declare_template_keys:nnnn {#1} {#2} {#3} {#4} } \cs_new_protected:Npn \DeclareTemplateCode #1#2#3#4#5 - { \xtemplate_declare_template_code:nnnnn {#1} {#2} {#3} {#4} {#5} } + { \@@_declare_template_code:nnnnn {#1} {#2} {#3} {#4} {#5} } \cs_new_protected:Npn \DeclareRestrictedTemplate #1#2#3#4 - { \xtemplate_declare_restricted:nnnn {#1} {#2} {#3} {#4} } + { \@@_declare_restricted:nnnn {#1} {#2} {#3} {#4} } \cs_new_protected:Npn \DeclareInstance #1#2#3#4 - { \xtemplate_declare_instance:nnnnn {#1} {#3} { } {#2} {#4} } + { \@@_declare_instance:nnnnn {#1} {#3} { } {#2} {#4} } \cs_new_protected:Npn \DeclareCollectionInstance #1#2#3#4#5 - { \xtemplate_declare_instance:nnnnn {#2} {#4} {#1} {#3} {#5} } + { \@@_declare_instance:nnnnn {#2} {#4} {#1} {#3} {#5} } \cs_new_protected:Npn \EditTemplateDefaults #1#2#3 - { \xtemplate_edit_defaults:nnn {#1} {#2} {#3} } + { \@@_edit_defaults:nnn {#1} {#2} {#3} } \cs_new_protected:Npn \EditInstance #1#2#3 - { \xtemplate_edit_instance:nnnn {#1} { } {#2} {#3} } + { \@@_edit_instance:nnnn {#1} { } {#2} {#3} } \cs_new_protected:Npn \EditCollectionInstance #1#2#3#4 - { \xtemplate_edit_instance:nnnn {#2} {#1} {#3} {#4} } + { \@@_edit_instance:nnnn {#2} {#1} {#3} {#4} } \cs_new_protected_nopar:Npn \UseTemplate #1#2#3 - { \xtemplate_use_template:nnn {#1} {#2} {#3} } + { \@@_use_template:nnn {#1} {#2} {#3} } \cs_new_protected_nopar:Npn \UseInstance #1#2 - { \xtemplate_use_instance:nn {#1} {#2} } + { \@@_use_instance:nn {#1} {#2} } \cs_new_protected_nopar:Npn \UseCollection #1#2 - { \xtemplate_use_collection:nn {#1} {#2} } + { \@@_use_collection:nn {#1} {#2} } % \end{macrocode} % \end{macro} % \end{macro} @@ -2775,17 +2779,17 @@ % The show functions are again just translation. % \begin{macrocode} \cs_new_protected_nopar:Npn \ShowTemplateCode #1#2 - { \xtemplate_show_code:nn {#1} {#2} } + { \@@_show_code:nn {#1} {#2} } \cs_new_protected_nopar:Npn \ShowTemplateDefaults #1#2 - { \xtemplate_show_defaults:nn {#1} {#2} } + { \@@_show_defaults:nn {#1} {#2} } \cs_new_protected_nopar:Npn \ShowTemplateInterface #1#2 - { \xtemplate_show_keytypes:nn {#1} {#2} } + { \@@_show_keytypes:nn {#1} {#2} } \cs_new_protected_nopar:Npn \ShowTemplateVariables #1#2 - { \xtemplate_show_vars:nn {#1} {#2} } + { \@@_show_vars:nn {#1} {#2} } \cs_new_protected_nopar:Npn \ShowInstanceValues #1#2 - { \xtemplate_show_values:nnn {#1} { } {#2} } + { \@@_show_values:nnn {#1} { } {#2} } \cs_new_protected_nopar:Npn \ShowCollectionInstanceValues #1#2#3 - { \xtemplate_show_values:nnn {#1} {#2} {#3} } + { \@@_show_values:nnn {#1} {#2} {#3} } % \end{macrocode} % \end{macro} % \end{macro} @@ -2798,11 +2802,11 @@ % More direct translation: only the base instance is checked for. % \begin{macrocode} \cs_new_nopar:Npn \IfInstanceExistTF #1#2 - { \xtemplate_if_instance_exist:nnnTF {#1} { } {#2} } + { \@@_if_instance_exist:nnnTF {#1} { } {#2} } \cs_new_nopar:Npn \IfInstanceExistT #1#2 - { \xtemplate_if_instance_exist:nnnT {#1} { } {#2} } + { \@@_if_instance_exist:nnnT {#1} { } {#2} } \cs_new_nopar:Npn \IfInstanceExistF #1#2 - { \xtemplate_if_instance_exist:nnnF {#1} { } {#2} } + { \@@_if_instance_exist:nnnF {#1} { } {#2} } % \end{macrocode} % \end{macro} % @@ -2821,7 +2825,7 @@ % A short call to use a token register by proxy. % \begin{macrocode} \cs_new_protected_nopar:Npn \AssignTemplateKeys - { \xtemplate_assignments_pop: } + { \@@_assignments_pop: } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.ins b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.ins index 71fa6cc29f6..2679b22ae38 100644 --- a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.ins +++ b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.ins @@ -1,6 +1,6 @@ \iffalse meta-comment -File xtemplate.ins Copyright (C) 2000-2011 The LaTeX3 Project +File xtemplate.ins Copyright (C) 2000-2012 The LaTeX3 Project It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this @@ -16,7 +16,7 @@ The released version of this bundle is available from CTAN. \fi -\input docstrip.tex +\input l3docstrip.tex \askforoverwritefalse \preamble diff --git a/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty b/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty index 5d4ecde4e55..fdd3f37a919 100644 --- a/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty +++ b/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty @@ -46,30 +46,30 @@ %% %% ----------------------------------------------------------------------- %% -\RequirePackage{expl3}[2012/04/23] -\@ifpackagelater{expl3}{2012/04/23} +\RequirePackage{expl3}[2012/07/16] +\@ifpackagelater{expl3}{2012/07/16} {} - { + {% \PackageError{l3keys2e}{Support package l3kernel too old.} - { + {% Please install an up to date version of l3kernel using your TeX package manager or from CTAN.\\ \\ - Loading l3keys2e will abort! - } + Loading l3keys2e will abort!% + }% \endinput } \RequirePackage{xparse} -\GetIdInfo$Id: l3keys2e.dtx 3570 2012-04-23 13:24:55Z joseph $ +\GetIdInfo$Id: l3keys2e.dtx 3990 2012-07-16 07:46:03Z joseph $ {LaTeX2e option processing using LaTeX3 keys} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\clist_new:N \keys_latexe_options_clist -\bool_new:N \_l_keys_process_class_bool -\cs_new_protected:Npn \keys_latexe_options:n #1 +\clist_new:N \__keys_latexe_options_clist +\bool_new:N \l__keys_process_class_bool +\cs_new_protected:Npn \__keys_latexe_options:n #1 { - \clist_clear:N \keys_latexe_options_clist - \keys_latexe_options_global:n {#1} - \keys_latexe_options_local: + \clist_clear:N \__keys_latexe_options_clist + \__keys_latexe_options_global:n {#1} + \__keys_latexe_options_local: \keys_if_exist:nnF {#1} { unknown } { \keys_define:nn {#1} @@ -81,68 +81,68 @@ } } } - \keys_set:nV {#1} \keys_latexe_options_clist + \keys_set:nV {#1} \__keys_latexe_options_clist \AtEndOfPackage { \cs_set_eq:NN \@unprocessedoptions \scan_stop: } } -\cs_new_protected:Npn \keys_latexe_options_global:n #1 +\cs_new_protected:Npn \__keys_latexe_options_global:n #1 { \cs_if_eq:NNF \@classoptionslist \scan_stop: { \cs_if_eq:NNTF \@currext \@clsextension - { \keys_latexe_options_class:n {#1} } + { \__keys_latexe_options_class:n {#1} } { - \bool_if:NT \_l_keys_process_class_bool - { \keys_latexe_options_package:n {#1} } + \bool_if:NT \l__keys_process_class_bool + { \__keys_latexe_options_package:n {#1} } } } } -\cs_new_protected:Npn \keys_latexe_options_class:n #1 +\cs_new_protected:Npn \__keys_latexe_options_class:n #1 { \keys_if_exist:nnTF {#1} { unknown } - { \clist_put_right:No \keys_latexe_options_clist \@classoptionslist } + { \clist_put_right:No \__keys_latexe_options_clist \@classoptionslist } { \clist_map_inline:Nn \@classoptionslist { - \keys_if_exist:nnTF {#1} { \keys_latexe_remove_equals:n {##1} } - { \clist_put_right:Nn \keys_latexe_options_clist {##1} } + \keys_if_exist:nnTF {#1} { \__keys_latexe_remove_equals:n {##1} } + { \clist_put_right:Nn \__keys_latexe_options_clist {##1} } { \clist_put_right:Nn \@unusedoptionlist {##1} } } } } -\cs_new_protected:Npn \keys_latexe_options_package:n #1 +\cs_new_protected:Npn \__keys_latexe_options_package:n #1 { \clist_map_inline:Nn \@classoptionslist { - \keys_if_exist:nnT {#1} { \keys_latexe_remove_equals:n {##1} } + \keys_if_exist:nnT {#1} { \__keys_latexe_remove_equals:n {##1} } { - \clist_put_right:Nn \keys_latexe_options_clist {##1} + \clist_put_right:Nn \__keys_latexe_options_clist {##1} \clist_remove_all:Nn \@unusedoptionlist {##1} } } } -\cs_new_protected_nopar:Npn \keys_latexe_options_local: +\cs_new_protected_nopar:Npn \__keys_latexe_options_local: { \cs_if_eq:NNF \@currext \@clsextension { \cs_if_exist:cT { opt@ \@currname . \@currext } { - \exp_args:NNc \clist_put_right:NV \keys_latexe_options_clist + \exp_args:NNc \clist_put_right:NV \__keys_latexe_options_clist { opt@ \@currname . \@currext } } } } -\cs_new:Npn \keys_latexe_remove_equals:n #1 - { \keys_latexe_remove_equals:w #1 = \q_stop } -\cs_new:Npn \keys_latexe_remove_equals:w #1 = #2 \q_stop {#1} +\cs_new:Npn \__keys_latexe_remove_equals:n #1 + { \__keys_latexe_remove_equals:w #1 = \q_stop } +\cs_new:Npn \__keys_latexe_remove_equals:w #1 = #2 \q_stop {#1} \cs_new_protected_nopar:Npn \ProcessKeysOptions #1 { - \bool_set_true:N \_l_keys_process_class_bool - \keys_latexe_options:n {#1} + \bool_set_true:N \l__keys_process_class_bool + \__keys_latexe_options:n {#1} } \cs_new_protected_nopar:Npn \ProcessKeysPackageOptions #1 { - \bool_set_false:N \_l_keys_process_class_bool - \keys_latexe_options:n {#1} + \bool_set_false:N \l__keys_process_class_bool + \__keys_latexe_options:n {#1} } \@onlypreamble \ProcessKeysOptions \@onlypreamble \ProcessKeysPackageOptions diff --git a/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty b/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty index b9bee5a0762..989c77fde0a 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty @@ -14,7 +14,7 @@ %% Do not distribute a modified version of this file. %% %% File: xfrac.dtx Copyright (C) 2004, 2008-2010 Morten Hoegholm -%% (C) 2011 The LaTeX3 Project +%% (C) 2011,2012 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -48,7 +48,7 @@ %% ----------------------------------------------------------------------- %% \RequirePackage{amstext,graphicx,l3keys2e,textcomp,xparse,xtemplate} -\GetIdInfo$Id: xfrac.dtx 3465 2012-02-26 15:31:13Z bruno $ +\GetIdInfo$Id: xfrac.dtx 3875 2012-06-30 12:38:05Z joseph $ {L3 Experimental split-level fractions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -57,42 +57,42 @@ cm-recommended .choice:, cm-recommended / false .code:n = - { \bool_set_true:N \l_xfrac_cm_std_bool }, + { \bool_set_true:N \l__xfrac_cm_std_bool }, cm-recommended / true .code:n = - { \bool_set_false:N \l_xfrac_cm_std_bool }, + { \bool_set_false:N \l__xfrac_cm_std_bool }, cm-recommended .default:n = { true }, - cm-standard .bool_set:N = \l_xfrac_cm_std_bool + cm-standard .bool_set:N = \l__xfrac_cm_std_bool } \ProcessKeysOptions { xfrac } -\box_new:N \l_xfrac_slash_box -\box_new:N \l_xfrac_tmp_box -\cs_new:Npn \xfrac_tmp:w { } -\dim_new:N \l_xfrac_denominator_bot_sep_dim -\dim_new:N \l_xfrac_numerator_bot_sep_dim -\dim_new:N \l_xfrac_numerator_top_sep_dim -\dim_new:N \l_xfrac_slash_left_sep_dim -\dim_new:N \l_xfrac_slash_right_sep_dim -\muskip_new:N \l_xfrac_slash_left_muskip -\muskip_new:N \l_xfrac_slash_right_muskip -\fp_new:N \l_xfrac_hscale_fp -\fp_new:N \l_xfrac_scale_factor_fp -\fp_new:N \l_xfrac_vscale_fp -\tl_new:N \l_xfrac_denominator_font_tl -\tl_new:N \l_xfrac_numerator_font_tl -\tl_new:N \l_xfrac_phantom_tl -\tl_new:N \l_xfrac_slash_symbol_tl -\tl_new:N \l_xfrac_slash_symbol_font_tl -\cs_new_nopar:Npn \xfrac_fontscale: -\cs_new:Npn \xfrac_math:n #1 { } -\cs_new_nopar:Npn \xfrac_denominator_font_change: { } -\cs_new:Npn \xfrac_denominator_format:n #1 { } -\cs_new_nopar:Npn \xfrac_numerator_font_change: { } -\cs_new:Npn \xfrac_numerator_format:n #1 { } -\cs_new_nopar:Npn \xfrac_relscale: { } -\cs_new_nopar:Npn \xfrac_slash_symbol_font_change: { } -\cs_new:Npn \xfrac_slash_symbol_format:n #1 { } -\cs_new:Npn \xfrac_text_or_math:n #1 { } +\box_new:N \l__xfrac_slash_box +\box_new:N \l__xfrac_tmp_box +\cs_new:Npn \__xfrac_tmp:w { } +\dim_new:N \l__xfrac_denominator_bot_sep_dim +\dim_new:N \l__xfrac_numerator_bot_sep_dim +\dim_new:N \l__xfrac_numerator_top_sep_dim +\dim_new:N \l__xfrac_slash_left_sep_dim +\dim_new:N \l__xfrac_slash_right_sep_dim +\muskip_new:N \l__xfrac_slash_left_muskip +\muskip_new:N \l__xfrac_slash_right_muskip +\fp_new:N \l__xfrac_hscale_fp +\fp_new:N \l__xfrac_scale_factor_fp +\fp_new:N \l__xfrac_vscale_fp +\tl_new:N \l__xfrac_denominator_font_tl +\tl_new:N \l__xfrac_numerator_font_tl +\tl_new:N \l__xfrac_phantom_tl +\tl_new:N \l__xfrac_slash_symbol_tl +\tl_new:N \l__xfrac_slash_symbol_font_tl +\cs_new_nopar:Npn \__xfrac_fontscale: +\cs_new:Npn \__xfrac_math:n #1 { } +\cs_new_nopar:Npn \__xfrac_denominator_font_change: { } +\cs_new:Npn \__xfrac_denominator_format:n #1 { } +\cs_new_nopar:Npn \__xfrac_numerator_font_change: { } +\cs_new:Npn \__xfrac_numerator_format:n #1 { } +\cs_new_nopar:Npn \__xfrac_relscale: { } +\cs_new_nopar:Npn \__xfrac_slash_symbol_font_change: { } +\cs_new:Npn \__xfrac_slash_symbol_format:n #1 { } +\cs_new:Npn \__xfrac_text_or_math:n #1 { } \DeclareObjectType { xfrac } { 3 } \DeclareTemplateInterface { xfrac } { text } { 3 } { @@ -123,142 +123,142 @@ } \DeclareTemplateCode { xfrac } { text } { 3 } { - denominator-bot-sep = \l_xfrac_denominator_bot_sep_dim , - denominator-font = \l_xfrac_denominator_font_tl , - denominator-format = \xfrac_denominator_format:n , - h-scale = \l_xfrac_hscale_fp , + denominator-bot-sep = \l__xfrac_denominator_bot_sep_dim , + denominator-font = \l__xfrac_denominator_font_tl , + denominator-format = \__xfrac_denominator_format:n , + h-scale = \l__xfrac_hscale_fp , math-mode = { - false = \cs_set_eq:NN \xfrac_math:n \use:n, - true = \cs_set_eq:NN \xfrac_math:n \ensuremath + false = \cs_set_eq:NN \__xfrac_math:n \use:n, + true = \cs_set_eq:NN \__xfrac_math:n \ensuremath }, - numerator-font = \l_xfrac_numerator_font_tl , - numerator-format = \xfrac_numerator_format:n , - numerator-bot-sep = \l_xfrac_numerator_bot_sep_dim , - numerator-top-sep = \l_xfrac_numerator_top_sep_dim , - phantom = \l_xfrac_phantom_tl , - scale-factor = \l_xfrac_scale_factor_fp , + numerator-font = \l__xfrac_numerator_font_tl , + numerator-format = \__xfrac_numerator_format:n , + numerator-bot-sep = \l__xfrac_numerator_bot_sep_dim , + numerator-top-sep = \l__xfrac_numerator_top_sep_dim , + phantom = \l__xfrac_phantom_tl , + scale-factor = \l__xfrac_scale_factor_fp , scale-relative = { false = - \cs_set_nopar:Npn \xfrac_relscale: + \cs_set_nopar:Npn \__xfrac_relscale: { - \dim_eval:w - \box_ht:N \l_xfrac_tmp_box + \box_dp:N \l_xfrac_tmp_box - \dim_eval_end: + \__dim_eval:w + \box_ht:N \l__xfrac_tmp_box + \box_dp:N \l__xfrac_tmp_box + \__dim_eval_end: }, true = - \cs_set_nopar:Npn \xfrac_relscale: - { \box_ht:N \l_xfrac_slash_box } + \cs_set_nopar:Npn \__xfrac_relscale: + { \box_ht:N \l__xfrac_slash_box } }, scaling = { - false = \cs_set_eq:NN \xfrac_fontscale: \prg_do_nothing:, + false = \cs_set_eq:NN \__xfrac_fontscale: \prg_do_nothing:, true = - \cs_set_nopar:Npn \xfrac_fontscale: + \cs_set_nopar:Npn \__xfrac_fontscale: { \fontsize - { \fp_use:N \l_xfrac_scale_factor_fp \xfrac_relscale: } + { \fp_use:N \l__xfrac_scale_factor_fp \__xfrac_relscale: } { \c_zero_dim } \selectfont } }, - slash-left-kern = \l_xfrac_slash_left_sep_dim , - slash-left-mkern = \l_xfrac_slash_left_muskip , - slash-right-kern = \l_xfrac_slash_right_sep_dim , - slash-right-mkern = \l_xfrac_slash_right_muskip , - slash-symbol = \l_xfrac_slash_symbol_tl , - slash-symbol-font = \l_xfrac_slash_symbol_font_tl , - slash-symbol-format = \xfrac_slash_symbol_format:n , - v-scale = \l_xfrac_vscale_fp + slash-left-kern = \l__xfrac_slash_left_sep_dim , + slash-left-mkern = \l__xfrac_slash_left_muskip , + slash-right-kern = \l__xfrac_slash_right_sep_dim , + slash-right-mkern = \l__xfrac_slash_right_muskip , + slash-symbol = \l__xfrac_slash_symbol_tl , + slash-symbol-font = \l__xfrac_slash_symbol_font_tl , + slash-symbol-format = \__xfrac_slash_symbol_format:n , + v-scale = \l__xfrac_vscale_fp } { \AssignTemplateKeys \mode_if_math:TF { - \cs_set_eq:NN \xfrac_text_or_math:n \text - \cs_set_nopar:Npx \xfrac_denominator_font_change: - { \tex_fam:D \l_xfrac_denominator_font_tl } - \cs_set_nopar:Npx \xfrac_numerator_font_change: - { \tex_fam:D \l_xfrac_numerator_font_tl } - \cs_set_nopar:Npx \xfrac_slash_symbol_font_change: - { \tex_fam:D \l_xfrac_slash_symbol_font_tl } + \cs_set_eq:NN \__xfrac_text_or_math:n \text + \cs_set_nopar:Npx \__xfrac_denominator_font_change: + { \tex_fam:D \l__xfrac_denominator_font_tl } + \cs_set_nopar:Npx \__xfrac_numerator_font_change: + { \tex_fam:D \l__xfrac_numerator_font_tl } + \cs_set_nopar:Npx \__xfrac_slash_symbol_font_change: + { \tex_fam:D \l__xfrac_slash_symbol_font_tl } } { - \cs_set_eq:NN \xfrac_text_or_math:n \mbox - \cs_set_nopar:Npn \xfrac_denominator_font_change: + \cs_set_eq:NN \__xfrac_text_or_math:n \mbox + \cs_set_nopar:Npn \__xfrac_denominator_font_change: { - \fontfamily { \l_xfrac_denominator_font_tl } + \fontfamily { \l__xfrac_denominator_font_tl } \selectfont } - \cs_set_nopar:Npn \xfrac_numerator_font_change: + \cs_set_nopar:Npn \__xfrac_numerator_font_change: { - \fontfamily { \l_xfrac_numerator_font_tl } + \fontfamily { \l__xfrac_numerator_font_tl } \selectfont } - \cs_set_nopar:Npn \xfrac_slash_symbol_font_change: + \cs_set_nopar:Npn \__xfrac_slash_symbol_font_change: { - \fontfamily { \l_xfrac_slash_symbol_font_tl } + \fontfamily { \l__xfrac_slash_symbol_font_tl } \selectfont } } - \xfrac_text_or_math:n + \__xfrac_text_or_math:n { \m@th - \hbox_set:Nn \l_xfrac_tmp_box - { \xfrac_math:n { \vphantom { ( ) } } } - \hbox_set:Nn \l_xfrac_slash_box + \hbox_set:Nn \l__xfrac_tmp_box + { \__xfrac_math:n { \vphantom { ( ) } } } + \hbox_set:Nn \l__xfrac_slash_box { - \xfrac_math:n + \__xfrac_math:n { - \xfrac_slash_symbol_format:n + \__xfrac_slash_symbol_format:n { - \xfrac_math:n + \__xfrac_math:n { - \xfrac_slash_symbol_font_change: + \__xfrac_slash_symbol_font_change: \IfNoValueTF {#2} - { \l_xfrac_slash_symbol_tl } {#2} + { \l__xfrac_slash_symbol_tl } {#2} } } } } - \cs_set_nopar:Npn \xfrac_tmp:w + \cs_set_nopar:Npn \__xfrac_tmp:w { \raisebox { - \dim_eval:w - \box_ht:N \l_xfrac_slash_box - - \box_dp:N \l_xfrac_slash_box + \__dim_eval:w + \box_ht:N \l__xfrac_slash_box + - \box_dp:N \l__xfrac_slash_box - \height - \dim_eval_end: + \__dim_eval_end: } } \dim_compare:nNnTF - { \l_xfrac_numerator_top_sep_dim } = { \c_max_dim } + { \l__xfrac_numerator_top_sep_dim } = { \c_max_dim } { \dim_compare:nNnF - { \l_xfrac_numerator_bot_sep_dim } = { \c_max_dim } + { \l__xfrac_numerator_bot_sep_dim } = { \c_max_dim } { - \cs_set_nopar:Npn \xfrac_tmp:w + \cs_set_nopar:Npn \__xfrac_tmp:w { \raisebox - { \dim_use:N \l_xfrac_numerator_bot_sep_dim } + { \dim_use:N \l__xfrac_numerator_bot_sep_dim } } } } { \dim_compare:nNnTF - { \l_xfrac_numerator_bot_sep_dim } = { \c_max_dim } + { \l__xfrac_numerator_bot_sep_dim } = { \c_max_dim } { - \cs_set_nopar:Npn \xfrac_tmp:w + \cs_set_nopar:Npn \__xfrac_tmp:w { \raisebox { - \dim_eval:w - \box_ht:N \l_xfrac_slash_box - - \dim_use:N \l_xfrac_numerator_top_sep_dim + \__dim_eval:w + \box_ht:N \l__xfrac_slash_box + - \dim_use:N \l__xfrac_numerator_top_sep_dim - \height - \dim_eval_end: + \__dim_eval_end: } } } @@ -267,67 +267,67 @@ { over-specified-numerator-sep } } } - \xfrac_tmp:w + \__xfrac_tmp:w { - \xfrac_fontscale: - \xfrac_numerator_format:n + \__xfrac_fontscale: + \__xfrac_numerator_format:n { \scalebox - { \fp_use:N \l_xfrac_hscale_fp } - [ \fp_use:N \l_xfrac_vscale_fp ] + { \fp_use:N \l__xfrac_hscale_fp } + [ \fp_use:N \l__xfrac_vscale_fp ] { - \xfrac_math:n + \__xfrac_math:n { - \xfrac_numerator_font_change: + \__xfrac_numerator_font_change: { - \vphantom { \l_xfrac_phantom_tl } + \vphantom { \l__xfrac_phantom_tl } #1 } } } } } - \xfrac_math:n + \__xfrac_math:n { % THIS IS JUST WRONG! \scan_align_safe_stop: \mode_if_math:TF - { \tex_mskip:D \l_xfrac_slash_right_muskip } - { \tex_hskip:D \l_xfrac_slash_right_sep_dim } + { \tex_mskip:D \l__xfrac_slash_right_muskip } + { \tex_hskip:D \l__xfrac_slash_right_sep_dim } } - \box_use:N \l_xfrac_slash_box - \xfrac_math:n + \box_use:N \l__xfrac_slash_box + \__xfrac_math:n { \mode_if_math:TF - { \tex_mskip:D \l_xfrac_slash_left_muskip } - { \tex_hskip:D \l_xfrac_slash_left_sep_dim } + { \tex_mskip:D \l__xfrac_slash_left_muskip } + { \tex_hskip:D \l__xfrac_slash_left_sep_dim } } \dim_compare:nNnTF - { \l_xfrac_denominator_bot_sep_dim } = { \c_max_dim } + { \l__xfrac_denominator_bot_sep_dim } = { \c_max_dim } { - \cs_set_nopar:Npn \xfrac_tmp:w - { \raisebox { - \box_dp:N \l_xfrac_slash_box } } + \cs_set_nopar:Npn \__xfrac_tmp:w + { \raisebox { - \box_dp:N \l__xfrac_slash_box } } } { - \cs_set_nopar:Npn \xfrac_tmp:w + \cs_set_nopar:Npn \__xfrac_tmp:w { \raisebox - { \dim_use:N \l_xfrac_denominator_bot_sep_dim } + { \dim_use:N \l__xfrac_denominator_bot_sep_dim } } } - \xfrac_tmp:w + \__xfrac_tmp:w { - \xfrac_fontscale: - \xfrac_denominator_format:n + \__xfrac_fontscale: + \__xfrac_denominator_format:n { \scalebox - { \fp_use:N \l_xfrac_hscale_fp } - [ \fp_use:N \l_xfrac_vscale_fp ] + { \fp_use:N \l__xfrac_hscale_fp } + [ \fp_use:N \l__xfrac_vscale_fp ] { - \xfrac_math:n + \__xfrac_math:n { - \xfrac_denominator_font_change: + \__xfrac_denominator_font_change: { - \vphantom { \l_xfrac_phantom_tl } + \vphantom { \l__xfrac_phantom_tl } #3 } } @@ -384,7 +384,7 @@ slash-left-kern = -0.1 em , slash-right-kern = -0.1 em } -\bool_if:NF \l_xfrac_cm_std_bool +\bool_if:NF \l__xfrac_cm_std_bool { \DeclareInstance { xfrac } { cmr } { text } { slash-symbol-font = ptm } 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 } { diff --git a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty index be5aca383b4..bda0b918cce 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty @@ -50,191 +50,191 @@ %% %% ----------------------------------------------------------------------- %% -\RequirePackage{expl3}[2012/04/23] -\@ifpackagelater{expl3}{2012/04/23} +\RequirePackage{expl3}[2012/07/16] +\@ifpackagelater{expl3}{2012/07/16} {} - { + {% \PackageError{xtemplate}{Support package l3kernel too old.} - { + {% Please install an up to date version of l3kernel using your TeX package manager or from CTAN.\\ \\ - Loading xtemplate will abort! - } + Loading xtemplate will abort!% + }% \endinput } -\GetIdInfo$Id: xtemplate.dtx 3570 2012-04-23 13:24:55Z joseph $ +\GetIdInfo$Id: xtemplate.dtx 3990 2012-07-16 07:46:03Z joseph $ {L3 Experimental prototype document functions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\tl_const:Nn \c_xtemplate_code_root_tl { template~code~>~ } -\tl_const:Nn \c_xtemplate_defaults_root_tl { template~defaults~>~ } -\tl_const:Nn \c_xtemplate_instances_root_tl { template~instance~>~ } -\tl_const:Nn \c_xtemplate_keytypes_root_tl { template~key~types~>~ } -\tl_const:Nn \c_xtemplate_key_order_root_tl { template~key~order~>~ } -\tl_const:Nn \c_xtemplate_restrict_root_tl { template~restrictions~>~ } -\tl_const:Nn \c_xtemplate_values_root_tl { template~values~>~ } -\tl_const:Nn \c_xtemplate_vars_root_tl { template~vars~>~ } -\seq_new:N \c_xtemplate_keytypes_arg_seq -\seq_put_right:Nn \c_xtemplate_keytypes_arg_seq { choice } -\seq_put_right:Nn \c_xtemplate_keytypes_arg_seq { function } -\seq_put_right:Nn \c_xtemplate_keytypes_arg_seq { instance } -\prop_new:N \g_xtemplate_object_type_prop -\tl_new:N \l_xtemplate_assignments_tl -\tl_new:N \l_xtemplate_collection_tl -\prop_new:N \l_xtemplate_collections_prop -\tl_new:N \l_xtemplate_default_tl -\bool_new:N \l_xtemplate_error_bool -\bool_new:N \l_xtemplate_global_bool -\bool_new:N \l_xtemplate_restrict_bool -\clist_new:N \l_xtemplate_restrict_clist -\tl_new:N \l_xtemplate_key_name_tl -\tl_new:N \l_xtemplate_keytype_tl -\tl_new:N \l_xtemplate_keytype_arg_tl -\tl_new:N \l_xtemplate_value_tl -\tl_new:N \l_xtemplate_var_tl -\prop_new:N \l_xtemplate_keytypes_prop -\seq_new:N \l_xtemplate_key_order_seq -\prop_new:N \l_xtemplate_values_prop -\prop_new:N \l_xtemplate_vars_prop -\clist_new:N \l_xtemplate_tmp_clist -\dim_new:N \l_xtemplate_tmp_dim -\int_new:N \l_xtemplate_tmp_int -\muskip_new:N \l_xtemplate_tmp_muskip -\skip_new:N \l_xtemplate_tmp_skip -\tl_new:N \l_xtemplate_tmp_tl +\tl_const:Nn \c__xtemplate_code_root_tl { template~code~>~ } +\tl_const:Nn \c__xtemplate_defaults_root_tl { template~defaults~>~ } +\tl_const:Nn \c__xtemplate_instances_root_tl { template~instance~>~ } +\tl_const:Nn \c__xtemplate_keytypes_root_tl { template~key~types~>~ } +\tl_const:Nn \c__xtemplate_key_order_root_tl { template~key~order~>~ } +\tl_const:Nn \c__xtemplate_restrict_root_tl { template~restrictions~>~ } +\tl_const:Nn \c__xtemplate_values_root_tl { template~values~>~ } +\tl_const:Nn \c__xtemplate_vars_root_tl { template~vars~>~ } +\seq_new:N \c__xtemplate_keytypes_arg_seq +\seq_put_right:Nn \c__xtemplate_keytypes_arg_seq { choice } +\seq_put_right:Nn \c__xtemplate_keytypes_arg_seq { function } +\seq_put_right:Nn \c__xtemplate_keytypes_arg_seq { instance } +\prop_new:N \g__xtemplate_object_type_prop +\tl_new:N \l__xtemplate_assignments_tl +\tl_new:N \l__xtemplate_collection_tl +\prop_new:N \l__xtemplate_collections_prop +\tl_new:N \l__xtemplate_default_tl +\bool_new:N \l__xtemplate_error_bool +\bool_new:N \l__xtemplate_global_bool +\bool_new:N \l__xtemplate_restrict_bool +\clist_new:N \l__xtemplate_restrict_clist +\tl_new:N \l__xtemplate_key_name_tl +\tl_new:N \l__xtemplate_keytype_tl +\tl_new:N \l__xtemplate_keytype_arg_tl +\tl_new:N \l__xtemplate_value_tl +\tl_new:N \l__xtemplate_var_tl +\prop_new:N \l__xtemplate_keytypes_prop +\seq_new:N \l__xtemplate_key_order_seq +\prop_new:N \l__xtemplate_values_prop +\prop_new:N \l__xtemplate_vars_prop +\clist_new:N \l__xtemplate_tmp_clist +\dim_new:N \l__xtemplate_tmp_dim +\int_new:N \l__xtemplate_tmp_int +\muskip_new:N \l__xtemplate_tmp_muskip +\skip_new:N \l__xtemplate_tmp_skip +\tl_new:N \l__xtemplate_tmp_tl \cs_generate_variant:Nn \prop_get:NnNTF { No } \cs_generate_variant:Nn \prop_get:NnNT { No } \cs_generate_variant:Nn \prop_get:NnNF { No } -\cs_new_protected:Npn \xtemplate_execute_if_arg_agree:nnT #1#2#3 +\cs_new_protected:Npn \__xtemplate_execute_if_arg_agree:nnT #1#2#3 { - \prop_get:NnN \g_xtemplate_object_type_prop {#1} \l_xtemplate_tmp_tl - \int_compare:nNnTF {#2} = \l_xtemplate_tmp_tl + \prop_get:NnN \g__xtemplate_object_type_prop {#1} \l__xtemplate_tmp_tl + \int_compare:nNnTF {#2} = \l__xtemplate_tmp_tl {#3} { \msg_error:nnxxx { xtemplate } - { argument-number-mismatch } {#1} { \l_xtemplate_tmp_tl } {#2} + { argument-number-mismatch } {#1} { \l__xtemplate_tmp_tl } {#2} } } -\cs_new_protected:Npn \xtemplate_execute_if_code_exist:nnT #1#2#3 +\cs_new_protected:Npn \__xtemplate_execute_if_code_exist:nnT #1#2#3 { - \cs_if_exist:cTF { \c_xtemplate_code_root_tl #1 / #2 } + \cs_if_exist:cTF { \c__xtemplate_code_root_tl #1 / #2 } {#3} { \msg_error:nnxx { xtemplate } { no-template-code } {#1} {#2} } } -\cs_new_protected:Npn \xtemplate_execute_if_keytype_exist:nT #1#2 +\cs_new_protected:Npn \__xtemplate_execute_if_keytype_exist:nT #1#2 { - \cs_if_exist:cTF { xtemplate_store_value_ #1 :n } + \cs_if_exist:cTF { __xtemplate_store_value_ #1 :n } {#2} { \msg_error:nnx { xtemplate } { unknown-keytype } {#1} } } -\cs_generate_variant:Nn \xtemplate_execute_if_keytype_exist:nT { o } -\cs_new_protected:Npn \xtemplate_execute_if_type_exist:nT #1#2 +\cs_generate_variant:Nn \__xtemplate_execute_if_keytype_exist:nT { o } +\cs_new_protected:Npn \__xtemplate_execute_if_type_exist:nT #1#2 { - \prop_if_in:NnTF \g_xtemplate_object_type_prop {#1} + \prop_if_in:NnTF \g__xtemplate_object_type_prop {#1} {#2} { \msg_error:nnx { xtemplate } { unknown-object-type } {#1} } } -\cs_new_protected:Npn \xtemplate_if_keys_exist:nnT #1#2#3 +\cs_new_protected:Npn \__xtemplate_if_keys_exist:nnT #1#2#3 { - \cs_if_exist:cTF { \c_xtemplate_keytypes_root_tl #1 / #2 } + \cs_if_exist:cTF { \c__xtemplate_keytypes_root_tl #1 / #2 } {#3} { \msg_error:nnxx { xtemplate } { unknown-template } {#1} {#2} } } -\prg_new_conditional:Npnn \xtemplate_if_key_value:n #1 { T } +\prg_new_conditional:Npnn \__xtemplate_if_key_value:n #1 { T } { \str_if_eq:noTF { \KeyValue } { \tl_head:w #1 \q_nil \q_stop } {\prg_return_true: } { \prg_return_false: } } -\cs_generate_variant:Nn \xtemplate_if_key_value:nT { o } -\prg_new_conditional:Npnn \xtemplate_if_eval_now:n #1 { TF } +\cs_generate_variant:Nn \__xtemplate_if_key_value:nT { o } +\prg_new_conditional:Npnn \__xtemplate_if_eval_now:n #1 { TF } { \str_if_eq:noTF { \EvaluateNow } { \tl_head:w #1 \q_nil \q_stop } { \prg_return_true: } { \prg_return_false: } } -\prg_new_conditional:Npnn \xtemplate_if_instance_exist:nnn #1#2#3 +\prg_new_conditional:Npnn \__xtemplate_if_instance_exist:nnn #1#2#3 { T, F, TF } { - \cs_if_exist:cTF { \c_xtemplate_instances_root_tl #1 / #2 / #3 } + \cs_if_exist:cTF { \c__xtemplate_instances_root_tl #1 / #2 / #3 } { \prg_return_true: } { \prg_return_false: } } -\prg_new_conditional:Npnn \xtemplate_if_use_template:n #1 { TF } +\prg_new_conditional:Npnn \__xtemplate_if_use_template:n #1 { TF } { \str_if_eq:noTF { \UseTemplate } { \tl_head:w #1 \q_nil \q_stop } { \prg_return_true: } { \prg_return_false: } } -\cs_new_protected:Npn \xtemplate_store_defaults:n #1 +\cs_new_protected:Npn \__xtemplate_store_defaults:n #1 { - \prop_gclear_new:c { \c_xtemplate_defaults_root_tl #1 } - \prop_gset_eq:cN { \c_xtemplate_defaults_root_tl #1 } - \l_xtemplate_values_prop + \prop_gclear_new:c { \c__xtemplate_defaults_root_tl #1 } + \prop_gset_eq:cN { \c__xtemplate_defaults_root_tl #1 } + \l__xtemplate_values_prop } -\cs_new_protected:Npn \xtemplate_store_keytypes:n #1 +\cs_new_protected:Npn \__xtemplate_store_keytypes:n #1 { - \prop_gclear_new:c { \c_xtemplate_keytypes_root_tl #1 } - \prop_gset_eq:cN { \c_xtemplate_keytypes_root_tl #1 } - \l_xtemplate_keytypes_prop - \seq_gclear_new:c { \c_xtemplate_key_order_root_tl #1 } - \seq_gset_eq:cN { \c_xtemplate_key_order_root_tl #1 } - \l_xtemplate_key_order_seq + \prop_gclear_new:c { \c__xtemplate_keytypes_root_tl #1 } + \prop_gset_eq:cN { \c__xtemplate_keytypes_root_tl #1 } + \l__xtemplate_keytypes_prop + \seq_gclear_new:c { \c__xtemplate_key_order_root_tl #1 } + \seq_gset_eq:cN { \c__xtemplate_key_order_root_tl #1 } + \l__xtemplate_key_order_seq } -\cs_new_protected:Npn \xtemplate_store_values:n #1 +\cs_new_protected:Npn \__xtemplate_store_values:n #1 { - \prop_clear_new:c { \c_xtemplate_values_root_tl #1 } - \prop_set_eq:cN { \c_xtemplate_values_root_tl #1 } - \l_xtemplate_values_prop + \prop_clear_new:c { \c__xtemplate_values_root_tl #1 } + \prop_set_eq:cN { \c__xtemplate_values_root_tl #1 } + \l__xtemplate_values_prop } -\cs_new_protected:Npn \xtemplate_store_restrictions:n #1 +\cs_new_protected:Npn \__xtemplate_store_restrictions:n #1 { - \clist_gclear_new:c { \c_xtemplate_restrict_root_tl #1 } - \clist_gset_eq:cN { \c_xtemplate_restrict_root_tl #1 } - \l_xtemplate_restrict_clist + \clist_gclear_new:c { \c__xtemplate_restrict_root_tl #1 } + \clist_gset_eq:cN { \c__xtemplate_restrict_root_tl #1 } + \l__xtemplate_restrict_clist } -\cs_new_protected:Npn \xtemplate_store_vars:n #1 +\cs_new_protected:Npn \__xtemplate_store_vars:n #1 { - \prop_gclear_new:c { \c_xtemplate_vars_root_tl #1 } - \prop_gset_eq:cN { \c_xtemplate_vars_root_tl #1 } - \l_xtemplate_vars_prop + \prop_gclear_new:c { \c__xtemplate_vars_root_tl #1 } + \prop_gset_eq:cN { \c__xtemplate_vars_root_tl #1 } + \l__xtemplate_vars_prop } -\cs_new_protected:Npn \xtemplate_recover_defaults:n #1 +\cs_new_protected:Npn \__xtemplate_recover_defaults:n #1 { - \prop_set_eq:Nc \l_xtemplate_values_prop - { \c_xtemplate_defaults_root_tl #1 } + \prop_set_eq:Nc \l__xtemplate_values_prop + { \c__xtemplate_defaults_root_tl #1 } } -\cs_new_protected:Npn \xtemplate_recover_keytypes:n #1 +\cs_new_protected:Npn \__xtemplate_recover_keytypes:n #1 { - \prop_set_eq:Nc \l_xtemplate_keytypes_prop - { \c_xtemplate_keytypes_root_tl #1 } - \seq_set_eq:Nc \l_xtemplate_key_order_seq - { \c_xtemplate_key_order_root_tl #1 } + \prop_set_eq:Nc \l__xtemplate_keytypes_prop + { \c__xtemplate_keytypes_root_tl #1 } + \seq_set_eq:Nc \l__xtemplate_key_order_seq + { \c__xtemplate_key_order_root_tl #1 } } -\cs_new_protected:Npn \xtemplate_recover_restrictions:n #1 +\cs_new_protected:Npn \__xtemplate_recover_restrictions:n #1 { - \clist_set_eq:Nc \l_xtemplate_restrict_clist - { \c_xtemplate_restrict_root_tl #1 } + \clist_set_eq:Nc \l__xtemplate_restrict_clist + { \c__xtemplate_restrict_root_tl #1 } } -\cs_new_protected:Npn \xtemplate_recover_values:n #1 +\cs_new_protected:Npn \__xtemplate_recover_values:n #1 { - \prop_set_eq:Nc \l_xtemplate_values_prop - { \c_xtemplate_values_root_tl #1 } + \prop_set_eq:Nc \l__xtemplate_values_prop + { \c__xtemplate_values_root_tl #1 } } -\cs_new_protected:Npn \xtemplate_recover_vars:n #1 +\cs_new_protected:Npn \__xtemplate_recover_vars:n #1 { - \prop_set_eq:Nc \l_xtemplate_vars_prop - { \c_xtemplate_vars_root_tl #1 } + \prop_set_eq:Nc \l__xtemplate_vars_prop + { \c__xtemplate_vars_root_tl #1 } } -\cs_new_protected:Npn \xtemplate_declare_object_type:nn #1#2 +\cs_new_protected:Npn \__xtemplate_declare_object_type:nn #1#2 { - \int_set:Nn \l_xtemplate_tmp_int {#2} + \int_set:Nn \l__xtemplate_tmp_int {#2} \bool_if:nTF { \int_compare_p:nNn {#2} > \c_nine || @@ -242,88 +242,88 @@ } { \msg_error:nnxx { xtemplate } { bad-number-of-arguments } - {#1} { \exp_not:V \l_xtemplate_tmp_int } + {#1} { \exp_not:V \l__xtemplate_tmp_int } } { \msg_info:nnxx { xtemplate } { declare-object-type } {#1} {#2} - \prop_gput:NnV \g_xtemplate_object_type_prop {#1} - \l_xtemplate_tmp_int + \prop_gput:NnV \g__xtemplate_object_type_prop {#1} + \l__xtemplate_tmp_int } } -\cs_new_protected:Npn \xtemplate_declare_template_keys:nnnn #1#2#3#4 +\cs_new_protected:Npn \__xtemplate_declare_template_keys:nnnn #1#2#3#4 { - \xtemplate_execute_if_type_exist:nT {#1} + \__xtemplate_execute_if_type_exist:nT {#1} { - \xtemplate_execute_if_arg_agree:nnT {#1} {#3} + \__xtemplate_execute_if_arg_agree:nnT {#1} {#3} { - \prop_clear:N \l_xtemplate_values_prop - \prop_clear:N \l_xtemplate_keytypes_prop - \seq_clear:N \l_xtemplate_key_order_seq + \prop_clear:N \l__xtemplate_values_prop + \prop_clear:N \l__xtemplate_keytypes_prop + \seq_clear:N \l__xtemplate_key_order_seq \keyval_parse:NNn - \xtemplate_parse_keys_elt:n \xtemplate_parse_keys_elt:nn {#4} - \xtemplate_store_defaults:n { #1 / #2 } - \xtemplate_store_keytypes:n { #1 / #2 } + \__xtemplate_parse_keys_elt:n \__xtemplate_parse_keys_elt:nn {#4} + \__xtemplate_store_defaults:n { #1 / #2 } + \__xtemplate_store_keytypes:n { #1 / #2 } } } } -\cs_new_protected:Npn \xtemplate_parse_keys_elt:n #1 +\cs_new_protected:Npn \__xtemplate_parse_keys_elt:n #1 { - \xtemplate_split_keytype:n {#1} - \bool_if:NF \l_xtemplate_error_bool + \__xtemplate_split_keytype:n {#1} + \bool_if:NF \l__xtemplate_error_bool { - \xtemplate_execute_if_keytype_exist:oT \l_xtemplate_keytype_tl + \__xtemplate_execute_if_keytype_exist:oT \l__xtemplate_keytype_tl { - \seq_map_function:NN \c_xtemplate_keytypes_arg_seq - \xtemplate_parse_keys_elt_aux:n - \bool_if:NF \l_xtemplate_error_bool + \seq_map_function:NN \c__xtemplate_keytypes_arg_seq + \__xtemplate_parse_keys_elt_aux:n + \bool_if:NF \l__xtemplate_error_bool { - \seq_if_in:NoTF \l_xtemplate_key_order_seq - \l_xtemplate_key_name_tl + \seq_if_in:NoTF \l__xtemplate_key_order_seq + \l__xtemplate_key_name_tl { \msg_error:nnx { xtemplate } { duplicate-key-interface } - { \l_xtemplate_key_name_tl } + { \l__xtemplate_key_name_tl } } - { \xtemplate_parse_keys_elt_aux: } + { \__xtemplate_parse_keys_elt_aux: } } } } } -\cs_new_protected_nopar:Npn \xtemplate_parse_keys_elt_aux:n #1 +\cs_new_protected_nopar:Npn \__xtemplate_parse_keys_elt_aux:n #1 { - \str_if_eq:onT \l_xtemplate_keytype_tl {#1} + \str_if_eq:onT \l__xtemplate_keytype_tl {#1} { - \tl_if_empty:NT \l_xtemplate_keytype_arg_tl + \tl_if_empty:NT \l__xtemplate_keytype_arg_tl { \msg_error:nnx { xtemplate } { keytype-requires-argument } {#1} - \bool_set_true:N \l_xtemplate_error_bool + \bool_set_true:N \l__xtemplate_error_bool \seq_map_break: } } } -\cs_new_nopar:Npn \xtemplate_parse_keys_elt_aux: +\cs_new_nopar:Npn \__xtemplate_parse_keys_elt_aux: { - \tl_set:Nx \l_xtemplate_tmp_tl + \tl_set:Nx \l__xtemplate_tmp_tl { - \l_xtemplate_keytype_tl - \tl_if_empty:NF \l_xtemplate_keytype_arg_tl - { { \l_xtemplate_keytype_arg_tl } } + \l__xtemplate_keytype_tl + \tl_if_empty:NF \l__xtemplate_keytype_arg_tl + { { \l__xtemplate_keytype_arg_tl } } } - \prop_put:Noo \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - \seq_put_right:No \l_xtemplate_key_order_seq \l_xtemplate_key_name_tl - \str_if_eq:onT \l_xtemplate_keytype_tl { choice } + \prop_put:Noo \l__xtemplate_keytypes_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_tl + \seq_put_right:No \l__xtemplate_key_order_seq \l__xtemplate_key_name_tl + \str_if_eq:onT \l__xtemplate_keytype_tl { choice } { - \clist_if_in:NnT \l_xtemplate_keytype_arg_tl { unknown } + \clist_if_in:NnT \l__xtemplate_keytype_arg_tl { unknown } { \msg_error:nn { xtemplate } { choice-unknown-reserved } } } } -\cs_new_protected:Npn \xtemplate_parse_keys_elt:nn #1#2 +\cs_new_protected:Npn \__xtemplate_parse_keys_elt:nn #1#2 { - \xtemplate_parse_keys_elt:n {#1} - \use:c { xtemplate_store_value_ \l_xtemplate_keytype_tl :n } {#2} + \__xtemplate_parse_keys_elt:n {#1} + \use:c { __xtemplate_store_value_ \l__xtemplate_keytype_tl :n } {#2} } \group_begin: \char_set_lccode:nn { `\@ } { `\: } @@ -331,209 +331,209 @@ \tl_to_lowercase:n { \group_end: - \cs_new_protected:Npn \xtemplate_split_keytype:n #1 + \cs_new_protected:Npn \__xtemplate_split_keytype:n #1 { - \bool_set_false:N \l_xtemplate_error_bool - \tl_set:Nn \l_xtemplate_tmp_tl {#1} - \tl_remove_all:Nn \l_xtemplate_tmp_tl { ~ } - \tl_replace_all:Nnn \l_xtemplate_tmp_tl { : } { @ } - \tl_if_in:onTF \l_xtemplate_tmp_tl { @ } + \bool_set_false:N \l__xtemplate_error_bool + \tl_set:Nn \l__xtemplate_tmp_tl {#1} + \tl_remove_all:Nn \l__xtemplate_tmp_tl { ~ } + \tl_replace_all:Nnn \l__xtemplate_tmp_tl { : } { @ } + \tl_if_in:onTF \l__xtemplate_tmp_tl { @ } { - \tl_clear:N \l_xtemplate_key_name_tl - \exp_after:wN \xtemplate_split_keytype_aux:w - \l_xtemplate_tmp_tl \q_stop + \tl_clear:N \l__xtemplate_key_name_tl + \exp_after:wN \__xtemplate_split_keytype_aux:w + \l__xtemplate_tmp_tl \q_stop } { - \bool_set_true:N \l_xtemplate_error_bool + \bool_set_true:N \l__xtemplate_error_bool \msg_error:nnx { xtemplate } { missing-keytype } {#1} } } - \cs_new_protected:Npn \xtemplate_split_keytype_aux:w #1 @ #2 \q_stop + \cs_new_protected:Npn \__xtemplate_split_keytype_aux:w #1 @ #2 \q_stop { - \tl_put_right:Nx \l_xtemplate_key_name_tl { \tl_to_str:n {#1} } + \tl_put_right:Nx \l__xtemplate_key_name_tl { \tl_to_str:n {#1} } \tl_if_in:nnTF {#2} { @ } { - \tl_put_right:Nn \l_xtemplate_key_name_tl { @ } - \xtemplate_split_keytype_aux:w #2 \q_stop + \tl_put_right:Nn \l__xtemplate_key_name_tl { @ } + \__xtemplate_split_keytype_aux:w #2 \q_stop } { - \tl_if_empty:NTF \l_xtemplate_key_name_tl + \tl_if_empty:NTF \l__xtemplate_key_name_tl { \msg_error:nnx { xtemplate } { empty-key-name } { @ #2 } } - { \xtemplate_split_keytype_arg:n {#2} } + { \__xtemplate_split_keytype_arg:n {#2} } } } } -\cs_new_protected:Npn \xtemplate_split_keytype_arg:n #1 +\cs_new_protected:Npn \__xtemplate_split_keytype_arg:n #1 { - \tl_set:Nn \l_xtemplate_keytype_tl {#1} - \tl_clear:N \l_xtemplate_keytype_arg_tl - \cs_set_protected_nopar:Npn \xtemplate_split_keytype_arg_aux:n ##1 + \tl_set:Nn \l__xtemplate_keytype_tl {#1} + \tl_clear:N \l__xtemplate_keytype_arg_tl + \cs_set_protected_nopar:Npn \__xtemplate_split_keytype_arg_aux:n ##1 { \tl_if_in:nnT {#1} {##1} { - \cs_set:Npn \xtemplate_split_keytype_arg_aux:w + \cs_set:Npn \__xtemplate_split_keytype_arg_aux:w ####1 ##1 ####2 \q_stop { \tl_if_empty:nT {####1} { - \tl_set:Nn \l_xtemplate_keytype_tl {##1} - \tl_set:Nn \l_xtemplate_keytype_arg_tl {####2} + \tl_set:Nn \l__xtemplate_keytype_tl {##1} + \tl_set:Nn \l__xtemplate_keytype_arg_tl {####2} \seq_map_break: } } - \xtemplate_split_keytype_arg_aux:w #1 \q_stop + \__xtemplate_split_keytype_arg_aux:w #1 \q_stop } } - \seq_map_function:NN \c_xtemplate_keytypes_arg_seq - \xtemplate_split_keytype_arg_aux:n + \seq_map_function:NN \c__xtemplate_keytypes_arg_seq + \__xtemplate_split_keytype_arg_aux:n } -\cs_generate_variant:Nn \xtemplate_split_keytype_arg:n { o } -\cs_new_nopar:Npn \xtemplate_split_keytype_arg_aux:n #1 { } -\cs_new_nopar:Npn \xtemplate_split_keytype_arg_aux:w #1 \q_stop { } -\cs_new_protected:Npn \xtemplate_store_value_boolean:n #1 +\cs_generate_variant:Nn \__xtemplate_split_keytype_arg:n { o } +\cs_new_nopar:Npn \__xtemplate_split_keytype_arg_aux:n #1 { } +\cs_new_nopar:Npn \__xtemplate_split_keytype_arg_aux:w #1 \q_stop { } +\cs_new_protected:Npn \__xtemplate_store_value_boolean:n #1 { - \xtemplate_if_eval_now:nTF {#1} + \__xtemplate_if_eval_now:nTF {#1} { \bool_if:cTF { c_ #1 _bool } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl + \prop_put:Non \l__xtemplate_values_prop \l__xtemplate_key_name_tl { true } } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl + \prop_put:Non \l__xtemplate_values_prop \l__xtemplate_key_name_tl { false } } } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l__xtemplate_values_prop \l__xtemplate_key_name_tl {#1} } } -\cs_new_protected:Npn \xtemplate_store_value_code:n #1 - { \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} } -\cs_new_eq:NN \xtemplate_store_value_choice:n \xtemplate_store_value_code:n -\cs_new_eq:NN \xtemplate_store_value_commalist:n \xtemplate_store_value_code:n -\cs_new_eq:NN \xtemplate_store_value_function:n \xtemplate_store_value_code:n -\cs_new_eq:NN \xtemplate_store_value_instance:n \xtemplate_store_value_code:n -\cs_new_eq:NN \xtemplate_store_value_real:n \xtemplate_store_value_code:n -\cs_new_eq:NN \xtemplate_store_value_tokenlist:n \xtemplate_store_value_code:n -\cs_new_protected:Npn \xtemplate_store_value_integer:n #1 - { - \xtemplate_if_eval_now:nTF {#1} +\cs_new_protected:Npn \__xtemplate_store_value_code:n #1 + { \prop_put:Non \l__xtemplate_values_prop \l__xtemplate_key_name_tl {#1} } +\cs_new_eq:NN \__xtemplate_store_value_choice:n \__xtemplate_store_value_code:n +\cs_new_eq:NN \__xtemplate_store_value_commalist:n \__xtemplate_store_value_code:n +\cs_new_eq:NN \__xtemplate_store_value_function:n \__xtemplate_store_value_code:n +\cs_new_eq:NN \__xtemplate_store_value_instance:n \__xtemplate_store_value_code:n +\cs_new_eq:NN \__xtemplate_store_value_real:n \__xtemplate_store_value_code:n +\cs_new_eq:NN \__xtemplate_store_value_tokenlist:n \__xtemplate_store_value_code:n +\cs_new_protected:Npn \__xtemplate_store_value_integer:n #1 + { + \__xtemplate_if_eval_now:nTF {#1} { - \int_set:Nn \l_xtemplate_tmp_int {#1} - \prop_put:NVV \l_xtemplate_values_prop \l_xtemplate_key_name_int - \l_xtemplate_tmp_int + \int_set:Nn \l__xtemplate_tmp_int {#1} + \prop_put:NVV \l__xtemplate_values_prop \l__xtemplate_key_name_int + \l__xtemplate_tmp_int } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l__xtemplate_values_prop \l__xtemplate_key_name_tl {#1} } } -\cs_new_protected:Npn \xtemplate_store_value_length:n #1 +\cs_new_protected:Npn \__xtemplate_store_value_length:n #1 { - \xtemplate_if_eval_now:nTF {#1} + \__xtemplate_if_eval_now:nTF {#1} { - \dim_set:Nn \l_xtemplate_tmp_dim {#1} - \prop_put:NVV \l_xtemplate_values_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_dim + \dim_set:Nn \l__xtemplate_tmp_dim {#1} + \prop_put:NVV \l__xtemplate_values_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_dim } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l__xtemplate_values_prop \l__xtemplate_key_name_tl {#1} } } -\cs_new_protected:Npn \xtemplate_store_value_muskip:n #1 +\cs_new_protected:Npn \__xtemplate_store_value_muskip:n #1 { - \xtemplate_if_eval_now:nTF {#1} + \__xtemplate_if_eval_now:nTF {#1} { - \muskip_set:Nn \l_xtemplate_tmp_muskip {#1} - \prop_put:NVV \l_xtemplate_values_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_muskip + \muskip_set:Nn \l__xtemplate_tmp_muskip {#1} + \prop_put:NVV \l__xtemplate_values_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_muskip } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l__xtemplate_values_prop \l__xtemplate_key_name_tl {#1} } } -\cs_new_protected:Npn \xtemplate_store_value_skip:n #1 +\cs_new_protected:Npn \__xtemplate_store_value_skip:n #1 { - \xtemplate_if_eval_now:nTF {#1} + \__xtemplate_if_eval_now:nTF {#1} { - \skip_set:Nn \l_xtemplate_tmp_skip {#1} - \prop_put:NVV \l_xtemplate_values_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_skip + \skip_set:Nn \l__xtemplate_tmp_skip {#1} + \prop_put:NVV \l__xtemplate_values_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_skip } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l__xtemplate_values_prop \l__xtemplate_key_name_tl {#1} } } -\cs_new_protected:Npn \xtemplate_declare_template_code:nnnnn #1#2#3#4#5 +\cs_new_protected:Npn \__xtemplate_declare_template_code:nnnnn #1#2#3#4#5 { - \xtemplate_execute_if_type_exist:nT {#1} + \__xtemplate_execute_if_type_exist:nT {#1} { - \xtemplate_execute_if_arg_agree:nnT {#1}{#3} + \__xtemplate_execute_if_arg_agree:nnT {#1}{#3} { - \xtemplate_if_keys_exist:nnT {#1} {#2} + \__xtemplate_if_keys_exist:nnT {#1} {#2} { - \xtemplate_store_key_implementation:nnn {#1} {#2} {#4} + \__xtemplate_store_key_implementation:nnn {#1} {#2} {#4} \cs_generate_from_arg_count:cNnn - { \c_xtemplate_code_root_tl #1 / #2 } + { \c__xtemplate_code_root_tl #1 / #2 } \cs_gset_protected:Npn {#3} {#5} } } } } -\cs_new_protected:Npn \xtemplate_store_key_implementation:nnn #1#2#3 +\cs_new_protected:Npn \__xtemplate_store_key_implementation:nnn #1#2#3 { - \xtemplate_recover_defaults:n { #1 / #2 } - \xtemplate_recover_keytypes:n { #1 / #2 } - \prop_clear:N \l_xtemplate_vars_prop + \__xtemplate_recover_defaults:n { #1 / #2 } + \__xtemplate_recover_keytypes:n { #1 / #2 } + \prop_clear:N \l__xtemplate_vars_prop \keyval_parse:NNn - \xtemplate_parse_vars_elt:n \xtemplate_parse_vars_elt:nn {#3} - \xtemplate_store_vars:n { #1 / #2 } - \clist_clear:N \l_xtemplate_restrict_clist - \xtemplate_store_restrictions:n { #1 / #2 } - \prop_map_inline:Nn \l_xtemplate_keytypes_prop + \__xtemplate_parse_vars_elt:n \__xtemplate_parse_vars_elt:nn {#3} + \__xtemplate_store_vars:n { #1 / #2 } + \clist_clear:N \l__xtemplate_restrict_clist + \__xtemplate_store_restrictions:n { #1 / #2 } + \prop_map_inline:Nn \l__xtemplate_keytypes_prop { \msg_error:nnxxx { xtemplate } { key-not-implemented } {##1} {#2} {#1} } } -\cs_new_protected:Npn \xtemplate_parse_vars_elt:n #1 +\cs_new_protected:Npn \__xtemplate_parse_vars_elt:n #1 { \msg_error:nnx { xtemplate } { key-no-variable } {#1} } -\cs_new_protected:Npn \xtemplate_parse_vars_elt:nn #1#2 +\cs_new_protected:Npn \__xtemplate_parse_vars_elt:nn #1#2 { - \tl_set:Nx \l_xtemplate_key_name_tl { \tl_to_str:n {#1} } - \tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ } + \tl_set:Nx \l__xtemplate_key_name_tl { \tl_to_str:n {#1} } + \tl_remove_all:Nn \l__xtemplate_key_name_tl { ~ } \prop_get:NoNTF - \l_xtemplate_keytypes_prop - \l_xtemplate_key_name_tl - \l_xtemplate_keytype_tl + \l__xtemplate_keytypes_prop + \l__xtemplate_key_name_tl + \l__xtemplate_keytype_tl { - \xtemplate_split_keytype_arg:o \l_xtemplate_keytype_tl - \xtemplate_parse_vars_elt_aux:n {#2} - \prop_del:NV \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl + \__xtemplate_split_keytype_arg:o \l__xtemplate_keytype_tl + \__xtemplate_parse_vars_elt_aux:n {#2} + \prop_remove:NV \l__xtemplate_keytypes_prop \l__xtemplate_key_name_tl } { \msg_error:nnx { xtemplate } { unknown-key } {#1} } } -\cs_new_protected:Npn \xtemplate_parse_vars_elt_aux:n #1 +\cs_new_protected:Npn \__xtemplate_parse_vars_elt_aux:n #1 { - \str_if_eq:onTF \l_xtemplate_keytype_tl { choice } - { \xtemplate_implement_choices:n {#1} } + \str_if_eq:onTF \l__xtemplate_keytype_tl { choice } + { \__xtemplate_implement_choices:n {#1} } { - \str_if_eq:onTF \l_xtemplate_keytype_tl { code } + \str_if_eq:onTF \l__xtemplate_keytype_tl { code } { - \prop_put:Non \l_xtemplate_vars_prop - \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l__xtemplate_vars_prop + \l__xtemplate_key_name_tl {#1} } { \tl_if_single:nTF {#1} { \cs_if_exist:NF #1 - { \xtemplate_create_variable:N #1 } - \prop_put:Non \l_xtemplate_vars_prop - \l_xtemplate_key_name_tl {#1} + { \__xtemplate_create_variable:N #1 } + \prop_put:Non \l__xtemplate_vars_prop + \l__xtemplate_key_name_tl {#1} } { \tl_if_in:nnTF {#1} { global } - { \xtemplate_parse_vars_elt_aux:w #1 \q_stop } + { \__xtemplate_parse_vars_elt_aux:w #1 \q_stop } { \msg_error:nnx { xtemplate } { bad-variable } { \tl_to_str:n {#1} } @@ -542,16 +542,16 @@ } } } -\cs_new_protected:Npn \xtemplate_parse_vars_elt_aux:w #1 global #2 \q_stop +\cs_new_protected:Npn \__xtemplate_parse_vars_elt_aux:w #1 global #2 \q_stop { \tl_if_empty:nTF {#1} { \tl_if_single:nTF {#2} { \cs_if_exist:NF #2 - { \xtemplate_create_variable:N #2 } - \prop_put:Non \l_xtemplate_vars_prop - \l_xtemplate_key_name_tl { #1 global #2 } + { \__xtemplate_create_variable:N #2 } + \prop_put:Non \l__xtemplate_vars_prop + \l__xtemplate_key_name_tl { #1 global #2 } } { \msg_error:nnx { xtemplate } { bad-variable } @@ -563,9 +563,9 @@ { \tl_to_str:n { #1 global #2 } } } } -\cs_new_protected_nopar:Npn \xtemplate_create_variable:N #1 +\cs_new_protected_nopar:Npn \__xtemplate_create_variable:N #1 { - \prg_case_str:onn \l_xtemplate_keytype_tl + \str_case:onn \l__xtemplate_keytype_tl { { boolean } { \bool_new:N #1 } { commalist } { \clist_new:N #1 } @@ -576,196 +576,196 @@ { real } { \fp_new:N #1 } { tokenlist } { \tl_new:N #1 } } - { \use:c { \l_xtemplate_keytype_tl _ new:N } #1 } + { \use:c { \l__xtemplate_keytype_tl _ new:N } #1 } } -\cs_new_protected:Npn \xtemplate_implement_choices:n #1 +\cs_new_protected:Npn \__xtemplate_implement_choices:n #1 { - \clist_set_eq:NN \l_xtemplate_tmp_clist \l_xtemplate_keytype_arg_tl - \prop_put:Non \l_xtemplate_vars_prop \l_xtemplate_key_name_tl { } + \clist_set_eq:NN \l__xtemplate_tmp_clist \l__xtemplate_keytype_arg_tl + \prop_put:Non \l__xtemplate_vars_prop \l__xtemplate_key_name_tl { } \keyval_parse:NNn - \xtemplate_implement_choice_elt:n \xtemplate_implement_choice_elt:nn + \__xtemplate_implement_choice_elt:n \__xtemplate_implement_choice_elt:nn {#1} - \prop_get:NoNT \l_xtemplate_values_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - { \xtemplate_implement_choices_default: } - \clist_if_empty:NF \l_xtemplate_tmp_clist + \prop_get:NoNT \l__xtemplate_values_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_tl + { \__xtemplate_implement_choices_default: } + \clist_if_empty:NF \l__xtemplate_tmp_clist { - \clist_map_inline:Nn \l_xtemplate_tmp_clist + \clist_map_inline:Nn \l__xtemplate_tmp_clist { \msg_error:nnx { xtemplate } { choice-not-implemented } {##1} } } } -\cs_new_protected_nopar:Npn \xtemplate_implement_choices_default: +\cs_new_protected_nopar:Npn \__xtemplate_implement_choices_default: { - \tl_set:Nx \l_xtemplate_tmp_tl - { \l_xtemplate_key_name_tl \c_space_tl \l_xtemplate_tmp_tl } - \prop_if_in:NoF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl + \tl_set:Nx \l__xtemplate_tmp_tl + { \l__xtemplate_key_name_tl \c_space_tl \l__xtemplate_tmp_tl } + \prop_if_in:NoF \l__xtemplate_vars_prop \l__xtemplate_tmp_tl { - \tl_set:Nx \l_xtemplate_tmp_tl - { \l_xtemplate_key_name_tl \c_space_tl \l_xtemplate_tmp_tl } - \prop_if_in:NoF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl + \tl_set:Nx \l__xtemplate_tmp_tl + { \l__xtemplate_key_name_tl \c_space_tl \l__xtemplate_tmp_tl } + \prop_if_in:NoF \l__xtemplate_vars_prop \l__xtemplate_tmp_tl { - \prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - \xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl - \prop_get:NoN \l_xtemplate_values_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl + \prop_get:NoN \l__xtemplate_keytypes_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_tl + \__xtemplate_split_keytype_arg:o \l__xtemplate_tmp_tl + \prop_get:NoN \l__xtemplate_values_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_tl \msg_error:nnxxx { xtemplate } { unknown-default-choice } - { \l_xtemplate_key_name_tl } { \l_xtemplate_key_name_tl } - { \l_xtemplate_keytype_arg_tl } + { \l__xtemplate_key_name_tl } { \l__xtemplate_key_name_tl } + { \l__xtemplate_keytype_arg_tl } } } } -\cs_new_protected:Npn \xtemplate_implement_choice_elt:n #1 +\cs_new_protected:Npn \__xtemplate_implement_choice_elt:n #1 { - \clist_if_empty:NTF \l_xtemplate_tmp_clist + \clist_if_empty:NTF \l__xtemplate_tmp_clist { \str_if_eq:nnF {#1} { unknown } { - \prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - \xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl + \prop_get:NoN \l__xtemplate_keytypes_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_tl + \__xtemplate_split_keytype_arg:o \l__xtemplate_tmp_tl \msg_error:nnxxx { xtemplate } { unknown-choice } - { \l_xtemplate_key_name_tl } {#1} - { \l_xtemplate_keytype_arg_tl } + { \l__xtemplate_key_name_tl } {#1} + { \l__xtemplate_keytype_arg_tl } } } { - \clist_if_in:NnTF \l_xtemplate_tmp_clist {#1} - { \clist_remove_all:Nn \l_xtemplate_tmp_clist {#1} } + \clist_if_in:NnTF \l__xtemplate_tmp_clist {#1} + { \clist_remove_all:Nn \l__xtemplate_tmp_clist {#1} } { - \prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - \xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl + \prop_get:NoN \l__xtemplate_keytypes_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_tl + \__xtemplate_split_keytype_arg:o \l__xtemplate_tmp_tl \msg_error:nnxxx { xtemplate } { unknown-choice } - { \l_xtemplate_key_name_tl } {#1} - { \l_xtemplate_keytype_arg_tl } + { \l__xtemplate_key_name_tl } {#1} + { \l__xtemplate_keytype_arg_tl } } } } -\cs_new_protected:Npn \xtemplate_implement_choice_elt:nn #1#2 +\cs_new_protected:Npn \__xtemplate_implement_choice_elt:nn #1#2 { - \xtemplate_implement_choice_elt:n {#1} - \tl_set:Nx \l_xtemplate_tmp_tl - { \l_xtemplate_key_name_tl \c_space_tl #1 } - \prop_put:Non \l_xtemplate_vars_prop \l_xtemplate_tmp_tl {#2} + \__xtemplate_implement_choice_elt:n {#1} + \tl_set:Nx \l__xtemplate_tmp_tl + { \l__xtemplate_key_name_tl \c_space_tl #1 } + \prop_put:Non \l__xtemplate_vars_prop \l__xtemplate_tmp_tl {#2} } -\cs_new_protected:Npn \xtemplate_declare_restricted:nnnn #1#2#3#4 +\cs_new_protected:Npn \__xtemplate_declare_restricted:nnnn #1#2#3#4 { - \xtemplate_if_keys_exist:nnT {#1} {#2} + \__xtemplate_if_keys_exist:nnT {#1} {#2} { - \xtemplate_set_template_eq:nn { #1 / #3 } { #1 / #2 } - \bool_set_true:N \l_xtemplate_restrict_bool - \xtemplate_edit_defaults_aux:nnn {#1} {#3} {#4} + \__xtemplate_set_template_eq:nn { #1 / #3 } { #1 / #2 } + \bool_set_true:N \l__xtemplate_restrict_bool + \__xtemplate_edit_defaults_aux:nnn {#1} {#3} {#4} } } -\cs_new_protected:Npn \xtemplate_edit_defaults:nnn +\cs_new_protected:Npn \__xtemplate_edit_defaults:nnn { - \bool_set_false:N \l_xtemplate_restrict_bool - \xtemplate_edit_defaults_aux:nnn + \bool_set_false:N \l__xtemplate_restrict_bool + \__xtemplate_edit_defaults_aux:nnn } -\cs_new_protected:Npn \xtemplate_edit_defaults_aux:nnn #1#2#3 +\cs_new_protected:Npn \__xtemplate_edit_defaults_aux:nnn #1#2#3 { - \xtemplate_if_keys_exist:nnT {#1} {#2} + \__xtemplate_if_keys_exist:nnT {#1} {#2} { - \xtemplate_recover_defaults:n { #1 / #2 } - \xtemplate_recover_restrictions:n { #1 / #2 } - \xtemplate_parse_values:nn { #1 / #2 } {#3} - \xtemplate_store_defaults:n { #1 / #2 } - \xtemplate_store_restrictions:n { #1 / #2 } + \__xtemplate_recover_defaults:n { #1 / #2 } + \__xtemplate_recover_restrictions:n { #1 / #2 } + \__xtemplate_parse_values:nn { #1 / #2 } {#3} + \__xtemplate_store_defaults:n { #1 / #2 } + \__xtemplate_store_restrictions:n { #1 / #2 } } } -\cs_new_protected:Npn \xtemplate_parse_values:nn #1#2 +\cs_new_protected:Npn \__xtemplate_parse_values:nn #1#2 { - \xtemplate_recover_keytypes:n {#1} - \clist_clear:N \l_xtemplate_restrict_clist + \__xtemplate_recover_keytypes:n {#1} + \clist_clear:N \l__xtemplate_restrict_clist \keyval_parse:NNn - \xtemplate_parse_values_elt:n \xtemplate_parse_values_elt:nn {#2} + \__xtemplate_parse_values_elt:n \__xtemplate_parse_values_elt:nn {#2} } -\cs_new_protected:Npn \xtemplate_parse_values_elt:n #1 +\cs_new_protected:Npn \__xtemplate_parse_values_elt:n #1 { - \bool_set_true:N \l_xtemplate_error_bool + \bool_set_true:N \l__xtemplate_error_bool \msg_error:nnx { xtemplate } { key-no-value } {#1} } -\cs_new_protected:Npn \xtemplate_parse_values_elt:nn #1#2 +\cs_new_protected:Npn \__xtemplate_parse_values_elt:nn #1#2 { - \tl_set:Nx \l_xtemplate_key_name_tl { \tl_to_str:n {#1} } - \tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ } - \prop_get:NoNTF \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl + \tl_set:Nx \l__xtemplate_key_name_tl { \tl_to_str:n {#1} } + \tl_remove_all:Nn \l__xtemplate_key_name_tl { ~ } + \prop_get:NoNTF \l__xtemplate_keytypes_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_tl { - \bool_if:NTF \l_xtemplate_restrict_bool + \bool_if:NTF \l__xtemplate_restrict_bool { - \clist_if_in:NoF \l_xtemplate_restrict_clist - \l_xtemplate_key_name_tl - { \xtemplate_parse_values_elt_aux:n {#2} } + \clist_if_in:NoF \l__xtemplate_restrict_clist + \l__xtemplate_key_name_tl + { \__xtemplate_parse_values_elt_aux:n {#2} } } - { \xtemplate_parse_values_elt_aux:n {#2} } + { \__xtemplate_parse_values_elt_aux:n {#2} } } { \msg_error:nnx { xtemplate } { unknown-key } - { \l_xtemplate_key_name_tl } + { \l__xtemplate_key_name_tl } } } -\cs_new_protected:Npn \xtemplate_parse_values_elt_aux:n #1 +\cs_new_protected:Npn \__xtemplate_parse_values_elt_aux:n #1 { - \clist_put_right:No \l_xtemplate_restrict_clist \l_xtemplate_key_name_tl - \xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl - \use:c { xtemplate_store_value_ \l_xtemplate_keytype_tl :n } {#1} + \clist_put_right:No \l__xtemplate_restrict_clist \l__xtemplate_key_name_tl + \__xtemplate_split_keytype_arg:o \l__xtemplate_tmp_tl + \use:c { __xtemplate_store_value_ \l__xtemplate_keytype_tl :n } {#1} } -\cs_new_protected:Npn \xtemplate_set_template_eq:nn #1#2 +\cs_new_protected:Npn \__xtemplate_set_template_eq:nn #1#2 { - \xtemplate_recover_defaults:n {#2} - \xtemplate_store_defaults:n {#1} - \xtemplate_recover_keytypes:n {#2} - \xtemplate_store_keytypes:n {#1} - \xtemplate_recover_vars:n {#2} - \xtemplate_store_vars:n {#1} - \cs_gset_eq:cc { \c_xtemplate_code_root_tl #1 } - { \c_xtemplate_code_root_tl #2 } + \__xtemplate_recover_defaults:n {#2} + \__xtemplate_store_defaults:n {#1} + \__xtemplate_recover_keytypes:n {#2} + \__xtemplate_store_keytypes:n {#1} + \__xtemplate_recover_vars:n {#2} + \__xtemplate_store_vars:n {#1} + \cs_gset_eq:cc { \c__xtemplate_code_root_tl #1 } + { \c__xtemplate_code_root_tl #2 } } -\cs_new_protected:Npn \xtemplate_declare_instance:nnnnn #1#2#3#4#5 +\cs_new_protected:Npn \__xtemplate_declare_instance:nnnnn #1#2#3#4#5 { - \xtemplate_execute_if_code_exist:nnT {#1} {#2} + \__xtemplate_execute_if_code_exist:nnT {#1} {#2} { - \xtemplate_recover_defaults:n { #1 / #2 } - \xtemplate_recover_vars:n { #1 / #2 } - \xtemplate_declare_instance_aux:nnnnn {#1} {#2} {#3} {#4} {#5} + \__xtemplate_recover_defaults:n { #1 / #2 } + \__xtemplate_recover_vars:n { #1 / #2 } + \__xtemplate_declare_instance_aux:nnnnn {#1} {#2} {#3} {#4} {#5} } } -\cs_new_protected:Npn \xtemplate_declare_instance_aux:nnnnn #1#2#3#4#5 +\cs_new_protected:Npn \__xtemplate_declare_instance_aux:nnnnn #1#2#3#4#5 { - \bool_set_false:N \l_xtemplate_error_bool - \xtemplate_parse_values:nn { #1 / #2 } {#5} - \bool_if:NF \l_xtemplate_error_bool + \bool_set_false:N \l__xtemplate_error_bool + \__xtemplate_parse_values:nn { #1 / #2 } {#5} + \bool_if:NF \l__xtemplate_error_bool { - \prop_put:Nnn \l_xtemplate_values_prop { from~template } {#2} - \xtemplate_store_values:n { #1 / #3 / #4 } - \xtemplate_convert_to_assignments: - \cs_set_protected:cpx { \c_xtemplate_instances_root_tl #1 / #3 / #4 } + \prop_put:Nnn \l__xtemplate_values_prop { from~template } {#2} + \__xtemplate_store_values:n { #1 / #3 / #4 } + \__xtemplate_convert_to_assignments: + \cs_set_protected:cpx { \c__xtemplate_instances_root_tl #1 / #3 / #4 } { - \exp_not:N \xtemplate_assignments_push:n - { \exp_not:o \l_xtemplate_assignments_tl } - \exp_not:c { \c_xtemplate_code_root_tl #1 / #2 } + \exp_not:N \__xtemplate_assignments_push:n + { \exp_not:o \l__xtemplate_assignments_tl } + \exp_not:c { \c__xtemplate_code_root_tl #1 / #2 } } - \xtemplate_if_instance_exist:nnnF {#1} { } {#4} + \__xtemplate_if_instance_exist:nnnF {#1} { } {#4} { \cs_set_eq:cc - { \c_xtemplate_instances_root_tl #1 / / #4 } - { \c_xtemplate_instances_root_tl #1 / #3 / #4 } + { \c__xtemplate_instances_root_tl #1 / / #4 } + { \c__xtemplate_instances_root_tl #1 / #3 / #4 } } } } -\cs_new_protected:Npn \xtemplate_edit_instance:nnnn #1#2#3 +\cs_new_protected:Npn \__xtemplate_edit_instance:nnnn #1#2#3 { - \xtemplate_if_instance_exist:nnnTF {#1} {#2} {#3} + \__xtemplate_if_instance_exist:nnnTF {#1} {#2} {#3} { - \xtemplate_recover_values:n { #1 / #2 / #3 } - \prop_get:NnN \l_xtemplate_values_prop { from~template } - \l_xtemplate_tmp_tl - \xtemplate_edit_instance_aux:nonnn {#1} \l_xtemplate_tmp_tl + \__xtemplate_recover_values:n { #1 / #2 / #3 } + \prop_get:NnN \l__xtemplate_values_prop { from~template } + \l__xtemplate_tmp_tl + \__xtemplate_edit_instance_aux:nonnn {#1} \l__xtemplate_tmp_tl {#2} {#3} } { @@ -773,331 +773,331 @@ {#1} {#3} } } -\cs_new_protected:Npn \xtemplate_edit_instance_aux:nnnnn #1#2 +\cs_new_protected:Npn \__xtemplate_edit_instance_aux:nnnnn #1#2 { - \xtemplate_recover_vars:n { #1 / #2 } - \xtemplate_declare_instance_aux:nnnnn {#1} {#2} + \__xtemplate_recover_vars:n { #1 / #2 } + \__xtemplate_declare_instance_aux:nnnnn {#1} {#2} } -\cs_generate_variant:Nn \xtemplate_edit_instance_aux:nnnnn { no } -\cs_new_protected_nopar:Npn \xtemplate_convert_to_assignments: +\cs_generate_variant:Nn \__xtemplate_edit_instance_aux:nnnnn { no } +\cs_new_protected_nopar:Npn \__xtemplate_convert_to_assignments: { - \tl_clear:N \l_xtemplate_assignments_tl - \seq_map_function:NN \l_xtemplate_key_order_seq - \xtemplate_convert_to_assignments_aux:n + \tl_clear:N \l__xtemplate_assignments_tl + \seq_map_function:NN \l__xtemplate_key_order_seq + \__xtemplate_convert_to_assignments_aux:n } -\cs_new_protected:Npn \xtemplate_convert_to_assignments_aux:n #1 +\cs_new_protected:Npn \__xtemplate_convert_to_assignments_aux:n #1 { - \prop_get:NnN \l_xtemplate_keytypes_prop {#1} \l_xtemplate_tmp_tl - \xtemplate_convert_to_assignments_aux:no {#1} \l_xtemplate_tmp_tl + \prop_get:NnN \l__xtemplate_keytypes_prop {#1} \l__xtemplate_tmp_tl + \__xtemplate_convert_to_assignments_aux:no {#1} \l__xtemplate_tmp_tl } -\cs_new_protected:Npn \xtemplate_convert_to_assignments_aux:nn #1#2 +\cs_new_protected:Npn \__xtemplate_convert_to_assignments_aux:nn #1#2 { - \prop_get:NnNT \l_xtemplate_values_prop {#1} \l_xtemplate_value_tl + \prop_get:NnNT \l__xtemplate_values_prop {#1} \l__xtemplate_value_tl { - \prop_get:NnNTF \l_xtemplate_vars_prop {#1} \l_xtemplate_var_tl + \prop_get:NnNTF \l__xtemplate_vars_prop {#1} \l__xtemplate_var_tl { - \xtemplate_split_keytype_arg:n {#2} - \str_if_eq:onF \l_xtemplate_keytype_tl { choice } + \__xtemplate_split_keytype_arg:n {#2} + \str_if_eq:onF \l__xtemplate_keytype_tl { choice } { - \str_if_eq:onF \l_xtemplate_keytype_tl { code } - { \xtemplate_find_global: } + \str_if_eq:onF \l__xtemplate_keytype_tl { code } + { \__xtemplate_find_global: } } - \tl_set:Nn \l_xtemplate_key_name_tl {#1} - \use:c { xtemplate_assign_ \l_xtemplate_keytype_tl : } + \tl_set:Nn \l__xtemplate_key_name_tl {#1} + \use:c { __xtemplate_assign_ \l__xtemplate_keytype_tl : } } { \msg_error:nnx { xtemplate } { unknown-attribute } {#1} } } } -\cs_generate_variant:Nn \xtemplate_convert_to_assignments_aux:nn { no } -\cs_new_protected_nopar:Npn \xtemplate_find_global: +\cs_generate_variant:Nn \__xtemplate_convert_to_assignments_aux:nn { no } +\cs_new_protected_nopar:Npn \__xtemplate_find_global: { - \bool_set_false:N \l_xtemplate_global_bool - \tl_if_in:onT \l_xtemplate_var_tl { global } + \bool_set_false:N \l__xtemplate_global_bool + \tl_if_in:onT \l__xtemplate_var_tl { global } { - \exp_after:wN \xtemplate_find_global_aux:w \l_xtemplate_var_tl \q_stop + \exp_after:wN \__xtemplate_find_global_aux:w \l__xtemplate_var_tl \q_stop } } -\cs_new_protected:Npn \xtemplate_find_global_aux:w #1 global #2 \q_stop +\cs_new_protected:Npn \__xtemplate_find_global_aux:w #1 global #2 \q_stop { - \tl_set:Nn \l_xtemplate_var_tl {#2} - \bool_set_true:N \l_xtemplate_global_bool + \tl_set:Nn \l__xtemplate_var_tl {#2} + \bool_set_true:N \l__xtemplate_global_bool } -\cs_new_protected:Npn \xtemplate_use_template:nnn #1#2#3 +\cs_new_protected:Npn \__xtemplate_use_template:nnn #1#2#3 { - \xtemplate_execute_if_code_exist:nnT {#1} {#2} + \__xtemplate_execute_if_code_exist:nnT {#1} {#2} { - \xtemplate_recover_defaults:n { #1 / #2 } - \xtemplate_recover_vars:n { #1 / #2 } - \xtemplate_parse_values:nn { #1 / #2 } {#3} - \xtemplate_convert_to_assignments: - \use:c { \c_xtemplate_code_root_tl #1 / #2 } + \__xtemplate_recover_defaults:n { #1 / #2 } + \__xtemplate_recover_vars:n { #1 / #2 } + \__xtemplate_parse_values:nn { #1 / #2 } {#3} + \__xtemplate_convert_to_assignments: + \use:c { \c__xtemplate_code_root_tl #1 / #2 } } } -\cs_new_protected_nopar:Npn \xtemplate_assign_boolean: +\cs_new_protected_nopar:Npn \__xtemplate_assign_boolean: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_boolean_aux:n { bool_gset } } - { \xtemplate_assign_boolean_aux:n { bool_set } } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_boolean_aux:n { bool_gset } } + { \__xtemplate_assign_boolean_aux:n { bool_set } } } -\cs_new_protected_nopar:Npn \xtemplate_assign_boolean_aux:n #1 +\cs_new_protected_nopar:Npn \__xtemplate_assign_boolean_aux:n #1 { - \xtemplate_if_key_value:oT \l_xtemplate_value_tl - { \xtemplate_key_to_value: } - \tl_put_left:Nx \l_xtemplate_assignments_tl + \__xtemplate_if_key_value:oT \l__xtemplate_value_tl + { \__xtemplate_key_to_value: } + \tl_put_left:Nx \l__xtemplate_assignments_tl { - \exp_not:c { #1 _ \l_xtemplate_value_tl :N } - \exp_not:o \l_xtemplate_var_tl + \exp_not:c { #1 _ \l__xtemplate_value_tl :N } + \exp_not:o \l__xtemplate_var_tl } } -\cs_new_protected_nopar:Npn \xtemplate_assign_choice: +\cs_new_protected_nopar:Npn \__xtemplate_assign_choice: { - \xtemplate_assign_choice_aux:xF - { \l_xtemplate_key_name_tl \c_space_tl \l_xtemplate_value_tl } + \__xtemplate_assign_choice_aux:xF + { \l__xtemplate_key_name_tl \c_space_tl \l__xtemplate_value_tl } { - \xtemplate_assign_choice_aux:xF - { \l_xtemplate_key_name_tl \c_space_tl unknown } + \__xtemplate_assign_choice_aux:xF + { \l__xtemplate_key_name_tl \c_space_tl unknown } { - \prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - \xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl + \prop_get:NoN \l__xtemplate_keytypes_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_tl + \__xtemplate_split_keytype_arg:o \l__xtemplate_tmp_tl \msg_error:nnxxx { xtemplate } { unknown-choice } - { \l_xtemplate_key_name_tl } { \l_xtemplate_value_tl } - { \l_xtemplate_keytype_arg_tl } + { \l__xtemplate_key_name_tl } { \l__xtemplate_value_tl } + { \l__xtemplate_keytype_arg_tl } } } } -\cs_new_protected_nopar:Npn \xtemplate_assign_choice_aux:nF #1 +\cs_new_protected_nopar:Npn \__xtemplate_assign_choice_aux:nF #1 { \prop_get:NnNTF - \l_xtemplate_vars_prop + \l__xtemplate_vars_prop {#1} - \l_xtemplate_tmp_tl - { \tl_put_right:No \l_xtemplate_assignments_tl \l_xtemplate_tmp_tl } + \l__xtemplate_tmp_tl + { \tl_put_right:No \l__xtemplate_assignments_tl \l__xtemplate_tmp_tl } } -\cs_generate_variant:Nn \xtemplate_assign_choice_aux:nF { x } -\cs_new_protected_nopar:Npn \xtemplate_assign_code: +\cs_generate_variant:Nn \__xtemplate_assign_choice_aux:nF { x } +\cs_new_protected_nopar:Npn \__xtemplate_assign_code: { - \tl_put_left:Nx \l_xtemplate_assignments_tl + \tl_put_left:Nx \l__xtemplate_assignments_tl { - \cs_set_protected:Npn \xtemplate_assign_code:n \exp_not:n {##1} - { \exp_not:o \l_xtemplate_var_tl } - \xtemplate_assign_code:n { \exp_not:o \l_xtemplate_value_tl } + \cs_set_protected:Npn \__xtemplate_assign_code:n \exp_not:n {##1} + { \exp_not:o \l__xtemplate_var_tl } + \__xtemplate_assign_code:n { \exp_not:o \l__xtemplate_value_tl } } } -\cs_new_protected:Npn \xtemplate_assign_code:n #1 { } -\cs_new_protected_nopar:Npn \xtemplate_assign_function: +\cs_new_protected:Npn \__xtemplate_assign_code:n #1 { } +\cs_new_protected_nopar:Npn \__xtemplate_assign_function: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_function_aux:N \cs_gset:Npn } - { \xtemplate_assign_function_aux:N \cs_set:Npn } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_function_aux:N \cs_gset:Npn } + { \__xtemplate_assign_function_aux:N \cs_set:Npn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_function_aux:N #1 +\cs_new_protected_nopar:Npn \__xtemplate_assign_function_aux:N #1 { - \tl_put_left:Nx \l_xtemplate_assignments_tl + \tl_put_left:Nx \l__xtemplate_assignments_tl { \cs_generate_from_arg_count:NNnn - \exp_not:o \l_xtemplate_var_tl + \exp_not:o \l__xtemplate_var_tl \exp_not:N #1 - { \exp_not:o \l_xtemplate_keytype_arg_tl } - { \exp_not:o \l_xtemplate_value_tl } + { \exp_not:o \l__xtemplate_keytype_arg_tl } + { \exp_not:o \l__xtemplate_value_tl } } } -\cs_new_protected_nopar:Npn \xtemplate_assign_instance: +\cs_new_protected_nopar:Npn \__xtemplate_assign_instance: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_instance_aux:N \cs_gset_protected:Npn } - { \xtemplate_assign_instance_aux:N \cs_set_protected:Npn } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_instance_aux:N \cs_gset_protected:Npn } + { \__xtemplate_assign_instance_aux:N \cs_set_protected:Npn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_instance_aux:N #1 +\cs_new_protected_nopar:Npn \__xtemplate_assign_instance_aux:N #1 { - \tl_put_left:Nx \l_xtemplate_assignments_tl + \tl_put_left:Nx \l__xtemplate_assignments_tl { - \exp_not:N #1 \exp_not:o \l_xtemplate_var_tl + \exp_not:N #1 \exp_not:o \l__xtemplate_var_tl { - \xtemplate_use_instance:nn - { \exp_not:o \l_xtemplate_keytype_arg_tl } - { \exp_not:o \l_xtemplate_value_tl } + \__xtemplate_use_instance:nn + { \exp_not:o \l__xtemplate_keytype_arg_tl } + { \exp_not:o \l__xtemplate_value_tl } } } } -\cs_new_protected_nopar:Npn \xtemplate_assign_integer: +\cs_new_protected_nopar:Npn \__xtemplate_assign_integer: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_variable:N \int_gset:Nn } - { \xtemplate_assign_variable:N \int_set:Nn } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_variable:N \int_gset:Nn } + { \__xtemplate_assign_variable:N \int_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_length: +\cs_new_protected_nopar:Npn \__xtemplate_assign_length: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_variable:N \dim_gset:Nn } - { \xtemplate_assign_variable:N \dim_set:Nn } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_variable:N \dim_gset:Nn } + { \__xtemplate_assign_variable:N \dim_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_muskip: +\cs_new_protected_nopar:Npn \__xtemplate_assign_muskip: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_variable:N \muskip_gset:Nn } - { \xtemplate_assign_variable:N \muskip_set:Nn } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_variable:N \muskip_gset:Nn } + { \__xtemplate_assign_variable:N \muskip_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_real: +\cs_new_protected_nopar:Npn \__xtemplate_assign_real: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_variable:N \fp_gset:Nn } - { \xtemplate_assign_variable:N \fp_set:Nn } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_variable:N \fp_gset:Nn } + { \__xtemplate_assign_variable:N \fp_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_skip: +\cs_new_protected_nopar:Npn \__xtemplate_assign_skip: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_variable:N \skip_gset:Nn } - { \xtemplate_assign_variable:N \skip_set:Nn } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_variable:N \skip_gset:Nn } + { \__xtemplate_assign_variable:N \skip_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_tokenlist: +\cs_new_protected_nopar:Npn \__xtemplate_assign_tokenlist: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_tokenlist_aux:N \tl_gset:Nn } - { \xtemplate_assign_tokenlist_aux:N \tl_set:Nn } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_tokenlist_aux:N \tl_gset:Nn } + { \__xtemplate_assign_tokenlist_aux:N \tl_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_tokenlist_aux:N #1 +\cs_new_protected_nopar:Npn \__xtemplate_assign_tokenlist_aux:N #1 { - \xtemplate_if_key_value:oT \l_xtemplate_value_tl - { \xtemplate_key_to_value: } - \tl_put_left:Nx \l_xtemplate_assignments_tl + \__xtemplate_if_key_value:oT \l__xtemplate_value_tl + { \__xtemplate_key_to_value: } + \tl_put_left:Nx \l__xtemplate_assignments_tl { - #1 \exp_not:o \l_xtemplate_var_tl - { \exp_not:o \l_xtemplate_value_tl } + #1 \exp_not:o \l__xtemplate_var_tl + { \exp_not:o \l__xtemplate_value_tl } } } -\cs_new_protected_nopar:Npn \xtemplate_assign_commalist: +\cs_new_protected_nopar:Npn \__xtemplate_assign_commalist: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_tokenlist_aux:N \clist_gset:Nn } - { \xtemplate_assign_tokenlist_aux:N \clist_set:Nn } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_tokenlist_aux:N \clist_gset:Nn } + { \__xtemplate_assign_tokenlist_aux:N \clist_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_variable:N #1 +\cs_new_protected_nopar:Npn \__xtemplate_assign_variable:N #1 { - \xtemplate_if_key_value:oT \l_xtemplate_value_tl - { \xtemplate_key_to_value: } - \tl_put_left:Nx \l_xtemplate_assignments_tl + \__xtemplate_if_key_value:oT \l__xtemplate_value_tl + { \__xtemplate_key_to_value: } + \tl_put_left:Nx \l__xtemplate_assignments_tl { - #1 \exp_not:o \l_xtemplate_var_tl - { \exp_not:o \l_xtemplate_value_tl } + #1 \exp_not:o \l__xtemplate_var_tl + { \exp_not:o \l__xtemplate_value_tl } } } -\cs_new_protected_nopar:Npn \xtemplate_key_to_value: - { \exp_after:wN \xtemplate_key_to_value_aux:w \l_xtemplate_value_tl } -\cs_new_protected:Npn \xtemplate_key_to_value_aux:w \KeyValue #1 +\cs_new_protected_nopar:Npn \__xtemplate_key_to_value: + { \exp_after:wN \__xtemplate_key_to_value_aux:w \l__xtemplate_value_tl } +\cs_new_protected:Npn \__xtemplate_key_to_value_aux:w \KeyValue #1 { - \tl_set:Nx \l_xtemplate_tmp_tl { \tl_to_str:n {#1} } - \tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ } + \tl_set:Nx \l__xtemplate_tmp_tl { \tl_to_str:n {#1} } + \tl_remove_all:Nn \l__xtemplate_key_name_tl { ~ } \prop_get:NoNF - \l_xtemplate_vars_prop - \l_xtemplate_tmp_tl - \l_xtemplate_value_tl + \l__xtemplate_vars_prop + \l__xtemplate_tmp_tl + \l__xtemplate_value_tl { \msg_error:nnx { xtemplate } { unknown-attribute } - { \l_xtemplate_tmp_tl } + { \l__xtemplate_tmp_tl } } } -\cs_new_protected:Npn \xtemplate_use_instance:nn #1#2 +\cs_new_protected:Npn \__xtemplate_use_instance:nn #1#2 { - \xtemplate_if_use_template:nTF {#2} - { \xtemplate_use_instance_aux:nNnnn {#1} #2 } - { \xtemplate_use_instance_aux:nn {#1} {#2} } + \__xtemplate_if_use_template:nTF {#2} + { \__xtemplate_use_instance_aux:nNnnn {#1} #2 } + { \__xtemplate_use_instance_aux:nn {#1} {#2} } } -\cs_new_protected:Npn \xtemplate_use_instance_aux:nNnnn #1#2#3#4#5 +\cs_new_protected:Npn \__xtemplate_use_instance_aux:nNnnn #1#2#3#4#5 { \str_if_eq:nnTF {#1} {#3} - { \xtemplate_use_template:nnn {#3} {#4} {#5} } + { \__xtemplate_use_template:nnn {#3} {#4} {#5} } { \msg_error:nnxx { xtemplate } { type-mismatch } {#1} {#3} } } -\cs_new_protected:Npn \xtemplate_use_instance_aux:nn #1#2 +\cs_new_protected:Npn \__xtemplate_use_instance_aux:nn #1#2 { - \xtemplate_get_collection:n {#1} - \xtemplate_if_instance_exist:nnnTF - {#1} { \l_xtemplate_collection_tl } {#2} + \__xtemplate_get_collection:n {#1} + \__xtemplate_if_instance_exist:nnnTF + {#1} { \l__xtemplate_collection_tl } {#2} { \use:c { - \c_xtemplate_instances_root_tl #1 / - \l_xtemplate_collection_tl / #2 + \c__xtemplate_instances_root_tl #1 / + \l__xtemplate_collection_tl / #2 } } { - \xtemplate_if_instance_exist:nnnTF {#1} { } {#2} - { \use:c { \c_xtemplate_instances_root_tl #1 / / #2 } } + \__xtemplate_if_instance_exist:nnnTF {#1} { } {#2} + { \use:c { \c__xtemplate_instances_root_tl #1 / / #2 } } { \msg_error:nnxx { xtemplate } { unknown-instance } {#1} {#2} } } } -\cs_new_protected:Npn \xtemplate_use_collection:nn #1#2 - { \prop_put:Nnn \l_xtemplate_collections_prop {#1} {#2} } -\cs_new_protected:Npn \xtemplate_get_collection:n #1 +\cs_new_protected:Npn \__xtemplate_use_collection:nn #1#2 + { \prop_put:Nnn \l__xtemplate_collections_prop {#1} {#2} } +\cs_new_protected:Npn \__xtemplate_get_collection:n #1 { - \prop_get:NnNF \l_xtemplate_collections_prop {#1} - \l_xtemplate_collection_tl - { \tl_clear:N \l_xtemplate_collection_tl } + \prop_get:NnNF \l__xtemplate_collections_prop {#1} + \l__xtemplate_collection_tl + { \tl_clear:N \l__xtemplate_collection_tl } } -\cs_new_nopar:Npn \xtemplate_assignments_pop: { \l_xtemplate_assignments_tl } -\cs_new_protected:Npn \xtemplate_assignments_push:n #1 - { \tl_set:Nn \l_xtemplate_assignments_tl {#1} } -\cs_new_protected_nopar:Npn \xtemplate_show_code:nn #1#2 - { \cs_show:c { \c_xtemplate_code_root_tl #1 / #2 } } -\cs_new_protected_nopar:Npn \xtemplate_show_defaults:nn #1#2 +\cs_new_nopar:Npn \__xtemplate_assignments_pop: { \l__xtemplate_assignments_tl } +\cs_new_protected:Npn \__xtemplate_assignments_push:n #1 + { \tl_set:Nn \l__xtemplate_assignments_tl {#1} } +\cs_new_protected_nopar:Npn \__xtemplate_show_code:nn #1#2 + { \cs_show:c { \c__xtemplate_code_root_tl #1 / #2 } } +\cs_new_protected_nopar:Npn \__xtemplate_show_defaults:nn #1#2 { - \xtemplate_if_keys_exist:nnT {#1} {#2} + \__xtemplate_if_keys_exist:nnT {#1} {#2} { - \xtemplate_recover_defaults:n { #1 / #2 } - \xtemplate_show:Nnnn \l_xtemplate_values_prop + \__xtemplate_recover_defaults:n { #1 / #2 } + \__xtemplate_show:Nnnn \l__xtemplate_values_prop {#1} {#2} { default~values } } } -\cs_new_protected_nopar:Npn \xtemplate_show_keytypes:nn #1#2 +\cs_new_protected_nopar:Npn \__xtemplate_show_keytypes:nn #1#2 { - \xtemplate_if_keys_exist:nnT {#1} {#2} + \__xtemplate_if_keys_exist:nnT {#1} {#2} { - \xtemplate_recover_keytypes:n { #1 / #2 } - \xtemplate_show:Nnnn \l_xtemplate_keytypes_prop + \__xtemplate_recover_keytypes:n { #1 / #2 } + \__xtemplate_show:Nnnn \l__xtemplate_keytypes_prop {#1} {#2} { interface } } } -\cs_new_protected_nopar:Npn \xtemplate_show_vars:nn #1#2 +\cs_new_protected_nopar:Npn \__xtemplate_show_vars:nn #1#2 { - \xtemplate_execute_if_code_exist:nnT {#1} {#2} + \__xtemplate_execute_if_code_exist:nnT {#1} {#2} { - \xtemplate_recover_vars:n { #1 / #2 } - \xtemplate_show:Nnnn \l_xtemplate_vars_prop + \__xtemplate_recover_vars:n { #1 / #2 } + \__xtemplate_show:Nnnn \l__xtemplate_vars_prop {#1} {#2} { variable~mapping } } } -\cs_new_protected_nopar:Npn \xtemplate_show:Nnnn #1#2#3#4 +\cs_new_protected_nopar:Npn \__xtemplate_show:Nnnn #1#2#3#4 { - \msg_aux_use:nnxxxx { xtemplate } + \__msg_term:nnnnn { xtemplate } { \prop_if_empty:NTF #1 { show-no-attribute } { show-attribute } } - {#2} {#3} {#4} { } - \msg_aux_show:x - { \prop_map_function:NN #1 \msg_aux_show_unbraced:nn } + {#2} {#3} {#4} + \__msg_show_variable:x + { \prop_map_function:NN #1 \__msg_show_item_unbraced:nn } } -\cs_new_protected_nopar:Npn \xtemplate_show_values:nnn #1#2#3 +\cs_new_protected_nopar:Npn \__xtemplate_show_values:nnn #1#2#3 { - \xtemplate_if_instance_exist:nnnT {#1} {#2} {#3} + \__xtemplate_if_instance_exist:nnnT {#1} {#2} {#3} { - \xtemplate_recover_values:n { #1 / #2 / #3 } - \prop_if_empty:NTF \l_xtemplate_values_prop + \__xtemplate_recover_values:n { #1 / #2 / #3 } + \prop_if_empty:NTF \l__xtemplate_values_prop { - \msg_aux_use:nnxxxx { xtemplate } { show-no-values } - {#1} {#2} {#3} { } - \msg_aux_show:x { } + \__msg_term:nnnnn { xtemplate } { show-no-values } + {#1} {#2} {#3} + \__msg_show_variable:x { } } { - \prop_pop:NnN \l_xtemplate_values_prop { from~template } - \l_xtemplate_tmp_tl - \msg_aux_use:nnxxxx { xtemplate } { show-values } - {#1} {#2} {#3} { \l_xtemplate_tmp_tl } - \msg_aux_show:x + \prop_pop:NnN \l__xtemplate_values_prop { from~template } + \l__xtemplate_tmp_tl + \__msg_term:nnnnnV { xtemplate } { show-values } + {#1} {#2} {#3} \l__xtemplate_tmp_tl + \__msg_show_variable:x { - \prop_map_function:NN \l_xtemplate_values_prop - \msg_aux_show_unbraced:nn + \prop_map_function:NN \l__xtemplate_values_prop + \__msg_show_item_unbraced:nn } } } @@ -1299,55 +1299,55 @@ The~ \tl_if_empty:nF {#2} {collection~} instance~'#3'~ \tl_if_empty:nF {#2} { (from~collection~'#2')~ } of~object~type~'#1'~ - \quark_if_no_value:NF #4 { (from~template~'#4')~ } + \str_if_eq:nnF { \q_no_value } {#4} { (from~template~'#4')~ } has~values: } \cs_new_protected_nopar:Npn \DeclareObjectType #1#2 - { \xtemplate_declare_object_type:nn {#1} {#2} } + { \__xtemplate_declare_object_type:nn {#1} {#2} } \cs_new_protected:Npn \DeclareTemplateInterface #1#2#3#4 - { \xtemplate_declare_template_keys:nnnn {#1} {#2} {#3} {#4} } + { \__xtemplate_declare_template_keys:nnnn {#1} {#2} {#3} {#4} } \cs_new_protected:Npn \DeclareTemplateCode #1#2#3#4#5 - { \xtemplate_declare_template_code:nnnnn {#1} {#2} {#3} {#4} {#5} } + { \__xtemplate_declare_template_code:nnnnn {#1} {#2} {#3} {#4} {#5} } \cs_new_protected:Npn \DeclareRestrictedTemplate #1#2#3#4 - { \xtemplate_declare_restricted:nnnn {#1} {#2} {#3} {#4} } + { \__xtemplate_declare_restricted:nnnn {#1} {#2} {#3} {#4} } \cs_new_protected:Npn \DeclareInstance #1#2#3#4 - { \xtemplate_declare_instance:nnnnn {#1} {#3} { } {#2} {#4} } + { \__xtemplate_declare_instance:nnnnn {#1} {#3} { } {#2} {#4} } \cs_new_protected:Npn \DeclareCollectionInstance #1#2#3#4#5 - { \xtemplate_declare_instance:nnnnn {#2} {#4} {#1} {#3} {#5} } + { \__xtemplate_declare_instance:nnnnn {#2} {#4} {#1} {#3} {#5} } \cs_new_protected:Npn \EditTemplateDefaults #1#2#3 - { \xtemplate_edit_defaults:nnn {#1} {#2} {#3} } + { \__xtemplate_edit_defaults:nnn {#1} {#2} {#3} } \cs_new_protected:Npn \EditInstance #1#2#3 - { \xtemplate_edit_instance:nnnn {#1} { } {#2} {#3} } + { \__xtemplate_edit_instance:nnnn {#1} { } {#2} {#3} } \cs_new_protected:Npn \EditCollectionInstance #1#2#3#4 - { \xtemplate_edit_instance:nnnn {#2} {#1} {#3} {#4} } + { \__xtemplate_edit_instance:nnnn {#2} {#1} {#3} {#4} } \cs_new_protected_nopar:Npn \UseTemplate #1#2#3 - { \xtemplate_use_template:nnn {#1} {#2} {#3} } + { \__xtemplate_use_template:nnn {#1} {#2} {#3} } \cs_new_protected_nopar:Npn \UseInstance #1#2 - { \xtemplate_use_instance:nn {#1} {#2} } + { \__xtemplate_use_instance:nn {#1} {#2} } \cs_new_protected_nopar:Npn \UseCollection #1#2 - { \xtemplate_use_collection:nn {#1} {#2} } + { \__xtemplate_use_collection:nn {#1} {#2} } \cs_new_protected_nopar:Npn \ShowTemplateCode #1#2 - { \xtemplate_show_code:nn {#1} {#2} } + { \__xtemplate_show_code:nn {#1} {#2} } \cs_new_protected_nopar:Npn \ShowTemplateDefaults #1#2 - { \xtemplate_show_defaults:nn {#1} {#2} } + { \__xtemplate_show_defaults:nn {#1} {#2} } \cs_new_protected_nopar:Npn \ShowTemplateInterface #1#2 - { \xtemplate_show_keytypes:nn {#1} {#2} } + { \__xtemplate_show_keytypes:nn {#1} {#2} } \cs_new_protected_nopar:Npn \ShowTemplateVariables #1#2 - { \xtemplate_show_vars:nn {#1} {#2} } + { \__xtemplate_show_vars:nn {#1} {#2} } \cs_new_protected_nopar:Npn \ShowInstanceValues #1#2 - { \xtemplate_show_values:nnn {#1} { } {#2} } + { \__xtemplate_show_values:nnn {#1} { } {#2} } \cs_new_protected_nopar:Npn \ShowCollectionInstanceValues #1#2#3 - { \xtemplate_show_values:nnn {#1} {#2} {#3} } + { \__xtemplate_show_values:nnn {#1} {#2} {#3} } \cs_new_nopar:Npn \IfInstanceExistTF #1#2 - { \xtemplate_if_instance_exist:nnnTF {#1} { } {#2} } + { \__xtemplate_if_instance_exist:nnnTF {#1} { } {#2} } \cs_new_nopar:Npn \IfInstanceExistT #1#2 - { \xtemplate_if_instance_exist:nnnT {#1} { } {#2} } + { \__xtemplate_if_instance_exist:nnnT {#1} { } {#2} } \cs_new_nopar:Npn \IfInstanceExistF #1#2 - { \xtemplate_if_instance_exist:nnnF {#1} { } {#2} } + { \__xtemplate_if_instance_exist:nnnF {#1} { } {#2} } \cs_new_protected:Npn \EvaluateNow #1 {#1} \cs_new_protected:Npn \KeyValue #1 {#1} \cs_new_protected_nopar:Npn \AssignTemplateKeys - { \xtemplate_assignments_pop: } + { \__xtemplate_assignments_pop: } \cs_new_eq:NN \ShowTemplateKeytypes \ShowTemplateInterface %% %% |