%% %% This is file `xparse.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% xparse.dtx (with options: `package') %% %% (C) Copyright The LaTeX3 Project and any individual authors %% listed elsewhere in this file. %% %% This is a generated file. %% %% This file was generated from file(s) of the xbase bundle. %% --------------------------------------------------------- %% %% This file may only be distributed together with a copy of this bundle. %% You may however distribute the bundle without such generated files. %% %% ====================================================================== %% %% File: xparse.dtx (C) Copyright 1999 Frank Mittelbach, Chris Rowley, David Carlisle %% (C) Copyright 2004-2006 Frank Mittelbach, 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 %% license or (at your option) any later version. The latest version %% of this license is in the file %% %% http://www.latex-project.org/lppl.txt %% %% This file is part of the ``xbase bundle'' (The Work in LPPL) %% and all files in that bundle must be distributed together. %% %% The released version of this bundle is available from CTAN. %% %% ----------------------------------------------------------------------- %% %% The development version of the bundle can be found at %% %% http://www.latex-project.org/cgi-bin/cvsweb.cgi/ %% %% for those people who are interested. %% %%%%%%%%%%% %% NOTE: %% %%%%%%%%%%% %% %% Snapshots taken from the repository represent work in progress and may %% not work or may contain conflicting material! We therefore ask %% people _not_ to put them into distributions, archives, etc. without %% prior consultation with the LaTeX Project Team. %% %% ----------------------------------------------------------------------- %% \RequirePackage{l3names} \GetIdInfo$Id: xparse.dtx 574 2006-08-21 23:30:10Z morten $ {generic document command parser} \RequirePackage{l3tlp,l3num,l3toks,l3prg,l3int,l3seq,l3token} \def_new:NNn \xparse_already_defined_error_msg:N 1 { \xparse_error:x { Command~name~`\token_to_string:N #1'~ already~defined! } } \def_new:NNn \xparse_not_yet_defined_error_msg:N 1 { \xparse_error:x { Command~`\token_to_string:N #1'~ not~ yet~defined! } } \def_new:NNn \xparse_begins_with_end_error_msg:N 1 { \xparse_error:x { Command~`\token_to_string:N #1'~begins~with~ `\token_to_string:N \end'! } } \def_new:NNn \xparse_unknown_arg_type_error_msg:N 1{ \xparse_error:x { Unknown~ argument~ type~ `#1'~ I'll~ substitute~ it~ with~ `m'~ for~ now.~ Fingers~ crossed... } } \def_new:NNn \xparse_no_command_implementation_warning:n 1 { \xparse_warning:x {No~ implementation~ for~ `#1'~ defined} } \def_new:NNn \xparse_error:x 1{\tex_errmessage:D {xparse~error:~#1}} \def_new:NNn \xparse_warning:x 1{\io_put_term:x{xparse~warning:~#1}} \def_new:NNn \xparse_if_definable:NTF 1 { \cs_free:NTF #1 { \xparse_begins_with_end:NTF #1 { \xparse_begins_with_end_error_msg:N #1 \use_arg_ii:nn } \use_arg_i:nn } { \xparse_already_defined_error_msg:N #1 \use_arg_ii:nn } } \def_new:NNn \xparse_if_definable:cTF 0 { \exp_args:Nc \xparse_if_definable:NTF } \def_new:NNn \xparse_if_redefinable:NTF 1 { \cs_free:NTF #1 { \xparse_not_yet_defined_error_msg:N #1 \use_arg_ii:nn } { \xparse_begins_with_end:NTF #1 { \xparse_begins_with_end_error_msg:N #1 \use_arg_ii:nn } \use_arg_i:nn } } \def_new:NNn \xparse_if_redefinable:cTF 0 { \exp_args:Nc \xparse_if_redefinable:NTF } \def_new:NNn \xparse_begins_with_end:NTF 1 { \group_begin: \exp_args:Nc \xparse_begins_with_end_aux:N { \tlist_head_iii:f { \cs_to_str:N #1 ??} } } \def_new:NNn \xparse_begins_with_end_aux:N 1 { \if:w \cs_if_eq_name_p:NN #1 \end \group_end: \exp_after:NN \use_arg_i:nn \else: \group_end: \exp_after:NN \use_arg_ii:nn \fi: } \def_new:NNn \DeclareDocumentCommand 1 { \xparse_if_definable:NTF #1 { \xparse_declare_document_command:Nnn #1 } \use_none:nn } \def_new:NNn \ReDeclareDocumentCommand 1 { \xparse_if_redefinable:NTF #1 { \xparse_declare_document_command:Nnn #1 } \use_none:nn } \def_new:NNn \DeclareDocumentEnvironment 1 { \xparse_if_definable:cTF {#1} { \xparse_declare_document_environment:nnnn {#1} } \use_none:nnn } \def_new:NNn \ReDeclareDocumentEnvironment 1 { \xparse_if_redefinable:cTF {#1} { \xparse_declare_document_environment:nnnn {#1} } \use_none:nnn } \def_new:NNn \ProvideDocumentCommand 1{ \cs_free:NTF #1 { \DeclareDocumentCommand #1} \use_none:nn } \def_new:NNn \ProvideDocumentEnvironment 1{ \cs_free:cTF {#1} { \DeclareDocumentEnvironment {#1} } \use_none:nnn } \toks_new:N \l_xparse_grabbed_args_toks \toks_new:N \l_xparse_end_environment_args_toks \int_new:N \l_xparse_mandatory_args_int \int_new:N \l_xparse_total_args_int \def_long:NNn \xparse_declare_document_command:Nnn 3{ \xparse_prepare_signature:n {#2} \def_protected:Npx #1 { \exp_not:n { \toks_set:Nn \l_xparse_grabbed_args_toks } {\exp_not:c {\token_to_string:N #1}} \toks_use:N \l_xparse_grabbed_args_toks \exp_not:n{ \toks_use:N \l_xparse_grabbed_args_toks} } \def_long:cNn {\token_to_string:N #1}\l_xparse_total_args_int{#3} } \def_new:Npn \xparse_declare_document_command:cnn { \exp_args:Nc \xparse_declare_document_command:Nnn } \def_long_new:NNn \xparse_declare_document_environment:nnnn 4 { \xparse_declare_document_command:cnn {#1}{#2} { \group_begin: \toks_set_eq:NN \l_xparse_end_environment_args_toks \l_xparse_grabbed_args_toks #3 } \let:cN {end #1} \xparse_parsed_end_environment: \def_long:cNn {end \token_to_string:N \\ #1} \l_xparse_total_args_int{#4} } \def_protected_new:NNn \xparse_parsed_end_environment: 0{ \exp_after:NN \xparse_parsed_end_environment_aux:N \toks_use:N \l_xparse_end_environment_args_toks \group_end: } \def_new:NNn \xparse_parsed_end_environment_aux:N 1{ \cs_use:c {end \token_to_string:N #1 } } \def_long_new:NNn \DeclareDocumentCommandInterface 3{ \xparse_prepare_signature:n {#3} \def_protected:Npx #1 { \exp_not:n { \toks_set:Nn \l_xparse_grabbed_args_toks } {\exp_not:c {impl-#2}} \toks_use:N\l_xparse_grabbed_args_toks \exp_not:n{ \toks_use:N \l_xparse_grabbed_args_toks} } \def_long:cNn {impl-#2} \l_xparse_total_args_int {\xparse_undefined_command_implementation:n{#2}} } \def_new:NNn \xparse_undefined_command_implementation:n 1{ ``#1'' \xparse_no_command_implementation_warning:n {#1} } \def_long_new:NNn \DeclareDocumentCommandImplementation 3{ \def_long:cNn {impl-#1}#2{#3} } \def_new:NNn \xparse_prepare_signature:n 1 { \int_zero:N \l_xparse_total_args_int \toks_clear:N \l_xparse_grabbed_args_toks \int_zero:N \l_xparse_mandatory_args_int \bool_gset_false:N \g_xparse_insert_marker_bool \bool_gset_false:N \g_xparse_allow_par_bool \tlp_gset_eq:NN \g_xparse_ignore_marker_tlp \g_xparse_ignore_spaces_marker_tlp \xparse_parse_signature:n #1 \q_nil } \tlp_new:Nn \g_xparse_ignore_marker_tlp {} \seq_new:N \g_xparse_ignore_marker_seq \bool_new:N \g_xparse_insert_marker_bool \def_new:cpn {xparse_add_arg_type_>:} #1 \xparse_read_arg_type_or_grab_default:n #2{ \xparse_add_remaining_m_args: \bool_gset_true:N \g_xparse_insert_marker_bool \int_decr:N \l_xparse_total_args_int \tlist_map_inline:nn{#2}{ \xparse_check_and_add_argument_type:N ##1 } \xparse_parse_signature:n } \def_new:NNn \xparse_add_ignore_marker:Nnn 3{ \tlp_new:cn {g_xparse #2 _marker_tlp}{#3} \seq_gpush:NC \g_xparse_ignore_marker_seq {g_xparse #2 _marker_tlp} \def_new:cpn {xparse_add_arg_type_#1:}{ \tlp_gset_eq:Nc \g_xparse_ignore_marker_tlp {g_xparse #2 _marker_tlp} } } \xparse_add_ignore_marker:Nnn W{_ignore_nothing}{} \xparse_add_ignore_marker:Nnn i{_ignore_spaces}{_ignore_spaces} \xparse_add_ignore_marker:Nnn I{_ignore_pars}{_ignore_pars} \def_new:NNn \xparse_add_arg_type_P: 0{ \bool_gset_true:N \g_xparse_allow_par_bool } \bool_new:N \g_xparse_allow_par_bool \def_new:NNn \xparse_parse_signature:n 1{ \quark_if_nil:NTF #1 { \xparse_add_remaining_m_args: } { \int_incr:N \l_xparse_total_args_int \xparse_check_and_add_argument_type:N #1 \bool_if:NT \g_xparse_insert_marker_bool { \bool_gset_false:N \g_xparse_insert_marker_bool \bool_gset_false:N \g_xparse_allow_par_bool \tlp_gset_eq:NN \g_xparse_ignore_marker_tlp \g_xparse_ignore_spaces_marker_tlp } \xparse_read_arg_type_or_grab_default:n } } \def_new:NNn \xparse_check_and_add_argument_type:N 1 { \cs_free:cTF {xparse_add_arg_type_#1:} { \xparse_unknown_arg_type_error_msg:N #1 \int_incr:N \l_xparse_mandatory_args_int } { \cs_use:c {xparse_add_arg_type_#1:} } } \let_new:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n \def_new:NNn \xparse_grab_default_arg:n 1{ \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#1}} \let:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n \xparse_parse_signature:n } \def_long_new:NNn \xparse_grab_default_arg_allow_par:n 1{ \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#1}} \let:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n \xparse_parse_signature:n } \def_new:Npn \xparse_add_arg_type_m: { \bool_if:NTF \g_xparse_allow_par_bool { \toks_put_right:Nn \l_xparse_grabbed_args_toks {\xparse_allow_par_m:w} } { \int_incr:N \l_xparse_mandatory_args_int } } \def_new:Npn \xparse_add_remaining_m_args: { \int_compare:nNnF \l_xparse_mandatory_args_int = \c_zero { \toks_put_right:Nx \l_xparse_grabbed_args_toks { \exp_not:c{xparse_m \int_use:N \l_xparse_mandatory_args_int :w } } \int_zero:N \l_xparse_mandatory_args_int } } \def_new:cpn {xparse_m1:w} #1 \l_xparse_grabbed_args_toks#2{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}} #1 \l_xparse_grabbed_args_toks } \def_new:cpn {xparse_m2:w} #1 \l_xparse_grabbed_args_toks #2#3{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}{#3}} #1 \l_xparse_grabbed_args_toks } \def_new:cpn {xparse_m3:w} #1 \l_xparse_grabbed_args_toks #2#3#4{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}{#3}{#4}} #1 \l_xparse_grabbed_args_toks } \def_new:cpn {xparse_m4:w} #1 \l_xparse_grabbed_args_toks #2#3#4#5{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}{#3}{#4}{#5}} #1 \l_xparse_grabbed_args_toks } \def_new:cpn {xparse_m5:w} #1 \l_xparse_grabbed_args_toks #2#3#4#5#6{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}{#3}{#4}{#5}{#6}} #1 \l_xparse_grabbed_args_toks } \def_new:cpn {xparse_m6:w} #1 \l_xparse_grabbed_args_toks #2#3#4#5#6#7{ \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#2}{#3}{#4}{#5}{#6}{#7}} #1 \l_xparse_grabbed_args_toks } \def_new:cpn {xparse_m7:w} #1 \l_xparse_grabbed_args_toks#2#3#4#5#6#7#8{ \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#2}{#3}{#4}{#5}{#6}{#7}{#8}} #1 \l_xparse_grabbed_args_toks } \def_new:cpn {xparse_m8:w} #1\l_xparse_grabbed_args_toks #2#3#4#5#6#7#8#9{ \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}} #1 \l_xparse_grabbed_args_toks } \def_new:cpn {xparse_m9:w} \toks_use:N \l_xparse_grabbed_args_toks #1#2#3#4#5#6#7#8#9{ \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}} \toks_use:N \l_xparse_grabbed_args_toks } \def_long_new:Npn \xparse_allow_par_m:w #1 \l_xparse_grabbed_args_toks#2{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}} #1 \l_xparse_grabbed_args_toks } \def_new:Npn \xparse_add_arg_type_l: { \xparse_add_remaining_m_args: \bool_if:NTF \g_xparse_allow_par_bool { \toks_put_right:Nn \l_xparse_grabbed_args_toks {\xparse_allow_par_l:w} } { \toks_put_right:Nn \l_xparse_grabbed_args_toks {\xparse_l:w} } } \def_new:Npn \xparse_l:w #1 \l_xparse_grabbed_args_toks#2#{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}} #1 \l_xparse_grabbed_args_toks } \def_long_new:Npn \xparse_allow_par_l:w #1 \l_xparse_grabbed_args_toks#2#{ \toks_put_right:Nn \l_xparse_grabbed_args_toks{{#2}} #1 \l_xparse_grabbed_args_toks } \def_new:NNn \DeclareSymbolArgument 2{ \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tlp { \def:cpx {xparse \l_tmpa_tlp _#1:w}##1##2\l_xparse_grabbed_args_toks{ \exp_not:c{peek_ #2 _remove \l_tmpa_tlp :NTF} ##1 { \exp_not:N \toks_put_right:Nn \exp_not:N \l_xparse_grabbed_args_toks \exp_not:N \c_true ##2 \exp_not:N\l_xparse_grabbed_args_toks } { \exp_not:N \toks_put_right:Nn \exp_not:N \l_xparse_grabbed_args_toks \exp_not:N \c_false ##2 \exp_not:N\l_xparse_grabbed_args_toks } } } \def:cpn {xparse_add_arg_type_#1:} { \xparse_add_remaining_m_args: \toks_put_right:Nx \l_xparse_grabbed_args_toks { \exp_not:c {xparse \g_xparse_ignore_marker_tlp _#1:w } } \let:NN \xparse_read_arg_type_or_grab_default:n \xparse_grab_default_arg:n } } \DeclareSymbolArgument S{meaning} \def_new:NNn \DeclareArgumentType 7{ \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tlp { \def:cpx {xparse \l_tmpa_tlp _#1:w}##1\l_xparse_grabbed_args_toks{ \exp_not:c{peek_#3 \l_tmpa_tlp :NTF} \exp_not:N #2 { \exp_not:c{xparse_#1_#3_help:nw}{##1} } { \exp_not:n { #4 \toks_put_right:Nn \l_xparse_grabbed_args_toks {#5} } ##1 \exp_not:N\l_xparse_grabbed_args_toks } } \def_long:cpx {xparse_allow_par \l_tmpa_tlp _#1:w}##1 \l_xparse_grabbed_args_toks{ \exp_not:c{peek_#3 \l_tmpa_tlp :NTF} \exp_not:N #2 { \exp_not:c{xparse_allow_par_#1_#3_help:nw}{##1} } { \exp_not:n { #4 \toks_put_right:Nn \l_xparse_grabbed_args_toks {#5} } ##1 \exp_not:N\l_xparse_grabbed_args_toks } } } \def:cpn {xparse_add_arg_type_#1:} { \xparse_add_remaining_m_args: \toks_put_right:Nx \l_xparse_grabbed_args_toks { \exp_not:c {xparse \bool_if:NT \g_xparse_allow_par_bool {_allow_par} \g_xparse_ignore_marker_tlp _#1:w } } \let:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n } \xparse_define_helper:Nnnn #1{#3}{#6}{#7} } \def_new:NNn \DeclareArgumentTypeDefaultValue 5{ \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tlp { \def:cpx {xparse \l_tmpa_tlp _#1:w}##1##2\l_xparse_grabbed_args_toks{ \exp_not:c{peek_#3 \l_tmpa_tlp :NTF} \exp_not:N #2 { \exp_not:c{xparse_#1_#3_help:nw}{##2} } { \exp_not:N \toks_put_right:Nn \exp_not:N \l_xparse_grabbed_args_toks {{##1}} ##2 \exp_not:N \l_xparse_grabbed_args_toks } } \def_long:cpx {xparse_allow_par \l_tmpa_tlp _#1:w}##1##2 \l_xparse_grabbed_args_toks{ \exp_not:c{peek_#3 \l_tmpa_tlp :NTF} \exp_not:N #2 { \exp_not:c{xparse_allow_par_#1_#3_help:nw}{##2} } { \exp_not:N \toks_put_right:Nn \exp_not:N \l_xparse_grabbed_args_toks {{##1}} ##2 \exp_not:N \l_xparse_grabbed_args_toks } } } \def:cpn {xparse_add_arg_type_#1:} { \xparse_add_remaining_m_args: \toks_put_right:Nx \l_xparse_grabbed_args_toks { \exp_not:c {xparse \bool_if:NT \g_xparse_allow_par_bool {_allow_par} \g_xparse_ignore_marker_tlp _#1:w } } \let:Nc \xparse_read_arg_type_or_grab_default:n {xparse_grab_default_arg \bool_if:NT \g_xparse_allow_par_bool {_allow_par} :n } } \xparse_define_helper:Nnnn #1{#3}{#4}{#5} } \def_new:NNn \xparse_define_helper:Nnnn 4{ \toks_set:Nn \l_tmpa_toks { #3 { \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#4}} ##1 \l_xparse_grabbed_args_toks } } \toks_set:Nx \l_tmpa_toks { \exp_not:n {\def:cpn{xparse_#1_#2_help:nw}} \toks_use:N \l_tmpa_toks \exp_not:n {\def:cpn{xparse_allow_par_#1_#2_help:nw}} \toks_use:N\l_tmpa_toks } \toks_use:N \l_tmpa_toks } \DeclareArgumentType o[{meaning}{}{\NoValue}{#1[#2]}{#2} \DeclareArgumentType c({meaning}{ \xparse_error:x{ Missing~ coordinate~ argument.~ A~ value~ of~ (0,0)~ is~ assumed} } {{00}} {#1(#2,#3)}{{#2}{#3}} \DeclareArgumentTypeDefaultValue O[{meaning}{#1[#2]}{#2} \DeclareArgumentTypeDefaultValue C({meaning}{#1(#2,#3)}{{#2}{#3}} \def_new:NNn \DeclareArgumentTypeShorthand 2{ \def_new:cpn {xparse_add_arg_type_#1:} ##1 \xparse_read_arg_type_or_grab_default:n { \int_decr:N \l_xparse_total_args_int \xparse_read_arg_type_or_grab_default:n #2 } } \DeclareArgumentTypeShorthand s {S{*}} \let_new:NN \IfBooleanTF \prg_if_predicate:nTF \let_new:NN \IfBooleanT \prg_if_predicate:nT \let_new:NN \IfBooleanF \prg_if_predicate:nF \tlp_new:Nn \NoValue {-NoValue-} \tlp_new:Nn \c_xparse_hidden_no_value_tlp {\NoValue} \def_long_new:Npn \xparse_if_no_value:nTF #1{ \tlp_set:Nx \l_tmpa_tlp{\exp_not:n{#1}} \tlp_if_eq:NNTF \l_tmpa_tlp \c_xparse_hidden_no_value_tlp { \use_arg_i:nn } { \tlist_if_blank:nTF {#1} { \use_arg_ii:nn } {\peek_after:NN \xparse_if_no_value_aux: #1 \q_nil {#1} } } } \def_long_new:Npn \xparse_if_no_value_aux: { \tlp_set:Nx \l_tmpa_tlp{\token_get_arg_spec:N \l_peek_token } \tlp_if_empty:NTF \l_tmpa_tlp {\use_arg_i_delimit_by_q_nil:nw {\exp_args:No\xparse_if_no_value:nTF}} {\use_arg_i_delimit_by_q_nil:nw {\use_arg_iii:nnn}} } \let_new:NN \IfNoValueTF \xparse_if_no_value:nTF \def_long_new:NNn \IfNoValueT 2 {\xparse_if_no_value:nTF{#1}{#2}{}} \def_long_new:NNn \IfNoValueF 1 {\xparse_if_no_value:nTF {#1}{}} \def_long_new:NNn \IfValueTF 3{\xparse_if_no_value:nTF {#1}{#3}{#2}} \let_new:NN \IfValueT \IfNoValueF \let_new:NN \IfValueF \IfNoValueT \tlp_new:Nn \l_xparse_pseudo_post_arg_tlp {} \def_long_new:NNn \DeclarePseudoArgument 4{ \def_long:cNn {xparse_pseudo_pre_arg_#1:\prg_replicate:nn{#2}{n}}#2{#3} \def_long:cNn {xparse_pseudo_post_arg_#1:\prg_replicate:nn{#2}{n}}#2{#4} \def:cNn {xparse_pseudo_nobrace_arg_#1:N} 1 { ##1 \l_xparse_pseudo_post_arg_tlp } \def_long:cNx {xparse_pseudo_arg_#1:w} #2 { \exp_not:c { xparse_pseudo_pre_arg_#1: \prg_replicate:nn{#2}{n} } \cs_use:c{def_aux_use_\int_use:N \int_eval:n{#2}_parameter:} \exp_not:n {\tlp_set:Nn \l_xparse_pseudo_post_arg_tlp} { \exp_not:c {xparse_pseudo_post_arg_#1:\prg_replicate:nn{#2}{n}} \cs_use:c{def_aux_use_\int_use:N \int_eval:n{#2}_parameter:} } \exp_not:n{ \peek_catcode_remove_ignore_spaces:NTF \c_group_begin_token } { \exp_not:n { \c_group_begin_token \group_execute_after:N \l_xparse_pseudo_post_arg_tlp } } { \exp_not:c{xparse_pseudo_nobrace_arg_#1:N} } } } \def_new:NNn \UsePseudoArgument 1{\cs_use:c{xparse_pseudo_arg_#1:w}} \endinput %% %% End of file `xparse.sty'.