diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/xpackages/xparse.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/xpackages/xparse.dtx | 426 |
1 files changed, 199 insertions, 227 deletions
diff --git a/Master/texmf-dist/source/latex/xpackages/xparse.dtx b/Master/texmf-dist/source/latex/xpackages/xparse.dtx index c2dd6796327..8b63e346a6a 100644 --- a/Master/texmf-dist/source/latex/xpackages/xparse.dtx +++ b/Master/texmf-dist/source/latex/xpackages/xparse.dtx @@ -34,10 +34,10 @@ %% ----------------------------------------------------------------------- %% %<*driver|package> -\RequirePackage{l3names} +\RequirePackage{expl3} %</driver|package> %\fi -\GetIdInfo$Id: xparse.dtx 748 2008-08-03 19:00:50Z morten $ +\GetIdInfo$Id: xparse.dtx 1365 2009-05-31 17:26:17Z mittelba $ {generic document command parser} %\iffalse %<*driver> @@ -126,10 +126,10 @@ % \item[O\{default\}] will return the parsed argument surrounded by a % brace pair if present. Otherwise it will return the |{default}| % as specified above. -% \item[S\{\meta{symbol}\}] will return either the token |\c_true| or -% |\c_false| depending on whether or not the next token is +% \item[S\{\meta{symbol}\}] will return either the token |\c_true_bool| or +% |\c_false_bool| depending on whether or not the next token is % \meta{symbol}. -% \item[s] will return either the token |\c_true| or |\c_false| +% \item[s] will return either the token |\c_true_bool| or |\c_false_bool| % depending on whether or not a star was parsed. This is just a % shorthand for |S{*}|. % \item[c] will parse the syntax |(|\meta{x}|,|\meta{y}|)|, i.e., a @@ -144,7 +144,7 @@ % \end{description} % For example, given the spec |soomO{default}| the input % |*[Foo]{Bar}| would be parsed as -% |\c_true{Foo}\NoValue{Bar}{default}|. In other words there will be +% |\c_true_bool{Foo}\NoValue{Bar}{default}|. In other words there will be % always exactly the same number of brace groups or tokens as the % number of letters in the argument spec. % @@ -316,14 +316,14 @@ % However this makes testing for this token slightly complicated as in % that case the test % \begin{verbatim} -% \tlp_set:Nn \l_seen_tlp {#1} -% \tlp_set:Nn \l_hidden_novalue_tlp {\NoValue} -% \tlp_if_eq:NNTF \l_seen_tlp \l_hidden_novalue_tlp +% \tl_set:Nn \l_seen_tl {#1} +% \tl_set:Nn \l_hidden_novalue_tl {\NoValue} +% \tl_if_eq:NNTF \l_seen_tl \l_hidden_novalue_tl % \end{verbatim} % will be true if |#1| was |\NoValue| but false if |#1| itself % contains a macro which contains |\NoValue|; a case that happens % unfortunately very often in practice. Using an unguarded |x| type -% expansion to define |\l_seen_tlp| is out of the question as |#1| is +% expansion to define |\l_seen_tl| is out of the question as |#1| is % typically either |\NoValue| or arbitrary user input for which we % can't properly guard it unless we are sure people only use robust % commands. When running a pure \LaTeX3 format where all document @@ -372,10 +372,10 @@ % \DescribeMacro\IfBooleanT % \DescribeMacro\IfBooleanF % As mentioned earlier, the parsing result for a symbol argument like -% |s| or |S{+}| is represented as the one of the tokens |\c_true| or -% |\c_false| respectively. To test for these values the macro +% |s| or |S{+}| is represented as the one of the tokens |\c_true_bool| or +% |\c_false_bool| respectively. To test for these values the macro % |\IfBooleanTF| can be used. It expects as its first argument either -% |\c_true| or |\c_false| and executes its second or third argument +% |\c_true_bool| or |\c_false_bool| and executes its second or third argument % depending on this value. |\IfBooleanT| and |\IfBooleanF| are % obvious shortcuts. % @@ -804,7 +804,7 @@ % \begin{verbatim} % \DeclarePseudoArgument{boxtest}{1} % {Before:~`#1',\hbox_set_inline_begin:N \l_tmpa_box } -% {\hbox_set_inline_end: \text_put_sp: the~ box:~ +% {\hbox_set_inline_end: \iow_space: the~ box:~ % \hbox_unpack_and_clear:N\l_tmpa_box ,~ % After:~`#1'} % \end{verbatim} @@ -839,7 +839,7 @@ %<*package> \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3tlp,l3num,l3toks,l3prg,l3int,l3seq,l3token} +\RequirePackage{expl3} % \end{macrocode} % % @@ -856,20 +856,20 @@ % \begin{macro}{\xparse_no_command_implementation_warning:n} % The names should give the function's purpose away. % \begin{macrocode} -\def_new:NNn \xparse_already_defined_error_msg:N 1 { +\cs_new_nopar:Nn \xparse_already_defined_error_msg:N { \xparse_error:x { - Command~name~`\token_to_string:N #1'~ already~defined! + Command~name~`\token_to_str:N #1'~ already~defined! } } -\def_new:NNn \xparse_not_yet_defined_error_msg:N 1 { +\cs_new_nopar:Nn \xparse_not_yet_defined_error_msg:N { \xparse_error:x { - Command~`\token_to_string:N #1'~ not~ yet~defined! + Command~`\token_to_str:N #1'~ not~ yet~defined! } } -\def_new:NNn \xparse_begins_with_end_error_msg:N 1 { +\cs_new_nopar:Nn \xparse_begins_with_end_error_msg:N { \xparse_error:x { - Command~`\token_to_string:N #1'~begins~with~ - `\token_to_string:N \end'! + Command~`\token_to_str:N #1'~begins~with~ + `\token_to_str:N \end'! } } % \end{macrocode} @@ -877,7 +877,7 @@ % the argument specification. We can try to recover by putting in an % |m| type instead and hope for the best. % \begin{macrocode} -\def_new:NNn \xparse_unknown_arg_type_error_msg:N 1{ +\cs_new_nopar:Nn \xparse_unknown_arg_type_error_msg:N { \xparse_error:x { Unknown~ argument~ type~ `#1'~ I'll~ substitute~ it~ with~ `m'~ for~ now.~ Fingers~ crossed... @@ -886,7 +886,7 @@ % \end{macrocode} % A message for people using the wrong number of arguments. % \begin{macrocode} -\def_new:NNn \xparse_no_command_implementation_warning:n 1 { +\cs_new_nopar:Nn \xparse_no_command_implementation_warning:n { \xparse_warning:x {No~ implementation~ for~ `#1'~ defined} } % \end{macrocode} @@ -902,8 +902,8 @@ % Here's how we produce the error messages and warnings currently. % This awaits a proper error message module! % \begin{macrocode} -\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}} +\cs_new_nopar:Nn \xparse_error:x {\tex_errmessage:D {xparse~error:~#1}} +\cs_new_nopar:Nn \xparse_warning:x {\iow_term:x{xparse~warning:~#1}} % \end{macrocode} % \end{macro} % \end{macro} @@ -915,32 +915,30 @@ % % \begin{macro}{\xparse_if_definable:NT} % \begin{macro}{\xparse_if_definable:cT} -% A definable command is either |\c_undefined| or |\scan_stop:| and +% An undefinable command is either |\c_undefined| or |\scan_stop:| and % furthermore we won't allow it to start with |\end|. % If the command is definable we do what was asked for otherwise % we give an appropriate error message. % \begin{macrocode} -\def_new:NNn \xparse_if_definable:NTF 1 { +\cs_new_nopar:Npn \xparse_if_definable:NTF #1 { % \end{macrocode} % First check if the control sequence is free. % \begin{macrocode} - \cs_free:NTF #1 + \cs_if_free:NTF #1 % \end{macrocode} % If free check if it begins with |\end|. % \begin{macrocode} { \xparse_begins_with_end:NTF #1 - { \xparse_begins_with_end_error_msg:N #1 \use_arg_ii:nn } - \use_arg_i:nn + { \xparse_begins_with_end_error_msg:N #1 \use_ii:nn } + \use_i:nn } % \end{macrocode} % If not free give an error message. % \begin{macrocode} - { \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 + { \xparse_already_defined_error_msg:N #1 \use_ii:nn } } +\cs_generate_variant:Nn \xparse_if_definable:NTF {c} % \end{macrocode} % \end{macro} % \end{macro} @@ -949,18 +947,16 @@ % A re-definable command is almost the same as above but here we % demand that it already exists. % \begin{macrocode} -\def_new:NNn \xparse_if_redefinable:NTF 1 { - \cs_free:NTF #1 - { \xparse_not_yet_defined_error_msg:N #1 \use_arg_ii:nn } +\cs_new_nopar:Npn \xparse_if_redefinable:NTF #1 { + \cs_if_free:NTF #1 + { \xparse_not_yet_defined_error_msg:N #1 \use_ii:nn } { \xparse_begins_with_end:NTF #1 - { \xparse_begins_with_end_error_msg:N #1 \use_arg_ii:nn } - \use_arg_i:nn + { \xparse_begins_with_end_error_msg:N #1 \use_ii:nn } + \use_i:nn } } -\def_new:NNn \xparse_if_redefinable:cTF 0 { - \exp_args:Nc \xparse_if_redefinable:NTF -} +\cs_generate_variant:Nn \xparse_if_redefinable:NTF {c} % \end{macrocode} % \end{macro} % \end{macro} @@ -980,27 +976,27 @@ % we turn these three letters into a control sequence with a simple % expansion which is then tested with |\xparse_begins_with_end_aux:N|. % \begin{macrocode} -\def_new:NNn \xparse_begins_with_end:NTF 1 { +\cs_new_nopar:Npn \xparse_begins_with_end:NTF #1 { % \end{macrocode} % We do it all in a group as there is no need to fill up the hash % table with weird three letter control sequences. % \begin{macrocode} \group_begin: \exp_args:Nc \xparse_begins_with_end_aux:N { - \tlist_head_iii:f { \cs_to_str:N #1 ??} + \tl_head_iii:f { \cs_to_str:N #1 ??} } } % \end{macrocode} % After the above expansion tricks we now have a real control sequence % to test against |\end|. We end the group again. % \begin{macrocode} -\def_new:NNn \xparse_begins_with_end_aux:N 1 { - \if:w \cs_if_eq_name_p:NN #1 \end +\cs_new_nopar:Nn \xparse_begins_with_end_aux:N { + \if_predicate:w \cs_if_eq_name_p:NN #1 \end \group_end: - \exp_after:NN \use_arg_i:nn + \exp_after:wN \use_i:nn \else: \group_end: - \exp_after:NN \use_arg_ii:nn + \exp_after:wN \use_ii:nn \fi: } % \end{macrocode} @@ -1044,7 +1040,7 @@ % for every such user level command to be robust which is done using % the \eTeX{} protection feature. % \begin{macrocode} -\def_long:NNn \xparse_declare_document_command:Nnn 3{ +\cs_set:Nn \xparse_declare_document_command:Nnn { % \end{macrocode} % First we prepare the signature. % \begin{macrocode} @@ -1053,9 +1049,9 @@ % Now for the document command. Make it robust and make sure it starts % with |\toks_set:Nn \l_xparse_grabbed_args_toks {\\|\meta{cmd}|}|. % \begin{macrocode} - \def_protected:Npx #1 { + \cs_set_protected_nopar:Npx #1 { \exp_not:n { \toks_set:Nn \l_xparse_grabbed_args_toks } - {\exp_not:c {\token_to_string:N #1}} + {\exp_not:c {\token_to_str:N #1}} % \end{macrocode} % Then add the argument grabbers which contain code gathered when % preparing the signature. @@ -1074,11 +1070,10 @@ % given by |#3|. Even though this internal macro allows |\par| in its % argument the decision is left to the individual argument grabbers. % \begin{macrocode} - \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 + \cs_generate_from_arg_count:cNnn {\token_to_str:N #1}\cs_set:Npn + \l_xparse_total_args_int{#3} } +\cs_generate_variant:Nn \xparse_declare_document_command:Nnn {cnn} % \end{macrocode} % \end{macro} % \end{macro} @@ -1090,7 +1085,7 @@ % also insert a |\group_begin:| as it will otherwise fail miserably % in case a user tries to use it without |\begin ... \end|. % \begin{macrocode} -\def_long_new:NNn \xparse_declare_document_environment:nnnn 4 { +\cs_new:Nn \xparse_declare_document_environment:nnnn { \xparse_declare_document_command:cnn {#1}{#2} { \group_begin: \toks_set_eq:NN \l_xparse_end_environment_args_toks @@ -1101,12 +1096,12 @@ % We let |\end|\meta{envir} equal to a standard version which will do % all the work. % \begin{macrocode} - \let:cN {end #1} \xparse_parsed_end_environment: + \cs_set_eq:cN {end #1} \xparse_parsed_end_environment: % \end{macrocode} % Now define |\end\\|\meta{envir}. % \begin{macrocode} - \def_long:cNn {end \token_to_string:N \\ #1} - \l_xparse_total_args_int{#4} + \cs_generate_from_arg_count:cNnn {end \token_to_str:N \\ #1}\cs_set:Npn + \l_xparse_total_args_int{#4} } % \end{macrocode} % \end{macro} @@ -1118,13 +1113,13 @@ % from the argument grabbing. The remainder of the token list is the % grabbed arguments. We better make this robust as well. % \begin{macrocode} -\def_protected_new:NNn \xparse_parsed_end_environment: 0{ - \exp_after:NN \xparse_parsed_end_environment_aux:N +\cs_new_protected_nopar:Nn \xparse_parsed_end_environment: { + \exp_after:wN \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 } +\cs_new_nopar:Nn \xparse_parsed_end_environment_aux:N { + \use:c {end \token_to_str:N #1 } } % \end{macrocode} % \end{macro} @@ -1145,13 +1140,13 @@ % arguments from the input stream. For commands there are two % arguments waiting. % \begin{macrocode} -\let_new:NN \DeclareDocumentCommand \xparse_declare_document_command:Nnn -\def_new:NNn \NewDocumentCommand 1 { +\cs_new_eq:NN \DeclareDocumentCommand \xparse_declare_document_command:Nnn +\cs_new_nopar:Npn \NewDocumentCommand #1 { \xparse_if_definable:NTF #1 { \xparse_declare_document_command:Nnn #1 } \use_none:nn } -\def_new:NNn \RenewDocumentCommand 1 { +\cs_new_nopar:Npn \RenewDocumentCommand #1 { \xparse_if_redefinable:NTF #1 { \xparse_declare_document_command:Nnn #1 } \use_none:nn @@ -1166,14 +1161,14 @@ % \begin{macro}{\RenewDocumentEnvironment} % Three arguments for environments. % \begin{macrocode} -\let_new:NN \DeclareDocumentEnvironment +\cs_new_eq:NN \DeclareDocumentEnvironment \xparse_declare_document_environment:nnnn -\def_new:NNn \NewDocumentEnvironment 1 { +\cs_new_nopar:Npn \NewDocumentEnvironment #1 { \xparse_if_definable:cTF {#1} { \xparse_declare_document_environment:nnnn {#1} } \use_none:nnn } -\def_new:NNn \RenewDocumentEnvironment 1 { +\cs_new_nopar:Npn \RenewDocumentEnvironment #1 { \xparse_if_redefinable:cTF {#1} { \xparse_declare_document_environment:nnnn {#1} } \use_none:nnn @@ -1189,13 +1184,13 @@ % free. If it is let |\DeclareDocument...| do the rest, otherwise % gobble the next arguments. % \begin{macrocode} -\def_new:NNn \ProvideDocumentCommand 1{ - \cs_free:NTF #1 +\cs_new_nopar:Npn \ProvideDocumentCommand #1{ + \cs_if_free:NTF #1 { \DeclareDocumentCommand #1} \use_none:nn } -\def_new:NNn \ProvideDocumentEnvironment 1{ - \cs_free:cTF {#1} +\cs_new_nopar:Npn \ProvideDocumentEnvironment #1{ + \cs_if_free:cTF {#1} { \DeclareDocumentEnvironment {#1} } \use_none:nnn } @@ -1215,9 +1210,9 @@ % signature |#3| which does the argument grabbing. The arguments are % passed on to the internal command |\impl-#2|. % \begin{macrocode} -\def_long_new:NNn \DeclareDocumentCommandInterface 3{ +\cs_new:Npn \DeclareDocumentCommandInterface #1#2#3{ \xparse_prepare_signature:n {#3} - \def_protected:Npx #1 { + \cs_set_protected_nopar: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 @@ -1228,7 +1223,8 @@ % for |\DeclareDocumentCommand| but give it just a default definition % instead (usually an error message). % \begin{macrocode} - \def_long:cNn {impl-#2} \l_xparse_total_args_int + \cs_generate_from_arg_count:cNnn {impl-#2} \cs_set:Npn + \l_xparse_total_args_int {\xparse_undefined_command_implementation:n{#2}} } % \end{macrocode} @@ -1238,7 +1234,7 @@ % called. Let's just typeset the name in quotes indicating that % something is wrong. % \begin{macrocode} -\def_new:NNn \xparse_undefined_command_implementation:n 1{ +\cs_new_nopar:Nn \xparse_undefined_command_implementation:n { ``#1'' % \ensuremath{\langle\textit{#1}\rangle} \xparse_no_command_implementation_warning:n {#1} @@ -1250,8 +1246,8 @@ % Defines the internal command |\impl-#1| with |#2| arguments % and definition |#3|. % \begin{macrocode} -\def_long_new:NNn \DeclareDocumentCommandImplementation 3{ - \def_long:cNn {impl-#1}#2{#3} +\cs_new:Npn \DeclareDocumentCommandImplementation #1#2#3{ + \cs_generate_from_arg_count:cNnn {impl-#1}\cs_set:Npn {#2}{#3} } % \end{macrocode} % \end{macro} @@ -1265,7 +1261,7 @@ % have different ways of handling it afterwards, so we make it a % separate function. % \begin{macrocode} -\def_new:NNn \xparse_prepare_signature:n 1 { +\cs_new_nopar:Nn \xparse_prepare_signature:n { % \end{macrocode} % Initialize the counter taking care of the number of arguments. In % case we reach more than nine we will give an error message later on. @@ -1280,8 +1276,8 @@ \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 + \tl_gset_eq:NN \g_xparse_ignore_marker_tl + \g_xparse_ignore_spaces_marker_tl % \end{macrocode} % Then call |\xparse_parse_signature:n|. % \begin{macrocode} @@ -1313,10 +1309,10 @@ % Since there are different markers that may be used at the same % time, we use the a special ``insert'' marker |>| to do this. % -% \begin{macro}{\g_xparse_ignore_marker_tlp} +% \begin{macro}{\g_xparse_ignore_marker_tl} % The current ignore marker is contained in this string. % \begin{macrocode} -\tlp_new:Nn \g_xparse_ignore_marker_tlp {} +\tl_new:Nn \g_xparse_ignore_marker_tl {} % \end{macrocode} % \end{macro} % @@ -1341,7 +1337,7 @@ % definition but it works. |#1| is some test in the loop function % and |#2| is the list of markers. % \begin{macrocode} -\def_new:cpn {xparse_add_arg_type_>:} #1 +\cs_new_nopar:cpn {xparse_add_arg_type_>:} #1 \xparse_read_arg_type_or_grab_default:n #2{ % \end{macrocode} % Insert pending |m| args first. @@ -1356,7 +1352,7 @@ % \end{macrocode} % Then go through the list and call each subtype if it exists. % \begin{macrocode} - \tlist_map_inline:nn{#2}{ + \tl_map_inline:nn{#2}{ \xparse_check_and_add_argument_type:N ##1 } % \end{macrocode} @@ -1370,11 +1366,11 @@ % \begin{macro}{\xparse_add_ignore_marker:Nnn} % A small function for adding a new ignore type marker. % \begin{macrocode} -\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} +\cs_new_nopar:Nn \xparse_add_ignore_marker:Nnn { + \tl_new:cn {g_xparse #2 _marker_tl}{#3} + \seq_gpush:Nv \g_xparse_ignore_marker_seq {g_xparse #2 _marker_tl} + \cs_new_nopar:cpn {xparse_add_arg_type_#1:}{ + \tl_gset_eq:Nc \g_xparse_ignore_marker_tl {g_xparse #2 _marker_tl} } } % \end{macrocode} @@ -1389,7 +1385,7 @@ % \begin{macro}{\xparse_add_arg_type_P:} % This is simple, just set a boolean. % \begin{macrocode} -\def_new:NNn \xparse_add_arg_type_P: 0{ +\cs_new_nopar:Nn \xparse_add_arg_type_P: { \bool_gset_true:N \g_xparse_allow_par_bool } % \end{macrocode} @@ -1409,7 +1405,7 @@ % stored in |\l_xparse_grabbed_args_toks|. The function is recursive % which is why we use a quark to delimit it. % \begin{macrocode} -\def_new:NNn \xparse_parse_signature:n 1{ +\cs_new_nopar:Nn \xparse_parse_signature:n { % \end{macrocode} % Check if we reached the end of the signature. % \begin{macrocode} @@ -1437,8 +1433,8 @@ { \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 + \tl_gset_eq:NN \g_xparse_ignore_marker_tl + \g_xparse_ignore_spaces_marker_tl } % \end{macrocode} % After adding arguments we better set the boolean false in case we @@ -1461,15 +1457,15 @@ % This function checks if the argument type actually exists and gives % an error if it doesn't. % \begin{macrocode} -\def_new:NNn \xparse_check_and_add_argument_type:N 1 { - \cs_free:cTF {xparse_add_arg_type_#1:} +\cs_new_nopar:Nn \xparse_check_and_add_argument_type:N { + \cs_if_free:cTF {xparse_add_arg_type_#1:} { \xparse_unknown_arg_type_error_msg:N #1 \int_incr:N \l_xparse_mandatory_args_int } % \end{macrocode} % Otherwise we just add it with its dedicated function. % \begin{macrocode} - { \cs_use:c {xparse_add_arg_type_#1:} } + { \use:c {xparse_add_arg_type_#1:} } } % \end{macrocode} % \end{macro} @@ -1483,17 +1479,17 @@ % just to tun the loop again. However, some argument types need to % add a default argument so we add these as well. % \begin{macrocode} -\let_new:NN \xparse_read_arg_type_or_grab_default:n +\cs_new_eq:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n -\def_new:NNn \xparse_grab_default_arg:n 1{ +\cs_new_nopar:Nn \xparse_grab_default_arg:n { \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#1}} - \let:NN \xparse_read_arg_type_or_grab_default:n + \cs_set_eq: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{ +\cs_new:Nn \xparse_grab_default_arg_allow_par:n { \toks_put_right:Nn \l_xparse_grabbed_args_toks {{#1}} - \let:NN \xparse_read_arg_type_or_grab_default:n + \cs_set_eq:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n \xparse_parse_signature:n } @@ -1532,7 +1528,7 @@ % tokens and insert it. Otherwise increment the number of % non-|\long| argument grabbers. % \begin{macrocode} -\def_new:Npn \xparse_add_arg_type_m: { +\cs_new_nopar:Nn \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} @@ -1547,8 +1543,8 @@ % arguments. There is little point in adding any arguments if none % are required. % \begin{macrocode} -\def_new:Npn \xparse_add_remaining_m_args: { - \int_compare:nNnF \l_xparse_mandatory_args_int = \c_zero +\cs_new_nopar:Nn \xparse_add_remaining_m_args: { + \intexpr_compare:nNnF \l_xparse_mandatory_args_int = \c_zero { \toks_put_right:Nx \l_xparse_grabbed_args_toks { \exp_not:c{xparse_m @@ -1576,43 +1572,43 @@ % |\toks_use:N \l_xparse_grabbed_args_toks| anyway so we avoid % problems with that one. % \begin{macrocode} -\def_new:cpn {xparse_m1:w} #1 \l_xparse_grabbed_args_toks#2{ +\cs_new_nopar: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{ +\cs_new_nopar: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{ +\cs_new_nopar: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{ +\cs_new_nopar: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{ +\cs_new_nopar: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{ +\cs_new_nopar: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{ +\cs_new_nopar: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 +\cs_new_nopar: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 +\cs_new_nopar: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}} @@ -1633,7 +1629,7 @@ % The |m| type allowing |\par| tokens. We only define one of them as % two in a row would be quite rare. % \begin{macrocode} -\def_long_new:Npn \xparse_allow_par_m:w #1 \l_xparse_grabbed_args_toks#2{ +\cs_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 } @@ -1648,7 +1644,7 @@ % This is almost exactly the same as the |m| type except we read % everything up to the first left brace. % \begin{macrocode} -\def_new:Npn \xparse_add_arg_type_l: { +\cs_new_nopar:Nn \xparse_add_arg_type_l: { \xparse_add_remaining_m_args: \bool_if:NTF \g_xparse_allow_par_bool { @@ -1656,11 +1652,11 @@ } { \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#{ +\cs_new_nopar: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#{ +\cs_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 } @@ -1674,21 +1670,22 @@ % % \begin{macro}{\DeclareSymbolArgument} % The actual grabber functions just issue a |\peek_meaning_remove:NTF| -% or similar on the symbol chosen. If found, we put a |\c_true| on the -% argument stack and |\c_false| otherwise. -% \begin{macrocode} -\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 +% or similar on the symbol chosen. If found, we put a |\c_true_bool| on the +% argument stack and |\c_false_bool| otherwise. +% \begin{macrocode} +\cs_new_nopar:Npn \DeclareSymbolArgument #1#2{ + \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tl { + \cs_set_nopar:cpx {xparse \l_tmpa_tl _#1:w}##1##2 + \l_xparse_grabbed_args_toks{ + \exp_not:c{peek_ #2 _remove \l_tmpa_tl :NTF} ##1 { \exp_not:N \toks_put_right:Nn \exp_not:N - \l_xparse_grabbed_args_toks \exp_not:N \c_true + \l_xparse_grabbed_args_toks \exp_not:N \c_true_bool ##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 + \l_xparse_grabbed_args_toks \exp_not:N \c_false_bool ##2 \exp_not:N\l_xparse_grabbed_args_toks } } @@ -1698,15 +1695,16 @@ % grab a default argument. First we must clear out any pending |m| % arguments. % \begin{macrocode} - \def:cpn {xparse_add_arg_type_#1:} { + \cs_set_nopar: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 } } + { \exp_not:c {xparse \g_xparse_ignore_marker_tl _#1:w } } % \end{macrocode} % Nothing special when building the signature: We always grab a single % default argument. % \begin{macrocode} - \let:NN \xparse_read_arg_type_or_grab_default:n \xparse_grab_default_arg:n + \cs_set_eq:NN \xparse_read_arg_type_or_grab_default:n + \xparse_grab_default_arg:n } } % \end{macrocode} @@ -1730,7 +1728,7 @@ % optional argument is missing. The last two arguments control how % the arguments are picked up and parsed on to the inner parsing. % \begin{macrocode} -\def_new:NNn \DeclareArgumentType 7{ +\cs_new_nopar:Npn \DeclareArgumentType #1#2#3#4#5#6#7{ % \end{macrocode} % For instance, we want |\DeclareArgumentType a{charcode}[...| to % define the function |\xparse_ignore_spaces_a:w| with meaning @@ -1742,9 +1740,9 @@ % |\g_xparse_ignore_marker_seq| so we go through that when doing the % definitions. % \begin{macrocode} - \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 + \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tl { + \cs_set_nopar:cpx {xparse \l_tmpa_tl _#1:w}##1\l_xparse_grabbed_args_toks{ + \exp_not:c{peek_#3 \l_tmpa_tl :NTF} \exp_not:N #2 { \exp_not:c{xparse_#1_#3_help:nw}{##1} } { \exp_not:n { @@ -1756,9 +1754,9 @@ % \end{macrocode} % And now an almost identical version which allows the |\par| token. % \begin{macrocode} - \def_long:cpx {xparse_allow_par \l_tmpa_tlp _#1:w}##1 + \cs_set:cpx {xparse_allow_par \l_tmpa_tl _#1:w}##1 \l_xparse_grabbed_args_toks{ - \exp_not:c{peek_#3 \l_tmpa_tlp :NTF} \exp_not:N #2 + \exp_not:c{peek_#3 \l_tmpa_tl :NTF} \exp_not:N #2 { \exp_not:c{xparse_allow_par_#1_#3_help:nw}{##1} } { \exp_not:n { @@ -1772,7 +1770,7 @@ % Here is the function for building the argument grabbing. We clear % out the remaining |m| arguments first. % \begin{macrocode} - \def:cpn {xparse_add_arg_type_#1:} { + \cs_set_nopar:cpn {xparse_add_arg_type_#1:} { \xparse_add_remaining_m_args: \toks_put_right:Nx \l_xparse_grabbed_args_toks { \exp_not:c {xparse @@ -1782,11 +1780,11 @@ % default). % \begin{macrocode} \bool_if:NT \g_xparse_allow_par_bool {_allow_par} - \g_xparse_ignore_marker_tlp + \g_xparse_ignore_marker_tl _#1:w } } - \let:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n + \cs_set_eq:NN \xparse_read_arg_type_or_grab_default:n \xparse_parse_signature:n } % \end{macrocode} % Now all we need to do is to define the helper functions. @@ -1801,10 +1799,10 @@ % Therefore it doesn't have the arguments of the default value and % what to do if it is missing like the above. % \begin{macrocode} -\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 +\cs_new_nopar:Npn \DeclareArgumentTypeDefaultValue #1#2#3#4#5{ + \seq_map_variable:NNn \g_xparse_ignore_marker_seq \l_tmpa_tl { + \cs_set_nopar:cpx {xparse \l_tmpa_tl _#1:w}##1##2\l_xparse_grabbed_args_toks{ + \exp_not:c{peek_#3 \l_tmpa_tl :NTF} \exp_not:N #2 { \exp_not:c{xparse_#1_#3_help:nw}{##2} } { \exp_not:N \toks_put_right:Nn @@ -1815,9 +1813,9 @@ % \end{macrocode} % And now an almost identical version which allows the |\par| token. % \begin{macrocode} - \def_long:cpx {xparse_allow_par \l_tmpa_tlp _#1:w}##1##2 + \cs_set:cpx {xparse_allow_par \l_tmpa_tl _#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{peek_#3 \l_tmpa_tl :NTF} \exp_not:N #2 { \exp_not:c{xparse_allow_par_#1_#3_help:nw}{##2} } { \exp_not:N \toks_put_right:Nn @@ -1830,7 +1828,7 @@ % Here is the function for building the argument grabbing. We clear % out the remaining |m| arguments first. % \begin{macrocode} - \def:cpn {xparse_add_arg_type_#1:} { + \cs_set_nopar:cpn {xparse_add_arg_type_#1:} { \xparse_add_remaining_m_args: \toks_put_right:Nx \l_xparse_grabbed_args_toks { \exp_not:c {xparse @@ -1840,11 +1838,11 @@ % default). % \begin{macrocode} \bool_if:NT \g_xparse_allow_par_bool {_allow_par} - \g_xparse_ignore_marker_tlp + \g_xparse_ignore_marker_tl _#1:w } } - \let:Nc \xparse_read_arg_type_or_grab_default:n + \cs_set_eq:Nc \xparse_read_arg_type_or_grab_default:n {xparse_grab_default_arg \bool_if:NT \g_xparse_allow_par_bool {_allow_par} :n @@ -1862,7 +1860,7 @@ % All we need now is the helper functions. We define a generic % interface that should be fairly easy to use. % \begin{macrocode} -\def_new:NNn \xparse_define_helper:Nnnn 4{ +\cs_new_nopar:Nn \xparse_define_helper:Nnnn { \toks_set:Nn \l_tmpa_toks { #3 @@ -1878,9 +1876,9 @@ % The next bit looks a little ugly but that's life. % \begin{macrocode} \toks_set:Nx \l_tmpa_toks { - \exp_not:n {\def:cpn{xparse_#1_#2_help:nw}} + \exp_not:n {\cs_set_nopar:cpn{xparse_#1_#2_help:nw}} \toks_use:N \l_tmpa_toks - \exp_not:n {\def:cpn{xparse_allow_par_#1_#2_help:nw}} + \exp_not:n {\cs_set_nopar:cpn{xparse_allow_par_#1_#2_help:nw}} \toks_use:N\l_tmpa_toks } \toks_use:N \l_tmpa_toks @@ -1933,8 +1931,8 @@ % and give it the wrong name as it should have a |w| argument % specification but I hope you can forgive this little white lie. % \begin{macrocode} -\def_new:NNn \DeclareArgumentTypeShorthand 2{ - \def_new:cpn {xparse_add_arg_type_#1:} +\cs_new_nopar:Npn \DeclareArgumentTypeShorthand #1#2{ + \cs_new_nopar: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 @@ -1957,42 +1955,42 @@ % \begin{macro}{\IfBooleanT} % \begin{macro}{\IfBooleanF} % The logical \meta{true} and \meta{false} statements are just our -% normal |\c_true| and |\c_false| so testing for them is done with +% normal |\c_true_bool| and |\c_false_bool| so testing for them is done with % our usual |\bool_if:NTF| functions from \textsf{l3prg}. % \begin{macrocode} -\let_new:NN \IfBooleanTF \bool_if:NTF -\let_new:NN \IfBooleanT \bool_if:NT -\let_new:NN \IfBooleanF \bool_if:NF +\cs_new_eq:NN \IfBooleanTF \bool_if:NTF +\cs_new_eq:NN \IfBooleanT \bool_if:NT +\cs_new_eq:NN \IfBooleanF \bool_if:NF % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\NoValue} -% \begin{macro}{\c_xparse_hidden_no_value_tlp} +% \begin{macro}{\c_xparse_hidden_no_value_tl} % |\NoValue| is just a text string and we define it as a token list -% pointer. However we will actually test for token list pointers +% variable. However we will actually test for token list variables % with \emph{meaning} |\NoValue|. Hence if an argument is really % |-NoValue-| it will not be detected but that shouldn't happen. % \begin{macrocode} -\tlp_new:Nn \NoValue {-NoValue-} -\tlp_new:Nn \c_xparse_hidden_no_value_tlp {\NoValue} +\tl_new:Nn \NoValue {-NoValue-} +\tl_new:Nn \c_xparse_hidden_no_value_tl {\NoValue} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\xparse_if_no_value:nTF} -% The test start by making a token list pointer out of the first +% The test start by making a token list variable out of the first % argument and then check if it is equal to -% |\c_xparse_hidden_no_value_tlp| which contains |\NoValue|. +% |\c_xparse_hidden_no_value_tl| which contains |\NoValue|. % \begin{macrocode} -\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 +\cs_new:Npn \xparse_if_no_value:nTF #1{ + \tl_set:Nx \l_tmpa_tl{\exp_not:n{#1}} + \tl_if_eq:NNTF \l_tmpa_tl \c_xparse_hidden_no_value_tl % \end{macrocode} % If they are equal we just exit and execute the \meta{true} code. % \begin{macrocode} - { \use_arg_i:nn } + { \use_i:nn } % \end{macrocode} % If not, take a closer look at |#1|. Peek ahead at the first token in % |#1| and then call the function |\xparse_if_no_value_aux:| but only @@ -2001,8 +1999,8 @@ % point otherwise the macros for checking tokens will break since the % argument may be empty. % \begin{macrocode} - { \tlist_if_blank:nTF {#1} - { \use_arg_ii:nn } + { \tl_if_blank:nTF {#1} + { \use_ii:nn } {\peek_after:NN \xparse_if_no_value_aux: #1 \q_nil {#1} } } } @@ -2014,18 +2012,18 @@ % it is not a macro the function |\token_get_arg_spec:N| returns % |\scan_stop:|. % \begin{macrocode} -\def_long_new:Npn \xparse_if_no_value_aux: { - \tlp_set:Nx \l_tmpa_tlp{\token_get_arg_spec:N \l_peek_token } +\cs_new:Nn \xparse_if_no_value_aux: { + \tl_set:Nx \l_tmpa_tl{\token_get_arg_spec:N \l_peek_token } % \end{macrocode} -% Then check if |\l_tmpa_tlp| is empty, because this means we have a +% Then check if |\l_tmpa_tl| is empty, because this means we have a % macro taking zero arguments and we can expand it once % safely. Otherwise we just exit and execute the false code. Remember % that we have the sequence |{#1}| waiting after the |\q_nil| in % |\xparse_if_no_value:nTF| above. % \begin{macrocode} - \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}} + \tl_if_empty:NTF \l_tmpa_tl + {\use_i_delimit_by_q_nil:nw {\exp_args:No\xparse_if_no_value:nTF}} + {\use_i_delimit_by_q_nil:nw {\use_iii:nnn}} } % \end{macrocode} % \end{macro} @@ -2040,15 +2038,15 @@ % |\IfNoValueTF| and its varieties are implemented as subcases of % |\xparse_if_no_value:nTF|. % \begin{macrocode} -\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}{}} +\cs_new_eq:NN \IfNoValueTF \xparse_if_no_value:nTF +\cs_new:Npn \IfNoValueT #1#2 {\xparse_if_no_value:nTF{#1}{#2}{}} +\cs_new:Npn \IfNoValueF #1 {\xparse_if_no_value:nTF {#1}{}} % \end{macrocode} % For |\IfValueTF| we just reverse the arguments. % \begin{macrocode} -\def_long_new:NNn \IfValueTF 3{\xparse_if_no_value:nTF {#1}{#3}{#2}} -\let_new:NN \IfValueT \IfNoValueF -\let_new:NN \IfValueF \IfNoValueT +\cs_new:Npn \IfValueTF #1#2#3{\xparse_if_no_value:nTF {#1}{#3}{#2}} +\cs_new_eq:NN \IfValueT \IfNoValueF +\cs_new_eq:NN \IfValueF \IfNoValueT % \end{macrocode} % \end{macro} % \end{macro} @@ -2060,10 +2058,10 @@ % % \subsection{Pseudo arguments} % -% \begin{macro}{\l_xparse_pseudo_post_arg_tlp} -% A temporary token list pointer to store the post-arguments. +% \begin{macro}{\l_xparse_pseudo_post_arg_tl} +% A temporary token list variable to store the post-arguments. % \begin{macrocode} -\tlp_new:Nn \l_xparse_pseudo_post_arg_tlp {} +\tl_new:Nn \l_xparse_pseudo_post_arg_tl {} % \end{macrocode} % \end{macro} % \begin{macro}{\DeclarePseudoArgument} @@ -2076,28 +2074,28 @@ % functions with |#2| arguments and definitions |#3| and |#4| % respectively. % \begin{macrocode} -\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} +\cs_new:Npn \DeclarePseudoArgument #1#2#3#4{ + \cs_set:cn {xparse_pseudo_pre_arg_#1:\prg_replicate:nn{#2}{n}} {#3} + \cs_set:cn {xparse_pseudo_post_arg_#1:\prg_replicate:nn{#2}{n}} {#4} % \end{macrocode} % In case the user doesn't put the argument in braces, it must be a % single token which we just grab and then execute the % post-argument. Surely it won't be a |\par| token! % \begin{macrocode} - \def:cNn {xparse_pseudo_nobrace_arg_#1:N} 1 { - ##1 \l_xparse_pseudo_post_arg_tlp + \cs_set_nopar:cn {xparse_pseudo_nobrace_arg_#1:N} { + ##1 \l_xparse_pseudo_post_arg_tl } % \end{macrocode} % The regular version of the command is then this: % \begin{enumerate} % \item Execute the pre-code at level $n$. -% \item Store the post-code in a token list pointer at level $n$. +% \item Store the post-code in a token list variable at level $n$. % \item Look for a begin-group token. % \item[4a] If found, remove it, start a group (level $n+1$) and make -% sure the token list pointer from 2) is executed after the group +% sure the token list variable from 2) is executed after the group % has ended (at level $n$). % \item[4b] If not found, call the |nobrace_arg| version which also -% executes the token list pointer from 2) at level $n$. +% executes the token list variable from 2) at level $n$. % \end{enumerate} % This scheme enables these commands to be nested since they all % appear at different grouping levels. @@ -2105,16 +2103,17 @@ % Next we define the function. Also make sure that it gets all the % arguments carried over to the post-argument. % \begin{macrocode} - \def_long:cNx {xparse_pseudo_arg_#1:w} #2 + \cs_generate_from_arg_count:cNnn {xparse_pseudo_arg_#1:w} + \cs_set:Npx {#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} + \use:c{use_ \intexpr_eval:n{#2} _parameter:} + \exp_not:n {\tl_set:Nn \l_xparse_pseudo_post_arg_tl} { \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:} + \use:c{use_ \intexpr_eval:n{#2}_parameter:} } \exp_not:n{ \peek_catcode_remove_ignore_spaces:NTF \c_group_begin_token } { @@ -2127,7 +2126,7 @@ % \begin{macrocode} \exp_not:n { \c_group_begin_token - \group_execute_after:N \l_xparse_pseudo_post_arg_tlp + \group_execute_after:N \l_xparse_pseudo_post_arg_tl } } { @@ -2140,7 +2139,7 @@ % \begin{macro}{\UsePseudoArgument} % Just a nice wrapper for calling such an argument. % \begin{macrocode} -\def_new:NNn \UsePseudoArgument 1{\cs_use:c{xparse_pseudo_arg_#1:w}} +\cs_new_nopar:Npn \UsePseudoArgument #1{\use:c{xparse_pseudo_arg_#1:w}} % \end{macrocode} % \end{macro} % @@ -2150,30 +2149,3 @@ % \Finale % \endinput -% -% $Log$ -% Revision 1.25 2006/07/17 22:25:53 morten -% Minor change to reflect change in l3basics.dtx -% -% Revision 1.24 2006/07/08 22:44:29 morten -% Fixed two lurking problems in \xparse_if_no_value:nTF. -% -% Revision 1.23 2006/07/06 14:56:04 morten -% Change to use new \def:NNn syntax -% -% Revision 1.22 2006/01/17 23:04:08 morten -% Added `l' type argument for reading up to a left brace. -% -% Revision 1.21 2006/01/04 02:42:35 morten -% Changed RCS information retrieval. Rewrote \DeclareArgumentType and -% its relatives in order for them to work properly with the new \peek_ -% functions. Changed how special markers are inserted into the -% signature. Added `pseudo arguments'. Updated documentation to reflect -% all these changes. And more which I can't remember right now :-) -% -% Revision 1.20 2005/04/06 21:24:47 morten -% Total rewrite - there is only one implementation in the package -% now. Documentation updated to match the changes. -% -% -% |