diff options
author | Karl Berry <karl@freefriends.org> | 2017-06-05 23:17:08 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-06-05 23:17:08 +0000 |
commit | 683004f8a1d94fc432fd8104903a431e27bfba93 (patch) | |
tree | 2450b41f4c918810556cbaec853ec48ddc2b949a | |
parent | c684ba451bf548bdb24c40ed54caa9f11ac21422 (diff) |
latex3 (30may17)
git-svn-id: svn://tug.org/texlive/trunk@44483 c570f23f-e606-0410-a88d-b1316a301751
123 files changed, 5018 insertions, 7877 deletions
diff --git a/Master/texmf-dist/doc/latex/l3build/README.md b/Master/texmf-dist/doc/latex/l3build/README.md index 276675631c1..d05d541855e 100644 --- a/Master/texmf-dist/doc/latex/l3build/README.md +++ b/Master/texmf-dist/doc/latex/l3build/README.md @@ -1,7 +1,7 @@ l3build: a testing and building system for LaTeX3 ================================================= -Release 2017/05/19 +Release 2017/05/29 Overview -------- diff --git a/Master/texmf-dist/doc/latex/l3build/l3build.pdf b/Master/texmf-dist/doc/latex/l3build/l3build.pdf Binary files differindex b3f5835d769..4fe3f17adaa 100644 --- a/Master/texmf-dist/doc/latex/l3build/l3build.pdf +++ b/Master/texmf-dist/doc/latex/l3build/l3build.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/README.md b/Master/texmf-dist/doc/latex/l3experimental/README.md index a4fcc33bde8..ccac875f177 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/README.md +++ b/Master/texmf-dist/doc/latex/l3experimental/README.md @@ -1,7 +1,7 @@ Experimental LaTeX3 Concepts ============================ -Release 2017/05/13 +Release 2017/05/29 Overview -------- @@ -32,11 +32,7 @@ A 'string' in TeX terms is a token list in which all of the tokens have category code 12 ('other'), with the exception of spaces which have the category code 10 ('space'). The `l3str` bundle consists of two parts. The first is `l3str` itself. This is a collection of functions to act on strings, -including for manipulations such as UTF8 mappings in pdfTeX. The second -part of the bundle is `l3regex`, a regular expression search-and-replace -implementation written in TeX primitives. The regex module works on token -lists, and is part of `l3str` (currently) for historical reasons: the team -anticipate splitting the two in the future. +including for manipulations such as UTF8 mappings in pdfTeX. `xcoffins` ---------- diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3intarray.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3intarray.pdf Binary files differdeleted file mode 100644 index d636674bc80..00000000000 --- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3intarray.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3regex.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3regex.pdf Binary files differdeleted file mode 100644 index 01cfbdbb127..00000000000 --- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3regex.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-convert.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-convert.pdf Binary files differindex 187de639968..0ff1e19524b 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-convert.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-convert.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-format.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-format.pdf Binary files differindex 9c72c830baf..a84ed19f4fc 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-format.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-format.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-analysis.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-analysis.pdf Binary files differdeleted file mode 100644 index b7035acda05..00000000000 --- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-analysis.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-build.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-build.pdf Binary files differdeleted file mode 100644 index 50c18f66a91..00000000000 --- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-build.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf b/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf Binary files differindex 59d76b7dd49..b0474719904 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf b/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf Binary files differindex 8859730fe8d..4f6675280b8 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf b/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf Binary files differindex 9768984fbe5..1b9b2c657dc 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/README.md b/Master/texmf-dist/doc/latex/l3kernel/README.md index ec32d80e731..1e941253eee 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/README.md +++ b/Master/texmf-dist/doc/latex/l3kernel/README.md @@ -1,7 +1,7 @@ LaTeX3 Programming Conventions ============================== -Release 2017/05/13 +Release 2017/05/29 Overview -------- diff --git a/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf b/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf Binary files differindex 27bba9740e1..374371230f6 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf b/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf Binary files differindex 3647b2b48f2..18de9660f4d 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/interface3.tex b/Master/texmf-dist/doc/latex/l3kernel/interface3.tex deleted file mode 100644 index 4c0a2761e92..00000000000 --- a/Master/texmf-dist/doc/latex/l3kernel/interface3.tex +++ /dev/null @@ -1,89 +0,0 @@ -% \iffalse meta-comment -% -%% File: interfaces3.tex Copyright (C) 1990-2011 The 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 "l3kernel 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/svnroot/experimental/trunk/ -%% -%% 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 LaTeX3 Project. -%% -%% ----------------------------------------------------------------------- -% -% \fi - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% This document will typeset the LaTeX3 interface descriptions a single -% document. This will produce quite a large file (more than 170 pages -% currently). -% -% There is also a full version of the sources (source3.tex) which additionally -% also typesets the command implementations. -% -% Do not forget to generate the index (as explained on the terminal output -% near the end of the run)! -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - -\documentclass{l3doc} -\listfiles - -\begin{document} - -\title{The \LaTeX3 Interfaces} -\author{% - The \LaTeX3 Project\thanks - {% - E-mail: - \href{mailto:latex-team@latex-project.org} - {latex-team@latex-project.org}% - }% -} - -\pagenumbering{roman} -\maketitle - -% -% First load all modules and typeset the documentation parts -% - -\input{source3body} % all the individual modules - -\clearpage - -\begingroup - \def\endash{--} - \catcode`\-\active - \def-{\futurelet\temp\indexdash} - \def\indexdash{\ifx\temp-\endash\fi} - \DelayPrintIndex -\endgroup - -\end{document} - - diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3docstrip.pdf b/Master/texmf-dist/doc/latex/l3kernel/l3docstrip.pdf Binary files differindex 8bc6bf4fada..0dd679911d9 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/l3docstrip.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/l3docstrip.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf Binary files differindex 25a4ac803ea..0a9b12ea552 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex deleted file mode 100644 index 909461fe12f..00000000000 --- a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.tex +++ /dev/null @@ -1,274 +0,0 @@ -\iffalse meta-comment - -File l3styleguide.tex Copyright (C) 2011,2012,2015-2017 The 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 "l3kernel 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. - -\fi - -\documentclass{l3doc} - - -\title{% - The \LaTeX3 kernel: style guide for code authors% -} -\author{% - The \LaTeX3 Project\thanks - {% - E-mail: - \href{mailto:latex-team@latex-project.org}% - {latex-team@latex-project.org}% - }% -} -\date{Released 2017/05/13} - -\begin{document} - -\maketitle - -\tableofcontents - -\section{Introduction} - -This document is intended as a style guide for authors of code and -documentation for the \LaTeX3 kernel. It covers both aspects of coding -style and the formatting of the sources. The aim of providing these -guidelines is help ensure consistency of the code and sources from -different authors. Experience suggests that in the long-term this helps -with maintenance. There will of course be places where there are -exceptions to these guidelines: common sense should always be -applied! - -\section{Documentation style} - -\LaTeX3 source and documentation should be written using the document -class \cls{l3doc} in \file{dtx} format. This class provides a number -of logical mark up elements, which should be used where possible. -In the main, this is standard \LaTeX{} practice, but there are a -few points to highlight: -\begin{itemize} - \item - Where possible, use \cs{cs} to mark up control sequences - rather than using a verbatim environment. - \item - Arguments which are given in braces should be marked using - \cs{Arg} when code-level functions are discussed, but using - \cs{marg} for document functions. - \item - The names \TeX{}, \LaTeX{}, \emph{etc}.\ use the normal logical mark - up followed by an empty group (|{}|), with the exception of |\LaTeX3|, - where the number should follow directly. - \item - Where in line verbatim text is used, it should be marked up - using the \verb=|...|= construct (\emph{i.e.}~vertical bars delimit - the verbatim text). - \item In line quotes should be marked up using the \cs{enquote} - function. - \item - Where numbers in the source have a mathematical meaning, - they should be included in math mode. Such in-line math mode - material should be marked up using |$...$| and \emph{not} - |\(...\)|. -\end{itemize} - -Line length in the source files should be under $80$ -characters where possible, as this helps keep everything on the screen -when editing files. In the \file{dtx} format, documentation lines start -with a \texttt{\%}, which is usually followed by a space to leave a -\enquote{comment margin} at the start of each line. - -As with code indenting (see later), nested environments and arguments -should be indented by (at least) two spaces to make the nature of the nesting -clear. Thus for example a typical arrangement for the \env{function} -environment might be -\begin{verbatim*} -\begin{function}{\seq_gclear:N, \seq_gclear:c} - \begin{syntax} - \cs{seq_gclear:N} \meta{sequence} - \end{syntax} - Clears all entries from the \meta{sequence} globally. -\end{function} -\end{verbatim*} -The \enquote{outer} \verb*|% \begin{function}| should have the customary -space after the |%| character at the start of the line. - -In general, a single \env{function} or \env{macro} environment should be -used for a group of closely-related functions, for example argument -specification variants. In such cases, a comma-separated list should be -used, as shown in the preceding example. - -\section{Format of the code itself} - -The requirement for less than $80$ characters per line applies to the code -itself as well as the surrounding documentation. A number of the general -style principles for \LaTeX3 code apply: these are described in the following -paragraph and an example is then given. - -With the exception of simple runs of parameter (|{#1}|, |#1#2|, -\emph{etc.}), everything should be divided up using spaces to make the code -more readable. In general, these will be single spaces, but in some -places it makes more sense to align parts of the code to emphasise -similarity. (Tabs should not be used for introducing white space.) - -Each conceptually-separate step in a function should be on a separate -line, to make the meaning clearer. Hence the \texttt{false} branch -in the example uses two lines for the two auxiliary function uses. - -Within the definition, a two-space indent should be used to show each -\enquote{level} of code. Thus in the example \cs{tl_if_empty:nTF} is -indented by two spaces, but the two branches are indented by four -spaces. Within the \texttt{false} branch, the need for multiple lines -means that an additional two-space indent should be used to show that -these lines are all part of the brace group. - -The result of these lay-out conventions is code which will in general -look like the example: -\begin{verbatim*} -\cs_new:Npn \module_foo:nn #1#2 - { - \tl_if_empty:nTF {#1} - { \module_foo_aux:n { X #2 } } - { - \module_foo_aux:nn {#1} {#2} - \module_foo_aux:n { #1 #2 } - } - } -\end{verbatim*} - -\section{Code conventions} - -All code-level functions should be \enquote{long} if they accept any -arguments, even if it seems \enquote{very unlikely} that a \cs{par} token -will be passed. Thus \cs{cs_new_nopar:Npn} and so forth should only be used -to create interfaces at the document level (where trapping \cs{par} tokens -may be appropriate) or where comparison to other code known not to be -\enquote{long} is required (\emph{e.g.}~when working with mixed -\LaTeXe{}/\pkg{expl3} situations). - -The expandability of each function should be well-defined. Functions which -cannot be fully expanded must be \texttt{protected}. This means that expandable -functions must themselves only contain expandable material. Functions which -use any non-expandable material must be defined using \cs{cs_new_protected:Npn} -or similar. - -When using \cs{cs_generate_variant:Nn}, group related variants together -to make the pattern clearer. A common example is variants of a function -which has an \texttt{N}-type first argument: -\begin{verbatim} - \cs_generate_variant:Nn \foo:Nn { NV , No } - \cs_generate_variant:Nn \foo:Nn { c , cV , co } -\end{verbatim} - -There may be cases where omitting braces from \texttt{o}-type arguments -is desirable for performance reasons. This should only be done if the -argument is a single token, thus for example -\begin{verbatim} - \tl_set:No \l_some_tl \l_some_other_tl -\end{verbatim} -remains clear and can be used where appropriate. - -\section{Private and internal functions} - -Private functions (those starting \cs{__}) should not be used between modules. -The only exception is where a \enquote{family} of modules share some -\enquote{internal} methods: this happens most obviously in the kernel itself. -Any internal functions or variables \emph{must} be documented in the same way -as public ones. - -The \pkg{l3docstrip} method should be used for internal functions in a module. -This requires a line -\begin{quote} - \ttfamily - \%<@@=\meta{module}> -\end{quote} -at the start of the source (\texttt{.dtx}) file, with internal functions -then written in the form -\begin{verbatim} - \cs_new_protected:Npn \@@_function:nn #1#2 - ... -\end{verbatim} - -\subsection{Access from other modules} - -There may be cases where it is useful to use an internal function from -a third-party module (this includes cases where you are the author of both -but they are not part of the same \enquote{family}). In these cases, you should -\emph{copy} the definition of the internal function to your code: this avoids -relying on non-documented interfaces. At the same time, it is strongly -encouraged that you discuss your requirements with the author of the -code you need to access. The best long-term solution to these cases is for -new documented interfaces to be added to the parent module. - -\subsection{Access to primitives} - -As \pkg{expl3} is still a developing system, there are places where direct -access to engine primitives is required. These are all marked as -\enquote{do not use} in the code and so require special handling. Where a -programmer is sure that they need to use a primitive (for example where the -team have not yet covered access to an area) then a local copy of the -primitive should be made, for example -\begin{verbatim} - \cs_new_eq:NN \__module_message:w \tex_message:D - % ... - \cs_new_protected:Npn \__module_fancy_msg:n #1 - { \__module_message:w { *** #1 *** } } -\end{verbatim} -This approach makes it possible for the team and others to find such -usage (by searching for the \texttt{:D} argument type) but avoids -multiple uses in general code. - -At the same time, the team ask that these use cases are raised on the -\texttt{LaTeX-L} mailing list. The team are keen to collect use cases for -areas that have not yet been addressed and to provide new code where the -required interfaces become clear. - -Programmers using primitives should be ready to make updates to their -code as the team develop additional interfaces. - -\section{Auxiliary functions} - -In general, the team encourages the use of descriptive names in \LaTeX3 code. -Thus many helper functions will have names which describe briefly what they do, -rather than simply indicating that they are auxiliary to some higher-level -function. However, there are places where one or more \texttt{aux} functions -are required. Where possible, these should be differentiated by signature -\begin{verbatim} - \cs_new_protected:Npn \@@_function:nn #1#2 - { - ... - } - \cs_new_protected:Npn \@@_function_aux:nn #1#2 - { - ... - } - \cs_new_protected:Npn \@@_function_aux:w #1#2 \q_stop - { - ... - } -\end{verbatim} -Where more than one auxiliary shares the same signature, the recommended naming -scheme is \texttt{auxi}, \texttt{auxii} and so on. -\begin{verbatim} - \cs_new_protected:Npn \@@_function_auxi:nn #1#2 - { - ... - } - \cs_new_protected:Npn \@@_function_auxii:nn #1#2 - { - ... - } -\end{verbatim} -The use of \texttt{aux_i}, \texttt{aux_ii}, \emph{etc.}\ is discouraged as this -conflicts with the convention used by \cs{use_i:nn} and related functions. - -\end{document} diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf Binary files differindex 60a0c7a2d4c..878e47efdf5 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.tex b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.tex deleted file mode 100644 index 5e39806bda2..00000000000 --- a/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.tex +++ /dev/null @@ -1,101 +0,0 @@ -\iffalse meta-comment - -File l3syntax-changes.tex Copyright (C) 2011-2012,2017 The 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 "l3kernel 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. - -\fi - -\documentclass{l3doc} - - -\title{% - Syntax changes in \LaTeX3 functions% -} -\author{% - The \LaTeX3 Project\thanks - {% - E-mail: - \href{mailto:latex-team@latex-project.org}% - {latex-team@latex-project.org}% - }% -} -\date{Released 2017/05/13} - -\newcommand{\TF}{\textit{(TF)}} - -\begin{document} - -\maketitle - -This file lists functions whose syntax has changed after August 2011, -with an approximate date. - -\section{August 2011} - -\begin{itemize} - \item \cs{tl_if_single:n\TF} recognized any non-zero number of - explicit spaces as \meta{true}, and did not ignore trailing spaces. - Now it is \meta{true} for - \[ - \meta{optional spaces} - \meta{normal token or brace group} - \meta{optional spaces}. - \] - \item \cs{tl_reverse:n} stripped outer braces and lost unprotected spaces. - Now it keeps spaces, leaves unbraced single tokens unbraced, and - braced groups braced. - \item \cs{tl_trim_spaces:n} only removed one leading and trailing space. - Now removes recursively. Also, on the left it used to strip implicit - and explicit spaces with any character code. Now it strips only explicit - space characters $(32,10)$. -\end{itemize} - -\section{September 2011} - -\begin{itemize} -\item clist functions which receive an \texttt{n}-type comma list argument - now trim spaces from each item in the argument. -\end{itemize} - -\section{June 2012} - -\begin{itemize} - \item Access to list functions now indexes from~$1$, not from~$0$. - This applies to multiple choices in the \pkg{l3keys} module and - the \cs{clist_item:Nn}, \cs{seq_item:Nn} and \cs{tl_item:Nn} - functions. - \item \cs{tl_trim_spaces:n} now requires a variable number of - expansions to fully expand, rather than exactly two. Of course, - \texttt{x}-type expansion still correctly evaluates this function. -\end{itemize} - -\section{July 2012} - -\begin{itemize} - \item The \cs{tl_if_head_eq_meaning:nN}, \cs{tl_if_head_eq_catcode:nN} - and \cs{tl_if_head_eq_charcode:nN} conditionals now never match when - their first argument is empty. -\end{itemize} - -\section{August 2012} - -\begin{itemize} - \item \cs{lua_now:x} is now a standard \texttt{x}-type expansion of - \cs{lua_now:n}, which does no expansion. Engine-level expansion is moved - to \cs{lua_now_x:n}, reflecting the fact that this is non-standard in the - same way as for example \cs{str_if_eq_x:nn(TF)}. -\end{itemize} - - -\end{document} diff --git a/Master/texmf-dist/doc/latex/l3kernel/source3.pdf b/Master/texmf-dist/doc/latex/l3kernel/source3.pdf Binary files differindex a0f086afe40..ac3ebd9ad71 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/source3.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/source3.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/source3.tex b/Master/texmf-dist/doc/latex/l3kernel/source3.tex deleted file mode 100644 index 22c3c44048d..00000000000 --- a/Master/texmf-dist/doc/latex/l3kernel/source3.tex +++ /dev/null @@ -1,106 +0,0 @@ -% \iffalse meta-comment -% -%% File: source3.tex Copyright (C) 1990-2011 The 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 "l3kernel 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/svnroot/experimental/trunk/ -%% -%% 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 LaTeX3 Project. -%% -%% ----------------------------------------------------------------------- -% -% \fi - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% This document will typeset the LaTeX3 sources as a single document. -% This will produce quite a large file (more than 780 pages). -% -% There is also a shorter version (interface3.tex) that only typesets the -% command % interface descriptions. -% -% Do not forget to generate the index (as explained on the terminal output -% near the end of the run)! -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\documentclass{l3doc} -\listfiles - -\begin{document} - -\title{The \LaTeX3 Sources} -\author{% - The \LaTeX3 Project\thanks - {% - E-mail: - \href{mailto:latex-team@latex-project.org} - {latex-team@latex-project.org}% - }% -} - -\pagenumbering{roman} -\maketitle - -% -% First load all modules and typeset the documentation parts -% - -\input{source3body} % all the individual modules - -% -% Now reload all modules and typeset the implementation parts -% - -\part{Implementation} - -\def\maketitle{} -\EnableImplementation -\DisableDocumentation -\DocInputAgain - -\clearpage -\pagestyle{headings} - -% Make TeX shut up. -\hbadness=10000 -\newcount\hbadness -\hfuzz=\maxdimen - -\PrintChanges -\clearpage - -\begingroup - \def\endash{--} - \catcode`\-\active - \def-{\futurelet\temp\indexdash} - \def\indexdash{\ifx\temp-\endash\fi} - - \DelayPrintIndex -\endgroup - -\end{document} diff --git a/Master/texmf-dist/doc/latex/l3kernel/source3body.tex b/Master/texmf-dist/doc/latex/l3kernel/source3body.tex index 86203d42ac6..b8f445ec6c8 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/source3body.tex +++ b/Master/texmf-dist/doc/latex/l3kernel/source3body.tex @@ -347,8 +347,8 @@ without repetition, this information is given in a shortened form: |\sys_if_engine_xetex:TF| \Arg{true code} \Arg{false code} \end{syntax} The underlining and italic of \texttt{TF} indicates that - |\xetex_if_engine:T|, |\xetex_if_engine:F| and - |\xetex_if_engine:TF| are all available. Usually, the illustration + |\sys_if_engine_xetex:T|, |\sys_if_engine_xetex:F| and + |\sys_if_engine_xetex:TF| are all available. Usually, the illustration will use the \texttt{TF} variant, and so both \meta{true code} and \meta{false code} will be shown. The two variant forms \texttt{T} and \texttt{F} take only \meta{true code} and \meta{false code}, respectively. @@ -419,6 +419,7 @@ used on top of \LaTeXe{} if \cs{outer} tokens are used in the arguments. \DocInput{l3str.dtx} \DocInput{l3seq.dtx} \DocInput{l3int.dtx} +\DocInput{l3intarray.dtx} \DocInput{l3flag.dtx} \DocInput{l3quark.dtx} \DocInput{l3prg.dtx} @@ -452,6 +453,9 @@ used on top of \LaTeXe{} if \cs{outer} tokens are used in the arguments. \ExplSyntaxOff \DocInput{l3sort.dtx} +\DocInput{l3tl-analysis.dtx} +\DocInput{l3tl-build.dtx} +\DocInput{l3regex.dtx} \DocInput{l3box.dtx} \DocInput{l3coffins.dtx} \DocInput{l3color.dtx} diff --git a/Master/texmf-dist/doc/latex/l3packages/README.md b/Master/texmf-dist/doc/latex/l3packages/README.md index 9fb0ae2bb43..4a157fa5454 100644 --- a/Master/texmf-dist/doc/latex/l3packages/README.md +++ b/Master/texmf-dist/doc/latex/l3packages/README.md @@ -1,7 +1,7 @@ LaTeX3 High-Level Concepts ========================== -Release 2017/05/13 +Release 2017/05/29 Overview -------- diff --git a/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf b/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf Binary files differindex acd5b6d2d77..31796912bb4 100644 --- a/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf +++ b/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf diff --git a/Master/texmf-dist/doc/latex/l3packages/xfp/xfp.pdf b/Master/texmf-dist/doc/latex/l3packages/xfp/xfp.pdf Binary files differindex 165ec365d4d..b8f1965546a 100644 --- a/Master/texmf-dist/doc/latex/l3packages/xfp/xfp.pdf +++ b/Master/texmf-dist/doc/latex/l3packages/xfp/xfp.pdf diff --git a/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf b/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf Binary files differindex d25a5fb1de9..f253fe27bd6 100644 --- a/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf +++ b/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf diff --git a/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf b/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf Binary files differindex 2eedc21e4e5..ee5762fe637 100644 --- a/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf +++ b/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf diff --git a/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf b/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf Binary files differindex ddd3231aadc..d62d369132e 100644 --- a/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf +++ b/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf diff --git a/Master/texmf-dist/source/latex/l3build/l3build.dtx b/Master/texmf-dist/source/latex/l3build/l3build.dtx index 6e9d4e3adb4..815d941b00b 100644 --- a/Master/texmf-dist/source/latex/l3build/l3build.dtx +++ b/Master/texmf-dist/source/latex/l3build/l3build.dtx @@ -202,7 +202,7 @@ % }^^A % } % -% \date{Released 2017/05/19} +% \date{Released 2017/05/29} % % \maketitle % \tableofcontents @@ -286,7 +286,7 @@ % \item check \meta{name(s)} % \item cmdcheck % \item clean -% \item doc +% \item doc \meta{name(s)} % \item install % \item save \meta{name(s)} % \item setversion @@ -443,12 +443,15 @@ % If \var{typesetsearch} is \code{true} (default), standard \texttt{texmf} search trees are used in the typesetting compilation. If set to false, \emph{all} necessary files for compilation must be included in the |build/local| sandbox. % \end{buildcmd} % +% \begin{buildcmd}{doc \meta{name(s)}} +% Typesets only the files with the \meta{name(s)} given, which should be the +% root name without any extension. +% \end{buildcmd} % % \begin{buildcmd}{install} % Copies all package files (defined by \var{installfiles}) into the user's home \texttt{texmf} tree in the form of the \TeX\ Directory Structure. % \end{buildcmd} % -% % \begin{buildcmd}{save \meta{name(s)}} % This command runs through the same execution as |check| for a specific test(s) \texttt{\meta{name(s)}.lvt}. % This command saves the output of the test to a |.tlg| file. @@ -1067,9 +1070,9 @@ % \texttt{tex} can be used, along with custom code, to define a PDF % typesetting pathway. The functions \texttt{biber} and \texttt{bibtex} % take a single argument: the name of the file to work with \emph{minus} -% any extension. The \texttt{tex} takes as an arugment the full name +% any extension. The \texttt{tex} takes as an argument the full name % of the file. The most complex function \texttt{makeindex} requires the -% name, input extension, putput extension, log extension and style name. +% name, input extension, output extension, log extension and style name. % For example, Figure~\ref{fig:PDF} shows a simple script which might % apply to a case where multiple \BibTeX{} runs are needed (perhaps where % citations can appear within other references). @@ -1082,17 +1085,17 @@ % % module = "mymodule" % -% function typeset (file) -% local name = string.match (file, "^(.*)%.") or name +% function typeset(file) +% local name = jobname(file) % local errorlevel = tex (file) % if errorlevel == 0 then % -- Return a non-zero errorlevel if anything goes wrong -% errorlevel = ( -% bibtex (name) + -% tex (file) + -% bibtex (name) + -% tex (file) + -% tex (file) +% errorlevel =( +% bibtex(name) + +% tex(file) + +% bibtex(name) + +% tex(file) + +% tex(file) % ) % end % return errorlevel @@ -1154,6 +1157,14 @@ % \meta{target} directory. % \end{function} % +% \begin{function}{basename()} +% \begin{syntax} +% |basename(|\meta{file}|)| +% \end{syntax} +% Returns a string comprising the full name of the file with the +% path removed (\emph{i.e.}~from the last |/| onward). +% \end{function} +% % \begin{function}{cleandir()} % \begin{syntax} % |cleandir(|\meta{dir}|)| @@ -1192,7 +1203,16 @@ % all files in the \meta{path}. % \end{function} % -% \begin{function}{mkidr()} +% \begin{function}{jobname()} +% \begin{syntax} +% |jobname(|\meta{file}|)| +% \end{syntax} +% Returns a string comprising the jobname of the file with the +% path and extension removed (\emph{i.e.}~from the last |/| up to the +% last |.|). +% \end{function} +% +% \begin{function}{mkdir()} % \begin{syntax} % |mkdir(|\meta{dir}|)| % \end{syntax} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx index 4e4b8c3959b..5d0300e6f4b 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -252,9 +252,8 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{l3str-convert}{2017/05/13}{} +\ProvidesExplPackage{l3str-convert}{2017/05/29}{} {L3 Experimental string encoding conversions} -\RequirePackage{l3tl-analysis,l3tl-build} % \end{macrocode} % % \subsection{Helpers} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx index c61d2575e90..56111fade54 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -163,7 +163,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3str-format}{2017/05/13}{} +\ProvidesExplPackage{l3str-format}{2017/05/29}{} {L3 Experimental string formatting} \RequirePackage{l3str} %</package> diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins index be46fd21845..2f2ed04c016 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins @@ -51,13 +51,8 @@ and all files in that bundle must be distributed together. \keepsilent -\generate{\file{l3regex.sty} {\from{l3regex.dtx} {package}}} \generate{\file{l3str-convert.sty} {\from{l3str-convert.dtx} {package}}} \generate{\file{l3str-format.sty} {\from{l3str-format.dtx} {package}}} -\generate{\file{l3tl-analysis.sty} {\from{l3tl-analysis.dtx} {package}}} -\generate{\file{l3tl-build.sty} {\from{l3tl-build.dtx} {package}}} -\generate{\file{l3regex-trace.sty} {\from{l3regex.dtx} {package,trace}}} -\generate{\file{l3intarray.sty} {\from{l3intarray.dtx} {package}}} % Escapings. \generate{% diff --git a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx index 59439b2b93f..7f57f213d87 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx @@ -54,7 +54,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -673,7 +673,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xcoffins}{2017/05/13}{} +\ProvidesExplPackage{xcoffins}{2017/05/29}{} {L3 Experimental design level coffins} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx index b29e9fa8364..b030677562f 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx @@ -24,8 +24,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/05/13] -%<package>\@ifpackagelater{expl3}{2017/05/13} +\RequirePackage{expl3}[2017/05/29] +%<package>\@ifpackagelater{expl3}{2017/05/29} %<package> {} %<package> {% %<package> \PackageError{l3galley}{Support package l3kernel too old} @@ -59,7 +59,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -685,7 +685,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3galley}{2017/05/13}{} +\ProvidesExplPackage{l3galley}{2017/05/29}{} {L3 Experimental galley code} %</package> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx index 00b6928e4bc..23a75e2c37d 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx @@ -45,7 +45,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -732,7 +732,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xgalley}{2017/05/13}{} +\ProvidesExplPackage{xgalley}{2017/05/29}{} {L3 Experimental galley} \RequirePackage{xparse,xtemplate,l3galley} % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index eaee0f7a59d..cc7493c71e3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -21,7 +21,7 @@ % for those people who are interested. % %<*driver|generic|package> -\def\ExplFileDate{2017/05/13}% +\def\ExplFileDate{2017/05/29}% %</driver|generic|package> %<*driver> \documentclass[full]{l3doc} @@ -49,7 +49,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3.ins b/Master/texmf-dist/source/latex/l3kernel/l3.ins index 2c381ced862..94b3fe38571 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3.ins +++ b/Master/texmf-dist/source/latex/l3kernel/l3.ins @@ -67,6 +67,7 @@ and all files in that bundle must be distributed together. \from{l3str.dtx} {package} \from{l3seq.dtx} {package} \from{l3int.dtx} {package} + \from{l3intarray.dtx} {package} \from{l3flag.dtx} {package} \from{l3quark.dtx} {package} \from{l3prg.dtx} {package} @@ -91,6 +92,9 @@ and all files in that bundle must be distributed together. \from{l3fp-random.dtx} {package} \from{l3fp-assign.dtx} {package} \from{l3sort.dtx} {package} + \from{l3tl-build.dtx} {package} + \from{l3tl-analysis.dtx}{package} + \from{l3regex.dtx} {package} \from{l3box.dtx} {package} \from{l3coffins.dtx} {package} \from{l3color.dtx} {package} @@ -138,11 +142,13 @@ and all files in that bundle must be distributed together. \generate{\file{l3prg.sty} {\from{l3oldmodules.dtx} {l3prg,oldmodules}}} \generate{\file{l3prop.sty} {\from{l3oldmodules.dtx} {l3prop,oldmodules}}} \generate{\file{l3quark.sty} {\from{l3oldmodules.dtx} {l3quark,oldmodules}}} +\generate{\file{l3regex.sty} {\from{l3oldmodules.dtx} {l3regex,oldmodules}}} \generate{\file{l3seq.sty} {\from{l3oldmodules.dtx} {l3seq,oldmodules}}} \generate{\file{l3skip.sty} {\from{l3oldmodules.dtx} {l3skip,oldmodules}}} -\generate{\file{l3sort.sty} {\from{l3oldmodules.dtx} {l3sort,oldmodules}}} +\generate{\file{l3sort.sty} {\from{l3oldmodules.dtx} {l3sort,oldmodules}}} \generate{\file{l3str.sty} {\from{l3oldmodules.dtx} {l3str,oldmodules}}} \generate{\file{l3tl.sty} {\from{l3oldmodules.dtx} {l3tl,oldmodules}}} +\generate{\file{l3tl-analysis.sty}{\from{l3oldmodules.dtx} {l3tl-analysis,oldmodules}}} \generate{\file{l3token.sty} {\from{l3oldmodules.dtx} {l3token,oldmodules}}} % Lua code @@ -150,12 +156,17 @@ and all files in that bundle must be distributed together. \def\MetaPrefix{--} \preamble -EXPERIMENTAL CODE +Copyright (C) 1990-2017 The LaTeX3 Project -Do not distribute this file without also distributing the -source files specified above. +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: -Do not distribute a modified version of this file. + http://www.latex-project.org/lppl.txt + +This file is part of the "l3kernel bundle" (The Work in LPPL) +and all files in that bundle must be distributed together. \endpreamble \nopostamble diff --git a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx index 1e94b66f730..989cd514177 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 7b895ee75d0..f37f4bcc4b4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx index db8e9826e3b..11032c534dd 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx @@ -139,7 +139,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index b7ac16ab656..5bc3bd3c2ce 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx index 627f4eba9e0..aeb2ce1469b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -201,89 +201,6 @@ % an error if the file is not found, in contrast to \cs{file_input:n}. % \end{function} % -% \begin{function}[added = 2012-02-11]{\ior_map_inline:Nn} -% \begin{syntax} -% \cs{ior_map_inline:Nn} \meta{stream} \Arg{inline function} -% \end{syntax} -% Applies the \meta{inline function} to \meta{lines} obtained by -% reading one or more lines (until an equal number of left and right -% braces are found) from the \meta{stream}. The \meta{inline function} -% should consist of code which will receive the \meta{line} as |#1|. -% Note that \TeX{} removes trailing space and tab characters -% (character codes 32 and 9) from every line upon input. \TeX{} also -% ignores any trailing new-line marker from the file it reads. -% \end{function} -% -% \begin{function}[added = 2012-02-11]{\ior_str_map_inline:Nn} -% \begin{syntax} -% \cs{ior_str_map_inline:Nn} \Arg{stream} \Arg{inline function} -% \end{syntax} -% Applies the \meta{inline function} to every \meta{line} -% in the \meta{stream}. The material is read from the \meta{stream} -% as a series of tokens with category code $12$ (other), with the -% exception of space characters which are given category code $10$ -% (space). The \meta{inline function} should consist of code which -% will receive the \meta{line} as |#1|. -% Note that \TeX{} removes trailing space and tab characters -% (character codes 32 and 9) from every line upon input. \TeX{} also -% ignores any trailing new-line marker from the file it reads. -% \end{function} -% -% \begin{function}[added = 2012-06-29]{\ior_map_break:} -% \begin{syntax} -% \cs{ior_map_break:} -% \end{syntax} -% Used to terminate a \cs[no-index]{ior_map_\ldots} function before all -% lines from the \meta{stream} have been processed. This will -% normally take place within a conditional statement, for example -% \begin{verbatim} -% \ior_map_inline:Nn \l_my_ior -% { -% \str_if_eq:nnTF { #1 } { bingo } -% { \ior_map_break: } -% { -% % Do something useful -% } -% } -% \end{verbatim} -% Use outside of a \cs[no-index]{ior_map_\ldots} scenario will lead to low -% level \TeX{} errors. -% \begin{texnote} -% When the mapping is broken, additional tokens may be inserted by the -% internal macro \cs{__prg_break_point:Nn} before further items are taken -% from the input stream. This will depend on the design of the mapping -% function. -% \end{texnote} -% \end{function} -% -% \begin{function}[added = 2012-06-29]{\ior_map_break:n} -% \begin{syntax} -% \cs{ior_map_break:n} \Arg{tokens} -% \end{syntax} -% Used to terminate a \cs[no-index]{ior_map_\ldots} function before all -% lines in the \meta{stream} have been processed, inserting -% the \meta{tokens} after the mapping has ended. This will -% normally take place within a conditional statement, for example -% \begin{verbatim} -% \ior_map_inline:Nn \l_my_ior -% { -% \str_if_eq:nnTF { #1 } { bingo } -% { \ior_map_break:n { <tokens> } } -% { -% % Do something useful -% } -% } -% \end{verbatim} -% Use outside of a \cs[no-index]{ior_map_\ldots} scenario will lead to low -% level \TeX{} errors. -% \begin{texnote} -% When the mapping is broken, additional tokens may be inserted by the -% internal macro \cs{__prg_break_point:Nn} before the \meta{tokens} are -% inserted into the input stream. -% This will depend on the design of the mapping function. -% \end{texnote} -% \end{function} -% % \begin{function}[added = 2014-08-22] % {\ior_log_streams:, \iow_log_streams:} % \begin{syntax} @@ -475,7 +392,7 @@ % % \section{Additions to \pkg{l3sys}} % -% \begin{function}[added = 2017-04-12, EXP, pTF]{\sys_if_rand_exist:} +% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_rand_exist:} % \begin{syntax} % \cs{sys_if_rand_exist_p:} % \cs{sys_if_rand_exist:TF} \Arg{true code} \Arg{false code} @@ -484,7 +401,7 @@ % this is the case in \pdfTeX{} and \LuaTeX{}. % \end{function} % -% \begin{function}[added = 2017-04-12, EXP]{\sys_rand_seed:} +% \begin{function}[added = 2017-05-27, EXP]{\sys_rand_seed:} % \begin{syntax} % \cs{sys_rand_seed:} % \end{syntax} @@ -493,7 +410,7 @@ % expands to $0$. % \end{function} % -% \begin{function}[added = 2017-04-12]{\sys_gset_rand_seed:n} +% \begin{function}[added = 2017-05-27]{\sys_gset_rand_seed:n} % \begin{syntax} % \cs{sys_gset_rand_seed:n} \Arg{intexpr} % \end{syntax} @@ -506,6 +423,61 @@ % random number support this produces an error. % \end{function} % +% \begin{variable}[added = 2017-05-27]{\c_sys_shell_escape_int} +% This variable exposes the internal triple of the shell escape +% status. The possible values are +% \begin{description} +% \item[0] Shell escape is disabled +% \item[1] Unrestricted shell escape is enabled +% \item[2] Restricted shell escape is enabled +% \end{description} +% \end{variable} +% +% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_shell:} +% \begin{syntax} +% \cs{sys_if_shell_p:} +% \cs{sys_if_shell:TF} \Arg{true code} \Arg{false code} +% \end{syntax} +% Performs a check for whether shell escape is enabled. This will +% return true if either of restricted or unrestircted shell escape +% is enabled. +% \end{function} +% +% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_shell_unrestricted:} +% \begin{syntax} +% \cs{sys_if_shell_unrestricted_p:} +% \cs{sys_if_shell_unrestricted:TF} \Arg{true code} \Arg{false code} +% \end{syntax} +% Performs a check for whether \emph{unrestricted} shell escape is +% enabled. +% \end{function} +% +% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_shell_restricted:} +% \begin{syntax} +% \cs{sys_if_shell_restricted_p:} +% \cs{sys_if_shell_restricted:TF} \Arg{true code} \Arg{false code} +% \end{syntax} +% Performs a check for whether \emph{restricted} shell escape is +% enabled. This will return false if unrestricted shell escape is +% enabled. Unrestricted shell escape is not considered a superset +% of restricted shell escape in this case. To find whether any +% shell escape is enabled use \cs{sys_if_shell:}. +% \end{function} +% +% \begin{function}[added = 2017-05-27]{\sys_shell_now:n, \sys_shell_now:x} +% \begin{syntax} +% \cs{sys_shell_now:n} \Arg{tokens} +% \end{syntax} +% Execute \meta{tokens} through shell escape immediately. +% \end{function} +% +% \begin{function}[added = 2017-05-27]{\sys_shell_shipout:n, \sys_shell_shipout:x} +% \begin{syntax} +% \cs{sys_shell_shipout:n} \Arg{tokens} +% \end{syntax} +% Execute \meta{tokens} through shell escape at shipout. +% \end{function} +% % \section{Additions to \pkg{l3tl}} % % \begin{function}[EXP,pTF]{\tl_if_single_token:n} @@ -1523,67 +1495,6 @@ } % \end{macrocode} % \end{macro} -% -% \begin{macrocode} -%<@@=ior> -% \end{macrocode} -% -% \begin{macro}[EXP]{\ior_map_break:, \ior_map_break:n} -% Usual map breaking functions. Those are not yet in \pkg{l3kernel} -% proper since the mapping below is the first of its kind. -% \begin{macrocode} -\cs_new:Npn \ior_map_break: - { \__prg_map_break:Nn \ior_map_break: { } } -\cs_new:Npn \ior_map_break:n - { \__prg_map_break:Nn \ior_map_break: } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\ior_map_inline:Nn, \ior_str_map_inline:Nn} -% \begin{macro}[aux]{\@@_map_inline:NNn} -% \begin{macro}[aux]{\@@_map_inline:NNNn} -% \begin{macro}[aux]{\@@_map_inline_loop:NNN} -% \begin{variable}{\l_@@_internal_tl} -% Mapping to an input stream can be done on either a token or a string -% basis, hence the set up. Within that, there is a check to avoid reading -% past the end of a file, hence the two applications of \cs{ior_if_eof:N}. -% This mapping cannot be nested with twice the same stream, as the -% stream has only one \enquote{current line}. -% \begin{macrocode} -\cs_new_protected:Npn \ior_map_inline:Nn - { \@@_map_inline:NNn \ior_get:NN } -\cs_new_protected:Npn \ior_str_map_inline:Nn - { \@@_map_inline:NNn \ior_str_get:NN } -\cs_new_protected:Npn \@@_map_inline:NNn - { - \int_gincr:N \g__prg_map_int - \exp_args:Nc \@@_map_inline:NNNn - { __prg_map_ \int_use:N \g__prg_map_int :n } - } -\cs_new_protected:Npn \@@_map_inline:NNNn #1#2#3#4 - { - \cs_gset_protected:Npn #1 ##1 {#4} - \ior_if_eof:NF #3 { \@@_map_inline_loop:NNN #1#2#3 } - \__prg_break_point:Nn \ior_map_break: - { \int_gdecr:N \g__prg_map_int } - } -\cs_new_protected:Npn \@@_map_inline_loop:NNN #1#2#3 - { - #2 #3 \l_@@_internal_tl - \ior_if_eof:NF #3 - { - \exp_args:No #1 \l_@@_internal_tl - \@@_map_inline_loop:NNN #1#2#3 - } - } -\tl_new:N \l_@@_internal_tl -% \end{macrocode} -% \end{variable} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% % \begin{macro}{\ior_log_streams:} % Redirect output of \cs{ior_list_streams:} to the log. % \begin{macrocode} @@ -1592,10 +1503,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macrocode} -%<@@=iow> -% \end{macrocode} -% % \begin{macro}{\iow_log_streams:} % Redirect output of \cs{iow_list_streams:} to the log. % \begin{macrocode} @@ -1976,6 +1883,10 @@ % % \subsection{Additions to \pkg{l3sys}} % +% \begin{macrocode} +%<@@=sys> +% \end{macrocode} +% % \begin{macro}[EXP, pTF]{\sys_if_rand_exist:} % Currently, randomness exists under \pdfTeX{} and \LuaTeX{}. % \begin{macrocode} @@ -2006,6 +1917,133 @@ % \end{macrocode} % \end{macro} % +% \begin{variable}{\c_sys_shell_escape_int} +% Expose the engine's shell escape status to the user. +% \begin{macrocode} +\int_const:Nn \c_sys_shell_escape_int + { + \sys_if_engine_luatex:TF + { + \luatex_directlua:D + { + tex.sprint((status.shell_escape~or~os.execute()) .. " ") + } + } + { + \pdftex_shellescape:D + } + } +% \end{macrocode} +% \end{variable} +% +% \begin{macro}[EXP, pTF]{\sys_if_shell:} +% Performs a check for whether shell escape is enabled. This will +% return true if either of restricted or unrestricted shell escape +% is enabled. +% \begin{macrocode} +\prg_new_conditional:Nnn \sys_if_shell: { p , T , F , TF } + { + \if_int_compare:w \c_sys_shell_escape_int = 0 ~ + \prg_return_false: + \else: + \prg_return_true: + \fi: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[EXP, pTF]{\sys_if_shell_unrestricted:} +% Performs a check for whether \emph{unrestricted} shell escape is +% enabled. +% \begin{macrocode} +\prg_new_conditional:Nnn \sys_if_shell_unrestricted: { p , T , F , TF } + { + \if_int_compare:w \c_sys_shell_escape_int = 1 ~ + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[EXP, pTF]{\sys_if_shell_unrestricted:} +% Performs a check for whether \emph{restricted} shell escape is +% enabled. This will return false if unrestricted shell escape is +% enabled. Unrestricted shell escape is not considered a superset +% of restricted shell escape in this case. To find whether any +% shell escape is enabled use \cs{sys_if_shell:}. +% \begin{macrocode} +\prg_new_conditional:Nnn \sys_if_shell_restricted: { p , T , F , TF } + { + \if_int_compare:w \c_sys_shell_escape_int = 2 ~ + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{\c_@@_shell_stream_int} +% This is not needed for \LuaTeX{}: shell escape there isn't done using +% a \TeX{} interface +% \begin{macrocode} +\sys_if_engine_luatex:F + { \int_const:Nn \c_@@_shell_stream_int { 18 } } +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\sys_shell_now:n} +% Execute commands through shell escape immediately. +% \begin{macrocode} +\sys_if_engine_luatex:TF + { + \cs_new_protected:Npn \sys_shell_now:n #1 + { + \luatex_directlua:D + { + os.execute(" + \luatex_luaescapestring:D { \etex_detokenize:D {#1} } + ") + } + } + } + { + \cs_new_protected:Npn \sys_shell_now:n #1 + { + \iow_now:Nn \c_@@_shell_stream_int { #1 } + } + } +\cs_generate_variant:Nn \sys_shell_now:n { x } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sys_shell_shipout:n} +% Execute commands through shell escape at shipout. +% \begin{macrocode} +\sys_if_engine_luatex:TF + { + \cs_new_protected:Npn \sys_shell_shipout:n #1 + { + \luatex_latelua:D + { + os.execute(" + \luatex_luaescapestring:D { \etex_detokenize:D {#1} } + ") + } + } + } + { + \cs_new_protected:Npn \sys_shell_shipout:n #1 + { + \iow_shipout:Nn \c_@@_shell_stream_int { #1 } + } + } +\cs_generate_variant:Nn \sys_shell_shipout:n { x } +% \end{macrocode} +% \end{macro} +% % \subsection{Additions to \pkg{l3tl}} % % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx index 4876e488bd3..3ae99922226 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index 1bc70605f7b..c571516ea79 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3color.dtx b/Master/texmf-dist/source/latex/l3kernel/l3color.dtx index 72bca5f43db..7201aac2abc 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3color.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3color.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx index d1eaba62294..4b6f1c28f3a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index 516925b3e4a..489a6a68f93 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -70,14 +70,14 @@ and all files in that bundle must be distributed together. % This isn't included in the typeset documentation because it's a bit % ugly: %<*class> -\ProvidesExplClass{l3doc}{2017/05/13}{} +\ProvidesExplClass{l3doc}{2017/05/29}{} {L3 Experimental documentation class} %</class> % \fi % % \title{The \cls{l3doc} class} % \author{\Team} -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % \maketitle % \tableofcontents % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx index 4f8ec457518..dd8b978269a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx @@ -61,7 +61,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx index 9584a9aa624..68bb90ec8cc 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx @@ -45,7 +45,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -640,17 +640,17 @@ % % \subsubsection{Color} % -% \begin{variable}{\l_@@_current_color_tl} +% \begin{variable}{\l_@@_color_current_tl} % The current color in driver-dependent format: pick up the package-mode % data if available. % \begin{macrocode} -\tl_new:N \l_@@_current_color_tl -\tl_set:Nn \l_@@_current_color_tl { 0~g~0~G } +\tl_new:N \l_@@_color_current_tl +\tl_set:Nn \l_@@_color_current_tl { 0~g~0~G } %<*package> \AtBeginDocument { \@ifpackageloaded { color } - { \tl_set:Nn \l_@@_current_color_tl { \current@color } } + { \tl_set:Nn \l_@@_color_current_tl { \current@color } } { } } %</package> @@ -676,7 +676,7 @@ { \luatex_pdfextension:D colorstack } { \pdftex_pdfcolorstack:D } \exp_not:N \l_@@_color_stack_int push - { \exp_not:N \l_@@_current_color_tl } + { \exp_not:N \l_@@_color_current_tl } \group_insert_after:N \exp_not:N \@@_color_reset: } \cs_new_protected:Npx \@@_color_reset: @@ -690,6 +690,108 @@ % \end{macro} % \end{macro} % +% \subsection{Images} +% +% \begin{variable}{\l_@@_image_attr_tl} +% In PDF mode, additional attributes of an image (such as page number) are +% needed both to obtain the bounding box and when inserting the image: this +% occurs as the image dictionary approach means they are read as part of +% the bounding box operation. As such, it is easier to track additional +% attributes using a dedicated |tl| rather than build up the same data +% twice. +% \begin{macrocode} +\tl_new:N \l_@@_image_attr_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macro}[int] +% {\@@_image_getbb_jpg:n, \@@_image_getbb_pdf:n, \@@_image_getbb_png:n} +% \begin{macro}[aux] +% {\@@_image_getbb_auxi:n, \@@_image_getbb_auxii:n} +% Getting the bounding box here requires us to box up the image and +% measure it. To deal with the difference in feature support in bitmap +% and vector images but keeping the common parts, there is a little work +% to do in terms of auxiliaries. The key here is to notice that we need +% two forms of the attributes: a \enquote{short} set to allow us to +% track for caching, and the full form to pass to the primitive. Note that +% in |pdftex.def| the short reference is stored to be used in the inclusion +% stage: may be required when there are more aspects to track. +% \begin{macrocode} +\cs_new_protected:Npn \@@_image_getbb_jpg:n #1 + { + \int_zero:N \l__image_page_int + \tl_set:Nx \l_@@_image_attr_tl + { + \bool_if:NT \l__image_interpolate_bool + { :I } + } + \@@_image_getbb_auxi:n {#1} + } +\cs_new_eq:NN \@@_image_getbb_png:n \@@_image_getbb_jpg:n +\cs_new_protected:Npn \@@_image_getbb_pdf:n #1 + { + \bool_set_false:N \l__image_interpolate_bool + \tl_set:Nx \l_@@_image_attr_tl + { + \int_compare:nNnT \l__image_page_int > 0 + { :P \int_use:N \l__image_page_int } + } + \@@_image_getbb_auxi:n {#1} + } +\cs_new_protected:Npn \@@_image_getbb_auxi:n #1 + { + \dim_if_exist:cTF { c__image_ #1 \l_@@_image_attr_tl _ht_dim } + { + \dim_set_eq:Nc \l__image_ht_dim + { c__image_ #1 \l_@@_image_attr_tl _ht_dim } + \dim_set_eq:Nc \l__image_wd_dim + { c__image_ #1 \l_@@_image_attr_tl _wd_dim } + } + { \@@_image_getbb_auxii:n {#1} } + } +% \begin{macrocode} +% Measuring the image is done by boxing up: for PDF images we could +% use |\pdftex_pdfximagebbox:D|, but if doesn't work for other types. +% \begin{macrocode} +\cs_new_protected:Npn \@@_image_getbb_auxii:n #1 + { + \tex_immediate:D \pdftex_pdfximage:D + \bool_if:NT \l__image_interpolate_bool + { attr ~ { /Interpolate~true } } + \int_compare:nNnT \l__image_page_int > 0 + { page ~ \int_use:N \l__image_page_int } + {#1} + \hbox_set:Nn \l__image_tmp_box + { \pdftex_pdfrefximage:D \pdftex_pdflastximage:D } + \dim_set:Nn \l__image_ht_dim { \box_ht:N \l__image_tmp_box } + \dim_set:Nn \l__image_wd_dim { \box_wd:N \l__image_tmp_box } + \int_const:cn { c__image_ #1 \l_@@_image_attr_tl _int } + { \tex_the:D \pdftex_pdflastximage:D } + \dim_const:cn { c__image_ #1 \l_@@_image_attr_tl _ht_dim } + { \l__image_ht_dim } + \dim_const:cn { c__image_ #1 \l_@@_image_attr_tl _wd_dim } + { \l__image_wd_dim } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[int] +% {\@@_image_include_jpg:n, \@@_image_include_pdf:n, \@@_image_include_png:n} +% Images are already loaded for the measurement part of the code, so +% inclusion is straight-forward, with only any attributes to worry about. The +% latter carry through from determination of the bounding box. +% \begin{macrocode} +\cs_new_protected:Npn \@@_image_include_jpg:n #1 + { + \pdftex_pdfrefximage:D + \int_use:c { c__image_ #1 \l_@@_image_attr_tl _int } + } +\cs_new_eq:NN \@@_image_include_pdf:n \@@_image_include_jpg:n +\cs_new_eq:NN \@@_image_include_png:n \@@_image_include_jpg:n +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} %</pdfmode> % \end{macrocode} @@ -799,16 +901,16 @@ % % \subsubsection{Color} % -% \begin{variable}{\l_@@_current_color_tl} +% \begin{variable}{\l_@@_color_current_tl} % The current color in driver-dependent format. % \begin{macrocode} -\tl_new:N \l_@@_current_color_tl -\tl_set:Nn \l_@@_current_color_tl { [ 0 ] } +\tl_new:N \l_@@_color_current_tl +\tl_set:Nn \l_@@_color_current_tl { [ 0 ] } %<*package> \AtBeginDocument { \@ifpackageloaded { color } - { \tl_set:Nn \l_@@_current_color_tl { \current@color } } + { \tl_set:Nn \l_@@_color_current_tl { \current@color } } { } } %</package> @@ -821,7 +923,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_color_ensure_current: { - \tex_special:D { pdf:bcolor~\l_@@_current_color_tl } + \tex_special:D { pdf:bcolor~\l_@@_color_current_tl } \group_insert_after:N \@@_color_reset: } \cs_new_protected:Npn \@@_color_reset: @@ -830,6 +932,107 @@ % \end{macro} % \end{macro} % +% \subsection{Images} +% +% \begin{macro}[int] +% { +% \@@_image_getbb_eps:n, \@@_image_getbb_jpg:n, +% \@@_image_getbb_pdf:n, \@@_image_getbb_png:n +% } +% Simply use the generic functions: only for \texttt{dvipdfmx} in the +% extraction cases. +% \begin{macrocode} +\cs_new_eq:NN \@@_image_getbb_eps:n \__image_read_bb:n +%<*dvipdfmx> +\cs_new_protected:Npn \@@_image_getbb_jpg:n #1 + { + \int_zero:N \l__image_page_int + \__image_extract_bb:n {#1} + } +\cs_new_eq:NN \@@_image_getbb_png:n \@@_image_getbb_jpg:n +\cs_new_protected:Npn \@@_image_getbb_pdf:n #1 + { + \bool_set_false:N \l__image_interpolate_tl + \__image_extract_bb:n {#1} + } +%</dvipdfmx> +% \end{macrocode} +% \end{macro} +% +% \begin{variable}[aux]{\g_@@_image_int} +% Used to track the object number associated with each image. +% \begin{macrocode} +\int_new:N \g_@@_image_int +% \end{macrocode} +% \end{variable} +% +% \begin{macro}[int] +% { +% \@@_image_include_eps:n, \@@_image_include_jpg:n, +% \@@_image_include_pdf:n, \@@_image_include_png:n +% } +% \begin{macro}[aux]{\@@_image_include_auxi:nn} +% \begin{macro}[aux]{\@@_image_include_auxii:nnn, \@@_image_include_auxii:xnn} +% \begin{macro}[aux]{\@@_image_include_auxiii:nn} +% The special syntax depends on the file type. +% \begin{macrocode} +\cs_new_protected:Npn \@@_image_include_eps:n #1 + { + \tex_special:D { PSfile = #1 } + } +\cs_new_protected:Npn \@@_image_include_jpg:n #1 + { \@@_image_include_auxi:nn {#1} { image } } +\cs_new_eq:NN \@@_image_include_png:n \@@_image_include_png:n +\cs_new_protected:Npn \@@_image_include_pdf:n #1 + { \@@_image_include_auxi:nn {#1} { epdf } } +% \end{macrocode} +% Image inclusion is set up to use the fact that each image is stored in +% the PDF as an XObject. This means that we can include repeated images +% only once and refer to them. To allow that, track the nature of each +% image: much the same as for the direct PDF mode case. +% \begin{macrocode} +\cs_new_protected:Npn \@@_image_include_auxi:nn #1#2 + { + \@@_image_include_auxii:xnn + { + \int_compare:nNnT \l__image_page_int > 0 + { :P \int_use:N \l__image_page_int } + \bool_if:NT \l__image_interpolate_bool + { :I } + } + {#1} {#2} + } +\cs_new_protected:Npn \@@_image_include_auxii:nnn #1#2#3 + { + \int_if_exist:cTF { c__image_ #2#1 _int } + { + \tex_special:D + { pdf:usexobj~@image \int_use:c { c__image_ #2#1 _int } } + } + { \@@_image_include_auxiii:nn {#2} {#1} {#3} } + } +\cs_generate_variant:Nn \@@_image_include_auxii:nnn { x } +\cs_new_protected:Npn \@@_image_include_auxiii:nnn #1#2#3 + { + \int_gincr:N \g_@@_image_int + \int_const:cn { c__image_ #1#2 _int } { \g_@@_image_int } + \tex_special:D + { + pdf:#3~ + @image \int_use:c { c__image_ #1#2 _int } + \int_compare:nNnT \l__image_page_int > 0 + { page ~ \int_use:N \l__image_page_int \c_space_tl } + (#1) + \bool_if:NT \l__image_interpolate_bool + { <</Interpolate~true>> } + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macrocode} %</dvipdfmx|xdvipdfmx> % \end{macrocode} @@ -844,21 +1047,29 @@ % % \begin{macro}[int]{\@@_color_ensure_current:} % \begin{macro}[aux]{\@@_color_reset:} -% The \LaTeXe{} driver uses \texttt{dvips}-like specials so there has to -% be a change of set up if \pkg{color} is loaded. +% Older \LaTeXe{} drivers uses \texttt{dvips}-like specials so there has to +% be a change of set up if \pkg{color} is loaded and if the current color +% doesn't match the pattern expected for |dvipdfmx|. % \begin{macrocode} %<*package> \AtBeginDocument { \@ifpackageloaded { color } { - \cs_set_protected:Npn \@@_color_ensure_current: + \cs_set_protected:Npn \@@_tmp:w #1 [ #2 ] #3 \q_stop { - \tex_special:D { color~push~\l_@@_current_color_tl } - \group_insert_after:N \@@_color_reset: + \tl_if_empty:nT {#2} + { + \cs_set_protected:Npn \@@_color_ensure_current: + { + \tex_special:D { color~push~\l_@@_color_current_tl } + \group_insert_after:N \@@_color_reset: + } + \cs_set_protected:Npn \@@_color_reset: + { \tex_special:D { color~pop } } + } } - \cs_set_protected:Npn \@@_color_reset: - { \tex_special:D { color~pop } } + \exp_after:wN \@@_tmp:w \current@color [ ] \q_stop } { } } @@ -867,6 +1078,58 @@ % \end{macro} % \end{macro} % +% \subsection{Images} +% +% \begin{macro}[int] +% {\@@_image_getbb_jpg:n, \@@_image_getbb_pdf:n, \@@_image_getbb_png:n} +% \begin{macro}[aux]{\@@_image_getbb_auxi:nN} +% \begin{macro}[aux]{\@@_image_getbb_auxii:nnN, \@@_image_getbb_auxii:VnN} +% \begin{macro}[aux]{\@@_image_getbb_auxiii:nNnn} +% For \texttt{xdvipdfmx}, there are two primitives that allow us to obtain +% the bounding box without needing \texttt{extractbb}. +% \begin{macrocode} +\cs_new_protected:Npn \@@_image_getbb_jpg:n #1 + { + \int_zero:N \l__image_page_int + \@@_image_getbb_auxi:nN {#1} \xetex_picfile:D + } +\cs_new_eq:NN \@@_image_getbb_png:n \@@_image_getbb_jpg:n +\cs_new_protected:Npn \@@_image_getbb_pdf:n #1 + { \@@_image_getbb_auxi:nN {#1} \xetex_pdffile:D } +\cs_new_protected:Npn \@@_image_getbb_auxi:nN #1#2 + { + \int_compare:nNnTF \l__image_page_int > 0 + { \@@_image_getbb_auxii:VnN \l__image_page_int {#1} #2 } + { \@@_image_getbb_auxiii:nNnn {#1} #2 } + } +\cs_new_protected:Npn \@@_image_getbb_auxii:nnN #1#2#3 + { \@@_image_getbb_auxiii:nNnn {#2} #3 { :P #1 } { page #1 } } +\cs_generate_variant:Nn \@@_image_getbb_auxii:nnN { V } +\cs_new_protected:Npn \@@_image_getbb_auxiii:nNnn #1#2#3#4 + { + \dim_if_exist:cTF { c__image_ #1#3 _ht_dim } + { + \dim_set_eq:Nc \l__image_ht_dim { c__image_ #1#3 _ht_dim } + \dim_set_eq:Nc \l__image_wd_dim { c__image_ #1#3 _wd_dim } + } + { \@@_image_getbb_auxvi:nNnn {#1} #2 {#3} {#4} } + } +\cs_new_protected:Npn \@@_image_getbb_auxvi:nNnn #1#2#3#4 + { + \hbox_set:Nn \l__image_tmp_box { #2 #1 ~ #4 } + \dim_set:Nn \l__image_ht_dim { \box_ht:N \l__image_tmp_box } + \dim_set:Nn \l__image_wd_dim { \box_wd:N \l__image_tmp_box } + \dim_const:cn { c__image_ #1#3 _ht_dim } + { \l__image_ht_dim } + \dim_const:cn { c__image_ #1#3 _wd_dim } + { \l__image_wd_dim } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macrocode} %</xdvipdfmx> % \end{macrocode} @@ -874,7 +1137,7 @@ % \subsection{Drawing commands: \texttt{pdfmode} and \texttt{(x)dvipdfmx}} % % Both \texttt{pdfmode} and \texttt{(x)dvipdfmx} directly produce PDF output -% and undertand a shared set of specials for drawing commands. +% and understand a shared set of specials for drawing commands. % % \begin{macrocode} %<*dvipdfmx|pdfmode|xdvipdfmx> @@ -954,7 +1217,7 @@ % \end{macro} % % \begin{macro}[int]{\@@_draw_evenodd_rule:, \@@_draw_nonzero_rule:} -% \begin{variable}[aux]{\g_@@_draw_eor_bool} +% \begin{variable}[int]{\g_@@_draw_eor_bool} % The even-odd rule here can be implemented as a simply switch. % \begin{macrocode} \cs_new_protected:Npn \@@_draw_evenodd_rule: @@ -1341,16 +1604,16 @@ % % \subsubsection{Color} % -% \begin{variable}{\l_@@_current_color_tl} +% \begin{variable}{\l_@@_color_current_tl} % The current color in driver-dependent format. % \begin{macrocode} -\tl_new:N \l_@@_current_color_tl -\tl_set:Nn \l_@@_current_color_tl { gray~0 } +\tl_new:N \l_@@_color_current_tl +\tl_set:Nn \l_@@_color_current_tl { gray~0 } %<*package> \AtBeginDocument { \@ifpackageloaded { color } - { \tl_set:Nn \l_@@_current_color_tl { \current@color } } + { \tl_set:Nn \l_@@_color_current_tl { \current@color } } { } } %</package> @@ -1363,7 +1626,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_color_ensure_current: { - \tex_special:D { color~push~\l_@@_current_color_tl } + \tex_special:D { color~push~\l_@@_color_current_tl } \group_insert_after:N \@@_color_reset: } \cs_new_protected:Npn \@@_color_reset: @@ -1372,6 +1635,26 @@ % \end{macro} % \end{macro} % +% \subsection{Images} +% +% \begin{macro}[int]{\@@_image_getbb_eps:n} +% Simply use the generic function. +% \begin{macrocode} +\cs_new_eq:NN \@@_image_getbb_eps:n \__image_read_bb:n +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@@_image_include_eps:n} +% The special syntax is relatively clear here: remember we need PostScript +% sizes here. +% \begin{macrocode} +\cs_new_protected:Npn \@@_image_include_eps:n #1 + { + \tex_special:D { PSfile = #1 } + } +% \end{macrocode} +% \end{macro} +% % \subsection{Drawing} % % \begin{macro}[aux]{\@@_draw_literal:n, \@@_draw_literal:x} @@ -1972,17 +2255,17 @@ % % \subsubsection{Color} % -% \begin{variable}{\l_@@_current_color_tl} +% \begin{variable}{\l_@@_color_current_tl} % The current color in driver-dependent format: the same as for % \texttt{dvips}. % \begin{macrocode} -\tl_new:N \l_@@_current_color_tl -\tl_set:Nn \l_@@_current_color_tl { gray~0 } +\tl_new:N \l_@@_color_current_tl +\tl_set:Nn \l_@@_color_current_tl { gray~0 } %<*package> \AtBeginDocument { \@ifpackageloaded { color } - { \tl_set:Nn \l_@@_current_color_tl { \current@color } } + { \tl_set:Nn \l_@@_color_current_tl { \current@color } } { } } %</package> @@ -1995,7 +2278,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_color_ensure_current: { - \tex_special:D { color~push~\l_@@_current_color_tl } + \tex_special:D { color~push~\l_@@_color_current_tl } \group_insert_after:N \@@_color_reset: } \cs_new_protected:Npn \@@_color_reset: diff --git a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx index 6908c0bc050..ae03bfb7cb8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index 12ffc79a8c5..a3ceb04d1cf 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -232,28 +232,34 @@ % and right braces are found) from the input \meta{stream} and stores % the result locally in the \meta{token list} variable. If the % \meta{stream} is not open, input is requested from the terminal. -% The material read from the \meta{stream} will be tokenized by -% \TeX{} according to the category codes in force when the function -% is used. Note that any blank lines will be converted to the token -% \cs{par}. Therefore, if skipping blank lines is requires a test such as +% The material read from the \meta{stream} will be tokenized by \TeX{} +% according to the category codes and \tn{endlinechar} in force when +% the function is used. Assuming normal settings, any lines which do +% not end in a comment character~|%| will have the line ending +% converted to a space, so for example input +% \begin{verbatim} +% a b c +% \end{verbatim} +% will result in a token list \verb*|a b c |. Any blank line is +% converted to the token \cs{par}. Therefore, blank lines can be +% skipped by using a test such as % \begin{verbatim} % \ior_get:NN \l_my_stream \l_tmpa_tl % \tl_set:Nn \l_tmpb_tl { \par } % \tl_if_eq:NNF \l_tmpa_tl \l_tmpb_tl % ... % \end{verbatim} -% may be used. Also notice that if multiple lines are read to match braces -% then the resulting token list will contain \cs{par} tokens. As normal -% \TeX{} tokenization is in force, any lines which do not end in a comment -% character (usually |%|) will have the line ending converted to a space, -% so for example input -% \begin{verbatim} -% a b c -% \end{verbatim} -% will result in a token list |a b c |. +% Also notice that if multiple lines are read to match braces +% then the resulting token list can contain \cs{par} tokens. % \begin{texnote} -% This protected macro expands to the \TeX{} primitive \tn{read} -% along with the |to| keyword. +% This protected macro is a wrapper around the \TeX{} primitive +% \tn{read}. Regardless of settings, \TeX{} replaces trailing space +% and tab characters (character codes 32 and~9) in each line by an +% end-of-line character (character code \tn{endlinechar}, omitted if +% \tn{endlinechar} is negative or too large) before turning +% characters into tokens according to current category codes. With +% default settings, spaces appearing at the beginning of lines are +% also ignored. % \end{texnote} % \end{function} % @@ -279,9 +285,91 @@ % having category code~12. % \begin{texnote} % This protected macro is a wrapper around the \eTeX{} primitive -% \tn{readline}. However, the end-line character normally added by -% this primitive is not included in the result of -% \cs{ior_str_get:NN}. +% \tn{readline}. Regardless of settings, \TeX{} removes trailing +% space and tab characters (character codes 32 and~9). However, the +% end-line character normally added by this primitive is not +% included in the result of \cs{ior_str_get:NN}. +% \end{texnote} +% \end{function} +% +% \begin{function}[added = 2012-02-11]{\ior_map_inline:Nn} +% \begin{syntax} +% \cs{ior_map_inline:Nn} \meta{stream} \Arg{inline function} +% \end{syntax} +% Applies the \meta{inline function} to each set of \meta{lines} +% obtained by calling \cs{ior_get:NN} until reaching the end of the +% file. \TeX{} ignores any trailing new-line marker from the file it +% reads. The \meta{inline function} should consist of code which will +% receive the \meta{line} as |#1|. +% \end{function} +% +% \begin{function}[added = 2012-02-11]{\ior_str_map_inline:Nn} +% \begin{syntax} +% \cs{ior_str_map_inline:Nn} \Arg{stream} \Arg{inline function} +% \end{syntax} +% Applies the \meta{inline function} to every \meta{line} +% in the \meta{stream}. The material is read from the \meta{stream} +% as a series of tokens with category code $12$ (other), with the +% exception of space characters which are given category code $10$ +% (space). The \meta{inline function} should consist of code which +% will receive the \meta{line} as |#1|. +% Note that \TeX{} removes trailing space and tab characters +% (character codes 32 and 9) from every line upon input. \TeX{} also +% ignores any trailing new-line marker from the file it reads. +% \end{function} +% +% \begin{function}[added = 2012-06-29]{\ior_map_break:} +% \begin{syntax} +% \cs{ior_map_break:} +% \end{syntax} +% Used to terminate a \cs[no-index]{ior_map_\ldots} function before all +% lines from the \meta{stream} have been processed. This will +% normally take place within a conditional statement, for example +% \begin{verbatim} +% \ior_map_inline:Nn \l_my_ior +% { +% \str_if_eq:nnTF { #1 } { bingo } +% { \ior_map_break: } +% { +% % Do something useful +% } +% } +% \end{verbatim} +% Use outside of a \cs[no-index]{ior_map_\ldots} scenario will lead to low +% level \TeX{} errors. +% \begin{texnote} +% When the mapping is broken, additional tokens may be inserted by the +% internal macro \cs{__prg_break_point:Nn} before further items are taken +% from the input stream. This will depend on the design of the mapping +% function. +% \end{texnote} +% \end{function} +% +% \begin{function}[added = 2012-06-29]{\ior_map_break:n} +% \begin{syntax} +% \cs{ior_map_break:n} \Arg{tokens} +% \end{syntax} +% Used to terminate a \cs[no-index]{ior_map_\ldots} function before all +% lines in the \meta{stream} have been processed, inserting +% the \meta{tokens} after the mapping has ended. This will +% normally take place within a conditional statement, for example +% \begin{verbatim} +% \ior_map_inline:Nn \l_my_ior +% { +% \str_if_eq:nnTF { #1 } { bingo } +% { \ior_map_break:n { <tokens> } } +% { +% % Do something useful +% } +% } +% \end{verbatim} +% Use outside of a \cs[no-index]{ior_map_\ldots} scenario will lead to low +% level \TeX{} errors. +% \begin{texnote} +% When the mapping is broken, additional tokens may be inserted by the +% internal macro \cs{__prg_break_point:Nn} before the \meta{tokens} are +% inserted into the input stream. +% This will depend on the design of the mapping function. % \end{texnote} % \end{function} % @@ -1183,6 +1271,61 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[EXP]{\ior_map_break:, \ior_map_break:n} +% Usual map breaking functions. +% \begin{macrocode} +\cs_new:Npn \ior_map_break: + { \__prg_map_break:Nn \ior_map_break: { } } +\cs_new:Npn \ior_map_break:n + { \__prg_map_break:Nn \ior_map_break: } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ior_map_inline:Nn, \ior_str_map_inline:Nn} +% \begin{macro}[aux]{\@@_map_inline:NNn} +% \begin{macro}[aux]{\@@_map_inline:NNNn} +% \begin{macro}[aux]{\@@_map_inline_loop:NNN} +% \begin{variable}{\l_@@_internal_tl} +% Mapping to an input stream can be done on either a token or a string +% basis, hence the set up. Within that, there is a check to avoid reading +% past the end of a file, hence the two applications of \cs{ior_if_eof:N}. +% This mapping cannot be nested with twice the same stream, as the +% stream has only one \enquote{current line}. +% \begin{macrocode} +\cs_new_protected:Npn \ior_map_inline:Nn + { \@@_map_inline:NNn \ior_get:NN } +\cs_new_protected:Npn \ior_str_map_inline:Nn + { \@@_map_inline:NNn \ior_str_get:NN } +\cs_new_protected:Npn \@@_map_inline:NNn + { + \int_gincr:N \g__prg_map_int + \exp_args:Nc \@@_map_inline:NNNn + { __prg_map_ \int_use:N \g__prg_map_int :n } + } +\cs_new_protected:Npn \@@_map_inline:NNNn #1#2#3#4 + { + \cs_gset_protected:Npn #1 ##1 {#4} + \ior_if_eof:NF #3 { \@@_map_inline_loop:NNN #1#2#3 } + \__prg_break_point:Nn \ior_map_break: + { \int_gdecr:N \g__prg_map_int } + } +\cs_new_protected:Npn \@@_map_inline_loop:NNN #1#2#3 + { + #2 #3 \l_@@_internal_tl + \ior_if_eof:NF #3 + { + \exp_args:No #1 \l_@@_internal_tl + \@@_map_inline_loop:NNN #1#2#3 + } + } +\tl_new:N \l_@@_internal_tl +% \end{macrocode} +% \end{variable} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{variable}{\g__file_internal_ior} % Needed by the higher-level code, but cannot be created until here. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx index 2c25386e920..d49b33d33da 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx index 658acbd3518..8c12450f32a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3format.ins b/Master/texmf-dist/source/latex/l3kernel/l3format.ins index 14d71ea4463..ec089835e9d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3format.ins +++ b/Master/texmf-dist/source/latex/l3kernel/l3format.ins @@ -67,6 +67,7 @@ and all files in that bundle must be distributed together. \from{l3alloc.dtx} {initex} % ============================== \from{l3int.dtx} {initex} + \from{l3intarray.dtx} {initex} \from{l3flag.dtx} {initex} \from{l3quark.dtx} {initex} \from{l3prg.dtx} {initex} @@ -91,6 +92,9 @@ and all files in that bundle must be distributed together. \from{l3fp-random.dtx} {initex} \from{l3fp-assign.dtx} {initex} \from{l3sort.dtx} {initex} + \from{l3tl-build.dtx} {initex} + \from{l3tl-analysis.dtx}{initex} + \from{l3regex.dtx} {initex} \from{l3box.dtx} {initex} \from{l3coffins.dtx} {initex} \from{l3color.dtx} {initex} @@ -117,12 +121,17 @@ and all files in that bundle must be distributed together. \def\MetaPrefix{--} \preamble -EXPERIMENTAL CODE +Copyright (C) 1990-2017 The LaTeX3 Project -Do not distribute this file without also distributing the -source files specified above. +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: -Do not distribute a modified version of this file. + http://www.latex-project.org/lppl.txt + +This file is part of the "l3kernel bundle" (The Work in LPPL) +and all files in that bundle must be distributed together. \endpreamble \nopostamble diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx index 02a22405d25..af396801a00 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % \maketitle % % \begin{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx index 4d7ccd55a90..58c67b9cf57 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx index cd8a2822cec..8a8e233edc5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx index 463892caee7..ae0c958d999 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx index 2cf6e06b8d5..521bdae30e6 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx index de04c7cf796..286d320973c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx index c51dd6069f7..ff54b840a59 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx index 83dca37310c..b0abdd5abac 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx index d78c7c5e2de..ebe0d53cb5c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx index dfc00ce2999..8b88920c57e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx index b11c8532a12..9a3a94ffc53 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % \maketitle % % \begin{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx index 9ff46ddee9a..d5c48436db4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index 380dd7f3641..6eb6e2b68e1 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index 7ea2be4fed0..d5b6eb60ace 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3intarray.dtx b/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx index 0327082bf18..e64ee21f1bb 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3intarray.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx @@ -9,7 +9,7 @@ % % http://www.latex-project.org/lppl.txt % -% This file is part of the "l3experimental bundle" (The Work in LPPL) +% This file is part of the "l3kernel bundle" (The Work in LPPL) % and all files in that bundle must be distributed together. % % ----------------------------------------------------------------------- @@ -20,26 +20,8 @@ % % for those people who are interested. % -%<*driver|package> -% The version of expl3 required is tested as early as possible, as -% some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/05/13] -%<package>\@ifpackagelater{expl3}{2017/05/13} -%<package> {} -%<package> {% -%<package> \PackageError{l3intarray}{Support package l3kernel too old} -%<package> {% -%<package> Please install an up to date version of l3kernel\MessageBreak -%<package> using your TeX package manager or from CTAN.\MessageBreak -%<package> \MessageBreak -%<package> Loading l3intarray will abort!% -%<package> }% -%<package> \endinput -%<package> } -%</driver|package> %<*driver> \documentclass[full]{l3doc} -\usepackage{amsmath} \begin{document} \DocInput{\jobname.dtx} \end{document} @@ -60,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -142,11 +124,6 @@ %<@@=intarray> % \end{macrocode} % -% \begin{macrocode} -\ProvidesExplPackage{l3intarray}{2017/05/13}{} - {L3 Experimental low-level arrays of small integers} -% \end{macrocode} -% % \subsection{Allocating arrays} % % \begin{variable}{\g_@@_font_int} @@ -207,7 +184,7 @@ \int_compare:nTF { - \c_max_dim <= \int_abs:n {#3} <= \c_max_dim } { \@@_gset_fast:Nnn #1 {#2} {#3} } { - \__msg_kernel_error:nnxxxx { intarray } { overflow } + \__msg_kernel_error:nnxxxx { kernel } { overflow } { \token_to_str:N #1 } {#2} {#3} { \int_compare:nNnT {#3} < 0 { - } \__int_value:w \c_max_dim } \@@_gset_fast:Nnn #1 {#2} @@ -215,7 +192,7 @@ } } { - \__msg_kernel_error:nnxxx { intarray } { out-of-bounds } + \__msg_kernel_error:nnxxx { kernel } { out-of-bounds } { \token_to_str:N #1 } {#2} { \@@_count:N #1 } } } @@ -236,7 +213,7 @@ \int_compare:nTF { 1 <= #2 <= \@@_count:N #1 } { \@@_item_fast:Nn #1 {#2} } { - \__msg_kernel_expandable_error:nnnnn { intarray } { out-of-bounds } + \__msg_kernel_expandable_error:nnnnn { kernel } { out-of-bounds } { \token_to_str:N #1 } {#2} { \@@_count:N #1 } 0 } @@ -245,23 +222,6 @@ % \end{macro} % \end{macro} % -% \subsection{Messages} -% -% \begin{macrocode} -\__msg_kernel_new:nnnn { intarray } { overflow } - { Integers~larger~than~2^{30}-1~cannot~be~stored~in~arrays. } - { - An~attempt~was~made~to~store~#3~at~position~#2~in~the~array~'#1'.~ - The~largest~allowed~value~#4~will~be~used~instead. - } -\__msg_kernel_new:nnnn { intarray } { out-of-bounds } - { Access~to~an~entry~beyond~an~array's~bounds. } - { - An~attempt~was~made~to~access~or~store~data~at~position~#2~of~the~ - array~'#1',~but~this~array~has~entries~at~positions~from~1~to~#3. - } -% \end{macrocode} -% % \begin{macrocode} %</initex|package> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index 13c088c2785..2b1deb80434 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -656,7 +656,7 @@ % } % \end{verbatim} % -% \begin{function}[added = 2011-08-23, updated = 2015-11-07] +% \begin{function}[added = 2011-08-23, updated = 2017-05-27] % { % \keys_set_known:nnN, \keys_set_known:nVN, % \keys_set_known:nvN, \keys_set_known:noN, @@ -720,7 +720,7 @@ % groups to be made \enquote{active}, or by marking one or more groups to % be ignored in key setting. % -% \begin{function}[added = 2013-07-14, updated = 2015-11-07] +% \begin{function}[added = 2013-07-14, updated = 2017-05-27] % { % \keys_set_filter:nnnN, \keys_set_filter:nnVN, % \keys_set_filter:nnvN, \keys_set_filter:nnoN, @@ -742,7 +742,7 @@ % \meta{keyval list} returned at each stage. % \end{function} % -% \begin{function}[added = 2013-07-14, updated = 2015-11-07] +% \begin{function}[added = 2013-07-14, updated = 2017-05-27] % { % \keys_set_groups:nnn, \keys_set_groups:nnV, % \keys_set_groups:nnv, \keys_set_groups:nno @@ -2022,6 +2022,7 @@ % \keys_set_known:nn, \keys_set_known:nV, % \keys_set_known:nv, \keys_set_known:no % } +% \begin{macro}[aux]{\@@_keys_set_known:nn} % Setting known keys simply means setting the appropriate flag, then % running the standard code. To allow for nested setting, any existing % value of \cs{l_@@_unused_clist} is saved on the stack and reset @@ -2041,15 +2042,23 @@ \cs_generate_variant:Nn \@@_set_known:nnnN { o } \cs_new_protected:Npn \keys_set_known:nn #1#2 { + \bool_if:NTF \l_@@_only_known_bool + { \keys_set:nn } + { \@@_set_known:nn } + {#1} {#2} + } +\cs_generate_variant:Nn \keys_set_known:nn { nV , nv , no } +\cs_new_protected:Npn \@@_set_known:nn #1#2 + { \bool_set_true:N \l_@@_only_known_bool \keys_set:nn {#1} {#2} \bool_set_false:N \l_@@_only_known_bool } -\cs_generate_variant:Nn \keys_set_known:nn { nV , nv , no } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro} % { @@ -2062,14 +2071,20 @@ % \keys_set_filter:nnn, \keys_set_filter:nnV, \keys_set_filter:nnv, % \keys_set_filter:nno % } +% \begin{macro}[aux]{\@@_set_filter:nnn} % \begin{macro} % { % \keys_set_groups:nnn, \keys_set_groups:nnV, \keys_set_groups:nnv, % \keys_set_groups:nno % } +% \begin{macro}[aux]{\@@_set_groups:nnn} +% \begin{macro}[aux]{\@@_set_selective:nnn} +% \begin{macro}[aux]{\@@_set_selective:nnnn, \@@_set_selective:onnn} +% \begin{macro}[aux]{\@@_set_selective:nn} % The idea of setting keys in a selective manner again uses flags % wrapped around the basic code. The comments on \cs{keys_set_known:nnN} -% also apply here. +% also apply here. We have a bit more shuffling to do to keep everything +% nestable. % \begin{macrocode} \cs_new_protected:Npn \keys_set_filter:nnnN { \@@_set_filter:onnnN \l_@@_unused_clist } @@ -2084,27 +2099,60 @@ \cs_generate_variant:Nn \@@_set_filter:nnnnN { o } \cs_new_protected:Npn \keys_set_filter:nnn #1#2#3 { - \bool_set_true:N \l_@@_selective_bool - \bool_set_true:N \l_@@_filtered_bool - \seq_set_from_clist:Nn \l_@@_selective_seq {#2} - \keys_set:nn {#1} {#3} - \bool_set_false:N \l_@@_selective_bool + \bool_if:NTF \l_@@_filtered_bool + { \@@_set_selective:nnn } + { \@@_set_filter:nnn } + {#1} {#2} {#3} } \cs_generate_variant:Nn \keys_set_filter:nnn { nnV , nnv , nno } +\cs_new_protected:Npn \@@_set_filter:nnn #1#2#3 + { + \bool_set_true:N \l_@@_filtered_bool + \@@_set_selective:nnn {#1} {#2} {#3} + \bool_set_false:N \l_@@_filtered_bool + } \cs_new_protected:Npn \keys_set_groups:nnn #1#2#3 { - \bool_set_true:N \l_@@_selective_bool + \bool_if:NTF \l_@@_filtered_bool + { \@@_set_groups:nnn } + { \@@_set_selective:nnn } + {#1} {#2} {#3} + } +\cs_generate_variant:Nn \keys_set_groups:nnn { nnV , nnv , nno } +\cs_new_protected:Npn \@@_set_groups:nnn #1#2#3 + { \bool_set_false:N \l_@@_filtered_bool - \seq_set_from_clist:Nn \l_@@_selective_seq {#2} - \keys_set:nn {#1} {#3} + \@@_set_selective:nnn {#1} {#2} {#3} + \bool_set_true:N \l_@@_filtered_bool + } +\cs_new_protected:Npn \@@_set_selective:nnn + { \@@_set_selective:onnn \l_@@_selective_seq } +\cs_new_protected:Npn \@@_set_selective:nnnn #1#2#3#4 + { + \seq_set_from_clist:Nn \l_@@_selective_seq {#3} + \bool_if:NTF \l_@@_selective_bool + { \keys_set:nn } + { \@@_set_selective:nn } + {#2} {#4} + \tl_set:Nn \l_@@_selective_seq {#1} + } +\cs_generate_variant:Nn \@@_set_selective:nnnn { o } +\cs_new_protected:Npn \@@_set_selective:nn #1#2 + { + \bool_set_true:N \l_@@_selective_bool + \keys_set:nn {#1} {#2} \bool_set_false:N \l_@@_selective_bool } -\cs_generate_variant:Nn \keys_set_groups:nnn { nnV , nnv , nno } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}[int]{\@@_set:n, \@@_set:nn} % \begin{macro}[aux]{\@@_set_aux:nnn, \@@_set_aux:onn} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx index 9fd49d2acd4..b83cc86cde1 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -186,7 +186,7 @@ } } \clist_map_inline:nn - { \lua_shipout_x :n , \lua_shipout:n } + { \lua_shipout_x:n , \lua_shipout:n } { \cs_set_protected:Npn #1 ##1 { diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index 466da628f8a..8e6a6525406 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -1902,6 +1902,18 @@ needed~when~defining~conditionals~or~variants,~or~when~building~a~ parameter~text~from~the~number~of~arguments~of~the~function. } +\@@_kernel_new:nnnn { kernel } { overflow } + { Integers~larger~than~2^{30}-1~cannot~be~stored~in~arrays. } + { + An~attempt~was~made~to~store~#3~at~position~#2~in~the~array~'#1'.~ + The~largest~allowed~value~#4~will~be~used~instead. + } +\@@_kernel_new:nnnn { kernel } { out-of-bounds } + { Access~to~an~entry~beyond~an~array's~bounds. } + { + An~attempt~was~made~to~access~or~store~data~at~position~#2~of~the~ + array~'#1',~but~this~array~has~entries~at~positions~from~1~to~#3. + } \@@_kernel_new:nnnn { kernel } { protected-predicate } { Predicate~'#1'~must~be~expandable. } { diff --git a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx index d46b5c9fbf6..805700f73c8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx b/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx index b52cec077c2..a8750f614c2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx @@ -42,7 +42,7 @@ % } % % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -103,11 +103,13 @@ %<l3prg>{l3prg} %<l3prop>{l3prop} %<l3quark>{l3quark} +%<l3regex>{l3regex} %<l3seq>{l3seq} %<l3skip>{l3skip} %<l3sort>{l3sort} %<l3str>{l3str} %<l3tl>{l3tl} +%<l3tl-analysis>{l3tl-analysis} %<l3token>{l3token} % \end{macrocode} % @@ -127,20 +129,20 @@ \typeout{** } \typeout{** Its functionality is now only provided as part of the expl3 package.} \typeout{** } -%<!l3sort>\typeout{** After showing you an error message you can hit <return> we will continue} -%<!l3sort>\typeout{** for now by loading expl3 for you. However, the old packages will be} -%<!l3sort>\typeout{** removed entirely at the end of 2017.} -%<l3sort>\typeout{** The old packages will be removed entirely at the end of 2018.} +%<!l3regex|l3sort|l3tl-analysis>\typeout{** After showing you an error message you can hit <return> we will continue} +%<!l3regex|l3sort|l3tl-analysis>\typeout{** for now by loading expl3 for you. However, the old packages will be} +%<!l3regex|l3sort|l3tl-analysis>\typeout{** removed entirely at the end of 2017.} +%<l3regex|l3sort|l3tl-analysis>\typeout{** The old packages will be removed entirely at the end of 2018.} \typeout{** } \typeout{** Therefore, please replace '\string\usepackage{\old@liii@module@name}'} \typeout{** with '\string\usepackage{expl3}' in your documents as soon as possible.} \typeout{** } \typeout{*******************************************************************} -%<!l3sort>\PackageError -%<l3sort>\PackageWarning +%<!l3regex|l3sort|l3tl-analysis>\PackageError +%<l3regex|l3sort|l3tl-analysis>\PackageWarning \old@liii@module@name{This package is obsolete --- use 'expl3' instead} -%<!l3sort> \@ehc +%<!l3regex|l3sort|l3tl-analysis> \@ehc % \end{macrocode} % Finally load \texttt{expl3} so that the user can continue for now. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index 055fab38e6b..b74c712d0a4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx index b30ad2e1278..5545dbec4b0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx index 6cfbf18f043..86be080ee8a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx index ddfbc79de23..fd57d6736cb 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx @@ -9,7 +9,7 @@ % % http://www.latex-project.org/lppl.txt % -% This file is part of the "l3experimental bundle" (The Work in LPPL) +% This file is part of the "l3kernel bundle" (The Work in LPPL) % and all files in that bundle must be distributed together. % % ----------------------------------------------------------------------- @@ -20,26 +20,8 @@ % % for those people who are interested. % -%<*driver|package> -% The version of expl3 required is tested as early as possible, as -% some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/05/13] -%<package>\@ifpackagelater{expl3}{2017/05/13} -%<package> {} -%<package> {% -%<package> \PackageError{l3regex}{Support package l3kernel too old} -%<package> {% -%<package> Please install an up to date version of l3kernel\MessageBreak -%<package> using your TeX package manager or from CTAN.\MessageBreak -%<package> \MessageBreak -%<package> Loading l3regex will abort!% -%<package> }% -%<package> \endinput -%<package> } -%</driver|package> %<*driver> \documentclass[full]{l3doc} -\usepackage{amsmath} \begin{document} \DocInput{\jobname.dtx} \end{document} @@ -59,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -68,7 +50,7 @@ % {\begin{itemize}\def\\{\char`\\}\def\makelabel##1{\hss\llap{\ttfamily##1}}} % {\end{itemize}} % -% \section{\pkg{l3regex} documentation} +% \section{Regular expressions} % % The \pkg{l3regex} package provides regular expression testing, % extraction of submatches, splitting, and replacement, all acting @@ -427,7 +409,7 @@ % regular expression argument either as an explicit string % or as a compiled regular expression. % -% \begin{function}{\regex_new:N} +% \begin{function}[added = 2017-05-26]{\regex_new:N} % \begin{syntax} % \cs{regex_new:N} \meta{regex~var} % \end{syntax} @@ -436,7 +418,8 @@ % \meta{regex~var} will initially be such that it never matches. % \end{function} % -% \begin{function}{\regex_set:Nn, \regex_gset:Nn, \regex_const:Nn} +% \begin{function}[added = 2017-05-26] +% {\regex_set:Nn, \regex_gset:Nn, \regex_const:Nn} % \begin{syntax} % \cs{regex_set:Nn} \meta{regex~var} \Arg{regex} % \end{syntax} @@ -452,7 +435,7 @@ % which will never change. % \end{function} % -% \begin{function}{\regex_show:n, \regex_show:N} +% \begin{function}[added = 2017-05-26]{\regex_show:n, \regex_show:N} % \begin{syntax} % \cs{regex_show:n} \Arg{regex} % \end{syntax} @@ -476,7 +459,7 @@ % while the later require a compiled expression as generated by % \cs{regex_(g)set:Nn}. % -% \begin{function}[TF]{\regex_match:nn, \regex_match:Nn} +% \begin{function}[TF, added = 2017-05-26]{\regex_match:nn, \regex_match:Nn} % \begin{syntax} % \cs{regex_match:nnTF} \Arg{regex} \Arg{token list} \Arg{true code} \Arg{false code} % \end{syntax} @@ -489,7 +472,7 @@ % leaves \texttt{TRUE} then \texttt{FALSE} in the input stream. % \end{function} % -% \begin{function}{\regex_count:nnN, \regex_count:NnN} +% \begin{function}[added = 2017-05-26]{\regex_count:nnN, \regex_count:NnN} % \begin{syntax} % \cs{regex_count:nnN} \Arg{regex} \Arg{token list} \meta{int var} % \end{syntax} @@ -513,7 +496,8 @@ % % \subsection{Submatch extraction} % -% \begin{function}[TF]{\regex_extract_once:nnN, \regex_extract_once:NnN} +% \begin{function}[TF, added = 2017-05-26] +% {\regex_extract_once:nnN, \regex_extract_once:NnN} % \begin{syntax} % \cs{regex_extract_once:nnN} \Arg{regex} \Arg{token list} \meta{seq~var} % \cs{regex_extract_once:nnNTF} \Arg{regex} \Arg{token list} \meta{seq~var} \Arg{true code} \Arg{false code} @@ -540,7 +524,8 @@ % branch is left in the input stream. % \end{function} % -% \begin{function}[TF]{\regex_extract_all:nnN, \regex_extract_all:NnN} +% \begin{function}[TF, added = 2017-05-26] +% {\regex_extract_all:nnN, \regex_extract_all:NnN} % \begin{syntax} % \cs{regex_extract_all:nnN} \Arg{regex} \Arg{token list} \meta{seq~var} % \cs{regex_extract_all:nnNTF} \Arg{regex} \Arg{token list} \meta{seq~var} \Arg{true code} \Arg{false code} @@ -563,7 +548,7 @@ % and the \texttt{true} branch is left in the input stream. % \end{function} % -% \begin{function}[TF]{\regex_split:nnN, \regex_split:NnN} +% \begin{function}[TF, added = 2017-05-26]{\regex_split:nnN, \regex_split:NnN} % \begin{syntax} % \cs{regex_split:nnN} \Arg{regular expression} \Arg{token list} \meta{seq~var} % \cs{regex_split:nnNTF} \Arg{regular expression} \Arg{token list} \meta{seq~var} \Arg{true code} \Arg{false code} @@ -591,7 +576,8 @@ % % \subsection{Replacement} % -% \begin{function}[TF]{\regex_replace_once:nnN,\regex_replace_once:NnN} +% \begin{function}[TF, added = 2017-05-26] +% {\regex_replace_once:nnN,\regex_replace_once:NnN} % \begin{syntax} % \cs{regex_replace_once:nnN} \Arg{regular expression} \Arg{replacement} \meta{tl~var} % \cs{regex_replace_once:nnNTF} \Arg{regular expression} \Arg{replacement} \meta{tl~var} \Arg{true code} \Arg{false code} @@ -603,7 +589,8 @@ % first capturing group, |\2| of the second, \emph{etc.} % \end{function} % -% \begin{function}[TF]{\regex_replace_all:nnN, \regex_replace_all:NnN} +% \begin{function}[TF, added = 2017-05-26] +% {\regex_replace_all:nnN, \regex_replace_all:NnN} % \begin{syntax} % \cs{regex_replace_all:nnN} \Arg{regular expression} \Arg{replacement} \meta{tl~var} % \cs{regex_replace_all:nnNTF} \Arg{regular expression} \Arg{replacement} \meta{tl~var} \Arg{true code} \Arg{false code} @@ -742,14 +729,6 @@ %<@@=regex> % \end{macrocode} % -% \begin{macrocode} -%<*package> -\ProvidesExplPackage{l3regex}{2017/05/13}{} - {L3 Experimental regular expressions} -\RequirePackage{l3tl-build, l3tl-analysis, l3intarray} -%</package> -% \end{macrocode} -% % \subsection{Plan of attack} % % Most regex engines use backtracking. This allows to provide very @@ -850,13 +829,6 @@ % % \subsection{Helpers} % -% \begin{macro}[aux]{\tl_to_str:V} -% A variant we need for the |\u| escape in the replacement text. -% \begin{macrocode} -\cs_generate_variant:Nn \tl_to_str:n { V } -% \end{macrocode} -% \end{macro} -% % \begin{macro}[int]{\@@_standard_escapechar:} % Make the \tn{escapechar} into the standard backslash. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index 3681b4b4104..3af96d7ad28 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index 0fc90333ab8..e43dd6320b6 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx index 9a7e9709631..009d228859e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx index 90c2f79fc8b..3739bc8a766 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx index ba1d67bd495..c21509d6f1d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx index 5dd95a5e208..d427b756056 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3tl-analysis.dtx Copyright (C) 2011-2012,2015-2017 The LaTeX3 Project +%% File: l3tl-analysis.dtx Copyright (C) 2011-2012,2015-2017 The 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 @@ -9,7 +9,7 @@ % % http://www.latex-project.org/lppl.txt % -% This file is part of the "l3experimental bundle" (The Work in LPPL) +% This file is part of the "l3kernel bundle" (The Work in LPPL) % and all files in that bundle must be distributed together. % % ----------------------------------------------------------------------- @@ -20,12 +20,8 @@ % % for those people who are interested. % -%<*driver|package> -\RequirePackage{expl3} -%</driver|package> %<*driver> \documentclass[full]{l3doc} -\usepackage{amsmath} \begin{document} \DocInput{\jobname.dtx} \end{document} @@ -46,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -59,7 +55,7 @@ % debugging function, very similar to the \cs{ShowTokens} macro from the % \pkg{ted} package. % -% \begin{function}{\tl_show_analysis:N, \tl_show_analysis:n} +% \begin{function}[added = 2017-05-26]{\tl_show_analysis:N, \tl_show_analysis:n} % \begin{syntax} % \cs{tl_show_analysis:n} \Arg{token list} % \end{syntax} @@ -69,6 +65,12 @@ % characters, and the value of registers. % \end{function} % +% \end{documentation} +% +% \begin{implementation} +% +% \section{\pkg{l3tl-analysis} implementation} +% % \subsection{Internal functions} % % \begin{variable}{\s__tl} @@ -156,12 +158,6 @@ % ^^A todo: ask LuaTeX list for an \ifx\undefined <active char> % ^^A which does not add the <active char> in memory. % -% \end{documentation} -% -% \begin{implementation} -% -% \section{\pkg{l3tl-analysis} implementation} -% % \begin{macrocode} %<*initex|package> % \end{macrocode} @@ -170,11 +166,6 @@ %<@@=tl_analysis> % \end{macrocode} % -% \begin{macrocode} -\ProvidesExplPackage{l3tl-analysis}{2017/05/13}{} - {L3 Experimental token list analysis} -% \end{macrocode} -% % \subsection{Variables and helper functions} % % \begin{variable}{\s__tl} @@ -410,9 +401,7 @@ \tex_lowercase:D { \tex_let:D ^^@ } \tex_undefined:D \@@_disable_loop:N } - \bool_lazy_or:nnT - { \sys_if_engine_ptex_p: } - { \sys_if_engine_uptex_p: } + \cs_if_exist:NT \ptex_kanjiskip:D { \cs_gset_protected:Npn \@@_disable_loop:N #1 { diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-build.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl-build.dtx index bbdb3958613..268c8616a55 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-build.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl-build.dtx @@ -9,7 +9,7 @@ % % http://www.latex-project.org/lppl.txt % -% This file is part of the "l3experimental bundle" (The Work in LPPL) +% This file is part of the "l3kernel bundle" (The Work in LPPL) % and all files in that bundle must be distributed together. % % ----------------------------------------------------------------------- @@ -20,26 +20,8 @@ % % for those people who are interested. % -%<*driver|package> -% The version of expl3 required is tested as early as possible, as -% some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/05/13] -%<package>\@ifpackagelater{expl3}{2017/05/13} -%<package> {} -%<package> {% -%<package> \PackageError{l3tl-build}{Support package l3kernel too old} -%<package> {% -%<package> Please install an up to date version of l3kernel\MessageBreak -%<package> using your TeX package manager or from CTAN.\MessageBreak -%<package> \MessageBreak -%<package> Loading l3tl-build will abort!% -%<package> }% -%<package> \endinput -%<package> } -%</driver|package> %<*driver> \documentclass[full]{l3doc} -\usepackage{amsmath} \begin{document} \DocInput{\jobname.dtx} \end{document} @@ -60,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -149,11 +131,6 @@ %<@@=tl_build> % \end{macrocode} % -% \begin{macrocode} -\ProvidesExplPackage{l3tl-build}{2017/05/13}{} - {L3 Experimental token list construction} -% \end{macrocode} -% % \subsection{Variables and helper functions} % % \begin{variable}{\l_@@_start_index_int, \l_@@_index_int} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index d111582686f..e0124c53a60 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -605,7 +605,7 @@ % % \section{Using token lists} % -% \begin{function}[EXP]{\tl_to_str:n} +% \begin{function}[EXP]{\tl_to_str:n, \tl_to_str:V} % \begin{syntax} % \cs{tl_to_str:n} \Arg{token list} % \end{syntax} @@ -2267,8 +2267,11 @@ % % \subsection{Using token lists} % -% \begin{macro}{\tl_to_str:n} +% \begin{macro}{\tl_to_str:n, \tl_to_str:V} % Another name for a primitive: defined in \pkg{l3basics}. +% \begin{macrocode} +\cs_generate_variant:Nn \tl_to_str:n { V } +% \end{macrocode} % \end{macro} % % \begin{macro}{\tl_to_str:N, \tl_to_str:c} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index 9b74a8f8346..3d9f02a2b1c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx index 18465e22d54..fcc6c4e6dfd 100644 --- a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx +++ b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx @@ -23,8 +23,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/05/13] -%<package>\@ifpackagelater{expl3}{2017/05/13} +\RequirePackage{expl3}[2017/05/29] +%<package>\@ifpackagelater{expl3}{2017/05/29} %<package> {} %<package> {% %<package> \PackageError{l3keys2e}{Support package l3kernel too old} @@ -60,7 +60,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -131,7 +131,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{l3keys2e}{2017/05/13}{} +\ProvidesExplPackage{l3keys2e}{2017/05/29}{} {LaTeX2e option processing using LaTeX3 keys} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx b/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx index 0196c9cd775..dd3477874f9 100644 --- a/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx @@ -23,8 +23,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/05/13] -%<package>\@ifpackagelater{expl3}{2017/05/13} +\RequirePackage{expl3}[2017/05/29] +%<package>\@ifpackagelater{expl3}{2017/05/29} %<package> {} %<package> {% %<package> \PackageError{xfpu}{Support package l3kernel too old} @@ -62,7 +62,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -143,7 +143,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xfp}{2017/05/13}{} +\ProvidesExplPackage{xfp}{2017/05/29}{} {L3 Floating point unit} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx index 2556fa267bf..cfdfc5d5e9f 100644 --- a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx @@ -24,8 +24,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/05/13] -%<package>\@ifpackagelater{expl3}{2017/05/13} +\RequirePackage{expl3}[2017/05/29] +%<package>\@ifpackagelater{expl3}{2017/05/29} %<package> {} %<package> {% %<package> \PackageError{xfrac}{Support package l3kernel too old} @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -533,7 +533,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xfrac}{2017/05/13}{} +\ProvidesExplPackage{xfrac}{2017/05/29}{} {L3 Experimental split-level fractions} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx index 95e08f91fdb..98e99bfbd88 100644 --- a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx @@ -27,8 +27,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/05/13] -%<package>\@ifpackagelater{expl3}{2017/05/13} +\RequirePackage{expl3}[2017/05/29] +%<package>\@ifpackagelater{expl3}{2017/05/29} %<package> {} %<package> {% %<package> \PackageError{xparse}{Support package l3kernel too old} @@ -67,7 +67,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -776,7 +776,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xparse}{2017/05/13}{} +\ProvidesExplPackage{xparse}{2017/05/29}{} {L3 Experimental document command parser} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx index 069612e4d0d..3ceba577192 100644 --- a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx @@ -27,8 +27,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/05/13] -%<package>\@ifpackagelater{expl3}{2017/05/13} +\RequirePackage{expl3}[2017/05/29] +%<package>\@ifpackagelater{expl3}{2017/05/29} %<package> {} %<package> {% %<package> \PackageError{xtemplate}{Support package l3kernel too old} @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2017/05/13} +% \date{Released 2017/05/29} % % \maketitle % @@ -682,7 +682,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xtemplate}{2017/05/13}{} +\ProvidesExplPackage{xtemplate}{2017/05/29}{} {L3 Experimental prototype document functions} % \end{macrocode} % diff --git a/Master/texmf-dist/tex/latex/l3build/l3build.lua b/Master/texmf-dist/tex/latex/l3build/l3build.lua index da1283b6302..44a4783727d 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build.lua @@ -23,7 +23,7 @@ for those people who are interested. --]] -- Version information -release_date = "2017/05/19" +release_date = "2017/05/29" -- "module" is a deprecated function in Lua 5.2: as we want the name -- for other purposes, and it should eventually be 'free', simply @@ -468,6 +468,15 @@ if os_type == "windows" then os_yes = "for /l %I in (1,1,200) do @echo y" end +-- Return an absolute path from a relative one +function abspath(path) + local oldpwd = lfs.currentdir() + lfs.chdir(path) + local result = lfs.currentdir() + lfs.chdir(oldpwd) + return gsub(result, "\\", "/") +end + -- For cleaning out a directory, which also ensures that it exists function cleandir(dir) local errorlevel = mkdir(dir) @@ -566,15 +575,6 @@ function mkdir(dir) end end --- Return an absolute path from a relative one -function abspath(path) - local oldpwd = lfs.currentdir() - lfs.chdir(path) - local result = lfs.currentdir() - lfs.chdir(oldpwd) - return result -end - -- Rename function ren(dir, source, dest) local dir = dir .. "/" @@ -1352,7 +1352,7 @@ function runtest(name, engine, hide, ext, makepdf) .. checkopts .. " " .. asciiopt .. lvtfile .. (hide and (" > " .. os_null) or "") .. os_concat .. - runtest_tasks(stripext(lvtfile)) + runtest_tasks(jobname(lvtfile)) ) end if makepdf and fileexists(testdir .. "/" .. name .. dviext) then @@ -1402,18 +1402,18 @@ function dvitopdf(name, dir, engine, hide) end end --- Strip the extension from a file name (if present) -function stripext(file) - local name = match(file, "^(.*)%.") - return name or file -end - -- Strip the path from a file name (if present) function basename(file) local name = match(file, "^.*/([^/]*)$") return name or file end +-- Strip the extension from a file name (if present) +function jobname(file) + local name = match(basename(file), "^(.*)%.") + return name or file +end + -- Look for a test: could be in the testfiledir or the unpackdir function testexists(test) return(locate({testfiledir, unpackdir}, {test .. lvtext})) @@ -1506,7 +1506,7 @@ function tex(file) end function typesetpdf(file) - local name = stripext(basename(file)) + local name = jobname(file) print("Typesetting " .. name) local errorlevel = typeset(file) if errorlevel == 0 then @@ -1523,7 +1523,7 @@ typeset = typeset or function(file) if errorlevel ~= 0 then return errorlevel else - local name = stripext(basename(file)) + local name = jobname(file) errorlevel = biber(name) + bibtex(name) if errorlevel == 0 then local function cycle(name) @@ -1590,14 +1590,14 @@ function check(names) -- No names passed: find all test files if not next(names) then for _,i in pairs(filelist(testfiledir, "*" .. lvtext)) do - insert(names, stripext(i)) + insert(names, jobname(i)) end for _,i in ipairs(filelist(unpackdir, "*" .. lvtext)) do if fileexists(testfiledir .. "/" .. i) then print("Duplicate test file: " .. i) return 1 else - insert(names, stripext(i)) + insert(names, jobname(i)) end end end @@ -1701,7 +1701,7 @@ function cmdcheck() print("Checking source files") for _,i in ipairs(cmdchkfiles) do for _,j in ipairs(filelist(".", i)) do - print(" " .. stripext(j)) + print(" " .. jobname(j)) run( testdir, os_setenv .. " TEXINPUTS=." .. os_pathsep .. localdir @@ -1711,7 +1711,7 @@ function cmdcheck() " \"\\PassOptionsToClass{check}{l3doc} \\input " .. j .. "\"" .. " > " .. os_null ) - for line in lines(testdir .. "/" .. stripext(j) .. ".cmds") do + for line in lines(testdir .. "/" .. jobname(j) .. ".cmds") do if match(line, "^%!") then print(" - " .. match(line, "^%! (.*)")) end @@ -1870,7 +1870,7 @@ function doc(files) if files and next(files) then typeset = false for _,k in ipairs(files) do - if k == stripext(j) then + if k == jobname(j) then typeset = true break end diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3intarray.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3intarray.sty deleted file mode 100644 index 8239e693bbc..00000000000 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3intarray.sty +++ /dev/null @@ -1,104 +0,0 @@ -%% -%% This is file `l3intarray.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% l3intarray.dtx (with options: `package') -%% -%% Copyright (C) 2011-2017 The 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 "l3experimental bundle" (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% File: l3intarray.dtx Copyright (C) 2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/05/13] -\@ifpackagelater{expl3}{2017/05/13} - {} - {% - \PackageError{l3intarray}{Support package l3kernel too old} - {% - Please install an up to date version of l3kernel\MessageBreak - using your TeX package manager or from CTAN.\MessageBreak - \MessageBreak - Loading l3intarray will abort!% - }% - \endinput - } -\ProvidesExplPackage{l3intarray}{2017/05/13}{} - {L3 Experimental low-level arrays of small integers} -\int_new:N \g__intarray_font_int -\cs_new_protected:Npn \__intarray_new:Nn #1#2 - { - \__chk_if_free_cs:N #1 - \int_gincr:N \g__intarray_font_int - \tex_global:D \tex_font:D #1 = cmr10~at~ \g__intarray_font_int sp \scan_stop: - \tex_hyphenchar:D #1 = \int_eval:n {#2} \scan_stop: - \int_compare:nNnT { \tex_hyphenchar:D #1 } > 0 - { \tex_fontdimen:D \tex_hyphenchar:D #1 #1 = 0 sp \scan_stop: } - \int_step_inline:nnnn { 1 } { 1 } { 8 } - { \tex_fontdimen:D ##1 #1 = 0 sp \scan_stop: } - } -\cs_new:Npn \__intarray_count:N #1 { \tex_the:D \tex_hyphenchar:D #1 } -\cs_new_protected:Npn \__intarray_gset_fast:Nnn #1#2#3 - { \tex_fontdimen:D \int_eval:n {#2} #1 = \int_eval:n {#3} sp \scan_stop: } -\cs_new_protected:Npn \__intarray_gset:Nnn #1#2#3 - { - \exp_args:Nff \__intarray_gset_aux:Nnn #1 - { \int_eval:n {#2} } { \int_eval:n {#3} } - } -\cs_new_protected:Npn \__intarray_gset_aux:Nnn #1#2#3 - { - \int_compare:nTF { 1 <= #2 <= \__intarray_count:N #1 } - { - \int_compare:nTF { - \c_max_dim <= \int_abs:n {#3} <= \c_max_dim } - { \__intarray_gset_fast:Nnn #1 {#2} {#3} } - { - \__msg_kernel_error:nnxxxx { intarray } { overflow } - { \token_to_str:N #1 } {#2} {#3} - { \int_compare:nNnT {#3} < 0 { - } \__int_value:w \c_max_dim } - \__intarray_gset_fast:Nnn #1 {#2} - { \int_compare:nNnT {#3} < 0 { - } \c_max_dim } - } - } - { - \__msg_kernel_error:nnxxx { intarray } { out-of-bounds } - { \token_to_str:N #1 } {#2} { \__intarray_count:N #1 } - } - } -\cs_new:Npn \__intarray_item_fast:Nn #1#2 - { \__int_value:w \tex_fontdimen:D \int_eval:n {#2} #1 } -\cs_new:Npn \__intarray_item:Nn #1#2 - { \exp_args:Nf \__intarray_item_aux:Nn #1 { \int_eval:n {#2} } } -\cs_new:Npn \__intarray_item_aux:Nn #1#2 - { - \int_compare:nTF { 1 <= #2 <= \__intarray_count:N #1 } - { \__intarray_item_fast:Nn #1 {#2} } - { - \__msg_kernel_expandable_error:nnnnn { intarray } { out-of-bounds } - { \token_to_str:N #1 } {#2} { \__intarray_count:N #1 } - 0 - } - } -\__msg_kernel_new:nnnn { intarray } { overflow } - { Integers~larger~than~2^{30}-1~cannot~be~stored~in~arrays. } - { - An~attempt~was~made~to~store~#3~at~position~#2~in~the~array~'#1'.~ - The~largest~allowed~value~#4~will~be~used~instead. - } -\__msg_kernel_new:nnnn { intarray } { out-of-bounds } - { Access~to~an~entry~beyond~an~array's~bounds. } - { - An~attempt~was~made~to~access~or~store~data~at~position~#2~of~the~ - array~'#1',~but~this~array~has~entries~at~positions~from~1~to~#3. - } -%% -%% -%% End of file `l3intarray.sty'. diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty deleted file mode 100644 index abb10d12edf..00000000000 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty +++ /dev/null @@ -1,3043 +0,0 @@ -%% -%% This is file `l3regex-trace.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% l3regex.dtx (with options: `package,trace') -%% -%% Copyright (C) 2011-2017 The 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 "l3experimental bundle" (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% File: l3regex.dtx Copyright (C) 2011-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/05/13] -\@ifpackagelater{expl3}{2017/05/13} - {} - {% - \PackageError{l3regex}{Support package l3kernel too old} - {% - Please install an up to date version of l3kernel\MessageBreak - using your TeX package manager or from CTAN.\MessageBreak - \MessageBreak - Loading l3regex will abort!% - }% - \endinput - } -\ProvidesExplPackage{l3regex}{2017/05/13}{} - {L3 Experimental regular expressions} -\RequirePackage{l3tl-build, l3tl-analysis, l3intarray} -\cs_generate_variant:Nn \tl_to_str:n { V } -\cs_new_protected:Npn \__regex_standard_escapechar: - { \int_set:Nn \tex_escapechar:D { `\\ } } -\cs_new:Npn \__regex_toks_use:w { \tex_the:D \tex_toks:D } -\cs_new_protected:Npn \__regex_toks_clear:N #1 - { \tex_toks:D #1 { } } -\cs_new_eq:NN \__regex_toks_set:Nn \tex_toks:D -\cs_new_protected:Npn \__regex_toks_set:No #1 - { \__regex_toks_set:Nn #1 \exp_after:wN } -\cs_new_protected:Npn \__regex_toks_memcpy:NNn #1#2#3 - { - \prg_replicate:nn {#3} - { - \tex_toks:D #1 = \tex_toks:D #2 - \int_incr:N #1 - \int_incr:N #2 - } - } -\cs_new_protected:Npn \__regex_toks_put_left:Nx #1#2 - { - \cs_set:Npx \__regex_tmp:w { #2 } - \tex_toks:D #1 \exp_after:wN \exp_after:wN \exp_after:wN - { \exp_after:wN \__regex_tmp:w \tex_the:D \tex_toks:D #1 } - } -\cs_new_protected:Npn \__regex_toks_put_right:Nx #1#2 - { - \cs_set:Npx \__regex_tmp:w {#2} - \tex_toks:D #1 \exp_after:wN - { \tex_the:D \tex_toks:D \exp_after:wN #1 \__regex_tmp:w } - } -\cs_new_protected:Npn \__regex_toks_put_right:Nn #1#2 - { \tex_toks:D #1 \exp_after:wN { \tex_the:D \tex_toks:D #1 #2 } } -\cs_new:Npn \__regex_current_cs_to_str: - { - \exp_after:wN \exp_after:wN \exp_after:wN \cs_to_str:N - \tex_the:D \tex_toks:D \l__regex_current_pos_int - } -\cs_new:Npn \__regex_tmp:w { } -\tl_new:N \l__regex_internal_a_tl -\tl_new:N \l__regex_internal_b_tl -\int_new:N \l__regex_internal_a_int -\int_new:N \l__regex_internal_b_int -\int_new:N \l__regex_internal_c_int -\bool_new:N \l__regex_internal_bool -\seq_new:N \l__regex_internal_seq -\tl_new:N \g__regex_internal_tl -\tl_const:Nn \c__regex_no_match_regex - { - \__regex_branch:n - { \__regex_class:NnnnN \c_true_bool { } { 1 } { 0 } \c_true_bool } - } -\__intarray_new:Nn \g__regex_charcode_intarray { 65536 } -\__intarray_new:Nn \g__regex_catcode_intarray { 65536 } -\__intarray_new:Nn \g__regex_balance_intarray { 65536 } -\int_new:N \l__regex_balance_int -\tl_new:N \l__regex_cs_name_tl -\int_const:Nn \c__regex_ascii_min_int { 0 } -\int_const:Nn \c__regex_ascii_max_control_int { 31 } -\int_const:Nn \c__regex_ascii_max_int { 127 } -\int_const:Nn \c__regex_ascii_lower_int { `a - `A } -\cs_new_protected:Npn \__regex_break_true:w - #1 \__regex_break_point:TF #2 #3 {#2} -\cs_new_protected:Npn \__regex_break_point:TF #1 #2 { #2 } -\cs_new_protected:Npn \__regex_item_reverse:n #1 - { - #1 - \__regex_break_point:TF { } \__regex_break_true:w - } -\cs_new_protected:Npn \__regex_item_caseful_equal:n #1 - { - \if_int_compare:w #1 = \l__regex_current_char_int - \exp_after:wN \__regex_break_true:w - \fi: - } -\cs_new_protected:Npn \__regex_item_caseful_range:nn #1 #2 - { - \reverse_if:N \if_int_compare:w #1 > \l__regex_current_char_int - \reverse_if:N \if_int_compare:w #2 < \l__regex_current_char_int - \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w - \fi: - \fi: - } -\cs_new_protected:Npn \__regex_item_caseless_equal:n #1 - { - \if_int_compare:w #1 = \l__regex_current_char_int - \exp_after:wN \__regex_break_true:w - \fi: - \if_int_compare:w \l__regex_case_changed_char_int = \c_max_int - \__regex_compute_case_changed_char: - \fi: - \if_int_compare:w #1 = \l__regex_case_changed_char_int - \exp_after:wN \__regex_break_true:w - \fi: - } -\cs_new_protected:Npn \__regex_item_caseless_range:nn #1 #2 - { - \reverse_if:N \if_int_compare:w #1 > \l__regex_current_char_int - \reverse_if:N \if_int_compare:w #2 < \l__regex_current_char_int - \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w - \fi: - \fi: - \if_int_compare:w \l__regex_case_changed_char_int = \c_max_int - \__regex_compute_case_changed_char: - \fi: - \reverse_if:N \if_int_compare:w #1 > \l__regex_case_changed_char_int - \reverse_if:N \if_int_compare:w #2 < \l__regex_case_changed_char_int - \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w - \fi: - \fi: - } -\cs_new_protected:Npn \__regex_compute_case_changed_char: - { - \int_set_eq:NN \l__regex_case_changed_char_int \l__regex_current_char_int - \if_int_compare:w \l__regex_current_char_int > `Z \exp_stop_f: - \if_int_compare:w \l__regex_current_char_int > `z \exp_stop_f: \else: - \if_int_compare:w \l__regex_current_char_int < `a \exp_stop_f: \else: - \int_sub:Nn \l__regex_case_changed_char_int { \c__regex_ascii_lower_int } - \fi: - \fi: - \else: - \if_int_compare:w \l__regex_current_char_int < `A \exp_stop_f: \else: - \int_add:Nn \l__regex_case_changed_char_int { \c__regex_ascii_lower_int } - \fi: - \fi: - } -\cs_new_eq:NN \__regex_item_equal:n ? -\cs_new_eq:NN \__regex_item_range:nn ? -\cs_new_protected:Npn \__regex_item_catcode: - { - " - \if_case:w \l__regex_current_catcode_int - 1 \or: 4 \or: 10 \or: 40 - \or: 100 \or: \or: 1000 \or: 4000 - \or: 10000 \or: \or: 100000 \or: 400000 - \or: 1000000 \or: 4000000 \else: 1*0 - \fi: - } -\cs_new_protected:Npn \__regex_item_catcode:nT #1 - { - \if_int_odd:w \__int_eval:w #1 / \__regex_item_catcode: \__int_eval_end: - \exp_after:wN \use:n - \else: - \exp_after:wN \use_none:n - \fi: - } -\cs_new_protected:Npn \__regex_item_catcode_reverse:nT #1#2 - { \__regex_item_catcode:nT {#1} { \__regex_item_reverse:n {#2} } } -\cs_new_protected:Npn \__regex_item_exact:nn #1#2 - { - \if_int_compare:w #1 = \l__regex_current_catcode_int - \if_int_compare:w #2 = \l__regex_current_char_int - \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w - \fi: - \fi: - } -\cs_new_protected:Npn \__regex_item_exact_cs:n #1 - { - \int_compare:nNnTF \l__regex_current_catcode_int = 0 - { - \tl_set:Nx \l__regex_internal_a_tl - { \scan_stop: \__regex_current_cs_to_str: \scan_stop: } - \tl_if_in:noTF { \scan_stop: #1 \scan_stop: } \l__regex_internal_a_tl - { \__regex_break_true:w } { } - } - { } - } -\cs_new_protected:Npn \__regex_item_cs:n #1 - { - \int_compare:nNnT \l__regex_current_catcode_int = 0 - { - \group_begin: - \tl_set:Nx \l__regex_cs_name_tl { \__regex_current_cs_to_str: } - \__regex_single_match: - \__regex_disable_submatches: - \__regex_build_for_cs:n {#1} - \bool_set_eq:NN \l__regex_saved_success_bool \g__regex_success_bool - \exp_args:NV \__regex_match:n \l__regex_cs_name_tl - \if_meaning:w \c_true_bool \g__regex_success_bool - \group_insert_after:N \__regex_break_true:w - \fi: - \bool_gset_eq:NN \g__regex_success_bool \l__regex_saved_success_bool - \group_end: - } - } -\cs_new_protected:Npn \__regex_prop_d: - { \__regex_item_caseful_range:nn { `0 } { `9 } } -\cs_new_protected:Npn \__regex_prop_h: - { - \__regex_item_caseful_equal:n { `\ } - \__regex_item_caseful_equal:n { `\^^I } - } -\cs_new_protected:Npn \__regex_prop_s: - { - \__regex_item_caseful_equal:n { `\ } - \__regex_item_caseful_equal:n { `\^^I } - \__regex_item_caseful_equal:n { `\^^J } - \__regex_item_caseful_equal:n { `\^^L } - \__regex_item_caseful_equal:n { `\^^M } - } -\cs_new_protected:Npn \__regex_prop_v: - { \__regex_item_caseful_range:nn { `\^^J } { `\^^M } } % lf, vtab, ff, cr -\cs_new_protected:Npn \__regex_prop_w: - { - \__regex_item_caseful_range:nn { `a } { `z } - \__regex_item_caseful_range:nn { `A } { `Z } - \__regex_item_caseful_range:nn { `0 } { `9 } - \__regex_item_caseful_equal:n { `_ } - } -\cs_new_protected:Npn \__regex_prop_N: - { - \__regex_item_reverse:n - { \__regex_item_caseful_equal:n { `\^^J } } - } -\cs_new_protected:Npn \__regex_posix_alnum: - { \__regex_posix_alpha: \__regex_posix_digit: } -\cs_new_protected:Npn \__regex_posix_alpha: - { \__regex_posix_lower: \__regex_posix_upper: } -\cs_new_protected:Npn \__regex_posix_ascii: - { - \__regex_item_caseful_range:nn - \c__regex_ascii_min_int - \c__regex_ascii_max_int - } -\cs_new_eq:NN \__regex_posix_blank: \__regex_prop_h: -\cs_new_protected:Npn \__regex_posix_cntrl: - { - \__regex_item_caseful_range:nn - \c__regex_ascii_min_int - \c__regex_ascii_max_control_int - \__regex_item_caseful_equal:n \c__regex_ascii_max_int - } -\cs_new_eq:NN \__regex_posix_digit: \__regex_prop_d: -\cs_new_protected:Npn \__regex_posix_graph: - { \__regex_item_caseful_range:nn { `! } { `\~ } } -\cs_new_protected:Npn \__regex_posix_lower: - { \__regex_item_caseful_range:nn { `a } { `z } } -\cs_new_protected:Npn \__regex_posix_print: - { \__regex_item_caseful_range:nn { `\ } { `\~ } } -\cs_new_protected:Npn \__regex_posix_punct: - { - \__regex_item_caseful_range:nn { `! } { `/ } - \__regex_item_caseful_range:nn { `: } { `@ } - \__regex_item_caseful_range:nn { `[ } { `` } - \__regex_item_caseful_range:nn { `\{ } { `\~ } - } -\cs_new_protected:Npn \__regex_posix_space: - { - \__regex_item_caseful_equal:n { `\ } - \__regex_item_caseful_range:nn { `\^^I } { `\^^M } - } -\cs_new_protected:Npn \__regex_posix_upper: - { \__regex_item_caseful_range:nn { `A } { `Z } } -\cs_new_eq:NN \__regex_posix_word: \__regex_prop_w: -\cs_new_protected:Npn \__regex_posix_xdigit: - { - \__regex_posix_digit: - \__regex_item_caseful_range:nn { `A } { `F } - \__regex_item_caseful_range:nn { `a } { `f } - } -\cs_new_protected:Npn \__regex_escape_use:nnnn #1#2#3#4 - { - \trace_push:nnn { regex } { 1 } { __regex_escape_use:nnnn } - \__tl_build:Nw \l__regex_internal_a_tl - \cs_set:Npn \__regex_escape_unescaped:N ##1 { #1 } - \cs_set:Npn \__regex_escape_escaped:N ##1 { #2 } - \cs_set:Npn \__regex_escape_raw:N ##1 { #3 } - \__regex_standard_escapechar: - \tl_gset:Nx \g__regex_internal_tl { \__str_to_other_fast:n {#4} } - \tl_set:Nx \l__regex_internal_b_tl - { - \exp_after:wN \__regex_escape_loop:N \g__regex_internal_tl - { break } \__prg_break_point: - } - \__tl_build_one:o \l__regex_internal_b_tl - \__tl_build_end: - \trace_pop:nnn { regex } { 1 } { __regex_escape_use:nnnn } - \l__regex_internal_a_tl - } -\cs_new:Npn \__regex_escape_loop:N #1 - { - \cs_if_exist_use:cF { __regex_escape_\token_to_str:N #1:w } - { \__regex_escape_unescaped:N #1 } - \__regex_escape_loop:N - } -\cs_new:cpn { __regex_escape_ \c_backslash_str :w } - \__regex_escape_loop:N #1 - { - \cs_if_exist_use:cF { __regex_escape_/\token_to_str:N #1:w } - { \__regex_escape_escaped:N #1 } - \__regex_escape_loop:N - } -\cs_new_eq:NN \__regex_escape_unescaped:N ? -\cs_new_eq:NN \__regex_escape_escaped:N ? -\cs_new_eq:NN \__regex_escape_raw:N ? -\cs_new_eq:NN \__regex_escape_break:w \__prg_break: -\cs_new:cpn { __regex_escape_/break:w } - { - \if_false: { \fi: } - \__msg_kernel_error:nn { regex } { trailing-backslash } - \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: - } -\cs_new:cpn { __regex_escape_~:w } { } -\cs_new:cpx { __regex_escape_/a:w } - { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^G } -\cs_new:cpx { __regex_escape_/t:w } - { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^I } -\cs_new:cpx { __regex_escape_/n:w } - { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^J } -\cs_new:cpx { __regex_escape_/f:w } - { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^L } -\cs_new:cpx { __regex_escape_/r:w } - { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^M } -\cs_new:cpx { __regex_escape_/e:w } - { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^[ } -\cs_new:cpn { __regex_escape_/x:w } \__regex_escape_loop:N - { - \exp_after:wN \__regex_escape_x_end:w - \__int_value:w "0 \__regex_escape_x_test:N - } -\cs_new:Npn \__regex_escape_x_end:w #1 ; - { - \int_compare:nNnTF {#1} > \c_max_char_int - { - \if_false: { \fi: } - \__tl_build_one:o \l__regex_internal_b_tl - \__msg_kernel_error:nnx { regex } { x-overflow } {#1} - \tl_set:Nx \l__regex_internal_b_tl - { \if_false: } \fi: - } - { - \exp_last_unbraced:Nf \__regex_escape_raw:N - { \char_generate:nn {#1} { 12 } } - } - } -\cs_new:Npn \__regex_escape_x_test:N #1 - { - \str_if_eq_x:nnTF {#1} { break } { ; } - { - \if_charcode:w \c_space_token #1 - \exp_after:wN \__regex_escape_x_test:N - \else: - \exp_after:wN \__regex_escape_x_testii:N - \exp_after:wN #1 - \fi: - } - } -\cs_new:Npn \__regex_escape_x_testii:N #1 - { - \if_charcode:w \c_left_brace_str #1 - \exp_after:wN \__regex_escape_x_loop:N - \else: - \__regex_hexadecimal_use:NTF #1 - { \exp_after:wN \__regex_escape_x:N } - { ; \exp_after:wN \__regex_escape_loop:N \exp_after:wN #1 } - \fi: - } -\cs_new:Npn \__regex_escape_x:N #1 - { - \str_if_eq_x:nnTF {#1} { break } { ; } - { - \__regex_hexadecimal_use:NTF #1 - { ; \__regex_escape_loop:N } - { ; \__regex_escape_loop:N #1 } - } - } -\cs_new:Npn \__regex_escape_x_loop:N #1 - { - \str_if_eq_x:nnTF {#1} { break } - { ; \__regex_escape_x_loop_error:n { } {#1} } - { - \__regex_hexadecimal_use:NTF #1 - { \__regex_escape_x_loop:N } - { - \token_if_eq_charcode:NNTF \c_space_token #1 - { \__regex_escape_x_loop:N } - { - ; - \exp_after:wN - \token_if_eq_charcode:NNTF \c_right_brace_str #1 - { \__regex_escape_loop:N } - { \__regex_escape_x_loop_error:n {#1} } - } - } - } - } -\cs_new:Npn \__regex_escape_x_loop_error:n #1 - { - \if_false: { \fi: } - \__tl_build_one:o \l__regex_internal_b_tl - \__msg_kernel_error:nnx { regex } { x-missing-rbrace } {#1} - \tl_set:Nx \l__regex_internal_b_tl - { \if_false: } \fi: \__regex_escape_loop:N #1 - } -\prg_new_conditional:Npnn \__regex_hexadecimal_use:N #1 { TF } - { - \if_int_compare:w 1 < "1 \token_to_str:N #1 \exp_stop_f: - #1 \prg_return_true: - \else: - \if_case:w \__int_eval:w - \exp_after:wN ` \token_to_str:N #1 - `a - \__int_eval_end: - A - \or: B - \or: C - \or: D - \or: E - \or: F - \else: - \prg_return_false: - \exp_after:wN \use_none:n - \fi: - \prg_return_true: - \fi: - } -\prg_new_conditional:Npnn \__regex_char_if_special:N #1 { TF } - { - \if_int_compare:w `#1 > `Z \exp_stop_f: - \if_int_compare:w `#1 > `z \exp_stop_f: - \if_int_compare:w `#1 < \c__regex_ascii_max_int - \prg_return_true: \else: \prg_return_false: \fi: - \else: - \if_int_compare:w `#1 < `a \exp_stop_f: - \prg_return_true: \else: \prg_return_false: \fi: - \fi: - \else: - \if_int_compare:w `#1 > `9 \exp_stop_f: - \if_int_compare:w `#1 < `A \exp_stop_f: - \prg_return_true: \else: \prg_return_false: \fi: - \else: - \if_int_compare:w `#1 < `0 \exp_stop_f: - \if_int_compare:w `#1 < `\ \exp_stop_f: - \prg_return_false: \else: \prg_return_true: \fi: - \else: \prg_return_false: \fi: - \fi: - \fi: - } -\prg_new_conditional:Npnn \__regex_char_if_alphanumeric:N #1 { TF } - { - \if_int_compare:w `#1 > `Z \exp_stop_f: - \if_int_compare:w `#1 > `z \exp_stop_f: - \prg_return_false: - \else: - \if_int_compare:w `#1 < `a \exp_stop_f: - \prg_return_false: \else: \prg_return_true: \fi: - \fi: - \else: - \if_int_compare:w `#1 > `9 \exp_stop_f: - \if_int_compare:w `#1 < `A \exp_stop_f: - \prg_return_false: \else: \prg_return_true: \fi: - \else: - \if_int_compare:w `#1 < `0 \exp_stop_f: - \prg_return_false: \else: \prg_return_true: \fi: - \fi: - \fi: - } -\int_new:N \l__regex_group_level_int -\int_new:N \l__regex_mode_int -\int_const:Nn \c__regex_cs_in_class_mode_int { -6 } -\int_const:Nn \c__regex_cs_mode_int { -2 } -\int_const:Nn \c__regex_outer_mode_int { 0 } -\int_const:Nn \c__regex_catcode_mode_int { 2 } -\int_const:Nn \c__regex_class_mode_int { 3 } -\int_const:Nn \c__regex_catcode_in_class_mode_int { 6 } -\int_new:N \l__regex_catcodes_int -\int_new:N \l__regex_default_catcodes_int -\bool_new:N \l__regex_catcodes_bool -\int_const:Nn \c__regex_catcode_C_int { "1 } -\int_const:Nn \c__regex_catcode_B_int { "4 } -\int_const:Nn \c__regex_catcode_E_int { "10 } -\int_const:Nn \c__regex_catcode_M_int { "40 } -\int_const:Nn \c__regex_catcode_T_int { "100 } -\int_const:Nn \c__regex_catcode_P_int { "1000 } -\int_const:Nn \c__regex_catcode_U_int { "4000 } -\int_const:Nn \c__regex_catcode_D_int { "10000 } -\int_const:Nn \c__regex_catcode_S_int { "100000 } -\int_const:Nn \c__regex_catcode_L_int { "400000 } -\int_const:Nn \c__regex_catcode_O_int { "1000000 } -\int_const:Nn \c__regex_catcode_A_int { "4000000 } -\int_const:Nn \c__regex_all_catcodes_int { "5515155 } -\cs_new_eq:NN \l__regex_internal_regex \c__regex_no_match_regex -\seq_new:N \l__regex_show_prefix_seq -\int_new:N \l__regex_show_lines_int -\cs_new_protected:Npn \__regex_get_digits:NTFw #1#2#3#4#5 - { - \__regex_if_raw_digit:NNTF #4 #5 - { #1 = #5 \__regex_get_digits_loop:nw {#2} } - { #3 #4 #5 } - } -\cs_new:Npn \__regex_get_digits_loop:nw #1#2#3 - { - \__regex_if_raw_digit:NNTF #2 #3 - { #3 \__regex_get_digits_loop:nw {#1} } - { \scan_stop: #1 #2 #3 } - } -\prg_new_conditional:Npnn \__regex_if_raw_digit:NN #1#2 { TF } - { - \if_meaning:w \__regex_compile_raw:N #1 - \if_int_compare:w 1 < 1 #2 \exp_stop_f: - \prg_return_true: - \else: - \prg_return_false: - \fi: - \else: - \prg_return_false: - \fi: - } -\cs_new:Npn \__regex_if_in_class:TF - { - \if_int_odd:w \l__regex_mode_int - \exp_after:wN \use_i:nn - \else: - \exp_after:wN \use_ii:nn - \fi: - } -\cs_new:Npn \__regex_if_in_cs:TF - { - \if_int_odd:w \l__regex_mode_int - \exp_after:wN \use_ii:nn - \else: - \if_int_compare:w \l__regex_mode_int < \c__regex_outer_mode_int - \exp_after:wN \exp_after:wN \exp_after:wN \use_i:nn - \else: - \exp_after:wN \exp_after:wN \exp_after:wN \use_ii:nn - \fi: - \fi: - } -\cs_new:Npn \__regex_if_in_class_or_catcode:TF - { - \if_int_odd:w \l__regex_mode_int - \exp_after:wN \use_i:nn - \else: - \if_int_compare:w \l__regex_mode_int > \c__regex_outer_mode_int - \exp_after:wN \exp_after:wN \exp_after:wN \use_i:nn - \else: - \exp_after:wN \exp_after:wN \exp_after:wN \use_ii:nn - \fi: - \fi: - } -\cs_new:Npn \__regex_if_within_catcode:TF - { - \if_int_compare:w \l__regex_mode_int > \c__regex_outer_mode_int - \exp_after:wN \use_i:nn - \else: - \exp_after:wN \use_ii:nn - \fi: - } -\cs_new_protected:Npn \__regex_chk_c_allowed:T - { - \if_int_compare:w \l__regex_mode_int = \c__regex_outer_mode_int - \exp_after:wN \use:n - \else: - \if_int_compare:w \l__regex_mode_int = \c__regex_class_mode_int - \exp_after:wN \exp_after:wN \exp_after:wN \use:n - \else: - \__msg_kernel_error:nn { regex } { c-bad-mode } - \exp_after:wN \exp_after:wN \exp_after:wN \use_none:n - \fi: - \fi: - } -\cs_new_protected:Npn \__regex_mode_quit_c: - { - \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_mode_int - \int_set_eq:NN \l__regex_mode_int \c__regex_outer_mode_int - \else: - \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_in_class_mode_int - \int_set_eq:NN \l__regex_mode_int \c__regex_class_mode_int - \fi: - \fi: - } -\cs_new_protected:Npn \__regex_compile:w - { - \__tl_build_x:Nw \l__regex_internal_regex - \int_zero:N \l__regex_group_level_int - \int_set_eq:NN \l__regex_default_catcodes_int \c__regex_all_catcodes_int - \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int - \cs_set:Npn \__regex_item_equal:n { \__regex_item_caseful_equal:n } - \cs_set:Npn \__regex_item_range:nn { \__regex_item_caseful_range:nn } - \__tl_build_one:n { \__regex_branch:n { \if_false: } \fi: } - } -\cs_new_protected:Npn \__regex_compile_end: - { - \__regex_if_in_class:TF - { - \__msg_kernel_error:nn { regex } { missing-rbrack } - \use:c { __regex_compile_]: } - \prg_do_nothing: \prg_do_nothing: - } - { } - \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: - \__msg_kernel_error:nnx { regex } { missing-rparen } - { \int_use:N \l__regex_group_level_int } - \prg_replicate:nn - { \l__regex_group_level_int } - { - \__tl_build_one:n - { - \if_false: { \fi: } - \if_false: { \fi: } { 1 } { 0 } \c_true_bool - } - \__tl_build_end: - \__tl_build_one:o \l__regex_internal_regex - } - \fi: - \__tl_build_one:n { \if_false: { \fi: } } - \__tl_build_end: - } -\cs_new_protected:Npn \__regex_compile:n #1 - { - \__regex_compile:w - \__regex_standard_escapechar: - \int_set_eq:NN \l__regex_mode_int \c__regex_outer_mode_int - \__regex_escape_use:nnnn - { - \__regex_char_if_special:NTF ##1 - \__regex_compile_special:N \__regex_compile_raw:N ##1 - } - { - \__regex_char_if_alphanumeric:NTF ##1 - \__regex_compile_escaped:N \__regex_compile_raw:N ##1 - } - { \__regex_compile_raw:N ##1 } - { #1 } - \prg_do_nothing: \prg_do_nothing: - \prg_do_nothing: \prg_do_nothing: - \int_compare:nNnT \l__regex_mode_int = \c__regex_catcode_mode_int - { \__msg_kernel_error:nn { regex } { c-trailing } } - \int_compare:nNnT \l__regex_mode_int < \c__regex_outer_mode_int - { - \__msg_kernel_error:nn { regex } { c-missing-rbrace } - \__regex_compile_end_cs: - \prg_do_nothing: \prg_do_nothing: - \prg_do_nothing: \prg_do_nothing: - } - \__regex_compile_end: - } -\cs_new_protected:Npn \__regex_compile_special:N #1 - { - \cs_if_exist_use:cF { __regex_compile_#1: } - { \__regex_compile_raw:N #1 } - } -\cs_new_protected:Npn \__regex_compile_escaped:N #1 - { - \cs_if_exist_use:cF { __regex_compile_/#1: } - { \__regex_compile_raw:N #1 } - } -\cs_new_protected:Npn \__regex_compile_one:x #1 - { - \__regex_mode_quit_c: - \__regex_if_in_class:TF { } - { - \__tl_build_one:n - { \__regex_class:NnnnN \c_true_bool { \if_false: } \fi: } - } - \__tl_build_one:x - { - \if_int_compare:w \l__regex_catcodes_int < \c__regex_all_catcodes_int - \__regex_item_catcode:nT { \int_use:N \l__regex_catcodes_int } - { \exp_not:N \exp_not:n {#1} } - \else: - \exp_not:N \exp_not:n {#1} - \fi: - } - \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int - \__regex_if_in_class:TF { } { \__regex_compile_quantifier:w } - } -\cs_new_protected:Npn \__regex_compile_abort_tokens:n #1 - { - \use:x - { - \exp_args:No \tl_map_function:nN { \tl_to_str:n {#1} } - \__regex_compile_raw:N - } - } -\cs_generate_variant:Nn \__regex_compile_abort_tokens:n { x } -\cs_new_protected:Npn \__regex_compile_quantifier:w #1#2 - { - \token_if_eq_meaning:NNTF #1 \__regex_compile_special:N - { - \cs_if_exist_use:cF { __regex_compile_quantifier_#2:w } - { \__regex_compile_quantifier_none: #1 #2 } - } - { \__regex_compile_quantifier_none: #1 #2 } - } -\cs_new_protected:Npn \__regex_compile_quantifier_none: - { \__tl_build_one:n { \if_false: { \fi: } { 1 } { 0 } \c_false_bool } } -\cs_new_protected:Npn \__regex_compile_quantifier_abort:xNN #1#2#3 - { - \__regex_compile_quantifier_none: - \__msg_kernel_warning:nnxx { regex } { invalid-quantifier } {#1} {#3} - \__regex_compile_abort_tokens:x {#1} - #2 #3 - } -\cs_new_protected:Npn \__regex_compile_quantifier_lazyness:nnNN #1#2#3#4 - { - \str_if_eq:nnTF { #3 #4 } { \__regex_compile_special:N ? } - { \__tl_build_one:n { \if_false: { \fi: } { #1 } { #2 } \c_true_bool } } - { - \__tl_build_one:n { \if_false: { \fi: } { #1 } { #2 } \c_false_bool } - #3 #4 - } - } -\cs_new_protected:cpn { __regex_compile_quantifier_?:w } - { \__regex_compile_quantifier_lazyness:nnNN { 0 } { 1 } } -\cs_new_protected:cpn { __regex_compile_quantifier_*:w } - { \__regex_compile_quantifier_lazyness:nnNN { 0 } { -1 } } -\cs_new_protected:cpn { __regex_compile_quantifier_+:w } - { \__regex_compile_quantifier_lazyness:nnNN { 1 } { -1 } } -\cs_new_protected:cpn { __regex_compile_quantifier_ \c_left_brace_str :w } - { - \__regex_get_digits:NTFw \l__regex_internal_a_int - { \__regex_compile_quantifier_braced_auxi:w } - { \__regex_compile_quantifier_abort:xNN { \c_left_brace_str } } - } -\cs_new_protected:Npn \__regex_compile_quantifier_braced_auxi:w #1#2 - { - \str_case_x:nnF { #1 #2 } - { - { \__regex_compile_special:N \c_right_brace_str } - { - \exp_args:No \__regex_compile_quantifier_lazyness:nnNN - { \int_use:N \l__regex_internal_a_int } { 0 } - } - { \__regex_compile_special:N , } - { - \__regex_get_digits:NTFw \l__regex_internal_b_int - { \__regex_compile_quantifier_braced_auxiii:w } - { \__regex_compile_quantifier_braced_auxii:w } - } - } - { - \__regex_compile_quantifier_abort:xNN - { \c_left_brace_str \int_use:N \l__regex_internal_a_int } - #1 #2 - } - } -\cs_new_protected:Npn \__regex_compile_quantifier_braced_auxii:w #1#2 - { - \str_if_eq_x:nnTF - { #1 #2 } { \__regex_compile_special:N \c_right_brace_str } - { - \exp_args:No \__regex_compile_quantifier_lazyness:nnNN - { \int_use:N \l__regex_internal_a_int } { -1 } - } - { - \__regex_compile_quantifier_abort:xNN - { \c_left_brace_str \int_use:N \l__regex_internal_a_int , } - #1 #2 - } - } -\cs_new_protected:Npn \__regex_compile_quantifier_braced_auxiii:w #1#2 - { - \str_if_eq_x:nnTF - { #1 #2 } { \__regex_compile_special:N \c_right_brace_str } - { - \if_int_compare:w \l__regex_internal_a_int > \l__regex_internal_b_int - \__msg_kernel_error:nnxx { regex } { backwards-quantifier } - { \int_use:N \l__regex_internal_a_int } - { \int_use:N \l__regex_internal_b_int } - \int_zero:N \l__regex_internal_b_int - \else: - \int_sub:Nn \l__regex_internal_b_int \l__regex_internal_a_int - \fi: - \exp_args:Noo \__regex_compile_quantifier_lazyness:nnNN - { \int_use:N \l__regex_internal_a_int } - { \int_use:N \l__regex_internal_b_int } - } - { - \__regex_compile_quantifier_abort:xNN - { - \c_left_brace_str - \int_use:N \l__regex_internal_a_int , - \int_use:N \l__regex_internal_b_int - } - #1 #2 - } - } -\cs_new_protected:Npn \__regex_compile_raw_error:N #1 - { - \__msg_kernel_error:nnx { regex } { bad-escape } {#1} - \__regex_compile_raw:N #1 - } -\cs_new_protected:Npn \__regex_compile_raw:N #1#2#3 - { - \__regex_if_in_class:TF - { - \str_if_eq:nnTF {#2#3} { \__regex_compile_special:N - } - { \__regex_compile_range:Nw #1 } - { - \__regex_compile_one:x - { \__regex_item_equal:n { \__int_value:w `#1 ~ } } - #2 #3 - } - } - { - \__regex_compile_one:x - { \__regex_item_equal:n { \__int_value:w `#1 ~ } } - #2 #3 - } - } -\prg_new_protected_conditional:Npnn \__regex_if_end_range:NN #1#2 { TF } - { - \if_meaning:w \__regex_compile_raw:N #1 - \prg_return_true: - \else: - \if_meaning:w \__regex_compile_special:N #1 - \if_charcode:w ] #2 - \prg_return_false: - \else: - \prg_return_true: - \fi: - \else: - \prg_return_false: - \fi: - \fi: - } -\cs_new_protected:Npn \__regex_compile_range:Nw #1#2#3 - { - \__regex_if_end_range:NNTF #2 #3 - { - \if_int_compare:w `#1 > `#3 \exp_stop_f: - \__msg_kernel_error:nnxx { regex } { range-backwards } {#1} {#3} - \else: - \__tl_build_one:x - { - \if_int_compare:w `#1 = `#3 \exp_stop_f: - \__regex_item_equal:n - \else: - \__regex_item_range:nn { \__int_value:w `#1 ~ } - \fi: - { \__int_value:w `#3 ~ } - } - \fi: - } - { - \__msg_kernel_warning:nnxx { regex } { range-missing-end } - {#1} { \c_backslash_str #3 } - \__tl_build_one:x - { - \__regex_item_equal:n { \__int_value:w `#1 ~ } - \__regex_item_equal:n { \__int_value:w `- ~ } - } - #2#3 - } - } -\cs_new_protected:cpx { __regex_compile_.: } - { - \exp_not:N \__regex_if_in_class:TF - { \__regex_compile_raw:N . } - { \__regex_compile_one:x \exp_not:c { __regex_prop_.: } } - } -\cs_new_protected:cpn { __regex_prop_.: } - { - \if_int_compare:w \l__regex_current_char_int > - 2 \exp_stop_f: - \exp_after:wN \__regex_break_true:w - \fi: - } -\cs_set_protected:Npn \__regex_tmp:w #1#2 - { - \cs_new_protected:cpx { __regex_compile_/#1: } - { \__regex_compile_one:x \exp_not:c { __regex_prop_#1: } } - \cs_new_protected:cpx { __regex_compile_/#2: } - { - \__regex_compile_one:x - { \__regex_item_reverse:n \exp_not:c { __regex_prop_#1: } } - } - } -\__regex_tmp:w d D -\__regex_tmp:w h H -\__regex_tmp:w s S -\__regex_tmp:w v V -\__regex_tmp:w w W -\cs_new_protected:cpn { __regex_compile_/N: } - { \__regex_compile_one:x \__regex_prop_N: } -\cs_new_protected:Npn \__regex_compile_anchor:NF #1#2 - { - \__regex_if_in_class_or_catcode:TF {#2} - { - \__tl_build_one:n - { \__regex_assertion:Nn \c_true_bool { \__regex_anchor:N #1 } } - } - } -\cs_set_protected:Npn \__regex_tmp:w #1#2 - { - \cs_new_protected:cpn { __regex_compile_/#1: } - { \__regex_compile_anchor:NF #2 { \__regex_compile_raw_error:N #1 } } - } -\__regex_tmp:w A \l__regex_min_pos_int -\__regex_tmp:w G \l__regex_start_pos_int -\__regex_tmp:w Z \l__regex_max_pos_int -\__regex_tmp:w z \l__regex_max_pos_int -\cs_set_protected:Npn \__regex_tmp:w #1#2 - { - \cs_new_protected:cpn { __regex_compile_#1: } - { \__regex_compile_anchor:NF #2 { \__regex_compile_raw:N #1 } } - } -\exp_args:Nx \__regex_tmp:w { \iow_char:N \^ } \l__regex_min_pos_int -\exp_args:Nx \__regex_tmp:w { \iow_char:N \$ } \l__regex_max_pos_int -\cs_new_protected:cpn { __regex_compile_/b: } - { - \__regex_if_in_class_or_catcode:TF - { \__regex_compile_raw_error:N b } - { - \__tl_build_one:n - { \__regex_assertion:Nn \c_true_bool { \__regex_b_test: } } - } - } -\cs_new_protected:cpn { __regex_compile_/B: } - { - \__regex_if_in_class_or_catcode:TF - { \__regex_compile_raw_error:N B } - { - \__tl_build_one:n - { \__regex_assertion:Nn \c_false_bool { \__regex_b_test: } } - } - } -\cs_new_protected:cpn { __regex_compile_]: } - { - \__regex_if_in_class:TF - { - \if_int_compare:w \l__regex_mode_int > \c__regex_catcode_in_class_mode_int - \__tl_build_one:n { \if_false: { \fi: } } - \fi: - \tex_advance:D \l__regex_mode_int - 15 \exp_stop_f: - \tex_divide:D \l__regex_mode_int 13 \exp_stop_f: - \if_int_odd:w \l__regex_mode_int \else: - \exp_after:wN \__regex_compile_quantifier:w - \fi: - } - { \__regex_compile_raw:N ] } - } -\cs_new_protected:cpn { __regex_compile_[: } - { - \__regex_if_in_class:TF - { \__regex_compile_class_posix_test:w } - { - \__regex_if_within_catcode:TF - { - \exp_after:wN \__regex_compile_class_catcode:w - \int_use:N \l__regex_catcodes_int ; - } - { \__regex_compile_class_normal:w } - } - } -\cs_new_protected:Npn \__regex_compile_class_normal:w - { - \__regex_compile_class:TFNN - { \__regex_class:NnnnN \c_true_bool } - { \__regex_class:NnnnN \c_false_bool } - } -\cs_new_protected:Npn \__regex_compile_class_catcode:w #1; - { - \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_mode_int - \__tl_build_one:n - { \__regex_class:NnnnN \c_true_bool { \if_false: } \fi: } - \fi: - \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int - \__regex_compile_class:TFNN - { \__regex_item_catcode:nT {#1} } - { \__regex_item_catcode_reverse:nT {#1} } - } -\cs_new_protected:Npn \__regex_compile_class:TFNN #1#2#3#4 - { - \l__regex_mode_int = \__int_value:w \l__regex_mode_int 3 \exp_stop_f: - \str_if_eq:nnTF { #3 #4 } { \__regex_compile_special:N ^ } - { - \__tl_build_one:n { #2 { \if_false: } \fi: } - \__regex_compile_class:NN - } - { - \__tl_build_one:n { #1 { \if_false: } \fi: } - \__regex_compile_class:NN #3 #4 - } - } -\cs_new_protected:Npn \__regex_compile_class:NN #1#2 - { - \token_if_eq_charcode:NNTF #2 ] - { \__regex_compile_raw:N #2 } - { #1 #2 } - } -\cs_new_protected:Npn \__regex_compile_class_posix_test:w #1#2 - { - \token_if_eq_meaning:NNT \__regex_compile_special:N #1 - { - \str_case:nn { #2 } - { - : { \__regex_compile_class_posix:NNNNw } - = { \__msg_kernel_warning:nnx { regex } { posix-unsupported } { = } } - . { \__msg_kernel_warning:nnx { regex } { posix-unsupported } { . } } - } - } - \__regex_compile_raw:N [ #1 #2 - } -\cs_new_protected:Npn \__regex_compile_class_posix:NNNNw #1#2#3#4#5#6 - { - \str_if_eq:nnTF { #5 #6 } { \__regex_compile_special:N ^ } - { - \bool_set_false:N \l__regex_internal_bool - \tl_set:Nx \l__regex_internal_a_tl { \if_false: } \fi: - \__regex_compile_class_posix_loop:w - } - { - \bool_set_true:N \l__regex_internal_bool - \tl_set:Nx \l__regex_internal_a_tl { \if_false: } \fi: - \__regex_compile_class_posix_loop:w #5 #6 - } - } -\cs_new:Npn \__regex_compile_class_posix_loop:w #1#2 - { - \token_if_eq_meaning:NNTF \__regex_compile_raw:N #1 - { #2 \__regex_compile_class_posix_loop:w } - { \if_false: { \fi: } \__regex_compile_class_posix_end:w #1 #2 } - } -\cs_new_protected:Npn \__regex_compile_class_posix_end:w #1#2#3#4 - { - \str_if_eq:nnTF { #1 #2 #3 #4 } - { \__regex_compile_special:N : \__regex_compile_special:N ] } - { - \cs_if_exist:cTF { __regex_posix_ \l__regex_internal_a_tl : } - { - \__regex_compile_one:x - { - \bool_if:NF \l__regex_internal_bool \__regex_item_reverse:n - \exp_not:c { __regex_posix_ \l__regex_internal_a_tl : } - } - } - { - \__msg_kernel_warning:nnx { regex } { posix-unknown } - { \l__regex_internal_a_tl } - \__regex_compile_abort_tokens:x - { - [: \bool_if:NF \l__regex_internal_bool { ^ } - \l__regex_internal_a_tl :] - } - } - } - { - \__msg_kernel_error:nnxx { regex } { posix-missing-close } - { [: \l__regex_internal_a_tl } { #2 #4 } - \__regex_compile_abort_tokens:x { [: \l__regex_internal_a_tl } - #1 #2 #3 #4 - } - } -\cs_new_protected:Npn \__regex_compile_group_begin:N #1 - { - \__tl_build_one:n { #1 { \if_false: } \fi: } - \__regex_mode_quit_c: - \__tl_build:Nw \l__regex_internal_regex - \int_set_eq:NN \l__regex_default_catcodes_int \l__regex_catcodes_int - \int_incr:N \l__regex_group_level_int - \__tl_build_one:n { \__regex_branch:n { \if_false: } \fi: } - } -\cs_new_protected:Npn \__regex_compile_group_end: - { - \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: - \__tl_build_one:n { \if_false: { \fi: } } - \__tl_build_end: - \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int - \__tl_build_one:o \l__regex_internal_regex - \exp_after:wN \__regex_compile_quantifier:w - \else: - \__msg_kernel_warning:nn { regex } { extra-rparen } - \exp_after:wN \__regex_compile_raw:N \exp_after:wN ) - \fi: - } -\cs_new_protected:cpn { __regex_compile_(: } - { - \__regex_if_in_class:TF { \__regex_compile_raw:N ( } - { \__regex_compile_lparen:w } - } -\cs_new_protected:Npn \__regex_compile_lparen:w #1#2#3#4 - { - \str_if_eq:nnTF { #1 #2 } { \__regex_compile_special:N ? } - { - \cs_if_exist_use:cF - { __regex_compile_special_group_\token_to_str:N #4 :w } - { - \__msg_kernel_warning:nnx { regex } { special-group-unknown } - { (? #4 } - \__regex_compile_group_begin:N \__regex_group:nnnN - \__regex_compile_raw:N ? #3 #4 - } - } - { - \__regex_compile_group_begin:N \__regex_group:nnnN - #1 #2 #3 #4 - } - } -\cs_new_protected:cpn { __regex_compile_|: } - { - \__regex_if_in_class:TF { \__regex_compile_raw:N | } - { - \__tl_build_one:n - { \if_false: { \fi: } \__regex_branch:n { \if_false: } \fi: } - } - } -\cs_new_protected:cpn { __regex_compile_): } - { - \__regex_if_in_class:TF { \__regex_compile_raw:N ) } - { \__regex_compile_group_end: } - } -\cs_new_protected:cpn { __regex_compile_special_group_::w } - { \__regex_compile_group_begin:N \__regex_group_no_capture:nnnN } -\cs_new_protected:cpn { __regex_compile_special_group_|:w } - { \__regex_compile_group_begin:N \__regex_group_resetting:nnnN } -\cs_new_protected:Npn \__regex_compile_special_group_i:w #1#2 - { - \str_if_eq:nnTF { #1 #2 } { \__regex_compile_special:N ) } - { - \cs_set:Npn \__regex_item_equal:n { \__regex_item_caseless_equal:n } - \cs_set:Npn \__regex_item_range:nn { \__regex_item_caseless_range:nn } - } - { - \__msg_kernel_warning:nnx { regex } { unknown-option } { (?i #2 } - \__regex_compile_raw:N ( - \__regex_compile_raw:N ? - \__regex_compile_raw:N i - #1 #2 - } - } -\cs_new_protected:cpn { __regex_compile_special_group_-:w } #1#2#3#4 - { - \str_if_eq:nnTF { #1 #2 #3 #4 } - { \__regex_compile_raw:N i \__regex_compile_special:N ) } - { - \cs_set:Npn \__regex_item_equal:n { \__regex_item_caseful_equal:n } - \cs_set:Npn \__regex_item_range:nn { \__regex_item_caseful_range:nn } - } - { - \__msg_kernel_warning:nnx { regex } { unknown-option } { (?-#2#4 } - \__regex_compile_raw:N ( - \__regex_compile_raw:N ? - \__regex_compile_raw:N - - #1 #2 #3 #4 - } - } -\cs_new_protected:cpn { __regex_compile_/c: } - { \__regex_chk_c_allowed:T { \__regex_compile_c_test:NN } } -\cs_new_protected:Npn \__regex_compile_c_test:NN #1#2 - { - \token_if_eq_meaning:NNTF #1 \__regex_compile_raw:N - { - \int_if_exist:cTF { c__regex_catcode_#2_int } - { - \int_set_eq:Nc \l__regex_catcodes_int { c__regex_catcode_#2_int } - \l__regex_mode_int - = \if_case:w \l__regex_mode_int - \c__regex_catcode_mode_int - \else: - \c__regex_catcode_in_class_mode_int - \fi: - } - } - { \cs_if_exist_use:cF { __regex_compile_c_#2:w } } - { - \__msg_kernel_error:nnx { regex } { c-missing-category } {#2} - #1 #2 - } - } -\cs_new_protected:cpn { __regex_compile_c_[:w } #1#2 - { - \l__regex_mode_int - = \if_case:w \l__regex_mode_int - \c__regex_catcode_mode_int - \else: - \c__regex_catcode_in_class_mode_int - \fi: - \int_zero:N \l__regex_catcodes_int - \str_if_eq:nnTF { #1 #2 } { \__regex_compile_special:N ^ } - { - \bool_set_false:N \l__regex_catcodes_bool - \__regex_compile_c_lbrack_loop:NN - } - { - \bool_set_true:N \l__regex_catcodes_bool - \__regex_compile_c_lbrack_loop:NN - #1 #2 - } - } -\cs_new_protected:Npn \__regex_compile_c_lbrack_loop:NN #1#2 - { - \token_if_eq_meaning:NNTF #1 \__regex_compile_raw:N - { - \int_if_exist:cTF { c__regex_catcode_#2_int } - { - \exp_args:Nc \__regex_compile_c_lbrack_add:N - { c__regex_catcode_#2_int } - \__regex_compile_c_lbrack_loop:NN - } - } - { - \token_if_eq_charcode:NNTF #2 ] - { \__regex_compile_c_lbrack_end: } - } - { - \__msg_kernel_error:nnx { regex } { c-missing-rbrack } {#2} - \__regex_compile_c_lbrack_end: - #1 #2 - } - } -\cs_new_protected:Npn \__regex_compile_c_lbrack_add:N #1 - { - \if_int_odd:w \__int_eval:w \l__regex_catcodes_int / #1 \__int_eval_end: - \else: - \int_add:Nn \l__regex_catcodes_int {#1} - \fi: - } -\cs_new_protected:Npn \__regex_compile_c_lbrack_end: - { - \if_meaning:w \c_false_bool \l__regex_catcodes_bool - \int_set:Nn \l__regex_catcodes_int - { \c__regex_all_catcodes_int - \l__regex_catcodes_int } - \fi: - } -\cs_new_protected:cpn { __regex_compile_c_ \c_left_brace_str :w } - { - \__regex_compile:w - \__regex_disable_submatches: - \l__regex_mode_int - = \if_case:w \l__regex_mode_int - \c__regex_cs_mode_int - \else: - \c__regex_cs_in_class_mode_int - \fi: - } -\flag_new:n { __regex_cs } -\cs_new_protected:cpn { __regex_compile_ \c_right_brace_str : } - { - \__regex_if_in_cs:TF - { \__regex_compile_end_cs: } - { \exp_after:wN \__regex_compile_raw:N \c_right_brace_str } - } -\cs_new_protected:Npn \__regex_compile_end_cs: - { - \__regex_compile_end: - \flag_clear:n { __regex_cs } - \tl_set:Nx \l__regex_internal_a_tl - { - \exp_after:wN \__regex_compile_cs_aux:Nn \l__regex_internal_regex - \q_nil \q_nil \q_recursion_stop - } - \exp_args:Nx \__regex_compile_one:x - { - \flag_if_raised:nTF { __regex_cs } - { \__regex_item_cs:n { \exp_not:o \l__regex_internal_regex } } - { \__regex_item_exact_cs:n { \tl_tail:N \l__regex_internal_a_tl } } - } - } -\cs_new:Npn \__regex_compile_cs_aux:Nn #1#2 - { - \cs_if_eq:NNTF #1 \__regex_branch:n - { - \scan_stop: - \__regex_compile_cs_aux:NNnnnN #2 - \q_nil \q_nil \q_nil \q_nil \q_nil \q_nil \q_recursion_stop - \__regex_compile_cs_aux:Nn - } - { - \quark_if_nil:NF #1 { \flag_raise:n { __regex_cs } } - \use_none_delimit_by_q_recursion_stop:w - } - } -\cs_new:Npn \__regex_compile_cs_aux:NNnnnN #1#2#3#4#5#6 - { - \bool_lazy_all:nTF - { - { \cs_if_eq_p:NN #1 \__regex_class:NnnnN } - {#2} - { \tl_if_head_eq_meaning_p:nN {#3} \__regex_item_caseful_equal:n } - { \int_compare_p:nNn { \tl_count:n {#3} } = { 2 } } - { \int_compare_p:nNn {#5} = { 0 } } - } - { - \prg_replicate:nn {#4} - { \char_generate:nn { \use_ii:nn #3 } {12} } - \__regex_compile_cs_aux:NNnnnN - } - { - \quark_if_nil:NF #1 - { - \flag_raise:n { __regex_cs } - \use_i_delimit_by_q_recursion_stop:nw - } - \use_none_delimit_by_q_recursion_stop:w - } - } -\cs_new_protected:cpn { __regex_compile_/u: } #1#2 - { - \__regex_if_in_class_or_catcode:TF - { \__regex_compile_raw_error:N u #1 #2 } - { - \str_if_eq_x:nnTF {#1#2} { \__regex_compile_special:N \c_left_brace_str } - { - \tl_set:Nx \l__regex_internal_a_tl { \if_false: } \fi: - \__regex_compile_u_loop:NN - } - { - \__msg_kernel_error:nn { regex } { u-missing-lbrace } - \__regex_compile_raw:N u #1 #2 - } - } - } -\cs_new:Npn \__regex_compile_u_loop:NN #1#2 - { - \token_if_eq_meaning:NNTF #1 \__regex_compile_raw:N - { #2 \__regex_compile_u_loop:NN } - { - \token_if_eq_meaning:NNTF #1 \__regex_compile_special:N - { - \exp_after:wN \token_if_eq_charcode:NNTF \c_right_brace_str #2 - { \if_false: { \fi: } \__regex_compile_u_end: } - { #2 \__regex_compile_u_loop:NN } - } - { - \if_false: { \fi: } - \__msg_kernel_error:nnx { regex } { u-missing-rbrace } {#2} - \__regex_compile_u_end: - #1 #2 - } - } - } -\cs_new_protected:Npn \__regex_compile_u_end: - { - \tl_set:Nv \l__regex_internal_a_tl { \l__regex_internal_a_tl } - \if_int_compare:w \l__regex_mode_int = \c__regex_outer_mode_int - \__regex_compile_u_not_cs: - \else: - \__regex_compile_u_in_cs: - \fi: - } -\cs_new_protected:Npn \__regex_compile_u_in_cs: - { - \tl_gset:Nx \g__regex_internal_tl - { \exp_args:No \__str_to_other_fast:n { \l__regex_internal_a_tl } } - \__tl_build_one:x - { - \tl_map_function:NN \g__regex_internal_tl - \__regex_compile_u_in_cs_aux:n - } - } -\cs_new:Npn \__regex_compile_u_in_cs_aux:n #1 - { - \__regex_class:NnnnN \c_true_bool - { \__regex_item_caseful_equal:n { \__int_value:w `#1 } } - { 1 } { 0 } \c_false_bool - } -\cs_new_protected:Npn \__regex_compile_u_not_cs: - { - \exp_args:No \__tl_analysis_map_inline:nn { \l__regex_internal_a_tl } - { - \__tl_build_one:n - { - \__regex_class:NnnnN \c_true_bool - { - \if_int_compare:w "##2 = 0 \exp_stop_f: - \__regex_item_exact_cs:n { \exp_after:wN \cs_to_str:N ##1 } - \else: - \__regex_item_exact:nn { \__int_value:w "##2 } { ##3 } - \fi: - } - { 1 } { 0 } \c_false_bool - } - } - } -\cs_new_protected:cpn { __regex_compile_/K: } - { - \int_compare:nNnTF \l__regex_mode_int = \c__regex_outer_mode_int - { \__tl_build_one:n { \__regex_command_K: } } - { \__regex_compile_raw_error:N K } - } -\cs_new_protected:Npn \__regex_show:Nn #1#2 - { - \__tl_build:Nw \l__regex_internal_a_tl - \cs_set_protected:Npn \__regex_branch:n - { - \seq_pop_right:NN \l__regex_show_prefix_seq \l__regex_internal_a_tl - \__regex_show_one:n { +-branch } - \seq_put_right:No \l__regex_show_prefix_seq \l__regex_internal_a_tl - \use:n - } - \cs_set_protected:Npn \__regex_group:nnnN - { \__regex_show_group_aux:nnnnN { } } - \cs_set_protected:Npn \__regex_group_no_capture:nnnN - { \__regex_show_group_aux:nnnnN { ~(no~capture) } } - \cs_set_protected:Npn \__regex_group_resetting:nnnN - { \__regex_show_group_aux:nnnnN { ~(resetting) } } - \cs_set_eq:NN \__regex_class:NnnnN \__regex_show_class:NnnnN - \cs_set_protected:Npn \__regex_command_K: - { \__regex_show_one:n { reset~match~start~(\iow_char:N\\K) } } - \cs_set_protected:Npn \__regex_assertion:Nn ##1##2 - { \__regex_show_one:n { \bool_if:NF ##1 { negative~ } assertion:~##2 } } - \cs_set:Npn \__regex_b_test: { word~boundary } - \cs_set_eq:NN \__regex_anchor:N \__regex_show_anchor_to_str:N - \cs_set_protected:Npn \__regex_item_caseful_equal:n ##1 - { \__regex_show_one:n { char~code~\int_eval:n{##1} } } - \cs_set_protected:Npn \__regex_item_caseful_range:nn ##1##2 - { \__regex_show_one:n { range~[\int_eval:n{##1}, \int_eval:n{##2}] } } - \cs_set_protected:Npn \__regex_item_caseless_equal:n ##1 - { \__regex_show_one:n { char~code~\int_eval:n{##1}~(caseless) } } - \cs_set_protected:Npn \__regex_item_caseless_range:nn ##1##2 - { - \__regex_show_one:n - { Range~[\int_eval:n{##1}, \int_eval:n{##2}]~(caseless) } - } - \cs_set_protected:Npn \__regex_item_catcode:nT - { \__regex_show_item_catcode:NnT \c_true_bool } - \cs_set_protected:Npn \__regex_item_catcode_reverse:nT - { \__regex_show_item_catcode:NnT \c_false_bool } - \cs_set_protected:Npn \__regex_item_reverse:n - { \__regex_show_scope:nn { Reversed~match } } - \cs_set_protected:Npn \__regex_item_exact:nn ##1##2 - { \__regex_show_one:n { char~##2,~catcode~##1 } } - \cs_set_eq:NN \__regex_item_exact_cs:n \__regex_show_item_exact_cs:n - \cs_set_protected:Npn \__regex_item_cs:n - { \__regex_show_scope:nn { control~sequence } } - \cs_set:cpn { __regex_prop_.: } { \__regex_show_one:n { any~token } } - \seq_clear:N \l__regex_show_prefix_seq - \__regex_show_push:n { ~ } - \cs_if_exist_use:N #1 - \__tl_build_end: - \__msg_show_variable:NNNnn #1 \cs_if_exist:NTF ? { } - { >~Compiled~regex~#2: \l__regex_internal_a_tl } - } -\cs_new_protected:Npn \__regex_show_one:n #1 - { - \int_incr:N \l__regex_show_lines_int - \__tl_build_one:x - { - \exp_not:N \\ - \seq_map_function:NN \l__regex_show_prefix_seq \use:n - #1 - } - } -\cs_new_protected:Npn \__regex_show_push:n #1 - { \seq_put_right:Nx \l__regex_show_prefix_seq { #1 ~ } } -\cs_new_protected:Npn \__regex_show_pop: - { \seq_pop_right:NN \l__regex_show_prefix_seq \l__regex_internal_a_tl } -\cs_new_protected:Npn \__regex_show_scope:nn #1#2 - { - \__regex_show_one:n {#1} - \__regex_show_push:n { ~ } - #2 - \__regex_show_pop: - } -\cs_new_protected:Npn \__regex_show_group_aux:nnnnN #1#2#3#4#5 - { - \__regex_show_one:n { ,-group~begin #1 } - \__regex_show_push:n { | } - \use_ii:nn #2 - \__regex_show_pop: - \__regex_show_one:n - { `-group~end \__regex_msg_repeated:nnN {#3} {#4} #5 } - } -\cs_set:Npn \__regex_show_class:NnnnN #1#2#3#4#5 - { - \__tl_build:Nw \l__regex_internal_a_tl - \int_zero:N \l__regex_show_lines_int - \__regex_show_push:n {~} - #2 - \exp_last_unbraced:Nf - \int_case:nnF { \l__regex_show_lines_int } - { - {0} - { - \__tl_build_end: - \__regex_show_one:n { \bool_if:NTF #1 { Fail } { Pass } } - } - {1} - { - \__tl_build_end: - \bool_if:NTF #1 - { - #2 - \__tl_build_one:n { \__regex_msg_repeated:nnN {#3} {#4} #5 } - } - { - \__regex_show_one:n - { Don't~match~\__regex_msg_repeated:nnN {#3} {#4} #5 } - \__tl_build_one:o \l__regex_internal_a_tl - } - } - } - { - \__tl_build_end: - \__regex_show_one:n - { - \bool_if:NTF #1 { M } { Don't~m } atch - \__regex_msg_repeated:nnN {#3} {#4} #5 - } - \__tl_build_one:o \l__regex_internal_a_tl - } - } -\cs_new:Npn \__regex_show_anchor_to_str:N #1 - { - anchor~at~ - \str_case:nnF { #1 } - { - { \l__regex_min_pos_int } { start~(\iow_char:N\\A) } - { \l__regex_start_pos_int } { start~of~match~(\iow_char:N\\G) } - { \l__regex_max_pos_int } { end~(\iow_char:N\\Z) } - } - { <error:~'#1'~not~recognized> } - } -\cs_new_protected:Npn \__regex_show_item_catcode:NnT #1#2 - { - \seq_set_split:Nnn \l__regex_internal_seq { } { CBEMTPUDSLOA } - \seq_set_filter:NNn \l__regex_internal_seq \l__regex_internal_seq - { \int_if_odd_p:n { #2 / \int_use:c { c__regex_catcode_##1_int } } } - \__regex_show_scope:nn - { - categories~ - \seq_map_function:NN \l__regex_internal_seq \use:n - , ~ - \bool_if:NF #1 { negative~ } class - } - } -\cs_new_protected:Npn \__regex_show_item_exact_cs:n #1 - { - \seq_set_split:Nnn \l__regex_internal_seq { \scan_stop: } {#1} - \seq_set_map:NNn \l__regex_internal_seq - \l__regex_internal_seq { \iow_char:N\\##1 } - \__regex_show_one:n - { control~sequence~ \seq_use:Nn \l__regex_internal_seq { ~or~ } } - } -\int_new:N \l__regex_min_state_int -\int_set:Nn \l__regex_min_state_int { 1 } -\int_new:N \l__regex_max_state_int -\int_new:N \l__regex_left_state_int -\int_new:N \l__regex_right_state_int -\seq_new:N \l__regex_left_state_seq -\seq_new:N \l__regex_right_state_seq -\int_new:N \l__regex_capturing_group_int -\cs_new_protected:Npn \__regex_build:n #1 - { - \__regex_compile:n {#1} - \__regex_build:N \l__regex_internal_regex - } -\cs_new_protected:Npn \__regex_build:N #1 - { - \trace_push:nnn { regex } { 1 } { __regex_build } - \__regex_standard_escapechar: - \int_zero:N \l__regex_capturing_group_int - \int_set_eq:NN \l__regex_max_state_int \l__regex_min_state_int - \__regex_build_new_state: - \__regex_build_new_state: - \__regex_toks_put_right:Nn \l__regex_left_state_int - { \__regex_action_start_wildcard: } - \__regex_group:nnnN {#1} { 1 } { 0 } \c_false_bool - \__regex_toks_put_right:Nn \l__regex_right_state_int - { \__regex_action_success: } - \__regex_trace_states:n { 2 } - \trace_pop:nnn { regex } { 1 } { __regex_build } - } -\cs_new_protected:Npn \__regex_build_for_cs:n #1 - { - \trace_push:nnn { regex } { 1 } { __regex_build_for_cs } - \int_set_eq:NN \l__regex_max_state_int \l__regex_min_state_int - \__regex_build_new_state: - \__regex_build_new_state: - \__regex_push_lr_states: - #1 - \__regex_pop_lr_states: - \__regex_toks_put_right:Nn \l__regex_right_state_int - { - \if_int_compare:w \l__regex_current_pos_int = \l__regex_max_pos_int - \exp_after:wN \__regex_action_success: - \fi: - } - \__regex_trace_states:n { 2 } - \trace_pop:nnn { regex } { 1 } { __regex_build_for_cs } - } -\cs_new_protected:Npn \__regex_push_lr_states: - { - \seq_push:No \l__regex_left_state_seq - { \int_use:N \l__regex_left_state_int } - \seq_push:No \l__regex_right_state_seq - { \int_use:N \l__regex_right_state_int } - } -\cs_new_protected:Npn \__regex_pop_lr_states: - { - \seq_pop:NN \l__regex_left_state_seq \l__regex_internal_a_tl - \int_set:Nn \l__regex_left_state_int \l__regex_internal_a_tl - \seq_pop:NN \l__regex_right_state_seq \l__regex_internal_a_tl - \int_set:Nn \l__regex_right_state_int \l__regex_internal_a_tl - } -\cs_new_protected:Npn \__regex_build_transition_left:NNN #1#2#3 - { \__regex_toks_put_left:Nx #2 { #1 { \int_eval:n { #3 - #2 } } } } -\cs_new_protected:Npn \__regex_build_transition_right:nNn #1#2#3 - { \__regex_toks_put_right:Nx #2 { #1 { \int_eval:n { #3 - #2 } } } } -\cs_new_protected:Npn \__regex_build_new_state: - { - \trace:nnx { regex } { 2 } - { - regex~new~state~ - L=\int_use:N \l__regex_left_state_int ~ -> ~ - R=\int_use:N \l__regex_right_state_int ~ -> ~ - M=\int_use:N \l__regex_max_state_int ~ -> ~ - \int_eval:n { \l__regex_max_state_int + 1 } - } - \__regex_toks_clear:N \l__regex_max_state_int - \int_set_eq:NN \l__regex_left_state_int \l__regex_right_state_int - \int_set_eq:NN \l__regex_right_state_int \l__regex_max_state_int - \int_incr:N \l__regex_max_state_int - } -\cs_new_protected:Npn \__regex_build_transitions_lazyness:NNNNN #1#2#3#4#5 - { - \__regex_build_new_state: - \__regex_toks_put_right:Nx \l__regex_left_state_int - { - \if_meaning:w \c_true_bool #1 - #2 { \int_eval:n { #3 - \l__regex_left_state_int } } - #4 { \int_eval:n { #5 - \l__regex_left_state_int } } - \else: - #4 { \int_eval:n { #5 - \l__regex_left_state_int } } - #2 { \int_eval:n { #3 - \l__regex_left_state_int } } - \fi: - } - } -\cs_new_protected:Npn \__regex_class:NnnnN #1#2#3#4#5 - { - \cs_set:Npx \__regex_tests_action_cost:n ##1 - { - \exp_not:n { \exp_not:n {#2} } - \bool_if:NTF #1 - { \__regex_break_point:TF { \__regex_action_cost:n {##1} } { } } - { \__regex_break_point:TF { } { \__regex_action_cost:n {##1} } } - } - \if_case:w - #4 \exp_stop_f: - \__regex_class_repeat:n {#3} - \or: \__regex_class_repeat:nN {#3} #5 - \else: \__regex_class_repeat:nnN {#3} {#4} #5 - \fi: - } -\cs_new:Npn \__regex_tests_action_cost:n { \__regex_action_cost:n } -\cs_new_protected:Npn \__regex_class_repeat:n #1 - { - \prg_replicate:nn {#1} - { - \__regex_build_new_state: - \__regex_build_transition_right:nNn \__regex_tests_action_cost:n - \l__regex_left_state_int \l__regex_right_state_int - } - } -\cs_new_protected:Npn \__regex_class_repeat:nN #1#2 - { - \if_int_compare:w #1 = 0 \exp_stop_f: - \__regex_build_transitions_lazyness:NNNNN #2 - \__regex_action_free:n \l__regex_right_state_int - \__regex_tests_action_cost:n \l__regex_left_state_int - \else: - \__regex_class_repeat:n {#1} - \int_set_eq:NN \l__regex_internal_a_int \l__regex_left_state_int - \__regex_build_transitions_lazyness:NNNNN #2 - \__regex_action_free:n \l__regex_right_state_int - \__regex_action_free:n \l__regex_internal_a_int - \fi: - } -\cs_new_protected:Npn \__regex_class_repeat:nnN #1#2#3 - { - \__regex_class_repeat:n {#1} - \int_set:Nn \l__regex_internal_a_int - { \l__regex_max_state_int + #2 - 1 } - \prg_replicate:nn { #2 } - { - \__regex_build_transitions_lazyness:NNNNN #3 - \__regex_action_free:n \l__regex_internal_a_int - \__regex_tests_action_cost:n \l__regex_right_state_int - } - } -\cs_new_protected:Npn \__regex_group_aux:nnnnN #1#2#3#4#5 - { - \trace_push:nnn { regex } { 1 } { __regex_group } - \if_int_compare:w #3 = 0 \exp_stop_f: - \__regex_build_new_state: - \__regex_build_transition_right:nNn \__regex_action_free_group:n - \l__regex_left_state_int \l__regex_right_state_int - \fi: - \__regex_build_new_state: - \__regex_push_lr_states: - #2 - \__regex_pop_lr_states: - \if_case:w - #4 \exp_stop_f: - \__regex_group_repeat:nn {#1} {#3} - \or: \__regex_group_repeat:nnN {#1} {#3} #5 - \else: \__regex_group_repeat:nnnN {#1} {#3} {#4} #5 - \fi: - \trace_pop:nnn { regex } { 1 } { __regex_group } - } -\cs_new_protected:Npn \__regex_group:nnnN #1 - { - \exp_args:No \__regex_group_aux:nnnnN - { \int_use:N \l__regex_capturing_group_int } - { - \int_incr:N \l__regex_capturing_group_int - #1 - } - } -\cs_new_protected:Npn \__regex_group_no_capture:nnnN - { \__regex_group_aux:nnnnN { -1 } } -\cs_new_protected:Npn \__regex_group_resetting:nnnN #1 - { - \__regex_group_aux:nnnnN { -1 } - { - \exp_args:Noo \__regex_group_resetting_loop:nnNn - { \int_use:N \l__regex_capturing_group_int } - { \int_use:N \l__regex_capturing_group_int } - #1 - { ?? \__prg_break:n } { } - \__prg_break_point: - } - } -\cs_new_protected:Npn \__regex_group_resetting_loop:nnNn #1#2#3#4 - { - \use_none:nn #3 { \int_set:Nn \l__regex_capturing_group_int {#1} } - \int_set:Nn \l__regex_capturing_group_int {#2} - #3 {#4} - \exp_args:Nf \__regex_group_resetting_loop:nnNn - { \int_max:nn {#1} { \l__regex_capturing_group_int } } - {#2} - } -\cs_new_protected:Npn \__regex_branch:n #1 - { - \trace_push:nnn { regex } { 1 } { __regex_branch } - \__regex_build_new_state: - \seq_get:NN \l__regex_left_state_seq \l__regex_internal_a_tl - \int_set:Nn \l__regex_left_state_int \l__regex_internal_a_tl - \__regex_build_transition_right:nNn \__regex_action_free:n - \l__regex_left_state_int \l__regex_right_state_int - #1 - \seq_get:NN \l__regex_right_state_seq \l__regex_internal_a_tl - \__regex_build_transition_right:nNn \__regex_action_free:n - \l__regex_right_state_int \l__regex_internal_a_tl - \trace_pop:nnn { regex } { 1 } { __regex_branch } - } -\cs_new_protected:Npn \__regex_group_repeat:nn #1#2 - { - \if_int_compare:w #2 = 0 \exp_stop_f: - \int_set:Nn \l__regex_max_state_int - { \l__regex_left_state_int - 1 } - \__regex_build_new_state: - \else: - \__regex_group_repeat_aux:n {#2} - \__regex_group_submatches:nNN {#1} - \l__regex_internal_a_int \l__regex_right_state_int - \__regex_build_new_state: - \fi: - } -\cs_new_protected:Npn \__regex_group_submatches:nNN #1#2#3 - { - \if_int_compare:w #1 > - 1 \exp_stop_f: - \__regex_toks_put_left:Nx #2 { \__regex_action_submatch:n { #1 < } } - \__regex_toks_put_left:Nx #3 { \__regex_action_submatch:n { #1 > } } - \fi: - } -\cs_new_protected:Npn \__regex_group_repeat_aux:n #1 - { - \__regex_build_transition_right:nNn \__regex_action_free:n - \l__regex_right_state_int \l__regex_max_state_int - \int_set_eq:NN \l__regex_internal_a_int \l__regex_left_state_int - \int_set_eq:NN \l__regex_internal_b_int \l__regex_max_state_int - \if_int_compare:w \__int_eval:w #1 > 1 \exp_stop_f: - \int_set:Nn \l__regex_internal_c_int - { - ( #1 - 1 ) - * ( \l__regex_internal_b_int - \l__regex_internal_a_int ) - } - \int_add:Nn \l__regex_right_state_int { \l__regex_internal_c_int } - \int_add:Nn \l__regex_max_state_int { \l__regex_internal_c_int } - \__regex_toks_memcpy:NNn - \l__regex_internal_b_int - \l__regex_internal_a_int - \l__regex_internal_c_int - \fi: - } -\cs_new_protected:Npn \__regex_group_repeat:nnN #1#2#3 - { - \if_int_compare:w #2 = 0 \exp_stop_f: - \__regex_group_submatches:nNN {#1} - \l__regex_left_state_int \l__regex_right_state_int - \int_set:Nn \l__regex_internal_a_int - { \l__regex_left_state_int - 1 } - \__regex_build_transition_right:nNn \__regex_action_free:n - \l__regex_right_state_int \l__regex_internal_a_int - \__regex_build_new_state: - \if_meaning:w \c_true_bool #3 - \__regex_build_transition_left:NNN \__regex_action_free:n - \l__regex_internal_a_int \l__regex_right_state_int - \else: - \__regex_build_transition_right:nNn \__regex_action_free:n - \l__regex_internal_a_int \l__regex_right_state_int - \fi: - \else: - \__regex_group_repeat_aux:n {#2} - \__regex_group_submatches:nNN {#1} - \l__regex_internal_a_int \l__regex_right_state_int - \if_meaning:w \c_true_bool #3 - \__regex_build_transition_right:nNn \__regex_action_free_group:n - \l__regex_right_state_int \l__regex_internal_a_int - \else: - \__regex_build_transition_left:NNN \__regex_action_free_group:n - \l__regex_right_state_int \l__regex_internal_a_int - \fi: - \__regex_build_new_state: - \fi: - } -\cs_new_protected:Npn \__regex_group_repeat:nnnN #1#2#3#4 - { - \__regex_group_submatches:nNN {#1} - \l__regex_left_state_int \l__regex_right_state_int - \__regex_group_repeat_aux:n { #2 + #3 } - \if_meaning:w \c_true_bool #4 - \int_set_eq:NN \l__regex_left_state_int \l__regex_max_state_int - \prg_replicate:nn { #3 } - { - \int_sub:Nn \l__regex_left_state_int - { \l__regex_internal_b_int - \l__regex_internal_a_int } - \__regex_build_transition_left:NNN \__regex_action_free:n - \l__regex_left_state_int \l__regex_max_state_int - } - \else: - \prg_replicate:nn { #3 - 1 } - { - \int_sub:Nn \l__regex_right_state_int - { \l__regex_internal_b_int - \l__regex_internal_a_int } - \__regex_build_transition_right:nNn \__regex_action_free:n - \l__regex_right_state_int \l__regex_max_state_int - } - \if_int_compare:w #2 = 0 \exp_stop_f: - \int_set:Nn \l__regex_right_state_int - { \l__regex_left_state_int - 1 } - \else: - \int_sub:Nn \l__regex_right_state_int - { \l__regex_internal_b_int - \l__regex_internal_a_int } - \fi: - \__regex_build_transition_right:nNn \__regex_action_free:n - \l__regex_right_state_int \l__regex_max_state_int - \fi: - \__regex_build_new_state: - } -\cs_new_protected:Npn \__regex_assertion:Nn #1#2 - { - \__regex_build_new_state: - \__regex_toks_put_right:Nx \l__regex_left_state_int - { - \exp_not:n {#2} - \__regex_break_point:TF - \bool_if:NF #1 { { } } - { - \__regex_action_free:n - { - \int_eval:n - { \l__regex_right_state_int - \l__regex_left_state_int } - } - } - \bool_if:NT #1 { { } } - } - } -\cs_new_protected:Npn \__regex_anchor:N #1 - { - \if_int_compare:w #1 = \l__regex_current_pos_int - \exp_after:wN \__regex_break_true:w - \fi: - } -\cs_new_protected:Npn \__regex_b_test: - { - \group_begin: - \int_set_eq:NN \l__regex_current_char_int \l__regex_last_char_int - \__regex_prop_w: - \__regex_break_point:TF - { \group_end: \__regex_item_reverse:n \__regex_prop_w: } - { \group_end: \__regex_prop_w: } - } -\cs_new_protected:Npn \__regex_command_K: - { - \__regex_build_new_state: - \__regex_toks_put_right:Nx \l__regex_left_state_int - { - \__regex_action_submatch:n { 0< } - \bool_set_true:N \l__regex_fresh_thread_bool - \__regex_action_free:n - { \int_eval:n { \l__regex_right_state_int - \l__regex_left_state_int } } - \bool_set_false:N \l__regex_fresh_thread_bool - } - } -\int_new:N \l__regex_min_pos_int -\int_new:N \l__regex_max_pos_int -\int_new:N \l__regex_current_pos_int -\int_new:N \l__regex_start_pos_int -\int_new:N \l__regex_success_pos_int -\int_new:N \l__regex_current_char_int -\int_new:N \l__regex_current_catcode_int -\int_new:N \l__regex_last_char_int -\int_new:N \l__regex_case_changed_char_int -\int_new:N \l__regex_current_state_int -\prop_new:N \l__regex_current_submatches_prop -\prop_new:N \l__regex_success_submatches_prop -\int_new:N \l__regex_step_int -\int_new:N \l__regex_min_active_int -\int_new:N \l__regex_max_active_int -\__intarray_new:Nn \g__regex_state_active_intarray { 65536 } -\__intarray_new:Nn \g__regex_thread_state_intarray { 65536 } -\tl_new:N \l__regex_every_match_tl -\bool_new:N \l__regex_fresh_thread_bool -\bool_new:N \l__regex_empty_success_bool -\cs_new_eq:NN \__regex_if_two_empty_matches:F \use:n -\bool_new:N \g__regex_success_bool -\bool_new:N \l__regex_saved_success_bool -\bool_new:N \l__regex_match_success_bool -\cs_new_protected:Npn \__regex_match:n #1 - { - \trace_push:nnx { regex } { 1 } { __regex_match } - \trace:nnx { regex } { 1 } { analyzing~query~token~list } - \int_zero:N \l__regex_balance_int - \int_set:Nn \l__regex_current_pos_int { 2 * \l__regex_max_state_int } - \__regex_query_set:nnn { } { -1 } { -2 } - \int_set_eq:NN \l__regex_min_pos_int \l__regex_current_pos_int - \__tl_analysis_map_inline:nn {#1} - { \__regex_query_set:nnn {##1} {"##2} {##3} } - \int_set_eq:NN \l__regex_max_pos_int \l__regex_current_pos_int - \__regex_query_set:nnn { } { -1 } { -2 } - \trace:nnx { regex } { 1 } { initializing } - \bool_gset_false:N \g__regex_success_bool - \int_step_inline:nnnn - \l__regex_min_state_int { 1 } { \l__regex_max_state_int - 1 } - { \__intarray_gset_fast:Nnn \g__regex_state_active_intarray {##1} { 1 } } - \int_set_eq:NN \l__regex_min_active_int \l__regex_max_state_int - \int_zero:N \l__regex_step_int - \int_set_eq:NN \l__regex_success_pos_int \l__regex_min_pos_int - \int_set:Nn \l__regex_min_submatch_int - { 2 * \l__regex_max_state_int } - \int_set_eq:NN \l__regex_submatch_int \l__regex_min_submatch_int - \bool_set_false:N \l__regex_empty_success_bool - \__regex_match_once: - \trace_pop:nnx { regex } { 1 } { __regex_match } - } -\cs_new_protected:Npn \__regex_match_once: - { - \if_meaning:w \c_true_bool \l__regex_empty_success_bool - \cs_set:Npn \__regex_if_two_empty_matches:F - { \int_compare:nNnF \l__regex_start_pos_int = \l__regex_current_pos_int } - \else: - \cs_set_eq:NN \__regex_if_two_empty_matches:F \use:n - \fi: - \int_set_eq:NN \l__regex_start_pos_int \l__regex_success_pos_int - \bool_set_false:N \l__regex_match_success_bool - \prop_clear:N \l__regex_current_submatches_prop - \int_set_eq:NN \l__regex_max_active_int \l__regex_min_active_int - \__regex_store_state:n { \l__regex_min_state_int } - \int_set:Nn \l__regex_current_pos_int - { \l__regex_start_pos_int - 1 } - \__regex_query_get: - \__regex_match_loop: - \l__regex_every_match_tl - } -\cs_new_protected:Npn \__regex_single_match: - { - \tl_set:Nn \l__regex_every_match_tl - { \bool_gset_eq:NN \g__regex_success_bool \l__regex_match_success_bool } - } -\cs_new_protected:Npn \__regex_multi_match:n #1 - { - \tl_set:Nn \l__regex_every_match_tl - { - \if_meaning:w \c_true_bool \l__regex_match_success_bool - \bool_gset_true:N \g__regex_success_bool - #1 - \exp_after:wN \__regex_match_once: - \fi: - } - } -\cs_new_protected:Npn \__regex_match_loop: - { - \int_add:Nn \l__regex_step_int { 2 } - \int_incr:N \l__regex_current_pos_int - \int_set_eq:NN \l__regex_last_char_int \l__regex_current_char_int - \int_set_eq:NN \l__regex_case_changed_char_int \c_max_int - \__regex_query_get: - \use:x - { - \int_set_eq:NN \l__regex_max_active_int \l__regex_min_active_int - \int_step_function:nnnN - { \l__regex_min_active_int } - { 1 } - { \l__regex_max_active_int - 1 } - \__regex_match_one_active:n - } - \__prg_break_point: - \bool_set_false:N \l__regex_fresh_thread_bool %^^A was arg of break_point:n - \if_int_compare:w \l__regex_max_active_int > \l__regex_min_active_int - \if_int_compare:w \l__regex_current_pos_int < \l__regex_max_pos_int - \exp_after:wN \exp_after:wN \exp_after:wN \__regex_match_loop: - \fi: - \fi: - } -\cs_new:Npn \__regex_match_one_active:n #1 - { - \__regex_use_state_and_submatches:nn - { \__intarray_item_fast:Nn \g__regex_thread_state_intarray {#1} } - { \__regex_toks_use:w #1 } - } -\cs_new_protected:Npn \__regex_query_set:nnn #1#2#3 - { - \__intarray_gset_fast:Nnn \g__regex_charcode_intarray - { \l__regex_current_pos_int } {#3} - \__intarray_gset_fast:Nnn \g__regex_catcode_intarray - { \l__regex_current_pos_int } {#2} - \__intarray_gset_fast:Nnn \g__regex_balance_intarray - { \l__regex_current_pos_int } { \l__regex_balance_int } - \__regex_toks_set:Nn \l__regex_current_pos_int {#1} - \int_incr:N \l__regex_current_pos_int - \if_case:w #2 \exp_stop_f: - \or: \int_incr:N \l__regex_balance_int - \or: \int_decr:N \l__regex_balance_int - \fi: - } -\cs_new_protected:Npn \__regex_query_get: - { - \l__regex_current_char_int - = \__intarray_item_fast:Nn \g__regex_charcode_intarray - { \l__regex_current_pos_int } \scan_stop: - \l__regex_current_catcode_int - = \__intarray_item_fast:Nn \g__regex_catcode_intarray - { \l__regex_current_pos_int } \scan_stop: - } -\cs_new_protected:Npn \__regex_use_state: - { - \trace:nnx { regex } { 2 } { state~\int_use:N \l__regex_current_state_int } - \__intarray_gset_fast:Nnn \g__regex_state_active_intarray - { \l__regex_current_state_int } { \l__regex_step_int } - \__regex_toks_use:w \l__regex_current_state_int - \__intarray_gset_fast:Nnn \g__regex_state_active_intarray - { \l__regex_current_state_int } { \l__regex_step_int + 1 } - } -\cs_new_protected:Npn \__regex_use_state_and_submatches:nn #1 #2 - { - \int_set:Nn \l__regex_current_state_int {#1} - \if_int_compare:w - \__intarray_item_fast:Nn \g__regex_state_active_intarray - { \l__regex_current_state_int } - < \l__regex_step_int - \tl_set:Nn \l__regex_current_submatches_prop {#2} - \exp_after:wN \__regex_use_state: - \fi: - \scan_stop: - } -\cs_new_protected:Npn \__regex_action_start_wildcard: - { - \bool_set_true:N \l__regex_fresh_thread_bool - \__regex_action_free:n {1} - \bool_set_false:N \l__regex_fresh_thread_bool - \__regex_action_cost:n {0} - } -\cs_new_protected:Npn \__regex_action_free:n - { \__regex_action_free_aux:nn { > \l__regex_step_int \else: } } -\cs_new_protected:Npn \__regex_action_free_group:n - { \__regex_action_free_aux:nn { < \l__regex_step_int } } -\cs_new_protected:Npn \__regex_action_free_aux:nn #1#2 - { - \use:x - { - \int_add:Nn \l__regex_current_state_int {#2} - \exp_not:n - { - \if_int_compare:w - \__intarray_item_fast:Nn \g__regex_state_active_intarray - { \l__regex_current_state_int } - #1 - \exp_after:wN \__regex_use_state: - \fi: - } - \int_set:Nn \l__regex_current_state_int - { \int_use:N \l__regex_current_state_int } - \tl_set:Nn \exp_not:N \l__regex_current_submatches_prop - { \exp_not:o \l__regex_current_submatches_prop } - } - } -\cs_new_protected:Npn \__regex_action_cost:n #1 - { - \exp_args:No \__regex_store_state:n - { \__int_value:w \__int_eval:w \l__regex_current_state_int + #1 } - } -\cs_new_protected:Npn \__regex_store_state:n #1 - { - \__regex_store_submatches: - \__intarray_gset_fast:Nnn \g__regex_thread_state_intarray - { \l__regex_max_active_int } {#1} - \int_incr:N \l__regex_max_active_int - } -\cs_new_protected:Npn \__regex_store_submatches: - { - \__regex_toks_set:No \l__regex_max_active_int - { \l__regex_current_submatches_prop } - } -\cs_new_protected:Npn \__regex_disable_submatches: - { - \cs_set_protected:Npn \__regex_store_submatches: { } - \cs_set_protected:Npn \__regex_action_submatch:n ##1 { } - } -\cs_new_protected:Npn \__regex_action_submatch:n #1 - { - \prop_put:Nno \l__regex_current_submatches_prop {#1} - { \int_use:N \l__regex_current_pos_int } - } -\cs_new_protected:Npn \__regex_action_success: - { - \__regex_if_two_empty_matches:F - { - \bool_set_true:N \l__regex_match_success_bool - \bool_set_eq:NN \l__regex_empty_success_bool - \l__regex_fresh_thread_bool - \int_set_eq:NN \l__regex_success_pos_int \l__regex_current_pos_int - \prop_set_eq:NN \l__regex_success_submatches_prop - \l__regex_current_submatches_prop - \__prg_break: - } - } -\int_new:N \l__regex_replacement_csnames_int -\tl_new:N \l__regex_replacement_category_tl -\seq_new:N \l__regex_replacement_category_seq -\tl_new:N \l__regex_balance_tl -\cs_new:Npn \__regex_replacement_balance_one_match:n #1 - { - \__regex_submatch_balance:n {#1} } -\cs_new:Npn \__regex_replacement_do_one_match:n #1 - { - \__regex_query_range:nn - { \__intarray_item_fast:Nn \g__regex_submatch_prev_intarray {#1} } - { \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray {#1} } - } -\cs_new:Npn \__regex_replacement_exp_not:N #1 { \exp_not:n {#1} } -\cs_new:Npn \__regex_query_range:nn #1#2 - { - \exp_after:wN \__regex_query_range_loop:ww - \__int_value:w \__int_eval:w #1 \exp_after:wN ; - \__int_value:w \__int_eval:w #2 ; - \__prg_break_point: - } -\cs_new:Npn \__regex_query_range_loop:ww #1 ; #2 ; - { - \if_int_compare:w #1 < #2 \exp_stop_f: - \else: - \exp_after:wN \__prg_break: - \fi: - \__regex_toks_use:w #1 \exp_stop_f: - \exp_after:wN \__regex_query_range_loop:ww - \__int_value:w \__int_eval:w #1 + 1 ; #2 ; - } -\cs_new:Npn \__regex_query_submatch:n #1 - { - \__regex_query_range:nn - { \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray {#1} } - { \__intarray_item_fast:Nn \g__regex_submatch_end_intarray {#1} } - } -\cs_new_protected:Npn \__regex_submatch_balance:n #1 - { - \__int_eval:w - \int_compare:nNnTF - { \__intarray_item_fast:Nn \g__regex_submatch_end_intarray {#1} } = 0 - { 0 } - { - \__intarray_item_fast:Nn \g__regex_balance_intarray - { \__intarray_item_fast:Nn \g__regex_submatch_end_intarray {#1} } - } - - - \int_compare:nNnTF - { \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray {#1} } = 0 - { 0 } - { - \__intarray_item_fast:Nn \g__regex_balance_intarray - { \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray {#1} } - } - \__int_eval_end: - } -\cs_new_protected:Npn \__regex_replacement:n #1 - { - \trace_push:nnn { regex } { 1 } { __regex_replacement:n } - \__tl_build:Nw \l__regex_internal_a_tl - \int_zero:N \l__regex_balance_int - \tl_clear:N \l__regex_balance_tl - \__regex_escape_use:nnnn - { - \if_charcode:w \c_right_brace_str ##1 - \__regex_replacement_rbrace:N - \else: - \__regex_replacement_normal:n - \fi: - ##1 - } - { \__regex_replacement_escaped:N ##1 } - { \__regex_replacement_normal:n ##1 } - {#1} - \prg_do_nothing: \prg_do_nothing: - \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: - \__msg_kernel_error:nnx { regex } { replacement-missing-rbrace } - { \int_use:N \l__regex_replacement_csnames_int } - \__tl_build_one:x - { \prg_replicate:nn \l__regex_replacement_csnames_int \cs_end: } - \fi: - \seq_if_empty:NF \l__regex_replacement_category_seq - { - \__msg_kernel_error:nnx { regex } { replacement-missing-rparen } - { \seq_count:N \l__regex_replacement_category_seq } - \seq_clear:N \l__regex_replacement_category_seq - } - \cs_gset:Npx \__regex_replacement_balance_one_match:n ##1 - { - + \int_use:N \l__regex_balance_int - \l__regex_balance_tl - - \__regex_submatch_balance:n {##1} - } - \__tl_build_end: - \exp_args:No \__regex_replacement_aux:n \l__regex_internal_a_tl - \trace_pop:nnn { regex } { 1 } { __regex_replacement:n } - } -\cs_new_protected:Npn \__regex_replacement_aux:n #1 - { - \cs_set:Npn \__regex_replacement_do_one_match:n ##1 - { - \__regex_query_range:nn - { \__intarray_item_fast:Nn \g__regex_submatch_prev_intarray {##1} } - { \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray {##1} } - #1 - } - } -\cs_new_protected:Npn \__regex_replacement_normal:n #1 - { - \tl_if_empty:NTF \l__regex_replacement_category_tl - { \__tl_build_one:n {#1} } - { % ( - \token_if_eq_charcode:NNTF #1 ) - { - \seq_pop:NN \l__regex_replacement_category_seq - \l__regex_replacement_category_tl - } - { - \use:c { __regex_replacement_c_ \l__regex_replacement_category_tl :w } - \__regex_replacement_normal:n {#1} - } - } - } -\cs_new_protected:Npn \__regex_replacement_escaped:N #1 - { - \cs_if_exist_use:cF { __regex_replacement_#1:w } - { - \if_int_compare:w 1 < 1#1 \exp_stop_f: - \__regex_replacement_put_submatch:n {#1} - \else: - \exp_args:No \__regex_replacement_normal:n - { \token_to_str:N #1 } - \fi: - } - } -\cs_new_protected:Npn \__regex_replacement_put_submatch:n #1 - { - \if_int_compare:w #1 < \l__regex_capturing_group_int - \__tl_build_one:n { \__regex_query_submatch:n { #1 + ##1 } } - \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: - \tl_put_right:Nn \l__regex_balance_tl - { + \__regex_submatch_balance:n { \__int_eval:w #1+##1 \__int_eval_end: } } - \fi: - \fi: - } -\cs_new_protected:Npn \__regex_replacement_g:w #1#2 - { - \str_if_eq_x:nnTF { #1#2 } { \__regex_replacement_normal:n \c_left_brace_str } - { \l__regex_internal_a_int = \__regex_replacement_g_digits:NN } - { \__regex_replacement_error:NNN g #1 #2 } - } -\cs_new:Npn \__regex_replacement_g_digits:NN #1#2 - { - \token_if_eq_meaning:NNTF #1 \__regex_replacement_normal:n - { - \if_int_compare:w 1 < 1#2 \exp_stop_f: - #2 - \exp_after:wN \use_i:nnn - \exp_after:wN \__regex_replacement_g_digits:NN - \else: - \exp_stop_f: - \exp_after:wN \__regex_replacement_error:NNN - \exp_after:wN g - \fi: - } - { - \exp_stop_f: - \if_meaning:w \__regex_replacement_rbrace:N #1 - \exp_args:No \__regex_replacement_put_submatch:n - { \int_use:N \l__regex_internal_a_int } - \exp_after:wN \use_none:nn - \else: - \exp_after:wN \__regex_replacement_error:NNN - \exp_after:wN g - \fi: - } - #1 #2 - } -\cs_new_protected:Npn \__regex_replacement_c:w #1#2 - { - \token_if_eq_meaning:NNTF #1 \__regex_replacement_normal:n - { - \exp_after:wN \token_if_eq_charcode:NNTF \c_left_brace_str #2 - { \__regex_replacement_cu_aux:Nw \__regex_replacement_exp_not:N } - { - \cs_if_exist:cTF { __regex_replacement_c_#2:w } - { \__regex_replacement_cat:NNN #2 } - { \__regex_replacement_error:NNN c #1#2 } - } - } - { \__regex_replacement_error:NNN c #1#2 } - } -\cs_new_protected:Npn \__regex_replacement_cu_aux:Nw #1 - { - \if_case:w \l__regex_replacement_csnames_int - \__tl_build_one:n { \exp_not:n { \exp_after:wN #1 \cs:w } } - \else: - \__tl_build_one:n { \exp_not:n { \exp_after:wN \tl_to_str:V \cs:w } } - \fi: - \int_incr:N \l__regex_replacement_csnames_int - } -\cs_new_protected:Npn \__regex_replacement_u:w #1#2 - { - \str_if_eq_x:nnTF { #1#2 } { \__regex_replacement_normal:n \c_left_brace_str } - { \__regex_replacement_cu_aux:Nw \exp_not:V } - { \__regex_replacement_error:NNN u #1#2 } - } -\cs_new_protected:Npn \__regex_replacement_rbrace:N #1 - { - \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: - \__tl_build_one:n \cs_end: - \int_decr:N \l__regex_replacement_csnames_int - \else: - \__regex_replacement_normal:n {#1} - \fi: - } -\cs_new_protected:Npn \__regex_replacement_cat:NNN #1#2#3 - { - \token_if_eq_meaning:NNTF \prg_do_nothing: #3 - { \__msg_kernel_error:nn { regex } { replacement-catcode-end } } - { - \int_compare:nNnTF { \l__regex_replacement_csnames_int } > 0 - { - \__msg_kernel_error:nnnn - { regex } { replacement-catcode-in-cs } {#1} {#3} - #2 #3 - } - { - \str_if_eq:nnTF { #2 #3 } { \__regex_replacement_normal:n ( } % ) - { - \seq_push:NV \l__regex_replacement_category_seq - \l__regex_replacement_category_tl - \tl_set:Nn \l__regex_replacement_category_tl {#1} - } - { \use:c { __regex_replacement_c_#1:w } #2 #3 } - } - } - } -\group_begin: - \cs_new_protected:Npn \__regex_replacement_char:nNN #1#2#3 - { - \tex_lccode:D 0 = `#3 \scan_stop: - \tex_lowercase:D { \__tl_build_one:n {#1} } - } - \char_set_catcode_active:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_A:w - { \__regex_replacement_char:nNN { \exp_not:n { \exp_not:N ^^@ } } } - \char_set_catcode_group_begin:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_B:w - { - \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: - \int_incr:N \l__regex_balance_int - \fi: - \__regex_replacement_char:nNN - { \exp_not:n { \exp_after:wN ^^@ \if_false: } \fi: } } - } - \cs_new_protected:Npn \__regex_replacement_c_C:w #1#2 - { \__tl_build_one:n { \exp_not:N \exp_not:N \exp_not:c {#2} } } - \char_set_catcode_math_subscript:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_D:w - { \__regex_replacement_char:nNN { ^^@ } } - \char_set_catcode_group_end:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_E:w - { - \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: - \int_decr:N \l__regex_balance_int - \fi: - \__regex_replacement_char:nNN - { \exp_not:n { \if_false: { \fi: ^^@ } } - } - \char_set_catcode_letter:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_L:w - { \__regex_replacement_char:nNN { ^^@ } } - \char_set_catcode_math_toggle:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_M:w - { \__regex_replacement_char:nNN { ^^@ } } - \char_set_catcode_other:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_O:w - { \__regex_replacement_char:nNN { ^^@ } } - \char_set_catcode_parameter:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_P:w - { - \__regex_replacement_char:nNN - { \exp_not:n { \exp_not:n { ^^@^^@^^@^^@ } } } - } - \cs_new_protected:Npn \__regex_replacement_c_S:w #1#2 - { - \if_int_compare:w `#2 = 0 \exp_stop_f: - \__msg_kernel_error:nn { regex } { replacement-null-space } - \fi: - \tex_lccode:D `\ = `#2 \scan_stop: - \tex_lowercase:D { \__tl_build_one:n {~} } - } - \char_set_catcode_alignment:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_T:w - { \__regex_replacement_char:nNN { ^^@ } } - \char_set_catcode_math_superscript:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_U:w - { \__regex_replacement_char:nNN { ^^@ } } -\group_end: -\cs_new_protected:Npn \__regex_replacement_error:NNN #1#2#3 - { - \__msg_kernel_error:nnx { regex } { replacement-#1 } {#3} - #2 #3 - } -\cs_new_protected:Npn \regex_new:N #1 - { \cs_new_eq:NN #1 \c__regex_no_match_regex } -\cs_new_protected:Npn \regex_set:Nn #1#2 - { - \__regex_compile:n {#2} - \tl_set_eq:NN #1 \l__regex_internal_regex - } -\cs_new_protected:Npn \regex_gset:Nn #1#2 - { - \__regex_compile:n {#2} - \tl_gset_eq:NN #1 \l__regex_internal_regex - } -\cs_new_protected:Npn \regex_const:Nn #1#2 - { - \__regex_compile:n {#2} - \tl_const:Nx #1 { \exp_not:o \l__regex_internal_regex } - } -\cs_new_protected:Npn \regex_show:n #1 - { - \__regex_compile:n {#1} - \__regex_show:Nn \l__regex_internal_regex - { { \tl_to_str:n {#1} } } - } -\cs_new_protected:Npn \regex_show:N #1 - { \__regex_show:Nn #1 { variable~\token_to_str:N #1 } } -\prg_new_protected_conditional:Npnn \regex_match:nn #1#2 { T , F , TF } - { - \__regex_if_match:nn { \__regex_build:n {#1} } {#2} - \__regex_return: - } -\prg_new_protected_conditional:Npnn \regex_match:Nn #1#2 { T , F , TF } - { - \__regex_if_match:nn { \__regex_build:N #1 } {#2} - \__regex_return: - } -\cs_new_protected:Npn \regex_count:nnN #1 - { \__regex_count:nnN { \__regex_build:n {#1} } } -\cs_new_protected:Npn \regex_count:NnN #1 - { \__regex_count:nnN { \__regex_build:N #1 } } -\cs_set_protected:Npn \__regex_tmp:w #1#2#3 - { - \cs_new_protected:Npn #2 ##1 { #1 { \__regex_build:n {##1} } } - \cs_new_protected:Npn #3 ##1 { #1 { \__regex_build:N ##1 } } - \prg_new_protected_conditional:Npnn #2 ##1##2##3 { T , F , TF } - { #1 { \__regex_build:n {##1} } {##2} ##3 \__regex_return: } - \prg_new_protected_conditional:Npnn #3 ##1##2##3 { T , F , TF } - { #1 { \__regex_build:N ##1 } {##2} ##3 \__regex_return: } - } -\__regex_tmp:w \__regex_extract_once:nnN - \regex_extract_once:nnN \regex_extract_once:NnN -\__regex_tmp:w \__regex_extract_all:nnN - \regex_extract_all:nnN \regex_extract_all:NnN -\__regex_tmp:w \__regex_replace_once:nnN - \regex_replace_once:nnN \regex_replace_once:NnN -\__regex_tmp:w \__regex_replace_all:nnN - \regex_replace_all:nnN \regex_replace_all:NnN -\__regex_tmp:w \__regex_split:nnN \regex_split:nnN \regex_split:NnN -\int_new:N \l__regex_match_count_int -\flag_new:n { __regex_begin } -\flag_new:n { __regex_end } -\int_new:N \l__regex_min_submatch_int -\int_new:N \l__regex_submatch_int -\int_new:N \l__regex_zeroth_submatch_int -\__intarray_new:Nn \g__regex_submatch_prev_intarray { 65536 } -\__intarray_new:Nn \g__regex_submatch_begin_intarray { 65536 } -\__intarray_new:Nn \g__regex_submatch_end_intarray { 65536 } -\cs_new_protected:Npn \__regex_return: - { - \if_meaning:w \c_true_bool \g__regex_success_bool - \prg_return_true: - \else: - \prg_return_false: - \fi: - } -\cs_new_protected:Npn \__regex_if_match:nn #1#2 - { - \group_begin: - \__regex_disable_submatches: - \__regex_single_match: - #1 - \__regex_match:n {#2} - \group_end: - } -\cs_new_protected:Npn \__regex_count:nnN #1#2#3 - { - \group_begin: - \__regex_disable_submatches: - \int_zero:N \l__regex_match_count_int - \__regex_multi_match:n { \int_incr:N \l__regex_match_count_int } - #1 - \__regex_match:n {#2} - \exp_args:NNNo - \group_end: - \int_set:Nn #3 { \int_use:N \l__regex_match_count_int } - } -\cs_new_protected:Npn \__regex_extract_once:nnN #1#2#3 - { - \group_begin: - \__regex_single_match: - #1 - \__regex_match:n {#2} - \__regex_extract: - \__regex_group_end_extract_seq:N #3 - } -\cs_new_protected:Npn \__regex_extract_all:nnN #1#2#3 - { - \group_begin: - \__regex_multi_match:n { \__regex_extract: } - #1 - \__regex_match:n {#2} - \__regex_group_end_extract_seq:N #3 - } -\cs_new_protected:Npn \__regex_split:nnN #1#2#3 - { - \group_begin: - \__regex_multi_match:n - { - \if_int_compare:w \l__regex_start_pos_int < \l__regex_success_pos_int - \__regex_extract: - \__intarray_gset_fast:Nnn \g__regex_submatch_prev_intarray - { \l__regex_zeroth_submatch_int } { 0 } - \__intarray_gset_fast:Nnn \g__regex_submatch_end_intarray - { \l__regex_zeroth_submatch_int } - { - \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray - { \l__regex_zeroth_submatch_int } - } - \__intarray_gset_fast:Nnn \g__regex_submatch_begin_intarray - { \l__regex_zeroth_submatch_int } - { \l__regex_start_pos_int } - \fi: - } - #1 - \__regex_match:n {#2} - \__intarray_gset_fast:Nnn \g__regex_submatch_prev_intarray - { \l__regex_submatch_int } { 0 } - \__intarray_gset_fast:Nnn \g__regex_submatch_end_intarray - { \l__regex_submatch_int } - { \l__regex_max_pos_int } - \__intarray_gset_fast:Nnn \g__regex_submatch_begin_intarray - { \l__regex_submatch_int } - { \l__regex_start_pos_int } - \int_incr:N \l__regex_submatch_int - \if_meaning:w \c_true_bool \l__regex_empty_success_bool - \if_int_compare:w \l__regex_start_pos_int = \l__regex_max_pos_int - \int_decr:N \l__regex_submatch_int - \fi: - \fi: - \__regex_group_end_extract_seq:N #3 - } -\cs_new_protected:Npn \__regex_group_end_extract_seq:N #1 - { - \cs_set_eq:NN \__seq_item:n \scan_stop: - \flag_clear:n { __regex_begin } - \flag_clear:n { __regex_end } - \tl_set:Nx \l__regex_internal_a_tl - { - \s__seq - \int_step_function:nnnN - { \l__regex_min_submatch_int } - { 1 } - { \l__regex_submatch_int - 1 } - \__regex_extract_seq_aux:n - } - \int_compare:nNnF - { \flag_height:n { __regex_begin } + \flag_height:n { __regex_end } } - = 0 - { - \__msg_kernel_error:nnxxx { regex } { result-unbalanced } - { splitting~or~extracting~submatches } - { \flag_height:n { __regex_end } } - { \flag_height:n { __regex_begin } } - } - \use:x - { - \group_end: - \tl_set:Nn \exp_not:N #1 { \l__regex_internal_a_tl } - } - } -\cs_new:Npn \__regex_extract_seq_aux:n #1 - { - \__seq_item:n - { - \exp_after:wN \__regex_extract_seq_aux:ww - \__int_value:w \__regex_submatch_balance:n {#1} ; #1; - } - } -\cs_new:Npn \__regex_extract_seq_aux:ww #1; #2; - { - \if_int_compare:w #1 < 0 \exp_stop_f: - \flag_raise:n { __regex_end } - \prg_replicate:nn {-#1} { \exp_not:n { { \if_false: } \fi: } } - \fi: - \__regex_query_submatch:n {#2} - \if_int_compare:w #1 > 0 \exp_stop_f: - \flag_raise:n { __regex_begin } - \prg_replicate:nn {#1} { \exp_not:n { \if_false: { \fi: } } } - \fi: - } -\cs_new_protected:Npn \__regex_extract: - { - \if_meaning:w \c_true_bool \g__regex_success_bool - \int_set_eq:NN \l__regex_zeroth_submatch_int \l__regex_submatch_int - \prg_replicate:nn \l__regex_capturing_group_int - { - \__intarray_gset_fast:Nnn \g__regex_submatch_begin_intarray - { \l__regex_submatch_int } { 0 } - \__intarray_gset_fast:Nnn \g__regex_submatch_end_intarray - { \l__regex_submatch_int } { 0 } - \__intarray_gset_fast:Nnn \g__regex_submatch_prev_intarray - { \l__regex_submatch_int } { 0 } - \int_incr:N \l__regex_submatch_int - } - \prop_map_inline:Nn \l__regex_success_submatches_prop - { - \if_int_compare:w ##1 - 1 \exp_stop_f: - \exp_after:wN \__regex_extract_e:wn \__int_value:w - \else: - \exp_after:wN \__regex_extract_b:wn \__int_value:w - \fi: - \__int_eval:w \l__regex_zeroth_submatch_int + ##1 {##2} - } - \__intarray_gset_fast:Nnn \g__regex_submatch_prev_intarray - { \l__regex_zeroth_submatch_int } { \l__regex_start_pos_int } - \fi: - } -\cs_new_protected:Npn \__regex_extract_b:wn #1 < #2 - { \__intarray_gset_fast:Nnn \g__regex_submatch_begin_intarray {#1} {#2} } -\cs_new_protected:Npn \__regex_extract_e:wn #1 > #2 - { \__intarray_gset_fast:Nnn \g__regex_submatch_end_intarray {#1} {#2} } -\cs_new_protected:Npn \__regex_replace_once:nnN #1#2#3 - { - \group_begin: - \__regex_single_match: - #1 - \__regex_replacement:n {#2} - \exp_args:No \__regex_match:n { #3 } - \if_meaning:w \c_false_bool \g__regex_success_bool - \group_end: - \else: - \__regex_extract: - \int_set:Nn \l__regex_balance_int - { - \__regex_replacement_balance_one_match:n - { \l__regex_zeroth_submatch_int } - } - \tl_set:Nx \l__regex_internal_a_tl - { - \__regex_replacement_do_one_match:n { \l__regex_zeroth_submatch_int } - \__regex_query_range:nn - { - \__intarray_item_fast:Nn \g__regex_submatch_end_intarray - { \l__regex_zeroth_submatch_int } - } - { \l__regex_max_pos_int } - } - \__regex_group_end_replace:N #3 - \fi: - } -\cs_new_protected:Npn \__regex_replace_all:nnN #1#2#3 - { - \group_begin: - \__regex_multi_match:n { \__regex_extract: } - #1 - \__regex_replacement:n {#2} - \exp_args:No \__regex_match:n {#3} - \int_set:Nn \l__regex_balance_int - { - 0 - \int_step_function:nnnN - { \l__regex_min_submatch_int } - \l__regex_capturing_group_int - { \l__regex_submatch_int - 1 } - \__regex_replacement_balance_one_match:n - } - \tl_set:Nx \l__regex_internal_a_tl - { - \int_step_function:nnnN - { \l__regex_min_submatch_int } - \l__regex_capturing_group_int - { \l__regex_submatch_int - 1 } - \__regex_replacement_do_one_match:n - \__regex_query_range:nn - \l__regex_start_pos_int \l__regex_max_pos_int - } - \__regex_group_end_replace:N #3 - } -\cs_new_protected:Npn \__regex_group_end_replace:N #1 - { - \if_int_compare:w \l__regex_balance_int = 0 \exp_stop_f: - \else: - \__msg_kernel_error:nnxxx { regex } { result-unbalanced } - { replacing } - { \int_max:nn { - \l__regex_balance_int } { 0 } } - { \int_max:nn { \l__regex_balance_int } { 0 } } - \fi: - \use:x - { - \group_end: - \tl_set:Nn \exp_not:N #1 - { - \if_int_compare:w \l__regex_balance_int < 0 \exp_stop_f: - \prg_replicate:nn { - \l__regex_balance_int } - { { \if_false: } \fi: } - \fi: - \l__regex_internal_a_tl - \if_int_compare:w \l__regex_balance_int > 0 \exp_stop_f: - \prg_replicate:nn { \l__regex_balance_int } - { \if_false: { \fi: } } - \fi: - } - } - } -\__msg_kernel_new:nnnn { regex } { trailing-backslash } - { Trailing~escape~character~'\iow_char:N\\'. } - { - A~regular~expression~or~its~replacement~text~ends~with~ - the~escape~character~'\iow_char:N\\'.~It~will~be~ignored. - } -\__msg_kernel_new:nnnn { regex } { x-missing-rbrace } - { Missing~closing~brace~in~'\iow_char:N\\x'~hexadecimal~sequence. } - { - You~wrote~something~like~ - '\iow_char:N\\x\{...#1'.~ - The~closing~brace~is~missing. - } -\__msg_kernel_new:nnnn { regex } { x-overflow } - { Character~code~'#1'~too~large~in~'\iow_char:N\\x'~hexadecimal~sequence. } - { - You~wrote~something~like~ - '\iow_char:N\\x\{\int_to_Hex:n{#1}\}'.~ - The~character~code~#1~is~larger~than~ - the~maximum~value~\int_use:N \c_max_char_int. - } -\__msg_kernel_new:nnnn { regex } { invalid-quantifier } - { Braced~quantifier~'#1'~may~not~be~followed~by~'#2'. } - { - The~character~'#2'~is~invalid~in~the~braced~quantifier~'#1'.~ - The~only~valid~quantifiers~are~'*',~'?',~'+',~'{<int>}',~ - '{<min>,}'~and~'{<min>,<max>}',~optionally~followed~by~'?'. - } -\__msg_kernel_new:nnnn { regex } { missing-rbrack } - { Missing~right~bracket~inserted~in~regular~expression. } - { - LaTeX~was~given~a~regular~expression~where~a~character~class~ - was~started~with~'[',~but~the~matching~']'~is~missing. - } -\__msg_kernel_new:nnnn { regex } { missing-rparen } - { - Missing~right~ - \int_compare:nTF { #1 = 1 } { parenthesis } { parentheses } ~ - inserted~in~regular~expression. - } - { - LaTeX~was~given~a~regular~expression~with~\int_eval:n {#1} ~ - more~left~parentheses~than~right~parentheses. - } -\__msg_kernel_new:nnnn { regex } { extra-rparen } - { Extra~right~parenthesis~ignored~in~regular~expression. } - { - LaTeX~came~across~a~closing~parenthesis~when~no~submatch~group~ - was~open.~The~parenthesis~will~be~ignored. - } -\__msg_kernel_new:nnnn { regex } { bad-escape } - { - Invalid~escape~'\iow_char:N\\#1'~ - \__regex_if_in_cs:TF { within~a~control~sequence. } - { - \__regex_if_in_class:TF - { in~a~character~class. } - { following~a~category~test. } - } - } - { - The~escape~sequence~'\iow_char:N\\#1'~may~not~appear~ - \__regex_if_in_cs:TF - { - within~a~control~sequence~test~introduced~by~ - '\iow_char:N\\c\iow_char:N\{'. - } - { - \__regex_if_in_class:TF - { within~a~character~class~ } - { following~a~category~test~such~as~'\iow_char:N\\cL'~ } - because~it~does~not~match~exactly~one~character. - } - } -\__msg_kernel_new:nnnn { regex } { range-missing-end } - { Invalid~end-point~for~range~'#1-#2'~in~character~class. } - { - The~end-point~'#2'~of~the~range~'#1-#2'~may~not~serve~as~an~ - end-point~for~a~range:~alphanumeric~characters~should~not~be~ - escaped,~and~non-alphanumeric~characters~should~be~escaped. - } -\__msg_kernel_new:nnnn { regex } { range-backwards } - { Range~'[#1-#2]'~out~of~order~in~character~class. } - { - In~ranges~of~characters~'[x-y]'~appearing~in~character~classes,~ - the~first~character~code~must~not~be~larger~than~the~second.~ - Here,~'#1'~has~character~code~\int_eval:n {`#1},~while~ - '#2'~has~character~code~\int_eval:n {`#2}. - } -\__msg_kernel_new:nnnn { regex } { c-bad-mode } - { Invalid~nested~'\iow_char:N\\c'~escape~in~regular~expression. } - { - The~'\iow_char:N\\c'~escape~cannot~be~used~within~ - a~control~sequence~test~'\iow_char:N\\c{...}'.~ - To~combine~several~category~tests,~use~'\iow_char:N\\c[...]'. - } -\__msg_kernel_new:nnnn { regex } { c-missing-rbrace } - { Missing~right~brace~inserted~for~'\iow_char:N\\c'~escape. } - { - LaTeX~was~given~a~regular~expression~where~a~ - '\iow_char:N\\c\iow_char:N\{...'~construction~was~not~ended~ - with~a~closing~brace~'\iow_char:N\}'. - } -\__msg_kernel_new:nnnn { regex } { c-missing-rbrack } - { Missing~right~bracket~inserted~for~'\iow_char:N\\c'~escape. } - { - A~construction~'\iow_char:N\\c[...'~appears~in~a~ - regular~expression,~but~the~closing~']'~is~not~present. - } -\__msg_kernel_new:nnnn { regex } { c-missing-category } - { Invalid~character~'#1'~following~'\iow_char:N\\c'~escape. } - { - In~regular~expressions,~the~'\iow_char:N\\c'~escape~sequence~ - may~only~be~followed~by~a~left~brace,~a~left~bracket,~or~a~ - capital~letter~representing~a~character~category,~namely~ - one~of~'ABCDELMOPSTU'. - } -\__msg_kernel_new:nnnn { regex } { c-trailing } - { Trailing~category~code~escape~'\iow_char:N\\c'... } - { - A~regular~expression~ends~with~'\iow_char:N\\c'~followed~ - by~a~letter.~It~will~be~ignored. - } -\__msg_kernel_new:nnnn { regex } { u-missing-lbrace } - { Missing~left~brace~following~'\iow_char:N\\u'~escape. } - { - The~'\iow_char:N\\u'~escape~sequence~must~be~followed~by~ - a~brace~group~with~the~name~of~the~variable~to~use. - } -\__msg_kernel_new:nnnn { regex } { u-missing-rbrace } - { Missing~right~brace~inserted~for~'\iow_char:N\\u'~escape. } - { - LaTeX~ - \str_if_eq_x:nnTF { } {#2} - { reached~the~end~of~the~string~ } - { encountered~an~escaped~alphanumeric~character '\iow_char:N\\#2'~ } - when~parsing~the~argument~of~an~'\iow_char:N\\u\iow_char:N\{...\}'~escape. - } -\__msg_kernel_new:nnnn { regex } { posix-unsupported } - { POSIX~collating~element~'[#1 ~ #1]'~not~supported. } - { - The~'[.foo.]'~and~'[=bar=]'~syntaxes~have~a~special~meaning~ - in~POSIX~regular~expressions.~This~is~not~supported~by~LaTeX.~ - Maybe~you~forgot~to~escape~a~left~bracket~in~a~character~class? - } -\__msg_kernel_new:nnnn { regex } { posix-unknown } - { POSIX~class~'[:#1:]'~unknown. } - { - '[:#1:]'~is~not~among~the~known~POSIX~classes~ - '[:alnum:]',~'[:alpha:]',~'[:ascii:]',~'[:blank:]',~ - '[:cntrl:]',~'[:digit:]',~'[:graph:]',~'[:lower:]',~ - '[:print:]',~'[:punct:]',~'[:space:]',~'[:upper:]',~ - '[:word:]',~and~'[:xdigit:]'. - } -\__msg_kernel_new:nnnn { regex } { posix-missing-close } - { Missing~closing~':]'~for~POSIX~class. } - { The~POSIX~syntax~'#1'~must~be~followed~by~':]',~not~'#2'. } -\__msg_kernel_new:nnnn { regex } { result-unbalanced } - { Missing~brace~inserted~when~#1. } - { - LaTeX~was~asked~to~do~some~regular~expression~operation,~ - and~the~resulting~token~list~would~not~have~the~same~number~ - of~begin-group~and~end-group~tokens.~Braces~were~inserted:~ - #2~left,~#3~right. - } -\__msg_kernel_new:nnnn { regex } { unknown-option } - { Unknown~option~'#1'~for~regular~expressions. } - { - The~only~available~option~is~'case-insensitive',~toggled~by~ - '(?i)'~and~'(?-i)'. - } -\__msg_kernel_new:nnnn { regex } { special-group-unknown } - { Unknown~special~group~'#1~...'~in~a~regular~expression. } - { - The~only~valid~constructions~starting~with~'(?'~are~ - '(?:~...~)',~'(?|~...~)',~'(?i)',~and~'(?-i)'. - } -\__msg_kernel_new:nnnn { regex } { replacement-c } - { Misused~'\iow_char:N\\c'~command~in~a~replacement~text. } - { - In~a~replacement~text,~the~'\iow_char:N\\c'~escape~sequence~ - can~be~followed~by~one~of~the~letters~'ABCDELMOPSTU'~ - or~a~brace~group,~not~by~'#1'. - } -\__msg_kernel_new:nnnn { regex } { replacement-u } - { Misused~'\iow_char:N\\u'~command~in~a~replacement~text. } - { - In~a~replacement~text,~the~'\iow_char:N\\u'~escape~sequence~ - must~be~~followed~by~a~brace~group~holding~the~name~of~the~ - variable~to~use. - } -\__msg_kernel_new:nnnn { regex } { replacement-g } - { - Missing~brace~for~the~'\iow_char:N\\g'~construction~ - in~a~replacement~text. - } - { - In~the~replacement~text~for~a~regular~expression~search,~ - submatches~are~represented~either~as~'\iow_char:N \\g{dd..d}',~ - or~'\\d',~where~'d'~are~single~digits.~Here,~a~brace~is~missing. - } -\__msg_kernel_new:nnnn { regex } { replacement-catcode-end } - { - Missing~character~for~the~'\iow_char:N\\c<category><character>'~ - construction~in~a~replacement~text. - } - { - In~a~replacement~text,~the~'\iow_char:N\\c'~escape~sequence~ - can~be~followed~by~one~of~the~letters~'ABCDELMOPSTU'~representing~ - the~character~category.~Then,~a~character~must~follow.~LaTeX~ - reached~the~end~of~the~replacement~when~looking~for~that. - } -\__msg_kernel_new:nnnn { regex } { replacement-catcode-in-cs } - { - Category~code~'\iow_char:N\\c#1#3'~ignored~inside~ - '\iow_char:N\\c\{...\}'~in~a~replacement~text. - } - { - In~a~replacement~text,~the~category~codes~of~the~argument~of~ - '\iow_char:N\\c\{...\}'~are~ignored~when~building~the~control~ - sequence~name. - } -\__msg_kernel_new:nnnn { regex } { replacement-null-space } - { TeX~cannot~build~a~space~token~with~character~code~0. } - { - You~asked~for~a~character~token~with~category~space,~ - and~character~code~0,~for~instance~through~ - '\iow_char:N\\cS\iow_char:N\\x00'.~ - This~specific~case~is~impossible~and~will~be~replaced~ - by~a~normal~space. - } -\__msg_kernel_new:nnnn { regex } { replacement-missing-rbrace } - { Missing~right~brace~inserted~in~replacement~text. } - { - There~ \int_compare:nTF { #1 = 1 } { was } { were } ~ #1~ - missing~right~\int_compare:nTF { #1 = 1 } { brace } { braces } . - } -\__msg_kernel_new:nnnn { regex } { replacement-missing-rparen } - { Missing~right~parenthesis~inserted~in~replacement~text. } - { - There~ \int_compare:nTF { #1 = 1 } { was } { were } ~ #1~ - missing~right~\int_compare:nTF { #1 = 1 } { parenthesis } { parentheses } . - } -\cs_new:Npn \__regex_msg_repeated:nnN #1#2#3 - { - \str_if_eq_x:nnF { #1 #2 } { 1 0 } - { - , ~ repeated ~ - \int_case:nnF {#2} - { - { -1 } { #1~or~more~times,~\bool_if:NTF #3 { lazy } { greedy } } - { 0 } { #1~times } - } - { - between~#1~and~\int_eval:n {#1+#2}~times,~ - \bool_if:NTF #3 { lazy } { greedy } - } - } - } -\cs_new_protected:Npn \__regex_trace_states:n #1 - { - \int_step_inline:nnnn - \l__regex_min_state_int - { 1 } - { \l__regex_max_state_int - 1 } - { - \trace:nnx { regex } { #1 } - { \iow_char:N \\toks ##1 = { \__regex_toks_use:w ##1 } } - } - } -%% -%% -%% End of file `l3regex-trace.sty'. diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty deleted file mode 100644 index b3ce165d5e8..00000000000 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty +++ /dev/null @@ -1,3005 +0,0 @@ -%% -%% This is file `l3regex.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% l3regex.dtx (with options: `package') -%% -%% Copyright (C) 2011-2017 The 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 "l3experimental bundle" (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% File: l3regex.dtx Copyright (C) 2011-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/05/13] -\@ifpackagelater{expl3}{2017/05/13} - {} - {% - \PackageError{l3regex}{Support package l3kernel too old} - {% - Please install an up to date version of l3kernel\MessageBreak - using your TeX package manager or from CTAN.\MessageBreak - \MessageBreak - Loading l3regex will abort!% - }% - \endinput - } -\ProvidesExplPackage{l3regex}{2017/05/13}{} - {L3 Experimental regular expressions} -\RequirePackage{l3tl-build, l3tl-analysis, l3intarray} -\cs_generate_variant:Nn \tl_to_str:n { V } -\cs_new_protected:Npn \__regex_standard_escapechar: - { \int_set:Nn \tex_escapechar:D { `\\ } } -\cs_new:Npn \__regex_toks_use:w { \tex_the:D \tex_toks:D } -\cs_new_protected:Npn \__regex_toks_clear:N #1 - { \tex_toks:D #1 { } } -\cs_new_eq:NN \__regex_toks_set:Nn \tex_toks:D -\cs_new_protected:Npn \__regex_toks_set:No #1 - { \__regex_toks_set:Nn #1 \exp_after:wN } -\cs_new_protected:Npn \__regex_toks_memcpy:NNn #1#2#3 - { - \prg_replicate:nn {#3} - { - \tex_toks:D #1 = \tex_toks:D #2 - \int_incr:N #1 - \int_incr:N #2 - } - } -\cs_new_protected:Npn \__regex_toks_put_left:Nx #1#2 - { - \cs_set:Npx \__regex_tmp:w { #2 } - \tex_toks:D #1 \exp_after:wN \exp_after:wN \exp_after:wN - { \exp_after:wN \__regex_tmp:w \tex_the:D \tex_toks:D #1 } - } -\cs_new_protected:Npn \__regex_toks_put_right:Nx #1#2 - { - \cs_set:Npx \__regex_tmp:w {#2} - \tex_toks:D #1 \exp_after:wN - { \tex_the:D \tex_toks:D \exp_after:wN #1 \__regex_tmp:w } - } -\cs_new_protected:Npn \__regex_toks_put_right:Nn #1#2 - { \tex_toks:D #1 \exp_after:wN { \tex_the:D \tex_toks:D #1 #2 } } -\cs_new:Npn \__regex_current_cs_to_str: - { - \exp_after:wN \exp_after:wN \exp_after:wN \cs_to_str:N - \tex_the:D \tex_toks:D \l__regex_current_pos_int - } -\cs_new:Npn \__regex_tmp:w { } -\tl_new:N \l__regex_internal_a_tl -\tl_new:N \l__regex_internal_b_tl -\int_new:N \l__regex_internal_a_int -\int_new:N \l__regex_internal_b_int -\int_new:N \l__regex_internal_c_int -\bool_new:N \l__regex_internal_bool -\seq_new:N \l__regex_internal_seq -\tl_new:N \g__regex_internal_tl -\tl_const:Nn \c__regex_no_match_regex - { - \__regex_branch:n - { \__regex_class:NnnnN \c_true_bool { } { 1 } { 0 } \c_true_bool } - } -\__intarray_new:Nn \g__regex_charcode_intarray { 65536 } -\__intarray_new:Nn \g__regex_catcode_intarray { 65536 } -\__intarray_new:Nn \g__regex_balance_intarray { 65536 } -\int_new:N \l__regex_balance_int -\tl_new:N \l__regex_cs_name_tl -\int_const:Nn \c__regex_ascii_min_int { 0 } -\int_const:Nn \c__regex_ascii_max_control_int { 31 } -\int_const:Nn \c__regex_ascii_max_int { 127 } -\int_const:Nn \c__regex_ascii_lower_int { `a - `A } -\cs_new_protected:Npn \__regex_break_true:w - #1 \__regex_break_point:TF #2 #3 {#2} -\cs_new_protected:Npn \__regex_break_point:TF #1 #2 { #2 } -\cs_new_protected:Npn \__regex_item_reverse:n #1 - { - #1 - \__regex_break_point:TF { } \__regex_break_true:w - } -\cs_new_protected:Npn \__regex_item_caseful_equal:n #1 - { - \if_int_compare:w #1 = \l__regex_current_char_int - \exp_after:wN \__regex_break_true:w - \fi: - } -\cs_new_protected:Npn \__regex_item_caseful_range:nn #1 #2 - { - \reverse_if:N \if_int_compare:w #1 > \l__regex_current_char_int - \reverse_if:N \if_int_compare:w #2 < \l__regex_current_char_int - \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w - \fi: - \fi: - } -\cs_new_protected:Npn \__regex_item_caseless_equal:n #1 - { - \if_int_compare:w #1 = \l__regex_current_char_int - \exp_after:wN \__regex_break_true:w - \fi: - \if_int_compare:w \l__regex_case_changed_char_int = \c_max_int - \__regex_compute_case_changed_char: - \fi: - \if_int_compare:w #1 = \l__regex_case_changed_char_int - \exp_after:wN \__regex_break_true:w - \fi: - } -\cs_new_protected:Npn \__regex_item_caseless_range:nn #1 #2 - { - \reverse_if:N \if_int_compare:w #1 > \l__regex_current_char_int - \reverse_if:N \if_int_compare:w #2 < \l__regex_current_char_int - \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w - \fi: - \fi: - \if_int_compare:w \l__regex_case_changed_char_int = \c_max_int - \__regex_compute_case_changed_char: - \fi: - \reverse_if:N \if_int_compare:w #1 > \l__regex_case_changed_char_int - \reverse_if:N \if_int_compare:w #2 < \l__regex_case_changed_char_int - \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w - \fi: - \fi: - } -\cs_new_protected:Npn \__regex_compute_case_changed_char: - { - \int_set_eq:NN \l__regex_case_changed_char_int \l__regex_current_char_int - \if_int_compare:w \l__regex_current_char_int > `Z \exp_stop_f: - \if_int_compare:w \l__regex_current_char_int > `z \exp_stop_f: \else: - \if_int_compare:w \l__regex_current_char_int < `a \exp_stop_f: \else: - \int_sub:Nn \l__regex_case_changed_char_int { \c__regex_ascii_lower_int } - \fi: - \fi: - \else: - \if_int_compare:w \l__regex_current_char_int < `A \exp_stop_f: \else: - \int_add:Nn \l__regex_case_changed_char_int { \c__regex_ascii_lower_int } - \fi: - \fi: - } -\cs_new_eq:NN \__regex_item_equal:n ? -\cs_new_eq:NN \__regex_item_range:nn ? -\cs_new_protected:Npn \__regex_item_catcode: - { - " - \if_case:w \l__regex_current_catcode_int - 1 \or: 4 \or: 10 \or: 40 - \or: 100 \or: \or: 1000 \or: 4000 - \or: 10000 \or: \or: 100000 \or: 400000 - \or: 1000000 \or: 4000000 \else: 1*0 - \fi: - } -\cs_new_protected:Npn \__regex_item_catcode:nT #1 - { - \if_int_odd:w \__int_eval:w #1 / \__regex_item_catcode: \__int_eval_end: - \exp_after:wN \use:n - \else: - \exp_after:wN \use_none:n - \fi: - } -\cs_new_protected:Npn \__regex_item_catcode_reverse:nT #1#2 - { \__regex_item_catcode:nT {#1} { \__regex_item_reverse:n {#2} } } -\cs_new_protected:Npn \__regex_item_exact:nn #1#2 - { - \if_int_compare:w #1 = \l__regex_current_catcode_int - \if_int_compare:w #2 = \l__regex_current_char_int - \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w - \fi: - \fi: - } -\cs_new_protected:Npn \__regex_item_exact_cs:n #1 - { - \int_compare:nNnTF \l__regex_current_catcode_int = 0 - { - \tl_set:Nx \l__regex_internal_a_tl - { \scan_stop: \__regex_current_cs_to_str: \scan_stop: } - \tl_if_in:noTF { \scan_stop: #1 \scan_stop: } \l__regex_internal_a_tl - { \__regex_break_true:w } { } - } - { } - } -\cs_new_protected:Npn \__regex_item_cs:n #1 - { - \int_compare:nNnT \l__regex_current_catcode_int = 0 - { - \group_begin: - \tl_set:Nx \l__regex_cs_name_tl { \__regex_current_cs_to_str: } - \__regex_single_match: - \__regex_disable_submatches: - \__regex_build_for_cs:n {#1} - \bool_set_eq:NN \l__regex_saved_success_bool \g__regex_success_bool - \exp_args:NV \__regex_match:n \l__regex_cs_name_tl - \if_meaning:w \c_true_bool \g__regex_success_bool - \group_insert_after:N \__regex_break_true:w - \fi: - \bool_gset_eq:NN \g__regex_success_bool \l__regex_saved_success_bool - \group_end: - } - } -\cs_new_protected:Npn \__regex_prop_d: - { \__regex_item_caseful_range:nn { `0 } { `9 } } -\cs_new_protected:Npn \__regex_prop_h: - { - \__regex_item_caseful_equal:n { `\ } - \__regex_item_caseful_equal:n { `\^^I } - } -\cs_new_protected:Npn \__regex_prop_s: - { - \__regex_item_caseful_equal:n { `\ } - \__regex_item_caseful_equal:n { `\^^I } - \__regex_item_caseful_equal:n { `\^^J } - \__regex_item_caseful_equal:n { `\^^L } - \__regex_item_caseful_equal:n { `\^^M } - } -\cs_new_protected:Npn \__regex_prop_v: - { \__regex_item_caseful_range:nn { `\^^J } { `\^^M } } % lf, vtab, ff, cr -\cs_new_protected:Npn \__regex_prop_w: - { - \__regex_item_caseful_range:nn { `a } { `z } - \__regex_item_caseful_range:nn { `A } { `Z } - \__regex_item_caseful_range:nn { `0 } { `9 } - \__regex_item_caseful_equal:n { `_ } - } -\cs_new_protected:Npn \__regex_prop_N: - { - \__regex_item_reverse:n - { \__regex_item_caseful_equal:n { `\^^J } } - } -\cs_new_protected:Npn \__regex_posix_alnum: - { \__regex_posix_alpha: \__regex_posix_digit: } -\cs_new_protected:Npn \__regex_posix_alpha: - { \__regex_posix_lower: \__regex_posix_upper: } -\cs_new_protected:Npn \__regex_posix_ascii: - { - \__regex_item_caseful_range:nn - \c__regex_ascii_min_int - \c__regex_ascii_max_int - } -\cs_new_eq:NN \__regex_posix_blank: \__regex_prop_h: -\cs_new_protected:Npn \__regex_posix_cntrl: - { - \__regex_item_caseful_range:nn - \c__regex_ascii_min_int - \c__regex_ascii_max_control_int - \__regex_item_caseful_equal:n \c__regex_ascii_max_int - } -\cs_new_eq:NN \__regex_posix_digit: \__regex_prop_d: -\cs_new_protected:Npn \__regex_posix_graph: - { \__regex_item_caseful_range:nn { `! } { `\~ } } -\cs_new_protected:Npn \__regex_posix_lower: - { \__regex_item_caseful_range:nn { `a } { `z } } -\cs_new_protected:Npn \__regex_posix_print: - { \__regex_item_caseful_range:nn { `\ } { `\~ } } -\cs_new_protected:Npn \__regex_posix_punct: - { - \__regex_item_caseful_range:nn { `! } { `/ } - \__regex_item_caseful_range:nn { `: } { `@ } - \__regex_item_caseful_range:nn { `[ } { `` } - \__regex_item_caseful_range:nn { `\{ } { `\~ } - } -\cs_new_protected:Npn \__regex_posix_space: - { - \__regex_item_caseful_equal:n { `\ } - \__regex_item_caseful_range:nn { `\^^I } { `\^^M } - } -\cs_new_protected:Npn \__regex_posix_upper: - { \__regex_item_caseful_range:nn { `A } { `Z } } -\cs_new_eq:NN \__regex_posix_word: \__regex_prop_w: -\cs_new_protected:Npn \__regex_posix_xdigit: - { - \__regex_posix_digit: - \__regex_item_caseful_range:nn { `A } { `F } - \__regex_item_caseful_range:nn { `a } { `f } - } -\cs_new_protected:Npn \__regex_escape_use:nnnn #1#2#3#4 - { - \__tl_build:Nw \l__regex_internal_a_tl - \cs_set:Npn \__regex_escape_unescaped:N ##1 { #1 } - \cs_set:Npn \__regex_escape_escaped:N ##1 { #2 } - \cs_set:Npn \__regex_escape_raw:N ##1 { #3 } - \__regex_standard_escapechar: - \tl_gset:Nx \g__regex_internal_tl { \__str_to_other_fast:n {#4} } - \tl_set:Nx \l__regex_internal_b_tl - { - \exp_after:wN \__regex_escape_loop:N \g__regex_internal_tl - { break } \__prg_break_point: - } - \__tl_build_one:o \l__regex_internal_b_tl - \__tl_build_end: - \l__regex_internal_a_tl - } -\cs_new:Npn \__regex_escape_loop:N #1 - { - \cs_if_exist_use:cF { __regex_escape_\token_to_str:N #1:w } - { \__regex_escape_unescaped:N #1 } - \__regex_escape_loop:N - } -\cs_new:cpn { __regex_escape_ \c_backslash_str :w } - \__regex_escape_loop:N #1 - { - \cs_if_exist_use:cF { __regex_escape_/\token_to_str:N #1:w } - { \__regex_escape_escaped:N #1 } - \__regex_escape_loop:N - } -\cs_new_eq:NN \__regex_escape_unescaped:N ? -\cs_new_eq:NN \__regex_escape_escaped:N ? -\cs_new_eq:NN \__regex_escape_raw:N ? -\cs_new_eq:NN \__regex_escape_break:w \__prg_break: -\cs_new:cpn { __regex_escape_/break:w } - { - \if_false: { \fi: } - \__msg_kernel_error:nn { regex } { trailing-backslash } - \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: - } -\cs_new:cpn { __regex_escape_~:w } { } -\cs_new:cpx { __regex_escape_/a:w } - { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^G } -\cs_new:cpx { __regex_escape_/t:w } - { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^I } -\cs_new:cpx { __regex_escape_/n:w } - { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^J } -\cs_new:cpx { __regex_escape_/f:w } - { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^L } -\cs_new:cpx { __regex_escape_/r:w } - { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^M } -\cs_new:cpx { __regex_escape_/e:w } - { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^[ } -\cs_new:cpn { __regex_escape_/x:w } \__regex_escape_loop:N - { - \exp_after:wN \__regex_escape_x_end:w - \__int_value:w "0 \__regex_escape_x_test:N - } -\cs_new:Npn \__regex_escape_x_end:w #1 ; - { - \int_compare:nNnTF {#1} > \c_max_char_int - { - \if_false: { \fi: } - \__tl_build_one:o \l__regex_internal_b_tl - \__msg_kernel_error:nnx { regex } { x-overflow } {#1} - \tl_set:Nx \l__regex_internal_b_tl - { \if_false: } \fi: - } - { - \exp_last_unbraced:Nf \__regex_escape_raw:N - { \char_generate:nn {#1} { 12 } } - } - } -\cs_new:Npn \__regex_escape_x_test:N #1 - { - \str_if_eq_x:nnTF {#1} { break } { ; } - { - \if_charcode:w \c_space_token #1 - \exp_after:wN \__regex_escape_x_test:N - \else: - \exp_after:wN \__regex_escape_x_testii:N - \exp_after:wN #1 - \fi: - } - } -\cs_new:Npn \__regex_escape_x_testii:N #1 - { - \if_charcode:w \c_left_brace_str #1 - \exp_after:wN \__regex_escape_x_loop:N - \else: - \__regex_hexadecimal_use:NTF #1 - { \exp_after:wN \__regex_escape_x:N } - { ; \exp_after:wN \__regex_escape_loop:N \exp_after:wN #1 } - \fi: - } -\cs_new:Npn \__regex_escape_x:N #1 - { - \str_if_eq_x:nnTF {#1} { break } { ; } - { - \__regex_hexadecimal_use:NTF #1 - { ; \__regex_escape_loop:N } - { ; \__regex_escape_loop:N #1 } - } - } -\cs_new:Npn \__regex_escape_x_loop:N #1 - { - \str_if_eq_x:nnTF {#1} { break } - { ; \__regex_escape_x_loop_error:n { } {#1} } - { - \__regex_hexadecimal_use:NTF #1 - { \__regex_escape_x_loop:N } - { - \token_if_eq_charcode:NNTF \c_space_token #1 - { \__regex_escape_x_loop:N } - { - ; - \exp_after:wN - \token_if_eq_charcode:NNTF \c_right_brace_str #1 - { \__regex_escape_loop:N } - { \__regex_escape_x_loop_error:n {#1} } - } - } - } - } -\cs_new:Npn \__regex_escape_x_loop_error:n #1 - { - \if_false: { \fi: } - \__tl_build_one:o \l__regex_internal_b_tl - \__msg_kernel_error:nnx { regex } { x-missing-rbrace } {#1} - \tl_set:Nx \l__regex_internal_b_tl - { \if_false: } \fi: \__regex_escape_loop:N #1 - } -\prg_new_conditional:Npnn \__regex_hexadecimal_use:N #1 { TF } - { - \if_int_compare:w 1 < "1 \token_to_str:N #1 \exp_stop_f: - #1 \prg_return_true: - \else: - \if_case:w \__int_eval:w - \exp_after:wN ` \token_to_str:N #1 - `a - \__int_eval_end: - A - \or: B - \or: C - \or: D - \or: E - \or: F - \else: - \prg_return_false: - \exp_after:wN \use_none:n - \fi: - \prg_return_true: - \fi: - } -\prg_new_conditional:Npnn \__regex_char_if_special:N #1 { TF } - { - \if_int_compare:w `#1 > `Z \exp_stop_f: - \if_int_compare:w `#1 > `z \exp_stop_f: - \if_int_compare:w `#1 < \c__regex_ascii_max_int - \prg_return_true: \else: \prg_return_false: \fi: - \else: - \if_int_compare:w `#1 < `a \exp_stop_f: - \prg_return_true: \else: \prg_return_false: \fi: - \fi: - \else: - \if_int_compare:w `#1 > `9 \exp_stop_f: - \if_int_compare:w `#1 < `A \exp_stop_f: - \prg_return_true: \else: \prg_return_false: \fi: - \else: - \if_int_compare:w `#1 < `0 \exp_stop_f: - \if_int_compare:w `#1 < `\ \exp_stop_f: - \prg_return_false: \else: \prg_return_true: \fi: - \else: \prg_return_false: \fi: - \fi: - \fi: - } -\prg_new_conditional:Npnn \__regex_char_if_alphanumeric:N #1 { TF } - { - \if_int_compare:w `#1 > `Z \exp_stop_f: - \if_int_compare:w `#1 > `z \exp_stop_f: - \prg_return_false: - \else: - \if_int_compare:w `#1 < `a \exp_stop_f: - \prg_return_false: \else: \prg_return_true: \fi: - \fi: - \else: - \if_int_compare:w `#1 > `9 \exp_stop_f: - \if_int_compare:w `#1 < `A \exp_stop_f: - \prg_return_false: \else: \prg_return_true: \fi: - \else: - \if_int_compare:w `#1 < `0 \exp_stop_f: - \prg_return_false: \else: \prg_return_true: \fi: - \fi: - \fi: - } -\int_new:N \l__regex_group_level_int -\int_new:N \l__regex_mode_int -\int_const:Nn \c__regex_cs_in_class_mode_int { -6 } -\int_const:Nn \c__regex_cs_mode_int { -2 } -\int_const:Nn \c__regex_outer_mode_int { 0 } -\int_const:Nn \c__regex_catcode_mode_int { 2 } -\int_const:Nn \c__regex_class_mode_int { 3 } -\int_const:Nn \c__regex_catcode_in_class_mode_int { 6 } -\int_new:N \l__regex_catcodes_int -\int_new:N \l__regex_default_catcodes_int -\bool_new:N \l__regex_catcodes_bool -\int_const:Nn \c__regex_catcode_C_int { "1 } -\int_const:Nn \c__regex_catcode_B_int { "4 } -\int_const:Nn \c__regex_catcode_E_int { "10 } -\int_const:Nn \c__regex_catcode_M_int { "40 } -\int_const:Nn \c__regex_catcode_T_int { "100 } -\int_const:Nn \c__regex_catcode_P_int { "1000 } -\int_const:Nn \c__regex_catcode_U_int { "4000 } -\int_const:Nn \c__regex_catcode_D_int { "10000 } -\int_const:Nn \c__regex_catcode_S_int { "100000 } -\int_const:Nn \c__regex_catcode_L_int { "400000 } -\int_const:Nn \c__regex_catcode_O_int { "1000000 } -\int_const:Nn \c__regex_catcode_A_int { "4000000 } -\int_const:Nn \c__regex_all_catcodes_int { "5515155 } -\cs_new_eq:NN \l__regex_internal_regex \c__regex_no_match_regex -\seq_new:N \l__regex_show_prefix_seq -\int_new:N \l__regex_show_lines_int -\cs_new_protected:Npn \__regex_get_digits:NTFw #1#2#3#4#5 - { - \__regex_if_raw_digit:NNTF #4 #5 - { #1 = #5 \__regex_get_digits_loop:nw {#2} } - { #3 #4 #5 } - } -\cs_new:Npn \__regex_get_digits_loop:nw #1#2#3 - { - \__regex_if_raw_digit:NNTF #2 #3 - { #3 \__regex_get_digits_loop:nw {#1} } - { \scan_stop: #1 #2 #3 } - } -\prg_new_conditional:Npnn \__regex_if_raw_digit:NN #1#2 { TF } - { - \if_meaning:w \__regex_compile_raw:N #1 - \if_int_compare:w 1 < 1 #2 \exp_stop_f: - \prg_return_true: - \else: - \prg_return_false: - \fi: - \else: - \prg_return_false: - \fi: - } -\cs_new:Npn \__regex_if_in_class:TF - { - \if_int_odd:w \l__regex_mode_int - \exp_after:wN \use_i:nn - \else: - \exp_after:wN \use_ii:nn - \fi: - } -\cs_new:Npn \__regex_if_in_cs:TF - { - \if_int_odd:w \l__regex_mode_int - \exp_after:wN \use_ii:nn - \else: - \if_int_compare:w \l__regex_mode_int < \c__regex_outer_mode_int - \exp_after:wN \exp_after:wN \exp_after:wN \use_i:nn - \else: - \exp_after:wN \exp_after:wN \exp_after:wN \use_ii:nn - \fi: - \fi: - } -\cs_new:Npn \__regex_if_in_class_or_catcode:TF - { - \if_int_odd:w \l__regex_mode_int - \exp_after:wN \use_i:nn - \else: - \if_int_compare:w \l__regex_mode_int > \c__regex_outer_mode_int - \exp_after:wN \exp_after:wN \exp_after:wN \use_i:nn - \else: - \exp_after:wN \exp_after:wN \exp_after:wN \use_ii:nn - \fi: - \fi: - } -\cs_new:Npn \__regex_if_within_catcode:TF - { - \if_int_compare:w \l__regex_mode_int > \c__regex_outer_mode_int - \exp_after:wN \use_i:nn - \else: - \exp_after:wN \use_ii:nn - \fi: - } -\cs_new_protected:Npn \__regex_chk_c_allowed:T - { - \if_int_compare:w \l__regex_mode_int = \c__regex_outer_mode_int - \exp_after:wN \use:n - \else: - \if_int_compare:w \l__regex_mode_int = \c__regex_class_mode_int - \exp_after:wN \exp_after:wN \exp_after:wN \use:n - \else: - \__msg_kernel_error:nn { regex } { c-bad-mode } - \exp_after:wN \exp_after:wN \exp_after:wN \use_none:n - \fi: - \fi: - } -\cs_new_protected:Npn \__regex_mode_quit_c: - { - \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_mode_int - \int_set_eq:NN \l__regex_mode_int \c__regex_outer_mode_int - \else: - \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_in_class_mode_int - \int_set_eq:NN \l__regex_mode_int \c__regex_class_mode_int - \fi: - \fi: - } -\cs_new_protected:Npn \__regex_compile:w - { - \__tl_build_x:Nw \l__regex_internal_regex - \int_zero:N \l__regex_group_level_int - \int_set_eq:NN \l__regex_default_catcodes_int \c__regex_all_catcodes_int - \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int - \cs_set:Npn \__regex_item_equal:n { \__regex_item_caseful_equal:n } - \cs_set:Npn \__regex_item_range:nn { \__regex_item_caseful_range:nn } - \__tl_build_one:n { \__regex_branch:n { \if_false: } \fi: } - } -\cs_new_protected:Npn \__regex_compile_end: - { - \__regex_if_in_class:TF - { - \__msg_kernel_error:nn { regex } { missing-rbrack } - \use:c { __regex_compile_]: } - \prg_do_nothing: \prg_do_nothing: - } - { } - \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: - \__msg_kernel_error:nnx { regex } { missing-rparen } - { \int_use:N \l__regex_group_level_int } - \prg_replicate:nn - { \l__regex_group_level_int } - { - \__tl_build_one:n - { - \if_false: { \fi: } - \if_false: { \fi: } { 1 } { 0 } \c_true_bool - } - \__tl_build_end: - \__tl_build_one:o \l__regex_internal_regex - } - \fi: - \__tl_build_one:n { \if_false: { \fi: } } - \__tl_build_end: - } -\cs_new_protected:Npn \__regex_compile:n #1 - { - \__regex_compile:w - \__regex_standard_escapechar: - \int_set_eq:NN \l__regex_mode_int \c__regex_outer_mode_int - \__regex_escape_use:nnnn - { - \__regex_char_if_special:NTF ##1 - \__regex_compile_special:N \__regex_compile_raw:N ##1 - } - { - \__regex_char_if_alphanumeric:NTF ##1 - \__regex_compile_escaped:N \__regex_compile_raw:N ##1 - } - { \__regex_compile_raw:N ##1 } - { #1 } - \prg_do_nothing: \prg_do_nothing: - \prg_do_nothing: \prg_do_nothing: - \int_compare:nNnT \l__regex_mode_int = \c__regex_catcode_mode_int - { \__msg_kernel_error:nn { regex } { c-trailing } } - \int_compare:nNnT \l__regex_mode_int < \c__regex_outer_mode_int - { - \__msg_kernel_error:nn { regex } { c-missing-rbrace } - \__regex_compile_end_cs: - \prg_do_nothing: \prg_do_nothing: - \prg_do_nothing: \prg_do_nothing: - } - \__regex_compile_end: - } -\cs_new_protected:Npn \__regex_compile_special:N #1 - { - \cs_if_exist_use:cF { __regex_compile_#1: } - { \__regex_compile_raw:N #1 } - } -\cs_new_protected:Npn \__regex_compile_escaped:N #1 - { - \cs_if_exist_use:cF { __regex_compile_/#1: } - { \__regex_compile_raw:N #1 } - } -\cs_new_protected:Npn \__regex_compile_one:x #1 - { - \__regex_mode_quit_c: - \__regex_if_in_class:TF { } - { - \__tl_build_one:n - { \__regex_class:NnnnN \c_true_bool { \if_false: } \fi: } - } - \__tl_build_one:x - { - \if_int_compare:w \l__regex_catcodes_int < \c__regex_all_catcodes_int - \__regex_item_catcode:nT { \int_use:N \l__regex_catcodes_int } - { \exp_not:N \exp_not:n {#1} } - \else: - \exp_not:N \exp_not:n {#1} - \fi: - } - \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int - \__regex_if_in_class:TF { } { \__regex_compile_quantifier:w } - } -\cs_new_protected:Npn \__regex_compile_abort_tokens:n #1 - { - \use:x - { - \exp_args:No \tl_map_function:nN { \tl_to_str:n {#1} } - \__regex_compile_raw:N - } - } -\cs_generate_variant:Nn \__regex_compile_abort_tokens:n { x } -\cs_new_protected:Npn \__regex_compile_quantifier:w #1#2 - { - \token_if_eq_meaning:NNTF #1 \__regex_compile_special:N - { - \cs_if_exist_use:cF { __regex_compile_quantifier_#2:w } - { \__regex_compile_quantifier_none: #1 #2 } - } - { \__regex_compile_quantifier_none: #1 #2 } - } -\cs_new_protected:Npn \__regex_compile_quantifier_none: - { \__tl_build_one:n { \if_false: { \fi: } { 1 } { 0 } \c_false_bool } } -\cs_new_protected:Npn \__regex_compile_quantifier_abort:xNN #1#2#3 - { - \__regex_compile_quantifier_none: - \__msg_kernel_warning:nnxx { regex } { invalid-quantifier } {#1} {#3} - \__regex_compile_abort_tokens:x {#1} - #2 #3 - } -\cs_new_protected:Npn \__regex_compile_quantifier_lazyness:nnNN #1#2#3#4 - { - \str_if_eq:nnTF { #3 #4 } { \__regex_compile_special:N ? } - { \__tl_build_one:n { \if_false: { \fi: } { #1 } { #2 } \c_true_bool } } - { - \__tl_build_one:n { \if_false: { \fi: } { #1 } { #2 } \c_false_bool } - #3 #4 - } - } -\cs_new_protected:cpn { __regex_compile_quantifier_?:w } - { \__regex_compile_quantifier_lazyness:nnNN { 0 } { 1 } } -\cs_new_protected:cpn { __regex_compile_quantifier_*:w } - { \__regex_compile_quantifier_lazyness:nnNN { 0 } { -1 } } -\cs_new_protected:cpn { __regex_compile_quantifier_+:w } - { \__regex_compile_quantifier_lazyness:nnNN { 1 } { -1 } } -\cs_new_protected:cpn { __regex_compile_quantifier_ \c_left_brace_str :w } - { - \__regex_get_digits:NTFw \l__regex_internal_a_int - { \__regex_compile_quantifier_braced_auxi:w } - { \__regex_compile_quantifier_abort:xNN { \c_left_brace_str } } - } -\cs_new_protected:Npn \__regex_compile_quantifier_braced_auxi:w #1#2 - { - \str_case_x:nnF { #1 #2 } - { - { \__regex_compile_special:N \c_right_brace_str } - { - \exp_args:No \__regex_compile_quantifier_lazyness:nnNN - { \int_use:N \l__regex_internal_a_int } { 0 } - } - { \__regex_compile_special:N , } - { - \__regex_get_digits:NTFw \l__regex_internal_b_int - { \__regex_compile_quantifier_braced_auxiii:w } - { \__regex_compile_quantifier_braced_auxii:w } - } - } - { - \__regex_compile_quantifier_abort:xNN - { \c_left_brace_str \int_use:N \l__regex_internal_a_int } - #1 #2 - } - } -\cs_new_protected:Npn \__regex_compile_quantifier_braced_auxii:w #1#2 - { - \str_if_eq_x:nnTF - { #1 #2 } { \__regex_compile_special:N \c_right_brace_str } - { - \exp_args:No \__regex_compile_quantifier_lazyness:nnNN - { \int_use:N \l__regex_internal_a_int } { -1 } - } - { - \__regex_compile_quantifier_abort:xNN - { \c_left_brace_str \int_use:N \l__regex_internal_a_int , } - #1 #2 - } - } -\cs_new_protected:Npn \__regex_compile_quantifier_braced_auxiii:w #1#2 - { - \str_if_eq_x:nnTF - { #1 #2 } { \__regex_compile_special:N \c_right_brace_str } - { - \if_int_compare:w \l__regex_internal_a_int > \l__regex_internal_b_int - \__msg_kernel_error:nnxx { regex } { backwards-quantifier } - { \int_use:N \l__regex_internal_a_int } - { \int_use:N \l__regex_internal_b_int } - \int_zero:N \l__regex_internal_b_int - \else: - \int_sub:Nn \l__regex_internal_b_int \l__regex_internal_a_int - \fi: - \exp_args:Noo \__regex_compile_quantifier_lazyness:nnNN - { \int_use:N \l__regex_internal_a_int } - { \int_use:N \l__regex_internal_b_int } - } - { - \__regex_compile_quantifier_abort:xNN - { - \c_left_brace_str - \int_use:N \l__regex_internal_a_int , - \int_use:N \l__regex_internal_b_int - } - #1 #2 - } - } -\cs_new_protected:Npn \__regex_compile_raw_error:N #1 - { - \__msg_kernel_error:nnx { regex } { bad-escape } {#1} - \__regex_compile_raw:N #1 - } -\cs_new_protected:Npn \__regex_compile_raw:N #1#2#3 - { - \__regex_if_in_class:TF - { - \str_if_eq:nnTF {#2#3} { \__regex_compile_special:N - } - { \__regex_compile_range:Nw #1 } - { - \__regex_compile_one:x - { \__regex_item_equal:n { \__int_value:w `#1 ~ } } - #2 #3 - } - } - { - \__regex_compile_one:x - { \__regex_item_equal:n { \__int_value:w `#1 ~ } } - #2 #3 - } - } -\prg_new_protected_conditional:Npnn \__regex_if_end_range:NN #1#2 { TF } - { - \if_meaning:w \__regex_compile_raw:N #1 - \prg_return_true: - \else: - \if_meaning:w \__regex_compile_special:N #1 - \if_charcode:w ] #2 - \prg_return_false: - \else: - \prg_return_true: - \fi: - \else: - \prg_return_false: - \fi: - \fi: - } -\cs_new_protected:Npn \__regex_compile_range:Nw #1#2#3 - { - \__regex_if_end_range:NNTF #2 #3 - { - \if_int_compare:w `#1 > `#3 \exp_stop_f: - \__msg_kernel_error:nnxx { regex } { range-backwards } {#1} {#3} - \else: - \__tl_build_one:x - { - \if_int_compare:w `#1 = `#3 \exp_stop_f: - \__regex_item_equal:n - \else: - \__regex_item_range:nn { \__int_value:w `#1 ~ } - \fi: - { \__int_value:w `#3 ~ } - } - \fi: - } - { - \__msg_kernel_warning:nnxx { regex } { range-missing-end } - {#1} { \c_backslash_str #3 } - \__tl_build_one:x - { - \__regex_item_equal:n { \__int_value:w `#1 ~ } - \__regex_item_equal:n { \__int_value:w `- ~ } - } - #2#3 - } - } -\cs_new_protected:cpx { __regex_compile_.: } - { - \exp_not:N \__regex_if_in_class:TF - { \__regex_compile_raw:N . } - { \__regex_compile_one:x \exp_not:c { __regex_prop_.: } } - } -\cs_new_protected:cpn { __regex_prop_.: } - { - \if_int_compare:w \l__regex_current_char_int > - 2 \exp_stop_f: - \exp_after:wN \__regex_break_true:w - \fi: - } -\cs_set_protected:Npn \__regex_tmp:w #1#2 - { - \cs_new_protected:cpx { __regex_compile_/#1: } - { \__regex_compile_one:x \exp_not:c { __regex_prop_#1: } } - \cs_new_protected:cpx { __regex_compile_/#2: } - { - \__regex_compile_one:x - { \__regex_item_reverse:n \exp_not:c { __regex_prop_#1: } } - } - } -\__regex_tmp:w d D -\__regex_tmp:w h H -\__regex_tmp:w s S -\__regex_tmp:w v V -\__regex_tmp:w w W -\cs_new_protected:cpn { __regex_compile_/N: } - { \__regex_compile_one:x \__regex_prop_N: } -\cs_new_protected:Npn \__regex_compile_anchor:NF #1#2 - { - \__regex_if_in_class_or_catcode:TF {#2} - { - \__tl_build_one:n - { \__regex_assertion:Nn \c_true_bool { \__regex_anchor:N #1 } } - } - } -\cs_set_protected:Npn \__regex_tmp:w #1#2 - { - \cs_new_protected:cpn { __regex_compile_/#1: } - { \__regex_compile_anchor:NF #2 { \__regex_compile_raw_error:N #1 } } - } -\__regex_tmp:w A \l__regex_min_pos_int -\__regex_tmp:w G \l__regex_start_pos_int -\__regex_tmp:w Z \l__regex_max_pos_int -\__regex_tmp:w z \l__regex_max_pos_int -\cs_set_protected:Npn \__regex_tmp:w #1#2 - { - \cs_new_protected:cpn { __regex_compile_#1: } - { \__regex_compile_anchor:NF #2 { \__regex_compile_raw:N #1 } } - } -\exp_args:Nx \__regex_tmp:w { \iow_char:N \^ } \l__regex_min_pos_int -\exp_args:Nx \__regex_tmp:w { \iow_char:N \$ } \l__regex_max_pos_int -\cs_new_protected:cpn { __regex_compile_/b: } - { - \__regex_if_in_class_or_catcode:TF - { \__regex_compile_raw_error:N b } - { - \__tl_build_one:n - { \__regex_assertion:Nn \c_true_bool { \__regex_b_test: } } - } - } -\cs_new_protected:cpn { __regex_compile_/B: } - { - \__regex_if_in_class_or_catcode:TF - { \__regex_compile_raw_error:N B } - { - \__tl_build_one:n - { \__regex_assertion:Nn \c_false_bool { \__regex_b_test: } } - } - } -\cs_new_protected:cpn { __regex_compile_]: } - { - \__regex_if_in_class:TF - { - \if_int_compare:w \l__regex_mode_int > \c__regex_catcode_in_class_mode_int - \__tl_build_one:n { \if_false: { \fi: } } - \fi: - \tex_advance:D \l__regex_mode_int - 15 \exp_stop_f: - \tex_divide:D \l__regex_mode_int 13 \exp_stop_f: - \if_int_odd:w \l__regex_mode_int \else: - \exp_after:wN \__regex_compile_quantifier:w - \fi: - } - { \__regex_compile_raw:N ] } - } -\cs_new_protected:cpn { __regex_compile_[: } - { - \__regex_if_in_class:TF - { \__regex_compile_class_posix_test:w } - { - \__regex_if_within_catcode:TF - { - \exp_after:wN \__regex_compile_class_catcode:w - \int_use:N \l__regex_catcodes_int ; - } - { \__regex_compile_class_normal:w } - } - } -\cs_new_protected:Npn \__regex_compile_class_normal:w - { - \__regex_compile_class:TFNN - { \__regex_class:NnnnN \c_true_bool } - { \__regex_class:NnnnN \c_false_bool } - } -\cs_new_protected:Npn \__regex_compile_class_catcode:w #1; - { - \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_mode_int - \__tl_build_one:n - { \__regex_class:NnnnN \c_true_bool { \if_false: } \fi: } - \fi: - \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int - \__regex_compile_class:TFNN - { \__regex_item_catcode:nT {#1} } - { \__regex_item_catcode_reverse:nT {#1} } - } -\cs_new_protected:Npn \__regex_compile_class:TFNN #1#2#3#4 - { - \l__regex_mode_int = \__int_value:w \l__regex_mode_int 3 \exp_stop_f: - \str_if_eq:nnTF { #3 #4 } { \__regex_compile_special:N ^ } - { - \__tl_build_one:n { #2 { \if_false: } \fi: } - \__regex_compile_class:NN - } - { - \__tl_build_one:n { #1 { \if_false: } \fi: } - \__regex_compile_class:NN #3 #4 - } - } -\cs_new_protected:Npn \__regex_compile_class:NN #1#2 - { - \token_if_eq_charcode:NNTF #2 ] - { \__regex_compile_raw:N #2 } - { #1 #2 } - } -\cs_new_protected:Npn \__regex_compile_class_posix_test:w #1#2 - { - \token_if_eq_meaning:NNT \__regex_compile_special:N #1 - { - \str_case:nn { #2 } - { - : { \__regex_compile_class_posix:NNNNw } - = { \__msg_kernel_warning:nnx { regex } { posix-unsupported } { = } } - . { \__msg_kernel_warning:nnx { regex } { posix-unsupported } { . } } - } - } - \__regex_compile_raw:N [ #1 #2 - } -\cs_new_protected:Npn \__regex_compile_class_posix:NNNNw #1#2#3#4#5#6 - { - \str_if_eq:nnTF { #5 #6 } { \__regex_compile_special:N ^ } - { - \bool_set_false:N \l__regex_internal_bool - \tl_set:Nx \l__regex_internal_a_tl { \if_false: } \fi: - \__regex_compile_class_posix_loop:w - } - { - \bool_set_true:N \l__regex_internal_bool - \tl_set:Nx \l__regex_internal_a_tl { \if_false: } \fi: - \__regex_compile_class_posix_loop:w #5 #6 - } - } -\cs_new:Npn \__regex_compile_class_posix_loop:w #1#2 - { - \token_if_eq_meaning:NNTF \__regex_compile_raw:N #1 - { #2 \__regex_compile_class_posix_loop:w } - { \if_false: { \fi: } \__regex_compile_class_posix_end:w #1 #2 } - } -\cs_new_protected:Npn \__regex_compile_class_posix_end:w #1#2#3#4 - { - \str_if_eq:nnTF { #1 #2 #3 #4 } - { \__regex_compile_special:N : \__regex_compile_special:N ] } - { - \cs_if_exist:cTF { __regex_posix_ \l__regex_internal_a_tl : } - { - \__regex_compile_one:x - { - \bool_if:NF \l__regex_internal_bool \__regex_item_reverse:n - \exp_not:c { __regex_posix_ \l__regex_internal_a_tl : } - } - } - { - \__msg_kernel_warning:nnx { regex } { posix-unknown } - { \l__regex_internal_a_tl } - \__regex_compile_abort_tokens:x - { - [: \bool_if:NF \l__regex_internal_bool { ^ } - \l__regex_internal_a_tl :] - } - } - } - { - \__msg_kernel_error:nnxx { regex } { posix-missing-close } - { [: \l__regex_internal_a_tl } { #2 #4 } - \__regex_compile_abort_tokens:x { [: \l__regex_internal_a_tl } - #1 #2 #3 #4 - } - } -\cs_new_protected:Npn \__regex_compile_group_begin:N #1 - { - \__tl_build_one:n { #1 { \if_false: } \fi: } - \__regex_mode_quit_c: - \__tl_build:Nw \l__regex_internal_regex - \int_set_eq:NN \l__regex_default_catcodes_int \l__regex_catcodes_int - \int_incr:N \l__regex_group_level_int - \__tl_build_one:n { \__regex_branch:n { \if_false: } \fi: } - } -\cs_new_protected:Npn \__regex_compile_group_end: - { - \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: - \__tl_build_one:n { \if_false: { \fi: } } - \__tl_build_end: - \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int - \__tl_build_one:o \l__regex_internal_regex - \exp_after:wN \__regex_compile_quantifier:w - \else: - \__msg_kernel_warning:nn { regex } { extra-rparen } - \exp_after:wN \__regex_compile_raw:N \exp_after:wN ) - \fi: - } -\cs_new_protected:cpn { __regex_compile_(: } - { - \__regex_if_in_class:TF { \__regex_compile_raw:N ( } - { \__regex_compile_lparen:w } - } -\cs_new_protected:Npn \__regex_compile_lparen:w #1#2#3#4 - { - \str_if_eq:nnTF { #1 #2 } { \__regex_compile_special:N ? } - { - \cs_if_exist_use:cF - { __regex_compile_special_group_\token_to_str:N #4 :w } - { - \__msg_kernel_warning:nnx { regex } { special-group-unknown } - { (? #4 } - \__regex_compile_group_begin:N \__regex_group:nnnN - \__regex_compile_raw:N ? #3 #4 - } - } - { - \__regex_compile_group_begin:N \__regex_group:nnnN - #1 #2 #3 #4 - } - } -\cs_new_protected:cpn { __regex_compile_|: } - { - \__regex_if_in_class:TF { \__regex_compile_raw:N | } - { - \__tl_build_one:n - { \if_false: { \fi: } \__regex_branch:n { \if_false: } \fi: } - } - } -\cs_new_protected:cpn { __regex_compile_): } - { - \__regex_if_in_class:TF { \__regex_compile_raw:N ) } - { \__regex_compile_group_end: } - } -\cs_new_protected:cpn { __regex_compile_special_group_::w } - { \__regex_compile_group_begin:N \__regex_group_no_capture:nnnN } -\cs_new_protected:cpn { __regex_compile_special_group_|:w } - { \__regex_compile_group_begin:N \__regex_group_resetting:nnnN } -\cs_new_protected:Npn \__regex_compile_special_group_i:w #1#2 - { - \str_if_eq:nnTF { #1 #2 } { \__regex_compile_special:N ) } - { - \cs_set:Npn \__regex_item_equal:n { \__regex_item_caseless_equal:n } - \cs_set:Npn \__regex_item_range:nn { \__regex_item_caseless_range:nn } - } - { - \__msg_kernel_warning:nnx { regex } { unknown-option } { (?i #2 } - \__regex_compile_raw:N ( - \__regex_compile_raw:N ? - \__regex_compile_raw:N i - #1 #2 - } - } -\cs_new_protected:cpn { __regex_compile_special_group_-:w } #1#2#3#4 - { - \str_if_eq:nnTF { #1 #2 #3 #4 } - { \__regex_compile_raw:N i \__regex_compile_special:N ) } - { - \cs_set:Npn \__regex_item_equal:n { \__regex_item_caseful_equal:n } - \cs_set:Npn \__regex_item_range:nn { \__regex_item_caseful_range:nn } - } - { - \__msg_kernel_warning:nnx { regex } { unknown-option } { (?-#2#4 } - \__regex_compile_raw:N ( - \__regex_compile_raw:N ? - \__regex_compile_raw:N - - #1 #2 #3 #4 - } - } -\cs_new_protected:cpn { __regex_compile_/c: } - { \__regex_chk_c_allowed:T { \__regex_compile_c_test:NN } } -\cs_new_protected:Npn \__regex_compile_c_test:NN #1#2 - { - \token_if_eq_meaning:NNTF #1 \__regex_compile_raw:N - { - \int_if_exist:cTF { c__regex_catcode_#2_int } - { - \int_set_eq:Nc \l__regex_catcodes_int { c__regex_catcode_#2_int } - \l__regex_mode_int - = \if_case:w \l__regex_mode_int - \c__regex_catcode_mode_int - \else: - \c__regex_catcode_in_class_mode_int - \fi: - } - } - { \cs_if_exist_use:cF { __regex_compile_c_#2:w } } - { - \__msg_kernel_error:nnx { regex } { c-missing-category } {#2} - #1 #2 - } - } -\cs_new_protected:cpn { __regex_compile_c_[:w } #1#2 - { - \l__regex_mode_int - = \if_case:w \l__regex_mode_int - \c__regex_catcode_mode_int - \else: - \c__regex_catcode_in_class_mode_int - \fi: - \int_zero:N \l__regex_catcodes_int - \str_if_eq:nnTF { #1 #2 } { \__regex_compile_special:N ^ } - { - \bool_set_false:N \l__regex_catcodes_bool - \__regex_compile_c_lbrack_loop:NN - } - { - \bool_set_true:N \l__regex_catcodes_bool - \__regex_compile_c_lbrack_loop:NN - #1 #2 - } - } -\cs_new_protected:Npn \__regex_compile_c_lbrack_loop:NN #1#2 - { - \token_if_eq_meaning:NNTF #1 \__regex_compile_raw:N - { - \int_if_exist:cTF { c__regex_catcode_#2_int } - { - \exp_args:Nc \__regex_compile_c_lbrack_add:N - { c__regex_catcode_#2_int } - \__regex_compile_c_lbrack_loop:NN - } - } - { - \token_if_eq_charcode:NNTF #2 ] - { \__regex_compile_c_lbrack_end: } - } - { - \__msg_kernel_error:nnx { regex } { c-missing-rbrack } {#2} - \__regex_compile_c_lbrack_end: - #1 #2 - } - } -\cs_new_protected:Npn \__regex_compile_c_lbrack_add:N #1 - { - \if_int_odd:w \__int_eval:w \l__regex_catcodes_int / #1 \__int_eval_end: - \else: - \int_add:Nn \l__regex_catcodes_int {#1} - \fi: - } -\cs_new_protected:Npn \__regex_compile_c_lbrack_end: - { - \if_meaning:w \c_false_bool \l__regex_catcodes_bool - \int_set:Nn \l__regex_catcodes_int - { \c__regex_all_catcodes_int - \l__regex_catcodes_int } - \fi: - } -\cs_new_protected:cpn { __regex_compile_c_ \c_left_brace_str :w } - { - \__regex_compile:w - \__regex_disable_submatches: - \l__regex_mode_int - = \if_case:w \l__regex_mode_int - \c__regex_cs_mode_int - \else: - \c__regex_cs_in_class_mode_int - \fi: - } -\flag_new:n { __regex_cs } -\cs_new_protected:cpn { __regex_compile_ \c_right_brace_str : } - { - \__regex_if_in_cs:TF - { \__regex_compile_end_cs: } - { \exp_after:wN \__regex_compile_raw:N \c_right_brace_str } - } -\cs_new_protected:Npn \__regex_compile_end_cs: - { - \__regex_compile_end: - \flag_clear:n { __regex_cs } - \tl_set:Nx \l__regex_internal_a_tl - { - \exp_after:wN \__regex_compile_cs_aux:Nn \l__regex_internal_regex - \q_nil \q_nil \q_recursion_stop - } - \exp_args:Nx \__regex_compile_one:x - { - \flag_if_raised:nTF { __regex_cs } - { \__regex_item_cs:n { \exp_not:o \l__regex_internal_regex } } - { \__regex_item_exact_cs:n { \tl_tail:N \l__regex_internal_a_tl } } - } - } -\cs_new:Npn \__regex_compile_cs_aux:Nn #1#2 - { - \cs_if_eq:NNTF #1 \__regex_branch:n - { - \scan_stop: - \__regex_compile_cs_aux:NNnnnN #2 - \q_nil \q_nil \q_nil \q_nil \q_nil \q_nil \q_recursion_stop - \__regex_compile_cs_aux:Nn - } - { - \quark_if_nil:NF #1 { \flag_raise:n { __regex_cs } } - \use_none_delimit_by_q_recursion_stop:w - } - } -\cs_new:Npn \__regex_compile_cs_aux:NNnnnN #1#2#3#4#5#6 - { - \bool_lazy_all:nTF - { - { \cs_if_eq_p:NN #1 \__regex_class:NnnnN } - {#2} - { \tl_if_head_eq_meaning_p:nN {#3} \__regex_item_caseful_equal:n } - { \int_compare_p:nNn { \tl_count:n {#3} } = { 2 } } - { \int_compare_p:nNn {#5} = { 0 } } - } - { - \prg_replicate:nn {#4} - { \char_generate:nn { \use_ii:nn #3 } {12} } - \__regex_compile_cs_aux:NNnnnN - } - { - \quark_if_nil:NF #1 - { - \flag_raise:n { __regex_cs } - \use_i_delimit_by_q_recursion_stop:nw - } - \use_none_delimit_by_q_recursion_stop:w - } - } -\cs_new_protected:cpn { __regex_compile_/u: } #1#2 - { - \__regex_if_in_class_or_catcode:TF - { \__regex_compile_raw_error:N u #1 #2 } - { - \str_if_eq_x:nnTF {#1#2} { \__regex_compile_special:N \c_left_brace_str } - { - \tl_set:Nx \l__regex_internal_a_tl { \if_false: } \fi: - \__regex_compile_u_loop:NN - } - { - \__msg_kernel_error:nn { regex } { u-missing-lbrace } - \__regex_compile_raw:N u #1 #2 - } - } - } -\cs_new:Npn \__regex_compile_u_loop:NN #1#2 - { - \token_if_eq_meaning:NNTF #1 \__regex_compile_raw:N - { #2 \__regex_compile_u_loop:NN } - { - \token_if_eq_meaning:NNTF #1 \__regex_compile_special:N - { - \exp_after:wN \token_if_eq_charcode:NNTF \c_right_brace_str #2 - { \if_false: { \fi: } \__regex_compile_u_end: } - { #2 \__regex_compile_u_loop:NN } - } - { - \if_false: { \fi: } - \__msg_kernel_error:nnx { regex } { u-missing-rbrace } {#2} - \__regex_compile_u_end: - #1 #2 - } - } - } -\cs_new_protected:Npn \__regex_compile_u_end: - { - \tl_set:Nv \l__regex_internal_a_tl { \l__regex_internal_a_tl } - \if_int_compare:w \l__regex_mode_int = \c__regex_outer_mode_int - \__regex_compile_u_not_cs: - \else: - \__regex_compile_u_in_cs: - \fi: - } -\cs_new_protected:Npn \__regex_compile_u_in_cs: - { - \tl_gset:Nx \g__regex_internal_tl - { \exp_args:No \__str_to_other_fast:n { \l__regex_internal_a_tl } } - \__tl_build_one:x - { - \tl_map_function:NN \g__regex_internal_tl - \__regex_compile_u_in_cs_aux:n - } - } -\cs_new:Npn \__regex_compile_u_in_cs_aux:n #1 - { - \__regex_class:NnnnN \c_true_bool - { \__regex_item_caseful_equal:n { \__int_value:w `#1 } } - { 1 } { 0 } \c_false_bool - } -\cs_new_protected:Npn \__regex_compile_u_not_cs: - { - \exp_args:No \__tl_analysis_map_inline:nn { \l__regex_internal_a_tl } - { - \__tl_build_one:n - { - \__regex_class:NnnnN \c_true_bool - { - \if_int_compare:w "##2 = 0 \exp_stop_f: - \__regex_item_exact_cs:n { \exp_after:wN \cs_to_str:N ##1 } - \else: - \__regex_item_exact:nn { \__int_value:w "##2 } { ##3 } - \fi: - } - { 1 } { 0 } \c_false_bool - } - } - } -\cs_new_protected:cpn { __regex_compile_/K: } - { - \int_compare:nNnTF \l__regex_mode_int = \c__regex_outer_mode_int - { \__tl_build_one:n { \__regex_command_K: } } - { \__regex_compile_raw_error:N K } - } -\cs_new_protected:Npn \__regex_show:Nn #1#2 - { - \__tl_build:Nw \l__regex_internal_a_tl - \cs_set_protected:Npn \__regex_branch:n - { - \seq_pop_right:NN \l__regex_show_prefix_seq \l__regex_internal_a_tl - \__regex_show_one:n { +-branch } - \seq_put_right:No \l__regex_show_prefix_seq \l__regex_internal_a_tl - \use:n - } - \cs_set_protected:Npn \__regex_group:nnnN - { \__regex_show_group_aux:nnnnN { } } - \cs_set_protected:Npn \__regex_group_no_capture:nnnN - { \__regex_show_group_aux:nnnnN { ~(no~capture) } } - \cs_set_protected:Npn \__regex_group_resetting:nnnN - { \__regex_show_group_aux:nnnnN { ~(resetting) } } - \cs_set_eq:NN \__regex_class:NnnnN \__regex_show_class:NnnnN - \cs_set_protected:Npn \__regex_command_K: - { \__regex_show_one:n { reset~match~start~(\iow_char:N\\K) } } - \cs_set_protected:Npn \__regex_assertion:Nn ##1##2 - { \__regex_show_one:n { \bool_if:NF ##1 { negative~ } assertion:~##2 } } - \cs_set:Npn \__regex_b_test: { word~boundary } - \cs_set_eq:NN \__regex_anchor:N \__regex_show_anchor_to_str:N - \cs_set_protected:Npn \__regex_item_caseful_equal:n ##1 - { \__regex_show_one:n { char~code~\int_eval:n{##1} } } - \cs_set_protected:Npn \__regex_item_caseful_range:nn ##1##2 - { \__regex_show_one:n { range~[\int_eval:n{##1}, \int_eval:n{##2}] } } - \cs_set_protected:Npn \__regex_item_caseless_equal:n ##1 - { \__regex_show_one:n { char~code~\int_eval:n{##1}~(caseless) } } - \cs_set_protected:Npn \__regex_item_caseless_range:nn ##1##2 - { - \__regex_show_one:n - { Range~[\int_eval:n{##1}, \int_eval:n{##2}]~(caseless) } - } - \cs_set_protected:Npn \__regex_item_catcode:nT - { \__regex_show_item_catcode:NnT \c_true_bool } - \cs_set_protected:Npn \__regex_item_catcode_reverse:nT - { \__regex_show_item_catcode:NnT \c_false_bool } - \cs_set_protected:Npn \__regex_item_reverse:n - { \__regex_show_scope:nn { Reversed~match } } - \cs_set_protected:Npn \__regex_item_exact:nn ##1##2 - { \__regex_show_one:n { char~##2,~catcode~##1 } } - \cs_set_eq:NN \__regex_item_exact_cs:n \__regex_show_item_exact_cs:n - \cs_set_protected:Npn \__regex_item_cs:n - { \__regex_show_scope:nn { control~sequence } } - \cs_set:cpn { __regex_prop_.: } { \__regex_show_one:n { any~token } } - \seq_clear:N \l__regex_show_prefix_seq - \__regex_show_push:n { ~ } - \cs_if_exist_use:N #1 - \__tl_build_end: - \__msg_show_variable:NNNnn #1 \cs_if_exist:NTF ? { } - { >~Compiled~regex~#2: \l__regex_internal_a_tl } - } -\cs_new_protected:Npn \__regex_show_one:n #1 - { - \int_incr:N \l__regex_show_lines_int - \__tl_build_one:x - { - \exp_not:N \\ - \seq_map_function:NN \l__regex_show_prefix_seq \use:n - #1 - } - } -\cs_new_protected:Npn \__regex_show_push:n #1 - { \seq_put_right:Nx \l__regex_show_prefix_seq { #1 ~ } } -\cs_new_protected:Npn \__regex_show_pop: - { \seq_pop_right:NN \l__regex_show_prefix_seq \l__regex_internal_a_tl } -\cs_new_protected:Npn \__regex_show_scope:nn #1#2 - { - \__regex_show_one:n {#1} - \__regex_show_push:n { ~ } - #2 - \__regex_show_pop: - } -\cs_new_protected:Npn \__regex_show_group_aux:nnnnN #1#2#3#4#5 - { - \__regex_show_one:n { ,-group~begin #1 } - \__regex_show_push:n { | } - \use_ii:nn #2 - \__regex_show_pop: - \__regex_show_one:n - { `-group~end \__regex_msg_repeated:nnN {#3} {#4} #5 } - } -\cs_set:Npn \__regex_show_class:NnnnN #1#2#3#4#5 - { - \__tl_build:Nw \l__regex_internal_a_tl - \int_zero:N \l__regex_show_lines_int - \__regex_show_push:n {~} - #2 - \exp_last_unbraced:Nf - \int_case:nnF { \l__regex_show_lines_int } - { - {0} - { - \__tl_build_end: - \__regex_show_one:n { \bool_if:NTF #1 { Fail } { Pass } } - } - {1} - { - \__tl_build_end: - \bool_if:NTF #1 - { - #2 - \__tl_build_one:n { \__regex_msg_repeated:nnN {#3} {#4} #5 } - } - { - \__regex_show_one:n - { Don't~match~\__regex_msg_repeated:nnN {#3} {#4} #5 } - \__tl_build_one:o \l__regex_internal_a_tl - } - } - } - { - \__tl_build_end: - \__regex_show_one:n - { - \bool_if:NTF #1 { M } { Don't~m } atch - \__regex_msg_repeated:nnN {#3} {#4} #5 - } - \__tl_build_one:o \l__regex_internal_a_tl - } - } -\cs_new:Npn \__regex_show_anchor_to_str:N #1 - { - anchor~at~ - \str_case:nnF { #1 } - { - { \l__regex_min_pos_int } { start~(\iow_char:N\\A) } - { \l__regex_start_pos_int } { start~of~match~(\iow_char:N\\G) } - { \l__regex_max_pos_int } { end~(\iow_char:N\\Z) } - } - { <error:~'#1'~not~recognized> } - } -\cs_new_protected:Npn \__regex_show_item_catcode:NnT #1#2 - { - \seq_set_split:Nnn \l__regex_internal_seq { } { CBEMTPUDSLOA } - \seq_set_filter:NNn \l__regex_internal_seq \l__regex_internal_seq - { \int_if_odd_p:n { #2 / \int_use:c { c__regex_catcode_##1_int } } } - \__regex_show_scope:nn - { - categories~ - \seq_map_function:NN \l__regex_internal_seq \use:n - , ~ - \bool_if:NF #1 { negative~ } class - } - } -\cs_new_protected:Npn \__regex_show_item_exact_cs:n #1 - { - \seq_set_split:Nnn \l__regex_internal_seq { \scan_stop: } {#1} - \seq_set_map:NNn \l__regex_internal_seq - \l__regex_internal_seq { \iow_char:N\\##1 } - \__regex_show_one:n - { control~sequence~ \seq_use:Nn \l__regex_internal_seq { ~or~ } } - } -\int_new:N \l__regex_min_state_int -\int_set:Nn \l__regex_min_state_int { 1 } -\int_new:N \l__regex_max_state_int -\int_new:N \l__regex_left_state_int -\int_new:N \l__regex_right_state_int -\seq_new:N \l__regex_left_state_seq -\seq_new:N \l__regex_right_state_seq -\int_new:N \l__regex_capturing_group_int -\cs_new_protected:Npn \__regex_build:n #1 - { - \__regex_compile:n {#1} - \__regex_build:N \l__regex_internal_regex - } -\cs_new_protected:Npn \__regex_build:N #1 - { - \__regex_standard_escapechar: - \int_zero:N \l__regex_capturing_group_int - \int_set_eq:NN \l__regex_max_state_int \l__regex_min_state_int - \__regex_build_new_state: - \__regex_build_new_state: - \__regex_toks_put_right:Nn \l__regex_left_state_int - { \__regex_action_start_wildcard: } - \__regex_group:nnnN {#1} { 1 } { 0 } \c_false_bool - \__regex_toks_put_right:Nn \l__regex_right_state_int - { \__regex_action_success: } - } -\cs_new_protected:Npn \__regex_build_for_cs:n #1 - { - \int_set_eq:NN \l__regex_max_state_int \l__regex_min_state_int - \__regex_build_new_state: - \__regex_build_new_state: - \__regex_push_lr_states: - #1 - \__regex_pop_lr_states: - \__regex_toks_put_right:Nn \l__regex_right_state_int - { - \if_int_compare:w \l__regex_current_pos_int = \l__regex_max_pos_int - \exp_after:wN \__regex_action_success: - \fi: - } - } -\cs_new_protected:Npn \__regex_push_lr_states: - { - \seq_push:No \l__regex_left_state_seq - { \int_use:N \l__regex_left_state_int } - \seq_push:No \l__regex_right_state_seq - { \int_use:N \l__regex_right_state_int } - } -\cs_new_protected:Npn \__regex_pop_lr_states: - { - \seq_pop:NN \l__regex_left_state_seq \l__regex_internal_a_tl - \int_set:Nn \l__regex_left_state_int \l__regex_internal_a_tl - \seq_pop:NN \l__regex_right_state_seq \l__regex_internal_a_tl - \int_set:Nn \l__regex_right_state_int \l__regex_internal_a_tl - } -\cs_new_protected:Npn \__regex_build_transition_left:NNN #1#2#3 - { \__regex_toks_put_left:Nx #2 { #1 { \int_eval:n { #3 - #2 } } } } -\cs_new_protected:Npn \__regex_build_transition_right:nNn #1#2#3 - { \__regex_toks_put_right:Nx #2 { #1 { \int_eval:n { #3 - #2 } } } } -\cs_new_protected:Npn \__regex_build_new_state: - { - \__regex_toks_clear:N \l__regex_max_state_int - \int_set_eq:NN \l__regex_left_state_int \l__regex_right_state_int - \int_set_eq:NN \l__regex_right_state_int \l__regex_max_state_int - \int_incr:N \l__regex_max_state_int - } -\cs_new_protected:Npn \__regex_build_transitions_lazyness:NNNNN #1#2#3#4#5 - { - \__regex_build_new_state: - \__regex_toks_put_right:Nx \l__regex_left_state_int - { - \if_meaning:w \c_true_bool #1 - #2 { \int_eval:n { #3 - \l__regex_left_state_int } } - #4 { \int_eval:n { #5 - \l__regex_left_state_int } } - \else: - #4 { \int_eval:n { #5 - \l__regex_left_state_int } } - #2 { \int_eval:n { #3 - \l__regex_left_state_int } } - \fi: - } - } -\cs_new_protected:Npn \__regex_class:NnnnN #1#2#3#4#5 - { - \cs_set:Npx \__regex_tests_action_cost:n ##1 - { - \exp_not:n { \exp_not:n {#2} } - \bool_if:NTF #1 - { \__regex_break_point:TF { \__regex_action_cost:n {##1} } { } } - { \__regex_break_point:TF { } { \__regex_action_cost:n {##1} } } - } - \if_case:w - #4 \exp_stop_f: - \__regex_class_repeat:n {#3} - \or: \__regex_class_repeat:nN {#3} #5 - \else: \__regex_class_repeat:nnN {#3} {#4} #5 - \fi: - } -\cs_new:Npn \__regex_tests_action_cost:n { \__regex_action_cost:n } -\cs_new_protected:Npn \__regex_class_repeat:n #1 - { - \prg_replicate:nn {#1} - { - \__regex_build_new_state: - \__regex_build_transition_right:nNn \__regex_tests_action_cost:n - \l__regex_left_state_int \l__regex_right_state_int - } - } -\cs_new_protected:Npn \__regex_class_repeat:nN #1#2 - { - \if_int_compare:w #1 = 0 \exp_stop_f: - \__regex_build_transitions_lazyness:NNNNN #2 - \__regex_action_free:n \l__regex_right_state_int - \__regex_tests_action_cost:n \l__regex_left_state_int - \else: - \__regex_class_repeat:n {#1} - \int_set_eq:NN \l__regex_internal_a_int \l__regex_left_state_int - \__regex_build_transitions_lazyness:NNNNN #2 - \__regex_action_free:n \l__regex_right_state_int - \__regex_action_free:n \l__regex_internal_a_int - \fi: - } -\cs_new_protected:Npn \__regex_class_repeat:nnN #1#2#3 - { - \__regex_class_repeat:n {#1} - \int_set:Nn \l__regex_internal_a_int - { \l__regex_max_state_int + #2 - 1 } - \prg_replicate:nn { #2 } - { - \__regex_build_transitions_lazyness:NNNNN #3 - \__regex_action_free:n \l__regex_internal_a_int - \__regex_tests_action_cost:n \l__regex_right_state_int - } - } -\cs_new_protected:Npn \__regex_group_aux:nnnnN #1#2#3#4#5 - { - \if_int_compare:w #3 = 0 \exp_stop_f: - \__regex_build_new_state: - \__regex_build_transition_right:nNn \__regex_action_free_group:n - \l__regex_left_state_int \l__regex_right_state_int - \fi: - \__regex_build_new_state: - \__regex_push_lr_states: - #2 - \__regex_pop_lr_states: - \if_case:w - #4 \exp_stop_f: - \__regex_group_repeat:nn {#1} {#3} - \or: \__regex_group_repeat:nnN {#1} {#3} #5 - \else: \__regex_group_repeat:nnnN {#1} {#3} {#4} #5 - \fi: - } -\cs_new_protected:Npn \__regex_group:nnnN #1 - { - \exp_args:No \__regex_group_aux:nnnnN - { \int_use:N \l__regex_capturing_group_int } - { - \int_incr:N \l__regex_capturing_group_int - #1 - } - } -\cs_new_protected:Npn \__regex_group_no_capture:nnnN - { \__regex_group_aux:nnnnN { -1 } } -\cs_new_protected:Npn \__regex_group_resetting:nnnN #1 - { - \__regex_group_aux:nnnnN { -1 } - { - \exp_args:Noo \__regex_group_resetting_loop:nnNn - { \int_use:N \l__regex_capturing_group_int } - { \int_use:N \l__regex_capturing_group_int } - #1 - { ?? \__prg_break:n } { } - \__prg_break_point: - } - } -\cs_new_protected:Npn \__regex_group_resetting_loop:nnNn #1#2#3#4 - { - \use_none:nn #3 { \int_set:Nn \l__regex_capturing_group_int {#1} } - \int_set:Nn \l__regex_capturing_group_int {#2} - #3 {#4} - \exp_args:Nf \__regex_group_resetting_loop:nnNn - { \int_max:nn {#1} { \l__regex_capturing_group_int } } - {#2} - } -\cs_new_protected:Npn \__regex_branch:n #1 - { - \__regex_build_new_state: - \seq_get:NN \l__regex_left_state_seq \l__regex_internal_a_tl - \int_set:Nn \l__regex_left_state_int \l__regex_internal_a_tl - \__regex_build_transition_right:nNn \__regex_action_free:n - \l__regex_left_state_int \l__regex_right_state_int - #1 - \seq_get:NN \l__regex_right_state_seq \l__regex_internal_a_tl - \__regex_build_transition_right:nNn \__regex_action_free:n - \l__regex_right_state_int \l__regex_internal_a_tl - } -\cs_new_protected:Npn \__regex_group_repeat:nn #1#2 - { - \if_int_compare:w #2 = 0 \exp_stop_f: - \int_set:Nn \l__regex_max_state_int - { \l__regex_left_state_int - 1 } - \__regex_build_new_state: - \else: - \__regex_group_repeat_aux:n {#2} - \__regex_group_submatches:nNN {#1} - \l__regex_internal_a_int \l__regex_right_state_int - \__regex_build_new_state: - \fi: - } -\cs_new_protected:Npn \__regex_group_submatches:nNN #1#2#3 - { - \if_int_compare:w #1 > - 1 \exp_stop_f: - \__regex_toks_put_left:Nx #2 { \__regex_action_submatch:n { #1 < } } - \__regex_toks_put_left:Nx #3 { \__regex_action_submatch:n { #1 > } } - \fi: - } -\cs_new_protected:Npn \__regex_group_repeat_aux:n #1 - { - \__regex_build_transition_right:nNn \__regex_action_free:n - \l__regex_right_state_int \l__regex_max_state_int - \int_set_eq:NN \l__regex_internal_a_int \l__regex_left_state_int - \int_set_eq:NN \l__regex_internal_b_int \l__regex_max_state_int - \if_int_compare:w \__int_eval:w #1 > 1 \exp_stop_f: - \int_set:Nn \l__regex_internal_c_int - { - ( #1 - 1 ) - * ( \l__regex_internal_b_int - \l__regex_internal_a_int ) - } - \int_add:Nn \l__regex_right_state_int { \l__regex_internal_c_int } - \int_add:Nn \l__regex_max_state_int { \l__regex_internal_c_int } - \__regex_toks_memcpy:NNn - \l__regex_internal_b_int - \l__regex_internal_a_int - \l__regex_internal_c_int - \fi: - } -\cs_new_protected:Npn \__regex_group_repeat:nnN #1#2#3 - { - \if_int_compare:w #2 = 0 \exp_stop_f: - \__regex_group_submatches:nNN {#1} - \l__regex_left_state_int \l__regex_right_state_int - \int_set:Nn \l__regex_internal_a_int - { \l__regex_left_state_int - 1 } - \__regex_build_transition_right:nNn \__regex_action_free:n - \l__regex_right_state_int \l__regex_internal_a_int - \__regex_build_new_state: - \if_meaning:w \c_true_bool #3 - \__regex_build_transition_left:NNN \__regex_action_free:n - \l__regex_internal_a_int \l__regex_right_state_int - \else: - \__regex_build_transition_right:nNn \__regex_action_free:n - \l__regex_internal_a_int \l__regex_right_state_int - \fi: - \else: - \__regex_group_repeat_aux:n {#2} - \__regex_group_submatches:nNN {#1} - \l__regex_internal_a_int \l__regex_right_state_int - \if_meaning:w \c_true_bool #3 - \__regex_build_transition_right:nNn \__regex_action_free_group:n - \l__regex_right_state_int \l__regex_internal_a_int - \else: - \__regex_build_transition_left:NNN \__regex_action_free_group:n - \l__regex_right_state_int \l__regex_internal_a_int - \fi: - \__regex_build_new_state: - \fi: - } -\cs_new_protected:Npn \__regex_group_repeat:nnnN #1#2#3#4 - { - \__regex_group_submatches:nNN {#1} - \l__regex_left_state_int \l__regex_right_state_int - \__regex_group_repeat_aux:n { #2 + #3 } - \if_meaning:w \c_true_bool #4 - \int_set_eq:NN \l__regex_left_state_int \l__regex_max_state_int - \prg_replicate:nn { #3 } - { - \int_sub:Nn \l__regex_left_state_int - { \l__regex_internal_b_int - \l__regex_internal_a_int } - \__regex_build_transition_left:NNN \__regex_action_free:n - \l__regex_left_state_int \l__regex_max_state_int - } - \else: - \prg_replicate:nn { #3 - 1 } - { - \int_sub:Nn \l__regex_right_state_int - { \l__regex_internal_b_int - \l__regex_internal_a_int } - \__regex_build_transition_right:nNn \__regex_action_free:n - \l__regex_right_state_int \l__regex_max_state_int - } - \if_int_compare:w #2 = 0 \exp_stop_f: - \int_set:Nn \l__regex_right_state_int - { \l__regex_left_state_int - 1 } - \else: - \int_sub:Nn \l__regex_right_state_int - { \l__regex_internal_b_int - \l__regex_internal_a_int } - \fi: - \__regex_build_transition_right:nNn \__regex_action_free:n - \l__regex_right_state_int \l__regex_max_state_int - \fi: - \__regex_build_new_state: - } -\cs_new_protected:Npn \__regex_assertion:Nn #1#2 - { - \__regex_build_new_state: - \__regex_toks_put_right:Nx \l__regex_left_state_int - { - \exp_not:n {#2} - \__regex_break_point:TF - \bool_if:NF #1 { { } } - { - \__regex_action_free:n - { - \int_eval:n - { \l__regex_right_state_int - \l__regex_left_state_int } - } - } - \bool_if:NT #1 { { } } - } - } -\cs_new_protected:Npn \__regex_anchor:N #1 - { - \if_int_compare:w #1 = \l__regex_current_pos_int - \exp_after:wN \__regex_break_true:w - \fi: - } -\cs_new_protected:Npn \__regex_b_test: - { - \group_begin: - \int_set_eq:NN \l__regex_current_char_int \l__regex_last_char_int - \__regex_prop_w: - \__regex_break_point:TF - { \group_end: \__regex_item_reverse:n \__regex_prop_w: } - { \group_end: \__regex_prop_w: } - } -\cs_new_protected:Npn \__regex_command_K: - { - \__regex_build_new_state: - \__regex_toks_put_right:Nx \l__regex_left_state_int - { - \__regex_action_submatch:n { 0< } - \bool_set_true:N \l__regex_fresh_thread_bool - \__regex_action_free:n - { \int_eval:n { \l__regex_right_state_int - \l__regex_left_state_int } } - \bool_set_false:N \l__regex_fresh_thread_bool - } - } -\int_new:N \l__regex_min_pos_int -\int_new:N \l__regex_max_pos_int -\int_new:N \l__regex_current_pos_int -\int_new:N \l__regex_start_pos_int -\int_new:N \l__regex_success_pos_int -\int_new:N \l__regex_current_char_int -\int_new:N \l__regex_current_catcode_int -\int_new:N \l__regex_last_char_int -\int_new:N \l__regex_case_changed_char_int -\int_new:N \l__regex_current_state_int -\prop_new:N \l__regex_current_submatches_prop -\prop_new:N \l__regex_success_submatches_prop -\int_new:N \l__regex_step_int -\int_new:N \l__regex_min_active_int -\int_new:N \l__regex_max_active_int -\__intarray_new:Nn \g__regex_state_active_intarray { 65536 } -\__intarray_new:Nn \g__regex_thread_state_intarray { 65536 } -\tl_new:N \l__regex_every_match_tl -\bool_new:N \l__regex_fresh_thread_bool -\bool_new:N \l__regex_empty_success_bool -\cs_new_eq:NN \__regex_if_two_empty_matches:F \use:n -\bool_new:N \g__regex_success_bool -\bool_new:N \l__regex_saved_success_bool -\bool_new:N \l__regex_match_success_bool -\cs_new_protected:Npn \__regex_match:n #1 - { - \int_zero:N \l__regex_balance_int - \int_set:Nn \l__regex_current_pos_int { 2 * \l__regex_max_state_int } - \__regex_query_set:nnn { } { -1 } { -2 } - \int_set_eq:NN \l__regex_min_pos_int \l__regex_current_pos_int - \__tl_analysis_map_inline:nn {#1} - { \__regex_query_set:nnn {##1} {"##2} {##3} } - \int_set_eq:NN \l__regex_max_pos_int \l__regex_current_pos_int - \__regex_query_set:nnn { } { -1 } { -2 } - \bool_gset_false:N \g__regex_success_bool - \int_step_inline:nnnn - \l__regex_min_state_int { 1 } { \l__regex_max_state_int - 1 } - { \__intarray_gset_fast:Nnn \g__regex_state_active_intarray {##1} { 1 } } - \int_set_eq:NN \l__regex_min_active_int \l__regex_max_state_int - \int_zero:N \l__regex_step_int - \int_set_eq:NN \l__regex_success_pos_int \l__regex_min_pos_int - \int_set:Nn \l__regex_min_submatch_int - { 2 * \l__regex_max_state_int } - \int_set_eq:NN \l__regex_submatch_int \l__regex_min_submatch_int - \bool_set_false:N \l__regex_empty_success_bool - \__regex_match_once: - } -\cs_new_protected:Npn \__regex_match_once: - { - \if_meaning:w \c_true_bool \l__regex_empty_success_bool - \cs_set:Npn \__regex_if_two_empty_matches:F - { \int_compare:nNnF \l__regex_start_pos_int = \l__regex_current_pos_int } - \else: - \cs_set_eq:NN \__regex_if_two_empty_matches:F \use:n - \fi: - \int_set_eq:NN \l__regex_start_pos_int \l__regex_success_pos_int - \bool_set_false:N \l__regex_match_success_bool - \prop_clear:N \l__regex_current_submatches_prop - \int_set_eq:NN \l__regex_max_active_int \l__regex_min_active_int - \__regex_store_state:n { \l__regex_min_state_int } - \int_set:Nn \l__regex_current_pos_int - { \l__regex_start_pos_int - 1 } - \__regex_query_get: - \__regex_match_loop: - \l__regex_every_match_tl - } -\cs_new_protected:Npn \__regex_single_match: - { - \tl_set:Nn \l__regex_every_match_tl - { \bool_gset_eq:NN \g__regex_success_bool \l__regex_match_success_bool } - } -\cs_new_protected:Npn \__regex_multi_match:n #1 - { - \tl_set:Nn \l__regex_every_match_tl - { - \if_meaning:w \c_true_bool \l__regex_match_success_bool - \bool_gset_true:N \g__regex_success_bool - #1 - \exp_after:wN \__regex_match_once: - \fi: - } - } -\cs_new_protected:Npn \__regex_match_loop: - { - \int_add:Nn \l__regex_step_int { 2 } - \int_incr:N \l__regex_current_pos_int - \int_set_eq:NN \l__regex_last_char_int \l__regex_current_char_int - \int_set_eq:NN \l__regex_case_changed_char_int \c_max_int - \__regex_query_get: - \use:x - { - \int_set_eq:NN \l__regex_max_active_int \l__regex_min_active_int - \int_step_function:nnnN - { \l__regex_min_active_int } - { 1 } - { \l__regex_max_active_int - 1 } - \__regex_match_one_active:n - } - \__prg_break_point: - \bool_set_false:N \l__regex_fresh_thread_bool %^^A was arg of break_point:n - \if_int_compare:w \l__regex_max_active_int > \l__regex_min_active_int - \if_int_compare:w \l__regex_current_pos_int < \l__regex_max_pos_int - \exp_after:wN \exp_after:wN \exp_after:wN \__regex_match_loop: - \fi: - \fi: - } -\cs_new:Npn \__regex_match_one_active:n #1 - { - \__regex_use_state_and_submatches:nn - { \__intarray_item_fast:Nn \g__regex_thread_state_intarray {#1} } - { \__regex_toks_use:w #1 } - } -\cs_new_protected:Npn \__regex_query_set:nnn #1#2#3 - { - \__intarray_gset_fast:Nnn \g__regex_charcode_intarray - { \l__regex_current_pos_int } {#3} - \__intarray_gset_fast:Nnn \g__regex_catcode_intarray - { \l__regex_current_pos_int } {#2} - \__intarray_gset_fast:Nnn \g__regex_balance_intarray - { \l__regex_current_pos_int } { \l__regex_balance_int } - \__regex_toks_set:Nn \l__regex_current_pos_int {#1} - \int_incr:N \l__regex_current_pos_int - \if_case:w #2 \exp_stop_f: - \or: \int_incr:N \l__regex_balance_int - \or: \int_decr:N \l__regex_balance_int - \fi: - } -\cs_new_protected:Npn \__regex_query_get: - { - \l__regex_current_char_int - = \__intarray_item_fast:Nn \g__regex_charcode_intarray - { \l__regex_current_pos_int } \scan_stop: - \l__regex_current_catcode_int - = \__intarray_item_fast:Nn \g__regex_catcode_intarray - { \l__regex_current_pos_int } \scan_stop: - } -\cs_new_protected:Npn \__regex_use_state: - { - \__intarray_gset_fast:Nnn \g__regex_state_active_intarray - { \l__regex_current_state_int } { \l__regex_step_int } - \__regex_toks_use:w \l__regex_current_state_int - \__intarray_gset_fast:Nnn \g__regex_state_active_intarray - { \l__regex_current_state_int } { \l__regex_step_int + 1 } - } -\cs_new_protected:Npn \__regex_use_state_and_submatches:nn #1 #2 - { - \int_set:Nn \l__regex_current_state_int {#1} - \if_int_compare:w - \__intarray_item_fast:Nn \g__regex_state_active_intarray - { \l__regex_current_state_int } - < \l__regex_step_int - \tl_set:Nn \l__regex_current_submatches_prop {#2} - \exp_after:wN \__regex_use_state: - \fi: - \scan_stop: - } -\cs_new_protected:Npn \__regex_action_start_wildcard: - { - \bool_set_true:N \l__regex_fresh_thread_bool - \__regex_action_free:n {1} - \bool_set_false:N \l__regex_fresh_thread_bool - \__regex_action_cost:n {0} - } -\cs_new_protected:Npn \__regex_action_free:n - { \__regex_action_free_aux:nn { > \l__regex_step_int \else: } } -\cs_new_protected:Npn \__regex_action_free_group:n - { \__regex_action_free_aux:nn { < \l__regex_step_int } } -\cs_new_protected:Npn \__regex_action_free_aux:nn #1#2 - { - \use:x - { - \int_add:Nn \l__regex_current_state_int {#2} - \exp_not:n - { - \if_int_compare:w - \__intarray_item_fast:Nn \g__regex_state_active_intarray - { \l__regex_current_state_int } - #1 - \exp_after:wN \__regex_use_state: - \fi: - } - \int_set:Nn \l__regex_current_state_int - { \int_use:N \l__regex_current_state_int } - \tl_set:Nn \exp_not:N \l__regex_current_submatches_prop - { \exp_not:o \l__regex_current_submatches_prop } - } - } -\cs_new_protected:Npn \__regex_action_cost:n #1 - { - \exp_args:No \__regex_store_state:n - { \__int_value:w \__int_eval:w \l__regex_current_state_int + #1 } - } -\cs_new_protected:Npn \__regex_store_state:n #1 - { - \__regex_store_submatches: - \__intarray_gset_fast:Nnn \g__regex_thread_state_intarray - { \l__regex_max_active_int } {#1} - \int_incr:N \l__regex_max_active_int - } -\cs_new_protected:Npn \__regex_store_submatches: - { - \__regex_toks_set:No \l__regex_max_active_int - { \l__regex_current_submatches_prop } - } -\cs_new_protected:Npn \__regex_disable_submatches: - { - \cs_set_protected:Npn \__regex_store_submatches: { } - \cs_set_protected:Npn \__regex_action_submatch:n ##1 { } - } -\cs_new_protected:Npn \__regex_action_submatch:n #1 - { - \prop_put:Nno \l__regex_current_submatches_prop {#1} - { \int_use:N \l__regex_current_pos_int } - } -\cs_new_protected:Npn \__regex_action_success: - { - \__regex_if_two_empty_matches:F - { - \bool_set_true:N \l__regex_match_success_bool - \bool_set_eq:NN \l__regex_empty_success_bool - \l__regex_fresh_thread_bool - \int_set_eq:NN \l__regex_success_pos_int \l__regex_current_pos_int - \prop_set_eq:NN \l__regex_success_submatches_prop - \l__regex_current_submatches_prop - \__prg_break: - } - } -\int_new:N \l__regex_replacement_csnames_int -\tl_new:N \l__regex_replacement_category_tl -\seq_new:N \l__regex_replacement_category_seq -\tl_new:N \l__regex_balance_tl -\cs_new:Npn \__regex_replacement_balance_one_match:n #1 - { - \__regex_submatch_balance:n {#1} } -\cs_new:Npn \__regex_replacement_do_one_match:n #1 - { - \__regex_query_range:nn - { \__intarray_item_fast:Nn \g__regex_submatch_prev_intarray {#1} } - { \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray {#1} } - } -\cs_new:Npn \__regex_replacement_exp_not:N #1 { \exp_not:n {#1} } -\cs_new:Npn \__regex_query_range:nn #1#2 - { - \exp_after:wN \__regex_query_range_loop:ww - \__int_value:w \__int_eval:w #1 \exp_after:wN ; - \__int_value:w \__int_eval:w #2 ; - \__prg_break_point: - } -\cs_new:Npn \__regex_query_range_loop:ww #1 ; #2 ; - { - \if_int_compare:w #1 < #2 \exp_stop_f: - \else: - \exp_after:wN \__prg_break: - \fi: - \__regex_toks_use:w #1 \exp_stop_f: - \exp_after:wN \__regex_query_range_loop:ww - \__int_value:w \__int_eval:w #1 + 1 ; #2 ; - } -\cs_new:Npn \__regex_query_submatch:n #1 - { - \__regex_query_range:nn - { \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray {#1} } - { \__intarray_item_fast:Nn \g__regex_submatch_end_intarray {#1} } - } -\cs_new_protected:Npn \__regex_submatch_balance:n #1 - { - \__int_eval:w - \int_compare:nNnTF - { \__intarray_item_fast:Nn \g__regex_submatch_end_intarray {#1} } = 0 - { 0 } - { - \__intarray_item_fast:Nn \g__regex_balance_intarray - { \__intarray_item_fast:Nn \g__regex_submatch_end_intarray {#1} } - } - - - \int_compare:nNnTF - { \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray {#1} } = 0 - { 0 } - { - \__intarray_item_fast:Nn \g__regex_balance_intarray - { \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray {#1} } - } - \__int_eval_end: - } -\cs_new_protected:Npn \__regex_replacement:n #1 - { - \__tl_build:Nw \l__regex_internal_a_tl - \int_zero:N \l__regex_balance_int - \tl_clear:N \l__regex_balance_tl - \__regex_escape_use:nnnn - { - \if_charcode:w \c_right_brace_str ##1 - \__regex_replacement_rbrace:N - \else: - \__regex_replacement_normal:n - \fi: - ##1 - } - { \__regex_replacement_escaped:N ##1 } - { \__regex_replacement_normal:n ##1 } - {#1} - \prg_do_nothing: \prg_do_nothing: - \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: - \__msg_kernel_error:nnx { regex } { replacement-missing-rbrace } - { \int_use:N \l__regex_replacement_csnames_int } - \__tl_build_one:x - { \prg_replicate:nn \l__regex_replacement_csnames_int \cs_end: } - \fi: - \seq_if_empty:NF \l__regex_replacement_category_seq - { - \__msg_kernel_error:nnx { regex } { replacement-missing-rparen } - { \seq_count:N \l__regex_replacement_category_seq } - \seq_clear:N \l__regex_replacement_category_seq - } - \cs_gset:Npx \__regex_replacement_balance_one_match:n ##1 - { - + \int_use:N \l__regex_balance_int - \l__regex_balance_tl - - \__regex_submatch_balance:n {##1} - } - \__tl_build_end: - \exp_args:No \__regex_replacement_aux:n \l__regex_internal_a_tl - } -\cs_new_protected:Npn \__regex_replacement_aux:n #1 - { - \cs_set:Npn \__regex_replacement_do_one_match:n ##1 - { - \__regex_query_range:nn - { \__intarray_item_fast:Nn \g__regex_submatch_prev_intarray {##1} } - { \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray {##1} } - #1 - } - } -\cs_new_protected:Npn \__regex_replacement_normal:n #1 - { - \tl_if_empty:NTF \l__regex_replacement_category_tl - { \__tl_build_one:n {#1} } - { % ( - \token_if_eq_charcode:NNTF #1 ) - { - \seq_pop:NN \l__regex_replacement_category_seq - \l__regex_replacement_category_tl - } - { - \use:c { __regex_replacement_c_ \l__regex_replacement_category_tl :w } - \__regex_replacement_normal:n {#1} - } - } - } -\cs_new_protected:Npn \__regex_replacement_escaped:N #1 - { - \cs_if_exist_use:cF { __regex_replacement_#1:w } - { - \if_int_compare:w 1 < 1#1 \exp_stop_f: - \__regex_replacement_put_submatch:n {#1} - \else: - \exp_args:No \__regex_replacement_normal:n - { \token_to_str:N #1 } - \fi: - } - } -\cs_new_protected:Npn \__regex_replacement_put_submatch:n #1 - { - \if_int_compare:w #1 < \l__regex_capturing_group_int - \__tl_build_one:n { \__regex_query_submatch:n { #1 + ##1 } } - \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: - \tl_put_right:Nn \l__regex_balance_tl - { + \__regex_submatch_balance:n { \__int_eval:w #1+##1 \__int_eval_end: } } - \fi: - \fi: - } -\cs_new_protected:Npn \__regex_replacement_g:w #1#2 - { - \str_if_eq_x:nnTF { #1#2 } { \__regex_replacement_normal:n \c_left_brace_str } - { \l__regex_internal_a_int = \__regex_replacement_g_digits:NN } - { \__regex_replacement_error:NNN g #1 #2 } - } -\cs_new:Npn \__regex_replacement_g_digits:NN #1#2 - { - \token_if_eq_meaning:NNTF #1 \__regex_replacement_normal:n - { - \if_int_compare:w 1 < 1#2 \exp_stop_f: - #2 - \exp_after:wN \use_i:nnn - \exp_after:wN \__regex_replacement_g_digits:NN - \else: - \exp_stop_f: - \exp_after:wN \__regex_replacement_error:NNN - \exp_after:wN g - \fi: - } - { - \exp_stop_f: - \if_meaning:w \__regex_replacement_rbrace:N #1 - \exp_args:No \__regex_replacement_put_submatch:n - { \int_use:N \l__regex_internal_a_int } - \exp_after:wN \use_none:nn - \else: - \exp_after:wN \__regex_replacement_error:NNN - \exp_after:wN g - \fi: - } - #1 #2 - } -\cs_new_protected:Npn \__regex_replacement_c:w #1#2 - { - \token_if_eq_meaning:NNTF #1 \__regex_replacement_normal:n - { - \exp_after:wN \token_if_eq_charcode:NNTF \c_left_brace_str #2 - { \__regex_replacement_cu_aux:Nw \__regex_replacement_exp_not:N } - { - \cs_if_exist:cTF { __regex_replacement_c_#2:w } - { \__regex_replacement_cat:NNN #2 } - { \__regex_replacement_error:NNN c #1#2 } - } - } - { \__regex_replacement_error:NNN c #1#2 } - } -\cs_new_protected:Npn \__regex_replacement_cu_aux:Nw #1 - { - \if_case:w \l__regex_replacement_csnames_int - \__tl_build_one:n { \exp_not:n { \exp_after:wN #1 \cs:w } } - \else: - \__tl_build_one:n { \exp_not:n { \exp_after:wN \tl_to_str:V \cs:w } } - \fi: - \int_incr:N \l__regex_replacement_csnames_int - } -\cs_new_protected:Npn \__regex_replacement_u:w #1#2 - { - \str_if_eq_x:nnTF { #1#2 } { \__regex_replacement_normal:n \c_left_brace_str } - { \__regex_replacement_cu_aux:Nw \exp_not:V } - { \__regex_replacement_error:NNN u #1#2 } - } -\cs_new_protected:Npn \__regex_replacement_rbrace:N #1 - { - \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: - \__tl_build_one:n \cs_end: - \int_decr:N \l__regex_replacement_csnames_int - \else: - \__regex_replacement_normal:n {#1} - \fi: - } -\cs_new_protected:Npn \__regex_replacement_cat:NNN #1#2#3 - { - \token_if_eq_meaning:NNTF \prg_do_nothing: #3 - { \__msg_kernel_error:nn { regex } { replacement-catcode-end } } - { - \int_compare:nNnTF { \l__regex_replacement_csnames_int } > 0 - { - \__msg_kernel_error:nnnn - { regex } { replacement-catcode-in-cs } {#1} {#3} - #2 #3 - } - { - \str_if_eq:nnTF { #2 #3 } { \__regex_replacement_normal:n ( } % ) - { - \seq_push:NV \l__regex_replacement_category_seq - \l__regex_replacement_category_tl - \tl_set:Nn \l__regex_replacement_category_tl {#1} - } - { \use:c { __regex_replacement_c_#1:w } #2 #3 } - } - } - } -\group_begin: - \cs_new_protected:Npn \__regex_replacement_char:nNN #1#2#3 - { - \tex_lccode:D 0 = `#3 \scan_stop: - \tex_lowercase:D { \__tl_build_one:n {#1} } - } - \char_set_catcode_active:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_A:w - { \__regex_replacement_char:nNN { \exp_not:n { \exp_not:N ^^@ } } } - \char_set_catcode_group_begin:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_B:w - { - \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: - \int_incr:N \l__regex_balance_int - \fi: - \__regex_replacement_char:nNN - { \exp_not:n { \exp_after:wN ^^@ \if_false: } \fi: } } - } - \cs_new_protected:Npn \__regex_replacement_c_C:w #1#2 - { \__tl_build_one:n { \exp_not:N \exp_not:N \exp_not:c {#2} } } - \char_set_catcode_math_subscript:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_D:w - { \__regex_replacement_char:nNN { ^^@ } } - \char_set_catcode_group_end:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_E:w - { - \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: - \int_decr:N \l__regex_balance_int - \fi: - \__regex_replacement_char:nNN - { \exp_not:n { \if_false: { \fi: ^^@ } } - } - \char_set_catcode_letter:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_L:w - { \__regex_replacement_char:nNN { ^^@ } } - \char_set_catcode_math_toggle:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_M:w - { \__regex_replacement_char:nNN { ^^@ } } - \char_set_catcode_other:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_O:w - { \__regex_replacement_char:nNN { ^^@ } } - \char_set_catcode_parameter:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_P:w - { - \__regex_replacement_char:nNN - { \exp_not:n { \exp_not:n { ^^@^^@^^@^^@ } } } - } - \cs_new_protected:Npn \__regex_replacement_c_S:w #1#2 - { - \if_int_compare:w `#2 = 0 \exp_stop_f: - \__msg_kernel_error:nn { regex } { replacement-null-space } - \fi: - \tex_lccode:D `\ = `#2 \scan_stop: - \tex_lowercase:D { \__tl_build_one:n {~} } - } - \char_set_catcode_alignment:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_T:w - { \__regex_replacement_char:nNN { ^^@ } } - \char_set_catcode_math_superscript:N \^^@ - \cs_new_protected:Npn \__regex_replacement_c_U:w - { \__regex_replacement_char:nNN { ^^@ } } -\group_end: -\cs_new_protected:Npn \__regex_replacement_error:NNN #1#2#3 - { - \__msg_kernel_error:nnx { regex } { replacement-#1 } {#3} - #2 #3 - } -\cs_new_protected:Npn \regex_new:N #1 - { \cs_new_eq:NN #1 \c__regex_no_match_regex } -\cs_new_protected:Npn \regex_set:Nn #1#2 - { - \__regex_compile:n {#2} - \tl_set_eq:NN #1 \l__regex_internal_regex - } -\cs_new_protected:Npn \regex_gset:Nn #1#2 - { - \__regex_compile:n {#2} - \tl_gset_eq:NN #1 \l__regex_internal_regex - } -\cs_new_protected:Npn \regex_const:Nn #1#2 - { - \__regex_compile:n {#2} - \tl_const:Nx #1 { \exp_not:o \l__regex_internal_regex } - } -\cs_new_protected:Npn \regex_show:n #1 - { - \__regex_compile:n {#1} - \__regex_show:Nn \l__regex_internal_regex - { { \tl_to_str:n {#1} } } - } -\cs_new_protected:Npn \regex_show:N #1 - { \__regex_show:Nn #1 { variable~\token_to_str:N #1 } } -\prg_new_protected_conditional:Npnn \regex_match:nn #1#2 { T , F , TF } - { - \__regex_if_match:nn { \__regex_build:n {#1} } {#2} - \__regex_return: - } -\prg_new_protected_conditional:Npnn \regex_match:Nn #1#2 { T , F , TF } - { - \__regex_if_match:nn { \__regex_build:N #1 } {#2} - \__regex_return: - } -\cs_new_protected:Npn \regex_count:nnN #1 - { \__regex_count:nnN { \__regex_build:n {#1} } } -\cs_new_protected:Npn \regex_count:NnN #1 - { \__regex_count:nnN { \__regex_build:N #1 } } -\cs_set_protected:Npn \__regex_tmp:w #1#2#3 - { - \cs_new_protected:Npn #2 ##1 { #1 { \__regex_build:n {##1} } } - \cs_new_protected:Npn #3 ##1 { #1 { \__regex_build:N ##1 } } - \prg_new_protected_conditional:Npnn #2 ##1##2##3 { T , F , TF } - { #1 { \__regex_build:n {##1} } {##2} ##3 \__regex_return: } - \prg_new_protected_conditional:Npnn #3 ##1##2##3 { T , F , TF } - { #1 { \__regex_build:N ##1 } {##2} ##3 \__regex_return: } - } -\__regex_tmp:w \__regex_extract_once:nnN - \regex_extract_once:nnN \regex_extract_once:NnN -\__regex_tmp:w \__regex_extract_all:nnN - \regex_extract_all:nnN \regex_extract_all:NnN -\__regex_tmp:w \__regex_replace_once:nnN - \regex_replace_once:nnN \regex_replace_once:NnN -\__regex_tmp:w \__regex_replace_all:nnN - \regex_replace_all:nnN \regex_replace_all:NnN -\__regex_tmp:w \__regex_split:nnN \regex_split:nnN \regex_split:NnN -\int_new:N \l__regex_match_count_int -\flag_new:n { __regex_begin } -\flag_new:n { __regex_end } -\int_new:N \l__regex_min_submatch_int -\int_new:N \l__regex_submatch_int -\int_new:N \l__regex_zeroth_submatch_int -\__intarray_new:Nn \g__regex_submatch_prev_intarray { 65536 } -\__intarray_new:Nn \g__regex_submatch_begin_intarray { 65536 } -\__intarray_new:Nn \g__regex_submatch_end_intarray { 65536 } -\cs_new_protected:Npn \__regex_return: - { - \if_meaning:w \c_true_bool \g__regex_success_bool - \prg_return_true: - \else: - \prg_return_false: - \fi: - } -\cs_new_protected:Npn \__regex_if_match:nn #1#2 - { - \group_begin: - \__regex_disable_submatches: - \__regex_single_match: - #1 - \__regex_match:n {#2} - \group_end: - } -\cs_new_protected:Npn \__regex_count:nnN #1#2#3 - { - \group_begin: - \__regex_disable_submatches: - \int_zero:N \l__regex_match_count_int - \__regex_multi_match:n { \int_incr:N \l__regex_match_count_int } - #1 - \__regex_match:n {#2} - \exp_args:NNNo - \group_end: - \int_set:Nn #3 { \int_use:N \l__regex_match_count_int } - } -\cs_new_protected:Npn \__regex_extract_once:nnN #1#2#3 - { - \group_begin: - \__regex_single_match: - #1 - \__regex_match:n {#2} - \__regex_extract: - \__regex_group_end_extract_seq:N #3 - } -\cs_new_protected:Npn \__regex_extract_all:nnN #1#2#3 - { - \group_begin: - \__regex_multi_match:n { \__regex_extract: } - #1 - \__regex_match:n {#2} - \__regex_group_end_extract_seq:N #3 - } -\cs_new_protected:Npn \__regex_split:nnN #1#2#3 - { - \group_begin: - \__regex_multi_match:n - { - \if_int_compare:w \l__regex_start_pos_int < \l__regex_success_pos_int - \__regex_extract: - \__intarray_gset_fast:Nnn \g__regex_submatch_prev_intarray - { \l__regex_zeroth_submatch_int } { 0 } - \__intarray_gset_fast:Nnn \g__regex_submatch_end_intarray - { \l__regex_zeroth_submatch_int } - { - \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray - { \l__regex_zeroth_submatch_int } - } - \__intarray_gset_fast:Nnn \g__regex_submatch_begin_intarray - { \l__regex_zeroth_submatch_int } - { \l__regex_start_pos_int } - \fi: - } - #1 - \__regex_match:n {#2} - \__intarray_gset_fast:Nnn \g__regex_submatch_prev_intarray - { \l__regex_submatch_int } { 0 } - \__intarray_gset_fast:Nnn \g__regex_submatch_end_intarray - { \l__regex_submatch_int } - { \l__regex_max_pos_int } - \__intarray_gset_fast:Nnn \g__regex_submatch_begin_intarray - { \l__regex_submatch_int } - { \l__regex_start_pos_int } - \int_incr:N \l__regex_submatch_int - \if_meaning:w \c_true_bool \l__regex_empty_success_bool - \if_int_compare:w \l__regex_start_pos_int = \l__regex_max_pos_int - \int_decr:N \l__regex_submatch_int - \fi: - \fi: - \__regex_group_end_extract_seq:N #3 - } -\cs_new_protected:Npn \__regex_group_end_extract_seq:N #1 - { - \cs_set_eq:NN \__seq_item:n \scan_stop: - \flag_clear:n { __regex_begin } - \flag_clear:n { __regex_end } - \tl_set:Nx \l__regex_internal_a_tl - { - \s__seq - \int_step_function:nnnN - { \l__regex_min_submatch_int } - { 1 } - { \l__regex_submatch_int - 1 } - \__regex_extract_seq_aux:n - } - \int_compare:nNnF - { \flag_height:n { __regex_begin } + \flag_height:n { __regex_end } } - = 0 - { - \__msg_kernel_error:nnxxx { regex } { result-unbalanced } - { splitting~or~extracting~submatches } - { \flag_height:n { __regex_end } } - { \flag_height:n { __regex_begin } } - } - \use:x - { - \group_end: - \tl_set:Nn \exp_not:N #1 { \l__regex_internal_a_tl } - } - } -\cs_new:Npn \__regex_extract_seq_aux:n #1 - { - \__seq_item:n - { - \exp_after:wN \__regex_extract_seq_aux:ww - \__int_value:w \__regex_submatch_balance:n {#1} ; #1; - } - } -\cs_new:Npn \__regex_extract_seq_aux:ww #1; #2; - { - \if_int_compare:w #1 < 0 \exp_stop_f: - \flag_raise:n { __regex_end } - \prg_replicate:nn {-#1} { \exp_not:n { { \if_false: } \fi: } } - \fi: - \__regex_query_submatch:n {#2} - \if_int_compare:w #1 > 0 \exp_stop_f: - \flag_raise:n { __regex_begin } - \prg_replicate:nn {#1} { \exp_not:n { \if_false: { \fi: } } } - \fi: - } -\cs_new_protected:Npn \__regex_extract: - { - \if_meaning:w \c_true_bool \g__regex_success_bool - \int_set_eq:NN \l__regex_zeroth_submatch_int \l__regex_submatch_int - \prg_replicate:nn \l__regex_capturing_group_int - { - \__intarray_gset_fast:Nnn \g__regex_submatch_begin_intarray - { \l__regex_submatch_int } { 0 } - \__intarray_gset_fast:Nnn \g__regex_submatch_end_intarray - { \l__regex_submatch_int } { 0 } - \__intarray_gset_fast:Nnn \g__regex_submatch_prev_intarray - { \l__regex_submatch_int } { 0 } - \int_incr:N \l__regex_submatch_int - } - \prop_map_inline:Nn \l__regex_success_submatches_prop - { - \if_int_compare:w ##1 - 1 \exp_stop_f: - \exp_after:wN \__regex_extract_e:wn \__int_value:w - \else: - \exp_after:wN \__regex_extract_b:wn \__int_value:w - \fi: - \__int_eval:w \l__regex_zeroth_submatch_int + ##1 {##2} - } - \__intarray_gset_fast:Nnn \g__regex_submatch_prev_intarray - { \l__regex_zeroth_submatch_int } { \l__regex_start_pos_int } - \fi: - } -\cs_new_protected:Npn \__regex_extract_b:wn #1 < #2 - { \__intarray_gset_fast:Nnn \g__regex_submatch_begin_intarray {#1} {#2} } -\cs_new_protected:Npn \__regex_extract_e:wn #1 > #2 - { \__intarray_gset_fast:Nnn \g__regex_submatch_end_intarray {#1} {#2} } -\cs_new_protected:Npn \__regex_replace_once:nnN #1#2#3 - { - \group_begin: - \__regex_single_match: - #1 - \__regex_replacement:n {#2} - \exp_args:No \__regex_match:n { #3 } - \if_meaning:w \c_false_bool \g__regex_success_bool - \group_end: - \else: - \__regex_extract: - \int_set:Nn \l__regex_balance_int - { - \__regex_replacement_balance_one_match:n - { \l__regex_zeroth_submatch_int } - } - \tl_set:Nx \l__regex_internal_a_tl - { - \__regex_replacement_do_one_match:n { \l__regex_zeroth_submatch_int } - \__regex_query_range:nn - { - \__intarray_item_fast:Nn \g__regex_submatch_end_intarray - { \l__regex_zeroth_submatch_int } - } - { \l__regex_max_pos_int } - } - \__regex_group_end_replace:N #3 - \fi: - } -\cs_new_protected:Npn \__regex_replace_all:nnN #1#2#3 - { - \group_begin: - \__regex_multi_match:n { \__regex_extract: } - #1 - \__regex_replacement:n {#2} - \exp_args:No \__regex_match:n {#3} - \int_set:Nn \l__regex_balance_int - { - 0 - \int_step_function:nnnN - { \l__regex_min_submatch_int } - \l__regex_capturing_group_int - { \l__regex_submatch_int - 1 } - \__regex_replacement_balance_one_match:n - } - \tl_set:Nx \l__regex_internal_a_tl - { - \int_step_function:nnnN - { \l__regex_min_submatch_int } - \l__regex_capturing_group_int - { \l__regex_submatch_int - 1 } - \__regex_replacement_do_one_match:n - \__regex_query_range:nn - \l__regex_start_pos_int \l__regex_max_pos_int - } - \__regex_group_end_replace:N #3 - } -\cs_new_protected:Npn \__regex_group_end_replace:N #1 - { - \if_int_compare:w \l__regex_balance_int = 0 \exp_stop_f: - \else: - \__msg_kernel_error:nnxxx { regex } { result-unbalanced } - { replacing } - { \int_max:nn { - \l__regex_balance_int } { 0 } } - { \int_max:nn { \l__regex_balance_int } { 0 } } - \fi: - \use:x - { - \group_end: - \tl_set:Nn \exp_not:N #1 - { - \if_int_compare:w \l__regex_balance_int < 0 \exp_stop_f: - \prg_replicate:nn { - \l__regex_balance_int } - { { \if_false: } \fi: } - \fi: - \l__regex_internal_a_tl - \if_int_compare:w \l__regex_balance_int > 0 \exp_stop_f: - \prg_replicate:nn { \l__regex_balance_int } - { \if_false: { \fi: } } - \fi: - } - } - } -\__msg_kernel_new:nnnn { regex } { trailing-backslash } - { Trailing~escape~character~'\iow_char:N\\'. } - { - A~regular~expression~or~its~replacement~text~ends~with~ - the~escape~character~'\iow_char:N\\'.~It~will~be~ignored. - } -\__msg_kernel_new:nnnn { regex } { x-missing-rbrace } - { Missing~closing~brace~in~'\iow_char:N\\x'~hexadecimal~sequence. } - { - You~wrote~something~like~ - '\iow_char:N\\x\{...#1'.~ - The~closing~brace~is~missing. - } -\__msg_kernel_new:nnnn { regex } { x-overflow } - { Character~code~'#1'~too~large~in~'\iow_char:N\\x'~hexadecimal~sequence. } - { - You~wrote~something~like~ - '\iow_char:N\\x\{\int_to_Hex:n{#1}\}'.~ - The~character~code~#1~is~larger~than~ - the~maximum~value~\int_use:N \c_max_char_int. - } -\__msg_kernel_new:nnnn { regex } { invalid-quantifier } - { Braced~quantifier~'#1'~may~not~be~followed~by~'#2'. } - { - The~character~'#2'~is~invalid~in~the~braced~quantifier~'#1'.~ - The~only~valid~quantifiers~are~'*',~'?',~'+',~'{<int>}',~ - '{<min>,}'~and~'{<min>,<max>}',~optionally~followed~by~'?'. - } -\__msg_kernel_new:nnnn { regex } { missing-rbrack } - { Missing~right~bracket~inserted~in~regular~expression. } - { - LaTeX~was~given~a~regular~expression~where~a~character~class~ - was~started~with~'[',~but~the~matching~']'~is~missing. - } -\__msg_kernel_new:nnnn { regex } { missing-rparen } - { - Missing~right~ - \int_compare:nTF { #1 = 1 } { parenthesis } { parentheses } ~ - inserted~in~regular~expression. - } - { - LaTeX~was~given~a~regular~expression~with~\int_eval:n {#1} ~ - more~left~parentheses~than~right~parentheses. - } -\__msg_kernel_new:nnnn { regex } { extra-rparen } - { Extra~right~parenthesis~ignored~in~regular~expression. } - { - LaTeX~came~across~a~closing~parenthesis~when~no~submatch~group~ - was~open.~The~parenthesis~will~be~ignored. - } -\__msg_kernel_new:nnnn { regex } { bad-escape } - { - Invalid~escape~'\iow_char:N\\#1'~ - \__regex_if_in_cs:TF { within~a~control~sequence. } - { - \__regex_if_in_class:TF - { in~a~character~class. } - { following~a~category~test. } - } - } - { - The~escape~sequence~'\iow_char:N\\#1'~may~not~appear~ - \__regex_if_in_cs:TF - { - within~a~control~sequence~test~introduced~by~ - '\iow_char:N\\c\iow_char:N\{'. - } - { - \__regex_if_in_class:TF - { within~a~character~class~ } - { following~a~category~test~such~as~'\iow_char:N\\cL'~ } - because~it~does~not~match~exactly~one~character. - } - } -\__msg_kernel_new:nnnn { regex } { range-missing-end } - { Invalid~end-point~for~range~'#1-#2'~in~character~class. } - { - The~end-point~'#2'~of~the~range~'#1-#2'~may~not~serve~as~an~ - end-point~for~a~range:~alphanumeric~characters~should~not~be~ - escaped,~and~non-alphanumeric~characters~should~be~escaped. - } -\__msg_kernel_new:nnnn { regex } { range-backwards } - { Range~'[#1-#2]'~out~of~order~in~character~class. } - { - In~ranges~of~characters~'[x-y]'~appearing~in~character~classes,~ - the~first~character~code~must~not~be~larger~than~the~second.~ - Here,~'#1'~has~character~code~\int_eval:n {`#1},~while~ - '#2'~has~character~code~\int_eval:n {`#2}. - } -\__msg_kernel_new:nnnn { regex } { c-bad-mode } - { Invalid~nested~'\iow_char:N\\c'~escape~in~regular~expression. } - { - The~'\iow_char:N\\c'~escape~cannot~be~used~within~ - a~control~sequence~test~'\iow_char:N\\c{...}'.~ - To~combine~several~category~tests,~use~'\iow_char:N\\c[...]'. - } -\__msg_kernel_new:nnnn { regex } { c-missing-rbrace } - { Missing~right~brace~inserted~for~'\iow_char:N\\c'~escape. } - { - LaTeX~was~given~a~regular~expression~where~a~ - '\iow_char:N\\c\iow_char:N\{...'~construction~was~not~ended~ - with~a~closing~brace~'\iow_char:N\}'. - } -\__msg_kernel_new:nnnn { regex } { c-missing-rbrack } - { Missing~right~bracket~inserted~for~'\iow_char:N\\c'~escape. } - { - A~construction~'\iow_char:N\\c[...'~appears~in~a~ - regular~expression,~but~the~closing~']'~is~not~present. - } -\__msg_kernel_new:nnnn { regex } { c-missing-category } - { Invalid~character~'#1'~following~'\iow_char:N\\c'~escape. } - { - In~regular~expressions,~the~'\iow_char:N\\c'~escape~sequence~ - may~only~be~followed~by~a~left~brace,~a~left~bracket,~or~a~ - capital~letter~representing~a~character~category,~namely~ - one~of~'ABCDELMOPSTU'. - } -\__msg_kernel_new:nnnn { regex } { c-trailing } - { Trailing~category~code~escape~'\iow_char:N\\c'... } - { - A~regular~expression~ends~with~'\iow_char:N\\c'~followed~ - by~a~letter.~It~will~be~ignored. - } -\__msg_kernel_new:nnnn { regex } { u-missing-lbrace } - { Missing~left~brace~following~'\iow_char:N\\u'~escape. } - { - The~'\iow_char:N\\u'~escape~sequence~must~be~followed~by~ - a~brace~group~with~the~name~of~the~variable~to~use. - } -\__msg_kernel_new:nnnn { regex } { u-missing-rbrace } - { Missing~right~brace~inserted~for~'\iow_char:N\\u'~escape. } - { - LaTeX~ - \str_if_eq_x:nnTF { } {#2} - { reached~the~end~of~the~string~ } - { encountered~an~escaped~alphanumeric~character '\iow_char:N\\#2'~ } - when~parsing~the~argument~of~an~'\iow_char:N\\u\iow_char:N\{...\}'~escape. - } -\__msg_kernel_new:nnnn { regex } { posix-unsupported } - { POSIX~collating~element~'[#1 ~ #1]'~not~supported. } - { - The~'[.foo.]'~and~'[=bar=]'~syntaxes~have~a~special~meaning~ - in~POSIX~regular~expressions.~This~is~not~supported~by~LaTeX.~ - Maybe~you~forgot~to~escape~a~left~bracket~in~a~character~class? - } -\__msg_kernel_new:nnnn { regex } { posix-unknown } - { POSIX~class~'[:#1:]'~unknown. } - { - '[:#1:]'~is~not~among~the~known~POSIX~classes~ - '[:alnum:]',~'[:alpha:]',~'[:ascii:]',~'[:blank:]',~ - '[:cntrl:]',~'[:digit:]',~'[:graph:]',~'[:lower:]',~ - '[:print:]',~'[:punct:]',~'[:space:]',~'[:upper:]',~ - '[:word:]',~and~'[:xdigit:]'. - } -\__msg_kernel_new:nnnn { regex } { posix-missing-close } - { Missing~closing~':]'~for~POSIX~class. } - { The~POSIX~syntax~'#1'~must~be~followed~by~':]',~not~'#2'. } -\__msg_kernel_new:nnnn { regex } { result-unbalanced } - { Missing~brace~inserted~when~#1. } - { - LaTeX~was~asked~to~do~some~regular~expression~operation,~ - and~the~resulting~token~list~would~not~have~the~same~number~ - of~begin-group~and~end-group~tokens.~Braces~were~inserted:~ - #2~left,~#3~right. - } -\__msg_kernel_new:nnnn { regex } { unknown-option } - { Unknown~option~'#1'~for~regular~expressions. } - { - The~only~available~option~is~'case-insensitive',~toggled~by~ - '(?i)'~and~'(?-i)'. - } -\__msg_kernel_new:nnnn { regex } { special-group-unknown } - { Unknown~special~group~'#1~...'~in~a~regular~expression. } - { - The~only~valid~constructions~starting~with~'(?'~are~ - '(?:~...~)',~'(?|~...~)',~'(?i)',~and~'(?-i)'. - } -\__msg_kernel_new:nnnn { regex } { replacement-c } - { Misused~'\iow_char:N\\c'~command~in~a~replacement~text. } - { - In~a~replacement~text,~the~'\iow_char:N\\c'~escape~sequence~ - can~be~followed~by~one~of~the~letters~'ABCDELMOPSTU'~ - or~a~brace~group,~not~by~'#1'. - } -\__msg_kernel_new:nnnn { regex } { replacement-u } - { Misused~'\iow_char:N\\u'~command~in~a~replacement~text. } - { - In~a~replacement~text,~the~'\iow_char:N\\u'~escape~sequence~ - must~be~~followed~by~a~brace~group~holding~the~name~of~the~ - variable~to~use. - } -\__msg_kernel_new:nnnn { regex } { replacement-g } - { - Missing~brace~for~the~'\iow_char:N\\g'~construction~ - in~a~replacement~text. - } - { - In~the~replacement~text~for~a~regular~expression~search,~ - submatches~are~represented~either~as~'\iow_char:N \\g{dd..d}',~ - or~'\\d',~where~'d'~are~single~digits.~Here,~a~brace~is~missing. - } -\__msg_kernel_new:nnnn { regex } { replacement-catcode-end } - { - Missing~character~for~the~'\iow_char:N\\c<category><character>'~ - construction~in~a~replacement~text. - } - { - In~a~replacement~text,~the~'\iow_char:N\\c'~escape~sequence~ - can~be~followed~by~one~of~the~letters~'ABCDELMOPSTU'~representing~ - the~character~category.~Then,~a~character~must~follow.~LaTeX~ - reached~the~end~of~the~replacement~when~looking~for~that. - } -\__msg_kernel_new:nnnn { regex } { replacement-catcode-in-cs } - { - Category~code~'\iow_char:N\\c#1#3'~ignored~inside~ - '\iow_char:N\\c\{...\}'~in~a~replacement~text. - } - { - In~a~replacement~text,~the~category~codes~of~the~argument~of~ - '\iow_char:N\\c\{...\}'~are~ignored~when~building~the~control~ - sequence~name. - } -\__msg_kernel_new:nnnn { regex } { replacement-null-space } - { TeX~cannot~build~a~space~token~with~character~code~0. } - { - You~asked~for~a~character~token~with~category~space,~ - and~character~code~0,~for~instance~through~ - '\iow_char:N\\cS\iow_char:N\\x00'.~ - This~specific~case~is~impossible~and~will~be~replaced~ - by~a~normal~space. - } -\__msg_kernel_new:nnnn { regex } { replacement-missing-rbrace } - { Missing~right~brace~inserted~in~replacement~text. } - { - There~ \int_compare:nTF { #1 = 1 } { was } { were } ~ #1~ - missing~right~\int_compare:nTF { #1 = 1 } { brace } { braces } . - } -\__msg_kernel_new:nnnn { regex } { replacement-missing-rparen } - { Missing~right~parenthesis~inserted~in~replacement~text. } - { - There~ \int_compare:nTF { #1 = 1 } { was } { were } ~ #1~ - missing~right~\int_compare:nTF { #1 = 1 } { parenthesis } { parentheses } . - } -\cs_new:Npn \__regex_msg_repeated:nnN #1#2#3 - { - \str_if_eq_x:nnF { #1 #2 } { 1 0 } - { - , ~ repeated ~ - \int_case:nnF {#2} - { - { -1 } { #1~or~more~times,~\bool_if:NTF #3 { lazy } { greedy } } - { 0 } { #1~times } - } - { - between~#1~and~\int_eval:n {#1+#2}~times,~ - \bool_if:NTF #3 { lazy } { greedy } - } - } - } -%% -%% -%% End of file `l3regex.sty'. diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty index b7216bd406a..934457dae78 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty @@ -20,9 +20,8 @@ %% %% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \RequirePackage{expl3} -\ProvidesExplPackage{l3str-convert}{2017/05/13}{} +\ProvidesExplPackage{l3str-convert}{2017/05/29}{} {L3 Experimental string encoding conversions} -\RequirePackage{l3tl-analysis,l3tl-build} \cs_if_exist:NF \use_ii_i:nn { \cs_new:Npn \use_ii_i:nn #1#2 { #2 #1 } } \cs_new_protected:Npn \__str_tmp:w { } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty index abbaec08ea3..b638c905b0a 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty @@ -20,7 +20,7 @@ %% %% File: l3str-format.dtx Copyright (C) 2012-2013,2015-2017 The LaTeX3 Project \RequirePackage{expl3} -\ProvidesExplPackage{l3str-format}{2017/05/13}{} +\ProvidesExplPackage{l3str-format}{2017/05/29}{} {L3 Experimental string formatting} \RequirePackage{l3str} \cs_generate_variant:Nn \use:nn { nf } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty deleted file mode 100644 index 9b336143d14..00000000000 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty +++ /dev/null @@ -1,449 +0,0 @@ -%% -%% This is file `l3tl-analysis.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% l3tl-analysis.dtx (with options: `package') -%% -%% Copyright (C) 2011-2017 The 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 "l3experimental bundle" (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% File: l3tl-analysis.dtx Copyright (C) 2011-2012,2015-2017 The LaTeX3 Project -\RequirePackage{expl3} -\ProvidesExplPackage{l3tl-analysis}{2017/05/13}{} - {L3 Experimental token list analysis} -\__scan_new:N \s__tl -\tl_new:N \l__tl_analysis_internal_tl -\cs_new_eq:NN \l__tl_analysis_token ? -\cs_new_eq:NN \l__tl_analysis_char_token ? -\int_new:N \l__tl_analysis_normal_int -\int_new:N \l__tl_analysis_index_int -\int_new:N \l__tl_analysis_nesting_int -\int_new:N \l__tl_analysis_type_int -\tl_new:N \g__tl_analysis_result_tl -\cs_new:Npn \__tl_analysis_extract_charcode: - { - \exp_after:wN \__tl_analysis_extract_charcode_aux:w - \token_to_meaning:N \l__tl_analysis_token - } -\cs_new:Npn \__tl_analysis_extract_charcode_aux:w #1 ~ #2 ~ { ` } -\cs_new:Npn \__tl_analysis_cs_space_count:NN #1 #2 - { - \exp_after:wN #1 - \__int_value:w \__int_eval:w 0 - \exp_after:wN \__tl_analysis_cs_space_count:w - \token_to_str:N #2 - \fi: \__tl_analysis_cs_space_count_end:w ; ~ ! - } -\cs_new:Npn \__tl_analysis_cs_space_count:w #1 ~ - { - \if_false: #1 #1 \fi: - + 1 - \__tl_analysis_cs_space_count:w - } -\cs_new:Npn \__tl_analysis_cs_space_count_end:w ; #1 \fi: #2 ! - { \exp_after:wN ; \__int_value:w \str_count_ignore_spaces:n {#1} ; } -\cs_new_protected:Npn \__tl_analysis:n #1 - { - \group_begin: - \group_align_safe_begin: - \__tl_analysis_setup:n {#1} - \__tl_analysis_a:n {#1} - \__tl_analysis_b:n {#1} - \group_align_safe_end: - \group_end: - } -\cs_new_protected:Npn \__tl_analysis_setup:n #1 - { - \int_set:Nn \tex_escapechar:D { -1 } - \exp_after:wN \__tl_analysis_disable_loop:N - \tl_to_str:n {#1} { ~ } { ? \__prg_break: } - \__prg_break_point: - \scan_stop: - } -\group_begin: - \char_set_catcode_active:N \^^@ - \cs_new_protected:Npn \__tl_analysis_disable_loop:N #1 - { - \tex_lccode:D 0 = `#1 ~ - \tex_lowercase:D { \tex_let:D ^^@ } \tex_undefined:D - \__tl_analysis_disable_loop:N - } - \bool_lazy_or:nnT - { \sys_if_engine_ptex_p: } - { \sys_if_engine_uptex_p: } - { - \cs_gset_protected:Npn \__tl_analysis_disable_loop:N #1 - { - \use_none:n #1 \scan_stop: - \if_int_compare:w 256 > `#1 \exp_stop_f: - \tex_lccode:D 0 = `#1 ~ - \tex_lowercase:D { \tex_let:D ^^@ } \tex_undefined:D - \fi: - \__tl_analysis_disable_loop:N - } - } -\group_end: -\cs_new_protected:Npn \__tl_analysis_a:n #1 - { - \int_set:Nn \tex_escapechar:D { 92 } - \int_zero:N \l__tl_analysis_normal_int - \int_zero:N \l__tl_analysis_index_int - \int_zero:N \l__tl_analysis_nesting_int - \if_false: { \fi: \__tl_analysis_a_loop:w #1 } - \int_decr:N \l__tl_analysis_index_int - } -\cs_new_protected:Npn \__tl_analysis_a_loop:w - { \tex_futurelet:D \l__tl_analysis_token \__tl_analysis_a_type:w } -\cs_new_protected:Npn \__tl_analysis_a_type:w - { - \l__tl_analysis_type_int = - \if_meaning:w \l__tl_analysis_token \c_space_token - 0 - \else: - \if_catcode:w \exp_not:N \l__tl_analysis_token \c_group_begin_token - 1 - \else: - \if_catcode:w \exp_not:N \l__tl_analysis_token \c_group_end_token - - 1 - \else: - 2 - \fi: - \fi: - \fi: - \exp_stop_f: - \if_case:w \l__tl_analysis_type_int - \exp_after:wN \__tl_analysis_a_space:w - \or: \exp_after:wN \__tl_analysis_a_bgroup:w - \or: \exp_after:wN \__tl_analysis_a_safe:N - \else: \exp_after:wN \__tl_analysis_a_egroup:w - \fi: - } -\cs_new_protected:Npn \__tl_analysis_a_space:w - { - \tex_afterassignment:D \__tl_analysis_a_space_test:w - \exp_after:wN \cs_set_eq:NN - \exp_after:wN \l__tl_analysis_char_token - \token_to_str:N - } -\cs_new_protected:Npn \__tl_analysis_a_space_test:w - { - \if_meaning:w \l__tl_analysis_char_token \c_space_token - \tex_toks:D \l__tl_analysis_index_int { \exp_not:n { ~ } } - \__tl_analysis_a_store: - \else: - \int_incr:N \l__tl_analysis_normal_int - \fi: - \__tl_analysis_a_loop:w - } -\group_begin: - \char_set_catcode_group_begin:N \^^@ - \char_set_catcode_group_end:N \^^E - \cs_new_protected:Npn \__tl_analysis_a_bgroup:w - { \__tl_analysis_a_group:nw { \exp_after:wN ^^@ \if_false: ^^E \fi: } } - \char_set_catcode_group_begin:N \^^B - \char_set_catcode_group_end:N \^^@ - \cs_new_protected:Npn \__tl_analysis_a_egroup:w - { \__tl_analysis_a_group:nw { \if_false: ^^B \fi: ^^@ } } -\group_end: -\cs_new_protected:Npn \__tl_analysis_a_group:nw #1 - { - \tex_lccode:D 0 = \__tl_analysis_extract_charcode: \scan_stop: - \tex_lowercase:D { \tex_toks:D \l__tl_analysis_index_int {#1} } - \if_int_compare:w \tex_lccode:D 0 = \tex_escapechar:D - \int_set:Nn \tex_escapechar:D { 139 - \tex_escapechar:D } - \fi: - \tex_afterassignment:D \__tl_analysis_a_group_test:w - \exp_after:wN \cs_set_eq:NN - \exp_after:wN \l__tl_analysis_char_token - \token_to_str:N - } -\cs_new_protected:Npn \__tl_analysis_a_group_test:w - { - \if_charcode:w \l__tl_analysis_token \l__tl_analysis_char_token - \__tl_analysis_a_store: - \else: - \int_incr:N \l__tl_analysis_normal_int - \fi: - \__tl_analysis_a_loop:w - } -\cs_new_protected:Npn \__tl_analysis_a_store: - { - \tex_advance:D \l__tl_analysis_nesting_int \l__tl_analysis_type_int - \if_int_compare:w \tex_lccode:D 0 = `\ \exp_stop_f: - \tex_multiply:D \l__tl_analysis_type_int 2 \exp_stop_f: - \fi: - \tex_skip:D \l__tl_analysis_index_int - = \l__tl_analysis_normal_int sp plus \l__tl_analysis_type_int sp \scan_stop: - \int_incr:N \l__tl_analysis_index_int - \int_zero:N \l__tl_analysis_normal_int - \if_int_compare:w \l__tl_analysis_nesting_int = -1 \exp_stop_f: - \cs_set_eq:NN \__tl_analysis_a_loop:w \scan_stop: - \fi: - } -\cs_new_protected:Npn \__tl_analysis_a_safe:N #1 - { - \if_charcode:w - \scan_stop: - \exp_after:wN \use_none:n \token_to_str:N #1 \prg_do_nothing: - \scan_stop: - \int_incr:N \l__tl_analysis_normal_int - \else: - \__tl_analysis_cs_space_count:NN \__tl_analysis_a_cs:ww #1 - \fi: - \__tl_analysis_a_loop:w - } -\cs_new_protected:Npn \__tl_analysis_a_cs:ww #1; #2; - { - \if_int_compare:w #1 > 0 \exp_stop_f: - \tex_skip:D \l__tl_analysis_index_int - = \__int_eval:w \l__tl_analysis_normal_int + 1 sp \scan_stop: - \tex_advance:D \l__tl_analysis_index_int #1 \exp_stop_f: - \l__tl_analysis_normal_int #2 \exp_stop_f: - \else: - \tex_advance:D \l__tl_analysis_normal_int #2 \exp_stop_f: - \fi: - } -\cs_new_protected:Npn \__tl_analysis_b:n #1 - { - \tl_gset:Nx \g__tl_analysis_result_tl - { - \__tl_analysis_b_loop:w 0; #1 - \__prg_break_point: - } - } -\cs_new:Npn \__tl_analysis_b_loop:w #1; - { - \exp_after:wN \__tl_analysis_b_normals:ww - \__int_value:w \tex_skip:D #1 ; #1 ; - } -\cs_new:Npn \__tl_analysis_b_normals:ww #1; - { - \if_int_compare:w #1 = 0 \exp_stop_f: - \__tl_analysis_b_special:w - \fi: - \__tl_analysis_b_normal:wwN #1; - } -\cs_new:Npn \__tl_analysis_b_normal:wwN #1; #2; #3 - { - \exp_not:n { \exp_not:n { #3 } } \s__tl - \if_charcode:w - \scan_stop: - \exp_after:wN \use_none:n \token_to_str:N #3 \prg_do_nothing: - \scan_stop: - \exp_after:wN \__tl_analysis_b_char:Nww - \else: - \exp_after:wN \__tl_analysis_b_cs:Nww - \fi: - #3 #1; #2; - } -\cs_new:Npx \__tl_analysis_b_char:Nww #1 - { - \exp_not:N \if_meaning:w #1 \exp_not:N \tex_undefined:D - \token_to_str:N D \exp_not:N \else: - \exp_not:N \if_catcode:w #1 \c_catcode_other_token - \token_to_str:N C \exp_not:N \else: - \exp_not:N \if_catcode:w #1 \c_catcode_letter_token - \token_to_str:N B \exp_not:N \else: - \exp_not:N \if_catcode:w #1 \c_math_toggle_token 3 \exp_not:N \else: - \exp_not:N \if_catcode:w #1 \c_alignment_token 4 \exp_not:N \else: - \exp_not:N \if_catcode:w #1 \c_math_superscript_token 7 \exp_not:N \else: - \exp_not:N \if_catcode:w #1 \c_math_subscript_token 8 \exp_not:N \else: - \exp_not:N \if_catcode:w #1 \c_space_token - \token_to_str:N A \exp_not:N \else: - 6 - \exp_not:n { \fi: \fi: \fi: \fi: \fi: \fi: \fi: \fi: } - \exp_not:N \__int_value:w `#1 \s__tl - \exp_not:N \exp_after:wN \exp_not:N \__tl_analysis_b_normals:ww - \exp_not:N \__int_value:w \exp_not:N \__int_eval:w - 1 + - } -\cs_new:Npn \__tl_analysis_b_cs:Nww #1 - { - 0 -1 \s__tl - \__tl_analysis_cs_space_count:NN \__tl_analysis_b_cs_test:ww #1 - } -\cs_new:Npn \__tl_analysis_b_cs_test:ww #1 ; #2 ; #3 ; #4 ; - { - \exp_after:wN \__tl_analysis_b_normals:ww - \__int_value:w \__int_eval:w - \if_int_compare:w #1 = 0 \exp_stop_f: - #3 - \else: - \tex_skip:D \__int_eval:w #4 + #1 \__int_eval_end: - \fi: - - #2 - \exp_after:wN ; - \__int_value:w \__int_eval:w #4 + #1 ; - } -\group_begin: - \char_set_catcode_other:N A - \cs_new:Npn \__tl_analysis_b_special:w - \fi: \__tl_analysis_b_normal:wwN 0 ; #1 ; - { - \fi: - \if_int_compare:w #1 = \l__tl_analysis_index_int - \exp_after:wN \__prg_break: - \fi: - \tex_the:D \tex_toks:D #1 \s__tl - \if_case:w \etex_gluestretch:D \tex_skip:D #1 \exp_stop_f: - A - \or: 1 - \or: 1 - \else: 2 - \fi: - \if_int_odd:w \etex_gluestretch:D \tex_skip:D #1 \exp_stop_f: - \exp_after:wN \__tl_analysis_b_special_char:wN \__int_value:w - \else: - \exp_after:wN \__tl_analysis_b_special_space:w \__int_value:w - \fi: - \__int_eval:w 1 + #1 \exp_after:wN ; - \token_to_str:N - } -\group_end: -\cs_new:Npn \__tl_analysis_b_special_char:wN #1 ; #2 - { - \__int_value:w `#2 \s__tl - \__tl_analysis_b_loop:w #1 ; - } -\cs_new:Npn \__tl_analysis_b_special_space:w #1 ; ~ - { - 32 \s__tl - \__tl_analysis_b_loop:w #1 ; - } -\cs_new_protected:Npn \__tl_analysis_map_inline:nn #1 - { - \__tl_analysis:n {#1} - \int_gincr:N \g__prg_map_int - \exp_args:Nc \__tl_analysis_map_inline_aux:Nn - { __tl_analysis_map_inline_ \int_use:N \g__prg_map_int :wNw } - } -\cs_new_protected:Npn \__tl_analysis_map_inline_aux:Nn #1#2 - { - \cs_gset_protected:Npn #1 ##1 \s__tl ##2 ##3 \s__tl - { - \use_none:n ##2 - #2 - #1 - } - \exp_after:wN #1 - \g__tl_analysis_result_tl - \s__tl { ? \tl_map_break: } \s__tl - \__prg_break_point:Nn \tl_map_break: { \int_gdecr:N \g__prg_map_int } - } -\cs_new_protected:Npn \tl_show_analysis:N #1 - { - \tl_if_exist:NTF #1 - { - \exp_args:No \__tl_analysis:n {#1} - \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-tl-analysis } - { \token_to_str:N #1 } { \tl_if_empty:NTF #1 { } { ? } } { } { } - \__tl_analysis_show: - } - { \tl_show:N #1 } - } -\cs_new_protected:Npn \tl_show_analysis:n #1 - { - \__tl_analysis:n {#1} - \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-tl-analysis } - { } { \tl_if_empty:nTF {#1} { } { ? } } { } { } - \__tl_analysis_show: - } -\cs_new_protected:Npn \__tl_analysis_show: - { - \group_begin: - \exp_args:NNx - \group_end: - \__msg_show_wrap:n - { - \exp_after:wN \__tl_analysis_show_loop:wNw \g__tl_analysis_result_tl - \s__tl { ? \__prg_break: } \s__tl - \__prg_break_point: - } - } -\cs_new:Npn \__tl_analysis_show_loop:wNw #1 \s__tl #2 #3 \s__tl - { - \use_none:n #2 - \exp_not:n { \\ > \ \ } - \if_int_compare:w "#2 = 0 \exp_stop_f: - \exp_after:wN \__tl_analysis_show_cs:n - \else: - \if_int_compare:w "#2 = 13 \exp_stop_f: - \exp_after:wN \exp_after:wN - \exp_after:wN \__tl_analysis_show_active:n - \else: - \exp_after:wN \exp_after:wN - \exp_after:wN \__tl_analysis_show_normal:n - \fi: - \fi: - {#1} - \__tl_analysis_show_loop:wNw - } -\cs_new:Npn \__tl_analysis_show_normal:n #1 - { - \exp_after:wN \token_to_str:N #1 ~ - ( \exp_after:wN \token_to_meaning:N #1 ) - } -\cs_new:Npn \__tl_analysis_show_value:N #1 - { - \token_if_expandable:NF #1 - { - \token_if_chardef:NTF #1 \__prg_break: { } - \token_if_mathchardef:NTF #1 \__prg_break: { } - \token_if_dim_register:NTF #1 \__prg_break: { } - \token_if_int_register:NTF #1 \__prg_break: { } - \token_if_skip_register:NTF #1 \__prg_break: { } - \token_if_toks_register:NTF #1 \__prg_break: { } - \use_none:nnn - \__prg_break_point: - \use:n { \exp_after:wN = \tex_the:D #1 } - } - } -\cs_new:Npn \__tl_analysis_show_cs:n #1 - { \exp_args:No \__tl_analysis_show_long:nn {#1} { control~sequence= } } -\cs_new:Npn \__tl_analysis_show_active:n #1 - { \exp_args:No \__tl_analysis_show_long:nn {#1} { active~character= } } -\cs_new:Npn \__tl_analysis_show_long:nn #1 - { - \__tl_analysis_show_long_aux:oofn - { \token_to_str:N #1 } - { \token_to_meaning:N #1 } - { \__tl_analysis_show_value:N #1 } - } -\cs_new:Npn \__tl_analysis_show_long_aux:nnnn #1#2#3#4 - { - \int_compare:nNnTF - { \str_count:n { #1 ~ ( #4 #2 #3 ) } } - > { \l_iow_line_count_int - 3 } - { - \str_range:nnn { #1 ~ ( #4 #2 #3 ) } { 1 } - { - \l_iow_line_count_int - 3 - - \str_count:N \c__tl_analysis_show_etc_str - } - \c__tl_analysis_show_etc_str - } - { #1 ~ ( #4 #2 #3 ) } - } -\cs_generate_variant:Nn \__tl_analysis_show_long_aux:nnnn { oof } -\tl_const:Nx \c__tl_analysis_show_etc_str % ( - { \token_to_str:N \ETC.) } -\__msg_kernel_new:nnn { kernel } { show-tl-analysis } - { - The~token~list~ \tl_if_empty:nF {#1} { #1 ~ } - \tl_if_empty:nTF {#2} - { is~empty } - { contains~the~tokens: } - } -%% -%% -%% End of file `l3tl-analysis.sty'. diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty deleted file mode 100644 index 9feca451233..00000000000 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty +++ /dev/null @@ -1,104 +0,0 @@ -%% -%% This is file `l3tl-build.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% l3tl-build.dtx (with options: `package') -%% -%% Copyright (C) 2011-2017 The 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 "l3experimental bundle" (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% File: l3tl-build.dtx Copyright (C) 2011-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/05/13] -\@ifpackagelater{expl3}{2017/05/13} - {} - {% - \PackageError{l3tl-build}{Support package l3kernel too old} - {% - Please install an up to date version of l3kernel\MessageBreak - using your TeX package manager or from CTAN.\MessageBreak - \MessageBreak - Loading l3tl-build will abort!% - }% - \endinput - } -\ProvidesExplPackage{l3tl-build}{2017/05/13}{} - {L3 Experimental token list construction} -\int_new:N \l__tl_build_start_index_int -\int_new:N \l__tl_build_index_int -\tl_new:N \l__tl_build_result_tl -\cs_new_protected:Npn \__tl_build_unpack: - { - \tl_put_right:Nx \l__tl_build_result_tl - { - \exp_after:wN \__tl_build_unpack_loop:w - \int_use:N \l__tl_build_start_index_int ; - \__prg_break_point: - } - } -\cs_new:Npn \__tl_build_unpack_loop:w #1 ; - { - \if_int_compare:w #1 = \l__tl_build_index_int - \exp_after:wN \__prg_break: - \fi: - \tex_the:D \tex_toks:D #1 \exp_stop_f: - \exp_after:wN \__tl_build_unpack_loop:w - \int_use:N \__int_eval:w #1 + 1 ; - } -\cs_new_protected:Npn \__tl_build:Nw - { \__tl_build_aux:NNw \tl_set:Nn } -\cs_new_protected:Npn \__tl_build_x:Nw - { \__tl_build_aux:NNw \tl_set:Nx } -\cs_new_protected:Npn \__tl_gbuild:Nw - { \__tl_build_aux:NNw \tl_gset:Nn } -\cs_new_protected:Npn \__tl_gbuild_x:Nw - { \__tl_build_aux:NNw \tl_gset:Nx } -\cs_new_protected:Npn \__tl_build_aux:NNw #1#2 - { - \group_begin: - \cs_set:Npn \__tl_build_end_assignment:n - { \group_end: #1 #2 } - \int_zero:N \l__tl_build_start_index_int - \int_zero:N \l__tl_build_index_int - \tl_clear:N \l__tl_build_result_tl - } -\cs_new_protected:Npn \__tl_build_end: - { - \__tl_build_unpack: - \exp_args:No - \__tl_build_end_assignment:n \l__tl_build_result_tl - } -\cs_new_eq:NN \__tl_build_end_assignment:n \use_none:n -\cs_new_protected:Npn \__tl_build_one:n #1 - { - \tex_toks:D \l__tl_build_index_int {#1} - \int_incr:N \l__tl_build_index_int - \if_int_compare:w \l__tl_build_index_int > \c_max_register_int - \__tl_build_unpack: - \l__tl_build_index_int \l__tl_build_start_index_int - \fi: - } -\cs_new_protected:Npn \__tl_build_one:o #1 - { - \tex_toks:D \l__tl_build_index_int \exp_after:wN {#1} - \int_incr:N \l__tl_build_index_int - \if_int_compare:w \l__tl_build_index_int > \c_max_register_int - \__tl_build_unpack: - \l__tl_build_index_int \l__tl_build_start_index_int - \fi: - } -\cs_new_protected:Npn \__tl_build_one:x #1 - { \use:x { \__tl_build_one:n {#1} } } -%% -%% -%% End of file `l3tl-build.sty'. diff --git a/Master/texmf-dist/tex/latex/l3experimental/xcoffins/xcoffins.sty b/Master/texmf-dist/tex/latex/l3experimental/xcoffins/xcoffins.sty index 1e2905d4cf4..4158ff85dbd 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xcoffins/xcoffins.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xcoffins/xcoffins.sty @@ -20,7 +20,7 @@ %% %% File: xcoffins.dtx Copyright(C) 2010-2012,2014,2016,2017 The LaTeX3 Project \RequirePackage{xparse} -\ProvidesExplPackage{xcoffins}{2017/05/13}{} +\ProvidesExplPackage{xcoffins}{2017/05/29}{} {L3 Experimental design level coffins} \keys_define:nn { coffin } { diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty index f4e6e5574f4..9f687c7e4f5 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty @@ -20,8 +20,8 @@ %% %% File: l3galley.dtx Copyright (C) 1999-2001, 2004-2009 Frank Mittelbach %% (C) 2010-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/05/13] -\@ifpackagelater{expl3}{2017/05/13} +\RequirePackage{expl3}[2017/05/29] +\@ifpackagelater{expl3}{2017/05/29} {} {% \PackageError{l3galley}{Support package l3kernel too old} @@ -33,7 +33,7 @@ }% \endinput } -\ProvidesExplPackage{l3galley}{2017/05/13}{} +\ProvidesExplPackage{l3galley}{2017/05/29}{} {L3 Experimental galley code} \int_new:N \l__galley_tmp_int \seq_new:N \g__galley_tmpa_seq diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty index 13e44bce0fd..53ce196568a 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty @@ -21,7 +21,7 @@ %% File: xgalley.dtx Copyright (C) 1999-2001, 2004-2009 Frank Mittelbach %% (C) 2010-2012,2014,2016-2017 The LaTeX3 Project \RequirePackage{xparse} -\ProvidesExplPackage{xgalley}{2017/05/13}{} +\ProvidesExplPackage{xgalley}{2017/05/29}{} {L3 Experimental galley} \RequirePackage{xparse,xtemplate,l3galley} \clist_new:N \l__galley_tmpa_clist diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex b/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex index 16769c81796..ed3ba7dd47d 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex @@ -13,6 +13,7 @@ %% l3str.dtx (with options: `package') %% l3seq.dtx (with options: `package') %% l3int.dtx (with options: `package') +%% l3intarray.dtx (with options: `package') %% l3flag.dtx (with options: `package') %% l3quark.dtx (with options: `package') %% l3prg.dtx (with options: `package') @@ -37,6 +38,9 @@ %% l3fp-random.dtx (with options: `package') %% l3fp-assign.dtx (with options: `package') %% l3sort.dtx (with options: `package') +%% l3tl-build.dtx (with options: `package') +%% l3tl-analysis.dtx (with options: `package') +%% l3regex.dtx (with options: `package') %% l3box.dtx (with options: `package') %% l3coffins.dtx (with options: `package') %% l3color.dtx (with options: `package') @@ -58,7 +62,7 @@ %% and all files in that bundle must be distributed together. %% %% File: expl3.dtx Copyright (C) 1990-2017 The LaTeX3 Project -\def\ExplFileDate{2017/05/13}% +\def\ExplFileDate{2017/05/29}% \begingroup \def\next{\endgroup}% \expandafter\ifx\csname PackageError\endcsname\relax @@ -3094,6 +3098,7 @@ { \__prg_map_break:Nn \tl_map_break: { } } \cs_new:Npn \tl_map_break:n { \__prg_map_break:Nn \tl_map_break: } +\cs_generate_variant:Nn \tl_to_str:n { V } \cs_new:Npn \tl_to_str:N #1 { \etex_detokenize:D \exp_after:wN {#1} } \cs_generate_variant:Nn \tl_to_str:N { c } \cs_new:Npn \tl_use:N #1 @@ -5429,6 +5434,60 @@ \int_new:N \g_tmpa_int \int_new:N \g_tmpb_int \cs_new_eq:NN \c_minus_one \m@ne +%% File: l3intarray.dtx Copyright (C) 2017 The LaTeX3 Project +\int_new:N \g__intarray_font_int +\cs_new_protected:Npn \__intarray_new:Nn #1#2 + { + \__chk_if_free_cs:N #1 + \int_gincr:N \g__intarray_font_int + \tex_global:D \tex_font:D #1 = cmr10~at~ \g__intarray_font_int sp \scan_stop: + \tex_hyphenchar:D #1 = \int_eval:n {#2} \scan_stop: + \int_compare:nNnT { \tex_hyphenchar:D #1 } > 0 + { \tex_fontdimen:D \tex_hyphenchar:D #1 #1 = 0 sp \scan_stop: } + \int_step_inline:nnnn { 1 } { 1 } { 8 } + { \tex_fontdimen:D ##1 #1 = 0 sp \scan_stop: } + } +\cs_new:Npn \__intarray_count:N #1 { \tex_the:D \tex_hyphenchar:D #1 } +\cs_new_protected:Npn \__intarray_gset_fast:Nnn #1#2#3 + { \tex_fontdimen:D \int_eval:n {#2} #1 = \int_eval:n {#3} sp \scan_stop: } +\cs_new_protected:Npn \__intarray_gset:Nnn #1#2#3 + { + \exp_args:Nff \__intarray_gset_aux:Nnn #1 + { \int_eval:n {#2} } { \int_eval:n {#3} } + } +\cs_new_protected:Npn \__intarray_gset_aux:Nnn #1#2#3 + { + \int_compare:nTF { 1 <= #2 <= \__intarray_count:N #1 } + { + \int_compare:nTF { - \c_max_dim <= \int_abs:n {#3} <= \c_max_dim } + { \__intarray_gset_fast:Nnn #1 {#2} {#3} } + { + \__msg_kernel_error:nnxxxx { kernel } { overflow } + { \token_to_str:N #1 } {#2} {#3} + { \int_compare:nNnT {#3} < 0 { - } \__int_value:w \c_max_dim } + \__intarray_gset_fast:Nnn #1 {#2} + { \int_compare:nNnT {#3} < 0 { - } \c_max_dim } + } + } + { + \__msg_kernel_error:nnxxx { kernel } { out-of-bounds } + { \token_to_str:N #1 } {#2} { \__intarray_count:N #1 } + } + } +\cs_new:Npn \__intarray_item_fast:Nn #1#2 + { \__int_value:w \tex_fontdimen:D \int_eval:n {#2} #1 } +\cs_new:Npn \__intarray_item:Nn #1#2 + { \exp_args:Nf \__intarray_item_aux:Nn #1 { \int_eval:n {#2} } } +\cs_new:Npn \__intarray_item_aux:Nn #1#2 + { + \int_compare:nTF { 1 <= #2 <= \__intarray_count:N #1 } + { \__intarray_item_fast:Nn #1 {#2} } + { + \__msg_kernel_expandable_error:nnnnn { kernel } { out-of-bounds } + { \token_to_str:N #1 } {#2} { \__intarray_count:N #1 } + 0 + } + } %% File: l3flag.dtx Copyright (C) 2011-2012,2014-2017 The LaTeX3 Project \cs_new_protected:Npn \flag_new:n #1 { @@ -8098,6 +8157,18 @@ needed~when~defining~conditionals~or~variants,~or~when~building~a~ parameter~text~from~the~number~of~arguments~of~the~function. } +\__msg_kernel_new:nnnn { kernel } { overflow } + { Integers~larger~than~2^{30}-1~cannot~be~stored~in~arrays. } + { + An~attempt~was~made~to~store~#3~at~position~#2~in~the~array~'#1'.~ + The~largest~allowed~value~#4~will~be~used~instead. + } +\__msg_kernel_new:nnnn { kernel } { out-of-bounds } + { Access~to~an~entry~beyond~an~array's~bounds. } + { + An~attempt~was~made~to~access~or~store~data~at~position~#2~of~the~ + array~'#1',~but~this~array~has~entries~at~positions~from~1~to~#3. + } \__msg_kernel_new:nnnn { kernel } { protected-predicate } { Predicate~'#1'~must~be~expandable. } { @@ -8607,6 +8678,37 @@ \int_set:Nn \tex_endlinechar:D { \int_use:N \tex_endlinechar:D } } } +\cs_new:Npn \ior_map_break: + { \__prg_map_break:Nn \ior_map_break: { } } +\cs_new:Npn \ior_map_break:n + { \__prg_map_break:Nn \ior_map_break: } +\cs_new_protected:Npn \ior_map_inline:Nn + { \__ior_map_inline:NNn \ior_get:NN } +\cs_new_protected:Npn \ior_str_map_inline:Nn + { \__ior_map_inline:NNn \ior_str_get:NN } +\cs_new_protected:Npn \__ior_map_inline:NNn + { + \int_gincr:N \g__prg_map_int + \exp_args:Nc \__ior_map_inline:NNNn + { __prg_map_ \int_use:N \g__prg_map_int :n } + } +\cs_new_protected:Npn \__ior_map_inline:NNNn #1#2#3#4 + { + \cs_gset_protected:Npn #1 ##1 {#4} + \ior_if_eof:NF #3 { \__ior_map_inline_loop:NNN #1#2#3 } + \__prg_break_point:Nn \ior_map_break: + { \int_gdecr:N \g__prg_map_int } + } +\cs_new_protected:Npn \__ior_map_inline_loop:NNN #1#2#3 + { + #2 #3 \l__ior_internal_tl + \ior_if_eof:NF #3 + { + \exp_args:No #1 \l__ior_internal_tl + \__ior_map_inline_loop:NNN #1#2#3 + } + } +\tl_new:N \l__ior_internal_tl \ior_new:N \g__file_internal_ior \int_const:Nn \c_log_iow { -1 } \int_const:Nn \c_term_iow @@ -10038,11 +10140,18 @@ \cs_generate_variant:Nn \__keys_set_known:nnnN { o } \cs_new_protected:Npn \keys_set_known:nn #1#2 { + \bool_if:NTF \l__keys_only_known_bool + { \keys_set:nn } + { \__keys_set_known:nn } + {#1} {#2} + } +\cs_generate_variant:Nn \keys_set_known:nn { nV , nv , no } +\cs_new_protected:Npn \__keys_set_known:nn #1#2 + { \bool_set_true:N \l__keys_only_known_bool \keys_set:nn {#1} {#2} \bool_set_false:N \l__keys_only_known_bool } -\cs_generate_variant:Nn \keys_set_known:nn { nV , nv , no } \cs_new_protected:Npn \keys_set_filter:nnnN { \__keys_set_filter:onnnN \l__keys_unused_clist } \cs_generate_variant:Nn \keys_set_filter:nnnN { nnV , nnv , nno } @@ -10056,22 +10165,50 @@ \cs_generate_variant:Nn \__keys_set_filter:nnnnN { o } \cs_new_protected:Npn \keys_set_filter:nnn #1#2#3 { - \bool_set_true:N \l__keys_selective_bool - \bool_set_true:N \l__keys_filtered_bool - \seq_set_from_clist:Nn \l__keys_selective_seq {#2} - \keys_set:nn {#1} {#3} - \bool_set_false:N \l__keys_selective_bool + \bool_if:NTF \l__keys_filtered_bool + { \__keys_set_selective:nnn } + { \__keys_set_filter:nnn } + {#1} {#2} {#3} } \cs_generate_variant:Nn \keys_set_filter:nnn { nnV , nnv , nno } +\cs_new_protected:Npn \__keys_set_filter:nnn #1#2#3 + { + \bool_set_true:N \l__keys_filtered_bool + \__keys_set_selective:nnn {#1} {#2} {#3} + \bool_set_false:N \l__keys_filtered_bool + } \cs_new_protected:Npn \keys_set_groups:nnn #1#2#3 { - \bool_set_true:N \l__keys_selective_bool + \bool_if:NTF \l__keys_filtered_bool + { \__keys_set_groups:nnn } + { \__keys_set_selective:nnn } + {#1} {#2} {#3} + } +\cs_generate_variant:Nn \keys_set_groups:nnn { nnV , nnv , nno } +\cs_new_protected:Npn \__keys_set_groups:nnn #1#2#3 + { \bool_set_false:N \l__keys_filtered_bool - \seq_set_from_clist:Nn \l__keys_selective_seq {#2} - \keys_set:nn {#1} {#3} + \__keys_set_selective:nnn {#1} {#2} {#3} + \bool_set_true:N \l__keys_filtered_bool + } +\cs_new_protected:Npn \__keys_set_selective:nnn + { \__keys_set_selective:onnn \l__keys_selective_seq } +\cs_new_protected:Npn \__keys_set_selective:nnnn #1#2#3#4 + { + \seq_set_from_clist:Nn \l__keys_selective_seq {#3} + \bool_if:NTF \l__keys_selective_bool + { \keys_set:nn } + { \__keys_set_selective:nn } + {#2} {#4} + \tl_set:Nn \l__keys_selective_seq {#1} + } +\cs_generate_variant:Nn \__keys_set_selective:nnnn { o } +\cs_new_protected:Npn \__keys_set_selective:nn #1#2 + { + \bool_set_true:N \l__keys_selective_bool + \keys_set:nn {#1} {#2} \bool_set_false:N \l__keys_selective_bool } -\cs_generate_variant:Nn \keys_set_groups:nnn { nnV , nnv , nno } \cs_new_protected:Npn \__keys_set:n #1 { \bool_set_true:N \l__keys_no_value_bool @@ -16214,6 +16351,3458 @@ \cs_gset_eq:NN \sort_reversed: \sort_return_swapped: \sort_return_swapped: } +%% File: l3tl-build.dtx Copyright (C) 2011-2017 The LaTeX3 Project +\int_new:N \l__tl_build_start_index_int +\int_new:N \l__tl_build_index_int +\tl_new:N \l__tl_build_result_tl +\cs_new_protected:Npn \__tl_build_unpack: + { + \tl_put_right:Nx \l__tl_build_result_tl + { + \exp_after:wN \__tl_build_unpack_loop:w + \int_use:N \l__tl_build_start_index_int ; + \__prg_break_point: + } + } +\cs_new:Npn \__tl_build_unpack_loop:w #1 ; + { + \if_int_compare:w #1 = \l__tl_build_index_int + \exp_after:wN \__prg_break: + \fi: + \tex_the:D \tex_toks:D #1 \exp_stop_f: + \exp_after:wN \__tl_build_unpack_loop:w + \int_use:N \__int_eval:w #1 + 1 ; + } +\cs_new_protected:Npn \__tl_build:Nw + { \__tl_build_aux:NNw \tl_set:Nn } +\cs_new_protected:Npn \__tl_build_x:Nw + { \__tl_build_aux:NNw \tl_set:Nx } +\cs_new_protected:Npn \__tl_gbuild:Nw + { \__tl_build_aux:NNw \tl_gset:Nn } +\cs_new_protected:Npn \__tl_gbuild_x:Nw + { \__tl_build_aux:NNw \tl_gset:Nx } +\cs_new_protected:Npn \__tl_build_aux:NNw #1#2 + { + \group_begin: + \cs_set:Npn \__tl_build_end_assignment:n + { \group_end: #1 #2 } + \int_zero:N \l__tl_build_start_index_int + \int_zero:N \l__tl_build_index_int + \tl_clear:N \l__tl_build_result_tl + } +\cs_new_protected:Npn \__tl_build_end: + { + \__tl_build_unpack: + \exp_args:No + \__tl_build_end_assignment:n \l__tl_build_result_tl + } +\cs_new_eq:NN \__tl_build_end_assignment:n \use_none:n +\cs_new_protected:Npn \__tl_build_one:n #1 + { + \tex_toks:D \l__tl_build_index_int {#1} + \int_incr:N \l__tl_build_index_int + \if_int_compare:w \l__tl_build_index_int > \c_max_register_int + \__tl_build_unpack: + \l__tl_build_index_int \l__tl_build_start_index_int + \fi: + } +\cs_new_protected:Npn \__tl_build_one:o #1 + { + \tex_toks:D \l__tl_build_index_int \exp_after:wN {#1} + \int_incr:N \l__tl_build_index_int + \if_int_compare:w \l__tl_build_index_int > \c_max_register_int + \__tl_build_unpack: + \l__tl_build_index_int \l__tl_build_start_index_int + \fi: + } +\cs_new_protected:Npn \__tl_build_one:x #1 + { \use:x { \__tl_build_one:n {#1} } } +%% File: l3tl-analysis.dtx Copyright (C) 2011-2012,2015-2017 The LaTeX3 Project% +\__scan_new:N \s__tl +\tl_new:N \l__tl_analysis_internal_tl +\cs_new_eq:NN \l__tl_analysis_token ? +\cs_new_eq:NN \l__tl_analysis_char_token ? +\int_new:N \l__tl_analysis_normal_int +\int_new:N \l__tl_analysis_index_int +\int_new:N \l__tl_analysis_nesting_int +\int_new:N \l__tl_analysis_type_int +\tl_new:N \g__tl_analysis_result_tl +\cs_new:Npn \__tl_analysis_extract_charcode: + { + \exp_after:wN \__tl_analysis_extract_charcode_aux:w + \token_to_meaning:N \l__tl_analysis_token + } +\cs_new:Npn \__tl_analysis_extract_charcode_aux:w #1 ~ #2 ~ { ` } +\cs_new:Npn \__tl_analysis_cs_space_count:NN #1 #2 + { + \exp_after:wN #1 + \__int_value:w \__int_eval:w 0 + \exp_after:wN \__tl_analysis_cs_space_count:w + \token_to_str:N #2 + \fi: \__tl_analysis_cs_space_count_end:w ; ~ ! + } +\cs_new:Npn \__tl_analysis_cs_space_count:w #1 ~ + { + \if_false: #1 #1 \fi: + + 1 + \__tl_analysis_cs_space_count:w + } +\cs_new:Npn \__tl_analysis_cs_space_count_end:w ; #1 \fi: #2 ! + { \exp_after:wN ; \__int_value:w \str_count_ignore_spaces:n {#1} ; } +\cs_new_protected:Npn \__tl_analysis:n #1 + { + \group_begin: + \group_align_safe_begin: + \__tl_analysis_setup:n {#1} + \__tl_analysis_a:n {#1} + \__tl_analysis_b:n {#1} + \group_align_safe_end: + \group_end: + } +\cs_new_protected:Npn \__tl_analysis_setup:n #1 + { + \int_set:Nn \tex_escapechar:D { -1 } + \exp_after:wN \__tl_analysis_disable_loop:N + \tl_to_str:n {#1} { ~ } { ? \__prg_break: } + \__prg_break_point: + \scan_stop: + } +\group_begin: + \char_set_catcode_active:N \^^@ + \cs_new_protected:Npn \__tl_analysis_disable_loop:N #1 + { + \tex_lccode:D 0 = `#1 ~ + \tex_lowercase:D { \tex_let:D ^^@ } \tex_undefined:D + \__tl_analysis_disable_loop:N + } + \cs_if_exist:NT \ptex_kanjiskip:D + { + \cs_gset_protected:Npn \__tl_analysis_disable_loop:N #1 + { + \use_none:n #1 \scan_stop: + \if_int_compare:w 256 > `#1 \exp_stop_f: + \tex_lccode:D 0 = `#1 ~ + \tex_lowercase:D { \tex_let:D ^^@ } \tex_undefined:D + \fi: + \__tl_analysis_disable_loop:N + } + } +\group_end: +\cs_new_protected:Npn \__tl_analysis_a:n #1 + { + \int_set:Nn \tex_escapechar:D { 92 } + \int_zero:N \l__tl_analysis_normal_int + \int_zero:N \l__tl_analysis_index_int + \int_zero:N \l__tl_analysis_nesting_int + \if_false: { \fi: \__tl_analysis_a_loop:w #1 } + \int_decr:N \l__tl_analysis_index_int + } +\cs_new_protected:Npn \__tl_analysis_a_loop:w + { \tex_futurelet:D \l__tl_analysis_token \__tl_analysis_a_type:w } +\cs_new_protected:Npn \__tl_analysis_a_type:w + { + \l__tl_analysis_type_int = + \if_meaning:w \l__tl_analysis_token \c_space_token + 0 + \else: + \if_catcode:w \exp_not:N \l__tl_analysis_token \c_group_begin_token + 1 + \else: + \if_catcode:w \exp_not:N \l__tl_analysis_token \c_group_end_token + - 1 + \else: + 2 + \fi: + \fi: + \fi: + \exp_stop_f: + \if_case:w \l__tl_analysis_type_int + \exp_after:wN \__tl_analysis_a_space:w + \or: \exp_after:wN \__tl_analysis_a_bgroup:w + \or: \exp_after:wN \__tl_analysis_a_safe:N + \else: \exp_after:wN \__tl_analysis_a_egroup:w + \fi: + } +\cs_new_protected:Npn \__tl_analysis_a_space:w + { + \tex_afterassignment:D \__tl_analysis_a_space_test:w + \exp_after:wN \cs_set_eq:NN + \exp_after:wN \l__tl_analysis_char_token + \token_to_str:N + } +\cs_new_protected:Npn \__tl_analysis_a_space_test:w + { + \if_meaning:w \l__tl_analysis_char_token \c_space_token + \tex_toks:D \l__tl_analysis_index_int { \exp_not:n { ~ } } + \__tl_analysis_a_store: + \else: + \int_incr:N \l__tl_analysis_normal_int + \fi: + \__tl_analysis_a_loop:w + } +\group_begin: + \char_set_catcode_group_begin:N \^^@ + \char_set_catcode_group_end:N \^^E + \cs_new_protected:Npn \__tl_analysis_a_bgroup:w + { \__tl_analysis_a_group:nw { \exp_after:wN ^^@ \if_false: ^^E \fi: } } + \char_set_catcode_group_begin:N \^^B + \char_set_catcode_group_end:N \^^@ + \cs_new_protected:Npn \__tl_analysis_a_egroup:w + { \__tl_analysis_a_group:nw { \if_false: ^^B \fi: ^^@ } } +\group_end: +\cs_new_protected:Npn \__tl_analysis_a_group:nw #1 + { + \tex_lccode:D 0 = \__tl_analysis_extract_charcode: \scan_stop: + \tex_lowercase:D { \tex_toks:D \l__tl_analysis_index_int {#1} } + \if_int_compare:w \tex_lccode:D 0 = \tex_escapechar:D + \int_set:Nn \tex_escapechar:D { 139 - \tex_escapechar:D } + \fi: + \tex_afterassignment:D \__tl_analysis_a_group_test:w + \exp_after:wN \cs_set_eq:NN + \exp_after:wN \l__tl_analysis_char_token + \token_to_str:N + } +\cs_new_protected:Npn \__tl_analysis_a_group_test:w + { + \if_charcode:w \l__tl_analysis_token \l__tl_analysis_char_token + \__tl_analysis_a_store: + \else: + \int_incr:N \l__tl_analysis_normal_int + \fi: + \__tl_analysis_a_loop:w + } +\cs_new_protected:Npn \__tl_analysis_a_store: + { + \tex_advance:D \l__tl_analysis_nesting_int \l__tl_analysis_type_int + \if_int_compare:w \tex_lccode:D 0 = `\ \exp_stop_f: + \tex_multiply:D \l__tl_analysis_type_int 2 \exp_stop_f: + \fi: + \tex_skip:D \l__tl_analysis_index_int + = \l__tl_analysis_normal_int sp plus \l__tl_analysis_type_int sp \scan_stop: + \int_incr:N \l__tl_analysis_index_int + \int_zero:N \l__tl_analysis_normal_int + \if_int_compare:w \l__tl_analysis_nesting_int = -1 \exp_stop_f: + \cs_set_eq:NN \__tl_analysis_a_loop:w \scan_stop: + \fi: + } +\cs_new_protected:Npn \__tl_analysis_a_safe:N #1 + { + \if_charcode:w + \scan_stop: + \exp_after:wN \use_none:n \token_to_str:N #1 \prg_do_nothing: + \scan_stop: + \int_incr:N \l__tl_analysis_normal_int + \else: + \__tl_analysis_cs_space_count:NN \__tl_analysis_a_cs:ww #1 + \fi: + \__tl_analysis_a_loop:w + } +\cs_new_protected:Npn \__tl_analysis_a_cs:ww #1; #2; + { + \if_int_compare:w #1 > 0 \exp_stop_f: + \tex_skip:D \l__tl_analysis_index_int + = \__int_eval:w \l__tl_analysis_normal_int + 1 sp \scan_stop: + \tex_advance:D \l__tl_analysis_index_int #1 \exp_stop_f: + \l__tl_analysis_normal_int #2 \exp_stop_f: + \else: + \tex_advance:D \l__tl_analysis_normal_int #2 \exp_stop_f: + \fi: + } +\cs_new_protected:Npn \__tl_analysis_b:n #1 + { + \tl_gset:Nx \g__tl_analysis_result_tl + { + \__tl_analysis_b_loop:w 0; #1 + \__prg_break_point: + } + } +\cs_new:Npn \__tl_analysis_b_loop:w #1; + { + \exp_after:wN \__tl_analysis_b_normals:ww + \__int_value:w \tex_skip:D #1 ; #1 ; + } +\cs_new:Npn \__tl_analysis_b_normals:ww #1; + { + \if_int_compare:w #1 = 0 \exp_stop_f: + \__tl_analysis_b_special:w + \fi: + \__tl_analysis_b_normal:wwN #1; + } +\cs_new:Npn \__tl_analysis_b_normal:wwN #1; #2; #3 + { + \exp_not:n { \exp_not:n { #3 } } \s__tl + \if_charcode:w + \scan_stop: + \exp_after:wN \use_none:n \token_to_str:N #3 \prg_do_nothing: + \scan_stop: + \exp_after:wN \__tl_analysis_b_char:Nww + \else: + \exp_after:wN \__tl_analysis_b_cs:Nww + \fi: + #3 #1; #2; + } +\cs_new:Npx \__tl_analysis_b_char:Nww #1 + { + \exp_not:N \if_meaning:w #1 \exp_not:N \tex_undefined:D + \token_to_str:N D \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_catcode_other_token + \token_to_str:N C \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_catcode_letter_token + \token_to_str:N B \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_math_toggle_token 3 \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_alignment_token 4 \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_math_superscript_token 7 \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_math_subscript_token 8 \exp_not:N \else: + \exp_not:N \if_catcode:w #1 \c_space_token + \token_to_str:N A \exp_not:N \else: + 6 + \exp_not:n { \fi: \fi: \fi: \fi: \fi: \fi: \fi: \fi: } + \exp_not:N \__int_value:w `#1 \s__tl + \exp_not:N \exp_after:wN \exp_not:N \__tl_analysis_b_normals:ww + \exp_not:N \__int_value:w \exp_not:N \__int_eval:w - 1 + + } +\cs_new:Npn \__tl_analysis_b_cs:Nww #1 + { + 0 -1 \s__tl + \__tl_analysis_cs_space_count:NN \__tl_analysis_b_cs_test:ww #1 + } +\cs_new:Npn \__tl_analysis_b_cs_test:ww #1 ; #2 ; #3 ; #4 ; + { + \exp_after:wN \__tl_analysis_b_normals:ww + \__int_value:w \__int_eval:w + \if_int_compare:w #1 = 0 \exp_stop_f: + #3 + \else: + \tex_skip:D \__int_eval:w #4 + #1 \__int_eval_end: + \fi: + - #2 + \exp_after:wN ; + \__int_value:w \__int_eval:w #4 + #1 ; + } +\group_begin: + \char_set_catcode_other:N A + \cs_new:Npn \__tl_analysis_b_special:w + \fi: \__tl_analysis_b_normal:wwN 0 ; #1 ; + { + \fi: + \if_int_compare:w #1 = \l__tl_analysis_index_int + \exp_after:wN \__prg_break: + \fi: + \tex_the:D \tex_toks:D #1 \s__tl + \if_case:w \etex_gluestretch:D \tex_skip:D #1 \exp_stop_f: + A + \or: 1 + \or: 1 + \else: 2 + \fi: + \if_int_odd:w \etex_gluestretch:D \tex_skip:D #1 \exp_stop_f: + \exp_after:wN \__tl_analysis_b_special_char:wN \__int_value:w + \else: + \exp_after:wN \__tl_analysis_b_special_space:w \__int_value:w + \fi: + \__int_eval:w 1 + #1 \exp_after:wN ; + \token_to_str:N + } +\group_end: +\cs_new:Npn \__tl_analysis_b_special_char:wN #1 ; #2 + { + \__int_value:w `#2 \s__tl + \__tl_analysis_b_loop:w #1 ; + } +\cs_new:Npn \__tl_analysis_b_special_space:w #1 ; ~ + { + 32 \s__tl + \__tl_analysis_b_loop:w #1 ; + } +\cs_new_protected:Npn \__tl_analysis_map_inline:nn #1 + { + \__tl_analysis:n {#1} + \int_gincr:N \g__prg_map_int + \exp_args:Nc \__tl_analysis_map_inline_aux:Nn + { __tl_analysis_map_inline_ \int_use:N \g__prg_map_int :wNw } + } +\cs_new_protected:Npn \__tl_analysis_map_inline_aux:Nn #1#2 + { + \cs_gset_protected:Npn #1 ##1 \s__tl ##2 ##3 \s__tl + { + \use_none:n ##2 + #2 + #1 + } + \exp_after:wN #1 + \g__tl_analysis_result_tl + \s__tl { ? \tl_map_break: } \s__tl + \__prg_break_point:Nn \tl_map_break: { \int_gdecr:N \g__prg_map_int } + } +\cs_new_protected:Npn \tl_show_analysis:N #1 + { + \tl_if_exist:NTF #1 + { + \exp_args:No \__tl_analysis:n {#1} + \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-tl-analysis } + { \token_to_str:N #1 } { \tl_if_empty:NTF #1 { } { ? } } { } { } + \__tl_analysis_show: + } + { \tl_show:N #1 } + } +\cs_new_protected:Npn \tl_show_analysis:n #1 + { + \__tl_analysis:n {#1} + \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-tl-analysis } + { } { \tl_if_empty:nTF {#1} { } { ? } } { } { } + \__tl_analysis_show: + } +\cs_new_protected:Npn \__tl_analysis_show: + { + \group_begin: + \exp_args:NNx + \group_end: + \__msg_show_wrap:n + { + \exp_after:wN \__tl_analysis_show_loop:wNw \g__tl_analysis_result_tl + \s__tl { ? \__prg_break: } \s__tl + \__prg_break_point: + } + } +\cs_new:Npn \__tl_analysis_show_loop:wNw #1 \s__tl #2 #3 \s__tl + { + \use_none:n #2 + \exp_not:n { \\ > \ \ } + \if_int_compare:w "#2 = 0 \exp_stop_f: + \exp_after:wN \__tl_analysis_show_cs:n + \else: + \if_int_compare:w "#2 = 13 \exp_stop_f: + \exp_after:wN \exp_after:wN + \exp_after:wN \__tl_analysis_show_active:n + \else: + \exp_after:wN \exp_after:wN + \exp_after:wN \__tl_analysis_show_normal:n + \fi: + \fi: + {#1} + \__tl_analysis_show_loop:wNw + } +\cs_new:Npn \__tl_analysis_show_normal:n #1 + { + \exp_after:wN \token_to_str:N #1 ~ + ( \exp_after:wN \token_to_meaning:N #1 ) + } +\cs_new:Npn \__tl_analysis_show_value:N #1 + { + \token_if_expandable:NF #1 + { + \token_if_chardef:NTF #1 \__prg_break: { } + \token_if_mathchardef:NTF #1 \__prg_break: { } + \token_if_dim_register:NTF #1 \__prg_break: { } + \token_if_int_register:NTF #1 \__prg_break: { } + \token_if_skip_register:NTF #1 \__prg_break: { } + \token_if_toks_register:NTF #1 \__prg_break: { } + \use_none:nnn + \__prg_break_point: + \use:n { \exp_after:wN = \tex_the:D #1 } + } + } +\cs_new:Npn \__tl_analysis_show_cs:n #1 + { \exp_args:No \__tl_analysis_show_long:nn {#1} { control~sequence= } } +\cs_new:Npn \__tl_analysis_show_active:n #1 + { \exp_args:No \__tl_analysis_show_long:nn {#1} { active~character= } } +\cs_new:Npn \__tl_analysis_show_long:nn #1 + { + \__tl_analysis_show_long_aux:oofn + { \token_to_str:N #1 } + { \token_to_meaning:N #1 } + { \__tl_analysis_show_value:N #1 } + } +\cs_new:Npn \__tl_analysis_show_long_aux:nnnn #1#2#3#4 + { + \int_compare:nNnTF + { \str_count:n { #1 ~ ( #4 #2 #3 ) } } + > { \l_iow_line_count_int - 3 } + { + \str_range:nnn { #1 ~ ( #4 #2 #3 ) } { 1 } + { + \l_iow_line_count_int - 3 + - \str_count:N \c__tl_analysis_show_etc_str + } + \c__tl_analysis_show_etc_str + } + { #1 ~ ( #4 #2 #3 ) } + } +\cs_generate_variant:Nn \__tl_analysis_show_long_aux:nnnn { oof } +\tl_const:Nx \c__tl_analysis_show_etc_str % ( + { \token_to_str:N \ETC.) } +\__msg_kernel_new:nnn { kernel } { show-tl-analysis } + { + The~token~list~ \tl_if_empty:nF {#1} { #1 ~ } + \tl_if_empty:nTF {#2} + { is~empty } + { contains~the~tokens: } + } +%% File: l3regex.dtx Copyright (C) 2011-2017 The LaTeX3 Project +\cs_new_protected:Npn \__regex_standard_escapechar: + { \int_set:Nn \tex_escapechar:D { `\\ } } +\cs_new:Npn \__regex_toks_use:w { \tex_the:D \tex_toks:D } +\cs_new_protected:Npn \__regex_toks_clear:N #1 + { \tex_toks:D #1 { } } +\cs_new_eq:NN \__regex_toks_set:Nn \tex_toks:D +\cs_new_protected:Npn \__regex_toks_set:No #1 + { \__regex_toks_set:Nn #1 \exp_after:wN } +\cs_new_protected:Npn \__regex_toks_memcpy:NNn #1#2#3 + { + \prg_replicate:nn {#3} + { + \tex_toks:D #1 = \tex_toks:D #2 + \int_incr:N #1 + \int_incr:N #2 + } + } +\cs_new_protected:Npn \__regex_toks_put_left:Nx #1#2 + { + \cs_set:Npx \__regex_tmp:w { #2 } + \tex_toks:D #1 \exp_after:wN \exp_after:wN \exp_after:wN + { \exp_after:wN \__regex_tmp:w \tex_the:D \tex_toks:D #1 } + } +\cs_new_protected:Npn \__regex_toks_put_right:Nx #1#2 + { + \cs_set:Npx \__regex_tmp:w {#2} + \tex_toks:D #1 \exp_after:wN + { \tex_the:D \tex_toks:D \exp_after:wN #1 \__regex_tmp:w } + } +\cs_new_protected:Npn \__regex_toks_put_right:Nn #1#2 + { \tex_toks:D #1 \exp_after:wN { \tex_the:D \tex_toks:D #1 #2 } } +\cs_new:Npn \__regex_current_cs_to_str: + { + \exp_after:wN \exp_after:wN \exp_after:wN \cs_to_str:N + \tex_the:D \tex_toks:D \l__regex_current_pos_int + } +\cs_new:Npn \__regex_tmp:w { } +\tl_new:N \l__regex_internal_a_tl +\tl_new:N \l__regex_internal_b_tl +\int_new:N \l__regex_internal_a_int +\int_new:N \l__regex_internal_b_int +\int_new:N \l__regex_internal_c_int +\bool_new:N \l__regex_internal_bool +\seq_new:N \l__regex_internal_seq +\tl_new:N \g__regex_internal_tl +\tl_const:Nn \c__regex_no_match_regex + { + \__regex_branch:n + { \__regex_class:NnnnN \c_true_bool { } { 1 } { 0 } \c_true_bool } + } +\__intarray_new:Nn \g__regex_charcode_intarray { 65536 } +\__intarray_new:Nn \g__regex_catcode_intarray { 65536 } +\__intarray_new:Nn \g__regex_balance_intarray { 65536 } +\int_new:N \l__regex_balance_int +\tl_new:N \l__regex_cs_name_tl +\int_const:Nn \c__regex_ascii_min_int { 0 } +\int_const:Nn \c__regex_ascii_max_control_int { 31 } +\int_const:Nn \c__regex_ascii_max_int { 127 } +\int_const:Nn \c__regex_ascii_lower_int { `a - `A } +\cs_new_protected:Npn \__regex_break_true:w + #1 \__regex_break_point:TF #2 #3 {#2} +\cs_new_protected:Npn \__regex_break_point:TF #1 #2 { #2 } +\cs_new_protected:Npn \__regex_item_reverse:n #1 + { + #1 + \__regex_break_point:TF { } \__regex_break_true:w + } +\cs_new_protected:Npn \__regex_item_caseful_equal:n #1 + { + \if_int_compare:w #1 = \l__regex_current_char_int + \exp_after:wN \__regex_break_true:w + \fi: + } +\cs_new_protected:Npn \__regex_item_caseful_range:nn #1 #2 + { + \reverse_if:N \if_int_compare:w #1 > \l__regex_current_char_int + \reverse_if:N \if_int_compare:w #2 < \l__regex_current_char_int + \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w + \fi: + \fi: + } +\cs_new_protected:Npn \__regex_item_caseless_equal:n #1 + { + \if_int_compare:w #1 = \l__regex_current_char_int + \exp_after:wN \__regex_break_true:w + \fi: + \if_int_compare:w \l__regex_case_changed_char_int = \c_max_int + \__regex_compute_case_changed_char: + \fi: + \if_int_compare:w #1 = \l__regex_case_changed_char_int + \exp_after:wN \__regex_break_true:w + \fi: + } +\cs_new_protected:Npn \__regex_item_caseless_range:nn #1 #2 + { + \reverse_if:N \if_int_compare:w #1 > \l__regex_current_char_int + \reverse_if:N \if_int_compare:w #2 < \l__regex_current_char_int + \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w + \fi: + \fi: + \if_int_compare:w \l__regex_case_changed_char_int = \c_max_int + \__regex_compute_case_changed_char: + \fi: + \reverse_if:N \if_int_compare:w #1 > \l__regex_case_changed_char_int + \reverse_if:N \if_int_compare:w #2 < \l__regex_case_changed_char_int + \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w + \fi: + \fi: + } +\cs_new_protected:Npn \__regex_compute_case_changed_char: + { + \int_set_eq:NN \l__regex_case_changed_char_int \l__regex_current_char_int + \if_int_compare:w \l__regex_current_char_int > `Z \exp_stop_f: + \if_int_compare:w \l__regex_current_char_int > `z \exp_stop_f: \else: + \if_int_compare:w \l__regex_current_char_int < `a \exp_stop_f: \else: + \int_sub:Nn \l__regex_case_changed_char_int { \c__regex_ascii_lower_int } + \fi: + \fi: + \else: + \if_int_compare:w \l__regex_current_char_int < `A \exp_stop_f: \else: + \int_add:Nn \l__regex_case_changed_char_int { \c__regex_ascii_lower_int } + \fi: + \fi: + } +\cs_new_eq:NN \__regex_item_equal:n ? +\cs_new_eq:NN \__regex_item_range:nn ? +\cs_new_protected:Npn \__regex_item_catcode: + { + " + \if_case:w \l__regex_current_catcode_int + 1 \or: 4 \or: 10 \or: 40 + \or: 100 \or: \or: 1000 \or: 4000 + \or: 10000 \or: \or: 100000 \or: 400000 + \or: 1000000 \or: 4000000 \else: 1*0 + \fi: + } +\cs_new_protected:Npn \__regex_item_catcode:nT #1 + { + \if_int_odd:w \__int_eval:w #1 / \__regex_item_catcode: \__int_eval_end: + \exp_after:wN \use:n + \else: + \exp_after:wN \use_none:n + \fi: + } +\cs_new_protected:Npn \__regex_item_catcode_reverse:nT #1#2 + { \__regex_item_catcode:nT {#1} { \__regex_item_reverse:n {#2} } } +\cs_new_protected:Npn \__regex_item_exact:nn #1#2 + { + \if_int_compare:w #1 = \l__regex_current_catcode_int + \if_int_compare:w #2 = \l__regex_current_char_int + \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w + \fi: + \fi: + } +\cs_new_protected:Npn \__regex_item_exact_cs:n #1 + { + \int_compare:nNnTF \l__regex_current_catcode_int = 0 + { + \tl_set:Nx \l__regex_internal_a_tl + { \scan_stop: \__regex_current_cs_to_str: \scan_stop: } + \tl_if_in:noTF { \scan_stop: #1 \scan_stop: } \l__regex_internal_a_tl + { \__regex_break_true:w } { } + } + { } + } +\cs_new_protected:Npn \__regex_item_cs:n #1 + { + \int_compare:nNnT \l__regex_current_catcode_int = 0 + { + \group_begin: + \tl_set:Nx \l__regex_cs_name_tl { \__regex_current_cs_to_str: } + \__regex_single_match: + \__regex_disable_submatches: + \__regex_build_for_cs:n {#1} + \bool_set_eq:NN \l__regex_saved_success_bool \g__regex_success_bool + \exp_args:NV \__regex_match:n \l__regex_cs_name_tl + \if_meaning:w \c_true_bool \g__regex_success_bool + \group_insert_after:N \__regex_break_true:w + \fi: + \bool_gset_eq:NN \g__regex_success_bool \l__regex_saved_success_bool + \group_end: + } + } +\cs_new_protected:Npn \__regex_prop_d: + { \__regex_item_caseful_range:nn { `0 } { `9 } } +\cs_new_protected:Npn \__regex_prop_h: + { + \__regex_item_caseful_equal:n { `\ } + \__regex_item_caseful_equal:n { `\^^I } + } +\cs_new_protected:Npn \__regex_prop_s: + { + \__regex_item_caseful_equal:n { `\ } + \__regex_item_caseful_equal:n { `\^^I } + \__regex_item_caseful_equal:n { `\^^J } + \__regex_item_caseful_equal:n { `\^^L } + \__regex_item_caseful_equal:n { `\^^M } + } +\cs_new_protected:Npn \__regex_prop_v: + { \__regex_item_caseful_range:nn { `\^^J } { `\^^M } } % lf, vtab, ff, cr +\cs_new_protected:Npn \__regex_prop_w: + { + \__regex_item_caseful_range:nn { `a } { `z } + \__regex_item_caseful_range:nn { `A } { `Z } + \__regex_item_caseful_range:nn { `0 } { `9 } + \__regex_item_caseful_equal:n { `_ } + } +\cs_new_protected:Npn \__regex_prop_N: + { + \__regex_item_reverse:n + { \__regex_item_caseful_equal:n { `\^^J } } + } +\cs_new_protected:Npn \__regex_posix_alnum: + { \__regex_posix_alpha: \__regex_posix_digit: } +\cs_new_protected:Npn \__regex_posix_alpha: + { \__regex_posix_lower: \__regex_posix_upper: } +\cs_new_protected:Npn \__regex_posix_ascii: + { + \__regex_item_caseful_range:nn + \c__regex_ascii_min_int + \c__regex_ascii_max_int + } +\cs_new_eq:NN \__regex_posix_blank: \__regex_prop_h: +\cs_new_protected:Npn \__regex_posix_cntrl: + { + \__regex_item_caseful_range:nn + \c__regex_ascii_min_int + \c__regex_ascii_max_control_int + \__regex_item_caseful_equal:n \c__regex_ascii_max_int + } +\cs_new_eq:NN \__regex_posix_digit: \__regex_prop_d: +\cs_new_protected:Npn \__regex_posix_graph: + { \__regex_item_caseful_range:nn { `! } { `\~ } } +\cs_new_protected:Npn \__regex_posix_lower: + { \__regex_item_caseful_range:nn { `a } { `z } } +\cs_new_protected:Npn \__regex_posix_print: + { \__regex_item_caseful_range:nn { `\ } { `\~ } } +\cs_new_protected:Npn \__regex_posix_punct: + { + \__regex_item_caseful_range:nn { `! } { `/ } + \__regex_item_caseful_range:nn { `: } { `@ } + \__regex_item_caseful_range:nn { `[ } { `` } + \__regex_item_caseful_range:nn { `\{ } { `\~ } + } +\cs_new_protected:Npn \__regex_posix_space: + { + \__regex_item_caseful_equal:n { `\ } + \__regex_item_caseful_range:nn { `\^^I } { `\^^M } + } +\cs_new_protected:Npn \__regex_posix_upper: + { \__regex_item_caseful_range:nn { `A } { `Z } } +\cs_new_eq:NN \__regex_posix_word: \__regex_prop_w: +\cs_new_protected:Npn \__regex_posix_xdigit: + { + \__regex_posix_digit: + \__regex_item_caseful_range:nn { `A } { `F } + \__regex_item_caseful_range:nn { `a } { `f } + } +\cs_new_protected:Npn \__regex_escape_use:nnnn #1#2#3#4 + { + \__tl_build:Nw \l__regex_internal_a_tl + \cs_set:Npn \__regex_escape_unescaped:N ##1 { #1 } + \cs_set:Npn \__regex_escape_escaped:N ##1 { #2 } + \cs_set:Npn \__regex_escape_raw:N ##1 { #3 } + \__regex_standard_escapechar: + \tl_gset:Nx \g__regex_internal_tl { \__str_to_other_fast:n {#4} } + \tl_set:Nx \l__regex_internal_b_tl + { + \exp_after:wN \__regex_escape_loop:N \g__regex_internal_tl + { break } \__prg_break_point: + } + \__tl_build_one:o \l__regex_internal_b_tl + \__tl_build_end: + \l__regex_internal_a_tl + } +\cs_new:Npn \__regex_escape_loop:N #1 + { + \cs_if_exist_use:cF { __regex_escape_\token_to_str:N #1:w } + { \__regex_escape_unescaped:N #1 } + \__regex_escape_loop:N + } +\cs_new:cpn { __regex_escape_ \c_backslash_str :w } + \__regex_escape_loop:N #1 + { + \cs_if_exist_use:cF { __regex_escape_/\token_to_str:N #1:w } + { \__regex_escape_escaped:N #1 } + \__regex_escape_loop:N + } +\cs_new_eq:NN \__regex_escape_unescaped:N ? +\cs_new_eq:NN \__regex_escape_escaped:N ? +\cs_new_eq:NN \__regex_escape_raw:N ? +\cs_new_eq:NN \__regex_escape_break:w \__prg_break: +\cs_new:cpn { __regex_escape_/break:w } + { + \if_false: { \fi: } + \__msg_kernel_error:nn { regex } { trailing-backslash } + \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: + } +\cs_new:cpn { __regex_escape_~:w } { } +\cs_new:cpx { __regex_escape_/a:w } + { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^G } +\cs_new:cpx { __regex_escape_/t:w } + { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^I } +\cs_new:cpx { __regex_escape_/n:w } + { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^J } +\cs_new:cpx { __regex_escape_/f:w } + { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^L } +\cs_new:cpx { __regex_escape_/r:w } + { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^M } +\cs_new:cpx { __regex_escape_/e:w } + { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^[ } +\cs_new:cpn { __regex_escape_/x:w } \__regex_escape_loop:N + { + \exp_after:wN \__regex_escape_x_end:w + \__int_value:w "0 \__regex_escape_x_test:N + } +\cs_new:Npn \__regex_escape_x_end:w #1 ; + { + \int_compare:nNnTF {#1} > \c_max_char_int + { + \if_false: { \fi: } + \__tl_build_one:o \l__regex_internal_b_tl + \__msg_kernel_error:nnx { regex } { x-overflow } {#1} + \tl_set:Nx \l__regex_internal_b_tl + { \if_false: } \fi: + } + { + \exp_last_unbraced:Nf \__regex_escape_raw:N + { \char_generate:nn {#1} { 12 } } + } + } +\cs_new:Npn \__regex_escape_x_test:N #1 + { + \str_if_eq_x:nnTF {#1} { break } { ; } + { + \if_charcode:w \c_space_token #1 + \exp_after:wN \__regex_escape_x_test:N + \else: + \exp_after:wN \__regex_escape_x_testii:N + \exp_after:wN #1 + \fi: + } + } +\cs_new:Npn \__regex_escape_x_testii:N #1 + { + \if_charcode:w \c_left_brace_str #1 + \exp_after:wN \__regex_escape_x_loop:N + \else: + \__regex_hexadecimal_use:NTF #1 + { \exp_after:wN \__regex_escape_x:N } + { ; \exp_after:wN \__regex_escape_loop:N \exp_after:wN #1 } + \fi: + } +\cs_new:Npn \__regex_escape_x:N #1 + { + \str_if_eq_x:nnTF {#1} { break } { ; } + { + \__regex_hexadecimal_use:NTF #1 + { ; \__regex_escape_loop:N } + { ; \__regex_escape_loop:N #1 } + } + } +\cs_new:Npn \__regex_escape_x_loop:N #1 + { + \str_if_eq_x:nnTF {#1} { break } + { ; \__regex_escape_x_loop_error:n { } {#1} } + { + \__regex_hexadecimal_use:NTF #1 + { \__regex_escape_x_loop:N } + { + \token_if_eq_charcode:NNTF \c_space_token #1 + { \__regex_escape_x_loop:N } + { + ; + \exp_after:wN + \token_if_eq_charcode:NNTF \c_right_brace_str #1 + { \__regex_escape_loop:N } + { \__regex_escape_x_loop_error:n {#1} } + } + } + } + } +\cs_new:Npn \__regex_escape_x_loop_error:n #1 + { + \if_false: { \fi: } + \__tl_build_one:o \l__regex_internal_b_tl + \__msg_kernel_error:nnx { regex } { x-missing-rbrace } {#1} + \tl_set:Nx \l__regex_internal_b_tl + { \if_false: } \fi: \__regex_escape_loop:N #1 + } +\prg_new_conditional:Npnn \__regex_hexadecimal_use:N #1 { TF } + { + \if_int_compare:w 1 < "1 \token_to_str:N #1 \exp_stop_f: + #1 \prg_return_true: + \else: + \if_case:w \__int_eval:w + \exp_after:wN ` \token_to_str:N #1 - `a + \__int_eval_end: + A + \or: B + \or: C + \or: D + \or: E + \or: F + \else: + \prg_return_false: + \exp_after:wN \use_none:n + \fi: + \prg_return_true: + \fi: + } +\prg_new_conditional:Npnn \__regex_char_if_special:N #1 { TF } + { + \if_int_compare:w `#1 > `Z \exp_stop_f: + \if_int_compare:w `#1 > `z \exp_stop_f: + \if_int_compare:w `#1 < \c__regex_ascii_max_int + \prg_return_true: \else: \prg_return_false: \fi: + \else: + \if_int_compare:w `#1 < `a \exp_stop_f: + \prg_return_true: \else: \prg_return_false: \fi: + \fi: + \else: + \if_int_compare:w `#1 > `9 \exp_stop_f: + \if_int_compare:w `#1 < `A \exp_stop_f: + \prg_return_true: \else: \prg_return_false: \fi: + \else: + \if_int_compare:w `#1 < `0 \exp_stop_f: + \if_int_compare:w `#1 < `\ \exp_stop_f: + \prg_return_false: \else: \prg_return_true: \fi: + \else: \prg_return_false: \fi: + \fi: + \fi: + } +\prg_new_conditional:Npnn \__regex_char_if_alphanumeric:N #1 { TF } + { + \if_int_compare:w `#1 > `Z \exp_stop_f: + \if_int_compare:w `#1 > `z \exp_stop_f: + \prg_return_false: + \else: + \if_int_compare:w `#1 < `a \exp_stop_f: + \prg_return_false: \else: \prg_return_true: \fi: + \fi: + \else: + \if_int_compare:w `#1 > `9 \exp_stop_f: + \if_int_compare:w `#1 < `A \exp_stop_f: + \prg_return_false: \else: \prg_return_true: \fi: + \else: + \if_int_compare:w `#1 < `0 \exp_stop_f: + \prg_return_false: \else: \prg_return_true: \fi: + \fi: + \fi: + } +\int_new:N \l__regex_group_level_int +\int_new:N \l__regex_mode_int +\int_const:Nn \c__regex_cs_in_class_mode_int { -6 } +\int_const:Nn \c__regex_cs_mode_int { -2 } +\int_const:Nn \c__regex_outer_mode_int { 0 } +\int_const:Nn \c__regex_catcode_mode_int { 2 } +\int_const:Nn \c__regex_class_mode_int { 3 } +\int_const:Nn \c__regex_catcode_in_class_mode_int { 6 } +\int_new:N \l__regex_catcodes_int +\int_new:N \l__regex_default_catcodes_int +\bool_new:N \l__regex_catcodes_bool +\int_const:Nn \c__regex_catcode_C_int { "1 } +\int_const:Nn \c__regex_catcode_B_int { "4 } +\int_const:Nn \c__regex_catcode_E_int { "10 } +\int_const:Nn \c__regex_catcode_M_int { "40 } +\int_const:Nn \c__regex_catcode_T_int { "100 } +\int_const:Nn \c__regex_catcode_P_int { "1000 } +\int_const:Nn \c__regex_catcode_U_int { "4000 } +\int_const:Nn \c__regex_catcode_D_int { "10000 } +\int_const:Nn \c__regex_catcode_S_int { "100000 } +\int_const:Nn \c__regex_catcode_L_int { "400000 } +\int_const:Nn \c__regex_catcode_O_int { "1000000 } +\int_const:Nn \c__regex_catcode_A_int { "4000000 } +\int_const:Nn \c__regex_all_catcodes_int { "5515155 } +\cs_new_eq:NN \l__regex_internal_regex \c__regex_no_match_regex +\seq_new:N \l__regex_show_prefix_seq +\int_new:N \l__regex_show_lines_int +\cs_new_protected:Npn \__regex_get_digits:NTFw #1#2#3#4#5 + { + \__regex_if_raw_digit:NNTF #4 #5 + { #1 = #5 \__regex_get_digits_loop:nw {#2} } + { #3 #4 #5 } + } +\cs_new:Npn \__regex_get_digits_loop:nw #1#2#3 + { + \__regex_if_raw_digit:NNTF #2 #3 + { #3 \__regex_get_digits_loop:nw {#1} } + { \scan_stop: #1 #2 #3 } + } +\prg_new_conditional:Npnn \__regex_if_raw_digit:NN #1#2 { TF } + { + \if_meaning:w \__regex_compile_raw:N #1 + \if_int_compare:w 1 < 1 #2 \exp_stop_f: + \prg_return_true: + \else: + \prg_return_false: + \fi: + \else: + \prg_return_false: + \fi: + } +\cs_new:Npn \__regex_if_in_class:TF + { + \if_int_odd:w \l__regex_mode_int + \exp_after:wN \use_i:nn + \else: + \exp_after:wN \use_ii:nn + \fi: + } +\cs_new:Npn \__regex_if_in_cs:TF + { + \if_int_odd:w \l__regex_mode_int + \exp_after:wN \use_ii:nn + \else: + \if_int_compare:w \l__regex_mode_int < \c__regex_outer_mode_int + \exp_after:wN \exp_after:wN \exp_after:wN \use_i:nn + \else: + \exp_after:wN \exp_after:wN \exp_after:wN \use_ii:nn + \fi: + \fi: + } +\cs_new:Npn \__regex_if_in_class_or_catcode:TF + { + \if_int_odd:w \l__regex_mode_int + \exp_after:wN \use_i:nn + \else: + \if_int_compare:w \l__regex_mode_int > \c__regex_outer_mode_int + \exp_after:wN \exp_after:wN \exp_after:wN \use_i:nn + \else: + \exp_after:wN \exp_after:wN \exp_after:wN \use_ii:nn + \fi: + \fi: + } +\cs_new:Npn \__regex_if_within_catcode:TF + { + \if_int_compare:w \l__regex_mode_int > \c__regex_outer_mode_int + \exp_after:wN \use_i:nn + \else: + \exp_after:wN \use_ii:nn + \fi: + } +\cs_new_protected:Npn \__regex_chk_c_allowed:T + { + \if_int_compare:w \l__regex_mode_int = \c__regex_outer_mode_int + \exp_after:wN \use:n + \else: + \if_int_compare:w \l__regex_mode_int = \c__regex_class_mode_int + \exp_after:wN \exp_after:wN \exp_after:wN \use:n + \else: + \__msg_kernel_error:nn { regex } { c-bad-mode } + \exp_after:wN \exp_after:wN \exp_after:wN \use_none:n + \fi: + \fi: + } +\cs_new_protected:Npn \__regex_mode_quit_c: + { + \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_mode_int + \int_set_eq:NN \l__regex_mode_int \c__regex_outer_mode_int + \else: + \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_in_class_mode_int + \int_set_eq:NN \l__regex_mode_int \c__regex_class_mode_int + \fi: + \fi: + } +\cs_new_protected:Npn \__regex_compile:w + { + \__tl_build_x:Nw \l__regex_internal_regex + \int_zero:N \l__regex_group_level_int + \int_set_eq:NN \l__regex_default_catcodes_int \c__regex_all_catcodes_int + \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int + \cs_set:Npn \__regex_item_equal:n { \__regex_item_caseful_equal:n } + \cs_set:Npn \__regex_item_range:nn { \__regex_item_caseful_range:nn } + \__tl_build_one:n { \__regex_branch:n { \if_false: } \fi: } + } +\cs_new_protected:Npn \__regex_compile_end: + { + \__regex_if_in_class:TF + { + \__msg_kernel_error:nn { regex } { missing-rbrack } + \use:c { __regex_compile_]: } + \prg_do_nothing: \prg_do_nothing: + } + { } + \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: + \__msg_kernel_error:nnx { regex } { missing-rparen } + { \int_use:N \l__regex_group_level_int } + \prg_replicate:nn + { \l__regex_group_level_int } + { + \__tl_build_one:n + { + \if_false: { \fi: } + \if_false: { \fi: } { 1 } { 0 } \c_true_bool + } + \__tl_build_end: + \__tl_build_one:o \l__regex_internal_regex + } + \fi: + \__tl_build_one:n { \if_false: { \fi: } } + \__tl_build_end: + } +\cs_new_protected:Npn \__regex_compile:n #1 + { + \__regex_compile:w + \__regex_standard_escapechar: + \int_set_eq:NN \l__regex_mode_int \c__regex_outer_mode_int + \__regex_escape_use:nnnn + { + \__regex_char_if_special:NTF ##1 + \__regex_compile_special:N \__regex_compile_raw:N ##1 + } + { + \__regex_char_if_alphanumeric:NTF ##1 + \__regex_compile_escaped:N \__regex_compile_raw:N ##1 + } + { \__regex_compile_raw:N ##1 } + { #1 } + \prg_do_nothing: \prg_do_nothing: + \prg_do_nothing: \prg_do_nothing: + \int_compare:nNnT \l__regex_mode_int = \c__regex_catcode_mode_int + { \__msg_kernel_error:nn { regex } { c-trailing } } + \int_compare:nNnT \l__regex_mode_int < \c__regex_outer_mode_int + { + \__msg_kernel_error:nn { regex } { c-missing-rbrace } + \__regex_compile_end_cs: + \prg_do_nothing: \prg_do_nothing: + \prg_do_nothing: \prg_do_nothing: + } + \__regex_compile_end: + } +\cs_new_protected:Npn \__regex_compile_special:N #1 + { + \cs_if_exist_use:cF { __regex_compile_#1: } + { \__regex_compile_raw:N #1 } + } +\cs_new_protected:Npn \__regex_compile_escaped:N #1 + { + \cs_if_exist_use:cF { __regex_compile_/#1: } + { \__regex_compile_raw:N #1 } + } +\cs_new_protected:Npn \__regex_compile_one:x #1 + { + \__regex_mode_quit_c: + \__regex_if_in_class:TF { } + { + \__tl_build_one:n + { \__regex_class:NnnnN \c_true_bool { \if_false: } \fi: } + } + \__tl_build_one:x + { + \if_int_compare:w \l__regex_catcodes_int < \c__regex_all_catcodes_int + \__regex_item_catcode:nT { \int_use:N \l__regex_catcodes_int } + { \exp_not:N \exp_not:n {#1} } + \else: + \exp_not:N \exp_not:n {#1} + \fi: + } + \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int + \__regex_if_in_class:TF { } { \__regex_compile_quantifier:w } + } +\cs_new_protected:Npn \__regex_compile_abort_tokens:n #1 + { + \use:x + { + \exp_args:No \tl_map_function:nN { \tl_to_str:n {#1} } + \__regex_compile_raw:N + } + } +\cs_generate_variant:Nn \__regex_compile_abort_tokens:n { x } +\cs_new_protected:Npn \__regex_compile_quantifier:w #1#2 + { + \token_if_eq_meaning:NNTF #1 \__regex_compile_special:N + { + \cs_if_exist_use:cF { __regex_compile_quantifier_#2:w } + { \__regex_compile_quantifier_none: #1 #2 } + } + { \__regex_compile_quantifier_none: #1 #2 } + } +\cs_new_protected:Npn \__regex_compile_quantifier_none: + { \__tl_build_one:n { \if_false: { \fi: } { 1 } { 0 } \c_false_bool } } +\cs_new_protected:Npn \__regex_compile_quantifier_abort:xNN #1#2#3 + { + \__regex_compile_quantifier_none: + \__msg_kernel_warning:nnxx { regex } { invalid-quantifier } {#1} {#3} + \__regex_compile_abort_tokens:x {#1} + #2 #3 + } +\cs_new_protected:Npn \__regex_compile_quantifier_lazyness:nnNN #1#2#3#4 + { + \str_if_eq:nnTF { #3 #4 } { \__regex_compile_special:N ? } + { \__tl_build_one:n { \if_false: { \fi: } { #1 } { #2 } \c_true_bool } } + { + \__tl_build_one:n { \if_false: { \fi: } { #1 } { #2 } \c_false_bool } + #3 #4 + } + } +\cs_new_protected:cpn { __regex_compile_quantifier_?:w } + { \__regex_compile_quantifier_lazyness:nnNN { 0 } { 1 } } +\cs_new_protected:cpn { __regex_compile_quantifier_*:w } + { \__regex_compile_quantifier_lazyness:nnNN { 0 } { -1 } } +\cs_new_protected:cpn { __regex_compile_quantifier_+:w } + { \__regex_compile_quantifier_lazyness:nnNN { 1 } { -1 } } +\cs_new_protected:cpn { __regex_compile_quantifier_ \c_left_brace_str :w } + { + \__regex_get_digits:NTFw \l__regex_internal_a_int + { \__regex_compile_quantifier_braced_auxi:w } + { \__regex_compile_quantifier_abort:xNN { \c_left_brace_str } } + } +\cs_new_protected:Npn \__regex_compile_quantifier_braced_auxi:w #1#2 + { + \str_case_x:nnF { #1 #2 } + { + { \__regex_compile_special:N \c_right_brace_str } + { + \exp_args:No \__regex_compile_quantifier_lazyness:nnNN + { \int_use:N \l__regex_internal_a_int } { 0 } + } + { \__regex_compile_special:N , } + { + \__regex_get_digits:NTFw \l__regex_internal_b_int + { \__regex_compile_quantifier_braced_auxiii:w } + { \__regex_compile_quantifier_braced_auxii:w } + } + } + { + \__regex_compile_quantifier_abort:xNN + { \c_left_brace_str \int_use:N \l__regex_internal_a_int } + #1 #2 + } + } +\cs_new_protected:Npn \__regex_compile_quantifier_braced_auxii:w #1#2 + { + \str_if_eq_x:nnTF + { #1 #2 } { \__regex_compile_special:N \c_right_brace_str } + { + \exp_args:No \__regex_compile_quantifier_lazyness:nnNN + { \int_use:N \l__regex_internal_a_int } { -1 } + } + { + \__regex_compile_quantifier_abort:xNN + { \c_left_brace_str \int_use:N \l__regex_internal_a_int , } + #1 #2 + } + } +\cs_new_protected:Npn \__regex_compile_quantifier_braced_auxiii:w #1#2 + { + \str_if_eq_x:nnTF + { #1 #2 } { \__regex_compile_special:N \c_right_brace_str } + { + \if_int_compare:w \l__regex_internal_a_int > \l__regex_internal_b_int + \__msg_kernel_error:nnxx { regex } { backwards-quantifier } + { \int_use:N \l__regex_internal_a_int } + { \int_use:N \l__regex_internal_b_int } + \int_zero:N \l__regex_internal_b_int + \else: + \int_sub:Nn \l__regex_internal_b_int \l__regex_internal_a_int + \fi: + \exp_args:Noo \__regex_compile_quantifier_lazyness:nnNN + { \int_use:N \l__regex_internal_a_int } + { \int_use:N \l__regex_internal_b_int } + } + { + \__regex_compile_quantifier_abort:xNN + { + \c_left_brace_str + \int_use:N \l__regex_internal_a_int , + \int_use:N \l__regex_internal_b_int + } + #1 #2 + } + } +\cs_new_protected:Npn \__regex_compile_raw_error:N #1 + { + \__msg_kernel_error:nnx { regex } { bad-escape } {#1} + \__regex_compile_raw:N #1 + } +\cs_new_protected:Npn \__regex_compile_raw:N #1#2#3 + { + \__regex_if_in_class:TF + { + \str_if_eq:nnTF {#2#3} { \__regex_compile_special:N - } + { \__regex_compile_range:Nw #1 } + { + \__regex_compile_one:x + { \__regex_item_equal:n { \__int_value:w `#1 ~ } } + #2 #3 + } + } + { + \__regex_compile_one:x + { \__regex_item_equal:n { \__int_value:w `#1 ~ } } + #2 #3 + } + } +\prg_new_protected_conditional:Npnn \__regex_if_end_range:NN #1#2 { TF } + { + \if_meaning:w \__regex_compile_raw:N #1 + \prg_return_true: + \else: + \if_meaning:w \__regex_compile_special:N #1 + \if_charcode:w ] #2 + \prg_return_false: + \else: + \prg_return_true: + \fi: + \else: + \prg_return_false: + \fi: + \fi: + } +\cs_new_protected:Npn \__regex_compile_range:Nw #1#2#3 + { + \__regex_if_end_range:NNTF #2 #3 + { + \if_int_compare:w `#1 > `#3 \exp_stop_f: + \__msg_kernel_error:nnxx { regex } { range-backwards } {#1} {#3} + \else: + \__tl_build_one:x + { + \if_int_compare:w `#1 = `#3 \exp_stop_f: + \__regex_item_equal:n + \else: + \__regex_item_range:nn { \__int_value:w `#1 ~ } + \fi: + { \__int_value:w `#3 ~ } + } + \fi: + } + { + \__msg_kernel_warning:nnxx { regex } { range-missing-end } + {#1} { \c_backslash_str #3 } + \__tl_build_one:x + { + \__regex_item_equal:n { \__int_value:w `#1 ~ } + \__regex_item_equal:n { \__int_value:w `- ~ } + } + #2#3 + } + } +\cs_new_protected:cpx { __regex_compile_.: } + { + \exp_not:N \__regex_if_in_class:TF + { \__regex_compile_raw:N . } + { \__regex_compile_one:x \exp_not:c { __regex_prop_.: } } + } +\cs_new_protected:cpn { __regex_prop_.: } + { + \if_int_compare:w \l__regex_current_char_int > - 2 \exp_stop_f: + \exp_after:wN \__regex_break_true:w + \fi: + } +\cs_set_protected:Npn \__regex_tmp:w #1#2 + { + \cs_new_protected:cpx { __regex_compile_/#1: } + { \__regex_compile_one:x \exp_not:c { __regex_prop_#1: } } + \cs_new_protected:cpx { __regex_compile_/#2: } + { + \__regex_compile_one:x + { \__regex_item_reverse:n \exp_not:c { __regex_prop_#1: } } + } + } +\__regex_tmp:w d D +\__regex_tmp:w h H +\__regex_tmp:w s S +\__regex_tmp:w v V +\__regex_tmp:w w W +\cs_new_protected:cpn { __regex_compile_/N: } + { \__regex_compile_one:x \__regex_prop_N: } +\cs_new_protected:Npn \__regex_compile_anchor:NF #1#2 + { + \__regex_if_in_class_or_catcode:TF {#2} + { + \__tl_build_one:n + { \__regex_assertion:Nn \c_true_bool { \__regex_anchor:N #1 } } + } + } +\cs_set_protected:Npn \__regex_tmp:w #1#2 + { + \cs_new_protected:cpn { __regex_compile_/#1: } + { \__regex_compile_anchor:NF #2 { \__regex_compile_raw_error:N #1 } } + } +\__regex_tmp:w A \l__regex_min_pos_int +\__regex_tmp:w G \l__regex_start_pos_int +\__regex_tmp:w Z \l__regex_max_pos_int +\__regex_tmp:w z \l__regex_max_pos_int +\cs_set_protected:Npn \__regex_tmp:w #1#2 + { + \cs_new_protected:cpn { __regex_compile_#1: } + { \__regex_compile_anchor:NF #2 { \__regex_compile_raw:N #1 } } + } +\exp_args:Nx \__regex_tmp:w { \iow_char:N \^ } \l__regex_min_pos_int +\exp_args:Nx \__regex_tmp:w { \iow_char:N \$ } \l__regex_max_pos_int +\cs_new_protected:cpn { __regex_compile_/b: } + { + \__regex_if_in_class_or_catcode:TF + { \__regex_compile_raw_error:N b } + { + \__tl_build_one:n + { \__regex_assertion:Nn \c_true_bool { \__regex_b_test: } } + } + } +\cs_new_protected:cpn { __regex_compile_/B: } + { + \__regex_if_in_class_or_catcode:TF + { \__regex_compile_raw_error:N B } + { + \__tl_build_one:n + { \__regex_assertion:Nn \c_false_bool { \__regex_b_test: } } + } + } +\cs_new_protected:cpn { __regex_compile_]: } + { + \__regex_if_in_class:TF + { + \if_int_compare:w \l__regex_mode_int > \c__regex_catcode_in_class_mode_int + \__tl_build_one:n { \if_false: { \fi: } } + \fi: + \tex_advance:D \l__regex_mode_int - 15 \exp_stop_f: + \tex_divide:D \l__regex_mode_int 13 \exp_stop_f: + \if_int_odd:w \l__regex_mode_int \else: + \exp_after:wN \__regex_compile_quantifier:w + \fi: + } + { \__regex_compile_raw:N ] } + } +\cs_new_protected:cpn { __regex_compile_[: } + { + \__regex_if_in_class:TF + { \__regex_compile_class_posix_test:w } + { + \__regex_if_within_catcode:TF + { + \exp_after:wN \__regex_compile_class_catcode:w + \int_use:N \l__regex_catcodes_int ; + } + { \__regex_compile_class_normal:w } + } + } +\cs_new_protected:Npn \__regex_compile_class_normal:w + { + \__regex_compile_class:TFNN + { \__regex_class:NnnnN \c_true_bool } + { \__regex_class:NnnnN \c_false_bool } + } +\cs_new_protected:Npn \__regex_compile_class_catcode:w #1; + { + \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_mode_int + \__tl_build_one:n + { \__regex_class:NnnnN \c_true_bool { \if_false: } \fi: } + \fi: + \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int + \__regex_compile_class:TFNN + { \__regex_item_catcode:nT {#1} } + { \__regex_item_catcode_reverse:nT {#1} } + } +\cs_new_protected:Npn \__regex_compile_class:TFNN #1#2#3#4 + { + \l__regex_mode_int = \__int_value:w \l__regex_mode_int 3 \exp_stop_f: + \str_if_eq:nnTF { #3 #4 } { \__regex_compile_special:N ^ } + { + \__tl_build_one:n { #2 { \if_false: } \fi: } + \__regex_compile_class:NN + } + { + \__tl_build_one:n { #1 { \if_false: } \fi: } + \__regex_compile_class:NN #3 #4 + } + } +\cs_new_protected:Npn \__regex_compile_class:NN #1#2 + { + \token_if_eq_charcode:NNTF #2 ] + { \__regex_compile_raw:N #2 } + { #1 #2 } + } +\cs_new_protected:Npn \__regex_compile_class_posix_test:w #1#2 + { + \token_if_eq_meaning:NNT \__regex_compile_special:N #1 + { + \str_case:nn { #2 } + { + : { \__regex_compile_class_posix:NNNNw } + = { \__msg_kernel_warning:nnx { regex } { posix-unsupported } { = } } + . { \__msg_kernel_warning:nnx { regex } { posix-unsupported } { . } } + } + } + \__regex_compile_raw:N [ #1 #2 + } +\cs_new_protected:Npn \__regex_compile_class_posix:NNNNw #1#2#3#4#5#6 + { + \str_if_eq:nnTF { #5 #6 } { \__regex_compile_special:N ^ } + { + \bool_set_false:N \l__regex_internal_bool + \tl_set:Nx \l__regex_internal_a_tl { \if_false: } \fi: + \__regex_compile_class_posix_loop:w + } + { + \bool_set_true:N \l__regex_internal_bool + \tl_set:Nx \l__regex_internal_a_tl { \if_false: } \fi: + \__regex_compile_class_posix_loop:w #5 #6 + } + } +\cs_new:Npn \__regex_compile_class_posix_loop:w #1#2 + { + \token_if_eq_meaning:NNTF \__regex_compile_raw:N #1 + { #2 \__regex_compile_class_posix_loop:w } + { \if_false: { \fi: } \__regex_compile_class_posix_end:w #1 #2 } + } +\cs_new_protected:Npn \__regex_compile_class_posix_end:w #1#2#3#4 + { + \str_if_eq:nnTF { #1 #2 #3 #4 } + { \__regex_compile_special:N : \__regex_compile_special:N ] } + { + \cs_if_exist:cTF { __regex_posix_ \l__regex_internal_a_tl : } + { + \__regex_compile_one:x + { + \bool_if:NF \l__regex_internal_bool \__regex_item_reverse:n + \exp_not:c { __regex_posix_ \l__regex_internal_a_tl : } + } + } + { + \__msg_kernel_warning:nnx { regex } { posix-unknown } + { \l__regex_internal_a_tl } + \__regex_compile_abort_tokens:x + { + [: \bool_if:NF \l__regex_internal_bool { ^ } + \l__regex_internal_a_tl :] + } + } + } + { + \__msg_kernel_error:nnxx { regex } { posix-missing-close } + { [: \l__regex_internal_a_tl } { #2 #4 } + \__regex_compile_abort_tokens:x { [: \l__regex_internal_a_tl } + #1 #2 #3 #4 + } + } +\cs_new_protected:Npn \__regex_compile_group_begin:N #1 + { + \__tl_build_one:n { #1 { \if_false: } \fi: } + \__regex_mode_quit_c: + \__tl_build:Nw \l__regex_internal_regex + \int_set_eq:NN \l__regex_default_catcodes_int \l__regex_catcodes_int + \int_incr:N \l__regex_group_level_int + \__tl_build_one:n { \__regex_branch:n { \if_false: } \fi: } + } +\cs_new_protected:Npn \__regex_compile_group_end: + { + \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: + \__tl_build_one:n { \if_false: { \fi: } } + \__tl_build_end: + \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int + \__tl_build_one:o \l__regex_internal_regex + \exp_after:wN \__regex_compile_quantifier:w + \else: + \__msg_kernel_warning:nn { regex } { extra-rparen } + \exp_after:wN \__regex_compile_raw:N \exp_after:wN ) + \fi: + } +\cs_new_protected:cpn { __regex_compile_(: } + { + \__regex_if_in_class:TF { \__regex_compile_raw:N ( } + { \__regex_compile_lparen:w } + } +\cs_new_protected:Npn \__regex_compile_lparen:w #1#2#3#4 + { + \str_if_eq:nnTF { #1 #2 } { \__regex_compile_special:N ? } + { + \cs_if_exist_use:cF + { __regex_compile_special_group_\token_to_str:N #4 :w } + { + \__msg_kernel_warning:nnx { regex } { special-group-unknown } + { (? #4 } + \__regex_compile_group_begin:N \__regex_group:nnnN + \__regex_compile_raw:N ? #3 #4 + } + } + { + \__regex_compile_group_begin:N \__regex_group:nnnN + #1 #2 #3 #4 + } + } +\cs_new_protected:cpn { __regex_compile_|: } + { + \__regex_if_in_class:TF { \__regex_compile_raw:N | } + { + \__tl_build_one:n + { \if_false: { \fi: } \__regex_branch:n { \if_false: } \fi: } + } + } +\cs_new_protected:cpn { __regex_compile_): } + { + \__regex_if_in_class:TF { \__regex_compile_raw:N ) } + { \__regex_compile_group_end: } + } +\cs_new_protected:cpn { __regex_compile_special_group_::w } + { \__regex_compile_group_begin:N \__regex_group_no_capture:nnnN } +\cs_new_protected:cpn { __regex_compile_special_group_|:w } + { \__regex_compile_group_begin:N \__regex_group_resetting:nnnN } +\cs_new_protected:Npn \__regex_compile_special_group_i:w #1#2 + { + \str_if_eq:nnTF { #1 #2 } { \__regex_compile_special:N ) } + { + \cs_set:Npn \__regex_item_equal:n { \__regex_item_caseless_equal:n } + \cs_set:Npn \__regex_item_range:nn { \__regex_item_caseless_range:nn } + } + { + \__msg_kernel_warning:nnx { regex } { unknown-option } { (?i #2 } + \__regex_compile_raw:N ( + \__regex_compile_raw:N ? + \__regex_compile_raw:N i + #1 #2 + } + } +\cs_new_protected:cpn { __regex_compile_special_group_-:w } #1#2#3#4 + { + \str_if_eq:nnTF { #1 #2 #3 #4 } + { \__regex_compile_raw:N i \__regex_compile_special:N ) } + { + \cs_set:Npn \__regex_item_equal:n { \__regex_item_caseful_equal:n } + \cs_set:Npn \__regex_item_range:nn { \__regex_item_caseful_range:nn } + } + { + \__msg_kernel_warning:nnx { regex } { unknown-option } { (?-#2#4 } + \__regex_compile_raw:N ( + \__regex_compile_raw:N ? + \__regex_compile_raw:N - + #1 #2 #3 #4 + } + } +\cs_new_protected:cpn { __regex_compile_/c: } + { \__regex_chk_c_allowed:T { \__regex_compile_c_test:NN } } +\cs_new_protected:Npn \__regex_compile_c_test:NN #1#2 + { + \token_if_eq_meaning:NNTF #1 \__regex_compile_raw:N + { + \int_if_exist:cTF { c__regex_catcode_#2_int } + { + \int_set_eq:Nc \l__regex_catcodes_int { c__regex_catcode_#2_int } + \l__regex_mode_int + = \if_case:w \l__regex_mode_int + \c__regex_catcode_mode_int + \else: + \c__regex_catcode_in_class_mode_int + \fi: + } + } + { \cs_if_exist_use:cF { __regex_compile_c_#2:w } } + { + \__msg_kernel_error:nnx { regex } { c-missing-category } {#2} + #1 #2 + } + } +\cs_new_protected:cpn { __regex_compile_c_[:w } #1#2 + { + \l__regex_mode_int + = \if_case:w \l__regex_mode_int + \c__regex_catcode_mode_int + \else: + \c__regex_catcode_in_class_mode_int + \fi: + \int_zero:N \l__regex_catcodes_int + \str_if_eq:nnTF { #1 #2 } { \__regex_compile_special:N ^ } + { + \bool_set_false:N \l__regex_catcodes_bool + \__regex_compile_c_lbrack_loop:NN + } + { + \bool_set_true:N \l__regex_catcodes_bool + \__regex_compile_c_lbrack_loop:NN + #1 #2 + } + } +\cs_new_protected:Npn \__regex_compile_c_lbrack_loop:NN #1#2 + { + \token_if_eq_meaning:NNTF #1 \__regex_compile_raw:N + { + \int_if_exist:cTF { c__regex_catcode_#2_int } + { + \exp_args:Nc \__regex_compile_c_lbrack_add:N + { c__regex_catcode_#2_int } + \__regex_compile_c_lbrack_loop:NN + } + } + { + \token_if_eq_charcode:NNTF #2 ] + { \__regex_compile_c_lbrack_end: } + } + { + \__msg_kernel_error:nnx { regex } { c-missing-rbrack } {#2} + \__regex_compile_c_lbrack_end: + #1 #2 + } + } +\cs_new_protected:Npn \__regex_compile_c_lbrack_add:N #1 + { + \if_int_odd:w \__int_eval:w \l__regex_catcodes_int / #1 \__int_eval_end: + \else: + \int_add:Nn \l__regex_catcodes_int {#1} + \fi: + } +\cs_new_protected:Npn \__regex_compile_c_lbrack_end: + { + \if_meaning:w \c_false_bool \l__regex_catcodes_bool + \int_set:Nn \l__regex_catcodes_int + { \c__regex_all_catcodes_int - \l__regex_catcodes_int } + \fi: + } +\cs_new_protected:cpn { __regex_compile_c_ \c_left_brace_str :w } + { + \__regex_compile:w + \__regex_disable_submatches: + \l__regex_mode_int + = \if_case:w \l__regex_mode_int + \c__regex_cs_mode_int + \else: + \c__regex_cs_in_class_mode_int + \fi: + } +\flag_new:n { __regex_cs } +\cs_new_protected:cpn { __regex_compile_ \c_right_brace_str : } + { + \__regex_if_in_cs:TF + { \__regex_compile_end_cs: } + { \exp_after:wN \__regex_compile_raw:N \c_right_brace_str } + } +\cs_new_protected:Npn \__regex_compile_end_cs: + { + \__regex_compile_end: + \flag_clear:n { __regex_cs } + \tl_set:Nx \l__regex_internal_a_tl + { + \exp_after:wN \__regex_compile_cs_aux:Nn \l__regex_internal_regex + \q_nil \q_nil \q_recursion_stop + } + \exp_args:Nx \__regex_compile_one:x + { + \flag_if_raised:nTF { __regex_cs } + { \__regex_item_cs:n { \exp_not:o \l__regex_internal_regex } } + { \__regex_item_exact_cs:n { \tl_tail:N \l__regex_internal_a_tl } } + } + } +\cs_new:Npn \__regex_compile_cs_aux:Nn #1#2 + { + \cs_if_eq:NNTF #1 \__regex_branch:n + { + \scan_stop: + \__regex_compile_cs_aux:NNnnnN #2 + \q_nil \q_nil \q_nil \q_nil \q_nil \q_nil \q_recursion_stop + \__regex_compile_cs_aux:Nn + } + { + \quark_if_nil:NF #1 { \flag_raise:n { __regex_cs } } + \use_none_delimit_by_q_recursion_stop:w + } + } +\cs_new:Npn \__regex_compile_cs_aux:NNnnnN #1#2#3#4#5#6 + { + \bool_lazy_all:nTF + { + { \cs_if_eq_p:NN #1 \__regex_class:NnnnN } + {#2} + { \tl_if_head_eq_meaning_p:nN {#3} \__regex_item_caseful_equal:n } + { \int_compare_p:nNn { \tl_count:n {#3} } = { 2 } } + { \int_compare_p:nNn {#5} = { 0 } } + } + { + \prg_replicate:nn {#4} + { \char_generate:nn { \use_ii:nn #3 } {12} } + \__regex_compile_cs_aux:NNnnnN + } + { + \quark_if_nil:NF #1 + { + \flag_raise:n { __regex_cs } + \use_i_delimit_by_q_recursion_stop:nw + } + \use_none_delimit_by_q_recursion_stop:w + } + } +\cs_new_protected:cpn { __regex_compile_/u: } #1#2 + { + \__regex_if_in_class_or_catcode:TF + { \__regex_compile_raw_error:N u #1 #2 } + { + \str_if_eq_x:nnTF {#1#2} { \__regex_compile_special:N \c_left_brace_str } + { + \tl_set:Nx \l__regex_internal_a_tl { \if_false: } \fi: + \__regex_compile_u_loop:NN + } + { + \__msg_kernel_error:nn { regex } { u-missing-lbrace } + \__regex_compile_raw:N u #1 #2 + } + } + } +\cs_new:Npn \__regex_compile_u_loop:NN #1#2 + { + \token_if_eq_meaning:NNTF #1 \__regex_compile_raw:N + { #2 \__regex_compile_u_loop:NN } + { + \token_if_eq_meaning:NNTF #1 \__regex_compile_special:N + { + \exp_after:wN \token_if_eq_charcode:NNTF \c_right_brace_str #2 + { \if_false: { \fi: } \__regex_compile_u_end: } + { #2 \__regex_compile_u_loop:NN } + } + { + \if_false: { \fi: } + \__msg_kernel_error:nnx { regex } { u-missing-rbrace } {#2} + \__regex_compile_u_end: + #1 #2 + } + } + } +\cs_new_protected:Npn \__regex_compile_u_end: + { + \tl_set:Nv \l__regex_internal_a_tl { \l__regex_internal_a_tl } + \if_int_compare:w \l__regex_mode_int = \c__regex_outer_mode_int + \__regex_compile_u_not_cs: + \else: + \__regex_compile_u_in_cs: + \fi: + } +\cs_new_protected:Npn \__regex_compile_u_in_cs: + { + \tl_gset:Nx \g__regex_internal_tl + { \exp_args:No \__str_to_other_fast:n { \l__regex_internal_a_tl } } + \__tl_build_one:x + { + \tl_map_function:NN \g__regex_internal_tl + \__regex_compile_u_in_cs_aux:n + } + } +\cs_new:Npn \__regex_compile_u_in_cs_aux:n #1 + { + \__regex_class:NnnnN \c_true_bool + { \__regex_item_caseful_equal:n { \__int_value:w `#1 } } + { 1 } { 0 } \c_false_bool + } +\cs_new_protected:Npn \__regex_compile_u_not_cs: + { + \exp_args:No \__tl_analysis_map_inline:nn { \l__regex_internal_a_tl } + { + \__tl_build_one:n + { + \__regex_class:NnnnN \c_true_bool + { + \if_int_compare:w "##2 = 0 \exp_stop_f: + \__regex_item_exact_cs:n { \exp_after:wN \cs_to_str:N ##1 } + \else: + \__regex_item_exact:nn { \__int_value:w "##2 } { ##3 } + \fi: + } + { 1 } { 0 } \c_false_bool + } + } + } +\cs_new_protected:cpn { __regex_compile_/K: } + { + \int_compare:nNnTF \l__regex_mode_int = \c__regex_outer_mode_int + { \__tl_build_one:n { \__regex_command_K: } } + { \__regex_compile_raw_error:N K } + } +\cs_new_protected:Npn \__regex_show:Nn #1#2 + { + \__tl_build:Nw \l__regex_internal_a_tl + \cs_set_protected:Npn \__regex_branch:n + { + \seq_pop_right:NN \l__regex_show_prefix_seq \l__regex_internal_a_tl + \__regex_show_one:n { +-branch } + \seq_put_right:No \l__regex_show_prefix_seq \l__regex_internal_a_tl + \use:n + } + \cs_set_protected:Npn \__regex_group:nnnN + { \__regex_show_group_aux:nnnnN { } } + \cs_set_protected:Npn \__regex_group_no_capture:nnnN + { \__regex_show_group_aux:nnnnN { ~(no~capture) } } + \cs_set_protected:Npn \__regex_group_resetting:nnnN + { \__regex_show_group_aux:nnnnN { ~(resetting) } } + \cs_set_eq:NN \__regex_class:NnnnN \__regex_show_class:NnnnN + \cs_set_protected:Npn \__regex_command_K: + { \__regex_show_one:n { reset~match~start~(\iow_char:N\\K) } } + \cs_set_protected:Npn \__regex_assertion:Nn ##1##2 + { \__regex_show_one:n { \bool_if:NF ##1 { negative~ } assertion:~##2 } } + \cs_set:Npn \__regex_b_test: { word~boundary } + \cs_set_eq:NN \__regex_anchor:N \__regex_show_anchor_to_str:N + \cs_set_protected:Npn \__regex_item_caseful_equal:n ##1 + { \__regex_show_one:n { char~code~\int_eval:n{##1} } } + \cs_set_protected:Npn \__regex_item_caseful_range:nn ##1##2 + { \__regex_show_one:n { range~[\int_eval:n{##1}, \int_eval:n{##2}] } } + \cs_set_protected:Npn \__regex_item_caseless_equal:n ##1 + { \__regex_show_one:n { char~code~\int_eval:n{##1}~(caseless) } } + \cs_set_protected:Npn \__regex_item_caseless_range:nn ##1##2 + { + \__regex_show_one:n + { Range~[\int_eval:n{##1}, \int_eval:n{##2}]~(caseless) } + } + \cs_set_protected:Npn \__regex_item_catcode:nT + { \__regex_show_item_catcode:NnT \c_true_bool } + \cs_set_protected:Npn \__regex_item_catcode_reverse:nT + { \__regex_show_item_catcode:NnT \c_false_bool } + \cs_set_protected:Npn \__regex_item_reverse:n + { \__regex_show_scope:nn { Reversed~match } } + \cs_set_protected:Npn \__regex_item_exact:nn ##1##2 + { \__regex_show_one:n { char~##2,~catcode~##1 } } + \cs_set_eq:NN \__regex_item_exact_cs:n \__regex_show_item_exact_cs:n + \cs_set_protected:Npn \__regex_item_cs:n + { \__regex_show_scope:nn { control~sequence } } + \cs_set:cpn { __regex_prop_.: } { \__regex_show_one:n { any~token } } + \seq_clear:N \l__regex_show_prefix_seq + \__regex_show_push:n { ~ } + \cs_if_exist_use:N #1 + \__tl_build_end: + \__msg_show_variable:NNNnn #1 \cs_if_exist:NTF ? { } + { >~Compiled~regex~#2: \l__regex_internal_a_tl } + } +\cs_new_protected:Npn \__regex_show_one:n #1 + { + \int_incr:N \l__regex_show_lines_int + \__tl_build_one:x + { + \exp_not:N \\ + \seq_map_function:NN \l__regex_show_prefix_seq \use:n + #1 + } + } +\cs_new_protected:Npn \__regex_show_push:n #1 + { \seq_put_right:Nx \l__regex_show_prefix_seq { #1 ~ } } +\cs_new_protected:Npn \__regex_show_pop: + { \seq_pop_right:NN \l__regex_show_prefix_seq \l__regex_internal_a_tl } +\cs_new_protected:Npn \__regex_show_scope:nn #1#2 + { + \__regex_show_one:n {#1} + \__regex_show_push:n { ~ } + #2 + \__regex_show_pop: + } +\cs_new_protected:Npn \__regex_show_group_aux:nnnnN #1#2#3#4#5 + { + \__regex_show_one:n { ,-group~begin #1 } + \__regex_show_push:n { | } + \use_ii:nn #2 + \__regex_show_pop: + \__regex_show_one:n + { `-group~end \__regex_msg_repeated:nnN {#3} {#4} #5 } + } +\cs_set:Npn \__regex_show_class:NnnnN #1#2#3#4#5 + { + \__tl_build:Nw \l__regex_internal_a_tl + \int_zero:N \l__regex_show_lines_int + \__regex_show_push:n {~} + #2 + \exp_last_unbraced:Nf + \int_case:nnF { \l__regex_show_lines_int } + { + {0} + { + \__tl_build_end: + \__regex_show_one:n { \bool_if:NTF #1 { Fail } { Pass } } + } + {1} + { + \__tl_build_end: + \bool_if:NTF #1 + { + #2 + \__tl_build_one:n { \__regex_msg_repeated:nnN {#3} {#4} #5 } + } + { + \__regex_show_one:n + { Don't~match~\__regex_msg_repeated:nnN {#3} {#4} #5 } + \__tl_build_one:o \l__regex_internal_a_tl + } + } + } + { + \__tl_build_end: + \__regex_show_one:n + { + \bool_if:NTF #1 { M } { Don't~m } atch + \__regex_msg_repeated:nnN {#3} {#4} #5 + } + \__tl_build_one:o \l__regex_internal_a_tl + } + } +\cs_new:Npn \__regex_show_anchor_to_str:N #1 + { + anchor~at~ + \str_case:nnF { #1 } + { + { \l__regex_min_pos_int } { start~(\iow_char:N\\A) } + { \l__regex_start_pos_int } { start~of~match~(\iow_char:N\\G) } + { \l__regex_max_pos_int } { end~(\iow_char:N\\Z) } + } + { <error:~'#1'~not~recognized> } + } +\cs_new_protected:Npn \__regex_show_item_catcode:NnT #1#2 + { + \seq_set_split:Nnn \l__regex_internal_seq { } { CBEMTPUDSLOA } + \seq_set_filter:NNn \l__regex_internal_seq \l__regex_internal_seq + { \int_if_odd_p:n { #2 / \int_use:c { c__regex_catcode_##1_int } } } + \__regex_show_scope:nn + { + categories~ + \seq_map_function:NN \l__regex_internal_seq \use:n + , ~ + \bool_if:NF #1 { negative~ } class + } + } +\cs_new_protected:Npn \__regex_show_item_exact_cs:n #1 + { + \seq_set_split:Nnn \l__regex_internal_seq { \scan_stop: } {#1} + \seq_set_map:NNn \l__regex_internal_seq + \l__regex_internal_seq { \iow_char:N\\##1 } + \__regex_show_one:n + { control~sequence~ \seq_use:Nn \l__regex_internal_seq { ~or~ } } + } +\int_new:N \l__regex_min_state_int +\int_set:Nn \l__regex_min_state_int { 1 } +\int_new:N \l__regex_max_state_int +\int_new:N \l__regex_left_state_int +\int_new:N \l__regex_right_state_int +\seq_new:N \l__regex_left_state_seq +\seq_new:N \l__regex_right_state_seq +\int_new:N \l__regex_capturing_group_int +\cs_new_protected:Npn \__regex_build:n #1 + { + \__regex_compile:n {#1} + \__regex_build:N \l__regex_internal_regex + } +\cs_new_protected:Npn \__regex_build:N #1 + { + \__regex_standard_escapechar: + \int_zero:N \l__regex_capturing_group_int + \int_set_eq:NN \l__regex_max_state_int \l__regex_min_state_int + \__regex_build_new_state: + \__regex_build_new_state: + \__regex_toks_put_right:Nn \l__regex_left_state_int + { \__regex_action_start_wildcard: } + \__regex_group:nnnN {#1} { 1 } { 0 } \c_false_bool + \__regex_toks_put_right:Nn \l__regex_right_state_int + { \__regex_action_success: } + } +\cs_new_protected:Npn \__regex_build_for_cs:n #1 + { + \int_set_eq:NN \l__regex_max_state_int \l__regex_min_state_int + \__regex_build_new_state: + \__regex_build_new_state: + \__regex_push_lr_states: + #1 + \__regex_pop_lr_states: + \__regex_toks_put_right:Nn \l__regex_right_state_int + { + \if_int_compare:w \l__regex_current_pos_int = \l__regex_max_pos_int + \exp_after:wN \__regex_action_success: + \fi: + } + } +\cs_new_protected:Npn \__regex_push_lr_states: + { + \seq_push:No \l__regex_left_state_seq + { \int_use:N \l__regex_left_state_int } + \seq_push:No \l__regex_right_state_seq + { \int_use:N \l__regex_right_state_int } + } +\cs_new_protected:Npn \__regex_pop_lr_states: + { + \seq_pop:NN \l__regex_left_state_seq \l__regex_internal_a_tl + \int_set:Nn \l__regex_left_state_int \l__regex_internal_a_tl + \seq_pop:NN \l__regex_right_state_seq \l__regex_internal_a_tl + \int_set:Nn \l__regex_right_state_int \l__regex_internal_a_tl + } +\cs_new_protected:Npn \__regex_build_transition_left:NNN #1#2#3 + { \__regex_toks_put_left:Nx #2 { #1 { \int_eval:n { #3 - #2 } } } } +\cs_new_protected:Npn \__regex_build_transition_right:nNn #1#2#3 + { \__regex_toks_put_right:Nx #2 { #1 { \int_eval:n { #3 - #2 } } } } +\cs_new_protected:Npn \__regex_build_new_state: + { + \__regex_toks_clear:N \l__regex_max_state_int + \int_set_eq:NN \l__regex_left_state_int \l__regex_right_state_int + \int_set_eq:NN \l__regex_right_state_int \l__regex_max_state_int + \int_incr:N \l__regex_max_state_int + } +\cs_new_protected:Npn \__regex_build_transitions_lazyness:NNNNN #1#2#3#4#5 + { + \__regex_build_new_state: + \__regex_toks_put_right:Nx \l__regex_left_state_int + { + \if_meaning:w \c_true_bool #1 + #2 { \int_eval:n { #3 - \l__regex_left_state_int } } + #4 { \int_eval:n { #5 - \l__regex_left_state_int } } + \else: + #4 { \int_eval:n { #5 - \l__regex_left_state_int } } + #2 { \int_eval:n { #3 - \l__regex_left_state_int } } + \fi: + } + } +\cs_new_protected:Npn \__regex_class:NnnnN #1#2#3#4#5 + { + \cs_set:Npx \__regex_tests_action_cost:n ##1 + { + \exp_not:n { \exp_not:n {#2} } + \bool_if:NTF #1 + { \__regex_break_point:TF { \__regex_action_cost:n {##1} } { } } + { \__regex_break_point:TF { } { \__regex_action_cost:n {##1} } } + } + \if_case:w - #4 \exp_stop_f: + \__regex_class_repeat:n {#3} + \or: \__regex_class_repeat:nN {#3} #5 + \else: \__regex_class_repeat:nnN {#3} {#4} #5 + \fi: + } +\cs_new:Npn \__regex_tests_action_cost:n { \__regex_action_cost:n } +\cs_new_protected:Npn \__regex_class_repeat:n #1 + { + \prg_replicate:nn {#1} + { + \__regex_build_new_state: + \__regex_build_transition_right:nNn \__regex_tests_action_cost:n + \l__regex_left_state_int \l__regex_right_state_int + } + } +\cs_new_protected:Npn \__regex_class_repeat:nN #1#2 + { + \if_int_compare:w #1 = 0 \exp_stop_f: + \__regex_build_transitions_lazyness:NNNNN #2 + \__regex_action_free:n \l__regex_right_state_int + \__regex_tests_action_cost:n \l__regex_left_state_int + \else: + \__regex_class_repeat:n {#1} + \int_set_eq:NN \l__regex_internal_a_int \l__regex_left_state_int + \__regex_build_transitions_lazyness:NNNNN #2 + \__regex_action_free:n \l__regex_right_state_int + \__regex_action_free:n \l__regex_internal_a_int + \fi: + } +\cs_new_protected:Npn \__regex_class_repeat:nnN #1#2#3 + { + \__regex_class_repeat:n {#1} + \int_set:Nn \l__regex_internal_a_int + { \l__regex_max_state_int + #2 - 1 } + \prg_replicate:nn { #2 } + { + \__regex_build_transitions_lazyness:NNNNN #3 + \__regex_action_free:n \l__regex_internal_a_int + \__regex_tests_action_cost:n \l__regex_right_state_int + } + } +\cs_new_protected:Npn \__regex_group_aux:nnnnN #1#2#3#4#5 + { + \if_int_compare:w #3 = 0 \exp_stop_f: + \__regex_build_new_state: + \__regex_build_transition_right:nNn \__regex_action_free_group:n + \l__regex_left_state_int \l__regex_right_state_int + \fi: + \__regex_build_new_state: + \__regex_push_lr_states: + #2 + \__regex_pop_lr_states: + \if_case:w - #4 \exp_stop_f: + \__regex_group_repeat:nn {#1} {#3} + \or: \__regex_group_repeat:nnN {#1} {#3} #5 + \else: \__regex_group_repeat:nnnN {#1} {#3} {#4} #5 + \fi: + } +\cs_new_protected:Npn \__regex_group:nnnN #1 + { + \exp_args:No \__regex_group_aux:nnnnN + { \int_use:N \l__regex_capturing_group_int } + { + \int_incr:N \l__regex_capturing_group_int + #1 + } + } +\cs_new_protected:Npn \__regex_group_no_capture:nnnN + { \__regex_group_aux:nnnnN { -1 } } +\cs_new_protected:Npn \__regex_group_resetting:nnnN #1 + { + \__regex_group_aux:nnnnN { -1 } + { + \exp_args:Noo \__regex_group_resetting_loop:nnNn + { \int_use:N \l__regex_capturing_group_int } + { \int_use:N \l__regex_capturing_group_int } + #1 + { ?? \__prg_break:n } { } + \__prg_break_point: + } + } +\cs_new_protected:Npn \__regex_group_resetting_loop:nnNn #1#2#3#4 + { + \use_none:nn #3 { \int_set:Nn \l__regex_capturing_group_int {#1} } + \int_set:Nn \l__regex_capturing_group_int {#2} + #3 {#4} + \exp_args:Nf \__regex_group_resetting_loop:nnNn + { \int_max:nn {#1} { \l__regex_capturing_group_int } } + {#2} + } +\cs_new_protected:Npn \__regex_branch:n #1 + { + \__regex_build_new_state: + \seq_get:NN \l__regex_left_state_seq \l__regex_internal_a_tl + \int_set:Nn \l__regex_left_state_int \l__regex_internal_a_tl + \__regex_build_transition_right:nNn \__regex_action_free:n + \l__regex_left_state_int \l__regex_right_state_int + #1 + \seq_get:NN \l__regex_right_state_seq \l__regex_internal_a_tl + \__regex_build_transition_right:nNn \__regex_action_free:n + \l__regex_right_state_int \l__regex_internal_a_tl + } +\cs_new_protected:Npn \__regex_group_repeat:nn #1#2 + { + \if_int_compare:w #2 = 0 \exp_stop_f: + \int_set:Nn \l__regex_max_state_int + { \l__regex_left_state_int - 1 } + \__regex_build_new_state: + \else: + \__regex_group_repeat_aux:n {#2} + \__regex_group_submatches:nNN {#1} + \l__regex_internal_a_int \l__regex_right_state_int + \__regex_build_new_state: + \fi: + } +\cs_new_protected:Npn \__regex_group_submatches:nNN #1#2#3 + { + \if_int_compare:w #1 > - 1 \exp_stop_f: + \__regex_toks_put_left:Nx #2 { \__regex_action_submatch:n { #1 < } } + \__regex_toks_put_left:Nx #3 { \__regex_action_submatch:n { #1 > } } + \fi: + } +\cs_new_protected:Npn \__regex_group_repeat_aux:n #1 + { + \__regex_build_transition_right:nNn \__regex_action_free:n + \l__regex_right_state_int \l__regex_max_state_int + \int_set_eq:NN \l__regex_internal_a_int \l__regex_left_state_int + \int_set_eq:NN \l__regex_internal_b_int \l__regex_max_state_int + \if_int_compare:w \__int_eval:w #1 > 1 \exp_stop_f: + \int_set:Nn \l__regex_internal_c_int + { + ( #1 - 1 ) + * ( \l__regex_internal_b_int - \l__regex_internal_a_int ) + } + \int_add:Nn \l__regex_right_state_int { \l__regex_internal_c_int } + \int_add:Nn \l__regex_max_state_int { \l__regex_internal_c_int } + \__regex_toks_memcpy:NNn + \l__regex_internal_b_int + \l__regex_internal_a_int + \l__regex_internal_c_int + \fi: + } +\cs_new_protected:Npn \__regex_group_repeat:nnN #1#2#3 + { + \if_int_compare:w #2 = 0 \exp_stop_f: + \__regex_group_submatches:nNN {#1} + \l__regex_left_state_int \l__regex_right_state_int + \int_set:Nn \l__regex_internal_a_int + { \l__regex_left_state_int - 1 } + \__regex_build_transition_right:nNn \__regex_action_free:n + \l__regex_right_state_int \l__regex_internal_a_int + \__regex_build_new_state: + \if_meaning:w \c_true_bool #3 + \__regex_build_transition_left:NNN \__regex_action_free:n + \l__regex_internal_a_int \l__regex_right_state_int + \else: + \__regex_build_transition_right:nNn \__regex_action_free:n + \l__regex_internal_a_int \l__regex_right_state_int + \fi: + \else: + \__regex_group_repeat_aux:n {#2} + \__regex_group_submatches:nNN {#1} + \l__regex_internal_a_int \l__regex_right_state_int + \if_meaning:w \c_true_bool #3 + \__regex_build_transition_right:nNn \__regex_action_free_group:n + \l__regex_right_state_int \l__regex_internal_a_int + \else: + \__regex_build_transition_left:NNN \__regex_action_free_group:n + \l__regex_right_state_int \l__regex_internal_a_int + \fi: + \__regex_build_new_state: + \fi: + } +\cs_new_protected:Npn \__regex_group_repeat:nnnN #1#2#3#4 + { + \__regex_group_submatches:nNN {#1} + \l__regex_left_state_int \l__regex_right_state_int + \__regex_group_repeat_aux:n { #2 + #3 } + \if_meaning:w \c_true_bool #4 + \int_set_eq:NN \l__regex_left_state_int \l__regex_max_state_int + \prg_replicate:nn { #3 } + { + \int_sub:Nn \l__regex_left_state_int + { \l__regex_internal_b_int - \l__regex_internal_a_int } + \__regex_build_transition_left:NNN \__regex_action_free:n + \l__regex_left_state_int \l__regex_max_state_int + } + \else: + \prg_replicate:nn { #3 - 1 } + { + \int_sub:Nn \l__regex_right_state_int + { \l__regex_internal_b_int - \l__regex_internal_a_int } + \__regex_build_transition_right:nNn \__regex_action_free:n + \l__regex_right_state_int \l__regex_max_state_int + } + \if_int_compare:w #2 = 0 \exp_stop_f: + \int_set:Nn \l__regex_right_state_int + { \l__regex_left_state_int - 1 } + \else: + \int_sub:Nn \l__regex_right_state_int + { \l__regex_internal_b_int - \l__regex_internal_a_int } + \fi: + \__regex_build_transition_right:nNn \__regex_action_free:n + \l__regex_right_state_int \l__regex_max_state_int + \fi: + \__regex_build_new_state: + } +\cs_new_protected:Npn \__regex_assertion:Nn #1#2 + { + \__regex_build_new_state: + \__regex_toks_put_right:Nx \l__regex_left_state_int + { + \exp_not:n {#2} + \__regex_break_point:TF + \bool_if:NF #1 { { } } + { + \__regex_action_free:n + { + \int_eval:n + { \l__regex_right_state_int - \l__regex_left_state_int } + } + } + \bool_if:NT #1 { { } } + } + } +\cs_new_protected:Npn \__regex_anchor:N #1 + { + \if_int_compare:w #1 = \l__regex_current_pos_int + \exp_after:wN \__regex_break_true:w + \fi: + } +\cs_new_protected:Npn \__regex_b_test: + { + \group_begin: + \int_set_eq:NN \l__regex_current_char_int \l__regex_last_char_int + \__regex_prop_w: + \__regex_break_point:TF + { \group_end: \__regex_item_reverse:n \__regex_prop_w: } + { \group_end: \__regex_prop_w: } + } +\cs_new_protected:Npn \__regex_command_K: + { + \__regex_build_new_state: + \__regex_toks_put_right:Nx \l__regex_left_state_int + { + \__regex_action_submatch:n { 0< } + \bool_set_true:N \l__regex_fresh_thread_bool + \__regex_action_free:n + { \int_eval:n { \l__regex_right_state_int - \l__regex_left_state_int } } + \bool_set_false:N \l__regex_fresh_thread_bool + } + } +\int_new:N \l__regex_min_pos_int +\int_new:N \l__regex_max_pos_int +\int_new:N \l__regex_current_pos_int +\int_new:N \l__regex_start_pos_int +\int_new:N \l__regex_success_pos_int +\int_new:N \l__regex_current_char_int +\int_new:N \l__regex_current_catcode_int +\int_new:N \l__regex_last_char_int +\int_new:N \l__regex_case_changed_char_int +\int_new:N \l__regex_current_state_int +\prop_new:N \l__regex_current_submatches_prop +\prop_new:N \l__regex_success_submatches_prop +\int_new:N \l__regex_step_int +\int_new:N \l__regex_min_active_int +\int_new:N \l__regex_max_active_int +\__intarray_new:Nn \g__regex_state_active_intarray { 65536 } +\__intarray_new:Nn \g__regex_thread_state_intarray { 65536 } +\tl_new:N \l__regex_every_match_tl +\bool_new:N \l__regex_fresh_thread_bool +\bool_new:N \l__regex_empty_success_bool +\cs_new_eq:NN \__regex_if_two_empty_matches:F \use:n +\bool_new:N \g__regex_success_bool +\bool_new:N \l__regex_saved_success_bool +\bool_new:N \l__regex_match_success_bool +\cs_new_protected:Npn \__regex_match:n #1 + { + \int_zero:N \l__regex_balance_int + \int_set:Nn \l__regex_current_pos_int { 2 * \l__regex_max_state_int } + \__regex_query_set:nnn { } { -1 } { -2 } + \int_set_eq:NN \l__regex_min_pos_int \l__regex_current_pos_int + \__tl_analysis_map_inline:nn {#1} + { \__regex_query_set:nnn {##1} {"##2} {##3} } + \int_set_eq:NN \l__regex_max_pos_int \l__regex_current_pos_int + \__regex_query_set:nnn { } { -1 } { -2 } + \bool_gset_false:N \g__regex_success_bool + \int_step_inline:nnnn + \l__regex_min_state_int { 1 } { \l__regex_max_state_int - 1 } + { \__intarray_gset_fast:Nnn \g__regex_state_active_intarray {##1} { 1 } } + \int_set_eq:NN \l__regex_min_active_int \l__regex_max_state_int + \int_zero:N \l__regex_step_int + \int_set_eq:NN \l__regex_success_pos_int \l__regex_min_pos_int + \int_set:Nn \l__regex_min_submatch_int + { 2 * \l__regex_max_state_int } + \int_set_eq:NN \l__regex_submatch_int \l__regex_min_submatch_int + \bool_set_false:N \l__regex_empty_success_bool + \__regex_match_once: + } +\cs_new_protected:Npn \__regex_match_once: + { + \if_meaning:w \c_true_bool \l__regex_empty_success_bool + \cs_set:Npn \__regex_if_two_empty_matches:F + { \int_compare:nNnF \l__regex_start_pos_int = \l__regex_current_pos_int } + \else: + \cs_set_eq:NN \__regex_if_two_empty_matches:F \use:n + \fi: + \int_set_eq:NN \l__regex_start_pos_int \l__regex_success_pos_int + \bool_set_false:N \l__regex_match_success_bool + \prop_clear:N \l__regex_current_submatches_prop + \int_set_eq:NN \l__regex_max_active_int \l__regex_min_active_int + \__regex_store_state:n { \l__regex_min_state_int } + \int_set:Nn \l__regex_current_pos_int + { \l__regex_start_pos_int - 1 } + \__regex_query_get: + \__regex_match_loop: + \l__regex_every_match_tl + } +\cs_new_protected:Npn \__regex_single_match: + { + \tl_set:Nn \l__regex_every_match_tl + { \bool_gset_eq:NN \g__regex_success_bool \l__regex_match_success_bool } + } +\cs_new_protected:Npn \__regex_multi_match:n #1 + { + \tl_set:Nn \l__regex_every_match_tl + { + \if_meaning:w \c_true_bool \l__regex_match_success_bool + \bool_gset_true:N \g__regex_success_bool + #1 + \exp_after:wN \__regex_match_once: + \fi: + } + } +\cs_new_protected:Npn \__regex_match_loop: + { + \int_add:Nn \l__regex_step_int { 2 } + \int_incr:N \l__regex_current_pos_int + \int_set_eq:NN \l__regex_last_char_int \l__regex_current_char_int + \int_set_eq:NN \l__regex_case_changed_char_int \c_max_int + \__regex_query_get: + \use:x + { + \int_set_eq:NN \l__regex_max_active_int \l__regex_min_active_int + \int_step_function:nnnN + { \l__regex_min_active_int } + { 1 } + { \l__regex_max_active_int - 1 } + \__regex_match_one_active:n + } + \__prg_break_point: + \bool_set_false:N \l__regex_fresh_thread_bool %^^A was arg of break_point:n + \if_int_compare:w \l__regex_max_active_int > \l__regex_min_active_int + \if_int_compare:w \l__regex_current_pos_int < \l__regex_max_pos_int + \exp_after:wN \exp_after:wN \exp_after:wN \__regex_match_loop: + \fi: + \fi: + } +\cs_new:Npn \__regex_match_one_active:n #1 + { + \__regex_use_state_and_submatches:nn + { \__intarray_item_fast:Nn \g__regex_thread_state_intarray {#1} } + { \__regex_toks_use:w #1 } + } +\cs_new_protected:Npn \__regex_query_set:nnn #1#2#3 + { + \__intarray_gset_fast:Nnn \g__regex_charcode_intarray + { \l__regex_current_pos_int } {#3} + \__intarray_gset_fast:Nnn \g__regex_catcode_intarray + { \l__regex_current_pos_int } {#2} + \__intarray_gset_fast:Nnn \g__regex_balance_intarray + { \l__regex_current_pos_int } { \l__regex_balance_int } + \__regex_toks_set:Nn \l__regex_current_pos_int {#1} + \int_incr:N \l__regex_current_pos_int + \if_case:w #2 \exp_stop_f: + \or: \int_incr:N \l__regex_balance_int + \or: \int_decr:N \l__regex_balance_int + \fi: + } +\cs_new_protected:Npn \__regex_query_get: + { + \l__regex_current_char_int + = \__intarray_item_fast:Nn \g__regex_charcode_intarray + { \l__regex_current_pos_int } \scan_stop: + \l__regex_current_catcode_int + = \__intarray_item_fast:Nn \g__regex_catcode_intarray + { \l__regex_current_pos_int } \scan_stop: + } +\cs_new_protected:Npn \__regex_use_state: + { + \__intarray_gset_fast:Nnn \g__regex_state_active_intarray + { \l__regex_current_state_int } { \l__regex_step_int } + \__regex_toks_use:w \l__regex_current_state_int + \__intarray_gset_fast:Nnn \g__regex_state_active_intarray + { \l__regex_current_state_int } { \l__regex_step_int + 1 } + } +\cs_new_protected:Npn \__regex_use_state_and_submatches:nn #1 #2 + { + \int_set:Nn \l__regex_current_state_int {#1} + \if_int_compare:w + \__intarray_item_fast:Nn \g__regex_state_active_intarray + { \l__regex_current_state_int } + < \l__regex_step_int + \tl_set:Nn \l__regex_current_submatches_prop {#2} + \exp_after:wN \__regex_use_state: + \fi: + \scan_stop: + } +\cs_new_protected:Npn \__regex_action_start_wildcard: + { + \bool_set_true:N \l__regex_fresh_thread_bool + \__regex_action_free:n {1} + \bool_set_false:N \l__regex_fresh_thread_bool + \__regex_action_cost:n {0} + } +\cs_new_protected:Npn \__regex_action_free:n + { \__regex_action_free_aux:nn { > \l__regex_step_int \else: } } +\cs_new_protected:Npn \__regex_action_free_group:n + { \__regex_action_free_aux:nn { < \l__regex_step_int } } +\cs_new_protected:Npn \__regex_action_free_aux:nn #1#2 + { + \use:x + { + \int_add:Nn \l__regex_current_state_int {#2} + \exp_not:n + { + \if_int_compare:w + \__intarray_item_fast:Nn \g__regex_state_active_intarray + { \l__regex_current_state_int } + #1 + \exp_after:wN \__regex_use_state: + \fi: + } + \int_set:Nn \l__regex_current_state_int + { \int_use:N \l__regex_current_state_int } + \tl_set:Nn \exp_not:N \l__regex_current_submatches_prop + { \exp_not:o \l__regex_current_submatches_prop } + } + } +\cs_new_protected:Npn \__regex_action_cost:n #1 + { + \exp_args:No \__regex_store_state:n + { \__int_value:w \__int_eval:w \l__regex_current_state_int + #1 } + } +\cs_new_protected:Npn \__regex_store_state:n #1 + { + \__regex_store_submatches: + \__intarray_gset_fast:Nnn \g__regex_thread_state_intarray + { \l__regex_max_active_int } {#1} + \int_incr:N \l__regex_max_active_int + } +\cs_new_protected:Npn \__regex_store_submatches: + { + \__regex_toks_set:No \l__regex_max_active_int + { \l__regex_current_submatches_prop } + } +\cs_new_protected:Npn \__regex_disable_submatches: + { + \cs_set_protected:Npn \__regex_store_submatches: { } + \cs_set_protected:Npn \__regex_action_submatch:n ##1 { } + } +\cs_new_protected:Npn \__regex_action_submatch:n #1 + { + \prop_put:Nno \l__regex_current_submatches_prop {#1} + { \int_use:N \l__regex_current_pos_int } + } +\cs_new_protected:Npn \__regex_action_success: + { + \__regex_if_two_empty_matches:F + { + \bool_set_true:N \l__regex_match_success_bool + \bool_set_eq:NN \l__regex_empty_success_bool + \l__regex_fresh_thread_bool + \int_set_eq:NN \l__regex_success_pos_int \l__regex_current_pos_int + \prop_set_eq:NN \l__regex_success_submatches_prop + \l__regex_current_submatches_prop + \__prg_break: + } + } +\int_new:N \l__regex_replacement_csnames_int +\tl_new:N \l__regex_replacement_category_tl +\seq_new:N \l__regex_replacement_category_seq +\tl_new:N \l__regex_balance_tl +\cs_new:Npn \__regex_replacement_balance_one_match:n #1 + { - \__regex_submatch_balance:n {#1} } +\cs_new:Npn \__regex_replacement_do_one_match:n #1 + { + \__regex_query_range:nn + { \__intarray_item_fast:Nn \g__regex_submatch_prev_intarray {#1} } + { \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray {#1} } + } +\cs_new:Npn \__regex_replacement_exp_not:N #1 { \exp_not:n {#1} } +\cs_new:Npn \__regex_query_range:nn #1#2 + { + \exp_after:wN \__regex_query_range_loop:ww + \__int_value:w \__int_eval:w #1 \exp_after:wN ; + \__int_value:w \__int_eval:w #2 ; + \__prg_break_point: + } +\cs_new:Npn \__regex_query_range_loop:ww #1 ; #2 ; + { + \if_int_compare:w #1 < #2 \exp_stop_f: + \else: + \exp_after:wN \__prg_break: + \fi: + \__regex_toks_use:w #1 \exp_stop_f: + \exp_after:wN \__regex_query_range_loop:ww + \__int_value:w \__int_eval:w #1 + 1 ; #2 ; + } +\cs_new:Npn \__regex_query_submatch:n #1 + { + \__regex_query_range:nn + { \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray {#1} } + { \__intarray_item_fast:Nn \g__regex_submatch_end_intarray {#1} } + } +\cs_new_protected:Npn \__regex_submatch_balance:n #1 + { + \__int_eval:w + \int_compare:nNnTF + { \__intarray_item_fast:Nn \g__regex_submatch_end_intarray {#1} } = 0 + { 0 } + { + \__intarray_item_fast:Nn \g__regex_balance_intarray + { \__intarray_item_fast:Nn \g__regex_submatch_end_intarray {#1} } + } + - + \int_compare:nNnTF + { \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray {#1} } = 0 + { 0 } + { + \__intarray_item_fast:Nn \g__regex_balance_intarray + { \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray {#1} } + } + \__int_eval_end: + } +\cs_new_protected:Npn \__regex_replacement:n #1 + { + \__tl_build:Nw \l__regex_internal_a_tl + \int_zero:N \l__regex_balance_int + \tl_clear:N \l__regex_balance_tl + \__regex_escape_use:nnnn + { + \if_charcode:w \c_right_brace_str ##1 + \__regex_replacement_rbrace:N + \else: + \__regex_replacement_normal:n + \fi: + ##1 + } + { \__regex_replacement_escaped:N ##1 } + { \__regex_replacement_normal:n ##1 } + {#1} + \prg_do_nothing: \prg_do_nothing: + \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: + \__msg_kernel_error:nnx { regex } { replacement-missing-rbrace } + { \int_use:N \l__regex_replacement_csnames_int } + \__tl_build_one:x + { \prg_replicate:nn \l__regex_replacement_csnames_int \cs_end: } + \fi: + \seq_if_empty:NF \l__regex_replacement_category_seq + { + \__msg_kernel_error:nnx { regex } { replacement-missing-rparen } + { \seq_count:N \l__regex_replacement_category_seq } + \seq_clear:N \l__regex_replacement_category_seq + } + \cs_gset:Npx \__regex_replacement_balance_one_match:n ##1 + { + + \int_use:N \l__regex_balance_int + \l__regex_balance_tl + - \__regex_submatch_balance:n {##1} + } + \__tl_build_end: + \exp_args:No \__regex_replacement_aux:n \l__regex_internal_a_tl + } +\cs_new_protected:Npn \__regex_replacement_aux:n #1 + { + \cs_set:Npn \__regex_replacement_do_one_match:n ##1 + { + \__regex_query_range:nn + { \__intarray_item_fast:Nn \g__regex_submatch_prev_intarray {##1} } + { \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray {##1} } + #1 + } + } +\cs_new_protected:Npn \__regex_replacement_normal:n #1 + { + \tl_if_empty:NTF \l__regex_replacement_category_tl + { \__tl_build_one:n {#1} } + { % ( + \token_if_eq_charcode:NNTF #1 ) + { + \seq_pop:NN \l__regex_replacement_category_seq + \l__regex_replacement_category_tl + } + { + \use:c { __regex_replacement_c_ \l__regex_replacement_category_tl :w } + \__regex_replacement_normal:n {#1} + } + } + } +\cs_new_protected:Npn \__regex_replacement_escaped:N #1 + { + \cs_if_exist_use:cF { __regex_replacement_#1:w } + { + \if_int_compare:w 1 < 1#1 \exp_stop_f: + \__regex_replacement_put_submatch:n {#1} + \else: + \exp_args:No \__regex_replacement_normal:n + { \token_to_str:N #1 } + \fi: + } + } +\cs_new_protected:Npn \__regex_replacement_put_submatch:n #1 + { + \if_int_compare:w #1 < \l__regex_capturing_group_int + \__tl_build_one:n { \__regex_query_submatch:n { #1 + ##1 } } + \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: + \tl_put_right:Nn \l__regex_balance_tl + { + \__regex_submatch_balance:n { \__int_eval:w #1+##1 \__int_eval_end: } } + \fi: + \fi: + } +\cs_new_protected:Npn \__regex_replacement_g:w #1#2 + { + \str_if_eq_x:nnTF { #1#2 } { \__regex_replacement_normal:n \c_left_brace_str } + { \l__regex_internal_a_int = \__regex_replacement_g_digits:NN } + { \__regex_replacement_error:NNN g #1 #2 } + } +\cs_new:Npn \__regex_replacement_g_digits:NN #1#2 + { + \token_if_eq_meaning:NNTF #1 \__regex_replacement_normal:n + { + \if_int_compare:w 1 < 1#2 \exp_stop_f: + #2 + \exp_after:wN \use_i:nnn + \exp_after:wN \__regex_replacement_g_digits:NN + \else: + \exp_stop_f: + \exp_after:wN \__regex_replacement_error:NNN + \exp_after:wN g + \fi: + } + { + \exp_stop_f: + \if_meaning:w \__regex_replacement_rbrace:N #1 + \exp_args:No \__regex_replacement_put_submatch:n + { \int_use:N \l__regex_internal_a_int } + \exp_after:wN \use_none:nn + \else: + \exp_after:wN \__regex_replacement_error:NNN + \exp_after:wN g + \fi: + } + #1 #2 + } +\cs_new_protected:Npn \__regex_replacement_c:w #1#2 + { + \token_if_eq_meaning:NNTF #1 \__regex_replacement_normal:n + { + \exp_after:wN \token_if_eq_charcode:NNTF \c_left_brace_str #2 + { \__regex_replacement_cu_aux:Nw \__regex_replacement_exp_not:N } + { + \cs_if_exist:cTF { __regex_replacement_c_#2:w } + { \__regex_replacement_cat:NNN #2 } + { \__regex_replacement_error:NNN c #1#2 } + } + } + { \__regex_replacement_error:NNN c #1#2 } + } +\cs_new_protected:Npn \__regex_replacement_cu_aux:Nw #1 + { + \if_case:w \l__regex_replacement_csnames_int + \__tl_build_one:n { \exp_not:n { \exp_after:wN #1 \cs:w } } + \else: + \__tl_build_one:n { \exp_not:n { \exp_after:wN \tl_to_str:V \cs:w } } + \fi: + \int_incr:N \l__regex_replacement_csnames_int + } +\cs_new_protected:Npn \__regex_replacement_u:w #1#2 + { + \str_if_eq_x:nnTF { #1#2 } { \__regex_replacement_normal:n \c_left_brace_str } + { \__regex_replacement_cu_aux:Nw \exp_not:V } + { \__regex_replacement_error:NNN u #1#2 } + } +\cs_new_protected:Npn \__regex_replacement_rbrace:N #1 + { + \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: + \__tl_build_one:n \cs_end: + \int_decr:N \l__regex_replacement_csnames_int + \else: + \__regex_replacement_normal:n {#1} + \fi: + } +\cs_new_protected:Npn \__regex_replacement_cat:NNN #1#2#3 + { + \token_if_eq_meaning:NNTF \prg_do_nothing: #3 + { \__msg_kernel_error:nn { regex } { replacement-catcode-end } } + { + \int_compare:nNnTF { \l__regex_replacement_csnames_int } > 0 + { + \__msg_kernel_error:nnnn + { regex } { replacement-catcode-in-cs } {#1} {#3} + #2 #3 + } + { + \str_if_eq:nnTF { #2 #3 } { \__regex_replacement_normal:n ( } % ) + { + \seq_push:NV \l__regex_replacement_category_seq + \l__regex_replacement_category_tl + \tl_set:Nn \l__regex_replacement_category_tl {#1} + } + { \use:c { __regex_replacement_c_#1:w } #2 #3 } + } + } + } +\group_begin: + \cs_new_protected:Npn \__regex_replacement_char:nNN #1#2#3 + { + \tex_lccode:D 0 = `#3 \scan_stop: + \tex_lowercase:D { \__tl_build_one:n {#1} } + } + \char_set_catcode_active:N \^^@ + \cs_new_protected:Npn \__regex_replacement_c_A:w + { \__regex_replacement_char:nNN { \exp_not:n { \exp_not:N ^^@ } } } + \char_set_catcode_group_begin:N \^^@ + \cs_new_protected:Npn \__regex_replacement_c_B:w + { + \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: + \int_incr:N \l__regex_balance_int + \fi: + \__regex_replacement_char:nNN + { \exp_not:n { \exp_after:wN ^^@ \if_false: } \fi: } } + } + \cs_new_protected:Npn \__regex_replacement_c_C:w #1#2 + { \__tl_build_one:n { \exp_not:N \exp_not:N \exp_not:c {#2} } } + \char_set_catcode_math_subscript:N \^^@ + \cs_new_protected:Npn \__regex_replacement_c_D:w + { \__regex_replacement_char:nNN { ^^@ } } + \char_set_catcode_group_end:N \^^@ + \cs_new_protected:Npn \__regex_replacement_c_E:w + { + \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: + \int_decr:N \l__regex_balance_int + \fi: + \__regex_replacement_char:nNN + { \exp_not:n { \if_false: { \fi: ^^@ } } + } + \char_set_catcode_letter:N \^^@ + \cs_new_protected:Npn \__regex_replacement_c_L:w + { \__regex_replacement_char:nNN { ^^@ } } + \char_set_catcode_math_toggle:N \^^@ + \cs_new_protected:Npn \__regex_replacement_c_M:w + { \__regex_replacement_char:nNN { ^^@ } } + \char_set_catcode_other:N \^^@ + \cs_new_protected:Npn \__regex_replacement_c_O:w + { \__regex_replacement_char:nNN { ^^@ } } + \char_set_catcode_parameter:N \^^@ + \cs_new_protected:Npn \__regex_replacement_c_P:w + { + \__regex_replacement_char:nNN + { \exp_not:n { \exp_not:n { ^^@^^@^^@^^@ } } } + } + \cs_new_protected:Npn \__regex_replacement_c_S:w #1#2 + { + \if_int_compare:w `#2 = 0 \exp_stop_f: + \__msg_kernel_error:nn { regex } { replacement-null-space } + \fi: + \tex_lccode:D `\ = `#2 \scan_stop: + \tex_lowercase:D { \__tl_build_one:n {~} } + } + \char_set_catcode_alignment:N \^^@ + \cs_new_protected:Npn \__regex_replacement_c_T:w + { \__regex_replacement_char:nNN { ^^@ } } + \char_set_catcode_math_superscript:N \^^@ + \cs_new_protected:Npn \__regex_replacement_c_U:w + { \__regex_replacement_char:nNN { ^^@ } } +\group_end: +\cs_new_protected:Npn \__regex_replacement_error:NNN #1#2#3 + { + \__msg_kernel_error:nnx { regex } { replacement-#1 } {#3} + #2 #3 + } +\cs_new_protected:Npn \regex_new:N #1 + { \cs_new_eq:NN #1 \c__regex_no_match_regex } +\cs_new_protected:Npn \regex_set:Nn #1#2 + { + \__regex_compile:n {#2} + \tl_set_eq:NN #1 \l__regex_internal_regex + } +\cs_new_protected:Npn \regex_gset:Nn #1#2 + { + \__regex_compile:n {#2} + \tl_gset_eq:NN #1 \l__regex_internal_regex + } +\cs_new_protected:Npn \regex_const:Nn #1#2 + { + \__regex_compile:n {#2} + \tl_const:Nx #1 { \exp_not:o \l__regex_internal_regex } + } +\cs_new_protected:Npn \regex_show:n #1 + { + \__regex_compile:n {#1} + \__regex_show:Nn \l__regex_internal_regex + { { \tl_to_str:n {#1} } } + } +\cs_new_protected:Npn \regex_show:N #1 + { \__regex_show:Nn #1 { variable~\token_to_str:N #1 } } +\prg_new_protected_conditional:Npnn \regex_match:nn #1#2 { T , F , TF } + { + \__regex_if_match:nn { \__regex_build:n {#1} } {#2} + \__regex_return: + } +\prg_new_protected_conditional:Npnn \regex_match:Nn #1#2 { T , F , TF } + { + \__regex_if_match:nn { \__regex_build:N #1 } {#2} + \__regex_return: + } +\cs_new_protected:Npn \regex_count:nnN #1 + { \__regex_count:nnN { \__regex_build:n {#1} } } +\cs_new_protected:Npn \regex_count:NnN #1 + { \__regex_count:nnN { \__regex_build:N #1 } } +\cs_set_protected:Npn \__regex_tmp:w #1#2#3 + { + \cs_new_protected:Npn #2 ##1 { #1 { \__regex_build:n {##1} } } + \cs_new_protected:Npn #3 ##1 { #1 { \__regex_build:N ##1 } } + \prg_new_protected_conditional:Npnn #2 ##1##2##3 { T , F , TF } + { #1 { \__regex_build:n {##1} } {##2} ##3 \__regex_return: } + \prg_new_protected_conditional:Npnn #3 ##1##2##3 { T , F , TF } + { #1 { \__regex_build:N ##1 } {##2} ##3 \__regex_return: } + } +\__regex_tmp:w \__regex_extract_once:nnN + \regex_extract_once:nnN \regex_extract_once:NnN +\__regex_tmp:w \__regex_extract_all:nnN + \regex_extract_all:nnN \regex_extract_all:NnN +\__regex_tmp:w \__regex_replace_once:nnN + \regex_replace_once:nnN \regex_replace_once:NnN +\__regex_tmp:w \__regex_replace_all:nnN + \regex_replace_all:nnN \regex_replace_all:NnN +\__regex_tmp:w \__regex_split:nnN \regex_split:nnN \regex_split:NnN +\int_new:N \l__regex_match_count_int +\flag_new:n { __regex_begin } +\flag_new:n { __regex_end } +\int_new:N \l__regex_min_submatch_int +\int_new:N \l__regex_submatch_int +\int_new:N \l__regex_zeroth_submatch_int +\__intarray_new:Nn \g__regex_submatch_prev_intarray { 65536 } +\__intarray_new:Nn \g__regex_submatch_begin_intarray { 65536 } +\__intarray_new:Nn \g__regex_submatch_end_intarray { 65536 } +\cs_new_protected:Npn \__regex_return: + { + \if_meaning:w \c_true_bool \g__regex_success_bool + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_new_protected:Npn \__regex_if_match:nn #1#2 + { + \group_begin: + \__regex_disable_submatches: + \__regex_single_match: + #1 + \__regex_match:n {#2} + \group_end: + } +\cs_new_protected:Npn \__regex_count:nnN #1#2#3 + { + \group_begin: + \__regex_disable_submatches: + \int_zero:N \l__regex_match_count_int + \__regex_multi_match:n { \int_incr:N \l__regex_match_count_int } + #1 + \__regex_match:n {#2} + \exp_args:NNNo + \group_end: + \int_set:Nn #3 { \int_use:N \l__regex_match_count_int } + } +\cs_new_protected:Npn \__regex_extract_once:nnN #1#2#3 + { + \group_begin: + \__regex_single_match: + #1 + \__regex_match:n {#2} + \__regex_extract: + \__regex_group_end_extract_seq:N #3 + } +\cs_new_protected:Npn \__regex_extract_all:nnN #1#2#3 + { + \group_begin: + \__regex_multi_match:n { \__regex_extract: } + #1 + \__regex_match:n {#2} + \__regex_group_end_extract_seq:N #3 + } +\cs_new_protected:Npn \__regex_split:nnN #1#2#3 + { + \group_begin: + \__regex_multi_match:n + { + \if_int_compare:w \l__regex_start_pos_int < \l__regex_success_pos_int + \__regex_extract: + \__intarray_gset_fast:Nnn \g__regex_submatch_prev_intarray + { \l__regex_zeroth_submatch_int } { 0 } + \__intarray_gset_fast:Nnn \g__regex_submatch_end_intarray + { \l__regex_zeroth_submatch_int } + { + \__intarray_item_fast:Nn \g__regex_submatch_begin_intarray + { \l__regex_zeroth_submatch_int } + } + \__intarray_gset_fast:Nnn \g__regex_submatch_begin_intarray + { \l__regex_zeroth_submatch_int } + { \l__regex_start_pos_int } + \fi: + } + #1 + \__regex_match:n {#2} + \__intarray_gset_fast:Nnn \g__regex_submatch_prev_intarray + { \l__regex_submatch_int } { 0 } + \__intarray_gset_fast:Nnn \g__regex_submatch_end_intarray + { \l__regex_submatch_int } + { \l__regex_max_pos_int } + \__intarray_gset_fast:Nnn \g__regex_submatch_begin_intarray + { \l__regex_submatch_int } + { \l__regex_start_pos_int } + \int_incr:N \l__regex_submatch_int + \if_meaning:w \c_true_bool \l__regex_empty_success_bool + \if_int_compare:w \l__regex_start_pos_int = \l__regex_max_pos_int + \int_decr:N \l__regex_submatch_int + \fi: + \fi: + \__regex_group_end_extract_seq:N #3 + } +\cs_new_protected:Npn \__regex_group_end_extract_seq:N #1 + { + \cs_set_eq:NN \__seq_item:n \scan_stop: + \flag_clear:n { __regex_begin } + \flag_clear:n { __regex_end } + \tl_set:Nx \l__regex_internal_a_tl + { + \s__seq + \int_step_function:nnnN + { \l__regex_min_submatch_int } + { 1 } + { \l__regex_submatch_int - 1 } + \__regex_extract_seq_aux:n + } + \int_compare:nNnF + { \flag_height:n { __regex_begin } + \flag_height:n { __regex_end } } + = 0 + { + \__msg_kernel_error:nnxxx { regex } { result-unbalanced } + { splitting~or~extracting~submatches } + { \flag_height:n { __regex_end } } + { \flag_height:n { __regex_begin } } + } + \use:x + { + \group_end: + \tl_set:Nn \exp_not:N #1 { \l__regex_internal_a_tl } + } + } +\cs_new:Npn \__regex_extract_seq_aux:n #1 + { + \__seq_item:n + { + \exp_after:wN \__regex_extract_seq_aux:ww + \__int_value:w \__regex_submatch_balance:n {#1} ; #1; + } + } +\cs_new:Npn \__regex_extract_seq_aux:ww #1; #2; + { + \if_int_compare:w #1 < 0 \exp_stop_f: + \flag_raise:n { __regex_end } + \prg_replicate:nn {-#1} { \exp_not:n { { \if_false: } \fi: } } + \fi: + \__regex_query_submatch:n {#2} + \if_int_compare:w #1 > 0 \exp_stop_f: + \flag_raise:n { __regex_begin } + \prg_replicate:nn {#1} { \exp_not:n { \if_false: { \fi: } } } + \fi: + } +\cs_new_protected:Npn \__regex_extract: + { + \if_meaning:w \c_true_bool \g__regex_success_bool + \int_set_eq:NN \l__regex_zeroth_submatch_int \l__regex_submatch_int + \prg_replicate:nn \l__regex_capturing_group_int + { + \__intarray_gset_fast:Nnn \g__regex_submatch_begin_intarray + { \l__regex_submatch_int } { 0 } + \__intarray_gset_fast:Nnn \g__regex_submatch_end_intarray + { \l__regex_submatch_int } { 0 } + \__intarray_gset_fast:Nnn \g__regex_submatch_prev_intarray + { \l__regex_submatch_int } { 0 } + \int_incr:N \l__regex_submatch_int + } + \prop_map_inline:Nn \l__regex_success_submatches_prop + { + \if_int_compare:w ##1 - 1 \exp_stop_f: + \exp_after:wN \__regex_extract_e:wn \__int_value:w + \else: + \exp_after:wN \__regex_extract_b:wn \__int_value:w + \fi: + \__int_eval:w \l__regex_zeroth_submatch_int + ##1 {##2} + } + \__intarray_gset_fast:Nnn \g__regex_submatch_prev_intarray + { \l__regex_zeroth_submatch_int } { \l__regex_start_pos_int } + \fi: + } +\cs_new_protected:Npn \__regex_extract_b:wn #1 < #2 + { \__intarray_gset_fast:Nnn \g__regex_submatch_begin_intarray {#1} {#2} } +\cs_new_protected:Npn \__regex_extract_e:wn #1 > #2 + { \__intarray_gset_fast:Nnn \g__regex_submatch_end_intarray {#1} {#2} } +\cs_new_protected:Npn \__regex_replace_once:nnN #1#2#3 + { + \group_begin: + \__regex_single_match: + #1 + \__regex_replacement:n {#2} + \exp_args:No \__regex_match:n { #3 } + \if_meaning:w \c_false_bool \g__regex_success_bool + \group_end: + \else: + \__regex_extract: + \int_set:Nn \l__regex_balance_int + { + \__regex_replacement_balance_one_match:n + { \l__regex_zeroth_submatch_int } + } + \tl_set:Nx \l__regex_internal_a_tl + { + \__regex_replacement_do_one_match:n { \l__regex_zeroth_submatch_int } + \__regex_query_range:nn + { + \__intarray_item_fast:Nn \g__regex_submatch_end_intarray + { \l__regex_zeroth_submatch_int } + } + { \l__regex_max_pos_int } + } + \__regex_group_end_replace:N #3 + \fi: + } +\cs_new_protected:Npn \__regex_replace_all:nnN #1#2#3 + { + \group_begin: + \__regex_multi_match:n { \__regex_extract: } + #1 + \__regex_replacement:n {#2} + \exp_args:No \__regex_match:n {#3} + \int_set:Nn \l__regex_balance_int + { + 0 + \int_step_function:nnnN + { \l__regex_min_submatch_int } + \l__regex_capturing_group_int + { \l__regex_submatch_int - 1 } + \__regex_replacement_balance_one_match:n + } + \tl_set:Nx \l__regex_internal_a_tl + { + \int_step_function:nnnN + { \l__regex_min_submatch_int } + \l__regex_capturing_group_int + { \l__regex_submatch_int - 1 } + \__regex_replacement_do_one_match:n + \__regex_query_range:nn + \l__regex_start_pos_int \l__regex_max_pos_int + } + \__regex_group_end_replace:N #3 + } +\cs_new_protected:Npn \__regex_group_end_replace:N #1 + { + \if_int_compare:w \l__regex_balance_int = 0 \exp_stop_f: + \else: + \__msg_kernel_error:nnxxx { regex } { result-unbalanced } + { replacing } + { \int_max:nn { - \l__regex_balance_int } { 0 } } + { \int_max:nn { \l__regex_balance_int } { 0 } } + \fi: + \use:x + { + \group_end: + \tl_set:Nn \exp_not:N #1 + { + \if_int_compare:w \l__regex_balance_int < 0 \exp_stop_f: + \prg_replicate:nn { - \l__regex_balance_int } + { { \if_false: } \fi: } + \fi: + \l__regex_internal_a_tl + \if_int_compare:w \l__regex_balance_int > 0 \exp_stop_f: + \prg_replicate:nn { \l__regex_balance_int } + { \if_false: { \fi: } } + \fi: + } + } + } +\__msg_kernel_new:nnnn { regex } { trailing-backslash } + { Trailing~escape~character~'\iow_char:N\\'. } + { + A~regular~expression~or~its~replacement~text~ends~with~ + the~escape~character~'\iow_char:N\\'.~It~will~be~ignored. + } +\__msg_kernel_new:nnnn { regex } { x-missing-rbrace } + { Missing~closing~brace~in~'\iow_char:N\\x'~hexadecimal~sequence. } + { + You~wrote~something~like~ + '\iow_char:N\\x\{...#1'.~ + The~closing~brace~is~missing. + } +\__msg_kernel_new:nnnn { regex } { x-overflow } + { Character~code~'#1'~too~large~in~'\iow_char:N\\x'~hexadecimal~sequence. } + { + You~wrote~something~like~ + '\iow_char:N\\x\{\int_to_Hex:n{#1}\}'.~ + The~character~code~#1~is~larger~than~ + the~maximum~value~\int_use:N \c_max_char_int. + } +\__msg_kernel_new:nnnn { regex } { invalid-quantifier } + { Braced~quantifier~'#1'~may~not~be~followed~by~'#2'. } + { + The~character~'#2'~is~invalid~in~the~braced~quantifier~'#1'.~ + The~only~valid~quantifiers~are~'*',~'?',~'+',~'{<int>}',~ + '{<min>,}'~and~'{<min>,<max>}',~optionally~followed~by~'?'. + } +\__msg_kernel_new:nnnn { regex } { missing-rbrack } + { Missing~right~bracket~inserted~in~regular~expression. } + { + LaTeX~was~given~a~regular~expression~where~a~character~class~ + was~started~with~'[',~but~the~matching~']'~is~missing. + } +\__msg_kernel_new:nnnn { regex } { missing-rparen } + { + Missing~right~ + \int_compare:nTF { #1 = 1 } { parenthesis } { parentheses } ~ + inserted~in~regular~expression. + } + { + LaTeX~was~given~a~regular~expression~with~\int_eval:n {#1} ~ + more~left~parentheses~than~right~parentheses. + } +\__msg_kernel_new:nnnn { regex } { extra-rparen } + { Extra~right~parenthesis~ignored~in~regular~expression. } + { + LaTeX~came~across~a~closing~parenthesis~when~no~submatch~group~ + was~open.~The~parenthesis~will~be~ignored. + } +\__msg_kernel_new:nnnn { regex } { bad-escape } + { + Invalid~escape~'\iow_char:N\\#1'~ + \__regex_if_in_cs:TF { within~a~control~sequence. } + { + \__regex_if_in_class:TF + { in~a~character~class. } + { following~a~category~test. } + } + } + { + The~escape~sequence~'\iow_char:N\\#1'~may~not~appear~ + \__regex_if_in_cs:TF + { + within~a~control~sequence~test~introduced~by~ + '\iow_char:N\\c\iow_char:N\{'. + } + { + \__regex_if_in_class:TF + { within~a~character~class~ } + { following~a~category~test~such~as~'\iow_char:N\\cL'~ } + because~it~does~not~match~exactly~one~character. + } + } +\__msg_kernel_new:nnnn { regex } { range-missing-end } + { Invalid~end-point~for~range~'#1-#2'~in~character~class. } + { + The~end-point~'#2'~of~the~range~'#1-#2'~may~not~serve~as~an~ + end-point~for~a~range:~alphanumeric~characters~should~not~be~ + escaped,~and~non-alphanumeric~characters~should~be~escaped. + } +\__msg_kernel_new:nnnn { regex } { range-backwards } + { Range~'[#1-#2]'~out~of~order~in~character~class. } + { + In~ranges~of~characters~'[x-y]'~appearing~in~character~classes,~ + the~first~character~code~must~not~be~larger~than~the~second.~ + Here,~'#1'~has~character~code~\int_eval:n {`#1},~while~ + '#2'~has~character~code~\int_eval:n {`#2}. + } +\__msg_kernel_new:nnnn { regex } { c-bad-mode } + { Invalid~nested~'\iow_char:N\\c'~escape~in~regular~expression. } + { + The~'\iow_char:N\\c'~escape~cannot~be~used~within~ + a~control~sequence~test~'\iow_char:N\\c{...}'.~ + To~combine~several~category~tests,~use~'\iow_char:N\\c[...]'. + } +\__msg_kernel_new:nnnn { regex } { c-missing-rbrace } + { Missing~right~brace~inserted~for~'\iow_char:N\\c'~escape. } + { + LaTeX~was~given~a~regular~expression~where~a~ + '\iow_char:N\\c\iow_char:N\{...'~construction~was~not~ended~ + with~a~closing~brace~'\iow_char:N\}'. + } +\__msg_kernel_new:nnnn { regex } { c-missing-rbrack } + { Missing~right~bracket~inserted~for~'\iow_char:N\\c'~escape. } + { + A~construction~'\iow_char:N\\c[...'~appears~in~a~ + regular~expression,~but~the~closing~']'~is~not~present. + } +\__msg_kernel_new:nnnn { regex } { c-missing-category } + { Invalid~character~'#1'~following~'\iow_char:N\\c'~escape. } + { + In~regular~expressions,~the~'\iow_char:N\\c'~escape~sequence~ + may~only~be~followed~by~a~left~brace,~a~left~bracket,~or~a~ + capital~letter~representing~a~character~category,~namely~ + one~of~'ABCDELMOPSTU'. + } +\__msg_kernel_new:nnnn { regex } { c-trailing } + { Trailing~category~code~escape~'\iow_char:N\\c'... } + { + A~regular~expression~ends~with~'\iow_char:N\\c'~followed~ + by~a~letter.~It~will~be~ignored. + } +\__msg_kernel_new:nnnn { regex } { u-missing-lbrace } + { Missing~left~brace~following~'\iow_char:N\\u'~escape. } + { + The~'\iow_char:N\\u'~escape~sequence~must~be~followed~by~ + a~brace~group~with~the~name~of~the~variable~to~use. + } +\__msg_kernel_new:nnnn { regex } { u-missing-rbrace } + { Missing~right~brace~inserted~for~'\iow_char:N\\u'~escape. } + { + LaTeX~ + \str_if_eq_x:nnTF { } {#2} + { reached~the~end~of~the~string~ } + { encountered~an~escaped~alphanumeric~character '\iow_char:N\\#2'~ } + when~parsing~the~argument~of~an~'\iow_char:N\\u\iow_char:N\{...\}'~escape. + } +\__msg_kernel_new:nnnn { regex } { posix-unsupported } + { POSIX~collating~element~'[#1 ~ #1]'~not~supported. } + { + The~'[.foo.]'~and~'[=bar=]'~syntaxes~have~a~special~meaning~ + in~POSIX~regular~expressions.~This~is~not~supported~by~LaTeX.~ + Maybe~you~forgot~to~escape~a~left~bracket~in~a~character~class? + } +\__msg_kernel_new:nnnn { regex } { posix-unknown } + { POSIX~class~'[:#1:]'~unknown. } + { + '[:#1:]'~is~not~among~the~known~POSIX~classes~ + '[:alnum:]',~'[:alpha:]',~'[:ascii:]',~'[:blank:]',~ + '[:cntrl:]',~'[:digit:]',~'[:graph:]',~'[:lower:]',~ + '[:print:]',~'[:punct:]',~'[:space:]',~'[:upper:]',~ + '[:word:]',~and~'[:xdigit:]'. + } +\__msg_kernel_new:nnnn { regex } { posix-missing-close } + { Missing~closing~':]'~for~POSIX~class. } + { The~POSIX~syntax~'#1'~must~be~followed~by~':]',~not~'#2'. } +\__msg_kernel_new:nnnn { regex } { result-unbalanced } + { Missing~brace~inserted~when~#1. } + { + LaTeX~was~asked~to~do~some~regular~expression~operation,~ + and~the~resulting~token~list~would~not~have~the~same~number~ + of~begin-group~and~end-group~tokens.~Braces~were~inserted:~ + #2~left,~#3~right. + } +\__msg_kernel_new:nnnn { regex } { unknown-option } + { Unknown~option~'#1'~for~regular~expressions. } + { + The~only~available~option~is~'case-insensitive',~toggled~by~ + '(?i)'~and~'(?-i)'. + } +\__msg_kernel_new:nnnn { regex } { special-group-unknown } + { Unknown~special~group~'#1~...'~in~a~regular~expression. } + { + The~only~valid~constructions~starting~with~'(?'~are~ + '(?:~...~)',~'(?|~...~)',~'(?i)',~and~'(?-i)'. + } +\__msg_kernel_new:nnnn { regex } { replacement-c } + { Misused~'\iow_char:N\\c'~command~in~a~replacement~text. } + { + In~a~replacement~text,~the~'\iow_char:N\\c'~escape~sequence~ + can~be~followed~by~one~of~the~letters~'ABCDELMOPSTU'~ + or~a~brace~group,~not~by~'#1'. + } +\__msg_kernel_new:nnnn { regex } { replacement-u } + { Misused~'\iow_char:N\\u'~command~in~a~replacement~text. } + { + In~a~replacement~text,~the~'\iow_char:N\\u'~escape~sequence~ + must~be~~followed~by~a~brace~group~holding~the~name~of~the~ + variable~to~use. + } +\__msg_kernel_new:nnnn { regex } { replacement-g } + { + Missing~brace~for~the~'\iow_char:N\\g'~construction~ + in~a~replacement~text. + } + { + In~the~replacement~text~for~a~regular~expression~search,~ + submatches~are~represented~either~as~'\iow_char:N \\g{dd..d}',~ + or~'\\d',~where~'d'~are~single~digits.~Here,~a~brace~is~missing. + } +\__msg_kernel_new:nnnn { regex } { replacement-catcode-end } + { + Missing~character~for~the~'\iow_char:N\\c<category><character>'~ + construction~in~a~replacement~text. + } + { + In~a~replacement~text,~the~'\iow_char:N\\c'~escape~sequence~ + can~be~followed~by~one~of~the~letters~'ABCDELMOPSTU'~representing~ + the~character~category.~Then,~a~character~must~follow.~LaTeX~ + reached~the~end~of~the~replacement~when~looking~for~that. + } +\__msg_kernel_new:nnnn { regex } { replacement-catcode-in-cs } + { + Category~code~'\iow_char:N\\c#1#3'~ignored~inside~ + '\iow_char:N\\c\{...\}'~in~a~replacement~text. + } + { + In~a~replacement~text,~the~category~codes~of~the~argument~of~ + '\iow_char:N\\c\{...\}'~are~ignored~when~building~the~control~ + sequence~name. + } +\__msg_kernel_new:nnnn { regex } { replacement-null-space } + { TeX~cannot~build~a~space~token~with~character~code~0. } + { + You~asked~for~a~character~token~with~category~space,~ + and~character~code~0,~for~instance~through~ + '\iow_char:N\\cS\iow_char:N\\x00'.~ + This~specific~case~is~impossible~and~will~be~replaced~ + by~a~normal~space. + } +\__msg_kernel_new:nnnn { regex } { replacement-missing-rbrace } + { Missing~right~brace~inserted~in~replacement~text. } + { + There~ \int_compare:nTF { #1 = 1 } { was } { were } ~ #1~ + missing~right~\int_compare:nTF { #1 = 1 } { brace } { braces } . + } +\__msg_kernel_new:nnnn { regex } { replacement-missing-rparen } + { Missing~right~parenthesis~inserted~in~replacement~text. } + { + There~ \int_compare:nTF { #1 = 1 } { was } { were } ~ #1~ + missing~right~\int_compare:nTF { #1 = 1 } { parenthesis } { parentheses } . + } +\cs_new:Npn \__regex_msg_repeated:nnN #1#2#3 + { + \str_if_eq_x:nnF { #1 #2 } { 1 0 } + { + , ~ repeated ~ + \int_case:nnF {#2} + { + { -1 } { #1~or~more~times,~\bool_if:NTF #3 { lazy } { greedy } } + { 0 } { #1~times } + } + { + between~#1~and~\int_eval:n {#1+#2}~times,~ + \bool_if:NTF #3 { lazy } { greedy } + } + } + } %% File: l3box.dtx Copyright (C) 2005-2017 The LaTeX3 Project \cs_new_protected:Npn \box_new:N #1 { @@ -18069,37 +21658,6 @@ \__file_input:V \l__file_internal_name_tl } } -\cs_new:Npn \ior_map_break: - { \__prg_map_break:Nn \ior_map_break: { } } -\cs_new:Npn \ior_map_break:n - { \__prg_map_break:Nn \ior_map_break: } -\cs_new_protected:Npn \ior_map_inline:Nn - { \__ior_map_inline:NNn \ior_get:NN } -\cs_new_protected:Npn \ior_str_map_inline:Nn - { \__ior_map_inline:NNn \ior_str_get:NN } -\cs_new_protected:Npn \__ior_map_inline:NNn - { - \int_gincr:N \g__prg_map_int - \exp_args:Nc \__ior_map_inline:NNNn - { __prg_map_ \int_use:N \g__prg_map_int :n } - } -\cs_new_protected:Npn \__ior_map_inline:NNNn #1#2#3#4 - { - \cs_gset_protected:Npn #1 ##1 {#4} - \ior_if_eof:NF #3 { \__ior_map_inline_loop:NNN #1#2#3 } - \__prg_break_point:Nn \ior_map_break: - { \int_gdecr:N \g__prg_map_int } - } -\cs_new_protected:Npn \__ior_map_inline_loop:NNN #1#2#3 - { - #2 #3 \l__ior_internal_tl - \ior_if_eof:NF #3 - { - \exp_args:No #1 \l__ior_internal_tl - \__ior_map_inline_loop:NNN #1#2#3 - } - } -\tl_new:N \l__ior_internal_tl \cs_new_protected:Npn \ior_log_streams: { \__msg_log_next: \ior_list_streams: } \cs_new_protected:Npn \iow_log_streams: @@ -18305,6 +21863,83 @@ \cs_new:Npn \sys_rand_seed: { \tex_the:D \pdftex_randomseed:D } \cs_new_protected:Npn \sys_gset_rand_seed:n #1 { \pdftex_setrandomseed:D \__int_eval:w #1 \__int_eval_end: } +\int_const:Nn \c_sys_shell_escape_int + { + \sys_if_engine_luatex:TF + { + \luatex_directlua:D + { + tex.sprint((status.shell_escape~or~os.execute()) .. " ") + } + } + { + \pdftex_shellescape:D + } + } +\prg_new_conditional:Nnn \sys_if_shell: { p , T , F , TF } + { + \if_int_compare:w \c_sys_shell_escape_int = 0 ~ + \prg_return_false: + \else: + \prg_return_true: + \fi: + } +\prg_new_conditional:Nnn \sys_if_shell_unrestricted: { p , T , F , TF } + { + \if_int_compare:w \c_sys_shell_escape_int = 1 ~ + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\prg_new_conditional:Nnn \sys_if_shell_restricted: { p , T , F , TF } + { + \if_int_compare:w \c_sys_shell_escape_int = 2 ~ + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\sys_if_engine_luatex:F + { \int_const:Nn \c__sys_shell_stream_int { 18 } } +\sys_if_engine_luatex:TF + { + \cs_new_protected:Npn \sys_shell_now:n #1 + { + \luatex_directlua:D + { + os.execute(" + \luatex_luaescapestring:D { \etex_detokenize:D {#1} } + ") + } + } + } + { + \cs_new_protected:Npn \sys_shell_now:n #1 + { + \iow_now:Nn \c__sys_shell_stream_int { #1 } + } + } +\cs_generate_variant:Nn \sys_shell_now:n { x } +\sys_if_engine_luatex:TF + { + \cs_new_protected:Npn \sys_shell_shipout:n #1 + { + \luatex_latelua:D + { + os.execute(" + \luatex_luaescapestring:D { \etex_detokenize:D {#1} } + ") + } + } + } + { + \cs_new_protected:Npn \sys_shell_shipout:n #1 + { + \iow_shipout:Nn \c__sys_shell_stream_int { #1 } + } + } +\cs_generate_variant:Nn \sys_shell_shipout:n { x } \prg_new_conditional:Npnn \tl_if_single_token:n #1 { p , T , F , TF } { \tl_if_head_is_N_type:nTF {#1} @@ -19502,7 +23137,7 @@ } } \clist_map_inline:nn - { \lua_shipout_x :n , \lua_shipout:n } + { \lua_shipout_x:n , \lua_shipout:n } { \cs_set_protected:Npn #1 ##1 { diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex b/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex index 7ff0bc2bb26..2dfdc116f31 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: expl3.dtx Copyright (C) 1990-2017 The LaTeX3 Project -\def\ExplFileDate{2017/05/13}% +\def\ExplFileDate{2017/05/29}% \let\ExplLoaderFileDate\ExplFileDate \begingroup \def\tempa{LaTeX2e}% diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3.lua b/Master/texmf-dist/tex/latex/l3kernel/expl3.lua index 41a82db20ba..1da6f623d37 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3.lua +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.lua @@ -6,12 +6,17 @@ -- -- l3luatex.dtx (with options: `package,lua') -- --- EXPERIMENTAL CODE +-- Copyright (C) 1990-2017 The LaTeX3 Project -- --- Do not distribute this file without also distributing the --- source files specified above. +-- 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: -- --- Do not distribute a modified version of this file. +-- http://www.latex-project.org/lppl.txt +-- +-- This file is part of the "l3kernel bundle" (The Work in LPPL) +-- and all files in that bundle must be distributed together. -- -- File: l3luatex.dtx Copyright (C) 2010-2017 The LaTeX3 Project l3kernel = l3kernel or { } diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty index ffdcd396e0b..10791bf2dc1 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: expl3.dtx Copyright (C) 1990-2017 The LaTeX3 Project -\def\ExplFileDate{2017/05/13}% +\def\ExplFileDate{2017/05/29}% \let\ExplLoaderFileDate\ExplFileDate \ProvidesPackage{expl3} [% diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls index 87a276fbd8b..557e1346c97 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls +++ b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls @@ -20,7 +20,7 @@ %% %% File: l3doc.dtx Copyright (C) 1990-2017 The LaTeX3 project \RequirePackage{expl3,xparse,calc} -\ProvidesExplClass{l3doc}{2017/05/13}{} +\ProvidesExplClass{l3doc}{2017/05/29}{} {L3 Experimental documentation class} \clist_new:N \g_docinput_clist \seq_new:N \g_doc_functions_seq diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3dvipdfmx.def b/Master/texmf-dist/tex/latex/l3kernel/l3dvipdfmx.def index a2e1fb7ee87..7d8c5b96f9e 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3dvipdfmx.def +++ b/Master/texmf-dist/tex/latex/l3kernel/l3dvipdfmx.def @@ -68,21 +68,79 @@ \hbox_overlap_right:n { \box_use:N #1 } \__driver_scope_end: } -\tl_new:N \l__driver_current_color_tl -\tl_set:Nn \l__driver_current_color_tl { [ 0 ] } +\tl_new:N \l__driver_color_current_tl +\tl_set:Nn \l__driver_color_current_tl { [ 0 ] } \AtBeginDocument { \@ifpackageloaded { color } - { \tl_set:Nn \l__driver_current_color_tl { \current@color } } + { \tl_set:Nn \l__driver_color_current_tl { \current@color } } { } } \cs_new_protected:Npn \__driver_color_ensure_current: { - \tex_special:D { pdf:bcolor~\l__driver_current_color_tl } + \tex_special:D { pdf:bcolor~\l__driver_color_current_tl } \group_insert_after:N \__driver_color_reset: } \cs_new_protected:Npn \__driver_color_reset: { \tex_special:D { pdf:ecolor } } +\cs_new_eq:NN \__driver_image_getbb_eps:n \__image_read_bb:n +\cs_new_protected:Npn \__driver_image_getbb_jpg:n #1 + { + \int_zero:N \l__image_page_int + \__image_extract_bb:n {#1} + } +\cs_new_eq:NN \__driver_image_getbb_png:n \__driver_image_getbb_jpg:n +\cs_new_protected:Npn \__driver_image_getbb_pdf:n #1 + { + \bool_set_false:N \l__image_interpolate_tl + \__image_extract_bb:n {#1} + } +\int_new:N \g__driver_image_int +\cs_new_protected:Npn \__driver_image_include_eps:n #1 + { + \tex_special:D { PSfile = #1 } + } +\cs_new_protected:Npn \__driver_image_include_jpg:n #1 + { \__driver_image_include_auxi:nn {#1} { image } } +\cs_new_eq:NN \__driver_image_include_png:n \__driver_image_include_png:n +\cs_new_protected:Npn \__driver_image_include_pdf:n #1 + { \__driver_image_include_auxi:nn {#1} { epdf } } +\cs_new_protected:Npn \__driver_image_include_auxi:nn #1#2 + { + \__driver_image_include_auxii:xnn + { + \int_compare:nNnT \l__image_page_int > 0 + { :P \int_use:N \l__image_page_int } + \bool_if:NT \l__image_interpolate_bool + { :I } + } + {#1} {#2} + } +\cs_new_protected:Npn \__driver_image_include_auxii:nnn #1#2#3 + { + \int_if_exist:cTF { c__image_ #2#1 _int } + { + \tex_special:D + { pdf:usexobj~@image \int_use:c { c__image_ #2#1 _int } } + } + { \__driver_image_include_auxiii:nn {#2} {#1} {#3} } + } +\cs_generate_variant:Nn \__driver_image_include_auxii:nnn { x } +\cs_new_protected:Npn \__driver_image_include_auxiii:nnn #1#2#3 + { + \int_gincr:N \g__driver_image_int + \int_const:cn { c__image_ #1#2 _int } { \g__driver_image_int } + \tex_special:D + { + pdf:#3~ + @image \int_use:c { c__image_ #1#2 _int } + \int_compare:nNnT \l__image_page_int > 0 + { page ~ \int_use:N \l__image_page_int \c_space_tl } + (#1) + \bool_if:NT \l__image_interpolate_bool + { <</Interpolate~true>> } + } + } \cs_new_eq:NN \__driver_draw_literal:n \__driver_literal:n \cs_generate_variant:Nn \__driver_draw_literal:n { x } \cs_new_protected:Npn \__driver_draw_begin: diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3dvips.def b/Master/texmf-dist/tex/latex/l3kernel/l3dvips.def index c28613a5c00..07063fdcd2c 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3dvips.def +++ b/Master/texmf-dist/tex/latex/l3kernel/l3dvips.def @@ -88,21 +88,26 @@ \hbox_overlap_right:n { \box_use:N #1 } \__driver_scope_end: } -\tl_new:N \l__driver_current_color_tl -\tl_set:Nn \l__driver_current_color_tl { gray~0 } +\tl_new:N \l__driver_color_current_tl +\tl_set:Nn \l__driver_color_current_tl { gray~0 } \AtBeginDocument { \@ifpackageloaded { color } - { \tl_set:Nn \l__driver_current_color_tl { \current@color } } + { \tl_set:Nn \l__driver_color_current_tl { \current@color } } { } } \cs_new_protected:Npn \__driver_color_ensure_current: { - \tex_special:D { color~push~\l__driver_current_color_tl } + \tex_special:D { color~push~\l__driver_color_current_tl } \group_insert_after:N \__driver_color_reset: } \cs_new_protected:Npn \__driver_color_reset: { \tex_special:D { color~pop } } +\cs_new_eq:NN \__driver_image_getbb_eps:n \__image_read_bb:n +\cs_new_protected:Npn \__driver_image_include_eps:n #1 + { + \tex_special:D { PSfile = #1 } + } \cs_new_protected:Npn \__driver_draw_literal:n #1 { \tex_special:D { ps:: ~ #1 } } \cs_generate_variant:Nn \__driver_draw_literal:n { x } diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3dvisvgm.def b/Master/texmf-dist/tex/latex/l3kernel/l3dvisvgm.def index 2fdbc9d5dbd..4bae05e91df 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3dvisvgm.def +++ b/Master/texmf-dist/tex/latex/l3kernel/l3dvisvgm.def @@ -113,17 +113,17 @@ \hbox_overlap_right:n { \box_use:N #1 } \__driver_scope_end: } -\tl_new:N \l__driver_current_color_tl -\tl_set:Nn \l__driver_current_color_tl { gray~0 } +\tl_new:N \l__driver_color_current_tl +\tl_set:Nn \l__driver_color_current_tl { gray~0 } \AtBeginDocument { \@ifpackageloaded { color } - { \tl_set:Nn \l__driver_current_color_tl { \current@color } } + { \tl_set:Nn \l__driver_color_current_tl { \current@color } } { } } \cs_new_protected:Npn \__driver_color_ensure_current: { - \tex_special:D { color~push~\l__driver_current_color_tl } + \tex_special:D { color~push~\l__driver_color_current_tl } \group_insert_after:N \__driver_color_reset: } \cs_new_protected:Npn \__driver_color_reset: diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def b/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def index aa41c1f1c1b..a8db92d73d0 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def +++ b/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def @@ -101,12 +101,12 @@ \hbox_overlap_right:n { \box_use:N #1 } \__driver_scope_end: } -\tl_new:N \l__driver_current_color_tl -\tl_set:Nn \l__driver_current_color_tl { 0~g~0~G } +\tl_new:N \l__driver_color_current_tl +\tl_set:Nn \l__driver_color_current_tl { 0~g~0~G } \AtBeginDocument { \@ifpackageloaded { color } - { \tl_set:Nn \l__driver_current_color_tl { \current@color } } + { \tl_set:Nn \l__driver_color_current_tl { \current@color } } { } } \int_new:N \l__driver_color_stack_int @@ -116,7 +116,7 @@ { \luatex_pdfextension:D colorstack } { \pdftex_pdfcolorstack:D } \exp_not:N \l__driver_color_stack_int push - { \exp_not:N \l__driver_current_color_tl } + { \exp_not:N \l__driver_color_current_tl } \group_insert_after:N \exp_not:N \__driver_color_reset: } \cs_new_protected:Npx \__driver_color_reset: @@ -126,6 +126,65 @@ { \pdftex_pdfcolorstack:D } \exp_not:N \l__driver_color_stack_int pop \scan_stop: } +\tl_new:N \l__driver_image_attr_tl +\cs_new_protected:Npn \__driver_image_getbb_jpg:n #1 + { + \int_zero:N \l__image_page_int + \tl_set:Nx \l__driver_image_attr_tl + { + \bool_if:NT \l__image_interpolate_bool + { :I } + } + \__driver_image_getbb_auxi:n {#1} + } +\cs_new_eq:NN \__driver_image_getbb_png:n \__driver_image_getbb_jpg:n +\cs_new_protected:Npn \__driver_image_getbb_pdf:n #1 + { + \bool_set_false:N \l__image_interpolate_bool + \tl_set:Nx \l__driver_image_attr_tl + { + \int_compare:nNnT \l__image_page_int > 0 + { :P \int_use:N \l__image_page_int } + } + \__driver_image_getbb_auxi:n {#1} + } +\cs_new_protected:Npn \__driver_image_getbb_auxi:n #1 + { + \dim_if_exist:cTF { c__image_ #1 \l__driver_image_attr_tl _ht_dim } + { + \dim_set_eq:Nc \l__image_ht_dim + { c__image_ #1 \l__driver_image_attr_tl _ht_dim } + \dim_set_eq:Nc \l__image_wd_dim + { c__image_ #1 \l__driver_image_attr_tl _wd_dim } + } + { \__driver_image_getbb_auxii:n {#1} } + } +\cs_new_protected:Npn \__driver_image_getbb_auxii:n #1 + { + \tex_immediate:D \pdftex_pdfximage:D + \bool_if:NT \l__image_interpolate_bool + { attr ~ { /Interpolate~true } } + \int_compare:nNnT \l__image_page_int > 0 + { page ~ \int_use:N \l__image_page_int } + {#1} + \hbox_set:Nn \l__image_tmp_box + { \pdftex_pdfrefximage:D \pdftex_pdflastximage:D } + \dim_set:Nn \l__image_ht_dim { \box_ht:N \l__image_tmp_box } + \dim_set:Nn \l__image_wd_dim { \box_wd:N \l__image_tmp_box } + \int_const:cn { c__image_ #1 \l__driver_image_attr_tl _int } + { \tex_the:D \pdftex_pdflastximage:D } + \dim_const:cn { c__image_ #1 \l__driver_image_attr_tl _ht_dim } + { \l__image_ht_dim } + \dim_const:cn { c__image_ #1 \l__driver_image_attr_tl _wd_dim } + { \l__image_wd_dim } + } +\cs_new_protected:Npn \__driver_image_include_jpg:n #1 + { + \pdftex_pdfrefximage:D + \int_use:c { c__image_ #1 \l__driver_image_attr_tl _int } + } +\cs_new_eq:NN \__driver_image_include_pdf:n \__driver_image_include_jpg:n +\cs_new_eq:NN \__driver_image_include_png:n \__driver_image_include_jpg:n \cs_new_eq:NN \__driver_draw_literal:n \__driver_literal:n \cs_generate_variant:Nn \__driver_draw_literal:n { x } \cs_new_protected:Npn \__driver_draw_begin: diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3regex.sty b/Master/texmf-dist/tex/latex/l3kernel/l3regex.sty new file mode 100644 index 00000000000..df800bc4fa9 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3regex.sty @@ -0,0 +1,47 @@ +%% +%% This is file `l3regex.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3oldmodules.dtx (with options: `l3regex,oldmodules') +%% +%% Copyright (C) 1990-2017 The 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 "l3kernel bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project +\def\old@liii@module@name +{l3regex} +\ProvidesPackage\old@liii@module@name + [% + 2017/03/18 Obsolete L3 package + ] +\typeout{*****************************************************************} +\typeout{** } +\typeout{** Package \old@liii@module@name\space is obsolete and has been removed!} +\typeout{** } +\typeout{** Its functionality is now only provided as part of the expl3 package.} +\typeout{** } +\typeout{** The old packages will be removed entirely at the end of 2018.} +\typeout{** } +\typeout{** Therefore, please replace '\string\usepackage{\old@liii@module@name}'} +\typeout{** with '\string\usepackage{expl3}' in your documents as soon as possible.} +\typeout{** } +\typeout{*******************************************************************} +\PackageWarning + \old@liii@module@name{This package is obsolete --- + use 'expl3' instead} +\RequirePackage{expl3} + +%% +%% +%% End of file `l3regex.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3sort.sty b/Master/texmf-dist/tex/latex/l3kernel/l3sort.sty index 9c562ad9755..75856385e88 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3sort.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3sort.sty @@ -31,15 +31,20 @@ \typeout{** } \typeout{** Its functionality is now only provided as part of the expl3 package.} \typeout{** } +\typeout{** After showing you an error message you can hit <return> we will continue} +\typeout{** for now by loading expl3 for you. However, the old packages will be} +\typeout{** removed entirely at the end of 2017.} \typeout{** The old packages will be removed entirely at the end of 2018.} \typeout{** } \typeout{** Therefore, please replace '\string\usepackage{\old@liii@module@name}'} \typeout{** with '\string\usepackage{expl3}' in your documents as soon as possible.} \typeout{** } \typeout{*******************************************************************} +\PackageError \PackageWarning \old@liii@module@name{This package is obsolete --- use 'expl3' instead} + \@ehc \RequirePackage{expl3} %% diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3tl-analysis.sty b/Master/texmf-dist/tex/latex/l3kernel/l3tl-analysis.sty new file mode 100644 index 00000000000..519a191ec9f --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3tl-analysis.sty @@ -0,0 +1,52 @@ +%% +%% This is file `l3tl-analysis.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3oldmodules.dtx (with options: `l3tl-analysis,oldmodules') +%% +%% Copyright (C) 1990-2017 The 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 "l3kernel bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project +\def\old@liii@module@name +{l3tl-analysis} +\ProvidesPackage\old@liii@module@name + [% + 2017/03/18 Obsolete L3 package + ] +\typeout{*****************************************************************} +\typeout{** } +\typeout{** Package \old@liii@module@name\space is obsolete and has been removed!} +\typeout{** } +\typeout{** Its functionality is now only provided as part of the expl3 package.} +\typeout{** } +\typeout{** After showing you an error message you can hit <return> we will continue} +\typeout{** for now by loading expl3 for you. However, the old packages will be} +\typeout{** removed entirely at the end of 2017.} +\typeout{** The old packages will be removed entirely at the end of 2018.} +\typeout{** } +\typeout{** Therefore, please replace '\string\usepackage{\old@liii@module@name}'} +\typeout{** with '\string\usepackage{expl3}' in your documents as soon as possible.} +\typeout{** } +\typeout{*******************************************************************} +\PackageError +\PackageWarning + \old@liii@module@name{This package is obsolete --- + use 'expl3' instead} + \@ehc +\RequirePackage{expl3} + +%% +%% +%% End of file `l3tl-analysis.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def b/Master/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def index 80de21c81dd..4046489e12e 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def +++ b/Master/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def @@ -68,35 +68,125 @@ \hbox_overlap_right:n { \box_use:N #1 } \__driver_scope_end: } -\tl_new:N \l__driver_current_color_tl -\tl_set:Nn \l__driver_current_color_tl { [ 0 ] } +\tl_new:N \l__driver_color_current_tl +\tl_set:Nn \l__driver_color_current_tl { [ 0 ] } \AtBeginDocument { \@ifpackageloaded { color } - { \tl_set:Nn \l__driver_current_color_tl { \current@color } } + { \tl_set:Nn \l__driver_color_current_tl { \current@color } } { } } \cs_new_protected:Npn \__driver_color_ensure_current: { - \tex_special:D { pdf:bcolor~\l__driver_current_color_tl } + \tex_special:D { pdf:bcolor~\l__driver_color_current_tl } \group_insert_after:N \__driver_color_reset: } \cs_new_protected:Npn \__driver_color_reset: { \tex_special:D { pdf:ecolor } } +\cs_new_eq:NN \__driver_image_getbb_eps:n \__image_read_bb:n +\int_new:N \g__driver_image_int +\cs_new_protected:Npn \__driver_image_include_eps:n #1 + { + \tex_special:D { PSfile = #1 } + } +\cs_new_protected:Npn \__driver_image_include_jpg:n #1 + { \__driver_image_include_auxi:nn {#1} { image } } +\cs_new_eq:NN \__driver_image_include_png:n \__driver_image_include_png:n +\cs_new_protected:Npn \__driver_image_include_pdf:n #1 + { \__driver_image_include_auxi:nn {#1} { epdf } } +\cs_new_protected:Npn \__driver_image_include_auxi:nn #1#2 + { + \__driver_image_include_auxii:xnn + { + \int_compare:nNnT \l__image_page_int > 0 + { :P \int_use:N \l__image_page_int } + \bool_if:NT \l__image_interpolate_bool + { :I } + } + {#1} {#2} + } +\cs_new_protected:Npn \__driver_image_include_auxii:nnn #1#2#3 + { + \int_if_exist:cTF { c__image_ #2#1 _int } + { + \tex_special:D + { pdf:usexobj~@image \int_use:c { c__image_ #2#1 _int } } + } + { \__driver_image_include_auxiii:nn {#2} {#1} {#3} } + } +\cs_generate_variant:Nn \__driver_image_include_auxii:nnn { x } +\cs_new_protected:Npn \__driver_image_include_auxiii:nnn #1#2#3 + { + \int_gincr:N \g__driver_image_int + \int_const:cn { c__image_ #1#2 _int } { \g__driver_image_int } + \tex_special:D + { + pdf:#3~ + @image \int_use:c { c__image_ #1#2 _int } + \int_compare:nNnT \l__image_page_int > 0 + { page ~ \int_use:N \l__image_page_int \c_space_tl } + (#1) + \bool_if:NT \l__image_interpolate_bool + { <</Interpolate~true>> } + } + } \AtBeginDocument { \@ifpackageloaded { color } { - \cs_set_protected:Npn \__driver_color_ensure_current: + \cs_set_protected:Npn \__driver_tmp:w #1 [ #2 ] #3 \q_stop { - \tex_special:D { color~push~\l__driver_current_color_tl } - \group_insert_after:N \__driver_color_reset: + \tl_if_empty:nT {#2} + { + \cs_set_protected:Npn \__driver_color_ensure_current: + { + \tex_special:D { color~push~\l__driver_color_current_tl } + \group_insert_after:N \__driver_color_reset: + } + \cs_set_protected:Npn \__driver_color_reset: + { \tex_special:D { color~pop } } + } } - \cs_set_protected:Npn \__driver_color_reset: - { \tex_special:D { color~pop } } + \exp_after:wN \__driver_tmp:w \current@color [ ] \q_stop } { } } +\cs_new_protected:Npn \__driver_image_getbb_jpg:n #1 + { + \int_zero:N \l__image_page_int + \__driver_image_getbb_auxi:nN {#1} \xetex_picfile:D + } +\cs_new_eq:NN \__driver_image_getbb_png:n \__driver_image_getbb_jpg:n +\cs_new_protected:Npn \__driver_image_getbb_pdf:n #1 + { \__driver_image_getbb_auxi:nN {#1} \xetex_pdffile:D } +\cs_new_protected:Npn \__driver_image_getbb_auxi:nN #1#2 + { + \int_compare:nNnTF \l__image_page_int > 0 + { \__driver_image_getbb_auxii:VnN \l__image_page_int {#1} #2 } + { \__driver_image_getbb_auxiii:nNnn {#1} #2 } + } +\cs_new_protected:Npn \__driver_image_getbb_auxii:nnN #1#2#3 + { \__driver_image_getbb_auxiii:nNnn {#2} #3 { :P #1 } { page #1 } } +\cs_generate_variant:Nn \__driver_image_getbb_auxii:nnN { V } +\cs_new_protected:Npn \__driver_image_getbb_auxiii:nNnn #1#2#3#4 + { + \dim_if_exist:cTF { c__image_ #1#3 _ht_dim } + { + \dim_set_eq:Nc \l__image_ht_dim { c__image_ #1#3 _ht_dim } + \dim_set_eq:Nc \l__image_wd_dim { c__image_ #1#3 _wd_dim } + } + { \__driver_image_getbb_auxvi:nNnn {#1} #2 {#3} {#4} } + } +\cs_new_protected:Npn \__driver_image_getbb_auxvi:nNnn #1#2#3#4 + { + \hbox_set:Nn \l__image_tmp_box { #2 #1 ~ #4 } + \dim_set:Nn \l__image_ht_dim { \box_ht:N \l__image_tmp_box } + \dim_set:Nn \l__image_wd_dim { \box_wd:N \l__image_tmp_box } + \dim_const:cn { c__image_ #1#3 _ht_dim } + { \l__image_ht_dim } + \dim_const:cn { c__image_ #1#3 _wd_dim } + { \l__image_wd_dim } + } \cs_new_eq:NN \__driver_draw_literal:n \__driver_literal:n \cs_generate_variant:Nn \__driver_draw_literal:n { x } \cs_new_protected:Npn \__driver_draw_begin: diff --git a/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty b/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty index 6b8976fe27d..29ecea0a4ec 100644 --- a/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty +++ b/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty @@ -19,8 +19,8 @@ %% and all files in that bundle must be distributed together. %% %% File: l3keys2e.dtx (C) Copyright 2009,2011-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/05/13] -\@ifpackagelater{expl3}{2017/05/13} +\RequirePackage{expl3}[2017/05/29] +\@ifpackagelater{expl3}{2017/05/29} {} {% \PackageError{l3keys2e}{Support package l3kernel too old} @@ -32,7 +32,7 @@ }% \endinput } -\ProvidesExplPackage{l3keys2e}{2017/05/13}{} +\ProvidesExplPackage{l3keys2e}{2017/05/29}{} {LaTeX2e option processing using LaTeX3 keys} \cs_generate_variant:Nn \clist_put_right:Nn { Nv } \cs_generate_variant:Nn \keys_if_exist:nnT { nx } diff --git a/Master/texmf-dist/tex/latex/l3packages/xfp/xfp.sty b/Master/texmf-dist/tex/latex/l3packages/xfp/xfp.sty index 306c0b6ed95..1dcf5f17d85 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xfp/xfp.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xfp/xfp.sty @@ -19,8 +19,8 @@ %% and all files in that bundle must be distributed together. %% %% File: xfp.dtx (C) Copyright 2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/05/13] -\@ifpackagelater{expl3}{2017/05/13} +\RequirePackage{expl3}[2017/05/29] +\@ifpackagelater{expl3}{2017/05/29} {} {% \PackageError{xfpu}{Support package l3kernel too old} @@ -33,7 +33,7 @@ \endinput } \RequirePackage{xparse} -\ProvidesExplPackage{xfp}{2017/05/13}{} +\ProvidesExplPackage{xfp}{2017/05/29}{} {L3 Floating point unit} \NewExpandableDocumentCommand \fpeval { m } { \fp_eval:n {#1} } %% diff --git a/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty b/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty index db51d303b99..96892e13abe 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty @@ -20,8 +20,8 @@ %% %% File: xfrac.dtx Copyright (C) 2004, 2008-2010 Morten Hoegholm %% (C) 2011,2012,2014-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/05/13] -\@ifpackagelater{expl3}{2017/05/13} +\RequirePackage{expl3}[2017/05/29] +\@ifpackagelater{expl3}{2017/05/29} {} {% \PackageError{xfrac}{Support package l3kernel too old} @@ -34,7 +34,7 @@ \endinput } \RequirePackage{amstext,graphicx,l3keys2e,textcomp,xparse,xtemplate} -\ProvidesExplPackage{xfrac}{2017/05/13}{} +\ProvidesExplPackage{xfrac}{2017/05/29}{} {L3 Experimental split-level fractions} \keys_define:nn { xfrac } { diff --git a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty index 14e8e59eec0..0616a2d2023 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty @@ -23,8 +23,8 @@ %% (C) Copyright 2004-2008 Frank Mittelbach, %% The LaTeX3 Project %% (C) Copyright 2009-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/05/13] -\@ifpackagelater{expl3}{2017/05/13} +\RequirePackage{expl3}[2017/05/29] +\@ifpackagelater{expl3}{2017/05/29} {} {% \PackageError{xparse}{Support package l3kernel too old} @@ -36,7 +36,7 @@ }% \endinput } -\ProvidesExplPackage{xparse}{2017/05/13}{} +\ProvidesExplPackage{xparse}{2017/05/29}{} {L3 Experimental document command parser} \tl_const:Nx \c__xparse_no_value_tl { \char_generate:nn { `\- } { 11 } NoValue- } diff --git a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty index 91b6e775335..ee436a00226 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty @@ -23,8 +23,8 @@ %% (C) Copyright 2004-2010 Frank Mittelbach, %% The LaTeX3 Project %% (C) Copyright 2011-2016 The LaTeX3 Project -\RequirePackage{expl3}[2017/05/13] -\@ifpackagelater{expl3}{2017/05/13} +\RequirePackage{expl3}[2017/05/29] +\@ifpackagelater{expl3}{2017/05/29} {} {% \PackageError{xtemplate}{Support package l3kernel too old} @@ -36,7 +36,7 @@ }% \endinput } -\ProvidesExplPackage{xtemplate}{2017/05/13}{} +\ProvidesExplPackage{xtemplate}{2017/05/29}{} {L3 Experimental prototype document functions} \tl_const:Nn \c__xtemplate_code_root_tl { template~code~>~ } \tl_const:Nn \c__xtemplate_defaults_root_tl { template~defaults~>~ } |