summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx4
-rw-r--r--Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx270
-rw-r--r--Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx4
3 files changed, 141 insertions, 137 deletions
diff --git a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx
index b5b5012d729..240b7f2ceb2 100644
--- a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx
+++ b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx
@@ -36,7 +36,7 @@
%
%<*driver|package>
\RequirePackage{xparse}
-\GetIdInfo$Id: l3keys2e.dtx 3036 2011-12-07 19:29:18Z joseph $
+\GetIdInfo$Id: l3keys2e.dtx 3109 2011-12-29 10:42:27Z joseph $
{LaTeX2e option processing using LaTeX3 keys}
%</driver|package>
%<*driver>
@@ -137,7 +137,7 @@
%
% A check to make sure that \pkg{expl3} is not too old
% \begin{macrocode}
-\@ifpackagelater { expl3 } { 2011/12/07 }
+\@ifpackagelater { expl3 } { 2011/12/29 }
{ }
{
\PackageError { l3keys2e } { Support~package~l3kernel~too~old. }
diff --git a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx
index efdbf34ad8c..acde2c3914e 100644
--- a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx
+++ b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx
@@ -40,7 +40,7 @@
%
%<*driver|package>
\RequirePackage{expl3}
-\GetIdInfo$Id: xparse.dtx 3036 2011-12-07 19:29:18Z joseph $
+\GetIdInfo$Id: xparse.dtx 3109 2011-12-29 10:42:27Z joseph $
{L3 Experimental document command parser}
%</driver|package>
%<*driver>
@@ -570,12 +570,13 @@
% available:
% \begin{itemize}
% \item The last argument (if any are present) must be one of the
-% mandatory types: \texttt{l}, \texttt{m} or \texttt{u}.
+% mandatory types \texttt{m} or \texttt{u}. (Type \texttt{l} is
+% not available.)
% \item All arguments are either short or long: it is not possible
% to mix short and long argument types.
-% \item The `optional group' argument types \texttt{g} and
+% \item The \enquote{optional group} argument types \texttt{g} and
% \texttt{G} are not available.
-% \item The `verbatim' argument type \texttt{v} is not available.
+% \item The \enquote{verbatim} argument type \texttt{v} is not available.
% \item It is not possible to differentiate between, for example
% |\foo[| and |\foo{[}|: in both cases the \texttt{[} will be
% interpreted as the start of an optional argument. As a result
@@ -649,7 +650,7 @@
%
% A check to make sure that \pkg{expl3} is not too old
% \begin{macrocode}
-\@ifpackagelater { expl3 } { 2011/12/07 }
+\@ifpackagelater { expl3 } { 2011/12/29 }
{ }
{
\PackageError { xparse } { Support~package~l3kernel~too~old. }
@@ -710,13 +711,6 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_xparse_error_bool}
-% Used to signal an error when creating expandable functions.
-% \begin{macrocode}
-\bool_new:N \l_xparse_error_bool
-% \end{macrocode}
-% \end{variable}
-%
% \begin{variable}{\l_xparse_function_tl}
% When creating expandable functions, the current function name needs
% to be passed along.
@@ -2198,10 +2192,10 @@
%
% \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{macro}[aux]{\xparse_split_list_multi:nn, \xparse_split_list_multi:nV}
+% \begin{macro}[aux]{\xparse_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 procedur is
+% identifier. To deal with single active tokens, a two-part procedure is
% needed.
% \begin{macrocode}
\seq_new:N \l_xparse_split_list_seq
@@ -2272,127 +2266,155 @@
% \end{macro}
%
% \begin{macro}{\xparse_exp_add_type_D:w}
+% \begin{macro}[aux]{\xparse_exp_add_type_D_aux:nnNNn}
% The most complex argument to grab in an expandable manner is the
-% general delimited one. First, a short-cut is set up in
-% \cs{l_xparse_tmp_tl} for the name of the current grabber function.
-% This is then created to grab one argument and test if it is equal
-% to the opening delimiter. If the test fails, the code adds the default
-% value and closing delimiter before `recycling' the argument. In either
-% case, the second auxiliary function is called. It finds the closing
-% delimiter and so the optional argument (if any). The function then
-% calls the next one in the chain, passing along the argument(s)
-% grabbed thus-far using \cs{q_xparse} as a marker.
+% general delimited one. Life gets so complicated here that the first thing
+% to do is to expand the name of the current function and the current
+% argument number so that a slightly less complex auxiliary can be employed.
% \begin{macrocode}
\cs_new_protected:Npn \xparse_exp_add_type_D:w #1#2#3
{
- \tl_set:Nx \l_xparse_tmp_tl
+ \exp_args:NVV \xparse_exp_add_type_D_aux:nnNNn
+ \l_xparse_function_tl \l_xparse_total_args_int #1 #2 {#3}
+ \xparse_exp_prepare_function:N
+ }
+% \end{macrocode}
+% The general idea here is to use the same strategy as is employed in the
+% non-expandable code, using a grabbed argument plus string test in place
+% of \cs{peek_...} and employing a stack approach for the nesting part.
+% Unlike the non-expandable code, all of the nesting here requires that
+% the tests are set up in advance, which includes a dedicated copy of the
+% \cs{tl_if_in:nnTF} auxiliary for the optional opening token. Several
+% of the internal functions are also built with expansion as this is
+% needed so that at point of use the number of expansions required is known.
+% \begin{macrocode}
+\cs_new_protected:Npn \xparse_exp_add_type_D_aux:nnNNn #1#2#3#4#5
+ {
+ \xparse_exp_set:cpx { #1 _arg_ #2 :w } ##1 \q_xparse ##2
{
- \exp_after:wN \token_to_str:N \l_xparse_function_tl
- \int_use:N \l_xparse_total_args_int
+ \exp_not:N \str_if_eq:nnTF {##2} {#3}
+ { \exp_not:c { #1 _arg_ #2 _aux:w } ##1 \exp_not:N \q_xparse }
+ {
+ \exp_not:c { #1 _arg_ \int_eval:n { #2 + \c_one } :w }
+ ##1 {#5} \exp_not:N \q_xparse {##2}
+ }
}
- \xparse_exp_set:cpx { \l_xparse_tmp_tl } ##1 \q_xparse ##2
+ \xparse_exp_set:cpx { #1 _arg_ #2 _aux:w } ##1 \q_xparse ##2 #4
{
- \exp_not:N \tl_if_head_eq_charcode:nNTF {##2} #1
+ \exp_not:N \tl_if_empty:oTF
+ { \exp_not:c { #1 _arg_ #2 _open_check:w } ##2 { } { } #3 }
{
- \exp_not:c { \l_xparse_tmp_tl aux }
- ##1 \exp_not:N \q_xparse
+ \exp_not:c { #1 _arg_ \int_eval:n { #2 + \c_one } :w }
+ ##1 {##2} \exp_not:N \q_xparse
}
{
- \exp_not:c { \l_xparse_tmp_tl aux }
- ##1 \exp_not:N \q_xparse #3 #2 {##2}
+ \exp_not:c { #1 _arg_ #2 _nested:wnnw } ##1 \exp_not:N \q_xparse
+ { } { } ##2 \exp_not:N \q_xparse
}
}
- \xparse_exp_set:cpx { \l_xparse_tmp_tl aux} ##1 \q_xparse ##2 #2
+ \cs_set:cpn { #1 _arg_ #2 _open_check:w } ##1 #3 { }
+ \xparse_exp_set:cpx { #1 _arg_ #2 _nested:wnnw }
+ ##1 \q_xparse ##2##3 ##4 #3 ##5 \q_xparse ##6 #4
{
- \exp_not:c
+ \exp_not:N \tl_if_empty:oTF
+ { \exp_not:c { #1 _arg_ #2 _open_check:w } ##5 { } { } #3 }
{
- \exp_after:wN \token_to_str:N \l_xparse_function_tl
- \int_eval:n { \l_xparse_total_args_int + 1 }
+ \exp_not:N \tl_if_empty:oTF
+ {
+ \exp_not:c { #1 _arg_ #2 _open_check:w } ##3 #4 ##6 { } { } #3
+ }
+ {
+ \exp_not:c { #1 _arg_ \int_eval:n { #2 + \c_one } :w }
+ ##1 { ##2 ##4 #3 ##5 ##3 #4 ##6 } \exp_not:N \q_xparse
+ }
+ {
+ \exp_not:c { #1 _arg_ #2 _nested:wnnw }
+ ##1 \exp_not:N \q_xparse { ##2 ##4 #3 ##5 } { }
+ ##3 #4 ##6 \exp_not:N \q_xparse
+ }
+ }
+ {
+ \exp_not:c { #1 _arg_ #2 _nested:w } ##1 \exp_not:N \q_xparse
+ { ##2 ##4 #3 }
+ { ##3 #4 ##6 }
+ ##5 \exp_not:N \q_xparse
}
- ##1 {##2} \exp_not:N \q_xparse
}
- \xparse_exp_prepare_function:N
}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
-% \begin{macro}{\xparse_exp_add_type_l:w}
% \begin{macro}{\xparse_exp_add_type_m:w}
-% Gathering \texttt{l} and \texttt{m} arguments is almost the same.
% The grabber for the current argument is created to simply get the
% necessary argument and pass it along with any others through to the
% next function in the chain.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \xparse_exp_add_type_l:w
- {
- \xparse_exp_set:cpx
- {
- \exp_after:wN \token_to_str:N \l_xparse_function_tl
- \int_use:N \l_xparse_total_args_int
- }
- ##1 \q_xparse ##2##
- {
- \exp_not:c
- {
- \exp_after:wN \token_to_str:N \l_xparse_function_tl
- \int_eval:n { \l_xparse_total_args_int + 1 }
- }
- ##1 {##2} \exp_not:N \q_xparse
- }
- \xparse_exp_prepare_function:N
- }
\cs_new_protected_nopar:Npn \xparse_exp_add_type_m:w
{
\int_incr:N \l_xparse_m_args_int
\xparse_exp_set:cpx
{
- \exp_after:wN \token_to_str:N \l_xparse_function_tl
+ \l_xparse_function_tl
+ _arg_
\int_use:N \l_xparse_total_args_int
+ :w
}
##1 \q_xparse ##2
{
\exp_not:c
{
- \exp_after:wN \token_to_str:N \l_xparse_function_tl
- \int_eval:n { \l_xparse_total_args_int + 1 }
+ \l_xparse_function_tl
+ _arg_
+ \int_eval:n { \l_xparse_total_args_int + \c_one }
+ :w
}
- ##1 {##2} \exp_not:N \q_xparse
+ ##1 {##2} \exp_not:N \q_xparse
}
\xparse_exp_prepare_function:N
}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
% \begin{macro}{\xparse_exp_add_type_t:w}
% Looking for a single token is a simpler version of the \texttt{D}
% code. The same idea of picking up one argument is used, but there is
% no need for a second function as there is no closing token to find. So
% either \cs{BooleanTrue} or \cs{BooleanFalse} are added to the list of
-% arguments. In the later case, the grabber argument must be `recycled'.
+% arguments. In the later case, the grabber argument must be
+% \enquote{recycled}.
% \begin{macrocode}
\cs_new_protected:Npn \xparse_exp_add_type_t:w #1
{
- \tl_set:Nx \l_xparse_tmp_tl
- {
- \exp_after:wN \token_to_str:N \l_xparse_function_tl
- \int_eval:n { \l_xparse_total_args_int + 1 }
- }
\xparse_exp_set:cpx
{
- \exp_after:wN \token_to_str:N \l_xparse_function_tl
+ \l_xparse_function_tl
+ _arg_
\int_use:N \l_xparse_total_args_int
+ :w
}
##1 \q_xparse ##2
{
- \exp_not:N \tl_if_head_eq_charcode:nNTF {##2} #1
+ \exp_not:N \str_if_eq:nnTF {##2} {#1}
{
- \exp_not:c { \l_xparse_tmp_tl }
+ \exp_not:c
+ {
+ \l_xparse_function_tl
+ _arg_
+ \int_eval:n { \l_xparse_total_args_int + \c_one }
+ :w
+ }
##1 \exp_not:n { { \BooleanTrue } \q_xparse }
}
{
- \exp_not:c { \l_xparse_tmp_tl }
- ##1 \exp_not:n { { \BooleanFalse } \q_xparse {##2} }
+ \exp_not:c
+ {
+ \l_xparse_function_tl
+ _arg_
+ \int_eval:n { \l_xparse_total_args_int + \c_one }
+ :w
+ }
+ ##1 \exp_not:n { { \BooleanFalse } \q_xparse } {##2}
}
}
\xparse_exp_prepare_function:N
@@ -2410,15 +2432,19 @@
{
\xparse_exp_set:cpx
{
- \exp_after:wN \token_to_str:N \l_xparse_function_tl
+ \l_xparse_function_tl
+ _arg_
\int_use:N \l_xparse_total_args_int
+ :w
}
##1 \q_xparse ##2 #1
{
\exp_not:c
{
- \exp_after:wN \token_to_str:N \l_xparse_function_tl
- \int_eval:n { \l_xparse_total_args_int + 1 }
+ \l_xparse_function_tl
+ _arg_
+ \int_eval:n { \l_xparse_total_args_int + \c_one }
+ :w
}
##1 {##2} \exp_not:N \q_xparse
}
@@ -2435,7 +2461,8 @@
{
\cs_if_free:cTF { xparse_exp_add_type_ #1 :w }
{
- \msg_error:nnx { xparse } { unknown-argument-type }
+ \msg_error:nnx { xparse }
+ { unknown-expandable-argument-type }
{ \tl_to_str:n {#1} }
\tl_set:Nn \l_xparse_last_arg_tl { m }
\xparse_exp_add_type_m:w
@@ -2454,12 +2481,12 @@
% \begin{macro}[aux]{\xparse_exp_declare_cmd_mixed_aux:Nn}
% The overall scheme here is very different from the standard method.
% For each argument, an internal function is created to grab an argument
-% and pass along previous ones. Each `daisy chains' to call the next
-% one in the sequence. Thus at the end of the chain, an extra `argument'
-% function is included to unwind the chain and pass data to the the
-% internal function containing the actual code. If all of the arguments
-% are type \texttt{m}, then the same tick is used as in the standard
-% version. The \texttt{x} in the lead-off and mop-up functions makes
+% and pass along previous ones. Each \enquote{daisy chains} to call the next
+% one in the sequence. Thus at the end of the chain, an extra
+% \enquote{argument} function is included to unwind the chain and pass data
+% to the the internal function containing the actual code. If all of the
+% arguments are type \texttt{m}, then the same tick is used as in the
+% standard version. The \texttt{x} in the lead-off and mop-up functions makes
% sure that the braces around the first argument are not lost.
% \begin{macrocode}
\cs_new_protected:Npn \xparse_exp_declare_cmd:Nnn #1#2#3
@@ -2473,11 +2500,11 @@
\msg_info:nnxx { xparse } { define-command }
{ \token_to_str:N #1 } { \tl_to_str:n {#2} }
}
- \group_begin:
+ \group_begin:
\tex_escapechar:D 92 \scan_stop:
- \tl_set:Nx \l_xparse_function_tl { \token_to_str:N #1}
- \exp_args:NNNo \group_end:
- \tl_set:Nn \l_xparse_function_tl { \l_xparse_function_tl }
+ \tl_set:Nx \l_xparse_function_tl { \token_to_str:N #1 }
+ \exp_args:NNNV \group_end:
+ \tl_set:Nn \l_xparse_function_tl \l_xparse_function_tl
\xparse_exp_prepare_function:n {#2}
\int_compare:nNnTF \l_xparse_total_args_int = \l_xparse_m_args_int
{ \xparse_exp_declare_cmd_all_m:Nn #1 {#3} }
@@ -2504,13 +2531,20 @@
\cs_new_protected:Npn \xparse_exp_declare_cmd_mixed_aux:Nn #1#2
{
\cs_set_nopar:Npx #1
- { \exp_not:c { \token_to_str:N #1 1 } x \exp_not:N \q_xparse }
+ {
+ \exp_not:c { \l_xparse_function_tl _arg_ 1 :w } x \exp_not:N \q_xparse
+ }
\cs_set_nopar:cpx
- { \token_to_str:N #1 \int_eval:n { \l_xparse_total_args_int + 1 } }
+ {
+ \l_xparse_function_tl
+ _arg_
+ \int_eval:n { \l_xparse_total_args_int + \c_one }
+ :w
+ }
x ##1 \q_xparse
- { \exp_not:c { \token_to_str:N #1 } ##1 }
+ { \exp_not:c { \l_xparse_function_tl } ##1 }
\cs_generate_from_arg_count:cNnn
- { \token_to_str:N #1 } \cs_set:Npn \l_xparse_total_args_int {#2}
+ { \l_xparse_function_tl } \cs_set:Npn \l_xparse_total_args_int {#2}
}
% \end{macrocode}
% \end{macro}
@@ -2520,37 +2554,15 @@
%
% \begin{macro}{\xparse_exp_prepare_function:n}
% \begin{macro}[aux]{\xparse_exp_prepare_function_aux:n}
-% A couple of early validation tests. Processors are forbidden, as are
-% \texttt{g}, \texttt{l}, \texttt{u} and \texttt{v} arguments.
+% Processors are forbidden in expandable functions.
% \begin{macrocode}
\cs_new_protected:Npn \xparse_exp_prepare_function:n #1
{
- \bool_set_false:N \l_xparse_error_bool
- \tl_if_in:nnT {#1} { > }
+ \tl_if_in:nnTF {#1} { > }
{
\msg_error:nnxx { xparse } { processor-in-expandable }
{ \tl_to_str:n {#1} }
- \bool_set_true:N \l_xparse_error_bool
- }
- \tl_if_in:nnT {#1} { g }
- {
- \msg_error:nnxx { xparse } { grouped-in-expandable }
- { g } { \tl_to_str:n {#1} }
- \bool_set_true:N \l_xparse_error_bool
- }
- \tl_if_in:nnT {#1} { G }
- {
- \msg_error:nnxx { xparse } { grouped-in-expandable }
- { G } { \tl_to_str:n {#1} }
- \bool_set_true:N \l_xparse_error_bool
}
- \tl_if_in:nnT {#1} { v }
- {
- \msg_error:nnxx { xparse } { verbatim-in-expandable }
- { v } { \tl_to_str:n {#1} }
- \bool_set_true:N \l_xparse_error_bool
- }
- \bool_if:NF \l_xparse_error_bool
{ \xparse_exp_prepare_function_aux:n {#1} }
}
\cs_new_protected:Npn \xparse_exp_prepare_function_aux:n #1
@@ -2748,14 +2760,6 @@
(or~no~arguments~at~all).~You~cannot~have~a~terminal~optional~
argument~with~expandable~commands.
}
-\msg_new:nnnn { xparse } { grouped-in-expandable }
- { Argument~specifier~'#1'~forbidden~in~expandable~commands. }
- {
- \c_msg_coding_error_text_tl
- Argument~specification~'#2'~contains~the~optional~grouped~
- argument~'#1':~
- this~is only~supported~for~standard~robust~functions.
- }
\msg_new:nnnn { xparse } { inconsistent-long }
{ Inconsistent~long~arguments~for~expandable~command. }
{
@@ -2796,6 +2800,14 @@
You~have~asked~for~the~argument~specification~for~a~command~'#1',~
but~this~is~not~a~document~environment.
}
+\msg_new:nnnn { xparse } { unknown-expandable-argument-type }
+ { Unknown~argument~type~'#1'~replaced~by~'m'. }
+ {
+ \c_msg_coding_error_text_tl
+ The~letter~'#1'~does~not~specify~an~argument~type~which~can~be~used~
+ in~an~expandable~function.
+ LaTeX~will~assume~you~want~a~standard~mandatory~argument~(type~'m').
+ }
\msg_new:nnnn { xparse } { verbatim-newline }
{ Verbatim~argument~of~#1~ended~by~end~of~line. }
{
@@ -2809,14 +2821,6 @@
The~command~#1~takes~a~verbatim~argument.~It~may~not~appear~within~
the~argument~of~another~function.~I~will~ignore~'#2'.
}
-
-\msg_new:nnnn { xparse } { verbatim-in-expandable }
- { Argument~specifier~'#1'~forbidden~in~expandable~commands. }
- {
- \c_msg_coding_error_text_tl
- Argument~specification~'#2'~contains~the~verbatim~argument~'#1':~
- this~is only~supported~for~standard~robust~functions.
- }
% \end{macrocode}
%
% Intended more for information.
diff --git a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx
index afa30c7500b..bacc031f584 100644
--- a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx
+++ b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx
@@ -40,7 +40,7 @@
%
%<*driver|package>
\RequirePackage{expl3}
-\GetIdInfo$Id: xtemplate.dtx 3036 2011-12-07 19:29:18Z joseph $
+\GetIdInfo$Id: xtemplate.dtx 3109 2011-12-29 10:42:27Z joseph $
{L3 Experimental prototype document functions}
%</driver|package>
%<*driver>
@@ -661,7 +661,7 @@
%
% A check to make sure that \pkg{expl3} is not too old
% \begin{macrocode}
-\@ifpackagelater { expl3 } { 2011/12/07 }
+\@ifpackagelater { expl3 } { 2011/12/29 }
{ }
{
\PackageError { xtemplate } { Support~package~l3kernel~too~old. }