summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3packages/xparse
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-02-28 00:40:31 +0000
committerKarl Berry <karl@freefriends.org>2012-02-28 00:40:31 +0000
commite20ea4bdd670e0418363a2a38a54b422a4d83231 (patch)
treee75e065101424a1535a03f6d071b8cc17d22eb2d /Master/texmf-dist/tex/latex/l3packages/xparse
parented49b3dfe19b91f9fd96ab70fe95dcda8fba24c8 (diff)
l3packages 3471 (26feb12)
git-svn-id: svn://tug.org/texlive/trunk@25524 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3packages/xparse')
-rw-r--r--Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty177
1 files changed, 86 insertions, 91 deletions
diff --git a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
index 045016b235a..f346bb55be1 100644
--- a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
+++ b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
@@ -50,8 +50,8 @@
%%
%% -----------------------------------------------------------------------
%%
-\RequirePackage{expl3}[2012/02/08]
-\@ifpackagelater{expl3}{2012/02/08}
+\RequirePackage{expl3}[2012/02/26]
+\@ifpackagelater{expl3}{2012/02/26}
{}
{
\PackageError{xparse}{Support package l3kernel too old.}
@@ -62,7 +62,7 @@
}
\endinput
}
-\GetIdInfo$Id: xparse.dtx 3342 2012-02-08 19:34:51Z joseph $
+\GetIdInfo$Id: xparse.dtx 3471 2012-02-26 20:12:23Z joseph $
{L3 Experimental document command parser}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
@@ -254,7 +254,7 @@
}
\cs_new_protected:cpn { xparse_count_type_>:w } #1
{
- \quark_if_recursion_tail_stop_do:nn {#1} { \xparse_bad_signature:wn }
+ \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 }
@@ -263,21 +263,21 @@
{
\xparse_single_token_check:n {#1}
\xparse_single_token_check:n {#2}
- \quark_if_recursion_tail_stop_do:Nn #2 { \xparse_bad_signature:wn }
+ \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
{
\xparse_single_token_check:n {#1}
\xparse_single_token_check:n {#2}
- \quark_if_recursion_tail_stop_do:nn {#3} { \xparse_bad_signature:wn }
+ \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
{
- \quark_if_recursion_tail_stop_do:nn {#1} { \xparse_bad_signature:wn }
+ \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
@@ -289,7 +289,7 @@
{
\xparse_single_token_check:n {#1}
\xparse_single_token_check:n {#2}
- \quark_if_recursion_tail_stop_do:Nn #2 { \xparse_bad_signature:wn }
+ \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
}
@@ -297,19 +297,19 @@
{
\xparse_single_token_check:n {#1}
\xparse_single_token_check:n {#2}
- \quark_if_recursion_tail_stop_do:nn {#3} { \xparse_bad_signature:wn }
+ \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
{
\xparse_single_token_check:n {#1}
- \quark_if_recursion_tail_stop_do:Nn #1 { \xparse_bad_signature:wn }
+ \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
{
- \quark_if_recursion_tail_stop_do:nn {#1} { \xparse_bad_signature:wn }
+ \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
}
@@ -324,8 +324,8 @@
\msg_kernel_error:nnx { xparse } { not-single-token }
{ \tl_to_str:n {#1} } { \tl_to_str:n {#3} }
}
-\cs_new_protected:Npn \xparse_bad_signature:wn #1 \xparse_break_point:n #2
- { \msg_kernel_error:nnx { xparse } { bad-signature } { \tl_to_str:n {#2} } }
+\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
@@ -953,18 +953,14 @@
}
\cs_new_protected_nopar:Npn \xparse_grab_v_group_end:
{
- \tl_set:Nx \l_xparse_tmp_tl
- {
- \tl_set:Nn \exp_not:N \l_xparse_v_arg_tl
- { \exp_not:o \l_xparse_v_arg_tl }
- }
- \exp_after:wN \group_align_safe_end:
- \exp_after:wN \group_end:
- \l_xparse_tmp_tl
+ \group_align_safe_end:
+ \exp_args:NNNo
+ \group_end:
+ \tl_set:Nn \l_xparse_v_arg_tl { \l_xparse_v_arg_tl }
}
\cs_new_protected:Npn \xparse_grab_v_aux_test:N #1
{
- \tl_put_right:Nn \l_xparse_v_arg_tl {#1}
+ \xparse_grab_v_aux_put:N #1
\xparse_grab_v_token_if_char:NTF #1
{
\xparse_grab_v_aux_catcodes:
@@ -985,7 +981,7 @@
\token_if_eq_charcode:NNTF #1 #2
{ \xparse_grab_v_aux_loop_end: }
{
- \tl_put_right:Nn \l_xparse_v_arg_tl { #2 }
+ \xparse_grab_v_aux_put:N #2
\xparse_grab_v_aux_loop:N #1
}
}
@@ -994,17 +990,16 @@
\cs_new_protected_nopar:Npn \xparse_grab_v_aux_loop_end:
{
\xparse_grab_v_group_end:
- \exp_args:Nx \xparse_add_arg:n
- { \exp_args:No \str_tail:n { \l_xparse_v_arg_tl } }
+ \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:Npn \xparse_grab_v_bgroup:
+\cs_new_protected_nopar:Npx \xparse_grab_v_bgroup:
{
- \xparse_grab_v_aux_catcodes:
- \int_set_eq:NN \l_xparse_v_nesting_int \c_one
- \tl_set:Nx \l_xparse_v_arg_tl { \iow_char: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:
{
@@ -1021,7 +1016,7 @@
\int_decr:N \l_xparse_v_nesting_int
\int_compare:nNnTF \l_xparse_v_nesting_int > \c_zero
{
- \tl_put_right:Nn \l_xparse_v_arg_tl { #1 }
+ \xparse_grab_v_aux_put:N #1
\xparse_grab_v_bgroup_loop:
}
{ \xparse_grab_v_aux_loop_end: }
@@ -1029,7 +1024,7 @@
{
\token_if_eq_charcode:NNT \c_group_begin_token #1
{ \int_incr:N \l_xparse_v_nesting_int }
- \tl_put_right:Nn \l_xparse_v_arg_tl { #1 }
+ \xparse_grab_v_aux_put:N #1
\xparse_grab_v_bgroup_loop:
}
}
@@ -1069,6 +1064,14 @@
\l_xparse_v_rest_of_signature_tl \l_xparse_args_tl
}
}
+\cs_new_protected:Npn \xparse_grab_v_aux_put:N #1
+ {
+ \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
@@ -1215,56 +1218,6 @@
{ \tl_set:Nn \ProcessedArgument { \c_false_bool } }
{ \tl_set:Nn \ProcessedArgument { \c_true_bool } }
}
-\tl_new:N \l_xparse_split_argument_tl
-\group_begin:
- \char_set_catcode_active:N \@
- \cs_new_protected:Npn \xparse_split_argument:nnn #1#2#3
- {
- \tl_set:Nn \l_xparse_split_argument_tl {#3}
- \group_begin:
- \char_set_lccode:nn { `\@ } { `#2}
- \tl_to_lowercase:n
- {
- \group_end:
- \tl_replace_all:Nnn \l_xparse_split_argument_tl { @ } {#2}
- }
- \cs_set_protected:Npn \xparse_split_argument_aux_i:w
- ##1 \q_mark ##2 #2 ##3 \q_stop
- {
- \tl_put_right:Nn \ProcessedArgument { {##2} }
- ##1 \q_mark ##3 \q_stop
- }
- \cs_set_protected:Npn \xparse_split_argument_aux_iii:w
- ##1 #2 ##2 \q_stop
- {
- \IfNoValueF {##1}
- {
- \msg_kernel_error:nnxxx { xparse } { split-excess-tokens }
- { \tl_to_str:n {#2} } { \tl_to_str:n {#1} }
- { \tl_to_str:n {#3} }
- }
- }
- \tl_set:Nx \l_xparse_tmp_tl
- {
- \prg_replicate:nn { #1 + 1 }
- { \xparse_split_argument_aux_i:w }
- \xparse_split_argument_aux_ii:w
- \exp_not:N \q_mark
- \exp_not:o \l_xparse_split_argument_tl
- \prg_replicate:nn {#1} { \exp_not:n {#2} \NoValue }
- \exp_not:n { #2 \q_stop }
- }
- \l_xparse_tmp_tl
- }
-\group_end:
-\cs_new_protected:Npn \xparse_split_argument_aux_i:w { }
-\cs_new_protected:Npn \xparse_split_argument_aux_ii:w
- #1 \q_mark #2 \q_stop
- {
- \tl_if_empty:nF {#2}
- { \xparse_split_argument_aux_iii:w #2 \q_stop }
- }
-\cs_new_protected:Npn \xparse_split_argument_aux_iii:w { }
\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
@@ -1272,7 +1225,7 @@
\bool_if:nTF
{
\tl_if_single_p:n {#1} &&
- ! (\token_if_cs_p:N #1 )
+ ! ( \token_if_cs_p:N #1 )
}
{ \xparse_split_list_single:Nn #1 {#2} }
{ \xparse_split_list_multi:nn {#1} {#2} }
@@ -1300,6 +1253,49 @@
\xparse_split_list_multi:nV {#1} \l_xparse_split_list_tl
}
\group_end:
+\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 }
+ {#1} {#2} {#3}
+ }
+\cs_new_protected:Npn \xparse_split_argument_aux:nnnn #1#2#3#4
+ {
+ \int_compare:nNnF {#1} = { #2 + \c_one }
+ {
+ \int_compare:nNnTF {#1} > { #2 + \c_one }
+ {
+ \tl_set:Nx \ProcessedArgument
+ {
+ \exp_last_unbraced:NnNo
+ \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 }
+ { \tl_to_str:n {#3} } { \int_eval:n { #2 + \c_one } }
+ { \tl_to_str:n {#4} }
+ }
+ {
+ \tl_put_right:Nx \ProcessedArgument
+ {
+ \prg_replicate:nn { #2 + \c_one - (#1) }
+ { { \exp_not:n { \NoValue } } }
+ }
+ }
+ }
+ }
+\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
{ \tl_set:Nx \ProcessedArgument { \tl_trim_spaces:n {#1} } }
\cs_new_protected:Npn \xparse_get_arg_spec:N #1
@@ -1323,7 +1319,6 @@
\tl_new:N \ArgumentSpecification
\cs_new_protected:Npn \xparse_show_arg_spec:N #1
{
- \tl_set:Nx \l_xparse_function_tl { \cs_to_str:N #1 }
\prop_get:NnNTF \l_xparse_command_arg_specs_prop {#1}
\ArgumentSpecification
{ \tl_show:N \ArgumentSpecification }
@@ -1344,12 +1339,12 @@
}
\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-signature }
- { Bad~signature~'#1'. }
+\msg_kernel_new:nnnn { xparse } { bad-arg-spec }
+ { Bad~argument~specification~'#1'. }
{
\c_msg_coding_error_text_tl
- The~signature~provided~was~not~valid:~one~or~more~mandatory~pieces~
- of~information~were~missing. \\ \\
+ The~argument~specification~provided~was~not~valid:~
+ one~or~more~mandatory~pieces~of~information~were~missing. \\ \\
LaTeX~will~ignore~this~entire~definition.
}
\msg_kernel_new:nnnn { xparse } { command-already-defined }
@@ -1394,7 +1389,7 @@
The~command~will~be~ignored.
}
\msg_kernel_new:nnnn { xparse } { expandable-ending-optional }
- { Signature~for~expandable~command~ends~with~optional~argument. }
+ { Argument~specification~for~expandable~command~ends~with~optional~argument. }
{
\c_msg_coding_error_text_tl
Expandable~commands~must~have~a~final~mandatory~argument~
@@ -1428,8 +1423,8 @@
{ Argument~delimiter~should~be~a~single~token:~'#1'. }
{
\c_msg_coding_error_text_tl
- The~signature~provided~was~not~valid:~in~a~place~where~a~single~token~is~
- required,~LaTeX~found~'#1'. \\ \\
+ The~argument~specification~provided~was~not~valid:~
+ 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 }