summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3packages/xparse.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3packages/xparse.dtx')
-rw-r--r--macros/latex/contrib/l3packages/xparse.dtx148
1 files changed, 122 insertions, 26 deletions
diff --git a/macros/latex/contrib/l3packages/xparse.dtx b/macros/latex/contrib/l3packages/xparse.dtx
index f56bcdf5e9..c700434903 100644
--- a/macros/latex/contrib/l3packages/xparse.dtx
+++ b/macros/latex/contrib/l3packages/xparse.dtx
@@ -67,7 +67,7 @@
% }^^A
% }
%
-% \date{Released 2020-03-06}
+% \date{Released 2020-05-14}
%
% \maketitle
%
@@ -304,7 +304,7 @@
% follow such a command. The most common example is the use of \cmd{\\} in
% \pkg{amsmath} environments. In \pkg{xparse} terms it has signature
% \begin{verbatim}
-% \DeclareDocumentCommad \\ { !s !o } { ... }
+% \DeclareDocumentCommand \\ { !s !o } { ... }
% \end{verbatim}
%
% \subsection{Required delimited arguments}
@@ -993,7 +993,7 @@
% \end{macrocode}
%
% \begin{macrocode}
-\ProvidesExplPackage{xparse}{2020-03-06}{}
+\ProvidesExplPackage{xparse}{2020-05-14}{}
{L3 Experimental document command parser}
% \end{macrocode}
%
@@ -1019,22 +1019,31 @@
% \end{variable}
% \end{variable}
%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
% \subsection{Reload check}
%
% A simple reload check.
% \begin{macrocode}
+%<*core>
\cs_if_exist:NT \NewDocumentCommand
{ \file_input_stop: }
+%</core>
% \end{macrocode}
%
+% Load the core code.
% \begin{macrocode}
-%</package>
+%<*2ekernel|package>
+\file_input:n { xparse-generic.tex }
+%</2ekernel|package>
% \end{macrocode}
%
% \subsection{Variables and constants}
%
% \begin{macrocode}
-%<*package|2ekernel>
+%<*!package>
% \end{macrocode}
%
% \begin{variable}{\c_@@_special_chars_seq}
@@ -1049,6 +1058,17 @@
% \end{macrocode}
% \end{variable}
%
+% \begin{macrocode}
+%<*core>
+\if_charcode:w xx
+ \cs_new:Npn \@@_file_end_hook: { }
+\else
+ \ExplSyntaxOn
+ \cs_new:Npn \@@_file_end_hook: { \ExplSyntaxOff }
+\fi:
+%</core>
+% \end{macrocode}
+%
% \begin{variable}{\l_@@_arg_spec_tl}
% Holds the argument specification after normalization of shorthands.
% \begin{macrocode}
@@ -1477,9 +1497,9 @@
%<*initex>
\cs_if_exist:cTF { environment~ \l_@@_environment_str }
%</initex>
-%<*package|2ekernel>
+%<*core>
\cs_if_exist:cTF { \l_@@_environment_str }
-%</package|2ekernel>
+%</core>
{
\__kernel_msg_info:nnxx { xparse } { redefine-environment }
{ \l_@@_environment_str } { \tl_to_str:n {#2} }
@@ -1525,10 +1545,10 @@
\cs_generate_from_arg_count:cNnn
{ environment~ #1 ~end~aux~ } \cs_set:Npn
\l_@@_current_arg_int {#4}
-%<*package|2ekernel>
+%<*core>
\cs_set_eq:cc {#1} { environment~ #1 }
\cs_set_eq:cc { end #1 } { environment~ #1 ~end }
-%</package|2ekernel>
+%</core>
}
}
% \end{macrocode}
@@ -1548,9 +1568,9 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_start_env:nnnnn #1#2
{
-%<*package|2ekernel>
+%<*core>
\cs_if_exist_use:N \conditionally@traceoff
-%</package|2ekernel>
+%</core>
\str_set:Nn \l_@@_environment_str {#2}
\bool_set_true:N \l_@@_environment_bool
\@@_start_aux:ccnnnn
@@ -1560,9 +1580,9 @@
}
\cs_new_protected:Npx \@@_start:nNNnnn #1#2#3
{
-%<*package|2ekernel>
+%<*core>
\exp_not:n { \cs_if_exist_use:N \conditionally@traceoff }
-%</package|2ekernel>
+%</core>
\exp_not:c { xparse~function~is~not~expandable }
\exp_not:n { \bool_set_false:N \l_@@_environment_bool }
\exp_not:N \@@_start_aux:NNnnnn
@@ -1599,9 +1619,9 @@
{
\tl_if_empty:NF \l_@@_defaults_tl { \@@_defaults: }
\tl_if_empty:NF \l_@@_process_all_tl { \@@_args_process: }
-%<*package|2ekernel>
+%<*core>
\cs_if_exist_use:N \conditionally@traceon
-%</package|2ekernel>
+%</core>
\exp_after:wN \l_@@_fn_code_tl \l_@@_args_tl
}
% \end{macrocode}
@@ -1885,11 +1905,39 @@
\int_incr:N \l_@@_current_arg_int
\cs_if_exist_use:cF { @@_normalize_type_ \tl_to_str:n {#1} :w }
{
+ \bool_lazy_any:nTF
+ {
+ { \str_if_eq_p:nn {#1} { G } }
+ { \str_if_eq_p:nn {#1} { g } }
+ { \str_if_eq_p:nn {#1} { l } }
+ { \str_if_eq_p:nn {#1} { u } }
+ }
+ {
+ \__kernel_msg_error:nnxx { xparse } { xparse-argument-type }
+ { \@@_environment_or_command: } { \tl_to_str:n {#1} }
+ }
+ {
+ \__kernel_msg_error:nnxx { xparse } { unknown-argument-type }
+ { \@@_environment_or_command: } { \tl_to_str:n {#1} }
+ }
+ \@@_bad_def:wn
+ }
+ }
+%</!package>
+%<*package>
+\cs_gset_protected:Npn \@@_normalize_arg_spec_loop:n #1
+ {
+ \quark_if_recursion_tail_stop:n {#1}
+ \int_incr:N \l_@@_current_arg_int
+ \cs_if_exist_use:cF { @@_normalize_type_ \tl_to_str:n {#1} :w }
+ {
\__kernel_msg_error:nnxx { xparse } { unknown-argument-type }
{ \@@_environment_or_command: } { \tl_to_str:n {#1} }
\@@_bad_def:wn
}
}
+%</package>
+%<*!package>
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1923,8 +1971,6 @@
\quark_if_recursion_tail_stop_do:nn {##1} { \@@_bad_arg_spec:wn }
\@@_normalize_type_E:w {##1} { }
}
- \cs_new_protected:Npn \@@_normalize_type_g:w
- { \@@_normalize_type_G:w {#1} }
\cs_new_protected:Npn \@@_normalize_type_o:w
{ \@@_normalize_type_D:w [ ] {#1} }
\cs_new_protected:Npn \@@_normalize_type_O:w
@@ -1938,6 +1984,12 @@
{ \@@_normalize_type_t:w * }
}
\exp_args:No \@@_tmp:w { \c_novalue_tl }
+%</!package>
+%<*package>
+\cs_new_protected:Npx \@@_normalize_type_g:w
+ { \exp_not:N \@@_normalize_type_G:w { \exp_not:V \c_novalue_tl } }
+%</package>
+%<*!package>
% \end{macrocode}
% \end{macro}
%
@@ -2051,6 +2103,8 @@
\@@_normalize_E_unique_check:w #2 \q_stop
}
}
+%</!package>
+%<*package>
\cs_new_protected:Npn \@@_normalize_type_G:w #1
{
\quark_if_recursion_tail_stop_do:nn {#1} { \@@_bad_arg_spec:wn }
@@ -2059,6 +2113,8 @@
\tl_put_right:Nn \l_@@_last_delimiters_tl { { } }
\@@_normalize_arg_spec_loop:n
}
+%</package>
+%<*!package>
\cs_new_protected:Npn \@@_normalize_type_t:w #1
{
\quark_if_recursion_tail_stop_do:Nn #1 { \@@_bad_arg_spec:wn }
@@ -2095,12 +2151,16 @@
% \cs{l_@@_arg_spec_tl}, count the mandatory argument, and empty the
% list of last delimiters.
% \begin{macrocode}
+%</!package>
+%<*package>
\cs_new_protected:Npn \@@_normalize_type_l:w
{
\@@_normalize_check_lu:N l
\@@_add_arg_spec_mandatory:n { l }
\@@_normalize_arg_spec_loop:n
}
+%</package>
+%<*!package>
\cs_new_protected:Npn \@@_normalize_type_m:w
{
\@@_delimiter_check:nnn { } { m } { \iow_char:N \{ }
@@ -2117,6 +2177,8 @@
\@@_add_arg_spec_mandatory:n { R #1 #2 {#3} }
\@@_normalize_arg_spec_loop:n
}
+%</!package>
+%<*package>
\cs_new_protected:Npn \@@_normalize_type_u:w #1
{
\quark_if_recursion_tail_stop_do:nn {#1} { \@@_bad_arg_spec:wn }
@@ -2124,6 +2186,8 @@
\@@_add_arg_spec_mandatory:n { u {#1} }
\@@_normalize_arg_spec_loop:n
}
+%</package>
+%<*!package>
\cs_new_protected:Npn \@@_normalize_type_v:w
{
\@@_normalize_check_gv:N v
@@ -2482,6 +2546,8 @@
% For the \texttt{G} type, the grabber and the default are added to the
% signature.
% \begin{macrocode}
+%</!package>
+%<*package>
\cs_new_protected:Npn \@@_add_type_G:w #1
{
\@@_flush_m_args:
@@ -2503,6 +2569,8 @@
\@@_add_grabber:N l
\@@_prepare_signature:N
}
+%</package>
+%<*!package>
% \end{macrocode}
% \end{macro}
%
@@ -2558,6 +2626,8 @@
% 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}
+%</!package>
+%<*package>
\cs_new_protected:Npn \@@_add_type_u:w #1
{
\@@_flush_m_args:
@@ -2566,6 +2636,8 @@
\tl_put_right:Nn \l_@@_signature_tl { {#1} }
\@@_prepare_signature:N
}
+%</package>
+%<*!package>
% \end{macrocode}
% \end{macro}
%
@@ -2784,8 +2856,12 @@
% parameter text ends with |#| in fact end up being delimited by an
% open brace.
% \begin{macrocode}
+%</!package>
+%<*package>
\cs_new_protected:Npn \@@_add_expandable_type_l:w
{ \@@_add_expandable_type_u:w ## }
+%</package>
+%<*!package>
% \end{macrocode}
% \end{macro}
%
@@ -2834,6 +2910,8 @@
% Define an auxiliary that will be used directly in the signature. It
% grabs one argument delimited by |#1| and places it before \cs{q_@@}.
% \begin{macrocode}
+%</!package>
+%<*package>
\cs_new_protected:Npn \@@_add_expandable_type_u:w #1
{
\@@_add_default:
@@ -2846,6 +2924,8 @@
{ \exp_not:c { \l_@@_expandable_aux_name_tl } }
\@@_prepare_signature:N
}
+%</package>
+%<*!package>
% \end{macrocode}
% \end{macro}
%
@@ -3249,6 +3329,8 @@
% Optional groups are checked by meaning, so that the same code will
% work with, for example, \ConTeXt{}-like input.
% \begin{macrocode}
+%</!package>
+%<*package>
\cs_new_protected:Npn \@@_grab_G:w #1 \@@_run_code:
{
\@@_grab_G_aux:nNN {#1} \cs_set_protected_nopar:Npn
@@ -3278,6 +3360,8 @@
{ \l_@@_fn_tl }
{ \@@_add_arg:o \c_novalue_tl }
}
+%</package>
+%<*!package>
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -3290,6 +3374,8 @@
% \begin{macro}{\@@_grab_l_aux:nN}
% Argument grabbers for mandatory \TeX{} arguments are pretty simple.
% \begin{macrocode}
+%</!package>
+%<*package>
\cs_new_protected:Npn \@@_grab_l:w #1 \@@_run_code:
{ \@@_grab_l_aux:nN {#1} \cs_set_protected_nopar:Npn }
\cs_new_protected:Npn \@@_grab_l_long:w #1 \@@_run_code:
@@ -3301,6 +3387,8 @@
{ \@@_add_arg:n {##1} }
\l_@@_fn_tl
}
+%</package>
+%<*!package>
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -3472,6 +3560,8 @@
% Grabbing up to a list of tokens is quite easy: define the grabber,
% and then collect.
% \begin{macrocode}
+%</!package>
+%<*package>
\cs_new_protected:Npn \@@_grab_u:w #1#2 \@@_run_code:
{ \@@_grab_u_aux:nnN {#1} {#2} \cs_set_protected_nopar:Npn }
\cs_new_protected:Npn \@@_grab_u_long:w #1#2 \@@_run_code:
@@ -3483,6 +3573,8 @@
{ \@@_add_arg:n {##1} }
\l_@@_fn_tl
}
+%</package>
+%<*!package>
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -3694,10 +3786,10 @@
\c_@@_special_chars_seq
\char_set_catcode_other:N
%</initex>
-%<*package|2ekernel>
+%<*core>
\cs_set_eq:NN \do \char_set_catcode_other:N
\dospecials
-%</package|2ekernel>
+%</core>
\tex_endlinechar:D = `\^^M \scan_stop:
\bool_if:NTF \l_@@_long_bool
{ \char_set_catcode_other:n { \tex_endlinechar:D } }
@@ -4762,6 +4854,13 @@
The~letter~'#2'~does~not~specify~a~known~argument~type.
\c_@@_ignore_def_tl
}
+\__kernel_msg_new:nnnn { xparse } { xparse-argument-type }
+ { Deprecated~argument~type~'#2'~for~the~#1~requires~xparse. }
+ {
+ The~letter~'#2'~specifies~a~known~argument~type~that~requires~
+ the~xparse~package.
+ \c_@@_ignore_def_tl
+ }
% \end{macrocode}
%
% Errors when using commands/environments. The \texttt{if-boolean}
@@ -5112,18 +5211,15 @@
%
% \begin{macrocode}
%<*2ekernel>
-% \end{macrocode}
-%
-% \begin{macrocode}
\ExplSyntaxOff
-% \end{macrocode}
-%
-% \begin{macrocode}
%</2ekernel>
% \end{macrocode}
%
% \begin{macrocode}
-%</package|2ekernel>
+%<*core>
+\@@_file_end_hook:
+%</core>
+%</!package>
% \end{macrocode}
%
% \end{implementation}