summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-07-23 17:14:27 +0000
committerKarl Berry <karl@freefriends.org>2012-07-23 17:14:27 +0000
commitf7855c12c18bb97b7b9e49ab685ee558d8c0b47b (patch)
tree9196e768b98b68b7ea8eb5fbdf45508d766f4056 /Master
parentc47bc266846cc8bf776d79f1f54140443a8269a3 (diff)
l3 3990
git-svn-id: svn://tug.org/texlive/trunk@27107 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/l3experimental/l3dt/l3dt.pdfbin520804 -> 553024 bytes
-rw-r--r--Master/texmf-dist/doc/latex/l3experimental/l3sort/l3sort.pdfbin501434 -> 515490 bytes
-rw-r--r--Master/texmf-dist/doc/latex/l3experimental/l3str/l3flag.pdfbin402815 -> 389876 bytes
-rw-r--r--Master/texmf-dist/doc/latex/l3experimental/l3str/l3regex.pdfbin713306 -> 983117 bytes
-rw-r--r--Master/texmf-dist/doc/latex/l3experimental/l3str/l3str.pdfbin776235 -> 850079 bytes
-rw-r--r--Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-analysis.pdfbin507585 -> 519907 bytes
-rw-r--r--Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-build.pdfbin463230 -> 468383 bytes
-rw-r--r--Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdfbin481218 -> 487843 bytes
-rw-r--r--Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdfbin636687 -> 665514 bytes
-rw-r--r--Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdfbin566960 -> 577252 bytes
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.dtx528
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.ins2
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx378
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.ins2
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx58
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx3750
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx2031
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins2
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx580
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-build.dtx155
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx66
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.ins2
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx629
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx244
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.ins4
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/l3dt/l3dt.sty316
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/l3sort/l3sort.sty214
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty40
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty3010
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty2960
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/l3str/l3str.sty705
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty386
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty90
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/xcoffins/xcoffins.sty44
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty491
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty182
36 files changed, 8521 insertions, 8348 deletions
diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3dt/l3dt.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3dt/l3dt.pdf
index 5932347693b..ef1f6338685 100644
--- a/Master/texmf-dist/doc/latex/l3experimental/l3dt/l3dt.pdf
+++ b/Master/texmf-dist/doc/latex/l3experimental/l3dt/l3dt.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3sort/l3sort.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3sort/l3sort.pdf
index 9946455b071..643c77c2797 100644
--- a/Master/texmf-dist/doc/latex/l3experimental/l3sort/l3sort.pdf
+++ b/Master/texmf-dist/doc/latex/l3experimental/l3sort/l3sort.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3flag.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3flag.pdf
index 0c75fcf5818..6d452a1a251 100644
--- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3flag.pdf
+++ b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3flag.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3regex.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3regex.pdf
index 9a2d148fd37..bf1c08b47e9 100644
--- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3regex.pdf
+++ b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3regex.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str.pdf
index ea0a481396d..dedf6013d1f 100644
--- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str.pdf
+++ b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-analysis.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-analysis.pdf
index 4286212f17a..0f6639fb947 100644
--- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-analysis.pdf
+++ b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-analysis.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-build.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-build.pdf
index 1e9b60acacb..b5fe014e87e 100644
--- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-build.pdf
+++ b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-build.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf b/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf
index b8870804f7f..4c99ccfd767 100644
--- a/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf
+++ b/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf b/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf
index 459715894f1..821b441064c 100644
--- a/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf
+++ b/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf b/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf
index b9366016967..2489c2d4220 100644
--- a/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf
+++ b/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.dtx b/Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.dtx
index 0fd090d9ef7..be3fc8eb1c1 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.dtx
@@ -36,7 +36,7 @@
%
%<*driver|package>
\RequirePackage{expl3}
-\GetIdInfo$Id: l3dt.dtx 3459 2012-02-26 08:58:53Z joseph $
+\GetIdInfo$Id: l3dt.dtx 3877 2012-06-30 22:24:42Z joseph $
{L3 Experimental data tables}
%</driver|package>
%<*driver>
@@ -165,9 +165,9 @@
%
% \section{Removing data}
%
-% \begin{function}{\dt_del:Nn, \dt_gdel:Nn}
+% \begin{function}{\dt_remove:Nn, \dt_gremove:Nn}
% \begin{syntax}
-% \cs{dt_del:Nn} \meta{dt} \Arg{key}
+% \cs{dt_remove:Nn} \meta{dt} \Arg{key}
% \end{syntax}
% Deletes any entry from the current row of the \meta{data table} with
% the \meta{key}. The \meta{key} is compared after processing with
@@ -175,9 +175,9 @@
% all entries from a row does not delete the row itself.
% \end{function}
%
-% \begin{function}{\dt_del:Nnn, \dt_gdel:Nnn}
+% \begin{function}{\dt_remove:Nnn, \dt_gremove:Nnn}
% \begin{syntax}
-% \cs{dt_del:Nnn} \meta{dt} \Arg{row} \Arg{key}
+% \cs{dt_remove:Nnn} \meta{dt} \Arg{row} \Arg{key}
% \end{syntax}
% Deletes any entry from the \meta{row} of the \meta{data table} with
% the \meta{key}. The \meta{key} is compared after processing with
@@ -384,88 +384,6 @@
% Scratch data tables for general use: these are never used by the kernel.
% \end{variable}
%
-% \section{Internal function}
-%
-% \begin{variable}{\q_dt, \q_dt_header, \q_dt_row}
-% Quarks used to construct the data table format.
-% \end{variable}
-%
-% \begin{function}[EXP]{\dt_split_header:NT}
-% \begin{syntax}
-% \cs{dt_split_header:Nn} \meta{dt} \Arg{code}
-% \end{syntax}
-% Splits the \meta{data table} into the header part (containing the total
-% number of rows present and the key list) and the body (containing the
-% rows). The \meta{code} is then inserted, and should absorb the two parts
-% of the split table as arguments.
-% \end{function}
-%
-% \begin{function}{\dt_split_key:nnTF}
-% \begin{syntax}
-% \cs{dt_split_key:nnTF} \Arg{row} \Arg{key} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Searches the \meta{row} for the \meta{key}, using the
-% comparison method as described for \cs{str_if_eq:nn}. If the \meta{key} is
-% present, the \meta{true code} is left in the input stream followed by
-% three \meta{balanced text} arguments
-% \begin{enumerate}
-% \item the partial \meta{row} for all keys before the \meta{key},
-% \item the \meta{value} for the \meta{key} and
-% \item the partial \meta{row} for all keys after the \meta{key}.
-% \end{enumerate}
-% Thus the \meta{true code} must absorb three arguments.
-% The two partial tables are structured such they may be recombined directly
-% to produce a valid row lacking the entry for the \meta{key}.
-%
-% If the \meta{key} is not found in the \meta{row}, then the \meta{false code}
-% is left in the input stream with no arguments.
-% \end{function}
-%
-% \begin{function}{\dt_split_key_list:NnTF}
-% \begin{syntax}
-% \cs{dt_split_key_list:NnTF} \meta{dt} \Arg{key} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Searches the key list of the \meta{dt} for the \meta{key}, using the
-% comparison method as described for \cs{str_if_eq:nn}. If the \meta{key} is
-% present, the \meta{true code} is left in the input stream followed by
-% five \meta{balanced text} arguments
-% \begin{enumerate}
-% \item the partial table for all keys before the \meta{key},
-% \item the \meta{id} for the \meta{key},
-% \item the \meta{type} for the \meta{key},
-% \item the \meta{header} for the \meta{key} and
-% \item the partial table for all keys after the \meta{key}.
-% \end{enumerate}
-% Thus the \meta{true code} must absorb five arguments.
-% The two partial tables are structured such they may be recombined directly
-% to produce a valid key table lacking the entry for the \meta{key}.
-%
-% If the \meta{key} is not found in the key table, then the \meta{false code}
-% is left in the input stream with no arguments.
-% \end{function}
-%
-% \begin{function}{\dt_split_row:NnTF}
-% \begin{syntax}
-% \cs{dt_split_row:NnTF} \meta{dt} \Arg{row} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% Searches the key list of the \meta{dt} for the \meta{row}
-% (an \meta{integer expression}). If the
-% \meta{row} is present, the \meta{true code} is left in the input stream
-% followed by three \meta{balanced text} arguments
-% \begin{enumerate}
-% \item the partial table before the \meta{row},
-% \item the content of the \meta{row}, starting and ending with the
-% row number,
-% \item the partial table after the \meta{row}.
-% \end{enumerate}
-% Thus the \meta{true code} must absorb three arguments.
-% The two partial tables are structured such they may be recombined directly
-% to produce a valid key table lacking the entry for the \meta{row}.
-%
-% If the \meta{row} is not found in the key table, then the \meta{false code}
-% is left in the input stream with no arguments.
-% \end{function}
-%
% \end{documentation}
%
% \begin{implementation}
@@ -475,12 +393,15 @@
% \begin{macrocode}
%<*initex|package>
% \end{macrocode}
+%
+% \begin{macrocode}
+%<@@=dt>
+% \end{macrocode}
%
% \begin{macrocode}
%<*package>
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
-\package_check_loaded_expl:
%</package>
% \end{macrocode}
%
@@ -495,34 +416,34 @@
% numbered:
% \begin{quote}
% \Arg{rows} \\
-% \cs{q_dt} \meta{key$_0$} \cs{q_dt} \meta{key$_1$} \cs{q_dt} \ldots \\
+% \cs{q_@@} \meta{key$_0$} \cs{q_@@} \meta{key$_1$} \cs{q_@@} \ldots \\
% \cs{q_nil} \\
-% \cs{q_dt_header} \\
-% \cs{q_dt_row} \\
+% \cs{q_@@_header} \\
+% \cs{q_@@_row} \\
% \meta{row$_0$} \\
-% \cs{q_dt} \meta{key$_0$} \cs{q_dt} \Arg{data$_{0,0}$} \\
-% \cs{q_dt} \meta{key$_1$} \cs{q_dt} \Arg{data$_{0,1}$} \\
+% \cs{q_@@} \meta{key$_0$} \cs{q_@@} \Arg{data$_{0,0}$} \\
+% \cs{q_@@} \meta{key$_1$} \cs{q_@@} \Arg{data$_{0,1}$} \\
% \ldots \\
-% \cs{q_dt} \\
+% \cs{q_@@} \\
% \cs{q_nil} \\
-% \cs{q_dt_row} \\
+% \cs{q_@@_row} \\
% \meta{row$_2$} \\
-% \cs{q_dt} \meta{key$_0$} \cs{q_dt} \Arg{data$_{1,0}$} \\
-% \cs{q_dt} \meta{key$_1$} \cs{q_dt} \Arg{data$_{1,1}$} \\
+% \cs{q_@@} \meta{key$_0$} \cs{q_@@} \Arg{data$_{1,0}$} \\
+% \cs{q_@@} \meta{key$_1$} \cs{q_@@} \Arg{data$_{1,1}$} \\
% \ldots \\
-% \cs{q_dt} \\
+% \cs{q_@@} \\
% \cs{q_nil} \\
-% \cs{q_dt_row} \\
+% \cs{q_@@_row} \\
% \ldots \\
-% \cs{q_dt_row}
+% \cs{q_@@_row}
% \end{quote}
%
-% \begin{variable}{\q_dt, \q_dt_row, \q_dt_header}
+% \begin{variable}{\q_@@, \q_@@_row, \q_@@_header}
% The quarks are set up.
% \begin{macrocode}
-\quark_new:N \q_dt
-\quark_new:N \q_dt_row
-\quark_new:N \q_dt_header
+\quark_new:N \q_@@
+\quark_new:N \q_@@_row
+\quark_new:N \q_@@_header
% \end{macrocode}
% \end{variable}
%
@@ -533,10 +454,10 @@
\tl_const:Nn \c_empty_dt
{
{ 0 }
- \q_dt
+ \q_@@
\q_nil
- \q_dt_header
- \q_dt_row
+ \q_@@_header
+ \q_@@_row
}
% \end{macrocode}
% \end{variable}
@@ -590,104 +511,104 @@
%
% \subsection{Splitting functions}
%
-% \begin{macro}[aux]{\dt_split_aux:nnnn}
-% \begin{macro}[aux]{\dt_split_aux:w}
+% \begin{macro}[aux]{\@@_split:nnnn}
+% \begin{macro}[aux]{\@@_split:w}
% Two general auxiliaries. The \texttt{nnnn} function is used to apply the
% \texttt{T} branch if a match is found and the \texttt{F} branch otherwise.
% The \texttt{w} function is general purpose, and is used to define the
% matching parameter set.
% \begin{macrocode}
-\cs_new_protected:Npn \dt_split_aux:nnnn #1#2#3#4 { #3 #2 }
-\cs_new_protected:Npn \dt_split_aux:w { }
+\cs_new_protected:Npn \@@_split:nnnn #1#2#3#4 { #3 #2 }
+\cs_new_protected:Npn \@@_split:w { }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int,EXP]{\dt_split_header:NT}
-% \begin{macro}[aux,EXP]{\dt_split_header_aux:wn}
+% \begin{macro}[int,EXP]{\@@_split_header:NT}
+% \begin{macro}[aux,EXP]{\@@_split_header:wn}
% Splits the header from the table, inserting the code required to then
% process the split table. The \cs{q_nil} is also removed from the end of the
% header, as it is essentially a distraction here.
% \begin{macrocode}
-\cs_new:Npn \dt_split_header:NT #1#2
- { \exp_after:wN \dt_split_header_aux:wn #1 \q_stop {#2} }
-\cs_new:Npn \dt_split_header_aux:wn #1 \q_nil \q_dt_header #2 \q_stop #3
- { #3 {#1} { \q_dt_header #2 } }
+\cs_new:Npn \@@_split_header:NT #1#2
+ { \exp_after:wN \@@_split_header:wn #1 \q_stop {#2} }
+\cs_new:Npn \@@_split_header:wn #1 \q_nil \q_@@_header #2 \q_stop #3
+ { #3 {#1} { \q_@@_header #2 } }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\dt_split_key:nnTF}
-% \begin{macro}[aux]{\dt_split_key_aux:nnTF}
+% \begin{macro}[int]{\@@_split_key:nnTF}
+% \begin{macro}[aux]{\@@_split_key_aux:nnTF}
% Here, the split is made for a partial list within a row. The row is
% basically the same as a property list, so the split here is almost
% identical to that in \cs{prop_split_aux:NnTF}. The row-end data is set up
% such that it will not interfere with this process.
% \begin{macrocode}
-\cs_new_protected:Npn \dt_split_key:nnTF #1#2
- { \exp_args:No \dt_split_key_aux:nnTF { \tl_to_str:n {#2} } {#1} }
-\cs_new_protected:Npn \dt_split_key_aux:nnTF #1#2
+\cs_new_protected:Npn \@@_split_key:nnTF #1#2
+ { \exp_args:No \@@_split_key_aux:nnTF { \tl_to_str:n {#2} } {#1} }
+\cs_new_protected:Npn \@@_split_key_aux:nnTF #1#2
{
- \cs_set_protected:Npn \dt_split_aux:w
- ##1 \q_dt #1 \q_dt ##2##3##4 \q_mark ##5 \q_stop
- { \dt_split_aux:nnnn ##3 { { ##1 \q_dt } {##2} {##4} } }
- \dt_split_aux:w #2 \q_mark
- \q_dt #1 \q_dt { } { ? \use_ii:nn { } } \q_mark \q_stop
+ \cs_set_protected:Npn \@@_split:w
+ ##1 \q_@@ #1 \q_@@ ##2##3##4 \q_mark ##5 \q_stop
+ { \@@_split:nnnn ##3 { { ##1 \q_@@ } {##2} {##4} } }
+ \@@_split:w #2 \q_mark
+ \q_@@ #1 \q_@@ { } { ? \use_ii:nn { } } \q_mark \q_stop
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\dt_split_key_list:NnTF}
-% \begin{macro}[aux]{\dt_split_key_list_aux:NnTF}
+% \begin{macro}[int]{\@@_split_key_list:NnTF}
+% \begin{macro}[aux]{\@@_split_key_list_aux:NnTF}
% Finding a key in the header uses a similar approach to finding a key in
% a property list. Here, if the key is found there will always be at least
-% one token between \cs{q_dt} and \cs{q_dt_header} due to the \cs{q_nil}
-% which is part of a new table. The use of |##1##2| in \cs{dt_split_aux:w}
+% one token between \cs{q_@@} and \cs{q_@@_header} due to the \cs{q_nil}
+% which is part of a new table. The use of |##1##2| in \cs{@@_split:w}
% here is to deal with the overall number of rows. The set up here means
% that this will always be unbraced then rebraced: simply grabbing |##1|
% to include this and anything before the key of interest will give variable
% results depending on whether the match is to the very first key or not.
% \begin{macrocode}
-\cs_new_protected:Npn \dt_split_key_list:NnTF #1#2
- { \exp_args:NNo \dt_split_key_list_aux:NnTF #1 { \tl_to_str:n {#2} } }
-\cs_new_protected:Npn \dt_split_key_list_aux:NnTF #1#2
+\cs_new_protected:Npn \@@_split_key_list:NnTF #1#2
+ { \exp_args:NNo \@@_split_key_list_aux:NnTF #1 { \tl_to_str:n {#2} } }
+\cs_new_protected:Npn \@@_split_key_list_aux:NnTF #1#2
{
- \cs_set_protected:Npn \dt_split_aux:w
- ##1##2 \q_dt #2 \q_dt ##3##4 \q_dt_header ##5 \q_mark ##6 \q_stop
+ \cs_set_protected:Npn \@@_split:w
+ ##1##2 \q_@@ #2 \q_@@ ##3##4 \q_@@_header ##5 \q_mark ##6 \q_stop
{
- \dt_split_aux:nnnn ##3
- { { {##1} ##2 \q_dt } { ##3##4 \q_dt_header ##5 } }
+ \@@_split:nnnn ##3
+ { { {##1} ##2 \q_@@ } { ##3##4 \q_@@_header ##5 } }
}
- \exp_after:wN \dt_split_aux:w #1 \q_mark
- \q_dt #2 \q_dt { ? \use_ii:nn { } } \q_dt_header \q_mark \q_stop
+ \exp_after:wN \@@_split:w #1 \q_mark
+ \q_@@ #2 \q_@@ { ? \use_ii:nn { } } \q_@@_header \q_mark \q_stop
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\dt_split_row:NnTF}
-% \begin{macro}[aux]{\dt_split_row_aux:NnTF, \dt_split_row_aux:NfTF}
+% \begin{macro}[int]{\@@_split_row:NnTF}
+% \begin{macro}[aux]{\@@_split_row_aux:NnTF, \@@_split_row_aux:NfTF}
% The usual approach, here using the fact that each row start with row number
% and ends with \cs{q_nil} so there will always be at least one token to be
% absorbed as |##2|. The only odd thing to watch here is that the row
% number is evaluated so that higher-level functions in the main do not
% need to have an \texttt{f}-type variant.
% \begin{macrocode}
-\cs_new_protected:Npn \dt_split_row:NnTF #1#2
- { \dt_split_row_aux:NfTF #1 { \int_eval:n {#2} } }
-\cs_new_protected:Npn \dt_split_row_aux:NnTF #1#2
+\cs_new_protected:Npn \@@_split_row:NnTF #1#2
+ { \@@_split_row_aux:NfTF #1 { \int_eval:n {#2} } }
+\cs_new_protected:Npn \@@_split_row_aux:NnTF #1#2
{
- \cs_set_protected:Npn \dt_split_aux:w
- ##1 \q_dt_row #2 \q_dt ##2##3 \q_dt_row ##4 \q_mark ##5 \q_stop
+ \cs_set_protected:Npn \@@_split:w
+ ##1 \q_@@_row #2 \q_@@ ##2##3 \q_@@_row ##4 \q_mark ##5 \q_stop
{
- \dt_split_aux:nnnn ##2
- { { ##1 \q_dt_row } { #2 \q_dt ##2##3 } {##4} }
+ \@@_split:nnnn ##2
+ { { ##1 \q_@@_row } { #2 \q_@@ ##2##3 } {##4} }
}
- \exp_after:wN \dt_split_aux:w #1 \q_mark
- \q_dt_row #2 \q_dt { ? \use_ii:nn { } } \q_dt_row \q_mark \q_stop
+ \exp_after:wN \@@_split:w #1 \q_mark
+ \q_@@_row #2 \q_@@ { ? \use_ii:nn { } } \q_@@_row \q_mark \q_stop
}
-\cs_generate_variant:Nn \dt_split_row_aux:NnTF { Nf }
+\cs_generate_variant:Nn \@@_split_row_aux:NnTF { Nf }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -695,33 +616,33 @@
% \subsection{Adding and removing data}
%
% \begin{macro}{\dt_add_key:Nn, \dt_gadd_key:Nn}
-% \begin{macro}[aux]{\dt_add_key_aux:NNn}
-% \begin{macro}[aux]{\dt_add_key_aux:NNnnn}
+% \begin{macro}[aux]{\@@_add_key:NNn}
+% \begin{macro}[aux]{\@@_add_key:NNnnn}
% Here, there are two stages. If the key is already present in the list of
% known keys then no action is taken, and the split list is thrown away.
% On the other hand, if the key is not present then the header and body
% are separated and the key is added to the end of the list of known keys
-% (hence keys are ordered). The \cs{dt_split_header:Nn} function will have
+% (hence keys are ordered). The \cs{@@_split_header:Nn} function will have
% removed the \cs{q_nil} from the header, and so it is put back in here.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \dt_add_key:Nn { \dt_add_key_aux:NNn \tl_set:Nx }
-\cs_new_protected_nopar:Npn \dt_gadd_key:Nn { \dt_add_key_aux:NNn \tl_gset:Nx }
-\cs_new_protected:Npn \dt_add_key_aux:NNn #1#2#3
+\cs_new_protected_nopar:Npn \dt_add_key:Nn { \@@_add_key:NNn \tl_set:Nx }
+\cs_new_protected_nopar:Npn \dt_gadd_key:Nn { \@@_add_key:NNn \tl_gset:Nx }
+\cs_new_protected:Npn \@@_add_key:NNn #1#2#3
{
- \dt_split_key_list:NnTF #2 {#3}
+ \@@_split_key_list:NnTF #2 {#3}
{ \use_none:nn }
{
- \dt_split_header:NT #2
- { \dt_add_key_aux:NNnnn #1 #2 {#3} }
+ \@@_split_header:NT #2
+ { \@@_add_key:NNnnn #1 #2 {#3} }
}
}
-\cs_new_protected:Npn \dt_add_key_aux:NNnnn #1#2#3#4#5
+\cs_new_protected:Npn \@@_add_key:NNnnn #1#2#3#4#5
{
#1 #2
{
\exp_not:n {#4}
\tl_to_str:n {#3}
- \exp_not:n { \q_dt \q_nil #5 }
+ \exp_not:n { \q_@@ \q_nil #5 }
}
}
% \end{macrocode}
@@ -730,28 +651,28 @@
% \end{macro}
%
% \begin{macro}{\dt_add_row:N, \dt_gadd_row:N}
-% \begin{macro}[aux]{\dt_add_row_aux:NN}
-% \begin{macro}[aux]{\dt_add_row_aux:NnN}
-% \begin{macro}[aux,EXP]{\dt_add_row_aux:nw}
+% \begin{macro}[aux]{\@@_add_row:NN}
+% \begin{macro}[aux]{\@@_add_row:NnN}
+% \begin{macro}[aux,EXP]{\@@_add_row:nw}
% Adding a row means incrementing the total number and adding the structure
% of an empty row. As finding the rows will get slow for large tables, this
% is only done once.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \dt_add_row:N { \dt_add_row_aux:NN \tl_set:Nx }
-\cs_new_protected_nopar:Npn \dt_gadd_row:N { \dt_add_row_aux:NN \tl_gset:Nx }
-\cs_new_protected:Npn \dt_add_row_aux:NN #1#2
- { \exp_args:NNf \dt_add_row_aux:NnN #1 { \dt_rows:N #2 } #2 }
-\cs_new_protected:Npn \dt_add_row_aux:NnN #1#2#3
+\cs_new_protected_nopar:Npn \dt_add_row:N { \@@_add_row:NN \tl_set:Nx }
+\cs_new_protected_nopar:Npn \dt_gadd_row:N { \@@_add_row:NN \tl_gset:Nx }
+\cs_new_protected:Npn \@@_add_row:NN #1#2
+ { \exp_args:NNf \@@_add_row:NnN #1 { \dt_rows:N #2 } #2 }
+\cs_new_protected:Npn \@@_add_row:NnN #1#2#3
{
#1 #3
{
{ \int_eval:n { #2 + \c_one } }
- \exp_after:wN \dt_add_row_aux:nw #3 \q_stop
+ \exp_after:wN \@@_add_row:nw #3 \q_stop
#2
- \exp_not:n { \q_dt \q_nil \q_dt_row }
+ \exp_not:n { \q_@@ \q_nil \q_@@_row }
}
}
-\cs_new:Npn \dt_add_row_aux:nw #1#2 \q_stop { \exp_not:n {#2} }
+\cs_new:Npn \@@_add_row:nw #1#2 \q_stop { \exp_not:n {#2} }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -770,29 +691,29 @@
% \end{macro}
%
% \begin{macro}{\dt_put:Nnnn, \dt_gput:Nnnn}
-% \begin{macro}[aux]{\dt_put_aux:NNNnnn}
-% \begin{macro}[aux]{\dt_put_aux:NNnnnnn}
-% \begin{macro}[aux]{\dt_put_update:NNnnnnnnn}
-% \begin{macro}[aux]{\dt_put_add_to_row:NNnnnnn}
-% \begin{macro}[aux, EXP]{\dt_put_add_to_row_aux:w}
+% \begin{macro}[aux]{\@@_put:NNNnnn}
+% \begin{macro}[aux]{\@@_put:NNnnnnn}
+% \begin{macro}[aux]{\@@_put_update:NNnnnnnnn}
+% \begin{macro}[aux]{\@@_put_add_to_row:NNnnnnn}
+% \begin{macro}[aux, EXP]{\@@_put_add_to_row_aux:w}
% Adding to a row is a slightly complex procedure. The lead-off is the
% standard combination across the local and global routes.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \dt_put:Nnnn
- { \dt_put_aux:NNNnnn \dt_add_key:Nn \tl_set:Nx }
+ { \@@_put:NNNnnn \dt_add_key:Nn \tl_set:Nx }
\cs_new_protected_nopar:Npn \dt_gput:Nnnn
- { \dt_put_aux:NNNnnn \dt_gadd_key:Nn \tl_gset:Nx }
+ { \@@_put:NNNnnn \dt_gadd_key:Nn \tl_gset:Nx }
% \end{macrocode}
% Add the key to the list those known, if necessary, then check that the
% row requested makes sense.
% \begin{macrocode}
-\cs_new_protected:Npn \dt_put_aux:NNNnnn #1#2#3#4#5#6
+\cs_new_protected:Npn \@@_put:NNNnnn #1#2#3#4#5#6
{
#1 #3 {#5}
- \dt_split_row:NnTF #3 {#4}
- { \dt_put_aux:NNnnnnn #2 #3 {#5} {#6} }
+ \@@_split_row:NnTF #3 {#4}
+ { \@@_put:NNnnnnn #2 #3 {#5} {#6} }
{
- \msg_kernel_error:nnxxx { dt } { unknown-row }
+ \__msg_kernel_error:nnxxx { dt } { unknown-row }
{ \token_to_str:N #3 } { \int_eval:n {#4} } { \dt_rows:N #3 }
}
}
@@ -811,11 +732,11 @@
% stack if the key is already present. So there is some care needed sending
% the parameters forward without running out of \TeX{} arguments.
% \begin{macrocode}
-\cs_new_protected:Npn \dt_put_aux:NNnnnnn #1#2#3#4#5#6#7
+\cs_new_protected:Npn \@@_put:NNnnnnn #1#2#3#4#5#6#7
{
- \dt_split_key:nnTF {#6} {#3}
- { \dt_put_update:NNnnnnnnn #1 #2 {#3} {#4} {#5} {#7} }
- { \dt_put_add_to_row:NNnnnnn #1 #2 {#3} {#4} {#5} {#6} {#7} }
+ \@@_split_key:nnTF {#6} {#3}
+ { \@@_put_update:NNnnnnnnn #1 #2 {#3} {#4} {#5} {#7} }
+ { \@@_put_add_to_row:NNnnnnn #1 #2 {#3} {#4} {#5} {#6} {#7} }
}
% \end{macrocode}
% The arguments here are
@@ -834,32 +755,32 @@
% |#8| is needed. To try to keep things clear, there are a few more
% \cs{exp_not:n} here than formally required.
% \begin{macrocode}
-\cs_new_protected:Npn \dt_put_update:NNnnnnnnn #1#2#3#4#5#6#7#8#9
+\cs_new_protected:Npn \@@_put_update:NNnnnnnnn #1#2#3#4#5#6#7#8#9
{
#1 #2
{
\exp_not:n { #5 #7 }
\tl_to_str:n {#3}
- \exp_not:n { \q_dt {#4} \q_dt #9 \q_dt_row #6 }
+ \exp_not:n { \q_@@ {#4} \q_@@ #9 \q_@@_row #6 }
}
}
% \end{macrocode}
% A slightly more complex case when adding an item. The arguments here are
-% identical to those for \cs{dt_put_aux:NNnnnnnn}. The row has not been
+% identical to those for \cs{@@_put:NNnnnnnn}. The row has not been
% split, so the \cs{q_nil} there is removed and re-added to come after the
% new content.
% \begin{macrocode}
-\cs_new_protected:Npn \dt_put_add_to_row:NNnnnnn #1#2#3#4#5#6#7
+\cs_new_protected:Npn \@@_put_add_to_row:NNnnnnn #1#2#3#4#5#6#7
{
#1 #2
{
\exp_not:n {#5}
- \exp_not:o { \dt_put_add_row_aux:w #6 }
+ \exp_not:o { \@@_put_add_to_row_aux:w #6 }
\tl_to_str:n {#3}
- \exp_not:n { \q_dt {#4} \q_dt \q_nil \q_dt_row #7 }
+ \exp_not:n { \q_@@ {#4} \q_@@ \q_nil \q_@@_row #7 }
}
}
-\cs_new:Npn \dt_put_add_row_aux:w #1 \q_nil {#1}
+\cs_new:Npn \@@_put_add_to_row_aux:w #1 \q_nil {#1}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -869,31 +790,29 @@
% \end{macro}
%
% \begin{macro}[EXP]{\dt_keys:N}
-% \begin{macro}[aux, EXP]{\dt_keys_aux:nn}
-% \begin{macro}[aux, EXP]{\dt_keys_aux:wN}
+% \begin{macro}[aux, EXP]{\@@_keys:nn}
+% \begin{macro}[aux, EXP]{\@@_keys:wN}
% A quick mapping is needed to count keys. The \cs{use_none:nn} here
-% is used to remove the number of rows and initial \cs{q_dt}. This could
+% is used to remove the number of rows and initial \cs{q_@@}. This could
% also be handled by starting from $-1$ rather than $0$, but this makes
% the logic hopefully slightly clearer.
% \begin{macrocode}
\cs_new:Npn \dt_keys:N #1
- { \dt_split_header:NT #1 { \dt_keys_aux:nn } }
-\cs_new:Npn \dt_keys_aux:nn #1#2
+ { \@@_split_header:NT #1 { \@@_keys:nn } }
+\cs_new:Npn \@@_keys:nn #1#2
{
\int_eval:n
{
0
- \exp_after:wN \dt_keys_aux:wN \use_none:nn #1 \q_recursion_tail \q_dt
- \prg_break_point:n { }
+ \exp_after:wN \@@_keys:wN \use_none:nn #1 \q_recursion_tail \q_@@
+ \__prg_break_point:Nn \dt_map_break: { }
}
}
-\cs_new:Npn \dt_keys_aux:wN #1 \q_dt
+\cs_new:Npn \@@_keys:wN #1 \q_@@
{
- \if_meaning:w \q_recursion_tail #1
- \exp_after:wN \prg_map_break:
- \fi:
+ \__quark_if_recursion_tail_break:nN {#1} \dt_map_break:
+1
- \dt_keys_aux:wN
+ \@@_keys:wN
}
% \end{macrocode}
% \end{macro}
@@ -910,40 +829,40 @@
%
% \subsection{Removing data}
%
-% \begin{macro}{\dt_del:Nn,\dt_gdel:Nn}
+% \begin{macro}{\dt_remove:Nn,\dt_gremove:Nn}
% Deleting to the current row is simply a special case of deleting to an
% arbitrary row.
% \begin{macrocode}
-\cs_new_protected:Npn \dt_del:Nn #1 { \dt_del:Nnn #1
+\cs_new_protected:Npn \dt_remove:Nn #1 { \dt_remove:Nnn #1
{ \dt_rows:N #1 - \c_one } }
-\cs_new_protected:Npn \dt_gdel:Nn #1 { \dt_gdel:Nnn #1
+\cs_new_protected:Npn \dt_gremove:Nn #1 { \dt_gremove:Nnn #1
{ \dt_rows:N #1 - \c_one } }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\dt_del:Nnn, \dt_gdel:Nnn}
-% \begin{macro}[aux]{\dt_del_aux:NNnn}
-% \begin{macro}[aux]{\dt_del_aux:NNnnnn}
-% \begin{macro}[aux]{\dt_del_aux:NNnnnnn}
+% \begin{macro}{\dt_remove:Nnn, \dt_gremove:Nnn}
+% \begin{macro}[aux]{\dt_remove_aux:NNnn}
+% \begin{macro}[aux]{\dt_remove_aux:NNnnnn}
+% \begin{macro}[aux]{\dt_remove_aux:NNnnnnn}
% Deleting a single entry from a single row means first splitting by row,
% then splitting by key, and finally doing the assignment. If the row or the
% key are not present then the entire function does nothing at all.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \dt_del:Nnn { \dt_del_aux:NNnn \tl_set:Nn }
-\cs_new_protected_nopar:Npn \dt_gdel:Nnn { \dt_del_aux:NNnn \tl_gset:Nn }
-\cs_new_protected:Npn \dt_del_aux:NNnn #1#2#3#4
+\cs_new_protected_nopar:Npn \dt_remove:Nnn { \dt_remove_aux:NNnn \tl_set:Nn }
+\cs_new_protected_nopar:Npn \dt_gremove:Nnn { \dt_remove_aux:NNnn \tl_gset:Nn }
+\cs_new_protected:Npn \dt_remove_aux:NNnn #1#2#3#4
{
- \dt_split_row:NnTF #2 {#3}
- { \dt_del_aux:NNnnnn #1 #2 {#4} }
+ \@@_split_row:NnTF #2 {#3}
+ { \dt_remove_aux:NNnnnn #1 #2 {#4} }
{ }
}
-\cs_new_protected:Npn \dt_del_aux:NNnnnn #1#2#3#4#5#6
+\cs_new_protected:Npn \dt_remove_aux:NNnnnn #1#2#3#4#5#6
{
- \dt_split_key:nnTF {#5} {#3}
- { \dt_del_aux:NNnnnnn #1 #2 {#4} {#6} }
+ \@@_split_key:nnTF {#5} {#3}
+ { \dt_remove_aux:NNnnnnn #1 #2 {#4} {#6} }
{ }
}
-\cs_new_protected:Npn \dt_del_aux:NNnnnnn #1#2#3#4#5#6#7
+\cs_new_protected:Npn \dt_remove_aux:NNnnnnn #1#2#3#4#5#6#7
{ #1 #2 { #3 #5 #7 #4 } }
% \end{macrocode}
% \end{macro}
@@ -968,25 +887,23 @@
{ \dt_remove_key_aux:NNn \tl_gset:Nx }
\cs_new_protected:Npn \dt_remove_key_aux:NNn #1#2#3
{
- \dt_split_key_list:NnTF #2 {#3}
+ \@@_split_key_list:NnTF #2 {#3}
{ \exp_args:No \dt_remove_key_aux:nNNnn { \tl_to_str:n {#3} } #1 #2 }
{ }
}
\cs_new_protected:Npn \dt_remove_key_aux:nNNnn #1#2#3#4#5
{
- \cs_set:Npn \dt_remove_key_aux:w ##1 \q_dt #1 \q_dt ##2 ##3
+ \cs_set:Npn \dt_remove_key_aux:w ##1 \q_@@ #1 \q_@@ ##2 ##3
{
\exp_not:n {##1}
- \if_meaning:w \q_recursion_tail ##3
- \exp_after:wN \prg_map_break:
- \fi:
+ \__quark_if_recursion_tail_break:nN {##3} \dt_map_break:
\dt_remove_key_aux:w ##3
}
#2 #3
{
\exp_not:n {#4}
- \dt_remove_key_aux:w #5 \q_dt #1 \q_dt { } \q_recursion_tail
- \prg_break_point:n { }
+ \dt_remove_key_aux:w #5 \q_@@ #1 \q_@@ { } \q_recursion_tail
+ \__prg_break_point:Nn \dt_map_break: { }
}
}
\cs_new:Npn \dt_remove_key_aux:w { }
@@ -1011,7 +928,7 @@
{ \dt_remove_row_aux:NNn \tl_gset:Nx }
\cs_new_protected:Npn \dt_remove_row_aux:NNn #1#2#3
{
- \dt_split_row:NnTF #2 {#3}
+ \@@_split_row:NnTF #2 {#3}
{ \dt_remove_row_aux:NNnnn #1 #2 }
{ }
}
@@ -1028,18 +945,16 @@
{
{ \int_eval:n { \dt_rows:N #2 - \c_one } }
\dt_remove_row_aux:nw #3 \q_stop
- \dt_remove_row_loop:nw #5 \q_recursion_tail \q_dt_row
- \prg_break_point:n { }
+ \dt_remove_row_loop:nw #5 \q_recursion_tail \q_@@_row
+ \__prg_break_point:Nn \dt_map_break: { }
}
}
-\cs_new_eq:NN \dt_remove_row_aux:nw \dt_add_row_aux:nw
-\cs_new:Npn \dt_remove_row_loop:nw #1#2 \q_dt_row
+\cs_new_eq:NN \dt_remove_row_aux:nw \@@_add_row:nw
+\cs_new:Npn \dt_remove_row_loop:nw #1#2 \q_@@_row
{
- \if_meaning:w \q_recursion_tail #1
- \exp_after:wN \prg_map_break:
- \fi:
+ \__quark_if_recursion_tail_break:nN {#1} \dt_map_break:
\int_eval:n { #1 - \c_one }
- \exp_not:n { #2 \q_dt_row }
+ \exp_not:n { #2 \q_@@_row }
\dt_remove_row_loop:nw
}
% \end{macrocode}
@@ -1060,13 +975,13 @@
% \begin{macrocode}
\cs_new_protected:Npn \dt_get:NnnN #1#2#3#4
{
- \dt_split_row:NnTF #1 {#2}
+ \@@_split_row:NnTF #1 {#2}
{ \dt_get_aux:nNnnn {#3} #4 }
{ \tl_set:Nn #4 { \q_no_value } }
}
\cs_new_protected:Npn \dt_get_aux:nNnnn #1#2#3#4#5
{
- \dt_split_key:nnTF {#4} {#1}
+ \@@_split_key:nnTF {#4} {#1}
{ \dt_get_aux:Nnnn #2 }
{ \tl_set:Nn #2 { \q_no_value } }
}
@@ -1077,23 +992,23 @@
% \end{macro}
%
% \begin{macro}[TF]{\dt_get:NnnN}
-% \begin{macro}[aux]{\dt_get_aux_true:nNnnn}
-% \begin{macro}[aux]{\dt_get_aux_true:Nnnn}
+% \begin{macro}[aux]{\@@_get_true:nNnnn}
+% \begin{macro}[aux]{\@@_get_true:Nnnn}
% The same idea as the standard method, but built as a conditional.
% \begin{macrocode}
\prg_new_protected_conditional:Npnn \dt_get:NnnN #1#2#3#4 { T , F , TF }
{
- \dt_split_row:NnTF #1 {#2}
- { \dt_get_aux_true:nNnnn {#3} #4 }
+ \@@_split_row:NnTF #1 {#2}
+ { \@@_get_true:nNnnn {#3} #4 }
{ \prg_return_false: }
}
-\cs_new_protected:Npn \dt_get_aux_true:nNnnn #1#2#3#4#5
+\cs_new_protected:Npn \@@_get_true:nNnnn #1#2#3#4#5
{
- \dt_split_key:nnTF {#4} {#1}
- { \dt_get_aux_true:Nnnn #2 }
+ \@@_split_key:nnTF {#4} {#1}
+ { \@@_get_true:Nnnn #2 }
{ \prg_return_false: }
}
-\cs_new_protected:Npn \dt_get_aux_true:Nnnn #1#2#3#4
+\cs_new_protected:Npn \@@_get_true:Nnnn #1#2#3#4
{
\tl_set:Nn #1 {#3}
\prg_return_true:
@@ -1130,10 +1045,10 @@
% \end{variable}
%
% \begin{macro}{\dt_map_variables:Nnn}
-% \begin{macro}[aux]{\dt_map_variables_key:nn}
-% \begin{macro}[aux]{\dt_map_variables_aux:nnn}
-% \begin{macro}[aux]{\dt_map_variables_aux:nNNw}
-% \begin{macro}[aux]{\dt_map_variables_aux:nnw}
+% \begin{macro}[aux]{\@@_map_variables_key:nn}
+% \begin{macro}[aux]{\@@_map_variables:nnn}
+% \begin{macro}[aux]{\@@_map_variables:nNNw}
+% \begin{macro}[aux]{\@@_map_variables:nnw}
% Mapping across a data table is more complex than other cases as there
% are two \enquote{dimensions} to worry about: the rows and the keys.
% The first stage of the mapping is to convert the key--variable mapping
@@ -1145,38 +1060,37 @@
{
\int_gincr:N \g_dt_map_level_int
\seq_gclear_new:c { g_dt_map_ \int_use:N \g_dt_map_level_int _seq }
- \keyval_parse:NNn \use_none:n \dt_map_variables_key:nn {#2}
- \dt_split_header:NT #1 { \dt_map_variables_aux:nnn {#3} }
+ \keyval_parse:NNn \use_none:n \@@_map_variables_key:nn {#2}
+ \@@_split_header:NT #1 { \@@_map_variables:nnn {#3} }
}
-\cs_new_protected:Npn \dt_map_variables_key:nn #1#2
+\cs_new_protected:Npn \@@_map_variables_key:nn #1#2
{
\seq_gput_right:cn { g_dt_map_ \int_use:N \g_dt_map_level_int _seq }
{ {#1} #2 }
}
% \end{macrocode}
-% As \cs{dt_split_header:NT} will leave a couple of tokens at the front
+% As \cs{@@_split_header:NT} will leave a couple of tokens at the front
% of the body part of the split, there is a quick piece of tidying up
% to remove them.
% \begin{macrocode}
-\cs_new_protected:Npn \dt_map_variables_aux:nnn #1#2#3
- { \dt_map_variables_aux:nNNw {#1} #3 \q_stop }
-\cs_new_protected:Npn \dt_map_variables_aux:nNNw
- #1 \q_dt_header \q_dt_row #2 \q_stop
+\cs_new_protected:Npn \@@_map_variables:nnn #1#2#3
+ { \@@_map_variables:nNNw {#1} #3 \q_stop }
+\cs_new_protected:Npn \@@_map_variables:nNNw
+ #1 \q_@@_header \q_@@_row #2 \q_stop
{
\int_zero_new:c { l_dt_map_ \int_use:N \g_dt_map_level_int _row_int }
- \dt_map_variables_aux:nnw {#1} #2 { } \q_recursion_tail \q_dt_row
- \prg_break_point:n { \int_gdecr:N \g_dt_map_level_int }
+ \@@_map_variables:nnw {#1} #2 { } \q_recursion_tail \q_@@_row
+ \__prg_break_point:Nn \dt_map_break:
+ { \int_gdecr:N \g_dt_map_level_int }
}
-\cs_new_protected:Npn \dt_map_variables_aux:nnw #1#2#3#4 \q_dt_row
+\cs_new_protected:Npn \@@_map_variables:nnw #1#2#3#4 \q_@@_row
{
- \if_meaning:w \q_recursion_tail #3
- \exp_after:wN \dt_map_break:
- \fi:
+ \__quark_if_recursion_tail_break:nN {#3} \dt_map_break:
\seq_map_inline:cn { g_dt_map_ \int_use:N \g_dt_map_level_int _seq }
{ \dt_get_aux:nNnnn ##1 { } {#3#4} { } }
#1
\int_incr:c { l_dt_map_ \int_use:N \g_dt_map_level_int _row_int }
- \dt_map_variables_aux:nnw {#1}
+ \@@_map_variables:nnw {#1}
}
% \end{macrocode}
% \end{macro}
@@ -1187,10 +1101,12 @@
%
% \begin{macro}[rEXP]{\dt_map_break:}
% \begin{macro}[rEXP]{\dt_map_break:n}
-% The break statements are simply copies.
+% The break statements use the general \cs{__prg_map_break:Nn}.
% \begin{macrocode}
-\cs_new_eq:NN \dt_map_break: \prg_map_break:
-\cs_new_eq:NN \dt_map_break:n \prg_map_break:n
+\cs_new_nopar:Npn \dt_map_break:
+ { \__prg_map_break:Nn \dt_map_break: { } }
+\cs_new_nopar:Npn \dt_map_break:n
+ { \__prg_map_break:Nn \dt_map_break: }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1213,33 +1129,33 @@
% \end{macro}
%
% \begin{macro}[pTF, EXP]{\dt_if_in:Nn}
-% \begin{macro}[aux, EXP]{\dt_if_in_aux:nnn}
-% \begin{macro}[aux, EXP]{\dt_if_in_aux:nwN}
-% \begin{macro}[aux, EXP]{\dt_if_in_aux:n}
+% \begin{macro}[aux, EXP]{\@@_if_in:nnn}
+% \begin{macro}[aux, EXP]{\@@_if_in:nwN}
+% \begin{macro}[aux, EXP]{\@@_if_in:n}
% Expandably checking for the presence of a key in the table as a whole
% requires a mapping to the header. The idea is the usual recursion set
% up with a string-based comparison only after checking for the end of
% the loop.
% \begin{macrocode}
\prg_new_conditional:Npnn \dt_if_in:Nn #1#2 { p , T , F , TF }
- { \dt_split_header:NT #1 { \dt_if_in_aux:nnn {#2} } }
-\cs_new:Npn \dt_if_in_aux:nnn #1#2#3
+ { \@@_split_header:NT #1 { \@@_if_in:nnn {#2} } }
+\cs_new:Npn \@@_if_in:nnn #1#2#3
{
- \exp_last_unbraced:Nno \dt_if_in_aux:nwN {#1} { \use_none:nn #2 }
- \q_recursion_tail \q_dt
- \prg_break_point:n { }
+ \exp_last_unbraced:Nno \@@_if_in:nwN {#1} { \use_none:nn #2 }
+ \q_recursion_tail \q_@@
+ \__prg_break_point:
}
-\cs_new:Npn \dt_if_in_aux:nwN #1#2 \q_dt
+\cs_new:Npn \@@_if_in:nwN #1#2 \q_@@
{
\if_meaning:w \q_recursion_tail #2
- \exp_after:wN \prg_map_break:n
+ \exp_after:wN \__prg_break:n
\else:
\exp_after:wN \use_none:n
\fi:
{ \prg_return_false: }
\str_if_eq:nnTF {#1} {#2}
- { \prg_map_break:n { \prg_return_true: } }
- { \dt_if_in_aux:nwN {#1} }
+ { \__prg_break:n { \prg_return_true: } }
+ { \@@_if_in:nwN {#1} }
}
% \end{macrocode}
% \end{macro}
@@ -1248,22 +1164,22 @@
% \end{macro}
%
% \begin{macro}[pTF, EXP]{\dt_if_in_row:Nnn}
-% \begin{macro}[aux, EXP]{\dt_if_in_row_aux:nw}
-% \begin{macro}[aux, EXP]{\dt_if_in_row_aux:nn}
-% \begin{macro}[aux, EXP]{\dt_if_in_row_aux:nwn}
-% \begin{macro}[aux, EXP]{\dt_if_in_row_aux:N}
+% \begin{macro}[aux, EXP]{\@@_if_in_row:nw}
+% \begin{macro}[aux, EXP]{\@@_if_in_row:nn}
+% \begin{macro}[aux, EXP]{\@@_if_in_row:nwn}
+% \begin{macro}[aux, EXP]{\@@_if_in_row:N}
% Finding a key in a single row in an expandable way requires two mappings.
% To start of with, there is a search for the row. This uses for termination
-% the fact that each row starts \cs{q_dt_row} and ends \cs{q_nil}, and
+% the fact that each row starts \cs{q_@@_row} and ends \cs{q_nil}, and
% always contains at least the row number as the first \meta{balanced
% text}. That can be replaced by the tail marker to terminate iteration:
% all that is then needed is the correct placement of the clean-up code.
% \begin{macrocode}
\prg_new_conditional:Npnn \dt_if_in_row:Nnn #1#2#3 { p , T , F , TF }
{
- \exp_last_unbraced:Nno \dt_if_in_row_aux:nw {#2} #1
+ \exp_last_unbraced:Nno \@@_if_in_row:nw {#2} #1
\q_recursion_tail \q_nil
- \prg_break_point:n { }
+ \__prg_break_point:
{ \tl_to_str:n {#3} }
}
% \end{macrocode}
@@ -1271,10 +1187,10 @@
% been found. That means that the row argument does not need to be converted
% to a number earlier.
% \begin{macrocode}
-\cs_new:Npn \dt_if_in_row_aux:nw #1#2 \q_dt_row #3#4 \q_nil
+\cs_new:Npn \@@_if_in_row:nw #1#2 \q_@@_row #3#4 \q_nil
{
\if_meaning:w \q_recursion_tail #3
- \exp_after:wN \prg_map_break:n
+ \exp_after:wN \__prg_break:n
\else:
\exp_after:wN \use_none:n
\fi:
@@ -1283,32 +1199,32 @@
\prg_return_false:
}
\int_compare:nNnTF {#1} = {#3}
- { \prg_map_break:n { \exp_args:Nno \dt_if_in_row_aux:nn {#4} } }
- { \dt_if_in_row_aux:nw {#1} }
+ { \__prg_break:n { \exp_args:Nno \@@_if_in_row:nn {#4} } }
+ { \@@_if_in_row:nw {#1} }
}
% \end{macrocode}
% The second iteration is along the row. This is basically the same as
-% \cs{prop_if_in:NnTF} with the \cs{q_dt} in place of \cs{q_prop}.
+% \cs{prop_if_in:NnTF} with the \cs{q_@@} in place of \cs{q_prop}.
% \begin{macrocode}
-\cs_new:Npn \dt_if_in_row_aux:nn #1#2
+\cs_new:Npn \@@_if_in_row:nn #1#2
{
- \dt_if_in_row_aux:nwn {#2} #1 {#2} \q_dt { } \q_recursion_tail
- \prg_break_point:n { }
+ \@@_if_in_row:nwn {#2} #1 {#2} \q_@@ { } \q_recursion_tail
+ \__prg_break_point:
}
-\cs_new:Npn \dt_if_in_row_aux:nwn #1 \q_dt #2 \q_dt #3
+\cs_new:Npn \@@_if_in_row:nwn #1 \q_@@ #2 \q_@@ #3
{
\str_if_eq:xxTF {#1} {#2}
- { \dt_if_in_row_aux:N }
- { \dt_if_in_row_aux:nwn {#1} }
+ { \@@_if_in_row:N }
+ { \@@_if_in_row:nwn {#1} }
}
-\cs_new:Npn \dt_if_in_row_aux:N #1
+\cs_new:Npn \@@_if_in_row:N #1
{
- \if_meaning:w \q_dt #1
+ \if_meaning:w \q_@@ #1
\prg_return_true:
\else:
\prg_return_false:
\fi:
- \prg_map_break:
+ \__prg_break:
}
% \end{macrocode}
% \end{macro}
@@ -1334,7 +1250,7 @@
% \subsection{Messages}
%
% \begin{macrocode}
-\msg_kernel_new:nnnn { dt } { unknown-row }
+\__msg_kernel_new:nnnn { dt } { unknown-row }
{ Data~table~#1~does~not~contain~a~row~'#2'. }
{
Data~table~#1~contains~#3~rows.~These~must~be~accessed~by~number:~row~
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.ins b/Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.ins
index 5b84dfca3dc..54db0f43b92 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.ins
+++ b/Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.ins
@@ -16,7 +16,7 @@ The released version of this bundle is available from CTAN.
\fi
-\input docstrip.tex
+\input l3docstrip.tex
\askforoverwritefalse
\preamble
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx b/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx
index 0d80aebcc51..4d795c7c9f5 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx
@@ -36,7 +36,7 @@
%
%<*driver|package>
\RequirePackage{expl3}
-\GetIdInfo$Id: l3sort.dtx 3467 2012-02-26 15:39:35Z bruno $
+\GetIdInfo$Id: l3sort.dtx 3953 2012-07-11 16:15:09Z bruno $
{L3 Experimental sorting functions}
%</driver|package>
%<*driver>
@@ -71,7 +71,7 @@
%
% \section{\pkg{l3sort} documentation}
%
-% \LaTeX3 comes with a function to sort list variables (sequences,
+% \LaTeX3 comes with a facility to sort list variables (sequences,
% token lists, or comma-lists) according to some user-defined
% comparison. For instance,
% \begin{verbatim}
@@ -133,6 +133,18 @@
% \meta{clist var}.
% \end{function}
%
+% \begin{function}[EXP]{\tl_sort:nN}
+% \begin{syntax}
+% \cs{tl_sort:nN} \Arg{token list} \meta{conditional}
+% \end{syntax}
+% Sorts the items in the \meta{token list}, using the
+% \meta{conditional} to compare items, and leaves the result in the
+% input stream. The \meta{conditional} should have signature |:nnTF|,
+% and return \texttt{true} if the two items being compared should be
+% left in the same order, and \texttt{false} if the items should be
+% swapped.
+% \end{function}
+%
% \end{documentation}
%
% \begin{implementation}
@@ -144,16 +156,19 @@
% \end{macrocode}
%
% \begin{macrocode}
+%<@@=sort>
+% \end{macrocode}
+%
+% \begin{macrocode}
%<*package>
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
-\package_check_loaded_expl:
%</package>
% \end{macrocode}
%
% \subsection{Variables}
%
-% \begin{variable}{\c_sort_max_length_int}
+% \begin{variable}{\c_@@_max_length_int}
% The maximum length of a sequence which will not overflow
% the available registers depends on which engine is in use.
% For $2^{N}$ registers, it is $3\cdot 2^{N-2}$: for that number
@@ -164,63 +179,155 @@
% of size $2^{N-2}$, will fill up exactly the $2^{N-2}$ free
% registers, totalling $2^{N-1}+2^{N-2}+2^{N-2}=2^{N}$ registers.
% \begin{macrocode}
-\int_const:Nn \c_sort_max_length_int
+\int_const:Nn \c_@@_max_length_int
{ \luatex_if_engine:TF { 49152 } { 24576 } }
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_sort_length_int}
+% \begin{variable}{\l_@@_length_int}
% Length of the sequence which is being sorted.
% \begin{macrocode}
-\int_new:N \l_sort_length_int
+\int_new:N \l_@@_length_int
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_sort_block_int}
+% \begin{variable}{\l_@@_block_int}
% Merge sort is done in several passes. In each pass, blocks of size
-% \cs{l_sort_block_int} are merged in pairs. The block size starts
+% \cs{l_@@_block_int} are merged in pairs. The block size starts
% at $1$, and, for a length in the range $[2^k+1,2^{k+1}]$, reaches
% $2^{k}$ in the last pass.
% \begin{macrocode}
-\int_new:N \l_sort_block_int
+\int_new:N \l_@@_block_int
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_sort_begin_int}
-% \begin{variable}{\l_sort_end_int}
-% When merging two blocks, \cs{l_sort_begin_int} marks the lowest
-% index in the two blocks, and \cs{l_sort_end_int} marks the
+% \begin{variable}{\l_@@_begin_int}
+% \begin{variable}{\l_@@_end_int}
+% When merging two blocks, \cs{l_@@_begin_int} marks the lowest
+% index in the two blocks, and \cs{l_@@_end_int} marks the
% highest index, plus $1$.
% \begin{macrocode}
-\int_new:N \l_sort_begin_int
-\int_new:N \l_sort_end_int
+\int_new:N \l_@@_begin_int
+\int_new:N \l_@@_end_int
% \end{macrocode}
% \end{variable}
% \end{variable}
%
-% \begin{variable}{\l_sort_A_int}
-% \begin{variable}{\l_sort_B_int}
-% \begin{variable}{\l_sort_C_int}
+% \begin{variable}{\l_@@_A_int}
+% \begin{variable}{\l_@@_B_int}
+% \begin{variable}{\l_@@_C_int}
% When merging two blocks (whose end-points are \texttt{beg}
% and \texttt{end}), $A$ starts from the high end of the low
% block, and decreases until reaching \texttt{beg}. The index
% $B$ starts from the top of the range and marks the register
% in which a sorted item should be put. Finally, $C$ points
% to the copy of the high block in the interval of registers
-% starting at \cs{l_sort_length_int}, upwards. $C$ starts
+% starting at \cs{l_@@_length_int}, upwards. $C$ starts
% from the upper limit of that range.
% \begin{macrocode}
-\int_new:N \l_sort_A_int
-\int_new:N \l_sort_B_int
-\int_new:N \l_sort_C_int
+\int_new:N \l_@@_A_int
+\int_new:N \l_@@_B_int
+\int_new:N \l_@@_C_int
% \end{macrocode}
% \end{variable}
% \end{variable}
% \end{variable}
%
-% \subsection{User commands}
+% \subsection{Expandable sorting}
+%
+% Sorting expandably is very different from sorting and assigning to a
+% variable. Since tokens cannot be stored, they must remain in the
+% input stream, and be read through at every step. It is thus
+% necessarily much slower (at best $O(n^2)$) than non-expandable sorting
+% functions.
+%
+% A prototypical version of expandable quicksort is as follows. If the
+% argument has no item, return nothing, otherwise partition, using the
+% first item as a pivot (argument |#4| of |\__sort:nnNnn|). The
+% arguments of \cs{__sort:nnNnn} are 1.~items less than |#4|, 2.~items
+% greater than |#4|, 3.~comparison, 4.~pivot, 5.~next item to test. If
+% |#5| is the tail of the list, call \cs{tl_sort:nN} on |#1| and on
+% |#2|, placing |#4| in between; |\use:ff| expands the parts to make
+% \cs{tl_sort:nN} \texttt{f}-expandable. Otherwise, compare |#4| and
+% |#5| using |#3|. If they are ordered, place |#5| amongst the
+% \enquote{greater} items, otherwise amongst the \enquote{lesser} items,
+% and continue partitioning.
+% \begin{verbatim}
+% \cs_new:Npn \tl_sort:nN #1#2
+% {
+% \tl_if_blank:nF {#1}
+% {
+% \__sort:nnNnn { } { } #2
+% #1 \q_recursion_tail \q_recursion_stop
+% }
+% }
+% \cs_new:Npn \__sort:nnNnn #1#2#3#4#5
+% {
+% \quark_if_recursion_tail_stop_do:nn {#5}
+% { \use:ff { \tl_sort:nN {#1} #3 {#4} } { \tl_sort:nN {#2} #3 } }
+% #3 {#4} {#5}
+% { \__sort:nnNnn {#1} { #2 {#5} } #3 {#4} }
+% { \__sort:nnNnn { #1 {#5} } {#2} #3 {#4} }
+% }
+% \cs_generate_variant:Nn \use:nn { ff }
+% \end{verbatim}
+% There are quite a few optimizations available here: the code below is
+% less legible, but twice as fast.
+%
+% \begin{macro}[EXP]{\tl_sort:nN}
+% \begin{macro}[EXP, aux]
+% {
+% \@@_quick_i:nNn, \@@_quick_ii:wn,
+% \@@_quick_iii:nnNnn, \@@_quick_iv:nnNnwn
+% }
+% The \cs{@@_quick_i:nNn} function sorts |#1| using the comparison
+% |#2|, then places its third argument (\meta{continuation}) before
+% the result. This essentially avoids the rather slow \cs{use:ff}.
+% First test if |#1| is blank: if it is, \cs{use_none:n} eats the
+% break point, and \cs{@@_quick_ii:wn} removes all until the ending
+% break point, unbracing the \meta{continuation}. If it is not blank,
+% \cs{@@_quick_ii:wn} simply removes the end of that test until the
+% break point. The third auxiliary plays the role of |\__sort:nnNnn|
+% above, with an end-test replaced by \cs{__prg_break:}, which skips
+% to the break point two lines later, unless |#5| is itself a break
+% point. In that case, \cs{@@_quick_iv:nnNnwn} calls the first
+% auxiliary, which sorts |#2| and places another call to itself before
+% the result.
+% \begin{macrocode}
+\cs_new:Npn \tl_sort:nN #1#2 { \@@_quick_i:nNn {#1} #2 { } }
+\cs_new:Npn \@@_quick_i:nNn #1#2
+ {
+ \exp_after:wN \@@_quick_ii:wn
+ \use_none:n #1 \__prg_break_point:
+ \@@_quick_iii:nnNnn { } { } #2
+ #1
+ { \__prg_break_point: }
+ \__prg_break_point:
+ }
+\cs_new:Npn \@@_quick_ii:wn #1 \__prg_break_point: #2 {#2}
+\cs_new:Npn \@@_quick_iii:nnNnn #1#2#3#4#5
+ {
+ \__prg_break: #5
+ \@@_quick_iv:nnNnwn {#1} {#2}
+ \__prg_break_point:
+ #3 {#4} {#5}
+ { \@@_quick_iii:nnNnn {#1} { #2 {#5} } }
+ { \@@_quick_iii:nnNnn { #1 {#5} } {#2} }
+ #3 {#4}
+ }
+\cs_new:Npn \@@_quick_iv:nnNnwn
+ #1#2 \__prg_break_point: #3#4 #5 \__prg_break_point: #6
+ {
+ \@@_quick_i:nNn {#2} #3
+ { \@@_quick_i:nNn {#1} #3 {#6} {#4} }
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Protected user commands}
%
-% \begin{macro}[int]{\sort_aux:NNnNn}
+% \begin{macro}[int]{\@@_main:NNNnNn}
% Sorting happens in three steps. First store items
% in \tn{toks} registers ranging from $0$ to the length
% of the list, while checking that the list is not too
@@ -232,32 +339,32 @@
% into a variable of the right type, by \texttt{x}-expanding
% the code in |#3|, specific to each type of list.
% \begin{macrocode}
-\cs_new_protected:Npn \sort_aux:NNnNn #1#2#3#4#5
+\cs_new_protected:Npn \@@_main:NNNnNn #1#2#3#4#5#6
{
\group_begin:
- \l_sort_length_int \c_zero
- #2 #4
+ \l_@@_length_int \c_zero
+ #2 #5
{
- \if_num:w \l_sort_length_int = \c_sort_max_length_int
- \sort_too_long_error:Nw #4
+ \if_int_compare:w \l_@@_length_int = \c_@@_max_length_int
+ \@@_too_long_error:NNw #3 #5
\fi:
- \tex_toks:D \l_sort_length_int {##1}
- \tex_advance:D \l_sort_length_int \c_one
+ \tex_toks:D \l_@@_length_int {##1}
+ \tex_advance:D \l_@@_length_int \c_one
}
- \cs_set:Npn \sort_compare:nn ##1 ##2 { #5 }
- \l_sort_block_int \c_one
- \sort_level:
+ \cs_set:Npn \sort_compare:nn ##1 ##2 { #6 }
+ \l_@@_block_int \c_one
+ \@@_level:
\use:x
{
\group_end:
- #1 \exp_not:N #4 {#3}
+ #1 \exp_not:N #5 {#4}
}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\seq_sort:Nn, \seq_gsort:Nn}
-% The first argument to \cs{sort_aux:NNnNn} is the final
+% The first argument to \cs{@@_main:NNNnNn} is the final
% assignment function used, either \cs{tl_set:Nn} or
% \cs{tl_gset:Nn} to control local versus global results.
% The second argument is what mapping function is used
@@ -269,15 +376,15 @@
% \begin{macrocode}
\cs_new_protected_nopar:Npn \seq_sort:Nn
{
- \sort_aux:NNnNn \tl_set:Nn
- \seq_map_inline:Nn
- { \sort_toks:NNw \exp_not:N \seq_item:n 0 ; }
+ \@@_main:NNNnNn \tl_set:Nn
+ \seq_map_inline:Nn \seq_map_break:
+ { \@@_toks:NNw \exp_not:N \__seq_item:n 0 ; }
}
\cs_new_protected_nopar:Npn \seq_gsort:Nn
{
- \sort_aux:NNnNn \tl_gset:Nn
- \seq_map_inline:Nn
- { \sort_toks:NNw \exp_not:N \seq_item:n 0 ; }
+ \@@_main:NNNnNn \tl_gset:Nn
+ \seq_map_inline:Nn \seq_map_break:
+ { \@@_toks:NNw \exp_not:N \__seq_item:n 0 ; }
}
% \end{macrocode}
% \end{macro}
@@ -291,21 +398,21 @@
% \begin{macrocode}
\cs_new_protected_nopar:Npn \tl_sort:Nn
{
- \sort_aux:NNnNn \tl_set:Nn
- \tl_map_inline:Nn
- { \sort_toks:NNw \prg_do_nothing: \prg_do_nothing: 0 ; }
+ \@@_main:NNNnNn \tl_set:Nn
+ \tl_map_inline:Nn \tl_map_break:
+ { \@@_toks:NNw \prg_do_nothing: \prg_do_nothing: 0 ; }
}
\cs_new_protected_nopar:Npn \tl_gsort:Nn
{
- \sort_aux:NNnNn \tl_gset:Nn
- \tl_map_inline:Nn
- { \sort_toks:NNw \prg_do_nothing: \prg_do_nothing: 0 ; }
+ \@@_main:NNNnNn \tl_gset:Nn
+ \tl_map_inline:Nn \tl_map_break:
+ { \@@_toks:NNw \prg_do_nothing: \prg_do_nothing: 0 ; }
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\clist_sort:Nn, \clist_gsort:Nn}
-% \begin{macro}[aux]{\clist_sort_aux:NNn}
+% \begin{macro}[aux]{\@@_sort:NNn}
% The case of empty comma-lists is a little bit special as usual,
% and filtered out: there is nothing to sort in that case.
% Otherwise, the input is done with \cs{clist_map_inline:Nn},
@@ -313,24 +420,24 @@
% for sequences and token lists. The first comma must be removed.
% An item must be wrapped in an extra set of braces if it contains
% either the space or the comma characters. This is taken care of
-% by \cs{clist_wrap_item:n}, but \cs{sort_toks:NNw} would simply
+% by \cs{clist_wrap_item:n}, but \cs{@@_toks:NNw} would simply
% feed \cs{tex_the:D} \cs{tex_toks:D} \meta{number} as an
% argument to that function; hence we need to expand this argument
% once to unpack the register.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \clist_sort:Nn
- { \clist_sort_aux:NNn \tl_set:Nn }
+ { \@@_sort:NNn \tl_set:Nn }
\cs_new_protected_nopar:Npn \clist_gsort:Nn
- { \clist_sort_aux:NNn \tl_gset:Nn }
-\cs_new_protected:Npn \clist_sort_aux:NNn #1#2#3
+ { \@@_sort:NNn \tl_gset:Nn }
+\cs_new_protected:Npn \@@_sort:NNn #1#2#3
{
\clist_if_empty:NF #2
{
- \sort_aux:NNnNn #1
- \clist_map_inline:Nn
+ \@@_main:NNNnNn #1
+ \clist_map_inline:Nn \clist_map_break:
{
\exp_last_unbraced:Nf \use_none:n
- { \sort_toks:NNw \exp_args:No \clist_wrap_item:n 0 ; }
+ { \@@_toks:NNw \exp_args:No \__clist_wrap_item:n 0 ; }
}
#2 {#3}
}
@@ -339,13 +446,13 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\sort_toks:NNw}
+% \begin{macro}{\@@_toks:NNw}
% Unpack the various \tn{toks} registers, from $0$ to the length
% of the list. The functions |#1| and |#2| allow us to treat the
% three data structures in a unified way:
% \begin{itemize}
-% \item for sequences, they are \cs{exp_not:N} \cs{seq_item:n},
-% expanding to the \cs{seq_item:n} separator, as expected;
+% \item for sequences, they are \cs{exp_not:N} \cs{__seq_item:n},
+% expanding to the \cs{__seq_item:n} separator, as expected;
% \item for token lists, they expand to nothing;
% \item for comma lists, they expand to \cs{exp_args:No}
% \cs{clist_wrap_item:n}, taking care of unpacking the register
@@ -354,12 +461,12 @@
% braces.
% \end{itemize}
% \begin{macrocode}
-\cs_new:Npn \sort_toks:NNw #1#2#3 ;
+\cs_new:Npn \@@_toks:NNw #1#2#3 ;
{
- \if_num:w #3 < \l_sort_length_int
+ \if_int_compare:w #3 < \l_@@_length_int
#1 #2 { \tex_the:D \tex_toks:D #3 }
- \exp_after:wN \sort_toks:NNw \exp_after:wN #1 \exp_after:wN #2
- \int_use:N \int_eval:w #3 + \c_one \exp_after:wN ;
+ \exp_after:wN \@@_toks:NNw \exp_after:wN #1 \exp_after:wN #2
+ \int_use:N \__int_eval:w #3 + \c_one \exp_after:wN ;
\fi:
}
% \end{macrocode}
@@ -367,28 +474,28 @@
%
% \subsection{Sorting itself}
%
-% \begin{macro}[int]{\sort_level:}
-% This function is called once blocks of size \cs{l_sort_block_int}
+% \begin{macro}[int]{\@@_level:}
+% This function is called once blocks of size \cs{l_@@_block_int}
% (initially $1$) are each sorted. If the whole list fits in one
% block, then we are done (this also takes care of the case of an
% empty list or a list with one item). Otherwise, go through pairs
% of blocks starting from $0$, then double the block size, and repeat.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \sort_level:
+\cs_new_protected_nopar:Npn \@@_level:
{
- \if_num:w \l_sort_block_int < \l_sort_length_int
- \l_sort_end_int \c_zero
- \sort_merge_blocks:
- \tex_multiply:D \l_sort_block_int \c_two
- \exp_after:wN \sort_level:
+ \if_int_compare:w \l_@@_block_int < \l_@@_length_int
+ \l_@@_end_int \c_zero
+ \@@_merge_blocks:
+ \tex_multiply:D \l_@@_block_int \c_two
+ \exp_after:wN \@@_level:
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\sort_merge_blocks:}
+% \begin{macro}[int]{\@@_merge_blocks:}
% This function is called to merge a pair of blocks, starting at
-% the last value of \cs{l_sort_end_int} (end-point of the previous
+% the last value of \cs{l_@@_end_int} (end-point of the previous
% pair of blocks). If shifting by one block to the right we reach
% the end of the list, then this pass has ended: this end of the
% list is sorted already. Store the result of that shift in $A$,
@@ -398,30 +505,30 @@
% go beyond the length of the list. Copy this upper block of \tn{toks}
% registers in registers above \texttt{length}, indexed by $C$:
% this is covered by \cs{sort_copy_block:}. Once this is done we
-% are ready to do the actual merger using \cs{sort_merge_blocks_aux:},
+% are ready to do the actual merger using \cs{@@_merge_blocks_aux:},
% after shifting $A$, $B$ and $C$ so that they point to the largest
% index in their respective ranges rather than pointing just beyond
% those ranges. Of course, once that pair of blocks is merged,
% move on to the next pair.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \sort_merge_blocks:
+\cs_new_protected_nopar:Npn \@@_merge_blocks:
{
- \l_sort_begin_int \l_sort_end_int
- \tex_advance:D \l_sort_end_int \l_sort_block_int
- \if_num:w \int_eval:w \l_sort_end_int < \l_sort_length_int
- \l_sort_A_int \l_sort_end_int
- \tex_advance:D \l_sort_end_int \l_sort_block_int
- \if_num:w \l_sort_end_int > \l_sort_length_int
- \l_sort_end_int \l_sort_length_int
+ \l_@@_begin_int \l_@@_end_int
+ \tex_advance:D \l_@@_end_int \l_@@_block_int
+ \if_int_compare:w \__int_eval:w \l_@@_end_int < \l_@@_length_int
+ \l_@@_A_int \l_@@_end_int
+ \tex_advance:D \l_@@_end_int \l_@@_block_int
+ \if_int_compare:w \l_@@_end_int > \l_@@_length_int
+ \l_@@_end_int \l_@@_length_int
\fi:
- \l_sort_B_int \l_sort_A_int
- \l_sort_C_int \l_sort_length_int
+ \l_@@_B_int \l_@@_A_int
+ \l_@@_C_int \l_@@_length_int
\sort_copy_block:
- \tex_advance:D \l_sort_A_int \c_minus_one
- \tex_advance:D \l_sort_B_int \c_minus_one
- \tex_advance:D \l_sort_C_int \c_minus_one
- \sort_merge_blocks_aux:
- \exp_after:wN \sort_merge_blocks:
+ \tex_advance:D \l_@@_A_int \c_minus_one
+ \tex_advance:D \l_@@_B_int \c_minus_one
+ \tex_advance:D \l_@@_C_int \c_minus_one
+ \@@_merge_blocks_aux:
+ \exp_after:wN \@@_merge_blocks:
\fi:
}
% \end{macrocode}
@@ -430,16 +537,16 @@
% \begin{macro}[int]{\sort_copy_block:}
% We wish to store a copy of the \enquote{upper} block of
% \tn{toks} registers, ranging between the initial value of
-% \cs{l_sort_B_int} (included) and \cs{l_sort_end_int}
+% \cs{l_@@_B_int} (included) and \cs{l_@@_end_int}
% (excluded) into a new range starting at the initial value
-% of \cs{l_sort_C_int}, namely \cs{l_sort_length_int}.
+% of \cs{l_@@_C_int}, namely \cs{l_@@_length_int}.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \sort_copy_block:
{
- \tex_toks:D \l_sort_C_int \tex_toks:D \l_sort_B_int
- \tex_advance:D \l_sort_C_int \c_one
- \tex_advance:D \l_sort_B_int \c_one
- \if_num:w \l_sort_B_int = \l_sort_end_int
+ \tex_toks:D \l_@@_C_int \tex_toks:D \l_@@_B_int
+ \tex_advance:D \l_@@_C_int \c_one
+ \tex_advance:D \l_@@_B_int \c_one
+ \if_int_compare:w \l_@@_B_int = \l_@@_end_int
\use_i:nn
\fi:
\sort_copy_block:
@@ -447,13 +554,13 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\sort_merge_blocks_aux:}
-% At this stage, the first block starts at \cs{l_sort_begin_int},
-% and ends at \cs{l_sort_A_int}, and the second block starts at
-% \cs{l_sort_length_int} and ends at \cs{l_sort_C_int}. The result
-% of the merger is stored at positions indexed by \cs{l_sort_B_int},
-% which starts at $\cs{l_sort_end_int}-1$ and decreases down to
-% \cs{l_sort_begin_int}, covering the full range of the two blocks.
+% \begin{macro}[aux]{\@@_merge_blocks_aux:}
+% At this stage, the first block starts at \cs{l_@@_begin_int},
+% and ends at \cs{l_@@_A_int}, and the second block starts at
+% \cs{l_@@_length_int} and ends at \cs{l_@@_C_int}. The result
+% of the merger is stored at positions indexed by \cs{l_@@_B_int},
+% which starts at $\cs{l_@@_end_int}-1$ and decreases down to
+% \cs{l_@@_begin_int}, covering the full range of the two blocks.
% In other words, we are building the merger starting with the
% largest values.
% The comparison function is defined to return either
@@ -461,11 +568,11 @@
% means the arguments need to be given in the order they
% appear originally in the list.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \sort_merge_blocks_aux:
+\cs_new_protected_nopar:Npn \@@_merge_blocks_aux:
{
\exp_after:wN \sort_compare:nn \exp_after:wN
- { \tex_the:D \tex_toks:D \exp_after:wN \l_sort_A_int \exp_after:wN }
- \exp_after:wN { \tex_the:D \tex_toks:D \l_sort_C_int }
+ { \tex_the:D \tex_toks:D \exp_after:wN \l_@@_A_int \exp_after:wN }
+ \exp_after:wN { \tex_the:D \tex_toks:D \l_@@_C_int }
}
% \end{macrocode}
% \end{macro}
@@ -484,13 +591,13 @@
% \begin{macrocode}
\cs_new_protected_nopar:Npn \sort_ordered:
{
- \tex_toks:D \l_sort_B_int \tex_toks:D \l_sort_C_int
- \tex_advance:D \l_sort_B_int \c_minus_one
- \tex_advance:D \l_sort_C_int \c_minus_one
- \if_num:w \l_sort_C_int < \l_sort_length_int
+ \tex_toks:D \l_@@_B_int \tex_toks:D \l_@@_C_int
+ \tex_advance:D \l_@@_B_int \c_minus_one
+ \tex_advance:D \l_@@_C_int \c_minus_one
+ \if_int_compare:w \l_@@_C_int < \l_@@_length_int
\use_i:nn
\fi:
- \sort_merge_blocks_aux:
+ \@@_merge_blocks_aux:
}
% \end{macrocode}
% \end{macro}
@@ -504,60 +611,59 @@
% block was exhausted ($A$ goes below the threshold).
% In that case, all remaining \tn{toks} registers in
% the second block, indexed by $C$, should be copied
-% to the merger (see \cs{sort_merge_blocks_end:}).
+% to the merger (see \cs{@@_merge_blocks_end:}).
% \begin{macrocode}
\cs_new_protected_nopar:Npn \sort_reversed:
{
- \tex_toks:D \l_sort_B_int \tex_toks:D \l_sort_A_int
- \tex_advance:D \l_sort_B_int \c_minus_one
- \tex_advance:D \l_sort_A_int \c_minus_one
- \if_num:w \l_sort_A_int < \l_sort_begin_int
- \sort_merge_blocks_end: \use_i:nn
+ \tex_toks:D \l_@@_B_int \tex_toks:D \l_@@_A_int
+ \tex_advance:D \l_@@_B_int \c_minus_one
+ \tex_advance:D \l_@@_A_int \c_minus_one
+ \if_int_compare:w \l_@@_A_int < \l_@@_begin_int
+ \@@_merge_blocks_end: \use_i:nn
\fi:
- \sort_merge_blocks_aux:
+ \@@_merge_blocks_aux:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\sort_merge_blocks_end:}
+% \begin{macro}[aux]{\@@_merge_blocks_end:}
% This function's task is to copy the \tn{toks} registers
% in the block indexed by $C$ to the merger indexed by $B$.
% The end can equally be detected by checking when $B$ reaches
% the threshold \texttt{begin}, or when $C$ reaches
% \texttt{length}.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \sort_merge_blocks_end:
+\cs_new_protected_nopar:Npn \@@_merge_blocks_end:
{
- \tex_toks:D \l_sort_B_int \tex_toks:D \l_sort_C_int
- \tex_advance:D \l_sort_B_int \c_minus_one
- \tex_advance:D \l_sort_C_int \c_minus_one
- \if_num:w \l_sort_B_int < \l_sort_begin_int
+ \tex_toks:D \l_@@_B_int \tex_toks:D \l_@@_C_int
+ \tex_advance:D \l_@@_B_int \c_minus_one
+ \tex_advance:D \l_@@_C_int \c_minus_one
+ \if_int_compare:w \l_@@_B_int < \l_@@_begin_int
\use_i:nn
\fi:
- \sort_merge_blocks_end:
+ \@@_merge_blocks_end:
}
% \end{macrocode}
% \end{macro}
%
% \subsection{Messages}
%
-% \begin{macro}{\sort_too_long_error:Nw}
-% When there are too many items in a sequence, this is an error,
-% and we clean up properly the mapping over items in the list.
-% This relies on the fact that the breaking code for all mappings
-% is unified.
+% \begin{macro}{\@@_too_long_error:NNw}
+% When there are too many items in a sequence, this is an error, and
+% we clean up properly the mapping over items in the list: break using
+% the type-specific breaking function |#1|.
% \begin{macrocode}
-\cs_new_protected:Npn \sort_too_long_error:Nw #1 \fi:
+\cs_new_protected:Npn \@@_too_long_error:NNw #1#2 \fi:
{
\fi:
- \msg_kernel_error:nnx { sort } { too-large } { \token_to_str:N #1 }
- \prg_map_break:
+ \__msg_kernel_error:nnx { sort } { too-large } { \token_to_str:N #2 }
+ #1
}
-\msg_kernel_new:nnnn { sort } { too-large }
+\__msg_kernel_new:nnnn { sort } { too-large }
{ The~list~#1~is~too~long~to~be~sorted~by~TeX. }
{
- TeX~has~\int_use:N \c_max_register_int \ registers~available:~
- this~only~allows~to~sorts~with~up~to~\int_use:N \c_sort_max_length_int
+ TeX~has~\int_eval:n { \c_max_register_int + 1 }~registers~available:~
+ this~only~allows~to~sorts~with~up~to~\int_use:N \c_@@_max_length_int
\ items.~All~extra~items~will~be~ignored.
}
% \end{macrocode}
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.ins b/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.ins
index 0cc04d132fe..db6f7f2b5d0 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.ins
+++ b/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.ins
@@ -16,7 +16,7 @@ The released version of this bundle is available from CTAN.
\fi
-\input docstrip.tex
+\input l3docstrip.tex
\askforoverwritefalse
\preamble
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx
index 717065d7d27..d3b17183671 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx
@@ -36,7 +36,7 @@
%<*driver|package>
\RequirePackage{expl3}
\GetIdInfo$Id: l3flag.dtx 3039 2011-12-08 09:22:35Z bruno $
- {L3 Experimental Flags}
+ {L3 Experimental flags}
%</driver|package>
%<*driver>
\documentclass[full]{l3doc}
@@ -175,6 +175,10 @@
% \end{macrocode}
%
% \begin{macrocode}
+%<@@=flag>
+% \end{macrocode}
+%
+% \begin{macrocode}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
% \end{macrocode}
@@ -187,28 +191,28 @@
% \begin{macrocode}
\cs_new_protected:Npn \flag_new:n #1
{
- \cs_new:cpn { flag_trap_#1:w } ##1 ;
- { \exp_after:wN \use_none:n \cs:w l_#1_##1_flag \cs_end: }
+ \cs_new:cpn { @@_trap_#1:w } ##1 ;
+ { \exp_after:wN \use_none:n \cs:w @@_#1_##1: \cs_end: }
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\flag_clear:n}
-% \begin{macro}[aux]{\flag_clear_aux:ww}
+% \begin{macro}[aux]{\@@_clear:ww}
% Undefine control sequences, starting from the |_0| flag, upwards,
% until reaching an undefined control sequence.
% \begin{macrocode}
\cs_new_protected:Npn \flag_clear:n #1
- { \flag_clear_aux:ww 0 ; #1 \q_stop }
-\cs_new_protected:Npn \flag_clear_aux:ww #1 ; #2 \q_stop
+ { \@@_clear:ww 0 ; #1 \q_stop }
+\cs_new_protected:Npn \@@_clear:ww #1 ; #2 \q_stop
{
- \if_cs_exist:w l_#2_#1_flag \cs_end:
+ \if_cs_exist:w @@_#2_#1: \cs_end:
\else:
\exp_after:wN \use_none_delimit_by_q_stop:w
\fi:
- \cs_set_eq:cN { l_#2_#1_flag } \c_undefined:D
- \exp_after:wN \flag_clear_aux:ww
- \int_use:N \int_eval:w \c_one + #1 ;
+ \cs_set_eq:cN { @@_#2_#1: } \c_undefined:D
+ \exp_after:wN \@@_clear:ww
+ \int_use:N \__int_eval:w \c_one + #1 ;
#2 \q_stop
}
% \end{macrocode}
@@ -216,7 +220,8 @@
% \end{macro}
%
% \begin{macro}{\flag_clear_new:n}
-% A flag exist if \cs{flag_trap_\meta{flag name}:n} exists.
+% As for other datatypes, clear the \meta{flag} or create a new one,
+% as appropriate.
% \begin{macrocode}
\cs_new_protected:Npn \flag_clear_new:n #1
{ \flag_if_exist:nTF {#1} { \flag_clear:n } { \flag_new:n } {#1} }
@@ -224,22 +229,23 @@
% \end{macro}
%
% \begin{macro}{\flag_set_trap:nn}
-% Should that \pkg{l3flag} function check whether the flag exists?
+% ^^A todo: check that the flag exists.
+% Redefine the trap.
% \begin{macrocode}
\cs_new_protected:Npn \flag_set_trap:nn #1#2
- { \cs_set:cpn { flag_trap_#1:w } ##1 ; {#2} }
+ { \cs_set:cpn { @@_trap_#1:w } ##1 ; {#2} }
% \end{macrocode}
% \end{macro}
%
% \subsection{Expandable flag commands}
%
% \begin{macro}[EXP, pTF]{\flag_if_exist:n}
-% A \meta{flag} is defined if the corresponding \enquote{trap} is
-% defined.
+% A flag exist if the corresponding trap \cs{@@_trap_\meta{flag
+% name}:n} is defined.
% \begin{macrocode}
\prg_new_conditional:Npnn \flag_if_exist:n #1 { p , T , F , TF }
{
- \cs_if_exist:cTF { flag_trap_#1:w }
+ \cs_if_exist:cTF { @@_trap_#1:w }
{ \prg_return_true: } { \prg_return_false: }
}
% \end{macrocode}
@@ -250,7 +256,7 @@
% \begin{macrocode}
\prg_new_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF }
{
- \if_cs_exist:w l_#1_0_flag \cs_end:
+ \if_cs_exist:w @@_#1_0: \cs_end:
\prg_return_true:
\else:
\prg_return_false:
@@ -260,21 +266,21 @@
% \end{macro}
%
% \begin{macro}[EXP]{\flag_height:n}
-% \begin{macro}[EXP, aux]{\flag_height_loop:ww, \flag_height_end:ww}
+% \begin{macro}[EXP, aux]{\@@_height_loop:ww, \@@_height_end:ww}
% Extract the value of the flag by going through all of the
% |_|\meta{integer} control sequences starting from $0$.
% \begin{macrocode}
-\cs_new:Npn \flag_height:n #1 { \flag_height_loop:ww 0; #1 \q_stop }
-\cs_new:Npn \flag_height_loop:ww #1 ; #2 \q_stop
+\cs_new:Npn \flag_height:n #1 { \@@_height_loop:ww 0; #1 \q_stop }
+\cs_new:Npn \@@_height_loop:ww #1 ; #2 \q_stop
{
- \if_cs_exist:w l_#2_#1_flag \cs_end:
- \exp_after:wN \flag_height_loop:ww \int_use:N \int_eval:w \c_one +
+ \if_cs_exist:w @@_#2_#1: \cs_end:
+ \exp_after:wN \@@_height_loop:ww \int_use:N \__int_eval:w \c_one +
\else:
- \exp_after:wN \flag_height_end:ww
+ \exp_after:wN \@@_height_end:ww
\fi:
#1 ; #2 \q_stop
}
-\cs_new:Npn \flag_height_end:ww #1 ; #2 \q_stop { #1 }
+\cs_new:Npn \@@_height_end:ww #1 ; #2 \q_stop { #1 }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -284,8 +290,8 @@
% \begin{macrocode}
\cs_new:Npn \flag_raise:n #1
{
- \cs:w flag_trap_#1:w \exp_after:wN \cs_end:
- \int_value:w \flag_height:n {#1} ;
+ \cs:w @@_trap_#1:w \exp_after:wN \cs_end:
+ \__int_value:w \flag_height:n {#1} ;
}
% \end{macrocode}
% \end{macro}
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx
index bb290aaa276..498036bdaa7 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx
@@ -35,8 +35,8 @@
%
%<*driver|package>
\RequirePackage{expl3}
-\GetIdInfo$Id: l3regex.dtx 3488 2012-03-03 19:49:03Z bruno $
- {L3 Experimental Regular Expressions}
+\GetIdInfo$Id: l3regex.dtx 3940 2012-07-09 00:41:44Z bruno $
+ {L3 Experimental regular expressions}
%</driver|package>
%<*driver>
\documentclass[full]{l3doc}
@@ -592,7 +592,7 @@
% \item Detect attempts to use back-references.
% \item Test for the maximum register \cs{c_max_register_int}.
% \item Find out whether the fact that |\W| and friends match the
-% end-marker leads to bugs. Possibly update \cs{regex_item_reverse:n}.
+% end-marker leads to bugs. Possibly update \cs{__regex_item_reverse:n}.
% \item Enforce that |\cC| can only be followed by a match-all dot.
% \end{itemize}
%
@@ -605,7 +605,7 @@
% \item Only build \c{...} once.
% \item Use \tn{skip} for the left and right state stacks when
% compiling a regex.
-% \item Should \cs{regex_action_free_group:n} only be used for greedy
+% \item Should \cs{__regex_action_free_group:n} only be used for greedy
% |{n,}| quantifier? (I think not.)
% \item Quantifiers for |\u| and assertions.
% \item Improve digit grabbing for the |\g| escape in replacement.
@@ -614,16 +614,16 @@
% \texttt{current_state} and \texttt{current_submatches}.
% \item If possible, when a state is reused by the same thread, kill
% other subthreads.
-% \item Use \tn{dimen} registers rather than \cs{l_regex_balance_tl}
-% to build \cs{regex_replacement_balance_one_match:n}.
+% \item Use \tn{dimen} registers rather than \cs{l__regex_balance_tl}
+% to build \cs{__regex_replacement_balance_one_match:n}.
% \item Reduce the number of epsilon-transitions in alternatives.
% \item Optimize simple strings: use less states (|abcade| should give
% two states, for |abc| and |ade|). [Does that really make sense?]
% \item Optimize groups with no alternative.
-% \item Optimize states with a single \cs{regex_action_free:n}.
-% \item Optimize the use of \cs{regex_action_success:} by inserting it
+% \item Optimize states with a single \cs{__regex_action_free:n}.
+% \item Optimize the use of \cs{__regex_action_success:} by inserting it
% in state $2$ directly instead of having an extra transition.
-% \item Optimize the use of \cs{prg_stepwise_...} functions.
+% \item Optimize the use of \cs{int_step_...} functions.
% \item Groups don't capture within regexes for csnames; optimize and
% document.
% \item Decide and document what |\c{\c{...}}| should do in the
@@ -700,11 +700,20 @@
%
% \section{\pkg{l3regex} implementation}
%
-%<*package>
% \begin{macrocode}
+%<*initex|package>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<@@=regex>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*package>
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\RequirePackage{l3tl-build, l3tl-analysis, l3flag, l3str}
+%</package>
% \end{macrocode}
%
% \subsection{Plan of attack}
@@ -750,7 +759,7 @@
% are ordered according to the greediness of quantifiers.
% \item \emph{Step}: used when matching, starts at $0$, incremented
% every time a character is read, and is not reset when searching
-% for repeated matches. The integer \cs{l_regex_step_int} is a
+% for repeated matches. The integer \cs{l_@@_step_int} is a
% unique id for all the steps of the matching algorithm.
% \end{itemize}
%
@@ -791,7 +800,7 @@
% submatches as would be extracted by the \cs{regex_extract}
% functions. Since smaller \tn{skip} registers are used, the minimum
% index is twice \texttt{max_state}, and the used registers go up to
-% \cs{l_regex_submatch_int}. They are organized in blocks of
+% \cs{l_@@_submatch_int}. They are organized in blocks of
% \texttt{capturing_group}, each block corresponding to one match
% with all its submatches stored in consecutive \tn{skip}s.
% \end{itemize}
@@ -820,114 +829,114 @@
%
% \subsubsection{Constants and variables}
%
-% \begin{macro}[aux]{\regex_tmp:w}
+% \begin{macro}[aux]{\@@_tmp:w}
% Temporary function used for various short-term purposes.
% \begin{macrocode}
-\cs_new:Npn \regex_tmp:w { }
+\cs_new:Npn \@@_tmp:w { }
% \end{macrocode}
% \end{macro}
%
% \begin{variable}
% {
-% \l_regex_internal_a_tl, \l_regex_internal_b_tl,
-% \l_regex_internal_a_int, \l_regex_internal_b_int,
-% \l_regex_internal_c_int, \l_regex_internal_bool,
-% \l_regex_internal_seq, \g_regex_internal_tl,
+% \l_@@_internal_a_tl, \l_@@_internal_b_tl,
+% \l_@@_internal_a_int, \l_@@_internal_b_int,
+% \l_@@_internal_c_int, \l_@@_internal_bool,
+% \l_@@_internal_seq, \g_@@_internal_tl,
% }
% Temporary variables used for various purposes.
% \begin{macrocode}
-\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_new:N \l_@@_internal_a_tl
+\tl_new:N \l_@@_internal_b_tl
+\int_new:N \l_@@_internal_a_int
+\int_new:N \l_@@_internal_b_int
+\int_new:N \l_@@_internal_c_int
+\bool_new:N \l_@@_internal_bool
+\seq_new:N \l_@@_internal_seq
+\tl_new:N \g_@@_internal_tl
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\c_regex_no_match_regex}
+% \begin{variable}{\c_@@_no_match_regex}
% This regular expression matches nothing, but is still a valid
% regular expression. We could use a failing assertion, but I went for
% an empty class. It is used as the initial value for regular
% expressions declared using \cs{regex_new:N}.
% \begin{macrocode}
-\tl_const:Nn \c_regex_no_match_regex
+\tl_const:Nn \c_@@_no_match_regex
{
- \regex_branch:n
- { \regex_class:NnnnN \c_true_bool { } { 1 } { 0 } \c_true_bool }
+ \@@_branch:n
+ { \@@_class:NnnnN \c_true_bool { } { 1 } { 0 } \c_true_bool }
}
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_regex_balance_int}
+% \begin{variable}{\l_@@_balance_int}
% The first thing we do when matching is to go once through the query
% token list and store the information for each token as \tn{muskip}
-% and \tn{toks} registers. During this phase, \cs{l_regex_balance_int}
+% and \tn{toks} registers. During this phase, \cs{l_@@_balance_int}
% counts the balance of begin-group and end-group character tokens
% which appear before a given point in the token list, and we store it
% as the shrink component of each \tn{muskip} register. This variable
% is also used to keep track of the balance in the replacement text.
% \begin{macrocode}
-\int_new:N \l_regex_balance_int
+\int_new:N \l_@@_balance_int
% \end{macrocode}
% \end{variable}
%
% \subsubsection{Testing characters}
%
-% \begin{macro}[int]{\regex_break_point:TF}
-% \begin{macro}[int]{\regex_break_true:w}
+% \begin{macro}[int]{\@@_break_point:TF}
+% \begin{macro}[int]{\@@_break_true:w}
% When testing whether a character of the query token list matches
% a given character class in the regular expression, we often
% have to test it against several ranges of characters, checking
% if any one of those matches. This is done with a structure like
% \begin{quote}
% \meta{test1} \ldots{} \meta{test$\sb{n}$} \\
-% \cs{regex_break_point:TF} \Arg{true code} \Arg{false code}
+% \cs{@@_break_point:TF} \Arg{true code} \Arg{false code}
% \end{quote}
-% If any of the tests succeeds, it calls \cs{regex_break_true:w},
+% If any of the tests succeeds, it calls \cs{@@_break_true:w},
% which cleans up and leaves \meta{true code} in the input stream.
-% Otherwise, \cs{regex_break_point:TF} leaves the \meta{false code}
+% Otherwise, \cs{@@_break_point:TF} leaves the \meta{false code}
% in the input stream.
% \begin{macrocode}
-\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 \@@_break_true:w
+ #1 \@@_break_point:TF #2 #3 {#2}
+\cs_new_protected:Npn \@@_break_point:TF #1 #2 { #2 }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\regex_item_reverse:n}
+% \begin{macro}[int]{\@@_item_reverse:n}
% This function makes showing regular expressions easier, and lets us
% define |\D| in terms of |\d| for instance. There is a subtelty: the
% end of the query is marked by $-2$, and will thus match |\D| and
% other negated properties; this case is catched by another part of
% the code.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_item_reverse:n #1
+\cs_new_protected:Npn \@@_item_reverse:n #1
{
#1
- \regex_break_point:TF { } \regex_break_true:w
+ \@@_break_point:TF { } \@@_break_true:w
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}[int]
-% {\regex_item_caseful_equal:n, \regex_item_caseful_range:nn}
-% Simple comparisons triggering \cs{regex_break_true:w} when true.
+% {\@@_item_caseful_equal:n, \@@_item_caseful_range:nn}
+% Simple comparisons triggering \cs{@@_break_true:w} when true.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_item_caseful_equal:n #1
+\cs_new_protected:Npn \@@_item_caseful_equal:n #1
{
- \if_num:w #1 = \l_regex_current_char_int
- \exp_after:wN \regex_break_true:w
+ \if_int_compare:w #1 = \l_@@_current_char_int
+ \exp_after:wN \@@_break_true:w
\fi:
}
-\cs_new_protected:Npn \regex_item_caseful_range:nn #1 #2
+\cs_new_protected:Npn \@@_item_caseful_range:nn #1 #2
{
- \reverse_if:N \if_num:w #1 > \l_regex_current_char_int
- \reverse_if:N \if_num:w #2 < \l_regex_current_char_int
- \exp_after:wN \exp_after:wN \exp_after:wN \regex_break_true:w
+ \reverse_if:N \if_int_compare:w #1 > \l_@@_current_char_int
+ \reverse_if:N \if_int_compare:w #2 < \l_@@_current_char_int
+ \exp_after:wN \exp_after:wN \exp_after:wN \@@_break_true:w
\fi:
\fi:
}
@@ -935,63 +944,63 @@
% \end{macro}
%
% \begin{macro}[int]
-% {\regex_item_caseless_equal:n, \regex_item_caseless_range:nn}
+% {\@@_item_caseless_equal:n, \@@_item_caseless_range:nn}
% For caseless matching, we perform the test both on the
% \texttt{current_char} and on the \texttt{case_changed_char}. Before
% doing the second set of tests, we make sure that
% \texttt{case_changed_char} has been computed.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_item_caseless_equal:n #1
+\cs_new_protected:Npn \@@_item_caseless_equal:n #1
{
- \if_num:w #1 = \l_regex_current_char_int
- \exp_after:wN \regex_break_true:w
+ \if_int_compare:w #1 = \l_@@_current_char_int
+ \exp_after:wN \@@_break_true:w
\fi:
- \if_num:w \l_regex_case_changed_char_int = \c_max_int
- \regex_compute_case_changed_char:
+ \if_int_compare:w \l_@@_case_changed_char_int = \c_max_int
+ \@@_compute_case_changed_char:
\fi:
- \if_num:w #1 = \l_regex_case_changed_char_int
- \exp_after:wN \regex_break_true:w
+ \if_int_compare:w #1 = \l_@@_case_changed_char_int
+ \exp_after:wN \@@_break_true:w
\fi:
}
-\cs_new_protected:Npn \regex_item_caseless_range:nn #1 #2
+\cs_new_protected:Npn \@@_item_caseless_range:nn #1 #2
{
- \reverse_if:N \if_num:w #1 > \l_regex_current_char_int
- \reverse_if:N \if_num:w #2 < \l_regex_current_char_int
- \exp_after:wN \exp_after:wN \exp_after:wN \regex_break_true:w
+ \reverse_if:N \if_int_compare:w #1 > \l_@@_current_char_int
+ \reverse_if:N \if_int_compare:w #2 < \l_@@_current_char_int
+ \exp_after:wN \exp_after:wN \exp_after:wN \@@_break_true:w
\fi:
\fi:
- \if_num:w \l_regex_case_changed_char_int = \c_max_int
- \regex_compute_case_changed_char:
+ \if_int_compare:w \l_@@_case_changed_char_int = \c_max_int
+ \@@_compute_case_changed_char:
\fi:
- \reverse_if:N \if_num:w #1 > \l_regex_case_changed_char_int
- \reverse_if:N \if_num:w #2 < \l_regex_case_changed_char_int
- \exp_after:wN \exp_after:wN \exp_after:wN \regex_break_true:w
+ \reverse_if:N \if_int_compare:w #1 > \l_@@_case_changed_char_int
+ \reverse_if:N \if_int_compare:w #2 < \l_@@_case_changed_char_int
+ \exp_after:wN \exp_after:wN \exp_after:wN \@@_break_true:w
\fi:
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_compute_case_changed_char:}
-% This function is called when \cs{l_regex_case_changed_char_int} has
+% \begin{macro}[int]{\@@_compute_case_changed_char:}
+% This function is called when \cs{l_@@_case_changed_char_int} has
% not yet been computed (or rather, when it is set to the marker value
% \cs{c_max_int}). If the current character code is in the range
% $[65,90]$ (upper-case), then add $32$, making it lowercase. If it is
% in the lower-case letter range $[97,122]$, subtract $32$.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_compute_case_changed_char:
+\cs_new_protected_nopar:Npn \@@_compute_case_changed_char:
{
- \int_set_eq:NN \l_regex_case_changed_char_int \l_regex_current_char_int
- \if_num:w \l_regex_current_char_int < \c_ninety_one
- \if_num:w \l_regex_current_char_int < \c_sixty_five
+ \int_set_eq:NN \l_@@_case_changed_char_int \l_@@_current_char_int
+ \if_int_compare:w \l_@@_current_char_int < \c_ninety_one
+ \if_int_compare:w \l_@@_current_char_int < \c_sixty_five
\else:
- \int_add:Nn \l_regex_case_changed_char_int { \c_thirty_two }
+ \int_add:Nn \l_@@_case_changed_char_int { \c_thirty_two }
\fi:
\else:
- \if_num:w \l_regex_current_char_int < \c_one_hundred_twenty_three
- \if_num:w \l_regex_current_char_int < \c_ninety_seven
+ \if_int_compare:w \l_@@_current_char_int < \c_one_hundred_twenty_three
+ \if_int_compare:w \l_@@_current_char_int < \c_ninety_seven
\else:
- \int_sub:Nn \l_regex_case_changed_char_int { \c_thirty_two }
+ \int_sub:Nn \l_@@_case_changed_char_int { \c_thirty_two }
\fi:
\fi:
\fi:
@@ -999,79 +1008,79 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int, EXP]{\regex_item_equal:n, \regex_item_range:nn}
+% \begin{macro}[int, EXP]{\@@_item_equal:n, \@@_item_range:nn}
% Those must always be defined to expand to a \texttt{caseful}
% (default) or \texttt{caseless} version, and not be protected: they
% must expand when compiling, to hard-code which tests are caseless or
% caseful.
% \begin{macrocode}
-\cs_new_eq:NN \regex_item_equal:n ?
-\cs_new_eq:NN \regex_item_range:nn ?
+\cs_new_eq:NN \@@_item_equal:n ?
+\cs_new_eq:NN \@@_item_range:nn ?
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_item_catcode:nT, \regex_item_catcode_reverse:nT}
-% \begin{macro}[aux]{\regex_item_catcode_aux:}
+% \begin{macro}[int]{\@@_item_catcode:nT, \@@_item_catcode_reverse:nT}
+% \begin{macro}[aux]{\@@_item_catcode:}
% The argument is a sum of powers of $4$ with exponents given by the
% allowed category codes (between $0$ and $13$). Dividing by a given
% power of $4$ gives an odd result if and only if that category code
% is allowed. If the catcode does not match, then skip the character
% code tests which follow.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_item_catcode_aux:
+\cs_new_protected:Npn \@@_item_catcode:
{
"
- \if_case:w \l_regex_current_catcode_int
+ \if_case:w \l_@@_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*\c_zero
\fi:
}
-\cs_new_protected:Npn \regex_item_catcode:nT #1
+\cs_new_protected:Npn \@@_item_catcode:nT #1
{
- \if_int_odd:w \int_eval:w #1 / \regex_item_catcode_aux: \int_eval_end:
+ \if_int_odd:w \__int_eval:w #1 / \@@_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 \@@_item_catcode_reverse:nT #1#2
+ { \@@_item_catcode:nT {#1} { \@@_item_reverse:n {#2} } }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\regex_item_exact:nn, \regex_item_exact_cs:c}
+% \begin{macro}[int]{\@@_item_exact:nn, \@@_item_exact_cs:c}
% This matches an exact \meta{category}-\meta{character code} pair, or
% an exact control sequence.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_item_exact:nn #1#2
+\cs_new_protected:Npn \@@_item_exact:nn #1#2
{
- \if_num:w #1 = \l_regex_current_catcode_int
- \if_num:w #2 = \l_regex_current_char_int
- \exp_after:wN \exp_after:wN \exp_after:wN \regex_break_true:w
+ \if_int_compare:w #1 = \l_@@_current_catcode_int
+ \if_int_compare:w #2 = \l_@@_current_char_int
+ \exp_after:wN \exp_after:wN \exp_after:wN \@@_break_true:w
\fi:
\fi:
}
-\cs_new_protected:Npn \regex_item_exact_cs:c #1
+\cs_new_protected:Npn \@@_item_exact_cs:c #1
{
- \int_compare:nNnTF \l_regex_current_catcode_int = \c_zero
+ \int_compare:nNnTF \l_@@_current_catcode_int = \c_zero
{
- \str_if_eq:xxTF
+ \str_if_eq_x:nnTF
{
\exp_after:wN \exp_after:wN \exp_after:wN \cs_to_str:N
- \tex_the:D \tex_toks:D \l_regex_current_pos_int
+ \tex_the:D \tex_toks:D \l_@@_current_pos_int
}
{ #1 }
- { \regex_break_true:w } { }
+ { \@@_break_true:w } { }
}
{ }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_item_cs:n}
+% \begin{macro}[int]{\@@_item_cs:n}
% Match a control sequence (the argument is a compiled regex).
% First test the catcode of the current token to be zero.
% Then perform the matching test, and break if the csname
@@ -1079,25 +1088,25 @@
% of the \tn{toks}\meta{current position} (of the form \cs{exp_not:n}
% \Arg{control sequence}) to \meta{control sequence}.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_item_cs:n #1
+\cs_new_protected:Npn \@@_item_cs:n #1
{
- \int_compare:nNnT \l_regex_current_catcode_int = \c_zero
+ \int_compare:nNnT \l_@@_current_catcode_int = \c_zero
{
\group_begin:
- \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:Nx \regex_match:n
+ \@@_single_match:
+ \@@_disable_submatches:
+ \@@_build_for_cs:n {#1}
+ \bool_set_eq:NN \l_@@_saved_success_bool \g_@@_success_bool
+ \exp_args:Nx \@@_match:n
{
\exp_after:wN \exp_after:wN
\exp_after:wN \cs_to_str:N
- \tex_the:D \tex_toks:D \l_regex_current_pos_int
+ \tex_the:D \tex_toks:D \l_@@_current_pos_int
}
- \if_meaning:w \c_true_bool \g_regex_success_bool
- \group_insert_after:N \regex_break_true:w
+ \if_meaning:w \c_true_bool \g_@@_success_bool
+ \group_insert_after:N \@@_break_true:w
\fi:
- \bool_gset_eq:NN \g_regex_success_bool \l_regex_saved_success_bool
+ \bool_gset_eq:NN \g_@@_success_bool \l_@@_saved_success_bool
\group_end:
}
}
@@ -1108,8 +1117,8 @@
%
% \begin{macro}[aux]
% {
-% \regex_prop_d:, \regex_prop_h:, \regex_prop_s:,
-% \regex_prop_v:, \regex_prop_w:, \regex_prop_N:
+% \@@_prop_d:, \@@_prop_h:, \@@_prop_s:,
+% \@@_prop_v:, \@@_prop_w:, \@@_prop_N:
% }
% Character property tests for |\d|, |\W|, \emph{etc.} These character
% properties are not affected by the |(?i)| option. The characters
@@ -1120,84 +1129,84 @@
% order in which the various tests appear is optimized for usual
% mostly lower case letter text.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_prop_d:
- { \regex_item_caseful_range:nn \c_forty_eight { 57 } } % 0--9
-\cs_new_protected_nopar:Npn \regex_prop_h:
+\cs_new_protected_nopar:Npn \@@_prop_d:
+ { \@@_item_caseful_range:nn \c_forty_eight { 57 } } % 0--9
+\cs_new_protected_nopar:Npn \@@_prop_h:
{
- \regex_item_caseful_equal:n \c_thirty_two % space
- \regex_item_caseful_equal:n \c_nine % tab
+ \@@_item_caseful_equal:n \c_thirty_two % space
+ \@@_item_caseful_equal:n \c_nine % tab
}
-\cs_new_protected_nopar:Npn \regex_prop_s:
+\cs_new_protected_nopar:Npn \@@_prop_s:
{
- \regex_item_caseful_equal:n \c_thirty_two % space
- \regex_item_caseful_equal:n \c_nine % tab
- \regex_item_caseful_equal:n \c_ten % lf
- \regex_item_caseful_equal:n \c_twelve % ff
- \regex_item_caseful_equal:n \c_thirteen % cr
+ \@@_item_caseful_equal:n \c_thirty_two % space
+ \@@_item_caseful_equal:n \c_nine % tab
+ \@@_item_caseful_equal:n \c_ten % lf
+ \@@_item_caseful_equal:n \c_twelve % ff
+ \@@_item_caseful_equal:n \c_thirteen % cr
}
-\cs_new_protected_nopar:Npn \regex_prop_v:
- { \regex_item_caseful_range:nn \c_ten \c_thirteen } % lf, vtab, ff, cr
-\cs_new_protected_nopar:Npn \regex_prop_w:
+\cs_new_protected_nopar:Npn \@@_prop_v:
+ { \@@_item_caseful_range:nn \c_ten \c_thirteen } % lf, vtab, ff, cr
+\cs_new_protected_nopar:Npn \@@_prop_w:
{
- \regex_item_caseful_range:nn \c_ninety_seven { 122 } % a--z
- \regex_item_caseful_range:nn \c_sixty_five { 90 } % A--Z
- \regex_item_caseful_range:nn \c_forty_eight { 57 } % 0--9
- \regex_item_caseful_equal:n { 95 } % _
+ \@@_item_caseful_range:nn \c_ninety_seven { 122 } % a--z
+ \@@_item_caseful_range:nn \c_sixty_five { 90 } % A--Z
+ \@@_item_caseful_range:nn \c_forty_eight { 57 } % 0--9
+ \@@_item_caseful_equal:n { 95 } % _
}
-\cs_new_protected_nopar:Npn \regex_prop_N:
- { \regex_item_reverse:n { \regex_item_caseful_equal:n \c_ten } }
+\cs_new_protected_nopar:Npn \@@_prop_N:
+ { \@@_item_reverse:n { \@@_item_caseful_equal:n \c_ten } }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}[aux]
% {
-% \regex_posix_alnum:, \regex_posix_alpha:, \regex_posix_ascii:,
-% \regex_posix_blank:, \regex_posix_cntrl:, \regex_posix_digit:,
-% \regex_posix_graph:, \regex_posix_lower:, \regex_posix_print:,
-% \regex_posix_punct:, \regex_posix_space:, \regex_posix_upper:,
-% \regex_posix_word: , \regex_posix_xdigit:
+% \@@_posix_alnum:, \@@_posix_alpha:, \@@_posix_ascii:,
+% \@@_posix_blank:, \@@_posix_cntrl:, \@@_posix_digit:,
+% \@@_posix_graph:, \@@_posix_lower:, \@@_posix_print:,
+% \@@_posix_punct:, \@@_posix_space:, \@@_posix_upper:,
+% \@@_posix_word: , \@@_posix_xdigit:
% }
% \textsc{posix} properties. No surprise.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_posix_alnum:
- { \regex_posix_alpha: \regex_posix_digit: }
-\cs_new_protected_nopar:Npn \regex_posix_alpha:
- { \regex_posix_lower: \regex_posix_upper: }
-\cs_new_protected_nopar:Npn \regex_posix_ascii:
- { \regex_item_caseful_range:nn \c_zero \c_one_hundred_twenty_seven }
-\cs_new_eq:NN \regex_posix_blank: \regex_prop_h:
-\cs_new_protected_nopar:Npn \regex_posix_cntrl:
+\cs_new_protected_nopar:Npn \@@_posix_alnum:
+ { \@@_posix_alpha: \@@_posix_digit: }
+\cs_new_protected_nopar:Npn \@@_posix_alpha:
+ { \@@_posix_lower: \@@_posix_upper: }
+\cs_new_protected_nopar:Npn \@@_posix_ascii:
+ { \@@_item_caseful_range:nn \c_zero \c_one_hundred_twenty_seven }
+\cs_new_eq:NN \@@_posix_blank: \@@_prop_h:
+\cs_new_protected_nopar:Npn \@@_posix_cntrl:
{
- \regex_item_caseful_range:nn \c_zero { 31 }
- \regex_item_caseful_equal:n \c_one_hundred_twenty_seven
+ \@@_item_caseful_range:nn \c_zero { 31 }
+ \@@_item_caseful_equal:n \c_one_hundred_twenty_seven
}
-\cs_new_eq:NN \regex_posix_digit: \regex_prop_d:
-\cs_new_protected_nopar:Npn \regex_posix_graph:
- { \regex_item_caseful_range:nn { 33 } { 126 } }
-\cs_new_protected_nopar:Npn \regex_posix_lower:
- { \regex_item_caseful_range:nn \c_ninety_seven { 122 } }
-\cs_new_protected_nopar:Npn \regex_posix_print:
- { \regex_item_caseful_range:nn \c_thirty_two { 126 } }
-\cs_new_protected_nopar:Npn \regex_posix_punct:
+\cs_new_eq:NN \@@_posix_digit: \@@_prop_d:
+\cs_new_protected_nopar:Npn \@@_posix_graph:
+ { \@@_item_caseful_range:nn { 33 } { 126 } }
+\cs_new_protected_nopar:Npn \@@_posix_lower:
+ { \@@_item_caseful_range:nn \c_ninety_seven { 122 } }
+\cs_new_protected_nopar:Npn \@@_posix_print:
+ { \@@_item_caseful_range:nn \c_thirty_two { 126 } }
+\cs_new_protected_nopar:Npn \@@_posix_punct:
{
- \regex_item_caseful_range:nn { 33 } { 47 }
- \regex_item_caseful_range:nn { 58 } { 64 }
- \regex_item_caseful_range:nn { 91 } { 96 }
- \regex_item_caseful_range:nn { 123 } { 126 }
+ \@@_item_caseful_range:nn { 33 } { 47 }
+ \@@_item_caseful_range:nn { 58 } { 64 }
+ \@@_item_caseful_range:nn { 91 } { 96 }
+ \@@_item_caseful_range:nn { 123 } { 126 }
}
-\cs_new_protected_nopar:Npn \regex_posix_space:
+\cs_new_protected_nopar:Npn \@@_posix_space:
{
- \regex_item_caseful_equal:n \c_thirty_two
- \regex_item_caseful_range:nn \c_nine \c_thirteen
+ \@@_item_caseful_equal:n \c_thirty_two
+ \@@_item_caseful_range:nn \c_nine \c_thirteen
}
-\cs_new_protected_nopar:Npn \regex_posix_upper:
- { \regex_item_caseful_range:nn \c_sixty_five { 90 } }
-\cs_new_eq:NN \regex_posix_word: \regex_prop_w:
-\cs_new_protected_nopar:Npn \regex_posix_xdigit:
+\cs_new_protected_nopar:Npn \@@_posix_upper:
+ { \@@_item_caseful_range:nn \c_sixty_five { 90 } }
+\cs_new_eq:NN \@@_posix_word: \@@_prop_w:
+\cs_new_protected_nopar:Npn \@@_posix_xdigit:
{
- \regex_posix_digit:
- \regex_item_caseful_range:nn \c_sixty_five { 70 }
- \regex_item_caseful_range:nn \c_ninety_seven { 102 }
+ \@@_posix_digit:
+ \@@_item_caseful_range:nn \c_sixty_five { 70 }
+ \@@_item_caseful_range:nn \c_ninety_seven { 102 }
}
% \end{macrocode}
% \end{macro}
@@ -1215,7 +1224,7 @@
% issues (those can become quite complex to handle in combination with
% ranges in character classes).
%
-% Usage: \cs{regex_escape_use:nnnn} \meta{inline~1} \meta{inline~2}
+% Usage: \cs{@@_escape_use:nnnn} \meta{inline~1} \meta{inline~2}
% \meta{inline~3} \Arg{token list} The \meta{token list} is converted to
% a string, then read from left to right, interpreting backslashes as
% escaping the next character. Unescaped characters are fed to the
@@ -1230,152 +1239,152 @@
% The conversion is mostly done within an \texttt{x}-expanding
% assignment, except for the |\x| escape sequence, which is not amenable
% to that in general. For this, we use the general framework of
-% \cs{tl_set_build:Nw}.
+% \cs{__tl_build:Nw}.
%
-% \begin{macro}[int]{\regex_escape_use:nnnn}
-% The result is built in \cs{l_regex_internal_a_tl}, which is then
+% \begin{macro}[int]{\@@_escape_use:nnnn}
+% The result is built in \cs{l_@@_internal_a_tl}, which is then
% left in the input stream. Go through |#4| once, applying |#1|,
% |#2|, or |#3| as relevant to each character (after de-escaping
-% it). Note that we cannot replace \cs{tl_se:Nx} and
-% \cs{tl_build_one:o} by a single call to \cs{tl_build_one:x}, because
-% the \texttt{x}-expanding assignment is interrupted by |\x|.
+% it). Note that we cannot replace \cs{tl_set:Nx} and
+% \cs{__tl_build_one:o} by a single call to \cs{__tl_build_one:x}, because
+% the \texttt{x}-expanding assignment may be interrupted by |\x|.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_escape_use:nnnn #1#2#3#4
+\cs_new_protected:Npn \@@_escape_use:nnnn #1#2#3#4
{
-%<trace> \trace_push:nnn { regex } { 1 } { regex_escape_use:nnnn }
- \tl_set_build:Nw \l_regex_internal_a_tl
- \cs_set_nopar:Npn \regex_escape_unescaped:N ##1 { #1 }
- \cs_set_nopar:Npn \regex_escape_escaped:N ##1 { #2 }
- \cs_set_nopar:Npn \regex_escape_raw:N ##1 { #3 }
+%<trace> \trace_push:nnn { regex } { 1 } { @@_escape_use:nnnn }
+ \__tl_build:Nw \l_@@_internal_a_tl
+ \cs_set_nopar:Npn \@@_escape_unescaped:N ##1 { #1 }
+ \cs_set_nopar:Npn \@@_escape_escaped:N ##1 { #2 }
+ \cs_set_nopar:Npn \@@_escape_raw:N ##1 { #3 }
\int_set:Nn \tex_escapechar:D { 92 }
- \str_gset_other:Nn \g_regex_internal_tl { #4 }
- \tl_set:Nx \l_regex_internal_b_tl
+ \__str_gset_other:Nn \g_@@_internal_tl { #4 }
+ \tl_set:Nx \l_@@_internal_b_tl
{
- \exp_after:wN \regex_escape_loop:N \g_regex_internal_tl
- { break } \prg_break_point:n { }
+ \exp_after:wN \@@_escape_loop:N \g_@@_internal_tl
+ { break } \__prg_break_point:
}
- \tl_build_one:o \l_regex_internal_b_tl
- \tl_build_end:
-%<trace> \trace_pop:nnn { regex } { 1 } { regex_escape_use:nnnn }
- \l_regex_internal_a_tl
+ \__tl_build_one:o \l_@@_internal_b_tl
+ \__tl_build_end:
+%<trace> \trace_pop:nnn { regex } { 1 } { @@_escape_use:nnnn }
+ \l_@@_internal_a_tl
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_escape_loop:N}
-% \begin{macro}[aux]+\regex_escape_\:w+
-% \cs{regex_escape_loop:N} reads one character: if it is special
+% \begin{macro}[aux]{\@@_escape_loop:N}
+% \begin{macro}[aux]+\@@_escape_\:w+
+% \cs{@@_escape_loop:N} reads one character: if it is special
% (space, backslash, or end-marker), perform the associated action,
% otherwise it is simply an unescaped character. After a backslash,
% the same is done, but unknown characters are \enquote{escaped}.
% \begin{macrocode}
-\cs_new:Npn \regex_escape_loop:N #1
+\cs_new:Npn \@@_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_if_exist_use:cF { @@_escape_\token_to_str:N #1:w }
+ { \@@_escape_unescaped:N #1 }
+ \@@_escape_loop:N
}
-\cs_new_nopar:cpn { regex_escape_ \c_backslash_str :w }
- \regex_escape_loop:N #1
+\cs_new_nopar:cpn { @@_escape_ \c_backslash_str :w }
+ \@@_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_if_exist_use:cF { @@_escape_/\token_to_str:N #1:w }
+ { \@@_escape_escaped:N #1 }
+ \@@_escape_loop:N
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}[aux]
-% {\regex_escape_unescaped:N, \regex_escape_escaped:N, \regex_escape_raw:N}
+% {\@@_escape_unescaped:N, \@@_escape_escaped:N, \@@_escape_raw:N}
% Those functions are never called before being given a new meaning,
% so their definitions here don't matter.
% \begin{macrocode}
-\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 \@@_escape_unescaped:N ?
+\cs_new_eq:NN \@@_escape_escaped:N ?
+\cs_new_eq:NN \@@_escape_raw:N ?
% \end{macrocode}
% \end{macro}
%
% \begin{macro}[aux]
% {
-% \regex_escape_break:w, \regex_escape_/break:w,
-% \regex_escape_/a:w, \regex_escape_/e:w, \regex_escape_/f:w,
-% \regex_escape_/n:w, \regex_escape_/r:w, \regex_escape_/t:w
+% \@@_escape_break:w, \@@_escape_/break:w,
+% \@@_escape_/a:w, \@@_escape_/e:w, \@@_escape_/f:w,
+% \@@_escape_/n:w, \@@_escape_/r:w, \@@_escape_/t:w
% }
-% \begin{macro}[aux]+\regex_escape_ :w+
+% \begin{macro}[aux]+\@@_escape_ :w+
% The loop is ended upon seeing the end-marker
% \enquote{\texttt{break}}, with an error if the string ended in a
% backslash. Spaces are ignored, and |\a|, |\e|, |\f|, |\n|, |\r|,
% |\t| take their meaning here.
% \begin{macrocode}
-\cs_new_eq:NN \regex_escape_break:w \prg_map_break:
-\cs_new_nopar:cpn { regex_escape_/break:w }
+\cs_new_eq:NN \@@_escape_break:w \__prg_break:
+\cs_new_nopar:cpn { @@_escape_/break:w }
{
\if_false: { \fi: }
- \msg_kernel_error:nn { regex } { trailing-backslash }
+ \__msg_kernel_error:nn { regex } { trailing-backslash }
\exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi:
}
-\cs_new_nopar:cpn { regex_escape_~:w } { }
-\cs_new_nopar:cpx { regex_escape_/a:w }
- { \exp_not:N \regex_escape_raw:N \iow_char:N \^^G }
-\cs_new_nopar:cpx { regex_escape_/t:w }
- { \exp_not:N \regex_escape_raw:N \iow_char:N \^^I }
-\cs_new_nopar:cpx { regex_escape_/n:w }
- { \exp_not:N \regex_escape_raw:N \iow_char:N \^^J }
-\cs_new_nopar:cpx { regex_escape_/f:w }
- { \exp_not:N \regex_escape_raw:N \iow_char:N \^^L }
-\cs_new_nopar:cpx { regex_escape_/r:w }
- { \exp_not:N \regex_escape_raw:N \iow_char:N \^^M }
-\cs_new_nopar:cpx { regex_escape_/e:w }
- { \exp_not:N \regex_escape_raw:N \iow_char:N \^^[ }
+\cs_new_nopar:cpn { @@_escape_~:w } { }
+\cs_new_nopar:cpx { @@_escape_/a:w }
+ { \exp_not:N \@@_escape_raw:N \iow_char:N \^^G }
+\cs_new_nopar:cpx { @@_escape_/t:w }
+ { \exp_not:N \@@_escape_raw:N \iow_char:N \^^I }
+\cs_new_nopar:cpx { @@_escape_/n:w }
+ { \exp_not:N \@@_escape_raw:N \iow_char:N \^^J }
+\cs_new_nopar:cpx { @@_escape_/f:w }
+ { \exp_not:N \@@_escape_raw:N \iow_char:N \^^L }
+\cs_new_nopar:cpx { @@_escape_/r:w }
+ { \exp_not:N \@@_escape_raw:N \iow_char:N \^^M }
+\cs_new_nopar:cpx { @@_escape_/e:w }
+ { \exp_not:N \@@_escape_raw:N \iow_char:N \^^[ }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_escape_/x:w}
-% \begin{macro}[aux]{\regex_escape_x_end:w, \regex_escape_x_large:n}
-% When |\x| is encountered, \cs{regex_escape_x_test:N} is responsible
+% \begin{macro}[aux]{\@@_escape_/x:w}
+% \begin{macro}[aux]{\@@_escape_x_end:w, \@@_escape_x_large:n}
+% When |\x| is encountered, \cs{@@_escape_x_test:N} is responsible
% for grabbing some hexadecimal digits, and feeding the result to
-% \cs{regex_escape_x_end:w}. If the number is $<256$, then it is
-% turned into a byte and fed to \cs{regex_escape_raw:N}. Otherwise,
+% \cs{@@_escape_x_end:w}. If the number is $<256$, then it is
+% turned into a byte and fed to \cs{@@_escape_raw:N}. Otherwise,
% interrupt the assignment, and either produce an error, or use a
% standard \tn{lowercase} trick depending on the precise value.
% \begin{macrocode}
-\cs_new:cpn { regex_escape_/x:w } \regex_escape_loop:N
+\cs_new:cpn { @@_escape_/x:w } \@@_escape_loop:N
{
- \exp_after:wN \regex_escape_x_end:w
- \int_value:w "0 \regex_escape_x_test:N
+ \exp_after:wN \@@_escape_x_end:w
+ \__int_value:w "0 \@@_escape_x_test:N
}
-\cs_new:Npn \regex_escape_x_end:w #1 ;
+\cs_new:Npn \@@_escape_x_end:w #1 ;
{
\int_compare:nNnTF {#1} < \c_two_hundred_fifty_six
{
- \exp_last_unbraced:Nf \regex_escape_raw:N
- { \str_output_byte:n {#1} }
+ \exp_last_unbraced:Nf \@@_escape_raw:N
+ { \__str_output_byte:n {#1} }
}
- { \regex_escape_x_large:n {#1} }
+ { \@@_escape_x_large:n {#1} }
}
\group_begin:
\char_set_catcode_other:n { 0 }
- \cs_new:Npn \regex_escape_x_large:n #1
+ \cs_new:Npn \@@_escape_x_large:n #1
{
\if_false: { \fi: }
- \tl_build_one:o \l_regex_internal_b_tl
+ \__tl_build_one:o \l_@@_internal_b_tl
\int_compare:nNnTF {#1} > \c_max_char_int
{
- \msg_kernel_error:nnx { regex } { x-overflow } {#1}
- \tl_set:Nx \l_regex_internal_b_tl
- { \if_false: } \fi: \regex_escape_loop:N
+ \__msg_kernel_error:nnx { regex } { x-overflow } {#1}
+ \tl_set:Nx \l_@@_internal_b_tl
+ { \if_false: } \fi: \@@_escape_loop:N
}
{
\char_set_lccode:nn { \c_zero } {#1}
\tl_to_lowercase:n
{
- \tl_set:Nx \l_regex_internal_b_tl
+ \tl_set:Nx \l_@@_internal_b_tl
{ \if_false: } \fi:
- \regex_escape_raw:N ^^@
- \regex_escape_loop:N
+ \@@_escape_raw:N ^^@
+ \@@_escape_loop:N
}
}
}
@@ -1384,75 +1393,75 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_escape_x_test:N}
+% \begin{macro}[aux]{\@@_escape_x_test:N}
% Find out whether the first character is a left brace (allowing any
% number of hexadecimal digits), or not (allowing up to two
% hexadecimal digits). We need to check for the end-of-string marker.
-% Eventually, call either \cs{regex_escape_x_loop:N} or
-% \cs{regex_escape_x_ii:N}.
+% Eventually, call either \cs{@@_escape_x_loop:N} or
+% \cs{@@_escape_x_ii:N}.
% \begin{macrocode}
-\cs_new:Npn \regex_escape_x_test:N #1
+\cs_new:Npn \@@_escape_x_test:N #1
{
- \str_if_eq:xxTF {#1} { break } { ; }
+ \str_if_eq_x:nnTF {#1} { break } { ; }
{
\if_charcode:w \c_space_token #1
- \exp_after:wN \regex_escape_x_test:N
+ \exp_after:wN \@@_escape_x_test:N
\else:
- \exp_after:wN \regex_escape_x_test_ii:N
+ \exp_after:wN \@@_escape_x_test_ii:N
\exp_after:wN #1
\fi:
}
}
-\cs_new:Npn \regex_escape_x_test_ii:N #1
+\cs_new:Npn \@@_escape_x_test_ii:N #1
{
\if_charcode:w \c_lbrace_str #1
- \exp_after:wN \regex_escape_x_loop:N
+ \exp_after:wN \@@_escape_x_loop:N
\else:
- \str_aux_hexadecimal_use:NTF #1
- { \exp_after:wN \regex_escape_x_ii:N }
- { ; \exp_after:wN \regex_escape_loop:N \exp_after:wN #1 }
+ \__str_hexadecimal_use:NTF #1
+ { \exp_after:wN \@@_escape_x_ii:N }
+ { ; \exp_after:wN \@@_escape_loop:N \exp_after:wN #1 }
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_escape_x_ii:N}
+% \begin{macro}[aux]{\@@_escape_x_ii:N}
% This looks for the second digit in the unbraced case.
% \begin{macrocode}
-\cs_new:Npn \regex_escape_x_ii:N #1
+\cs_new:Npn \@@_escape_x_ii:N #1
{
- \str_if_eq:xxTF {#1} { break } { ; }
+ \str_if_eq_x:nnTF {#1} { break } { ; }
{
- \str_aux_hexadecimal_use:NTF #1
- { ; \regex_escape_loop:N }
- { ; \regex_escape_loop:N #1 }
+ \__str_hexadecimal_use:NTF #1
+ { ; \@@_escape_loop:N }
+ { ; \@@_escape_loop:N #1 }
}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_escape_x_loop:N}
+% \begin{macro}[aux]{\@@_escape_x_loop:N}
% Grab hexadecimal digits, skip spaces, and at the end, check that
% there is a right brace, otherwise raise an error outside the
% assignment.
% \begin{macrocode}
-\cs_new:Npn \regex_escape_x_loop:N #1
+\cs_new:Npn \@@_escape_x_loop:N #1
{
- \str_aux_hexadecimal_use:NTF #1
- { \regex_escape_x_loop:N }
+ \__str_hexadecimal_use:NTF #1
+ { \@@_escape_x_loop:N }
{
\token_if_eq_charcode:NNTF \c_space_token #1
- { \regex_escape_x_loop:N }
+ { \@@_escape_x_loop:N }
{
;
\exp_after:wN \token_if_eq_charcode:NNTF \c_rbrace_str #1
- { \regex_escape_loop:N }
+ { \@@_escape_loop:N }
{
\if_false: { \fi: }
- \tl_build_one:o \l_regex_internal_b_tl
- \msg_kernel_error:nn { regex } { x-missing-rbrace } {#1}
- \tl_set:Nx \l_regex_internal_b_tl
- { \if_false: } \fi: \regex_escape_loop:N #1
+ \__tl_build_one:o \l_@@_internal_b_tl
+ \__msg_kernel_error:nn { regex } { x-missing-rbrace } {#1}
+ \tl_set:Nx \l_@@_internal_b_tl
+ { \if_false: } \fi: \@@_escape_loop:N #1
}
}
}
@@ -1461,7 +1470,7 @@
% \end{macro}
%
% \begin{macro}[EXP, aux]
-% {\regex_char_if_alphanumeric:NTF, \regex_char_if_special:NTF}
+% {\@@_char_if_alphanumeric:NTF, \@@_char_if_special:NTF}
% These two tests are used in the first pass when parsing a regular
% expression. That pass is responsible for finding escaped and
% non-escaped characters, and recognizing which ones have special
@@ -1478,7 +1487,7 @@
% \end{itemize}
% The code is ugly, and highly based on magic numbers and the ascii
% codes of characters. This is mostly unavoidable for performance
-% reasons: testing for instance with \cs{str_if_contains_char:nN}
+% reasons: testing for instance with \cs{__str_if_contains_char:nN}
% would be much slower. Maybe the tests can be optimized a little
% bit more.
% Here, \enquote{alphanumeric} means \texttt{0}--\texttt{9},
@@ -1487,41 +1496,41 @@
% but printable ascii, from space (hex \texttt{20}) to
% \texttt{del} (hex \texttt{7E}).
% \begin{macrocode}
-\prg_new_conditional:Npnn \regex_char_if_special:N #1 { TF }
+\prg_new_conditional:Npnn \@@_char_if_special:N #1 { TF }
{
- \if_num:w `#1 < \c_ninety_one
- \if_num:w `#1 < \c_fifty_eight
- \if_num:w `#1 < \c_forty_eight
- \if_num:w `#1 < \c_thirty_two
+ \if_int_compare:w `#1 < \c_ninety_one
+ \if_int_compare:w `#1 < \c_fifty_eight
+ \if_int_compare:w `#1 < \c_forty_eight
+ \if_int_compare:w `#1 < \c_thirty_two
\prg_return_false: \else: \prg_return_true: \fi:
\else: \prg_return_false: \fi:
\else:
- \if_num:w `#1 < \c_sixty_five
+ \if_int_compare:w `#1 < \c_sixty_five
\prg_return_true: \else: \prg_return_false: \fi:
\fi:
\else:
- \if_num:w `#1 < \c_one_hundred_twenty_three
- \if_num:w `#1 < \c_ninety_seven
+ \if_int_compare:w `#1 < \c_one_hundred_twenty_three
+ \if_int_compare:w `#1 < \c_ninety_seven
\prg_return_true: \else: \prg_return_false: \fi:
\else:
- \if_num:w `#1 < \c_one_hundred_twenty_seven
+ \if_int_compare:w `#1 < \c_one_hundred_twenty_seven
\prg_return_true: \else: \prg_return_false: \fi:
\fi:
\fi:
}
-\prg_new_conditional:Npnn \regex_char_if_alphanumeric:N #1 { TF }
+\prg_new_conditional:Npnn \@@_char_if_alphanumeric:N #1 { TF }
{
- \if_num:w `#1 < \c_ninety_one
- \if_num:w `#1 < \c_fifty_eight
- \if_num:w `#1 < \c_forty_eight
+ \if_int_compare:w `#1 < \c_ninety_one
+ \if_int_compare:w `#1 < \c_fifty_eight
+ \if_int_compare:w `#1 < \c_forty_eight
\prg_return_false: \else: \prg_return_true: \fi:
\else:
- \if_num:w `#1 < \c_sixty_five
+ \if_int_compare:w `#1 < \c_sixty_five
\prg_return_false: \else: \prg_return_true: \fi:
\fi:
\else:
- \if_num:w `#1 < \c_one_hundred_twenty_three
- \if_num:w `#1 < \c_ninety_seven
+ \if_int_compare:w `#1 < \c_one_hundred_twenty_three
+ \if_int_compare:w `#1 < \c_ninety_seven
\prg_return_false: \else: \prg_return_true: \fi:
\else:
\prg_return_false:
@@ -1539,152 +1548,152 @@
% then turned into states of an automaton in the building
% phase. Compiled regular expressions consist of the following:
% \begin{itemize}
-% \item \cs{regex_class:NnnnN} \meta{boolean} \Arg{tests} \Arg{min}
+% \item \cs{@@_class:NnnnN} \meta{boolean} \Arg{tests} \Arg{min}
% \Arg{more} \meta{lazyness}
-% \item \cs{regex_group:nnnN} \Arg{branches} \Arg{min} \Arg{more}
-% \meta{lazyness}, also \cs{regex_group_no_capture:nnnN} and
-% \cs{regex_group_resetting:nnnN} with the same syntax.
-% \item \cs{regex_branch:n} \Arg{contents}
-% \item \cs{regex_command_K:}
-% \item \cs{regex_assertion:Nn} \meta{boolean} \Arg{assertion test},
-% where the \meta{assertion test} is \cs{regex_b_test:} or
-% |{|\cs{regex_anchor:N} \meta{integer}|}|
+% \item \cs{@@_group:nnnN} \Arg{branches} \Arg{min} \Arg{more}
+% \meta{lazyness}, also \cs{@@_group_no_capture:nnnN} and
+% \cs{@@_group_resetting:nnnN} with the same syntax.
+% \item \cs{@@_branch:n} \Arg{contents}
+% \item \cs{@@_command_K:}
+% \item \cs{@@_assertion:Nn} \meta{boolean} \Arg{assertion test},
+% where the \meta{assertion test} is \cs{@@_b_test:} or
+% |{|\cs{@@_anchor:N} \meta{integer}|}|
% \end{itemize}
% Tests can be the following:
% \begin{itemize}
-% \item \cs{regex_item_caseful_equal:n} \Arg{char code}
-% \item \cs{regex_item_caseless_equal:n} \Arg{char code}
-% \item \cs{regex_item_caseful_range:nn} \Arg{min} \Arg{max}
-% \item \cs{regex_item_caseless_range:nn} \Arg{min} \Arg{max}
-% \item \cs{regex_item_catcode:nT} \Arg{catcode bitmap} \Arg{tests}
-% \item \cs{regex_item_catcode_reverse:nT} \Arg{catcode bitmap} \Arg{tests}
-% \item \cs{regex_item_reverse:n} \Arg{tests}
-% \item \cs{regex_item_exact:nn} \Arg{catcode} \Arg{char code}
-% \item \cs{regex_item_exact_cs:c} \Arg{csname}
-% \item \cs{regex_item_cs:n} \Arg{compiled regex}
+% \item \cs{@@_item_caseful_equal:n} \Arg{char code}
+% \item \cs{@@_item_caseless_equal:n} \Arg{char code}
+% \item \cs{@@_item_caseful_range:nn} \Arg{min} \Arg{max}
+% \item \cs{@@_item_caseless_range:nn} \Arg{min} \Arg{max}
+% \item \cs{@@_item_catcode:nT} \Arg{catcode bitmap} \Arg{tests}
+% \item \cs{@@_item_catcode_reverse:nT} \Arg{catcode bitmap} \Arg{tests}
+% \item \cs{@@_item_reverse:n} \Arg{tests}
+% \item \cs{@@_item_exact:nn} \Arg{catcode} \Arg{char code}
+% \item \cs{@@_item_exact_cs:c} \Arg{csname}
+% \item \cs{@@_item_cs:n} \Arg{compiled regex}
% \end{itemize}
%
% \subsubsection{Variables used when compiling}
%
-% \begin{variable}{\l_regex_group_level_int}
+% \begin{variable}{\l_@@_group_level_int}
% We make sure to open the same number of groups as we close.
% \begin{macrocode}
-\int_new:N \l_regex_group_level_int
+\int_new:N \l_@@_group_level_int
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_regex_mode_int}
+% \begin{variable}{\l_@@_mode_int}
% While compiling, ten modes are recognized, labelled $-63$, $-23$,
% $-6$, $-2$, $0$, $2$, $3$, $6$, $23$, $63$. See
% section~\ref{sec:regex-modes}.
% \begin{macrocode}
-\int_new:N \l_regex_mode_int
+\int_new:N \l_@@_mode_int
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_regex_catcodes_int, \l_regex_default_catcodes_int}
-% \begin{variable}{\l_regex_catcodes_bool}
+% \begin{variable}{\l_@@_catcodes_int, \l_@@_default_catcodes_int}
+% \begin{variable}{\l_@@_catcodes_bool}
% We wish to allow constructions such as |\c[^BE](..\cL[a-z]..)|,
% where the outer catcode test applies to the whole group, but is
% superseeded by the inner catcode test. For this to work, we need to
% keep track of lists of allowed category codes:
-% \cs{l_regex_catcodes_int} and \cs{l_regex_default_catcodes_int} are
+% \cs{l_@@_catcodes_int} and \cs{l_@@_default_catcodes_int} are
% bitmaps, sums of $4^c$, for all allowed catcodes $c$. The latter is
% local to each capturing group, and we reset
-% \cs{l_regex_catcodes_int} to that value after each character or
+% \cs{l_@@_catcodes_int} to that value after each character or
% class, changing it only when encountering a |\c| escape. The boolean
% records whether the list of categories of a catcode test has to be
% inverted: compare |\c[^BE]| and |\c[BE]|.
% \begin{macrocode}
-\int_new:N \l_regex_catcodes_int
-\int_new:N \l_regex_default_catcodes_int
-\bool_new:N \l_regex_catcodes_bool
+\int_new:N \l_@@_catcodes_int
+\int_new:N \l_@@_default_catcodes_int
+\bool_new:N \l_@@_catcodes_bool
% \end{macrocode}
% \end{variable}
% \end{variable}
%
% \begin{variable}
% {
-% \c_regex_catcode_C_int, \c_regex_catcode_B_int, \c_regex_catcode_E_int,
-% \c_regex_catcode_M_int, \c_regex_catcode_T_int, \c_regex_catcode_P_int,
-% \c_regex_catcode_U_int, \c_regex_catcode_D_int, \c_regex_catcode_S_int,
-% \c_regex_catcode_L_int, \c_regex_catcode_O_int, \c_regex_catcode_A_int
+% \c_@@_catcode_C_int, \c_@@_catcode_B_int, \c_@@_catcode_E_int,
+% \c_@@_catcode_M_int, \c_@@_catcode_T_int, \c_@@_catcode_P_int,
+% \c_@@_catcode_U_int, \c_@@_catcode_D_int, \c_@@_catcode_S_int,
+% \c_@@_catcode_L_int, \c_@@_catcode_O_int, \c_@@_catcode_A_int
% }
-% \begin{variable}{\c_regex_all_catcodes_int}
+% \begin{variable}{\c_@@_all_catcodes_int}
% Constants: $4^c$ for each category, and the sum of all powers of $4$.
% \begin{macrocode}
-\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 }
+\int_const:Nn \c_@@_catcode_C_int { "1 }
+\int_const:Nn \c_@@_catcode_B_int { "4 }
+\int_const:Nn \c_@@_catcode_E_int { "10 }
+\int_const:Nn \c_@@_catcode_M_int { "40 }
+\int_const:Nn \c_@@_catcode_T_int { "100 }
+\int_const:Nn \c_@@_catcode_P_int { "1000 }
+\int_const:Nn \c_@@_catcode_U_int { "4000 }
+\int_const:Nn \c_@@_catcode_D_int { "10000 }
+\int_const:Nn \c_@@_catcode_S_int { "100000 }
+\int_const:Nn \c_@@_catcode_L_int { "400000 }
+\int_const:Nn \c_@@_catcode_O_int { "1000000 }
+\int_const:Nn \c_@@_catcode_A_int { "4000000 }
+\int_const:Nn \c_@@_all_catcodes_int { "5515155 }
% \end{macrocode}
% \end{variable}
% \end{variable}
%
-% \begin{variable}{\l_regex_internal_regex}
+% \begin{variable}{\l_@@_internal_regex}
% The compilation step stores its result in this variable.
% \begin{macrocode}
-\cs_new_eq:NN \l_regex_internal_regex \c_regex_no_match_regex
+\cs_new_eq:NN \l_@@_internal_regex \c_@@_no_match_regex
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_regex_show_prefix_seq}
+% \begin{variable}{\l_@@_show_prefix_seq}
% This sequence holds the prefix that makes up the line displayed to
% the user. The various items must be removed from the right, which is
% tricky with a token list, hence we use a sequence.
% \begin{macrocode}
-\seq_new:N \l_regex_show_prefix_seq
+\seq_new:N \l_@@_show_prefix_seq
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_regex_show_lines_int}
+% \begin{variable}{\l_@@_show_lines_int}
% A hack. To know whether a given class has a single item in it or
% not, we count the number of lines when showing the class.
% \begin{macrocode}
-\int_new:N \l_regex_show_lines_int
+\int_new:N \l_@@_show_lines_int
% \end{macrocode}
% \end{variable}
%
% \subsubsection{Generic helpers used when compiling}
%
-% \begin{macro}[int]{\regex_get_digits:NTFw}
-% \begin{macro}[aux, rEXP]{\regex_get_digits_loop:w}
+% \begin{macro}[int]{\@@_get_digits:NTFw}
+% \begin{macro}[aux, rEXP]{\@@_get_digits_loop:w}
% If followed by some raw digits, collect them one by one in the
% integer variable |#1|, and take the \texttt{true} branch. Otherwise,
% take the \texttt{false} branch.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_get_digits:NTFw #1#2#3#4#5
+\cs_new_protected:Npn \@@_get_digits:NTFw #1#2#3#4#5
{
- \regex_if_raw_digit:NNTF #4 #5
- { #1 = #5 \regex_get_digits_loop:nw {#2} }
+ \@@_if_raw_digit:NNTF #4 #5
+ { #1 = #5 \@@_get_digits_loop:nw {#2} }
{ #3 #4 #5 }
}
-\cs_new:Npn \regex_get_digits_loop:nw #1#2#3
+\cs_new:Npn \@@_get_digits_loop:nw #1#2#3
{
- \regex_if_raw_digit:NNTF #2 #3
- { #3 \regex_get_digits_loop:nw {#1} }
+ \@@_if_raw_digit:NNTF #2 #3
+ { #3 \@@_get_digits_loop:nw {#1} }
{ \scan_stop: #1 #2 #3 }
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[aux, EXP]{\regex_if_raw_digit:NNTF}
+% \begin{macro}[aux, EXP]{\@@_if_raw_digit:NNTF}
% Test used when grabbing digits for the |{m,n}| quantifier.
% It only accepts non-escaped digits.
% \begin{macrocode}
-\prg_new_conditional:Npnn \regex_if_raw_digit:NN #1#2 { TF }
+\prg_new_conditional:Npnn \@@_if_raw_digit:NN #1#2 { TF }
{
- \if_meaning:w \regex_compile_raw:N #1
+ \if_meaning:w \@@_compile_raw:N #1
\if_int_compare:w \c_one < 1 #2 \exp_stop_f:
\prg_return_true:
\else:
@@ -1740,15 +1749,15 @@
% any mode.
% \end{itemize}
%
-% \begin{macro}[int, EXP]{\regex_if_in_class:TF}
+% \begin{macro}[int, EXP]{\@@_if_in_class:TF}
% Test whether we are directly in a character class (at the innermost
% level of nesting). There, many escape sequences are not recognized,
% and special characters are normal. Also, for every raw character, we
% must look ahead for a possible raw dash.
% \begin{macrocode}
-\cs_new_nopar:Npn \regex_if_in_class:TF
+\cs_new_nopar:Npn \@@_if_in_class:TF
{
- \if_int_odd:w \l_regex_mode_int
+ \if_int_odd:w \l_@@_mode_int
\exp_after:wN \use_i:nn
\else:
\exp_after:wN \use_ii:nn
@@ -1757,16 +1766,16 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int, EXP]{\regex_if_in_cs:TF}
+% \begin{macro}[int, EXP]{\@@_if_in_cs:TF}
% Right braces are special only directly inside control sequences (at
% the inner-most level of nesting, not counting groups).
% \begin{macrocode}
-\cs_new_nopar:Npn \regex_if_in_cs:TF
+\cs_new_nopar:Npn \@@_if_in_cs:TF
{
- \if_int_odd:w \l_regex_mode_int
+ \if_int_odd:w \l_@@_mode_int
\exp_after:wN \use_ii:nn
\else:
- \if_int_compare:w \l_regex_mode_int < \c_zero
+ \if_int_compare:w \l_@@_mode_int < \c_zero
\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
@@ -1776,16 +1785,16 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int, EXP]{\regex_if_in_class_or_catcode:TF}
+% \begin{macro}[int, EXP]{\@@_if_in_class_or_catcode:TF}
% Assertions are only allowed in modes $0$, $-2$, and $-6$,
% \emph{i.e.}, even, non-positive modes.
% \begin{macrocode}
-\cs_new_nopar:Npn \regex_if_in_class_or_catcode:TF
+\cs_new_nopar:Npn \@@_if_in_class_or_catcode:TF
{
- \if_int_odd:w \l_regex_mode_int
+ \if_int_odd:w \l_@@_mode_int
\exp_after:wN \use_i:nn
\else:
- \if_int_compare:w \l_regex_mode_int > \c_zero
+ \if_int_compare:w \l_@@_mode_int > \c_zero
\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
@@ -1795,15 +1804,15 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int, EXP]{\regex_if_within_catcode:TF}
+% \begin{macro}[int, EXP]{\@@_if_within_catcode:TF}
% This test takes the true branch if we are in a catcode test, either
% immediately following it (modes $2$ and $6$) or in a class on which
% it applies (modes $23$ and $63$). This is used to tweak how left
% brackets behave in modes $2$ and $6$.
% \begin{macrocode}
-\cs_new_nopar:Npn \regex_if_within_catcode:TF
+\cs_new_nopar:Npn \@@_if_within_catcode:TF
{
- \if_int_compare:w \l_regex_mode_int > \c_zero
+ \if_int_compare:w \l_@@_mode_int > \c_zero
\exp_after:wN \use_i:nn
\else:
\exp_after:wN \use_ii:nn
@@ -1812,19 +1821,19 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_chk_c_allowed:T}
+% \begin{macro}[aux]{\@@_chk_c_allowed:T}
% The |\c| escape sequence is only allowed in modes $0$ and $3$,
% \emph{i.e.}, not within any other |\c| escape sequence.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_chk_c_allowed:T
+\cs_new_protected:Npn \@@_chk_c_allowed:T
{
- \if_num:w \l_regex_mode_int = \c_zero
+ \if_int_compare:w \l_@@_mode_int = \c_zero
\exp_after:wN \use:n
\else:
- \if_num:w \l_regex_mode_int = \c_three
+ \if_int_compare:w \l_@@_mode_int = \c_three
\exp_after:wN \exp_after:wN \exp_after:wN \use:n
\else:
- \msg_kernel_error:nn { regex } { c-bad-mode }
+ \__msg_kernel_error:nn { regex } { c-bad-mode }
\exp_after:wN \exp_after:wN \exp_after:wN \use_none:n
\fi:
\fi:
@@ -1832,17 +1841,17 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_mode_quit_c:}
+% \begin{macro}[aux]{\@@_mode_quit_c:}
% This function changes the mode as it is needed just after a catcode
% test.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_mode_quit_c:
+\cs_new_protected:Npn \@@_mode_quit_c:
{
- \if_num:w \l_regex_mode_int = \c_two
- \l_regex_mode_int = \c_zero
+ \if_int_compare:w \l_@@_mode_int = \c_two
+ \l_@@_mode_int = \c_zero
\else:
- \if_num:w \l_regex_mode_int = \c_six
- \l_regex_mode_int = \c_three
+ \if_int_compare:w \l_@@_mode_int = \c_six
+ \l_@@_mode_int = \c_three
\fi:
\fi:
}
@@ -1851,214 +1860,214 @@
%
% \subsubsection{Framework}
%
-% \begin{macro}[int]{\regex_compile:w, \regex_compile_end:}
+% \begin{macro}[int]{\@@_compile:w, \@@_compile_end:}
% Used when compiling a user regex or a regex for the |\c{...}| escape
% sequence within another regex. Start building a token list within a
% group (with \texttt{x}-expansion at the outset), and set a few
% variables (group level, catcodes), then start the first branch. At
% the end, make sure there are no dangling classes nor groups, close
-% the last branch: we are done building \cs{l_regex_internal_regex}.
+% the last branch: we are done building \cs{l_@@_internal_regex}.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_compile:w
+\cs_new_protected_nopar:Npn \@@_compile:w
{
- \tl_set_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_nopar:Npn \regex_item_equal:n { \regex_item_caseful_equal:n }
- \cs_set_nopar:Npn \regex_item_range:nn { \regex_item_caseful_range:nn }
- \tl_build_one:n { \regex_branch:n { \if_false: } \fi: }
+ \__tl_build_x:Nw \l_@@_internal_regex
+ \int_zero:N \l_@@_group_level_int
+ \int_set_eq:NN \l_@@_default_catcodes_int \c_@@_all_catcodes_int
+ \int_set_eq:NN \l_@@_catcodes_int \l_@@_default_catcodes_int
+ \cs_set_nopar:Npn \@@_item_equal:n { \@@_item_caseful_equal:n }
+ \cs_set_nopar:Npn \@@_item_range:nn { \@@_item_caseful_range:nn }
+ \__tl_build_one:n { \@@_branch:n { \if_false: } \fi: }
}
-\cs_new_protected_nopar:Npn \regex_compile_end:
+\cs_new_protected_nopar:Npn \@@_compile_end:
{
- \regex_if_in_class:TF
+ \@@_if_in_class:TF
{
- \msg_kernel_error:nn { regex } { missing-rbrack }
- \use:c { regex_compile_]: }
+ \__msg_kernel_error:nn { regex } { missing-rbrack }
+ \use:c { @@_compile_]: }
\prg_do_nothing: \prg_do_nothing:
}
{ }
- \if_num:w \l_regex_group_level_int > \c_zero
- \msg_kernel_error:nnx { regex } { missing-rparen }
- { \int_use:N \l_regex_group_level_int }
+ \if_int_compare:w \l_@@_group_level_int > \c_zero
+ \__msg_kernel_error:nnx { regex } { missing-rparen }
+ { \int_use:N \l_@@_group_level_int }
\prg_replicate:nn
- { \l_regex_group_level_int }
+ { \l_@@_group_level_int }
{
- \tl_build_one:n
+ \__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
+ \__tl_build_end:
+ \__tl_build_one:o \l_@@_internal_regex
}
\fi:
- \tl_build_one:n { \if_false: { \fi: } }
- \tl_build_end:
+ \__tl_build_one:n { \if_false: { \fi: } }
+ \__tl_build_end:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_compile:n}
-% The compilation is done between \cs{regex_compile:w} and
-% \cs{regex_compile_end:}, starting in mode~$0$. Then
-% \cs{regex_escape_use:nnnn} distinguishes special characters, escaped
+% \begin{macro}[int]{\@@_compile:n}
+% The compilation is done between \cs{@@_compile:w} and
+% \cs{@@_compile_end:}, starting in mode~$0$. Then
+% \cs{@@_escape_use:nnnn} distinguishes special characters, escaped
% alphanumerics, and raw characters, interpreting |\a|, |\x| and other
% sequences. The $4$ trailing \cs{prg_do_nothing:} are needed because
% some functions defined later look up to $4$ tokens ahead. Before
% ending, make sure that any |\c{...}| is properly closed.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile:n #1
+\cs_new_protected:Npn \@@_compile:n #1
{
- \regex_compile:w
+ \@@_compile:w
\int_set:Nn \tex_escapechar:D { 92 }
- \int_set_eq:NN \l_regex_mode_int \c_zero
- \regex_escape_use:nnnn
+ \int_set_eq:NN \l_@@_mode_int \c_zero
+ \@@_escape_use:nnnn
{
- \regex_char_if_special:NTF ##1
- \regex_compile_special:N \regex_compile_raw:N ##1
+ \@@_char_if_special:NTF ##1
+ \@@_compile_special:N \@@_compile_raw:N ##1
}
{
- \regex_char_if_alphanumeric:NTF ##1
- \regex_compile_escaped:N \regex_compile_raw:N ##1
+ \@@_char_if_alphanumeric:NTF ##1
+ \@@_compile_escaped:N \@@_compile_raw:N ##1
}
- { \regex_compile_raw:N ##1 }
+ { \@@_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_zero
+ \int_compare:nNnT \l_@@_mode_int < \c_zero
{
- \msg_kernel_error:nn { regex } { c-missing-rbrace }
- \regex_compile_end:
- \regex_compile_one:x
- { \regex_item_cs:n { \exp_not:o \l_regex_internal_regex } }
+ \__msg_kernel_error:nn { regex } { c-missing-rbrace }
+ \@@_compile_end:
+ \@@_compile_one:x
+ { \@@_item_cs:n { \exp_not:o \l_@@_internal_regex } }
\prg_do_nothing: \prg_do_nothing:
\prg_do_nothing: \prg_do_nothing:
}
- \regex_compile_end:
+ \@@_compile_end:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_compile_escaped:N, \regex_compile_special:N}
+% \begin{macro}[int]{\@@_compile_escaped:N, \@@_compile_special:N}
% If the special character or escaped alphanumeric has a particular
% meaning in regexes, the corresponding function is used. Otherwise,
% it is interpreted as a raw character. We distinguish special
% characters from escaped alphanumeric characters because they behave
% differently when appearing as an end-point of a range.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile_special:N #1
+\cs_new_protected:Npn \@@_compile_special:N #1
{
- \cs_if_exist_use:cF { regex_compile_#1: }
- { \regex_compile_raw:N #1 }
+ \cs_if_exist_use:cF { @@_compile_#1: }
+ { \@@_compile_raw:N #1 }
}
-\cs_new_protected:Npn \regex_compile_escaped:N #1
+\cs_new_protected:Npn \@@_compile_escaped:N #1
{
- \cs_if_exist_use:cF { regex_compile_/#1: }
- { \regex_compile_raw:N #1 }
+ \cs_if_exist_use:cF { @@_compile_/#1: }
+ { \@@_compile_raw:N #1 }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_compile_one:x}
+% \begin{macro}[int]{\@@_compile_one:x}
% This is used after finding one \enquote{test}, such as |\d|, or a
% raw character. If that followed a catcode test (\emph{e.g.}, |\cL|),
% then restore the mode. If we are not in a class, then the test is
-% \enquote{standalone}, and we need to add \cs{regex_class:NnnnN} and
+% \enquote{standalone}, and we need to add \cs{@@_class:NnnnN} and
% search for quantifiers. In any case, insert the test, possibly
% together with a catcode test if appropriate.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile_one:x #1
+\cs_new_protected:Npn \@@_compile_one:x #1
{
- \regex_mode_quit_c:
- \regex_if_in_class:TF { }
+ \@@_mode_quit_c:
+ \@@_if_in_class:TF { }
{
- \tl_build_one:n
- { \regex_class:NnnnN \c_true_bool { \if_false: } \fi: }
+ \__tl_build_one:n
+ { \@@_class:NnnnN \c_true_bool { \if_false: } \fi: }
}
- \tl_build_one:x
+ \__tl_build_one:x
{
- \if_num:w \l_regex_catcodes_int < \c_regex_all_catcodes_int
- \regex_item_catcode:nT { \int_use:N \l_regex_catcodes_int }
+ \if_int_compare:w \l_@@_catcodes_int < \c_@@_all_catcodes_int
+ \@@_item_catcode:nT { \int_use:N \l_@@_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 }
+ \int_set_eq:NN \l_@@_catcodes_int \l_@@_default_catcodes_int
+ \@@_if_in_class:TF { } { \@@_compile_quantifier:w }
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}[int]
-% {\regex_compile_abort_tokens:n, \regex_compile_abort_tokens:x}
+% {\@@_compile_abort_tokens:n, \@@_compile_abort_tokens:x}
% This function places the collected tokens back in the input stream,
% each as a raw character. Spaces are not preserved.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile_abort_tokens:n #1
+\cs_new_protected:Npn \@@_compile_abort_tokens:n #1
{
\use:x
{
\exp_args:No \tl_map_function:nN { \tl_to_str:n {#1} }
- \regex_compile_raw:N
+ \@@_compile_raw:N
}
}
-\cs_generate_variant:Nn \regex_compile_abort_tokens:n { x }
+\cs_generate_variant:Nn \@@_compile_abort_tokens:n { x }
% \end{macrocode}
% \end{macro}
%
% \subsubsection{Quantifers}
%
-% \begin{macro}[int]{\regex_compile_quantifier:w}
+% \begin{macro}[int]{\@@_compile_quantifier:w}
% This looks ahead and finds any quantifier (special character equal
% to either of \texttt{?+*\{}).
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile_quantifier:w #1#2
+\cs_new_protected:Npn \@@_compile_quantifier:w #1#2
{
- \token_if_eq_meaning:NNTF #1 \regex_compile_special:N
+ \token_if_eq_meaning:NNTF #1 \@@_compile_special:N
{
- \cs_if_exist_use:cF { regex_compile_quantifier_#2:w }
- { \regex_compile_quantifier_none: #1 #2 }
+ \cs_if_exist_use:cF { @@_compile_quantifier_#2:w }
+ { \@@_compile_quantifier_none: #1 #2 }
}
- { \regex_compile_quantifier_none: #1 #2 }
+ { \@@_compile_quantifier_none: #1 #2 }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_compile_quantifier_none:}
-% \begin{macro}[aux]{\regex_compile_quantifier_abort:xNN}
+% \begin{macro}[aux]{\@@_compile_quantifier_none:}
+% \begin{macro}[aux]{\@@_compile_quantifier_abort:xNN}
% Those functions are called whenever there is no quantifier, or a
% braced construction is invalid (equivalent to no quantifier, and
% whatever characters were grabbed are left raw).
% \begin{macrocode}
-\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
+\cs_new_protected:Npn \@@_compile_quantifier_none:
+ { \__tl_build_one:n { \if_false: { \fi: } { 1 } { 0 } \c_false_bool } }
+\cs_new_protected:Npn \@@_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}
+ \@@_compile_quantifier_none:
+ \__msg_kernel_warning:nnxx { regex } { invalid-quantifier } {#1} {#3}
+ \@@_compile_abort_tokens:x {#1}
#2 #3
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_compile_quantifier_lazyness:nnNN}
+% \begin{macro}[aux]{\@@_compile_quantifier_lazyness:nnNN}
% Once the \enquote{main} quantifier (\texttt{?}, \texttt{*},
% \texttt{+} or a braced construction) is found, we check whether it
% is lazy (followed by a question mark). We then add to the compiled
-% regex a closing brace (ending \cs{regex_class:NnnnN} and friends),
+% regex a closing brace (ending \cs{@@_class:NnnnN} and friends),
% the start-point of the range, its end-point, and a boolean,
% \texttt{true} for lazy and \texttt{false} for greedy operators.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile_quantifier_lazyness:nnNN #1#2#3#4
+\cs_new_protected:Npn \@@_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 } }
+ \str_if_eq:nnTF { #3 #4 } { \@@_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 }
+ \__tl_build_one:n { \if_false: { \fi: } { #1 } { #2 } \c_false_bool }
#3 #4
}
}
@@ -2067,106 +2076,106 @@
%
% \begin{macro}[aux]
% {
-% \regex_compile_quantifier_?:w,
-% \regex_compile_quantifier_*:w,
-% \regex_compile_quantifier_+:w
+% \@@_compile_quantifier_?:w,
+% \@@_compile_quantifier_*:w,
+% \@@_compile_quantifier_+:w
% }
% For each \enquote{basic} quantifier, |?|, |*|, |+|, feed the correct
-% arguments to \cs{regex_compile_quantifier_lazyness:nnNN}, $-1$ means
+% arguments to \cs{@@_compile_quantifier_lazyness:nnNN}, $-1$ means
% that there is no upper bound on the number of repetitions.
% \begin{macrocode}
-\cs_new_protected_nopar:cpn { regex_compile_quantifier_?:w }
- { \regex_compile_quantifier_lazyness:nnNN { 0 } { 1 } }
-\cs_new_protected_nopar:cpn { regex_compile_quantifier_*:w }
- { \regex_compile_quantifier_lazyness:nnNN { 0 } { -1 } }
-\cs_new_protected_nopar:cpn { regex_compile_quantifier_+:w }
- { \regex_compile_quantifier_lazyness:nnNN { 1 } { -1 } }
+\cs_new_protected_nopar:cpn { @@_compile_quantifier_?:w }
+ { \@@_compile_quantifier_lazyness:nnNN { 0 } { 1 } }
+\cs_new_protected_nopar:cpn { @@_compile_quantifier_*:w }
+ { \@@_compile_quantifier_lazyness:nnNN { 0 } { -1 } }
+\cs_new_protected_nopar:cpn { @@_compile_quantifier_+:w }
+ { \@@_compile_quantifier_lazyness:nnNN { 1 } { -1 } }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]+\regex_compile_quantifier_{:w+ ^^A}
+% \begin{macro}[aux]+\@@_compile_quantifier_{:w+ ^^A}
% \begin{macro}[aux]
% {
-% \regex_compile_quantifier_braced_i:w,
-% \regex_compile_quantifier_braced_ii:w,
-% \regex_compile_quantifier_braced_iii:w,
+% \@@_compile_quantifier_braced_i:w,
+% \@@_compile_quantifier_braced_ii:w,
+% \@@_compile_quantifier_braced_iii:w,
% }
% Three possible syntaxes: \texttt{\{\meta{int}\}},
% \texttt{\{\meta{int},\}}, or \texttt{\{\meta{int},\meta{int}\}}. Any
% other syntax causes us to abort and put whatever we collected back
% in the input stream, as \texttt{raw} characters, including the
-% opening brace. Grab a number into \cs{l_regex_internal_a_int}. If
+% opening brace. Grab a number into \cs{l_@@_internal_a_int}. If
% the number is followed by a right brace, the range is $[a,a]$. If
% followed by a comma, grab one more number, and call the \texttt{_ii}
% or \texttt{_iii} auxiliary. Those auxiliaries check for a closing
% brace, leading to the range $[a,\infty]$ or $[a,b]$, encoded as
% $\{a\}\{-1\}$ and $\{a\}\{b-a\}$.
% \begin{macrocode}
-\cs_new_protected:cpn { regex_compile_quantifier_ \c_lbrace_str :w }
+\cs_new_protected:cpn { @@_compile_quantifier_ \c_lbrace_str :w }
{
- \regex_get_digits:NTFw \l_regex_internal_a_int
- { \regex_compile_quantifier_braced_i:w }
- { \regex_compile_quantifier_abort:xNN { \c_lbrace_str } }
+ \@@_get_digits:NTFw \l_@@_internal_a_int
+ { \@@_compile_quantifier_braced_i:w }
+ { \@@_compile_quantifier_abort:xNN { \c_lbrace_str } }
}
-\cs_new_protected:Npn \regex_compile_quantifier_braced_i:w #1#2
+\cs_new_protected:Npn \@@_compile_quantifier_braced_i:w #1#2
{
- \prg_case_str:xxn { #1 #2 }
+ \str_case_x:nnn { #1 #2 }
{
- { \regex_compile_special:N \c_rbrace_str }
+ { \@@_compile_special:N \c_rbrace_str }
{
- \exp_args:No \regex_compile_quantifier_lazyness:nnNN
- { \int_use:N \l_regex_internal_a_int } { 0 }
+ \exp_args:No \@@_compile_quantifier_lazyness:nnNN
+ { \int_use:N \l_@@_internal_a_int } { 0 }
}
- { \regex_compile_special:N , }
+ { \@@_compile_special:N , }
{
- \regex_get_digits:NTFw \l_regex_internal_b_int
- { \regex_compile_quantifier_braced_iii:w }
- { \regex_compile_quantifier_braced_ii:w }
+ \@@_get_digits:NTFw \l_@@_internal_b_int
+ { \@@_compile_quantifier_braced_iii:w }
+ { \@@_compile_quantifier_braced_ii:w }
}
}
{
- \regex_compile_quantifier_abort:xNN
- { \c_lbrace_str \int_use:N \l_regex_internal_a_int }
+ \@@_compile_quantifier_abort:xNN
+ { \c_lbrace_str \int_use:N \l_@@_internal_a_int }
#1 #2
}
}
-\cs_new_protected:Npn \regex_compile_quantifier_braced_ii:w #1#2
+\cs_new_protected:Npn \@@_compile_quantifier_braced_ii:w #1#2
{
- \str_if_eq:xxTF
- { #1 #2 } { \regex_compile_special:N \c_rbrace_str }
+ \str_if_eq_x:nnTF
+ { #1 #2 } { \@@_compile_special:N \c_rbrace_str }
{
- \exp_args:No \regex_compile_quantifier_lazyness:nnNN
- { \int_use:N \l_regex_internal_a_int } { -1 }
+ \exp_args:No \@@_compile_quantifier_lazyness:nnNN
+ { \int_use:N \l_@@_internal_a_int } { -1 }
}
{
- \regex_compile_quantifier_abort:xNN
- { \c_lbrace_str \int_use:N \l_regex_internal_a_int , }
+ \@@_compile_quantifier_abort:xNN
+ { \c_lbrace_str \int_use:N \l_@@_internal_a_int , }
#1 #2
}
}
-\cs_new_protected:Npn \regex_compile_quantifier_braced_iii:w #1#2
+\cs_new_protected:Npn \@@_compile_quantifier_braced_iii:w #1#2
{
- \str_if_eq:xxTF
- { #1 #2 } { \regex_compile_special:N \c_rbrace_str }
+ \str_if_eq_x:nnTF
+ { #1 #2 } { \@@_compile_special:N \c_rbrace_str }
{
- \if_num: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
+ \if_int_compare:w \l_@@_internal_a_int > \l_@@_internal_b_int
+ \__msg_kernel_error:nnxx { regex } { backwards-quantifier }
+ { \int_use:N \l_@@_internal_a_int }
+ { \int_use:N \l_@@_internal_b_int }
+ \int_zero:N \l_@@_internal_b_int
\else:
- \int_sub:Nn \l_regex_internal_b_int \l_regex_internal_a_int
+ \int_sub:Nn \l_@@_internal_b_int \l_@@_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 }
+ \exp_args:Noo \@@_compile_quantifier_lazyness:nnNN
+ { \int_use:N \l_@@_internal_a_int }
+ { \int_use:N \l_@@_internal_b_int }
}
{
- \regex_compile_quantifier_abort:xNN
+ \@@_compile_quantifier_abort:xNN
{
\c_lbrace_str
- \int_use:N \l_regex_internal_a_int ,
- \int_use:N \l_regex_internal_b_int
+ \int_use:N \l_@@_internal_a_int ,
+ \int_use:N \l_@@_internal_b_int
}
#1 #2
}
@@ -2177,57 +2186,57 @@
%
% \subsubsection{Raw characters}
%
-% \begin{macro}[int]{\regex_compile_raw_error:N}
+% \begin{macro}[int]{\@@_compile_raw_error:N}
% Within character classes, and following catcode tests, some escaped
% alphanumeric sequences such as |\b| do not have any meaning. They
% are replaced by a raw character, after spitting out an error.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile_raw_error:N #1
+\cs_new_protected:Npn \@@_compile_raw_error:N #1
{
- \msg_kernel_error:nnx { regex } { bad-escape } {#1}
- \regex_compile_raw:N #1
+ \__msg_kernel_error:nnx { regex } { bad-escape } {#1}
+ \@@_compile_raw:N #1
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_compile_raw:N}
+% \begin{macro}[int]{\@@_compile_raw:N}
% If we are in a character class and the next character is an
% unescaped dash, this denotes a range. Otherwise, the current
% character |#1| matches itself.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile_raw:N #1#2#3
+\cs_new_protected:Npn \@@_compile_raw:N #1#2#3
{
- \regex_if_in_class:TF
+ \@@_if_in_class:TF
{
- \str_if_eq:nnTF {#2#3} { \regex_compile_special:N - }
- { \regex_compile_range:Nw #1 }
+ \str_if_eq:nnTF {#2#3} { \@@_compile_special:N - }
+ { \@@_compile_range:Nw #1 }
{
- \regex_compile_one:x
- { \regex_item_equal:n { \int_value:w `#1 ~ } }
+ \@@_compile_one:x
+ { \@@_item_equal:n { \__int_value:w `#1 ~ } }
#2 #3
}
}
{
- \regex_compile_one:x
- { \regex_item_equal:n { \int_value:w `#1 ~ } }
+ \@@_compile_one:x
+ { \@@_item_equal:n { \__int_value:w `#1 ~ } }
#2 #3
}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_compile_range:Nw, \regex_if_end_range:NNTF}
+% \begin{macro}[aux]{\@@_compile_range:Nw, \@@_if_end_range:NNTF}
% We have just read a raw character followed by a dash; this should be
% followed by an end-point for the range. Valid end-points are: any
% raw character; any special character, except a right bracket. In
% particular, escaped characters are forbidden.
% \begin{macrocode}
-\prg_new_protected_conditional:Npnn \regex_if_end_range:NN #1#2 { TF }
+\prg_new_protected_conditional:Npnn \@@_if_end_range:NN #1#2 { TF }
{
- \if_meaning:w \regex_compile_raw:N #1
+ \if_meaning:w \@@_compile_raw:N #1
\prg_return_true:
\else:
- \if_meaning:w \regex_compile_special:N #1
+ \if_meaning:w \@@_compile_special:N #1
\if_charcode:w ] #2
\prg_return_false:
\else:
@@ -2238,31 +2247,31 @@
\fi:
\fi:
}
-\cs_new_protected:Npn \regex_compile_range:Nw #1#2#3
+\cs_new_protected:Npn \@@_compile_range:Nw #1#2#3
{
- \regex_if_end_range:NNTF #2 #3
+ \@@_if_end_range:NNTF #2 #3
{
- \if_num:w `#1 > `#3 \exp_stop_f:
- \msg_kernel_error:nnxx { regex } { range-backwards } {#1} {#3}
+ \if_int_compare:w `#1 > `#3 \exp_stop_f:
+ \__msg_kernel_error:nnxx { regex } { range-backwards } {#1} {#3}
\else:
- \tl_build_one:x
+ \__tl_build_one:x
{
- \if_num:w `#1 = `#3 \exp_stop_f:
- \regex_item_equal:n
+ \if_int_compare:w `#1 = `#3 \exp_stop_f:
+ \@@_item_equal:n
\else:
- \regex_item_range:nn { \int_value:w `#1 ~ }
+ \@@_item_range:nn { \__int_value:w `#1 ~ }
\fi:
- { \int_value:w `#3 ~ }
+ { \__int_value:w `#3 ~ }
}
\fi:
}
{
- \msg_kernel_warning:nnxx { regex } { range-missing-end }
+ \__msg_kernel_warning:nnxx { regex } { range-missing-end }
{#1} { \c_backslash_str #3 }
- \tl_build_one:x
+ \__tl_build_one:x
{
- \regex_item_equal:n { \int_value:w `#1 ~ }
- \regex_item_equal:n { \int_value:w `- ~ }
+ \@@_item_equal:n { \__int_value:w `#1 ~ }
+ \@@_item_equal:n { \__int_value:w `- ~ }
}
#2#3
}
@@ -2272,21 +2281,21 @@
%
% \subsubsection{Character properties}
%
-% \begin{macro}[aux]{\regex_compile_.:, \regex_prop_.:}
+% \begin{macro}[aux]{\@@_compile_.:, \@@_prop_.:}
% In a class, the dot has no special meaning. Outside, insert
-% \cs{regex_prop_.:}, which matches any character or control
+% \cs{@@_prop_.:}, which matches any character or control
% sequence, and refuses $-2$ (end-marker).
% \begin{macrocode}
-\cs_new_protected_nopar:cpx { regex_compile_.: }
+\cs_new_protected_nopar:cpx { @@_compile_.: }
{
- \exp_not:N \regex_if_in_class:TF
- { \regex_compile_raw:N . }
- { \regex_compile_one:x \exp_not:c { regex_prop_.: } }
+ \exp_not:N \@@_if_in_class:TF
+ { \@@_compile_raw:N . }
+ { \@@_compile_one:x \exp_not:c { @@_prop_.: } }
}
-\cs_new_protected_nopar:cpn { regex_prop_.: }
+\cs_new_protected_nopar:cpn { @@_prop_.: }
{
- \if_num:w \l_regex_current_char_int > - \c_two
- \exp_after:wN \regex_break_true:w
+ \if_int_compare:w \l_@@_current_char_int > - \c_two
+ \exp_after:wN \@@_break_true:w
\fi:
}
% \end{macrocode}
@@ -2294,75 +2303,75 @@
%
% \begin{macro}[aux]
% {
-% \regex_compile_/d:, \regex_compile_/D:,
-% \regex_compile_/h:, \regex_compile_/H:,
-% \regex_compile_/s:, \regex_compile_/S:,
-% \regex_compile_/v:, \regex_compile_/V:,
-% \regex_compile_/w:, \regex_compile_/W:,
-% \regex_compile_/N:,
+% \@@_compile_/d:, \@@_compile_/D:,
+% \@@_compile_/h:, \@@_compile_/H:,
+% \@@_compile_/s:, \@@_compile_/S:,
+% \@@_compile_/v:, \@@_compile_/V:,
+% \@@_compile_/w:, \@@_compile_/W:,
+% \@@_compile_/N:,
% }
-% The constants \cs{regex_prop_d:}, \emph{etc.} hold
+% The constants \cs{@@_prop_d:}, \emph{etc.} hold
% a list of tests which match the corresponding character
-% class, and jump to the \cs{regex_break_point:TF} marker.
+% class, and jump to the \cs{@@_break_point:TF} marker.
% As for a normal character, we check for quantifiers.
% \begin{macrocode}
-\cs_set_protected:Npn \regex_tmp:w #1#2
+\cs_set_protected:Npn \@@_tmp:w #1#2
{
- \cs_new_protected_nopar:cpx { regex_compile_/#1: }
- { \regex_compile_one:x \exp_not:c { regex_prop_#1: } }
- \cs_new_protected_nopar:cpx { regex_compile_/#2: }
+ \cs_new_protected_nopar:cpx { @@_compile_/#1: }
+ { \@@_compile_one:x \exp_not:c { @@_prop_#1: } }
+ \cs_new_protected_nopar:cpx { @@_compile_/#2: }
{
- \regex_compile_one:x
- { \regex_item_reverse:n \exp_not:c { regex_prop_#1: } }
+ \@@_compile_one:x
+ { \@@_item_reverse:n \exp_not:c { @@_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_nopar:cpn { regex_compile_/N: }
- { \regex_compile_one:x \regex_prop_N: }
+\@@_tmp:w d D
+\@@_tmp:w h H
+\@@_tmp:w s S
+\@@_tmp:w v V
+\@@_tmp:w w W
+\cs_new_protected_nopar:cpn { @@_compile_/N: }
+ { \@@_compile_one:x \@@_prop_N: }
% \end{macrocode}
% \end{macro}
%
% \subsubsection{Anchoring and simple assertions}
%
-% \begin{macro}[aux]{\regex_compile_anchor:NF}
-% \begin{macro}[aux]+\regex_compile_^:+
-% \begin{macro}[aux]{\regex_compile_/A:, \regex_compile_/G:}
-% \begin{macro}[aux]+\regex_compile_$:+
-% \begin{macro}[aux]{\regex_compile_/Z:, \regex_compile_/z:}
+% \begin{macro}[aux]{\@@_compile_anchor:NF}
+% \begin{macro}[aux]+\@@_compile_^:+
+% \begin{macro}[aux]{\@@_compile_/A:, \@@_compile_/G:}
+% \begin{macro}[aux]+\@@_compile_$:+
+% \begin{macro}[aux]{\@@_compile_/Z:, \@@_compile_/z:}
% In modes where assertions are allowed, anchor to the start of the
% query, the start of the match, or the end of the query, depending on
% the integer |#1|. In other modes, |#2| treats the character as raw,
% with an error for escaped letters (|$| is valid in a class, but |\A|
% is definitely a mistake on the user's part).
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile_anchor:NF #1#2
+\cs_new_protected:Npn \@@_compile_anchor:NF #1#2
{
- \regex_if_in_class_or_catcode:TF {#2}
+ \@@_if_in_class_or_catcode:TF {#2}
{
- \tl_build_one:n
- { \regex_assertion:Nn \c_true_bool { \regex_anchor:N #1 } }
+ \__tl_build_one:n
+ { \@@_assertion:Nn \c_true_bool { \@@_anchor:N #1 } }
}
}
-\cs_set_protected:Npn \regex_tmp:w #1#2
+\cs_set_protected:Npn \@@_tmp:w #1#2
{
- \cs_new_protected_nopar:cpn { regex_compile_/#1: }
- { \regex_compile_anchor:NF #2 { \regex_compile_raw_error:N #1 } }
+ \cs_new_protected_nopar:cpn { @@_compile_/#1: }
+ { \@@_compile_anchor:NF #2 { \@@_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
+\@@_tmp:w A \l_@@_min_pos_int
+\@@_tmp:w G \l_@@_start_pos_int
+\@@_tmp:w Z \l_@@_max_pos_int
+\@@_tmp:w z \l_@@_max_pos_int
+\cs_set_protected:Npn \@@_tmp:w #1#2
{
- \cs_new_protected_nopar:cpn { regex_compile_#1: }
- { \regex_compile_anchor:NF #2 { \regex_compile_raw:N #1 } }
+ \cs_new_protected_nopar:cpn { @@_compile_#1: }
+ { \@@_compile_anchor:NF #2 { \@@_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
+\exp_args:Nx \@@_tmp:w { \iow_char:N \^ } \l_@@_min_pos_int
+\exp_args:Nx \@@_tmp:w { \iow_char:N \$ } \l_@@_max_pos_int
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -2370,27 +2379,27 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_compile_/b:, \regex_compile_/B:}
+% \begin{macro}[aux]{\@@_compile_/b:, \@@_compile_/B:}
% Contrarily to |^| and |$|, which could be implemented without really
% knowing what precedes in the token list, this requires more
% information, namely, the knowledge of the last character code.
% \begin{macrocode}
-\cs_new_protected_nopar:cpn { regex_compile_/b: }
+\cs_new_protected_nopar:cpn { @@_compile_/b: }
{
- \regex_if_in_class_or_catcode:TF
- { \regex_compile_raw_error:N b }
+ \@@_if_in_class_or_catcode:TF
+ { \@@_compile_raw_error:N b }
{
- \tl_build_one:n
- { \regex_assertion:Nn \c_true_bool { \regex_b_test: } }
+ \__tl_build_one:n
+ { \@@_assertion:Nn \c_true_bool { \@@_b_test: } }
}
}
-\cs_new_protected_nopar:cpn { regex_compile_/B: }
+\cs_new_protected_nopar:cpn { @@_compile_/B: }
{
- \regex_if_in_class_or_catcode:TF
- { \regex_compile_raw_error:N B }
+ \@@_if_in_class_or_catcode:TF
+ { \@@_compile_raw_error:N B }
{
- \tl_build_one:n
- { \regex_assertion:Nn \c_false_bool { \regex_b_test: } }
+ \__tl_build_one:n
+ { \@@_assertion:Nn \c_false_bool { \@@_b_test: } }
}
}
% \end{macrocode}
@@ -2398,116 +2407,116 @@
%
% \subsubsection{Character classes}
%
-% \begin{macro}[aux]{\regex_compile_]:}
+% \begin{macro}[aux]{\@@_compile_]:}
% Outside a class, right brackets have no meaning. In a class, change
% the mode ($m\to (m-15)/13$, truncated) to reflect the fact that we
% are leaving the class. Look for quantifiers, unless we are still in
% a class after leaving one (the case of |[...\cL[...]...]|).
% quantifiers.
% \begin{macrocode}
-\cs_new_protected:cpn { regex_compile_]: }
+\cs_new_protected:cpn { @@_compile_]: }
{
- \regex_if_in_class:TF
+ \@@_if_in_class:TF
{
- \if_num:w \l_regex_mode_int > \c_sixteen
- \tl_build_one:n { \if_false: { \fi: } }
+ \if_int_compare:w \l_@@_mode_int > \c_sixteen
+ \__tl_build_one:n { \if_false: { \fi: } }
\fi:
- \tex_advance:D \l_regex_mode_int - \c_fifteen
- \tex_divide:D \l_regex_mode_int \c_thirteen
- \if_int_odd:w \l_regex_mode_int \else:
- \exp_after:wN \regex_compile_quantifier:w
+ \tex_advance:D \l_@@_mode_int - \c_fifteen
+ \tex_divide:D \l_@@_mode_int \c_thirteen
+ \if_int_odd:w \l_@@_mode_int \else:
+ \exp_after:wN \@@_compile_quantifier:w
\fi:
}
- { \regex_compile_raw:N ] }
+ { \@@_compile_raw:N ] }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_compile_[:}
+% \begin{macro}[aux]{\@@_compile_[:}
% In a class, left brackets might introduce a \textsc{posix} character
% class, or mean nothing. Immediately following |\c|\meta{category},
% we must insert the apropriate catcode test, then parse the class; we
% pre-expand the catcode as an optimization. Otherwise (modes $0$,
% $-2$ and $-6$) just parse the class. The mode is updated later.
% \begin{macrocode}
-\cs_new_protected_nopar:cpn { regex_compile_[: }
+\cs_new_protected_nopar:cpn { @@_compile_[: }
{
- \regex_if_in_class:TF
- { \regex_compile_class_posix_test:w }
+ \@@_if_in_class:TF
+ { \@@_compile_class_posix_test:w }
{
- \regex_if_within_catcode:TF
+ \@@_if_within_catcode:TF
{
- \exp_after:wN \regex_compile_class_catcode:w
- \int_use:N \l_regex_catcodes_int ;
+ \exp_after:wN \@@_compile_class_catcode:w
+ \int_use:N \l_@@_catcodes_int ;
}
- { \regex_compile_class_normal:w }
+ { \@@_compile_class_normal:w }
}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_compile_class_normal:w}
-% In the \enquote{normal} case, we will insert \cs{regex_class:NnnnN}
+% \begin{macro}[aux]{\@@_compile_class_normal:w}
+% In the \enquote{normal} case, we will insert \cs{@@_class:NnnnN}
% \meta{boolean} in the compiled code. The \meta{boolean} is true for
% positive classes, and false for negative classes, characterized by a
-% leading |^|. The auxiliary \cs{regex_compile_class:TFNN} also
+% leading |^|. The auxiliary \cs{@@_compile_class:TFNN} also
% checks for a leading |]| which has a special meaning.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_compile_class_normal:w
+\cs_new_protected_nopar:Npn \@@_compile_class_normal:w
{
- \regex_compile_class:TFNN
- { \regex_class:NnnnN \c_true_bool }
- { \regex_class:NnnnN \c_false_bool }
+ \@@_compile_class:TFNN
+ { \@@_class:NnnnN \c_true_bool }
+ { \@@_class:NnnnN \c_false_bool }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_compile_class_catcode:w}
+% \begin{macro}[aux]{\@@_compile_class_catcode:w}
% This function is called for a left bracket in modes $2$ or $6$
% (catcode test, and catcode test within a class). In mode $2$ the
% whole construction needs to be put in a class (like single
% character). Then determine if the class is positive or negative,
-% inserting \cs{regex_item_catcode:nT} or the \texttt{reverse} variant
+% inserting \cs{@@_item_catcode:nT} or the \texttt{reverse} variant
% as appropriate, each with the current catcodes bitmap |#1| as an
% argument, and reset the catcodes.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile_class_catcode:w #1;
+\cs_new_protected:Npn \@@_compile_class_catcode:w #1;
{
- \if_int_compare:w \l_regex_mode_int = \c_two
- \tl_build_one:n
- { \regex_class:NnnnN \c_true_bool { \if_false: } \fi: }
+ \if_int_compare:w \l_@@_mode_int = \c_two
+ \__tl_build_one:n
+ { \@@_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} }
+ \int_set_eq:NN \l_@@_catcodes_int \l_@@_default_catcodes_int
+ \@@_compile_class:TFNN
+ { \@@_item_catcode:nT {#1} }
+ { \@@_item_catcode_reverse:nT {#1} }
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}[aux]
-% {\regex_compile_class:TFNN, \regex_compile_class_ii:NN}
+% {\@@_compile_class:TFNN, \@@_compile_class_ii:NN}
% If the first character is |^|, then the class is negative (use
% |#2|), otherwise it is positive (use |#1|). If the next character
% is a right bracket, then it should be changed to a raw one.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile_class:TFNN #1#2#3#4
+\cs_new_protected:Npn \@@_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 ^ }
+ \l_@@_mode_int = \__int_value:w \l_@@_mode_int 3 \exp_stop_f:
+ \str_if_eq:nnTF { #3 #4 } { \@@_compile_special:N ^ }
{
- \tl_build_one:n { #2 { \if_false: } \fi: }
- \regex_compile_class_ii:NN
+ \__tl_build_one:n { #2 { \if_false: } \fi: }
+ \@@_compile_class_ii:NN
}
{
- \tl_build_one:n { #1 { \if_false: } \fi: }
- \regex_compile_class_ii:NN #3 #4
+ \__tl_build_one:n { #1 { \if_false: } \fi: }
+ \@@_compile_class_ii:NN #3 #4
}
}
-\cs_new_protected:Npn \regex_compile_class_ii:NN #1#2
+\cs_new_protected:Npn \@@_compile_class_ii:NN #1#2
{
\token_if_eq_charcode:NNTF #2 ]
- { \regex_compile_raw:N #2 }
+ { \@@_compile_raw:N #2 }
{ #1 #2 }
}
% \end{macrocode}
@@ -2515,80 +2524,80 @@
%
% \begin{macro}[aux]
% {
-% \regex_compile_class_posix_test:w,
-% \regex_compile_class_posix:NNNNw,
-% \regex_compile_class_posix_loop:w,
-% \regex_compile_class_posix_end:w
+% \@@_compile_class_posix_test:w,
+% \@@_compile_class_posix:NNNNw,
+% \@@_compile_class_posix_loop:w,
+% \@@_compile_class_posix_end:w
% }
% Here we check for a syntax such as |[:alpha:]|. We also detect |[=|
% and |[.| which have a meaning in \textsc{posix} regular expressions,
% but are not implemented in \pkg{l3regex}. In case we see |[:|, grab
% raw characters until hopefully reaching |:]|. If that's missing, or
% the \textsc{posix} class is unknown, abort. If all is right, add the
-% test to the current class, with an extra \cs{regex_item_reverse:n}
+% test to the current class, with an extra \cs{@@_item_reverse:n}
% for negative classes.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile_class_posix_test:w #1#2
+\cs_new_protected:Npn \@@_compile_class_posix_test:w #1#2
{
- \token_if_eq_meaning:NNT \regex_compile_special:N #1
+ \token_if_eq_meaning:NNT \@@_compile_special:N #1
{
- \prg_case_str:nnn { #2 }
+ \str_case:nnn { #2 }
{
- : { \regex_compile_class_posix:NNNNw }
- = { \msg_kernel_warning:nnx { regex } { posix-unsupported } { = } }
- . { \msg_kernel_warning:nnx { regex } { posix-unsupported } { . } }
+ : { \@@_compile_class_posix:NNNNw }
+ = { \__msg_kernel_warning:nnx { regex } { posix-unsupported } { = } }
+ . { \__msg_kernel_warning:nnx { regex } { posix-unsupported } { . } }
}
{ }
}
- \regex_compile_raw:N [ #1 #2
+ \@@_compile_raw:N [ #1 #2
}
-\cs_new_protected:Npn \regex_compile_class_posix:NNNNw #1#2#3#4#5#6
+\cs_new_protected:Npn \@@_compile_class_posix:NNNNw #1#2#3#4#5#6
{
- \str_if_eq:nnTF { #5 #6 } { \regex_compile_special:N ^ }
+ \str_if_eq:nnTF { #5 #6 } { \@@_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_false:N \l_@@_internal_bool
+ \tl_set:Nx \l_@@_internal_a_tl { \if_false: } \fi:
+ \@@_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
+ \bool_set_true:N \l_@@_internal_bool
+ \tl_set:Nx \l_@@_internal_a_tl { \if_false: } \fi:
+ \@@_compile_class_posix_loop:w #5 #6
}
}
-\cs_new:Npn \regex_compile_class_posix_loop:w #1#2
+\cs_new:Npn \@@_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 }
+ \token_if_eq_meaning:NNTF \@@_compile_raw:N #1
+ { #2 \@@_compile_class_posix_loop:w }
+ { \if_false: { \fi: } \@@_compile_class_posix_end:w #1 #2 }
}
-\cs_new_protected:Npn \regex_compile_class_posix_end:w #1#2#3#4
+\cs_new_protected:Npn \@@_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 ] }
+ { \@@_compile_special:N : \@@_compile_special:N ] }
{
- \cs_if_exist:cTF { regex_posix_ \l_regex_internal_a_tl : }
+ \cs_if_exist:cTF { @@_posix_ \l_@@_internal_a_tl : }
{
- \regex_compile_one:x
+ \@@_compile_one:x
{
- \bool_if:NF \l_regex_internal_bool \regex_item_reverse:n
- \exp_not:c { regex_posix_ \l_regex_internal_a_tl : }
+ \bool_if:NF \l_@@_internal_bool \@@_item_reverse:n
+ \exp_not:c { @@_posix_ \l_@@_internal_a_tl : }
}
}
{
- \msg_kernel_warning:nnx { regex } { posix-unknown }
- { \l_regex_internal_a_tl }
- \regex_compile_abort_tokens:x
+ \__msg_kernel_warning:nnx { regex } { posix-unknown }
+ { \l_@@_internal_a_tl }
+ \@@_compile_abort_tokens:x
{
- [: \bool_if:NF \l_regex_internal_bool { ^ }
- \l_regex_internal_a_tl :]
+ [: \bool_if:NF \l_@@_internal_bool { ^ }
+ \l_@@_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 }
+ \__msg_kernel_error:nnxx { regex } { posix-missing-close }
+ { [: \l_@@_internal_a_tl } { #2 #4 }
+ \@@_compile_abort_tokens:x { [: \l_@@_internal_a_tl }
#1 #2 #3 #4
}
}
@@ -2597,149 +2606,149 @@
%
% \subsubsection{Groups and alternations}
%
-% \begin{macro}[aux]{\regex_compile_group_begin:N, \regex_compile_group_end:}
+% \begin{macro}[aux]{\@@_compile_group_begin:N, \@@_compile_group_end:}
% The contents of a regex group are turned into compiled code in
-% \cs{l_regex_internal_regex}, which ends up with items of the form
-% \cs{regex_branch:n} \Arg{concatenation}. This construction is done
+% \cs{l_@@_internal_regex}, which ends up with items of the form
+% \cs{@@_branch:n} \Arg{concatenation}. This construction is done
% using \pkg{l3tl-build} within a \TeX{} group, which automatically
% makes sure that options (case-sensitivity and default catcode) are
% reset at the end of the group. The argument |#1| is
-% \cs{regex_group:nnnN} or a variant thereof. A small subtelty to
+% \cs{@@_group:nnnN} or a variant thereof. A small subtelty to
% support |\cL(abc)| as a shorthand for |(\cLa\cLb\cLc)|: exit any
% pending catcode test, save the category code at the start of the
% group as the default catcode for that group, and make sure that the
% catcode is restored to the default outside the group.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile_group_begin:N #1
+\cs_new_protected:Npn \@@_compile_group_begin:N #1
{
- \tl_build_one:n { #1 { \if_false: } \fi: }
- \regex_mode_quit_c:
- \tl_set_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: }
+ \__tl_build_one:n { #1 { \if_false: } \fi: }
+ \@@_mode_quit_c:
+ \__tl_build:Nw \l_@@_internal_regex
+ \int_set_eq:NN \l_@@_default_catcodes_int \l_@@_catcodes_int
+ \int_incr:N \l_@@_group_level_int
+ \__tl_build_one:n { \@@_branch:n { \if_false: } \fi: }
}
-\cs_new_protected:Npn \regex_compile_group_end:
+\cs_new_protected:Npn \@@_compile_group_end:
{
- \if_num:w \l_regex_group_level_int > \c_zero
- \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
+ \if_int_compare:w \l_@@_group_level_int > \c_zero
+ \__tl_build_one:n { \if_false: { \fi: } }
+ \__tl_build_end:
+ \int_set_eq:NN \l_@@_catcodes_int \l_@@_default_catcodes_int
+ \__tl_build_one:o \l_@@_internal_regex
+ \exp_after:wN \@@_compile_quantifier:w
\else:
- \msg_kernel_warning:nn { regex } { extra-rparen }
- \exp_after:wN \regex_compile_raw:N \exp_after:wN )
+ \__msg_kernel_warning:nn { regex } { extra-rparen }
+ \exp_after:wN \@@_compile_raw:N \exp_after:wN )
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_compile_(:}
+% \begin{macro}[aux]{\@@_compile_(:}
% In a class, parentheses are not special. Outside, check for a |?|,
% denoting special groups, and run the code for the corresponding
% special group.
% \begin{macrocode}
-\cs_new_protected_nopar:cpn { regex_compile_(: }
+\cs_new_protected_nopar:cpn { @@_compile_(: }
{
- \regex_if_in_class:TF { \regex_compile_raw:N ( }
- { \regex_compile_lparen:w }
+ \@@_if_in_class:TF { \@@_compile_raw:N ( }
+ { \@@_compile_lparen:w }
}
-\cs_new_protected:Npn \regex_compile_lparen:w #1#2#3#4
+\cs_new_protected:Npn \@@_compile_lparen:w #1#2#3#4
{
- \str_if_eq:nnTF { #1 #2 } { \regex_compile_special:N ? }
+ \str_if_eq:nnTF { #1 #2 } { \@@_compile_special:N ? }
{
\cs_if_exist_use:cF
- { regex_compile_special_group_\token_to_str:N #4 :w }
+ { @@_compile_special_group_\token_to_str:N #4 :w }
{
- \msg_kernel_warning:nnx { regex } { special-group-unknown }
+ \__msg_kernel_warning:nnx { regex } { special-group-unknown }
{ (? \token_to_str:N #4 }
- \regex_compile_group_begin:N \regex_group:nnnN
- \regex_compile_raw:N ? #3 #4
+ \@@_compile_group_begin:N \@@_group:nnnN
+ \@@_compile_raw:N ? #3 #4
}
}
{
- \regex_compile_group_begin:N \regex_group:nnnN
+ \@@_compile_group_begin:N \@@_group:nnnN
#1 #2 #3 #4
}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]+\regex_compile_|:+
+% \begin{macro}[aux]+\@@_compile_|:+
% In a class, the pipe is not special. Otherwise, end the current
% branch and open another one.
% \begin{macrocode}
-\cs_new_protected_nopar:cpn { regex_compile_|: }
+\cs_new_protected_nopar:cpn { @@_compile_|: }
{
- \regex_if_in_class:TF { \regex_compile_raw:N | }
+ \@@_if_in_class:TF { \@@_compile_raw:N | }
{
- \tl_build_one:n
- { \if_false: { \fi: } \regex_branch:n { \if_false: } \fi: }
+ \__tl_build_one:n
+ { \if_false: { \fi: } \@@_branch:n { \if_false: } \fi: }
}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_compile_):}
+% \begin{macro}[aux]{\@@_compile_):}
% Within a class, parentheses are not special. Outside, close a group.
% \begin{macrocode}
-\cs_new_protected_nopar:cpn { regex_compile_): }
+\cs_new_protected_nopar:cpn { @@_compile_): }
{
- \regex_if_in_class:TF { \regex_compile_raw:N ) }
- { \regex_compile_group_end: }
+ \@@_if_in_class:TF { \@@_compile_raw:N ) }
+ { \@@_compile_group_end: }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_compile_special_group_::w}
-% \begin{macro}[aux]+\regex_compile_special_group_|:w+
+% \begin{macro}[aux]{\@@_compile_special_group_::w}
+% \begin{macro}[aux]+\@@_compile_special_group_|:w+
% Non-capturing, and resetting groups are easy to take care of during
% compilation; for those groups, the harder parts will come when
% building.
% \begin{macrocode}
-\cs_new_protected_nopar:cpn { regex_compile_special_group_::w }
- { \regex_compile_group_begin:N \regex_group_no_capture:nnnN }
-\cs_new_protected_nopar:cpn { regex_compile_special_group_|:w }
- { \regex_compile_group_begin:N \regex_group_resetting:nnnN }
+\cs_new_protected_nopar:cpn { @@_compile_special_group_::w }
+ { \@@_compile_group_begin:N \@@_group_no_capture:nnnN }
+\cs_new_protected_nopar:cpn { @@_compile_special_group_|:w }
+ { \@@_compile_group_begin:N \@@_group_resetting:nnnN }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}[aux]
-% {\regex_compile_special_group_i:w, \regex_compile_special_group_-:w}
+% {\@@_compile_special_group_i:w, \@@_compile_special_group_-:w}
% The match can be made case-insensitive by setting the option with
% \texttt{(?i)}; the original behaviour is restored by \texttt{(?-i)}.
% This is the only supported option.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile_special_group_i:w #1#2
+\cs_new_protected:Npn \@@_compile_special_group_i:w #1#2
{
- \str_if_eq:nnTF { #1 #2 } { \regex_compile_special:N ) }
+ \str_if_eq:nnTF { #1 #2 } { \@@_compile_special:N ) }
{
- \cs_set_nopar:Npn \regex_item_equal:n { \regex_item_caseless_equal:n }
- \cs_set_nopar:Npn \regex_item_range:nn { \regex_item_caseless_range:nn }
+ \cs_set_nopar:Npn \@@_item_equal:n { \@@_item_caseless_equal:n }
+ \cs_set_nopar:Npn \@@_item_range:nn { \@@_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
+ \__msg_kernel_warning:nnx { regex } { unknown-option } { (?i #2 }
+ \@@_compile_raw:N (
+ \@@_compile_raw:N ?
+ \@@_compile_raw:N i
#1 #2
}
}
-\cs_new_protected_nopar:cpn { regex_compile_special_group_-:w } #1#2#3#4
+\cs_new_protected_nopar:cpn { @@_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 ) }
+ { \@@_compile_raw:N i \@@_compile_special:N ) }
{
- \cs_set_nopar:Npn \regex_item_equal:n { \regex_item_caseful_equal:n }
- \cs_set_nopar:Npn \regex_item_range:nn { \regex_item_caseful_range:nn }
+ \cs_set_nopar:Npn \@@_item_equal:n { \@@_item_caseful_equal:n }
+ \cs_set_nopar:Npn \@@_item_range:nn { \@@_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 -
+ \__msg_kernel_warning:nnx { regex } { unknown-option } { (?-#2#4 }
+ \@@_compile_raw:N (
+ \@@_compile_raw:N ?
+ \@@_compile_raw:N -
#1 #2 #3 #4
}
}
@@ -2748,28 +2757,28 @@
%
% \subsubsection{Catcodes and csnames}
%
-% \begin{macro}[aux]{\regex_compile_/c:, \regex_compile_c_test:NN}
+% \begin{macro}[aux]{\@@_compile_/c:, \@@_compile_c_test:NN}
% The |\c| escape sequence can be followed by a capital letter
% representing a character category, by a left bracket which starts a
% list of categories, or by a brace group holding a regular expression
% for a control sequence name. Otherwise, raise an error.
% \begin{macrocode}
-\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
+\cs_new_protected:cpn { @@_compile_/c: }
+ { \@@_chk_c_allowed:T { \@@_compile_c_test:NN } }
+\cs_new_protected:Npn \@@_compile_c_test:NN #1#2
{
- \token_if_eq_meaning:NNTF #1 \regex_compile_raw:N
+ \token_if_eq_meaning:NNTF #1 \@@_compile_raw:N
{
- \int_if_exist:cTF { c_regex_catcode_#2_int }
+ \int_if_exist:cTF { c_@@_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_two \else: \c_six \fi:
+ \int_set_eq:Nc \l_@@_catcodes_int { c_@@_catcode_#2_int }
+ \l_@@_mode_int
+ = \if_case:w \l_@@_mode_int \c_two \else: \c_six \fi:
}
}
- { \cs_if_exist_use:cF { regex_compile_c_#2:w } }
+ { \cs_if_exist_use:cF { @@_compile_c_#2:w } }
{
- \msg_kernel_error:nnx { regex } { c-missing-category } {#2}
+ \__msg_kernel_error:nnx { regex } { c-missing-category } {#2}
#1 #2
}
}
@@ -2778,86 +2787,86 @@
%
% \begin{macro}[aux]
% {
-% \regex_compile_c_[:w,
-% \regex_compile_c_lbrack_loop:NN,
-% \regex_compile_c_lbrack_add:N,
-% \regex_compile_c_lbrack_end:,
+% \@@_compile_c_[:w,
+% \@@_compile_c_lbrack_loop:NN,
+% \@@_compile_c_lbrack_add:N,
+% \@@_compile_c_lbrack_end:,
% }
% When encountering |\c[|, the task is to collect uppercase letters
% representing character categories. First check for |^| which negates
% the list of category codes.
% \begin{macrocode}
-\cs_new_protected:cpn { regex_compile_c_[:w } #1#2
+\cs_new_protected:cpn { @@_compile_c_[:w } #1#2
{
- \l_regex_mode_int
- = \if_case:w \l_regex_mode_int \c_two \else: \c_six \fi:
- \int_zero:N \l_regex_catcodes_int
- \str_if_eq:nnTF { #1 #2 } { \regex_compile_special:N ^ }
+ \l_@@_mode_int
+ = \if_case:w \l_@@_mode_int \c_two \else: \c_six \fi:
+ \int_zero:N \l_@@_catcodes_int
+ \str_if_eq:nnTF { #1 #2 } { \@@_compile_special:N ^ }
{
- \bool_set_false:N \l_regex_catcodes_bool
- \regex_compile_c_lbrack_loop:NN
+ \bool_set_false:N \l_@@_catcodes_bool
+ \@@_compile_c_lbrack_loop:NN
}
{
- \bool_set_true:N \l_regex_catcodes_bool
- \regex_compile_c_lbrack_loop:NN
+ \bool_set_true:N \l_@@_catcodes_bool
+ \@@_compile_c_lbrack_loop:NN
#1 #2
}
}
-\cs_new_protected:Npn \regex_compile_c_lbrack_loop:NN #1#2
+\cs_new_protected:Npn \@@_compile_c_lbrack_loop:NN #1#2
{
- \token_if_eq_meaning:NNTF #1 \regex_compile_raw:N
+ \token_if_eq_meaning:NNTF #1 \@@_compile_raw:N
{
- \int_if_exist:cTF { c_regex_catcode_#2_int }
+ \int_if_exist:cTF { c_@@_catcode_#2_int }
{
- \exp_args:Nc \regex_compile_c_lbrack_add:N
- { c_regex_catcode_#2_int }
- \regex_compile_c_lbrack_loop:NN
+ \exp_args:Nc \@@_compile_c_lbrack_add:N
+ { c_@@_catcode_#2_int }
+ \@@_compile_c_lbrack_loop:NN
}
}
{
\token_if_eq_charcode:NNTF #2 ]
- { \regex_compile_c_lbrack_end: }
+ { \@@_compile_c_lbrack_end: }
}
{
- \msg_kernel_error:nnx { regex } { c-missing-rbrack } {#2}
- \regex_compile_c_lbrack_end:
+ \__msg_kernel_error:nnx { regex } { c-missing-rbrack } {#2}
+ \@@_compile_c_lbrack_end:
#1 #2
}
}
-\cs_new_protected:Npn \regex_compile_c_lbrack_add:N #1
+\cs_new_protected:Npn \@@_compile_c_lbrack_add:N #1
{
- \if_int_odd:w \int_eval:w \l_regex_catcodes_int / #1 \int_eval_end:
+ \if_int_odd:w \__int_eval:w \l_@@_catcodes_int / #1 \__int_eval_end:
\else:
- \tex_advance:D \l_regex_catcodes_int #1
+ \tex_advance:D \l_@@_catcodes_int #1
\fi:
}
-\cs_new_protected_nopar:Npn \regex_compile_c_lbrack_end:
+\cs_new_protected_nopar:Npn \@@_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 }
+ \if_meaning:w \c_false_bool \l_@@_catcodes_bool
+ \int_set:Nn \l_@@_catcodes_int
+ { \c_@@_all_catcodes_int - \l_@@_catcodes_int }
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}+\regex_compile_c_{:+
+% \begin{macro}+\@@_compile_c_{:+
% The case of a left brace is easy, based on what we have done so far:
% in a group, compile the regular expression, after changing the mode
% to forbid nesting |\c|. Additionally, disable submatch tracking
% since groups don't escape the scope of |\c{...}|.
% \begin{macrocode}
-\cs_new_protected_nopar:cpn { regex_compile_c_ \c_lbrace_str :w }
+\cs_new_protected_nopar:cpn { @@_compile_c_ \c_lbrace_str :w }
{
- \regex_compile:w
- \regex_disable_submatches:
- \l_regex_mode_int
- = - \if_case:w \l_regex_mode_int \c_two \else: \c_six \fi:
+ \@@_compile:w
+ \@@_disable_submatches:
+ \l_@@_mode_int
+ = - \if_case:w \l_@@_mode_int \c_two \else: \c_six \fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}+\regex_compile_}:+
+% \begin{macro}+\@@_compile_}:+
% Non-escaped right braces are only special if they appear when
% compiling the regular expression for a csname, but not within a
% class: |\c{[}{]}| matches the control sequences |\}| and
@@ -2866,23 +2875,23 @@
% dangling class or group). Then insert the corresponding test in the
% outer regex.
% \begin{macrocode}
-\cs_new_protected:cpn { regex_compile_ \c_rbrace_str : }
+\cs_new_protected:cpn { @@_compile_ \c_rbrace_str : }
{
- \regex_if_in_cs:TF
+ \@@_if_in_cs:TF
{
- \regex_compile_end:
- \regex_compile_one:x
- { \regex_item_cs:n { \exp_not:o \l_regex_internal_regex } }
+ \@@_compile_end:
+ \@@_compile_one:x
+ { \@@_item_cs:n { \exp_not:o \l_@@_internal_regex } }
}
- { \exp_after:wN \regex_compile_raw:N \c_rbrace_str }
+ { \exp_after:wN \@@_compile_raw:N \c_rbrace_str }
}
% \end{macrocode}
% \end{macro}
%
% \subsubsection{Raw token lists with \cs{u}}
%
-% \begin{macro}[aux]{\regex_compile_/u:}
-% \begin{macro}[aux, EXP]{\regex_compile_u_loop:NN}
+% \begin{macro}[aux]{\@@_compile_/u:}
+% \begin{macro}[aux, EXP]{\@@_compile_u_loop:NN}
% The |\u| escape is invalid in classes and directly following a
% catcode test. Otherwise, it must be followed by a left brace. We
% then collect the characters for the argument of |\u| within an
@@ -2893,37 +2902,37 @@
% raw and special characters, and stop when encountering a special
% right brace, any escaped character, or the end-marker.
% \begin{macrocode}
-\cs_new_protected:cpn { regex_compile_/u: } #1#2
+\cs_new_protected:cpn { @@_compile_/u: } #1#2
{
- \regex_if_in_class_or_catcode:TF
- { \regex_compile_raw_error:N u #1 #2 }
+ \@@_if_in_class_or_catcode:TF
+ { \@@_compile_raw_error:N u #1 #2 }
{
- \str_if_eq:xxTF {#1#2} { \regex_compile_special:N \c_lbrace_str }
+ \str_if_eq_x:nnTF {#1#2} { \@@_compile_special:N \c_lbrace_str }
{
- \tl_set:Nx \l_regex_internal_a_tl { \if_false: } \fi:
- \regex_compile_u_loop:NN
+ \tl_set:Nx \l_@@_internal_a_tl { \if_false: } \fi:
+ \@@_compile_u_loop:NN
}
{
- \msg_kernel_error:nn { regex } { u-missing-lbrace }
- \regex_compile_raw:N u #1 #2
+ \__msg_kernel_error:nn { regex } { u-missing-lbrace }
+ \@@_compile_raw:N u #1 #2
}
}
}
-\cs_new:Npn \regex_compile_u_loop:NN #1#2
+\cs_new:Npn \@@_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 \@@_compile_raw:N
+ { #2 \@@_compile_u_loop:NN }
{
- \token_if_eq_meaning:NNTF #1 \regex_compile_special:N
+ \token_if_eq_meaning:NNTF #1 \@@_compile_special:N
{
\exp_after:wN \token_if_eq_charcode:NNTF \c_rbrace_str #2
- { \if_false: { \fi: } \regex_compile_u_end: }
- { #2 \regex_compile_u_loop:NN }
+ { \if_false: { \fi: } \@@_compile_u_end: }
+ { #2 \@@_compile_u_loop:NN }
}
{
\if_false: { \fi: }
- \msg_kernel_error:nnx { regex } { u-missing-rbrace } {#2}
- \regex_compile_u_end:
+ \__msg_kernel_error:nnx { regex } { u-missing-rbrace } {#2}
+ \@@_compile_u_end:
#1 #2
}
}
@@ -2932,66 +2941,66 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_compile_u_end:}
+% \begin{macro}[aux]{\@@_compile_u_end:}
% Once we have extracted the variable's name, we store the contents of
-% that variable in \cs{l_regex_internal_a_tl}. The behaviour of |\u|
+% that variable in \cs{l_@@_internal_a_tl}. The behaviour of |\u|
% then depends on whether we are within a |\c{...}| escape (in this
% case, the variable is turned to a string), or not.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile_u_end:
+\cs_new_protected:Npn \@@_compile_u_end:
{
- \tl_set:Nv \l_regex_internal_a_tl { \l_regex_internal_a_tl }
- \if_num:w \l_regex_mode_int = \c_zero
- \regex_compile_u_not_cs:
+ \tl_set:Nv \l_@@_internal_a_tl { \l_@@_internal_a_tl }
+ \if_int_compare:w \l_@@_mode_int = \c_zero
+ \@@_compile_u_not_cs:
\else:
- \regex_compile_u_in_cs:
+ \@@_compile_u_in_cs:
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_compile_u_in_cs:}
+% \begin{macro}[aux]{\@@_compile_u_in_cs:}
% When |\u| appears within a control sequence, we convert the variable
% to a string with escaped spaces. Then for each character insert a
% class matching exactly that character, once.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile_u_in_cs:
+\cs_new_protected:Npn \@@_compile_u_in_cs:
{
- \exp_args:NNo \str_gset_other:Nn \g_regex_internal_tl
- { \l_regex_internal_a_tl }
- \tl_build_one:x
+ \exp_args:NNo \__str_gset_other:Nn \g_@@_internal_tl
+ { \l_@@_internal_a_tl }
+ \__tl_build_one:x
{
- \tl_map_function:NN \g_regex_internal_tl
- \regex_compile_u_in_cs_aux:n
+ \tl_map_function:NN \g_@@_internal_tl
+ \@@_compile_u_in_cs_aux:n
}
}
-\cs_new:Npn \regex_compile_u_in_cs_aux:n #1
+\cs_new:Npn \@@_compile_u_in_cs_aux:n #1
{
- \regex_class:NnnnN \c_true_bool
- { \regex_item_caseful_equal:n { \int_value:w `#1 } }
+ \@@_class:NnnnN \c_true_bool
+ { \@@_item_caseful_equal:n { \__int_value:w `#1 } }
{ 1 } { 0 } \c_false_bool
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_compile_u_not_cs:}
+% \begin{macro}[aux]{\@@_compile_u_not_cs:}
% In mode $0$, the |\u| escape adds one state to the NFA for each
-% token in \cs{l_regex_internal_a_tl}. If a given \meta{token} is a
+% token in \cs{l_@@_internal_a_tl}. If a given \meta{token} is a
% control sequence, then insert a string comparison test, otherwise,
-% \cs{regex_item_exact:nn} which compares catcode and character code.
+% \cs{@@_item_exact:nn} which compares catcode and character code.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_compile_u_not_cs:
+\cs_new_protected:Npn \@@_compile_u_not_cs:
{
- \exp_args:No \tl_analysis_map_inline:nn { \l_regex_internal_a_tl }
+ \exp_args:No \__tl_analysis_map_inline:nn { \l_@@_internal_a_tl }
{
- \tl_build_one:n
+ \__tl_build_one:n
{
- \regex_class:NnnnN \c_true_bool
+ \@@_class:NnnnN \c_true_bool
{
- \if_num:w "##2 = \c_zero
- \regex_item_exact_cs:c { \exp_after:wN \cs_to_str:N ##1 }
+ \if_int_compare:w "##2 = \c_zero
+ \@@_item_exact_cs:c { \exp_after:wN \cs_to_str:N ##1 }
\else:
- \regex_item_exact:nn { \int_value:w "##2 } { ##3 }
+ \@@_item_exact:nn { \__int_value:w "##2 } { ##3 }
\fi:
}
{ 1 } { 0 } \c_false_bool
@@ -3003,136 +3012,140 @@
%
% \subsubsection{Other}
%
-% \begin{macro}[aux]{\regex_compile_/K:}
+% \begin{macro}[aux]{\@@_compile_/K:}
% The |\K| control sequence is currently the only \enquote{command},
% which performs some action, rather than matching something. It is
% allowed in the same contexts as |\b|. At the compilation stage, we
% leave it as a single control sequence, defined later.
% \begin{macrocode}
-\cs_new_protected_nopar:cpn { regex_compile_/K: }
+\cs_new_protected_nopar:cpn { @@_compile_/K: }
{
- \int_compare:nNnTF \l_regex_mode_int = \c_zero
- { \tl_build_one:n { \regex_command_K: } }
- { \regex_compile_raw_error:N K }
+ \int_compare:nNnTF \l_@@_mode_int = \c_zero
+ { \__tl_build_one:n { \@@_command_K: } }
+ { \@@_compile_raw_error:N K }
}
% \end{macrocode}
% \end{macro}
%
% \subsubsection{Showing regexes}
%
-% \begin{macro}[aux]{\regex_show_aux:Nx}
-% Within a \cs{tl_set_build:Nw} \ldots{} \cs{tl_build_end:} group, we
+% \begin{macro}[aux]{\@@_show:Nx}
+% Within a \cs{__tl_build:Nw} \ldots{} \cs{__tl_build_end:} group, we
% redefine all the function that can appear in a compiled regex, then
% run the regex. The result is then shown.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_show_aux:Nx #1#2
+\cs_new_protected:Npn \@@_show:Nx #1#2
{
- \tl_set_build:Nw \l_regex_internal_a_tl
- \cs_set_protected_nopar:Npn \regex_branch:n
+ \__tl_build:Nw \l_@@_internal_a_tl
+ \cs_set_protected_nopar:Npn \@@_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
+ \seq_pop_right:NN \l_@@_show_prefix_seq \l_@@_internal_a_tl
+ \@@_show_one:n { +-branch }
+ \seq_put_right:No \l_@@_show_prefix_seq \l_@@_internal_a_tl
\use:n
}
- \cs_set_protected_nopar:Npn \regex_group:nnnN
- { \regex_show_group_aux:nnnnN { } }
- \cs_set_protected_nopar:Npn \regex_group_no_capture:nnnN
- { \regex_show_group_aux:nnnnN { ~(no~capture) } }
- \cs_set_protected_nopar: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_nopar: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_nopar: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
+ \cs_set_protected_nopar:Npn \@@_group:nnnN
+ { \@@_show_group_aux:nnnnN { } }
+ \cs_set_protected_nopar:Npn \@@_group_no_capture:nnnN
+ { \@@_show_group_aux:nnnnN { ~(no~capture) } }
+ \cs_set_protected_nopar:Npn \@@_group_resetting:nnnN
+ { \@@_show_group_aux:nnnnN { ~(resetting) } }
+ \cs_set_eq:NN \@@_class:NnnnN \@@_show_class:NnnnN
+ \cs_set_protected_nopar:Npn \@@_command_K:
+ { \@@_show_one:n { reset~match~start~(\iow_char:N\\K) } }
+ \cs_set_protected:Npn \@@_assertion:Nn ##1##2
+ { \@@_show_one:n { \bool_if:NF ##1 { negative~ } assertion:~##2 } }
+ \cs_set_nopar:Npn \@@_b_test: { word~boundary }
+ \cs_set_eq:NN \@@_anchor:N \@@_show_anchor_to_str:N
+ \cs_set_protected:Npn \@@_item_caseful_equal:n ##1
+ { \@@_show_one:n { char~code~\int_eval:n{##1} } }
+ \cs_set_protected:Npn \@@_item_caseful_range:nn ##1##2
+ { \@@_show_one:n { range~[\int_eval:n{##1}, \int_eval:n{##2}] } }
+ \cs_set_protected:Npn \@@_item_caseless_equal:n ##1
+ { \@@_show_one:n { char~code~\int_eval:n{##1}~(caseless) } }
+ \cs_set_protected:Npn \@@_item_caseless_range:nn ##1##2
{
- \regex_show_one:n
+ \@@_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_protected:Npn \regex_item_exact_cs:c ##1
- { \regex_show_one:n { control~sequence~\iow_char:N\\##1 } }
- \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_set_protected:Npn \@@_item_catcode:nT
+ { \@@_show_item_catcode:NnT \c_true_bool }
+ \cs_set_protected:Npn \@@_item_catcode_reverse:nT
+ { \@@_show_item_catcode:NnT \c_false_bool }
+ \cs_set_protected:Npn \@@_item_reverse:n
+ { \@@_show_scope:nn { Reversed~match } }
+ \cs_set_protected:Npn \@@_item_exact:nn ##1##2
+ { \@@_show_one:n { char~##2,~catcode~##1 } }
+ \cs_set_protected:Npn \@@_item_exact_cs:c ##1
+ { \@@_show_one:n { control~sequence~\iow_char:N\\##1 } }
+ \cs_set_protected:Npn \@@_item_cs:n
+ { \@@_show_scope:nn { control~sequence } }
+ \cs_set:cpn { @@_prop_.: } { \@@_show_one:n { any~token } }
+ \seq_clear:N \l_@@_show_prefix_seq
+ \@@_show_push:n { ~ }
#1
- \tl_build_end:
- \msg_aux_show:x { > Compiled~regex~#2: \l_regex_internal_a_tl }
+ \__tl_build_end:
+ \__msg_show_variable:x { > Compiled~regex~#2: \l_@@_internal_a_tl }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_show_one:n}
+% \begin{macro}[aux]{\@@_show_one:n}
% Every part of the final message go through this function, which adds
% one line to the output, with the apropriate prefix.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_show_one:n #1
+\cs_new_protected:Npn \@@_show_one:n #1
{
- \int_incr:N \l_regex_show_lines_int
- \tl_build_one:x
- { \iow_newline: \seq_use:N \l_regex_show_prefix_seq #1 }
+ \int_incr:N \l_@@_show_lines_int
+ \__tl_build_one:x
+ {
+ \iow_newline:
+ \seq_map_function:NN \l_@@_show_prefix_seq \use:n
+ #1
+ }
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}[aux]
-% {\regex_show_push:n, \regex_show_pop:, \regex_show_scope:nn}
+% {\@@_show_push:n, \@@_show_pop:, \@@_show_scope:nn}
% Enter and exit levels of nesting. The \texttt{scope} function prints
% its first argument as an \enquote{introduction}, then performs its
% second argument in a deeper level of nesting.
% \begin{macrocode}
-\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
+\cs_new_protected:Npn \@@_show_push:n #1
+ { \seq_put_right:Nx \l_@@_show_prefix_seq { #1 ~ } }
+\cs_new_protected:Npn \@@_show_pop:
+ { \seq_pop_right:NN \l_@@_show_prefix_seq \l_@@_internal_a_tl }
+\cs_new_protected:Npn \@@_show_scope:nn #1#2
{
- \regex_show_one:n {#1}
- \regex_show_push:n { ~ }
+ \@@_show_one:n {#1}
+ \@@_show_push:n { ~ }
#2
- \regex_show_pop:
+ \@@_show_pop:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_show_group_aux:nnnnN}
+% \begin{macro}[aux]{\@@_show_group_aux:nnnnN}
% We display all groups in the same way, simply adding a message,
% \texttt{(no capture)} or \texttt{(resetting)}, to special groups.
% The odd \cs{use_ii:nn} avoids printing a spurious \texttt{+-branch}
% for the first branch.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_show_group_aux:nnnnN #1#2#3#4#5
+\cs_new_protected:Npn \@@_show_group_aux:nnnnN #1#2#3#4#5
{
- \regex_show_one:n { ,-group~begin #1 }
- \regex_show_push:n { | }
+ \@@_show_one:n { ,-group~begin #1 }
+ \@@_show_push:n { | }
\use_ii:nn #2
- \regex_show_pop:
- \regex_show_one:n
- { `-group~end \regex_msg_repeated:nnN {#3} {#4} #5 }
+ \@@_show_pop:
+ \@@_show_one:n
+ { `-group~end \@@_msg_repeated:nnN {#3} {#4} #5 }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_show_class:NnnnN}
+% \begin{macro}[aux]{\@@_show_class:NnnnN}
% I'm entirely unhappy about this function: I couldn't find a way to
% test if a class is a single test. Instead, collect the
% representation of the tests in the class. If that had more than one
@@ -3143,79 +3156,81 @@
% incorrect). That's clunky, but not too expensive, since it's only
% one test.
% \begin{macrocode}
-\cs_set:Npn \regex_show_class:NnnnN #1#2#3#4#5
+\cs_set:Npn \@@_show_class:NnnnN #1#2#3#4#5
{
- \tl_set_build:Nw \l_regex_internal_a_tl
- \int_zero:N \l_regex_show_lines_int
- \regex_show_push:n {~}
+ \__tl_build:Nw \l_@@_internal_a_tl
+ \int_zero:N \l_@@_show_lines_int
+ \@@_show_push:n {~}
#2
\exp_last_unbraced:Nf
- \prg_case_int:nnn { \l_regex_show_lines_int }
+ \int_case:nnn { \l_@@_show_lines_int }
{
{0}
{
- \tl_build_end:
- \regex_show_one:n { \bool_if:NTF #1 { Fail } { Pass } }
+ \__tl_build_end:
+ \@@_show_one:n { \bool_if:NTF #1 { Fail } { Pass } }
}
{1}
{
- \tl_build_end:
+ \__tl_build_end:
\bool_if:NTF #1
{
#2
- \tl_build_one:n { \regex_msg_repeated:nnN {#3} {#4} #5 }
+ \__tl_build_one:n { \@@_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
+ \@@_show_one:n
+ { Don't~match~\@@_msg_repeated:nnN {#3} {#4} #5 }
+ \__tl_build_one:o \l_@@_internal_a_tl
}
}
}
{
- \tl_build_end:
- \regex_show_one:n
+ \__tl_build_end:
+ \@@_show_one:n
{
\bool_if:NTF #1 { M } { Don't~m } atch
- \regex_msg_repeated:nnN {#3} {#4} #5
+ \@@_msg_repeated:nnN {#3} {#4} #5
}
- \tl_build_one:o \l_regex_internal_a_tl
+ \__tl_build_one:o \l_@@_internal_a_tl
}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux, rEXP]{\regex_show_anchor_to_str:N}
+% \begin{macro}[aux, rEXP]{\@@_show_anchor_to_str:N}
% The argument is an integer telling us where the anchor is. We
% convert that to the relevant info.
% \begin{macrocode}
-\cs_new:Npn \regex_show_anchor_to_str:N #1
+\cs_new:Npn \@@_show_anchor_to_str:N #1
{
anchor~at~
- \prg_case_str:nnn { #1 }
+ \str_case:nnn { #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) }
+ { \l_@@_min_pos_int } { start~(\iow_char:N\\A) }
+ { \l_@@_start_pos_int } { start~of~match~(\iow_char:N\\G) }
+ { \l_@@_max_pos_int } { end~(\iow_char:N\\Z) }
}
{ <error:~'#1'~not~recognized> }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_show_item_catcode:NnT}
+% \begin{macro}[aux]{\@@_show_item_catcode:NnT}
% Produce a sequence of categories which the catcode bitmap |#2|
% contains, and show it, indenting the tests on which this catcode
% constraint applies.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_show_item_catcode:NnT #1#2
+\cs_new_protected:Npn \@@_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
+ \seq_set_split:Nnn \l_@@_internal_seq { } { CBEMTPUDSLOA }
+ \seq_set_filter:NNn \l_@@_internal_seq \l_@@_internal_seq
+ { \int_if_odd_p:n { #2 / \int_use:c { c_@@_catcode_##1_int } } }
+ \@@_show_scope:nn
{
- categories~\seq_use:N \l_regex_internal_seq, ~
+ categories~
+ \seq_map_function:NN \l_@@_internal_seq \use:n
+ , ~
\bool_if:NF #1 { negative~ } class
}
}
@@ -3226,41 +3241,41 @@
%
% \subsubsection{Variables used while building}
%
-% \begin{variable}{\l_regex_min_state_int, \l_regex_max_state_int}
-% The last state that was allocated is $\cs{l_regex_max_state_int}-1$,
-% so that \cs{l_regex_max_state_int} always points to a free state.
+% \begin{variable}{\l_@@_min_state_int, \l_@@_max_state_int}
+% The last state that was allocated is $\cs{l_@@_max_state_int}-1$,
+% so that \cs{l_@@_max_state_int} always points to a free state.
% The \texttt{min_state} variable is always $0$, but is included to
% avoid hard-coding this value.
% \begin{macrocode}
-\int_new:N \l_regex_min_state_int
-\int_new:N \l_regex_max_state_int
+\int_new:N \l_@@_min_state_int
+\int_new:N \l_@@_max_state_int
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_regex_left_state_int, \l_regex_right_state_int}
-% \begin{variable}{\l_regex_left_state_seq, \l_regex_right_state_seq}
+% \begin{variable}{\l_@@_left_state_int, \l_@@_right_state_int}
+% \begin{variable}{\l_@@_left_state_seq, \l_@@_right_state_seq}
% Alternatives are implemented by branching from a \texttt{left} state
% into the various choices, then merging those into a \texttt{right}
% state. We store information about those states in two sequences.
% Those states are also used to implement group quantifiers. Most
% often, the left and right pointers only differ by~$1$.
% \begin{macrocode}
-\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_@@_left_state_int
+\int_new:N \l_@@_right_state_int
+\seq_new:N \l_@@_left_state_seq
+\seq_new:N \l_@@_right_state_seq
% \end{macrocode}
% \end{variable}
% \end{variable}
%
-% \begin{variable}{\l_regex_capturing_group_int}
-% \cs{l_regex_capturing_group_int} is the \textsc{id} number that will
+% \begin{variable}{\l_@@_capturing_group_int}
+% \cs{l_@@_capturing_group_int} is the \textsc{id} number that will
% be assigned to a capturing group if one was opened now. This starts
% at $0$ for the group enclosing the full regular expression, and
% groups are counted in the order of their left parenthesis, except
% when encountering \texttt{resetting} groups.
% \begin{macrocode}
-\int_new:N \l_regex_capturing_group_int
+\int_new:N \l_@@_capturing_group_int
% \end{macrocode}
% \end{variable}
%
@@ -3270,22 +3285,22 @@
% Each state of the \textsc{nfa} is stored in a \tn{toks}. The
% operations which can appear in the \tn{toks} are
% \begin{itemize}
-% \item \cs{regex_action_start_wildcard:} inserted at the start
+% \item \cs{@@_action_start_wildcard:} inserted at the start
% of the regular expression to make it unanchored.
-% \item \cs{regex_action_success:} marks the exit state of the
+% \item \cs{@@_action_success:} marks the exit state of the
% \textsc{nfa}.
-% \item \cs{regex_action_cost:n} \Arg{shift} is a transition from the
+% \item \cs{@@_action_cost:n} \Arg{shift} is a transition from the
% current \meta{state} to $\meta{state}+\meta{shift}$, which
% consumes the current character: the target state is saved and will
% be considered again when matching at the next position.
-% \item \cs{regex_action_free:n} \Arg{shift}, and
-% \cs{regex_action_free_group:n} \Arg{shift} are free transitions,
+% \item \cs{@@_action_free:n} \Arg{shift}, and
+% \cs{@@_action_free_group:n} \Arg{shift} are free transitions,
% which immediately perform the actions for the state
% $\meta{state}+\meta{shift}$ of the \textsc{nfa}. They differ in
% how they detect and avoid infinite loops. For now, we just need to
% know that the \texttt{group} variant must be used for transitions
% back to the start of a group.
-% \item \cs{regex_action_submatch:n} \Arg{key} where the \meta{key} is
+% \item \cs{@@_action_submatch:n} \Arg{key} where the \meta{key} is
% a group number followed by |<| or |>| for the beginning or end of
% group. This causes the current position in the query to be stored
% as the \meta{key} submatch boundary.
@@ -3306,7 +3321,7 @@
% corresponding end-points of nested groups.
% \end{itemize}
%
-% \begin{macro}[int]{\regex_build:n, \regex_build:N}
+% \begin{macro}[int]{\@@_build:n, \@@_build:N}
% The \texttt{n}-type function first compiles its argument. Reset some
% variables. Allocate two states, and put a wildcard in state $0$
% (transitions to state $1$ and $0$ state). Then build the regex
@@ -3314,104 +3329,104 @@
% value of \texttt{capturing_group}). Finally, if the match reaches the
% last state, it is successful.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_build:n #1
+\cs_new_protected:Npn \@@_build:n #1
{
- \regex_compile:n {#1}
- \regex_build:N \l_regex_internal_regex
+ \@@_compile:n {#1}
+ \@@_build:N \l_@@_internal_regex
}
-\cs_new_protected:Npn \regex_build:N #1
+\cs_new_protected:Npn \@@_build:N #1
{
-%<trace> \trace_push:nnn { regex } { 1 } { regex_build }
+%<trace> \trace_push:nnn { regex } { 1 } { @@_build }
\int_set:Nn \tex_escapechar:D { 92 }
- \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: }
-%<trace> \regex_trace_states:n { 2 }
-%<trace> \trace_pop:nnn { regex } { 1 } { regex_build }
+ \int_zero:N \l_@@_capturing_group_int
+ \int_set_eq:NN \l_@@_max_state_int \l_@@_min_state_int
+ \@@_build_new_state:
+ \@@_build_new_state:
+ \@@_toks_put_right:Nn \l_@@_left_state_int
+ { \@@_action_start_wildcard: }
+ \@@_group:nnnN {#1} { 1 } { 0 } \c_false_bool
+ \@@_toks_put_right:Nn \l_@@_right_state_int
+ { \@@_action_success: }
+%<trace> \@@_trace_states:n { 2 }
+%<trace> \trace_pop:nnn { regex } { 1 } { @@_build }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_build_for_cs:n}
+% \begin{macro}[int]{\@@_build_for_cs:n}
% When using a regex to match a cs, we don't insert a wildcard, we
% anchor at the end, and since we ignore submatches, there is no need
% to surround the expression with a group. However, for branches to
% work properly at the outer level, we need to put the appropriate
% \texttt{left} and \texttt{right} states in their sequence.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_build_for_cs:n #1
+\cs_new_protected:Npn \@@_build_for_cs:n #1
{
-%<trace> \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:
+%<trace> \trace_push:nnn { regex } { 1 } { @@_build_for_cs }
+ \int_set_eq:NN \l_@@_max_state_int \l_@@_min_state_int
+ \@@_build_new_state:
+ \@@_build_new_state:
+ \@@_push_lr_states:
#1
- \regex_pop_lr_states:
- \regex_toks_put_right:Nn \l_regex_right_state_int
+ \@@_pop_lr_states:
+ \@@_toks_put_right:Nn \l_@@_right_state_int
{
- \if_num:w \l_regex_current_pos_int = \l_regex_max_pos_int
- \exp_after:wN \regex_action_success:
+ \if_int_compare:w \l_@@_current_pos_int = \l_@@_max_pos_int
+ \exp_after:wN \@@_action_success:
\fi:
}
-%<trace> \regex_trace_states:n { 2 }
-%<trace> \trace_pop:nnn { regex } { 1 } { regex_build_for_cs }
+%<trace> \@@_trace_states:n { 2 }
+%<trace> \trace_pop:nnn { regex } { 1 } { @@_build_for_cs }
}
% \end{macrocode}
% \end{macro}
%
% \subsubsection{Helpers for building an \textsc{nfa}}
%
-% \begin{macro}[int]{\regex_push_lr_states:, \regex_pop_lr_states:}
+% \begin{macro}[int]{\@@_push_lr_states:, \@@_pop_lr_states:}
% When building the regular expression, we keep track of pointers to
% the left-end and right-end of each group without help from \TeX{}'s
% grouping.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_push_lr_states:
+\cs_new_protected_nopar:Npn \@@_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 }
+ \seq_push:No \l_@@_left_state_seq
+ { \int_use:N \l_@@_left_state_int }
+ \seq_push:No \l_@@_right_state_seq
+ { \int_use:N \l_@@_right_state_int }
}
-\cs_new_protected_nopar:Npn \regex_pop_lr_states:
+\cs_new_protected_nopar:Npn \@@_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
+ \seq_pop:NN \l_@@_left_state_seq \l_@@_internal_a_tl
+ \int_set:Nn \l_@@_left_state_int \l_@@_internal_a_tl
+ \seq_pop:NN \l_@@_right_state_seq \l_@@_internal_a_tl
+ \int_set:Nn \l_@@_right_state_int \l_@@_internal_a_tl
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_toks_put_left:Nx}
-% \begin{macro}[int]{\regex_toks_put_right:Nx, \regex_toks_put_right:Nn}
+% \begin{macro}[int]{\@@_toks_put_left:Nx}
+% \begin{macro}[int]{\@@_toks_put_right:Nx, \@@_toks_put_right:Nn}
% During the building phase we wish to add \texttt{x}-expanded
% material to \tn{toks}, either to the left or to the right. The
% expansion is done \enquote{by hand} for optimization (these
% operations are used quite a lot). The \texttt{Nn} version of
-% \cs{regex_toks_put_right:Nx} is provided because it is more
+% \cs{@@_toks_put_right:Nx} is provided because it is more
% efficient than \texttt{x}-expanding with \cs{exp_not:n}.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_toks_put_left:Nx #1#2
+\cs_new_protected:Npn \@@_toks_put_left:Nx #1#2
{
- \cs_set_nopar:Npx \regex_tmp:w { #2 }
+ \cs_set_nopar:Npx \@@_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 }
+ { \exp_after:wN \@@_tmp:w \tex_the:D \tex_toks:D #1 }
}
-\cs_new_protected:Npn \regex_toks_put_right:Nx #1#2
+\cs_new_protected:Npn \@@_toks_put_right:Nx #1#2
{
- \cs_set_nopar:Npx \regex_tmp:w {#2}
+ \cs_set_nopar:Npx \@@_tmp:w {#2}
\tex_toks:D #1 \exp_after:wN
- { \tex_the:D \tex_toks:D \exp_after:wN #1 \regex_tmp:w }
+ { \tex_the:D \tex_toks:D \exp_after:wN #1 \@@_tmp:w }
}
-\cs_new_protected:Npn \regex_toks_put_right:Nn #1#2
+\cs_new_protected:Npn \@@_toks_put_right:Nn #1#2
{ \tex_toks:D #1 \exp_after:wN { \tex_the:D \tex_toks:D #1 #2 } }
% \end{macrocode}
% \end{macro}
@@ -3419,8 +3434,8 @@
%
% \begin{macro}[int]
% {
-% \regex_build_transition_left:NNN,
-% \regex_build_transition_right:nNn
+% \@@_build_transition_left:NNN,
+% \@@_build_transition_right:nNn
% }
% Add a transition from |#2| to |#3| using the function |#1|. The
% \texttt{left} function is used for higher priority transitions, and
@@ -3428,56 +3443,56 @@
% should be performed later). The signatures differ to reflect the
% differing usage later on. Both functions could be optimized.
% \begin{macrocode}
-\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 \@@_build_transition_left:NNN #1#2#3
+ { \@@_toks_put_left:Nx #2 { #1 { \int_eval:n { #3 - #2 } } } }
+\cs_new_protected:Npn \@@_build_transition_right:nNn #1#2#3
+ { \@@_toks_put_right:Nx #2 { #1 { \int_eval:n { #3 - #2 } } } }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_build_new_state:}
+% \begin{macro}[int]{\@@_build_new_state:}
% Add a new empty state to the \textsc{nfa}. Then update the
% \texttt{left}, \texttt{right}, and \texttt{max} states, so that the
% \texttt{right} state is the new empty state, and the \texttt{left}
% state points to the previously \enquote{current} state.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_build_new_state:
+\cs_new_protected_nopar:Npn \@@_build_new_state:
{
%<*trace>
\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 + \c_one }
+ L=\int_use:N \l_@@_left_state_int ~ -> ~
+ R=\int_use:N \l_@@_right_state_int ~ -> ~
+ M=\int_use:N \l_@@_max_state_int ~ -> ~
+ \int_eval:n { \l_@@_max_state_int + \c_one }
}
%</trace>
- \tex_toks:D \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
+ \tex_toks:D \l_@@_max_state_int { }
+ \int_set_eq:NN \l_@@_left_state_int \l_@@_right_state_int
+ \int_set_eq:NN \l_@@_right_state_int \l_@@_max_state_int
+ \int_incr:N \l_@@_max_state_int
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_build_transitions_lazyness:NNNNN}
+% \begin{macro}[int]{\@@_build_transitions_lazyness:NNNNN}
% This function creates a new state, and puts two transitions starting
% from the old current state. The order of the transitions is
% controlled by |#1|, true for lazy quantifiers, and false for greedy
% quantifiers.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_build_transitions_lazyness:NNNNN #1#2#3#4#5
+\cs_new_protected:Npn \@@_build_transitions_lazyness:NNNNN #1#2#3#4#5
{
- \regex_build_new_state:
- \regex_toks_put_right:Nx \l_regex_left_state_int
+ \@@_build_new_state:
+ \@@_toks_put_right:Nx \l_@@_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 } }
+ #2 { \int_eval:n { #3 - \l_@@_left_state_int } }
+ #4 { \int_eval:n { #5 - \l_@@_left_state_int } }
\else:
- #4 { \int_eval:n { #5 - \l_regex_left_state_int } }
- #2 { \int_eval:n { #3 - \l_regex_left_state_int } }
+ #4 { \int_eval:n { #5 - \l_@@_left_state_int } }
+ #2 { \int_eval:n { #3 - \l_@@_left_state_int } }
\fi:
}
}
@@ -3486,83 +3501,83 @@
%
% \subsubsection{Building classes}
%
-% \begin{macro}[int]{\regex_class:NnnnN}
-% \begin{macro}[int, rEXP]{\regex_tests_action_cost:n}
+% \begin{macro}[int]{\@@_class:NnnnN}
+% \begin{macro}[int, rEXP]{\@@_tests_action_cost:n}
% The arguments are: \meta{boolean} \Arg{tests} \Arg{min} \Arg{more}
% \meta{lazyness}. First store the tests with a trailing
-% \cs{regex_action_cost:n}, in the true branch of
-% \cs{regex_break_point:TF} for positive classes, or the false branch
+% \cs{@@_action_cost:n}, in the true branch of
+% \cs{@@_break_point:TF} for positive classes, or the false branch
% for negative classes. The integer \meta{more} is $0$ for fixed
% repetitions, $-1$ for unbounded repetitions, and
% $\meta{max}-\meta{min}$ for a range of repetitions.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_class:NnnnN #1#2#3#4#5
+\cs_new_protected:Npn \@@_class:NnnnN #1#2#3#4#5
{
- \cs_set_nopar:Npx \regex_tests_action_cost:n ##1
+ \cs_set_nopar:Npx \@@_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} } }
+ { \@@_break_point:TF { \@@_action_cost:n {##1} } { } }
+ { \@@_break_point:TF { } { \@@_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
+ \@@_class_repeat:n {#3}
+ \or: \@@_class_repeat:nN {#3} #5
+ \else: \@@_class_repeat:nnN {#3} {#4} #5
\fi:
}
-\cs_new:Npn \regex_tests_action_cost:n { \regex_action_cost:n }
+\cs_new:Npn \@@_tests_action_cost:n { \@@_action_cost:n }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_class_repeat:n}
+% \begin{macro}[aux]{\@@_class_repeat:n}
% This is used for a fixed number of repetitions. Build one state for
% each repetition, with a transition controlled by the tests that we
% have collected. That works just fine for |#1|${}=0$ repetitions:
% nothing is built.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_class_repeat:n #1
+\cs_new_protected:Npn \@@_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
+ \@@_build_new_state:
+ \@@_build_transition_right:nNn \@@_tests_action_cost:n
+ \l_@@_left_state_int \l_@@_right_state_int
}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_class_repeat:nN}
+% \begin{macro}[aux]{\@@_class_repeat:nN}
% This implements unbounded repetitions of a single class (\emph{e.g.}
% the |*| and |+| quantifiers). If the minimum number |#1| of
% repetitions is $0$, then build a transition from the current state
% to itself governed by the tests, and a free transition to a new
% state (hence skipping the tests). Otherwise, call
-% \cs{regex_class_repeat:n} for the code to match |#1| repetitions,
+% \cs{@@_class_repeat:n} for the code to match |#1| repetitions,
% and add free transitions from the last state to the previous one,
% and to a new one. In both cases, the order of transitions is
% controlled by the lazyness boolean |#2|.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_class_repeat:nN #1#2
+\cs_new_protected:Npn \@@_class_repeat:nN #1#2
{
- \if_num:w #1 = \c_zero
- \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
+ \if_int_compare:w #1 = \c_zero
+ \@@_build_transitions_lazyness:NNNNN #2
+ \@@_action_free:n \l_@@_right_state_int
+ \@@_tests_action_cost:n \l_@@_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
+ \@@_class_repeat:n {#1}
+ \int_set_eq:NN \l_@@_internal_a_int \l_@@_left_state_int
+ \@@_build_transitions_lazyness:NNNNN #2
+ \@@_action_free:n \l_@@_right_state_int
+ \@@_action_free:n \l_@@_internal_a_int
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_class_repeat:nnN}
+% \begin{macro}[aux]{\@@_class_repeat:nnN}
% We want to build the code to match from |#1| to $|#1|+|#2|$
% repetitions. Match |#1| repetitions (can be $0$). Compute the final
% state of the next construction as \texttt{a}. Build $|#2|>0$ states,
@@ -3571,16 +3586,16 @@
% \texttt{a} is safe because states are allocated in order, starting
% from \texttt{max_state}.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_class_repeat:nnN #1#2#3
+\cs_new_protected:Npn \@@_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 - \c_one }
+ \@@_class_repeat:n {#1}
+ \int_set:Nn \l_@@_internal_a_int
+ { \l_@@_max_state_int + #2 - \c_one }
\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
+ \@@_build_transitions_lazyness:NNNNN #3
+ \@@_action_free:n \l_@@_internal_a_int
+ \@@_tests_action_cost:n \l_@@_right_state_int
}
}
% \end{macrocode}
@@ -3588,7 +3603,7 @@
%
% \subsubsection{Building groups}
%
-% \begin{macro}[aux]{\regex_group_aux:nnnnN}
+% \begin{macro}[aux]{\@@_group_aux:nnnnN}
% Arguments: \Arg{label} \Arg{contents} \Arg{min} \Arg{more}
% \meta{lazyness}. If \meta{min} is $0$, we need to add a state before
% building the group, so that the thread which skips the group does
@@ -3605,146 +3620,146 @@
% auxiliaries expects \texttt{left_state} and \texttt{right_state} to
% be set properly.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_group_aux:nnnnN #1#2#3#4#5
+\cs_new_protected:Npn \@@_group_aux:nnnnN #1#2#3#4#5
{
-%<trace> \trace_push:nnn { regex } { 1 } { regex_group }
- \if_num:w #3 = \c_zero
- \regex_build_new_state:
-%<assert>\assert_int:n { \l_regex_max_state_int = \l_regex_right_state_int + 1 }
- \regex_build_transition_right:nNn \regex_action_free_group:n
- \l_regex_left_state_int \l_regex_right_state_int
+%<trace> \trace_push:nnn { regex } { 1 } { @@_group }
+ \if_int_compare:w #3 = \c_zero
+ \@@_build_new_state:
+%<assert>\assert_int:n { \l_@@_max_state_int = \l_@@_right_state_int + 1 }
+ \@@_build_transition_right:nNn \@@_action_free_group:n
+ \l_@@_left_state_int \l_@@_right_state_int
\fi:
- \regex_build_new_state:
- \regex_push_lr_states:
+ \@@_build_new_state:
+ \@@_push_lr_states:
#2
- \regex_pop_lr_states:
+ \@@_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
+ \@@_group_repeat:nn {#1} {#3}
+ \or: \@@_group_repeat:nnN {#1} {#3} #5
+ \else: \@@_group_repeat:nnnN {#1} {#3} {#4} #5
\fi:
-%<trace> \trace_pop:nnn { regex } { 1 } { regex_group }
+%<trace> \trace_pop:nnn { regex } { 1 } { @@_group }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_group:nnnN, \regex_group_no_capture:nnnN}
-% Hand to \cs{regex_group_aux:nnnnnN} the label of that group
+% \begin{macro}[int]{\@@_group:nnnN, \@@_group_no_capture:nnnN}
+% Hand to \cs{@@_group_aux:nnnnnN} the label of that group
% (expanded), and the group itself, with some extra commands to
% perform.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_group:nnnN #1
+\cs_new_protected:Npn \@@_group:nnnN #1
{
- \exp_args:No \regex_group_aux:nnnnN
- { \int_use:N \l_regex_capturing_group_int }
+ \exp_args:No \@@_group_aux:nnnnN
+ { \int_use:N \l_@@_capturing_group_int }
{
- \int_incr:N \l_regex_capturing_group_int
+ \int_incr:N \l_@@_capturing_group_int
#1
}
}
-\cs_new_protected_nopar:Npn \regex_group_no_capture:nnnN
- { \regex_group_aux:nnnnN { -1 } }
+\cs_new_protected_nopar:Npn \@@_group_no_capture:nnnN
+ { \@@_group_aux:nnnnN { -1 } }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_group_resetting:nnnN}
-% \begin{macro}[aux]{\regex_group_resetting_loop:nnNn}
-% Again, hand the label $-1$ to \cs{regex_group_aux:nnnnN}, but this
+% \begin{macro}[int]{\@@_group_resetting:nnnN}
+% \begin{macro}[aux]{\@@_group_resetting_loop:nnNn}
+% Again, hand the label $-1$ to \cs{@@_group_aux:nnnnN}, but this
% time we work a little bit harder to keep track of the maximum group
% label at the end of any branch, and to reset the group number at
% each branch. This relies on the fact that a compiled regex always is
-% a sequence of items of the form \cs{regex_branch:n} \Arg{branch}.
+% a sequence of items of the form \cs{@@_branch:n} \Arg{branch}.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_group_resetting:nnnN #1
+\cs_new_protected:Npn \@@_group_resetting:nnnN #1
{
- \regex_group_aux:nnnnN { -1 }
+ \@@_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 }
+ \exp_args:Noo \@@_group_resetting_loop:nnNn
+ { \int_use:N \l_@@_capturing_group_int }
+ { \int_use:N \l_@@_capturing_group_int }
#1
- { ?? \prg_map_break:n } { }
- \prg_break_point:n { }
+ { ?? \__prg_break:n } { }
+ \__prg_break_point:
}
}
-\cs_new_protected:Npn \regex_group_resetting_loop:nnNn #1#2#3#4
+\cs_new_protected:Npn \@@_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}
+ \use_none:nn #3 { \int_set:Nn \l_@@_capturing_group_int {#1} }
+ \int_set:Nn \l_@@_capturing_group_int {#2}
#3 {#4}
- \exp_args:Nf \regex_group_resetting_loop:nnNn
- { \int_max:nn {#1} { \l_regex_capturing_group_int } }
+ \exp_args:Nf \@@_group_resetting_loop:nnNn
+ { \int_max:nn {#1} { \l_@@_capturing_group_int } }
{#2}
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\regex_branch:n}
+% \begin{macro}[int]{\@@_branch:n}
% Add a free transition from the left state of the current group to a
% brand new state, starting point of this branch. Once the branch is
% built, add a transition from its last state to the right state of
% the group. The left and right states of the group are extracted from
% the relevant sequences.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_branch:n #1
+\cs_new_protected:Npn \@@_branch:n #1
{
-%<trace> \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
+%<trace> \trace_push:nnn { regex } { 1 } { @@_branch }
+ \@@_build_new_state:
+ \seq_get:NN \l_@@_left_state_seq \l_@@_internal_a_tl
+ \int_set:Nn \l_@@_left_state_int \l_@@_internal_a_tl
+ \@@_build_transition_right:nNn \@@_action_free:n
+ \l_@@_left_state_int \l_@@_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> \trace_pop:nnn { regex } { 1 } { regex_branch }
+ \seq_get:NN \l_@@_right_state_seq \l_@@_internal_a_tl
+ \@@_build_transition_right:nNn \@@_action_free:n
+ \l_@@_right_state_int \l_@@_internal_a_tl
+%<trace> \trace_pop:nnn { regex } { 1 } { @@_branch }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_group_repeat:nn}
+% \begin{macro}[int]{\@@_group_repeat:nn}
% This function is called to repeat a group a fixed number of times
% |#2|; if this is $0$ we remove the group altogether (but don't reset
% the \texttt{capturing_group} label). Otherwise, the auxiliary
-% \cs{regex_group_repeat_aux:n} copies |#2| times the \tn{toks} for
+% \cs{@@_group_repeat_aux:n} copies |#2| times the \tn{toks} for
% the group, and leaves \texttt{internal_a} pointing to the left end
% of the last repetition. We only record the submatch information at
% the last repetition. Finally, add a state at the end (the transition
% to it has been taken care of by the replicating auxiliary.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_group_repeat:nn #1#2
+\cs_new_protected:Npn \@@_group_repeat:nn #1#2
{
- \if_num:w #2 = \c_zero
- \int_set:Nn \l_regex_max_state_int
- { \l_regex_left_state_int - \c_one }
- \regex_build_new_state:
+ \if_int_compare:w #2 = \c_zero
+ \int_set:Nn \l_@@_max_state_int
+ { \l_@@_left_state_int - \c_one }
+ \@@_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:
+ \@@_group_repeat_aux:n {#2}
+ \@@_group_submatches:nNN {#1}
+ \l_@@_internal_a_int \l_@@_right_state_int
+ \@@_build_new_state:
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_group_submatches:nNN}
+% \begin{macro}[aux]{\@@_group_submatches:nNN}
% This inserts in states |#2| and |#3| the code for tracking
% submatches of the group |#1|, unless inhibited by a label of $-1$.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_group_submatches:nNN #1#2#3
+\cs_new_protected:Npn \@@_group_submatches:nNN #1#2#3
{
- \if_num:w #1 > \c_minus_one
- \regex_toks_put_left:Nx #2 { \regex_action_submatch:n { #1 < } }
- \regex_toks_put_left:Nx #3 { \regex_action_submatch:n { #1 > } }
+ \if_int_compare:w #1 > \c_minus_one
+ \@@_toks_put_left:Nx #2 { \@@_action_submatch:n { #1 < } }
+ \@@_toks_put_left:Nx #3 { \@@_action_submatch:n { #1 > } }
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_group_repeat_aux:n}
+% \begin{macro}[aux]{\@@_group_repeat_aux:n}
% Here we repeat \tn{toks} ranging from \texttt{left_state} to
% \texttt{max_state}, $|#1|>0$ times. First add a transition so that
% the copies will \enquote{chain} properly. Compute the shift
@@ -3754,33 +3769,33 @@
% the end, \texttt{b} is equal to the \texttt{max_state}, and
% \texttt{a} points to the left of the last copy of the group.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_group_repeat_aux:n #1
+\cs_new_protected:Npn \@@_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_num:w \int_eval:w #1 > \c_one
- \int_set:Nn \l_regex_internal_c_int
+ \@@_build_transition_right:nNn \@@_action_free:n
+ \l_@@_right_state_int \l_@@_max_state_int
+ \int_set_eq:NN \l_@@_internal_a_int \l_@@_left_state_int
+ \int_set_eq:NN \l_@@_internal_b_int \l_@@_max_state_int
+ \if_int_compare:w \__int_eval:w #1 > \c_one
+ \int_set:Nn \l_@@_internal_c_int
{
( #1 - \c_one )
- * ( \l_regex_internal_b_int - \l_regex_internal_a_int )
+ * ( \l_@@_internal_b_int - \l_@@_internal_a_int )
}
- \tex_advance:D \l_regex_right_state_int \l_regex_internal_c_int
- \tex_advance:D \l_regex_max_state_int \l_regex_internal_c_int
- \prg_replicate:nn \l_regex_internal_c_int
+ \tex_advance:D \l_@@_right_state_int \l_@@_internal_c_int
+ \tex_advance:D \l_@@_max_state_int \l_@@_internal_c_int
+ \prg_replicate:nn \l_@@_internal_c_int
{
- \tex_toks:D \l_regex_internal_b_int
- = \tex_toks:D \l_regex_internal_a_int
- \tex_advance:D \l_regex_internal_a_int \c_one
- \tex_advance:D \l_regex_internal_b_int \c_one
+ \tex_toks:D \l_@@_internal_b_int
+ = \tex_toks:D \l_@@_internal_a_int
+ \tex_advance:D \l_@@_internal_a_int \c_one
+ \tex_advance:D \l_@@_internal_b_int \c_one
}
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_group_repeat:nnN}
+% \begin{macro}[aux]{\@@_group_repeat:nnN}
% This function is called to repeat a group at least $n$ times; the
% case $n=0$ is very different from $n>0$. Assume first that $n=0$.
% Insert submatch tracking information at the start and end of the
@@ -3798,43 +3813,43 @@
% end up before submatch tracking, but that is irrelevant since it
% only does so when going again through the group, recording new
% matches. Finally, add a state; we already have a transition pointing
-% to it from \cs{regex_group_repeat_aux:n}.
-% \begin{macrocode}
-\cs_new_protected:Npn \regex_group_repeat:nnN #1#2#3
- {
- \if_num:w #2 = \c_zero
- \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 - \c_one }
- \regex_build_transition_right:nNn \regex_action_free:n
- \l_regex_right_state_int \l_regex_internal_a_int
- \regex_build_new_state:
+% to it from \cs{@@_group_repeat_aux:n}.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_group_repeat:nnN #1#2#3
+ {
+ \if_int_compare:w #2 = \c_zero
+ \@@_group_submatches:nNN {#1}
+ \l_@@_left_state_int \l_@@_right_state_int
+ \int_set:Nn \l_@@_internal_a_int
+ { \l_@@_left_state_int - \c_one }
+ \@@_build_transition_right:nNn \@@_action_free:n
+ \l_@@_right_state_int \l_@@_internal_a_int
+ \@@_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
+ \@@_build_transition_left:NNN \@@_action_free:n
+ \l_@@_internal_a_int \l_@@_right_state_int
\else:
- \regex_build_transition_right:nNn \regex_action_free:n
- \l_regex_internal_a_int \l_regex_right_state_int
+ \@@_build_transition_right:nNn \@@_action_free:n
+ \l_@@_internal_a_int \l_@@_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
+ \@@_group_repeat_aux:n {#2}
+ \@@_group_submatches:nNN {#1}
+ \l_@@_internal_a_int \l_@@_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
+ \@@_build_transition_right:nNn \@@_action_free_group:n
+ \l_@@_right_state_int \l_@@_internal_a_int
\else:
- \regex_build_transition_left:NNN \regex_action_free_group:n
- \l_regex_right_state_int \l_regex_internal_a_int
+ \@@_build_transition_left:NNN \@@_action_free_group:n
+ \l_@@_right_state_int \l_@@_internal_a_int
\fi:
- \regex_build_new_state:
+ \@@_build_new_state:
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_group_repeat:nnnN}
+% \begin{macro}[aux]{\@@_group_repeat:nnnN}
% We wish to repeat the group between |#2| and $|#2|+|#3|$ times, with
% a lazyness controlled by |#4|. We insert submatch tracking up front:
% in principle, we could avoid recording submatches for the first |#2|
@@ -3851,106 +3866,106 @@
% not follow the normal pattern: we had to add it \enquote{by hand}
% earlier.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_group_repeat:nnnN #1#2#3#4
+\cs_new_protected:Npn \@@_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 }
+ \@@_group_submatches:nNN {#1}
+ \l_@@_left_state_int \l_@@_right_state_int
+ \@@_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
+ \int_set_eq:NN \l_@@_left_state_int \l_@@_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
+ \int_sub:Nn \l_@@_left_state_int
+ { \l_@@_internal_b_int - \l_@@_internal_a_int }
+ \@@_build_transition_left:NNN \@@_action_free:n
+ \l_@@_left_state_int \l_@@_max_state_int
}
\else:
\prg_replicate:nn { #3 - \c_one }
{
- \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
+ \int_sub:Nn \l_@@_right_state_int
+ { \l_@@_internal_b_int - \l_@@_internal_a_int }
+ \@@_build_transition_right:nNn \@@_action_free:n
+ \l_@@_right_state_int \l_@@_max_state_int
}
- \if_num:w #2 = \c_zero
- \int_set:Nn \l_regex_right_state_int
- { \l_regex_left_state_int - \c_one }
+ \if_int_compare:w #2 = \c_zero
+ \int_set:Nn \l_@@_right_state_int
+ { \l_@@_left_state_int - \c_one }
\else:
- \int_sub:Nn \l_regex_right_state_int
- { \l_regex_internal_b_int - \l_regex_internal_a_int }
+ \int_sub:Nn \l_@@_right_state_int
+ { \l_@@_internal_b_int - \l_@@_internal_a_int }
\fi:
- \regex_build_transition_right:nNn \regex_action_free:n
- \l_regex_right_state_int \l_regex_max_state_int
+ \@@_build_transition_right:nNn \@@_action_free:n
+ \l_@@_right_state_int \l_@@_max_state_int
\fi:
- \regex_build_new_state:
+ \@@_build_new_state:
}
% \end{macrocode}
% \end{macro}
%
% \subsubsection{Others}
%
-% \begin{macro}[int]{\regex_assertion:Nn, \regex_b_test:, \regex_anchor:N}
-% Usage: \cs{regex_assertion:Nn} \meta{boolean} \Arg{test}, where the
+% \begin{macro}[int]{\@@_assertion:Nn, \@@_b_test:, \@@_anchor:N}
+% Usage: \cs{@@_assertion:Nn} \meta{boolean} \Arg{test}, where the
% \meta{test} is either of the two other functions. Add a free
% transition to a new state, conditionally to the assertion test. The
-% \cs{regex_b_test:} test is used by the |\b| and |\B| escape: check
+% \cs{@@_b_test:} test is used by the |\b| and |\B| escape: check
% if the last character was a word character or not, and do the same
% to the current character. The boundary-markers of the string are
% non-word characters for this purpose. Anchors at the start or end
-% of match use \cs{regex_anchor:N}, with a position controlled by the
+% of match use \cs{@@_anchor:N}, with a position controlled by the
% integer |#1|.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_assertion:Nn #1#2
+\cs_new_protected:Npn \@@_assertion:Nn #1#2
{
- \regex_build_new_state:
- \regex_toks_put_right:Nx \l_regex_left_state_int
+ \@@_build_new_state:
+ \@@_toks_put_right:Nx \l_@@_left_state_int
{
\exp_not:n {#2}
- \regex_break_point:TF
+ \@@_break_point:TF
\bool_if:NF #1 { { } }
{
- \regex_action_free:n
+ \@@_action_free:n
{
\int_eval:n
- { \l_regex_right_state_int - \l_regex_left_state_int }
+ { \l_@@_right_state_int - \l_@@_left_state_int }
}
}
\bool_if:NT #1 { { } }
}
}
-\cs_new_protected:Npn \regex_anchor:N #1
+\cs_new_protected:Npn \@@_anchor:N #1
{
- \if_num:w #1 = \l_regex_current_pos_int
- \exp_after:wN \regex_break_true:w
+ \if_int_compare:w #1 = \l_@@_current_pos_int
+ \exp_after:wN \@@_break_true:w
\fi:
}
-\cs_new_protected_nopar:Npn \regex_b_test:
+\cs_new_protected_nopar:Npn \@@_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: }
+ \int_set_eq:NN \l_@@_current_char_int \l_@@_last_char_int
+ \@@_prop_w:
+ \@@_break_point:TF
+ { \group_end: \@@_item_reverse:n \@@_prop_w: }
+ { \group_end: \@@_prop_w: }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_command_K:}
+% \begin{macro}[int]{\@@_command_K:}
% Change the starting point of the $0$-th submatch (full match), and
% transition to a new state, pretending that this is a fresh thread.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_command_K:
+\cs_new_protected_nopar:Npn \@@_command_K:
{
- \regex_build_new_state:
- \regex_toks_put_right:Nx \l_regex_left_state_int
+ \@@_build_new_state:
+ \@@_toks_put_right:Nx \l_@@_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
+ \@@_action_submatch:n { 0< }
+ \bool_set_true:N \l_@@_fresh_thread_bool
+ \@@_action_free:n
+ { \int_eval:n { \l_@@_right_state_int - \l_@@_left_state_int } }
+ \bool_set_false:N \l_@@_fresh_thread_bool
}
}
% \end{macrocode}
@@ -3991,8 +4006,8 @@
% match, should have a higher priority than not going through the group.
%
% We solve this by distinguishing \enquote{normal} free transitions
-% \cs{regex_action_free:n} from transitions
-% \cs{regex_action_free_group:n} which go back to the start of the
+% \cs{@@_action_free:n} from transitions
+% \cs{@@_action_free_group:n} which go back to the start of the
% group. The former will keep threads unless they have been visited by a
% \enquote{completed} thread, while the latter kind of transition also
% prevents going back to a state visited by the current thread.
@@ -4001,11 +4016,11 @@
%
% \begin{variable}
% {
-% \l_regex_min_pos_int,
-% \l_regex_max_pos_int,
-% \l_regex_current_pos_int,
-% \l_regex_start_pos_int,
-% \l_regex_success_pos_int,
+% \l_@@_min_pos_int,
+% \l_@@_max_pos_int,
+% \l_@@_current_pos_int,
+% \l_@@_start_pos_int,
+% \l_@@_success_pos_int,
% }
% The tokens in the query are indexed from \texttt{min_pos} for the
% first to $\texttt{max_pos}-1$ for the last, and their information is
@@ -4018,20 +4033,20 @@
% updated whenever a thread succeeds, is used as the next starting
% position.
% \begin{macrocode}
-\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_@@_min_pos_int
+\int_new:N \l_@@_max_pos_int
+\int_new:N \l_@@_current_pos_int
+\int_new:N \l_@@_start_pos_int
+\int_new:N \l_@@_success_pos_int
% \end{macrocode}
% \end{variable}
%
% \begin{variable}
% {
-% \l_regex_current_char_int,
-% \l_regex_current_catcode_int,
-% \l_regex_last_char_int,
-% \l_regex_case_changed_char_int
+% \l_@@_current_char_int,
+% \l_@@_current_catcode_int,
+% \l_@@_last_char_int,
+% \l_@@_case_changed_char_int
% }
% The character and category codes of the token at the current
% position; the character code of the token at the previous position;
@@ -4041,40 +4056,40 @@
% \texttt{current_char} variable is also used in various other phases
% to hold a character code.
% \begin{macrocode}
-\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_@@_current_char_int
+\int_new:N \l_@@_current_catcode_int
+\int_new:N \l_@@_last_char_int
+\int_new:N \l_@@_case_changed_char_int
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_regex_current_state_int}
+% \begin{variable}{\l_@@_current_state_int}
% For every character in the token list, each of the active states is
-% considered in turn. The variable \cs{l_regex_current_state_int}
+% considered in turn. The variable \cs{l_@@_current_state_int}
% holds the state of the \textsc{nfa} which is currently considered:
% transitions are then given as shifts relative to the current state.
% \begin{macrocode}
-\int_new:N \l_regex_current_state_int
+\int_new:N \l_@@_current_state_int
% \end{macrocode}
% \end{variable}
%
% \begin{variable}
-% {\l_regex_current_submatches_prop, \l_regex_success_submatches_prop}
+% {\l_@@_current_submatches_prop, \l_@@_success_submatches_prop}
% The submatches for the thread which is currently active are stored
% in the \texttt{current_submatches} property list variable. This
-% property list is stored by \cs{regex_action_cost:n} into the
+% property list is stored by \cs{@@_action_cost:n} into the
% \tn{toks} register for the target state of the transition, to be
% retrieved when matching at the next position. When a thread
% succeeds, this property list is copied to
-% \cs{l_regex_success_submatches_prop}: only the last sucessful thread
+% \cs{l_@@_success_submatches_prop}: only the last sucessful thread
% will remain there.
% \begin{macrocode}
-\prop_new:N \l_regex_current_submatches_prop
-\prop_new:N \l_regex_success_submatches_prop
+\prop_new:N \l_@@_current_submatches_prop
+\prop_new:N \l_@@_success_submatches_prop
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_regex_step_int}
+% \begin{variable}{\l_@@_step_int}
% This integer, always even, is increased every time a character in
% the query is read, and not reset when doing multiple matches. For
% each \meta{state} in the \textsc{nfa} we store in
@@ -4089,11 +4104,11 @@
% attach each set of submatch information to a given iteration (and
% automatically discard it when it corresponds to a past step).
% \begin{macrocode}
-\int_new:N \l_regex_step_int
+\int_new:N \l_@@_step_int
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_regex_min_active_int, \l_regex_max_active_int}
+% \begin{variable}{\l_@@_min_active_int, \l_@@_max_active_int}
% All the currently active states are kept in order of precedence in
% the \tn{skip} registers, and the corresponding submatches in the
% \tn{toks}. For our purposes, those serve as an array, indexed from
@@ -4102,71 +4117,71 @@
% space can immediately be reused, and \texttt{max_active} is reset to
% \texttt{min_active}, effectively clearing the array.
% \begin{macrocode}
-\int_new:N \l_regex_min_active_int
-\int_new:N \l_regex_max_active_int
+\int_new:N \l_@@_min_active_int
+\int_new:N \l_@@_max_active_int
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_regex_every_match_tl}
+% \begin{variable}{\l_@@_every_match_tl}
% Every time a match is found, this token list is used. For single
% matching, the token list is empty. For multiple matching, the token
% list is set to repeat the matching, after performing some operation
-% which depends on the user function. See \cs{regex_single_match:} and
-% \cs{regex_multi_match:n}.
+% which depends on the user function. See \cs{@@_single_match:} and
+% \cs{@@_multi_match:n}.
% \begin{macrocode}
-\tl_new:N \l_regex_every_match_tl
+\tl_new:N \l_@@_every_match_tl
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_regex_fresh_thread_bool, \l_regex_empty_success_bool}
-% \begin{macro}[aux]{\regex_if_two_empty_matches:F}
+% \begin{variable}{\l_@@_fresh_thread_bool, \l_@@_empty_success_bool}
+% \begin{macro}[aux]{\@@_if_two_empty_matches:F}
% When doing multiple matches, we need to avoid infinite loops where
% each iteration matches the same empty token list. When an empty
% token list is matched, the next successful match of the same empty
% token list is suppressed. We detect empty matches by setting
-% \cs{l_regex_fresh_thread_bool} to \texttt{true} for threads which
+% \cs{l_@@_fresh_thread_bool} to \texttt{true} for threads which
% directly come from the start of the regex or from the |\K| command,
% and testing that boolean whenever a thread succeeds. The function
-% \cs{regex_if_two_empty_matches:F} is redefined at every match
+% \cs{@@_if_two_empty_matches:F} is redefined at every match
% attempt, depending on whether the previous match was empty or not:
% if it was, then the function must cancel a purported success if it
% is empty and at the same spot as the previous match; otherwise, we
% definitely don't have two identical empty matches, so the function
% is \cs{use:n}.
% \begin{macrocode}
-\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 \l_@@_fresh_thread_bool
+\bool_new:N \l_@@_empty_success_bool
+\cs_new_eq:NN \@@_if_two_empty_matches:F \use:n
% \end{macrocode}
% \end{macro}
% \end{variable}
%
% \begin{variable}
% {
-% \g_regex_success_bool,
-% \l_regex_saved_success_bool,
-% \l_regex_match_success_bool
+% \g_@@_success_bool,
+% \l_@@_saved_success_bool,
+% \l_@@_match_success_bool
% }
-% The boolean \cs{l_regex_match_success_bool} is true if the current
-% match attempt was successful, and \cs{g_regex_success_bool} is true
+% The boolean \cs{l_@@_match_success_bool} is true if the current
+% match attempt was successful, and \cs{g_@@_success_bool} is true
% if there was at least one successful match. This is the only global
% variable in this whole module, but we would need it to be local when
% matching a control sequence with |\c{...}|. This is done by saving
-% the global variable into \cs{l_regex_saved_success_bool}, which is
+% the global variable into \cs{l_@@_saved_success_bool}, which is
% local, hence not affected by the changes due to inner regex
% functions.
% \begin{macrocode}
-\bool_new:N \g_regex_success_bool
-\bool_new:N \l_regex_saved_success_bool
-\bool_new:N \l_regex_match_success_bool
+\bool_new:N \g_@@_success_bool
+\bool_new:N \l_@@_saved_success_bool
+\bool_new:N \l_@@_match_success_bool
% \end{macrocode}
% \end{variable}
%
% \subsubsection{Matching: framework}
%
-% \begin{macro}[int]{\regex_match:n}
+% \begin{macro}[int]{\@@_match:n}
% First store the query into \tn{toks} and \tn{muskip} registers (see
-% \cs{regex_query_set:nnn}). Then initialize the variables that should
+% \cs{@@_query_set:nnn}). Then initialize the variables that should
% be set once for each user function (even for multiple
% matches). Namely, the overall matching is not yet sucessful; none of
% the states should be marked as visited (\tn{dimen} registers), and
@@ -4175,39 +4190,39 @@
% smothering an empty match at the start). Once all this is set up, we
% are ready for the ride. Find the first match.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_match:n #1
+\cs_new_protected:Npn \@@_match:n #1
{
-%<trace> \trace_push:nnx { regex } { 1 } { regex_match }
+%<trace> \trace_push:nnx { regex } { 1 } { @@_match }
%<trace> \trace:nnx { regex } { 1 } { analyzing~query~token~list }
- \int_zero:N \l_regex_balance_int
- \int_set:Nn \l_regex_current_pos_int { \c_two * \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 }
+ \int_zero:N \l_@@_balance_int
+ \int_set:Nn \l_@@_current_pos_int { \c_two * \l_@@_max_state_int }
+ \@@_query_set:nnn { } { -1 } { -2 }
+ \int_set_eq:NN \l_@@_min_pos_int \l_@@_current_pos_int
+ \__tl_analysis_map_inline:nn {#1}
+ { \@@_query_set:nnn {##1} {"##2} {##3} }
+ \int_set_eq:NN \l_@@_max_pos_int \l_@@_current_pos_int
+ \@@_query_set:nnn { } { -1 } { -2 }
%<trace> \trace:nnx { regex } { 1 } { initializing }
- \bool_gset_false:N \g_regex_success_bool
- \prg_stepwise_inline:nnnn
- \l_regex_min_state_int \c_one { \l_regex_max_state_int - \c_one }
+ \bool_gset_false:N \g_@@_success_bool
+ \int_step_inline:nnnn
+ \l_@@_min_state_int \c_one { \l_@@_max_state_int - \c_one }
{ \tex_dimen:D ##1 \c_one sp \scan_stop: }
- \int_set_eq:NN \l_regex_min_active_int \l_regex_max_state_int
- \int_set_eq:NN \l_regex_step_int \c_zero
- \int_set_eq:NN \l_regex_success_pos_int \l_regex_min_pos_int
- \int_set:Nn \l_regex_submatch_int
- { \c_two * \l_regex_max_state_int }
- \bool_set_false:N \l_regex_empty_success_bool
- \regex_match_once:
-%<trace> \trace_pop:nnx { regex } { 1 } { regex_match }
+ \int_set_eq:NN \l_@@_min_active_int \l_@@_max_state_int
+ \int_set_eq:NN \l_@@_step_int \c_zero
+ \int_set_eq:NN \l_@@_success_pos_int \l_@@_min_pos_int
+ \int_set:Nn \l_@@_submatch_int
+ { \c_two * \l_@@_max_state_int }
+ \bool_set_false:N \l_@@_empty_success_bool
+ \@@_match_once:
+%<trace> \trace_pop:nnx { regex } { 1 } { @@_match }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_match_once:}
+% \begin{macro}[int]{\@@_match_once:}
% This function finds one match, then does some action defined by the
% \texttt{every_match} token list, which may recursively call
-% \cs{regex_match_once:}. First initialize some variables: set the
+% \cs{@@_match_once:}. First initialize some variables: set the
% conditional which detects identical empty matches; this match
% attempt starts at the previous \texttt{success_pos}, is not yet
% sucessful, and has no submatches yet; clear the array of active
@@ -4215,148 +4230,149 @@
% ready to read our first token in the query, but we actually start
% one position earlier than the start, and \texttt{get} that token, so
% that the \texttt{last_char} will be set properly for word
-% boundaries. Then call \cs{regex_match_loop:}, which runs through the
+% boundaries. Then call \cs{@@_match_loop:}, which runs through the
% query until the end or until a successful match breaks early.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_match_once:
+\cs_new_protected_nopar:Npn \@@_match_once:
{
- \if_meaning:w \c_true_bool \l_regex_empty_success_bool
- \cs_set_nopar:Npn \regex_if_two_empty_matches:F
- { \int_compare:nNnF \l_regex_start_pos_int = \l_regex_current_pos_int }
+ \if_meaning:w \c_true_bool \l_@@_empty_success_bool
+ \cs_set_nopar:Npn \@@_if_two_empty_matches:F
+ { \int_compare:nNnF \l_@@_start_pos_int = \l_@@_current_pos_int }
\else:
- \cs_set_eq:NN \regex_if_two_empty_matches:F \use:n
+ \cs_set_eq:NN \@@_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 - \c_one }
- \regex_query_get:
- \regex_match_loop:
- \l_regex_every_match_tl
+ \int_set_eq:NN \l_@@_start_pos_int \l_@@_success_pos_int
+ \bool_set_false:N \l_@@_match_success_bool
+ \prop_clear:N \l_@@_current_submatches_prop
+ \int_set_eq:NN \l_@@_max_active_int \l_@@_min_active_int
+ \@@_store_state:n { \l_@@_min_state_int }
+ \int_set:Nn \l_@@_current_pos_int
+ { \l_@@_start_pos_int - \c_one }
+ \@@_query_get:
+ \@@_match_loop:
+ \l_@@_every_match_tl
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_single_match:, \regex_multi_match:n}
+% \begin{macro}[int]{\@@_single_match:, \@@_multi_match:n}
% For a single match, the overall success is determined by whether the
% only match attempt is a success. When doing multiple matches, the
% overall matching is successful as soon as any match
% succeeds. Perform the action |#1|, then find the next match.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_single_match:
+\cs_new_protected_nopar:Npn \@@_single_match:
{
- \tl_set:Nn \l_regex_every_match_tl
- { \bool_gset_eq:NN \g_regex_success_bool \l_regex_match_success_bool }
+ \tl_set:Nn \l_@@_every_match_tl
+ { \bool_gset_eq:NN \g_@@_success_bool \l_@@_match_success_bool }
}
-\cs_new_protected:Npn \regex_multi_match:n #1
+\cs_new_protected:Npn \@@_multi_match:n #1
{
- \tl_set:Nn \l_regex_every_match_tl
+ \tl_set:Nn \l_@@_every_match_tl
{
- \if_meaning:w \c_true_bool \l_regex_match_success_bool
- \bool_gset_true:N \g_regex_success_bool
+ \if_meaning:w \c_true_bool \l_@@_match_success_bool
+ \bool_gset_true:N \g_@@_success_bool
#1
- \exp_after:wN \regex_match_once:
+ \exp_after:wN \@@_match_once:
\fi:
}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_match_loop:}
-% \begin{macro}[aux, rEXP]{\regex_match_one_active:w}
+% \begin{macro}[aux]{\@@_match_loop:}
+% \begin{macro}[aux, rEXP]{\@@_match_one_active:w}
% At each new position, set some variables and get the new character
% and category from the query. Then unpack the array of active
% threads, and clear it by resetting its length
% (\texttt{max_active}). This results in a sequence of
-% \cs{regex_use_state_and_submatches:nn} \Arg{state} \Arg{prop}, and
+% \cs{@@_use_state_and_submatches:nn} \Arg{state} \Arg{prop}, and
% we consider those states one by one in order. As soon as a thread
% succeeds, exit the step, and, if there are threads to consider at the
% next position, and we have not reached the end of the string,
% repeat the loop. Otherwise, the last thread that succeeded is what
-% \cs{regex_match_once:} matches. We explain the \texttt{fresh_thread}
-% business when describing \cs{regex_action_wildcard:}.
+% \cs{@@_match_once:} matches. We explain the \texttt{fresh_thread}
+% business when describing \cs{@@_action_wildcard:}.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_match_loop:
+\cs_new_protected_nopar:Npn \@@_match_loop:
{
- \tex_advance:D \l_regex_step_int \c_two
- \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:
+ \tex_advance:D \l_@@_step_int \c_two
+ \int_incr:N \l_@@_current_pos_int
+ \int_set_eq:NN \l_@@_last_char_int \l_@@_current_char_int
+ \int_set_eq:NN \l_@@_case_changed_char_int \c_max_int
+ \@@_query_get:
\use:x
{
- \int_set_eq:NN \l_regex_max_active_int \l_regex_min_active_int
- \exp_after:wN \regex_match_one_active:w
- \int_use:N \l_regex_min_active_int ;
+ \int_set_eq:NN \l_@@_max_active_int \l_@@_min_active_int
+ \exp_after:wN \@@_match_one_active:w
+ \int_use:N \l_@@_min_active_int ;
}
- \prg_break_point:n { \bool_set_false:N \l_regex_fresh_thread_bool }
- \if_num:w \l_regex_max_active_int > \l_regex_min_active_int
- \if_num:w \l_regex_current_pos_int < \l_regex_max_pos_int
- \exp_after:wN \exp_after:wN \exp_after:wN \regex_match_loop:
+ \__prg_break_point:
+ \bool_set_false:N \l_@@_fresh_thread_bool %^^A was arg of break_point:n
+ \if_int_compare:w \l_@@_max_active_int > \l_@@_min_active_int
+ \if_int_compare:w \l_@@_current_pos_int < \l_@@_max_pos_int
+ \exp_after:wN \exp_after:wN \exp_after:wN \@@_match_loop:
\fi:
\fi:
}
-\cs_new:Npn \regex_match_one_active:w #1;
+\cs_new:Npn \@@_match_one_active:w #1;
{
- \if_num:w #1 < \l_regex_max_active_int
- \regex_use_state_and_submatches:nn
- { \int_value:w \tex_skip:D #1 }
+ \if_int_compare:w #1 < \l_@@_max_active_int
+ \@@_use_state_and_submatches:nn
+ { \__int_value:w \tex_skip:D #1 }
{ \tex_the:D \tex_toks:D #1 }
- \exp_after:wN \regex_match_one_active:w
- \int_use:N \int_eval:w #1 + \c_one \exp_after:wN ;
+ \exp_after:wN \@@_match_one_active:w
+ \int_use:N \__int_eval:w #1 + \c_one \exp_after:wN ;
\fi:
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_query_set:nnn}
+% \begin{macro}[aux]{\@@_query_set:nnn}
% The arguments are: tokens that \texttt{o} and \texttt{x} expand to
% one token of the query, the catcode, and the character code. Store
% those, and the current brace balance (used later to check for
% overall brace balance) in a \tn{muskip} register and a \tn{toks},
% then update the \texttt{balance}.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_query_set:nnn #1#2#3
+\cs_new_protected:Npn \@@_query_set:nnn #1#2#3
{
- \tex_muskip:D \l_regex_current_pos_int
+ \tex_muskip:D \l_@@_current_pos_int
= \etex_gluetomu:D
#3 sp
plus #2 sp
- minus \l_regex_balance_int sp
+ minus \l_@@_balance_int sp
\scan_stop:
- \tex_toks:D \l_regex_current_pos_int {#1}
- \int_incr:N \l_regex_current_pos_int
+ \tex_toks:D \l_@@_current_pos_int {#1}
+ \int_incr:N \l_@@_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
+ \or: \int_incr:N \l_@@_balance_int
+ \or: \int_decr:N \l_@@_balance_int
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_query_get:}
+% \begin{macro}[aux]{\@@_query_get:}
% Extract the current character and category codes from the
% \tn{muskip} register of the current position: those are the main and
% the stretch components, and we need a conversion to avoid \TeX{}'s
% \enquote{incompatible glue units} error.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_query_get:
+\cs_new_protected_nopar:Npn \@@_query_get:
{
- \l_regex_current_char_int
- = \etex_mutoglue:D \tex_muskip:D \l_regex_current_pos_int
- \l_regex_current_catcode_int = \etex_gluestretch:D
- \etex_mutoglue:D \tex_muskip:D \l_regex_current_pos_int
+ \l_@@_current_char_int
+ = \etex_mutoglue:D \tex_muskip:D \l_@@_current_pos_int
+ \l_@@_current_catcode_int = \etex_gluestretch:D
+ \etex_mutoglue:D \tex_muskip:D \l_@@_current_pos_int
}
% \end{macrocode}
% \end{macro}
%
% \subsubsection{Using states of the \textsc{nfa}}
%
-% \begin{macro}[int]{\regex_use_state:}
+% \begin{macro}[int]{\@@_use_state:}
% Use the current \textsc{nfa} instruction. The state is initially
% marked as belonging to the current \texttt{step}: this allows normal
% free transition to repeat, but group-repeating transitions
@@ -4364,32 +4380,33 @@
% state is marked as $\texttt{step}+1$: any thread hitting it at that
% point will be terminated.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_use_state:
+\cs_new_protected_nopar:Npn \@@_use_state:
{
%<*trace>
- \trace:nnx { regex } { 2 } { state~\int_use:N \l_regex_current_state_int }
+ \trace:nnx { regex } { 2 } { state~\int_use:N \l_@@_current_state_int }
%</trace>
- \tex_dimen:D \l_regex_current_state_int
- = \l_regex_step_int sp \scan_stop:
- \tex_the:D \tex_toks:D \l_regex_current_state_int
- \tex_dimen:D \l_regex_current_state_int
- = \int_eval:w \l_regex_step_int + \c_one \int_eval_end: sp \scan_stop:
+ \tex_dimen:D \l_@@_current_state_int
+ = \l_@@_step_int sp \scan_stop:
+ \tex_the:D \tex_toks:D \l_@@_current_state_int
+ \tex_dimen:D \l_@@_current_state_int
+ = \__int_eval:w \l_@@_step_int + \c_one \__int_eval_end: sp \scan_stop:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_use_state_and_submatches:nn}
+% \begin{macro}[int]{\@@_use_state_and_submatches:nn}
% This function is called as one item in the array of active threads
% after that array has been unpacked for a new step. Update the
% \texttt{current_state} and \texttt{current_submatches} and use the
% state if it has not yet been encountered at this step.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_use_state_and_submatches:nn #1 #2
+\cs_new_protected:Npn \@@_use_state_and_submatches:nn #1 #2
{
- \int_set:Nn \l_regex_current_state_int {#1}
- \if_num:w \tex_dimen:D \l_regex_current_state_int < \l_regex_step_int
- \tl_set:Nn \l_regex_current_submatches_prop {#2}
- \exp_after:wN \regex_use_state:
+ \int_set:Nn \l_@@_current_state_int {#1}
+ \if_int_compare:w \tex_dimen:D \l_@@_current_state_int
+ < \l_@@_step_int
+ \tl_set:Nn \l_@@_current_submatches_prop {#2}
+ \exp_after:wN \@@_use_state:
\fi:
\scan_stop:
}
@@ -4398,31 +4415,31 @@
%
% \subsubsection{Actions when matching}
%
-% \begin{macro}[int]{\regex_action_start_wildcard:}
+% \begin{macro}[int]{\@@_action_start_wildcard:}
% For an unanchored match, state $0$ has a free transition to the next
% and a costly one to itself, to repeat at the next position. To catch
% repeated identical empty matches, we need to know if a successful
% thread corresponds to an empty match. The instruction resetting
-% \cs{l_regex_fresh_thread_bool} may be skipped by a successful
-% thread, hence we had to add it to \cs{regex_match_loop:} too.
+% \cs{l_@@_fresh_thread_bool} may be skipped by a successful
+% thread, hence we had to add it to \cs{@@_match_loop:} too.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_action_start_wildcard:
+\cs_new_protected_nopar:Npn \@@_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}
+ \bool_set_true:N \l_@@_fresh_thread_bool
+ \@@_action_free:n {1}
+ \bool_set_false:N \l_@@_fresh_thread_bool
+ \@@_action_cost:n {0}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_action_free:n, \regex_action_free_group:n}
-% \begin{macro}[aux]{\regex_action_free_aux:nn}
+% \begin{macro}[int]{\@@_action_free:n, \@@_action_free_group:n}
+% \begin{macro}[aux]{\@@_action_free_aux:nn}
% These functions copy a thread after checking that the \textsc{nfa}
% state has not already been used at this position. If not, store
% submatches in the new state, and insert the instructions for that
% state in the input stream. Then restore the old value of
-% \cs{l_regex_current_state_int} and of the current submatches. The
+% \cs{l_@@_current_state_int} and of the current submatches. The
% two types of free transitions differ by how they test that the state
% has not been encountered yet: the \texttt{group} version is
% stricter, and will not use a state if it was used earlier in the
@@ -4430,116 +4447,116 @@
% \enquote{normal} version will revisit a state when within the thread
% itself.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_action_free:n
- { \regex_action_free_aux:nn { > \l_regex_step_int \else: } }
-\cs_new_protected_nopar: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
+\cs_new_protected_nopar:Npn \@@_action_free:n
+ { \@@_action_free_aux:nn { > \l_@@_step_int \else: } }
+\cs_new_protected_nopar:Npn \@@_action_free_group:n
+ { \@@_action_free_aux:nn { < \l_@@_step_int } }
+\cs_new_protected:Npn \@@_action_free_aux:nn #1#2
{
\use:x
{
- \int_add:Nn \l_regex_current_state_int {#2}
+ \int_add:Nn \l_@@_current_state_int {#2}
\exp_not:n
{
- \if_num:w \tex_dimen:D \l_regex_current_state_int #1
- \exp_after:wN \regex_use_state:
+ \if_int_compare:w \tex_dimen:D \l_@@_current_state_int #1
+ \exp_after:wN \@@_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 }
+ \int_set:Nn \l_@@_current_state_int
+ { \int_use:N \l_@@_current_state_int }
+ \tl_set:Nn \exp_not:N \l_@@_current_submatches_prop
+ { \exp_not:o \l_@@_current_submatches_prop }
}
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\regex_action_cost:n}
+% \begin{macro}[int]{\@@_action_cost:n}
% A transition which consumes the current character and shifts the
% state by |#1|. The resulting state is stored in the \tn{skip} array
% for use at the next position, and we also store the current
% submatches.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_action_cost:n #1
+\cs_new_protected:Npn \@@_action_cost:n #1
{
- \exp_args:No \regex_store_state:n
- { \int_use:N \int_eval:w \l_regex_current_state_int + #1 }
+ \exp_args:No \@@_store_state:n
+ { \int_use:N \__int_eval:w \l_@@_current_state_int + #1 }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_store_state:n}
-% \begin{macro}[aux]{\regex_store_submatches:}
+% \begin{macro}[int]{\@@_store_state:n}
+% \begin{macro}[aux]{\@@_store_submatches:}
% Put the given state in the array of \tn{skip} registers (converted
% to a dimension in scaled points), and increment the length of the
% array. Then store the current submatch in the This is done by
-% increasing the pointer \cs{l_regex_max_active_int}, and converting
+% increasing the pointer \cs{l_@@_max_active_int}, and converting
% the integer to a dimension (suitable for a \tn{skip} assignment) in
% scaled points.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_store_state:n #1
+\cs_new_protected:Npn \@@_store_state:n #1
{
- \regex_store_submatches:
- \tex_skip:D \l_regex_max_active_int = #1 sp \scan_stop:
- \int_incr:N \l_regex_max_active_int
+ \@@_store_submatches:
+ \tex_skip:D \l_@@_max_active_int = #1 sp \scan_stop:
+ \int_incr:N \l_@@_max_active_int
}
-\cs_new_protected_nopar:Npn \regex_store_submatches:
+\cs_new_protected_nopar:Npn \@@_store_submatches:
{
- \tex_toks:D \l_regex_max_active_int \exp_after:wN
- { \l_regex_current_submatches_prop }
+ \tex_toks:D \l_@@_max_active_int \exp_after:wN
+ { \l_@@_current_submatches_prop }
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\regex_disable_submatches:}
+% \begin{macro}[int]{\@@_disable_submatches:}
% Some user functions don't require tracking submatches.
% We get a performance improvement by simply defining the
% relevant functions to remove their argument and do nothing
% with it.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_disable_submatches:
+\cs_new_protected_nopar:Npn \@@_disable_submatches:
{
- \cs_set_protected_nopar:Npn \regex_store_submatches: { }
- \cs_set_protected:Npn \regex_action_submatch:n ##1 { }
+ \cs_set_protected_nopar:Npn \@@_store_submatches: { }
+ \cs_set_protected:Npn \@@_action_submatch:n ##1 { }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_action_submatch:n}
+% \begin{macro}[int]{\@@_action_submatch:n}
% Update the current submatches with the information from the current
% position. Maybe a bottleneck.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_action_submatch:n #1
+\cs_new_protected:Npn \@@_action_submatch:n #1
{
- \prop_put:Nno \l_regex_current_submatches_prop {#1}
- { \int_use:N \l_regex_current_pos_int }
+ \prop_put:Nno \l_@@_current_submatches_prop {#1}
+ { \int_use:N \l_@@_current_pos_int }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\regex_action_success:}
+% \begin{macro}[int]{\@@_action_success:}
% There is a successful match when an execution path reaches the last
% state in the \textsc{nfa}, unless this marks a second identical
% empty match. Then mark that there was a successful match; it is
% empty if it is \enquote{fresh}; and we store the current position
% and submatches. The current step is then interrupted with
-% \cs{prg_map_break:}, and only paths with higher precedence are
+% \cs{__prg_break:}, and only paths with higher precedence are
% pursued further. The values stored here may be overwritten by a
% later success of a path with higher precedence.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_action_success:
+\cs_new_protected_nopar:Npn \@@_action_success:
{
- \regex_if_two_empty_matches:F
+ \@@_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_map_break:
+ \bool_set_true:N \l_@@_match_success_bool
+ \bool_set_eq:NN \l_@@_empty_success_bool
+ \l_@@_fresh_thread_bool
+ \int_set_eq:NN \l_@@_success_pos_int \l_@@_current_pos_int
+ \prop_set_eq:NN \l_@@_success_submatches_prop
+ \l_@@_current_submatches_prop
+ \__prg_break:
}
}
% \end{macrocode}
@@ -4549,27 +4566,27 @@
%
% \subsubsection{Variables and helpers used in replacement}
%
-% \begin{variable}{\l_regex_replacement_csnames_int}
+% \begin{variable}{\l_@@_replacement_csnames_int}
% The behaviour of closing braces inside a replacement text depends on
% whether a sequences |\c{| or |\u{| has been encountered. The number
% of \enquote{open} such sequences that should be closed by |}| is
-% stored in \cs{l_regex_replacement_csnames_int}, and decreased by
+% stored in \cs{l_@@_replacement_csnames_int}, and decreased by
% $1$ by each |}|.
% \begin{macrocode}
-\int_new:N \l_regex_replacement_csnames_int
+\int_new:N \l_@@_replacement_csnames_int
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_regex_balance_tl}
+% \begin{variable}{\l_@@_balance_tl}
% This token list holds the replacement text for
-% \cs{regex_replacement_balance_one_match:n} while it is being built
+% \cs{@@_replacement_balance_one_match:n} while it is being built
% incrementally.
% \begin{macrocode}
-\tl_new:N \l_regex_balance_tl
+\tl_new:N \l_@@_balance_tl
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}[aux, rEXP]{\regex_replacement_balance_one_match:n}
+% \begin{macro}[aux, rEXP]{\@@_replacement_balance_one_match:n}
% This expects as an argument the first index of a range of \tn{skip}
% registers which hold the submatch information for a given match. It
% can be used within an integer expression to obtain the brace balance
@@ -4582,13 +4599,13 @@
% function must result in a valid integer expression (hence a leading
% |+| in the actual definition).
% \begin{macrocode}
-\cs_new:Npn \regex_replacement_balance_one_match:n #1
- { - \regex_submatch_balance:n {#1} }
+\cs_new:Npn \@@_replacement_balance_one_match:n #1
+ { - \@@_submatch_balance:n {#1} }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux, rEXP]{\regex_replacement_do_one_match:n}
-% The input is the same as \cs{regex_replacement_balance_one_match:n}.
+% \begin{macro}[aux, rEXP]{\@@_replacement_do_one_match:n}
+% The input is the same as \cs{@@_replacement_balance_one_match:n}.
% This function is redefined to expand to the part of the token list
% from the end of the previous match to a given match, followed by the
% replacement text. Hence concatenating the result of this function
@@ -4597,16 +4614,16 @@
% will produce the fully replaced token list. The initialization does
% not matter, but we set it as for an empty replacement.
% \begin{macrocode}
-\cs_new:Npn \regex_replacement_do_one_match:n #1
+\cs_new:Npn \@@_replacement_do_one_match:n #1
{
- \regex_query_range:nn
+ \@@_query_range:nn
{ \etex_glueshrink:D \tex_skip:D #1 }
{ \tex_skip:D #1 }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_exp_not:N}
+% \begin{macro}[aux]{\@@_replacement_exp_not:N}
% This function lets us navigate around the fact that the primitive
% \cs{exp_not:n} requires a braced argument. As far as I can tell, it
% is only needed if the user tries to include in the replacement text
@@ -4615,18 +4632,18 @@
% assignment, \cs{exp_not:N}~|#| behaves as a single |#|, whereas
% \cs{exp_not:n}~|{#}| behaves as a doubled |##|.
% \begin{macrocode}
-\cs_new:Npn \regex_replacement_exp_not:N #1 { \exp_not:n {#1} }
+\cs_new:Npn \@@_replacement_exp_not:N #1 { \exp_not:n {#1} }
% \end{macrocode}
% \end{macro}
%
% \subsubsection{Query and brace balance}
%
-% \begin{macro}[int, rEXP]{\regex_query_range:nn}
-% \begin{macro}[aux, rEXP]{\regex_query_range_loop:ww}
+% \begin{macro}[int, rEXP]{\@@_query_range:nn}
+% \begin{macro}[aux, rEXP]{\@@_query_range_loop:ww}
% When it is time to extract submatches from the token list, the
% various tokens are stored in \tn{toks} registers numbered from
-% \cs{l_regex_min_pos_int} inclusive to \cs{l_regex_max_pos_int}
-% exclusive. The function \cs{regex_query_range:nn} \Arg{min}
+% \cs{l_@@_min_pos_int} inclusive to \cs{l_@@_max_pos_int}
+% exclusive. The function \cs{@@_query_range:nn} \Arg{min}
% \Arg{max} unpacks registers from the position \meta{min} to the
% position $\meta{max}-1$ included. Once this is expanded, a second
% \texttt{x}-expansion will result in the actual tokens from the
@@ -4634,44 +4651,44 @@
% very end of their operation, after checking (and correcting) the
% brace balance first.
% \begin{macrocode}
-\cs_new:Npn \regex_query_range:nn #1#2
+\cs_new:Npn \@@_query_range:nn #1#2
{
- \exp_after:wN \regex_query_range_loop:ww
- \int_use:N \int_eval:w #1 \exp_after:wN ;
- \int_use:N \int_eval:w #2 ;
- \prg_break_point:n { }
+ \exp_after:wN \@@_query_range_loop:ww
+ \int_use:N \__int_eval:w #1 \exp_after:wN ;
+ \int_use:N \__int_eval:w #2 ;
+ \__prg_break_point:
}
-\cs_new:Npn \regex_query_range_loop:ww #1 ; #2 ;
+\cs_new:Npn \@@_query_range_loop:ww #1 ; #2 ;
{
- \if_num:w #1 < #2 \exp_stop_f:
+ \if_int_compare:w #1 < #2 \exp_stop_f:
\else:
- \exp_after:wN \prg_map_break:
+ \exp_after:wN \__prg_break:
\fi:
\tex_the:D \tex_toks:D #1 \exp_stop_f:
- \exp_after:wN \regex_query_range_loop:ww
- \int_use:N \int_eval:w #1 + \c_one ; #2 ;
+ \exp_after:wN \@@_query_range_loop:ww
+ \int_use:N \__int_eval:w #1 + \c_one ; #2 ;
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\regex_query_submatch:n}
+% \begin{macro}[int]{\@@_query_submatch:n}
% When this function is called, \tn{skip}$i$ holds the start and end
% positions for the $i$-th overall submatch as its main and stretch
% components. In the case of repeated matches, submatches from all the
% matches are put one after the other in blocks of
-% \cs{l_regex_capturing_group_int} \tn{skip} registers.
+% \cs{l_@@_capturing_group_int} \tn{skip} registers.
% \begin{macrocode}
-\cs_new:Npn \regex_query_submatch:n #1
+\cs_new:Npn \@@_query_submatch:n #1
{
- \regex_query_range:nn
- { \tex_skip:D \int_eval:w #1 }
- { \etex_gluestretch:D \tex_skip:D \int_eval:w #1 }
+ \@@_query_range:nn
+ { \tex_skip:D \__int_eval:w #1 }
+ { \etex_gluestretch:D \tex_skip:D \__int_eval:w #1 }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[rEXP]{\regex_submatch_balance:n}
+% \begin{macro}[rEXP]{\@@_submatch_balance:n}
% Every user function must result in a balanced token list (unbalanced
% token lists cannot be stored by TeX). When we unpacked the query, we
% kept track of the brace balance as the shrink component of
@@ -4683,7 +4700,7 @@
% gobbled by \cs{etex_muexpr:D}, and the whole expression can be cast
% safely to an integer (no trailing expansion).
% \begin{macrocode}
-\cs_new_protected:Npn \regex_submatch_balance:n #1
+\cs_new_protected:Npn \@@_submatch_balance:n #1
{
\etex_glueshrink:D \etex_mutoglue:D \etex_muexpr:D
\tex_muskip:D \etex_gluestretch:D \tex_skip:D #1
@@ -4695,12 +4712,12 @@
%
% \subsubsection{Framework}
%
-% \begin{macro}[int]{\regex_replacement:n}
-% \begin{macro}[aux]{\regex_replacement_aux:n}
+% \begin{macro}[int]{\@@_replacement:n}
+% \begin{macro}[aux]{\@@_replacement_aux:n}
% The replacement text is built incrementally by abusing \tn{toks}
% within a group (see \pkg{l3tl-build}). We keep track in
-% \cs{l_regex_balance_int} of the balance of explicit begin- and
-% end-group tokens and \cs{l_regex_balance_tl} will consist of some
+% \cs{l_@@_balance_int} of the balance of explicit begin- and
+% end-group tokens and \cs{l_@@_balance_tl} will consist of some
% code to compute the brace balance from submatches (see its
% description). Detect unescaped right braces, and escaped characters,
% with trailing \cs{prg_do_nothing:} because some of the later
@@ -4708,42 +4725,42 @@
% parsed, make sure that there is no open csname. Finally, define the
% \texttt{balance_one_match} and \texttt{do_one_match} functions.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_replacement:n #1
+\cs_new_protected:Npn \@@_replacement:n #1
{
-%<trace> \trace_push:nnn { regex } { 1 } { regex_replacement:n }
- \tl_set_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
+%<trace> \trace_push:nnn { regex } { 1 } { @@_replacement:n }
+ \__tl_build:Nw \l_@@_internal_a_tl
+ \int_zero:N \l_@@_balance_int
+ \tl_clear:N \l_@@_balance_tl
+ \@@_escape_use:nnnn
{
\if_charcode:w \c_rbrace_str ##1
- \regex_replacement_rbrace:N \else: \tl_build_one:n \fi: ##1
+ \@@_replacement_rbrace:N \else: \__tl_build_one:n \fi: ##1
}
- { \regex_replacement_escaped:N ##1 }
- { \tl_build_one:n ##1 }
+ { \@@_replacement_escaped:N ##1 }
+ { \__tl_build_one:n ##1 }
{#1}
\prg_do_nothing: \prg_do_nothing:
- \if_int_compare:w \l_regex_replacement_csnames_int > \c_zero
- \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: }
+ \if_int_compare:w \l_@@_replacement_csnames_int > \c_zero
+ \__msg_kernel_error:nnx { regex } { replacement-missing-rbrace }
+ { \int_use:N \l_@@_replacement_csnames_int }
+ \__tl_build_one:x
+ { \prg_replicate:nn \l_@@_replacement_csnames_int \cs_end: }
\fi:
- \cs_gset:Npx \regex_replacement_balance_one_match:n ##1
+ \cs_gset:Npx \@@_replacement_balance_one_match:n ##1
{
- + \int_use:N \l_regex_balance_int
- \l_regex_balance_tl
- - \regex_submatch_balance:n {##1}
+ + \int_use:N \l_@@_balance_int
+ \l_@@_balance_tl
+ - \@@_submatch_balance:n {##1}
}
- \tl_build_end:
- \exp_args:No \regex_replacement_aux:n \l_regex_internal_a_tl
-%<trace> \trace_pop:nnn { regex } { 1 } { regex_replacement:n }
+ \__tl_build_end:
+ \exp_args:No \@@_replacement_aux:n \l_@@_internal_a_tl
+%<trace> \trace_pop:nnn { regex } { 1 } { @@_replacement:n }
}
-\cs_new_protected:Npn \regex_replacement_aux:n #1
+\cs_new_protected:Npn \@@_replacement_aux:n #1
{
- \cs_set:Npn \regex_replacement_do_one_match:n ##1
+ \cs_set:Npn \@@_replacement_do_one_match:n ##1
{
- \regex_query_range:nn
+ \@@_query_range:nn
{ \etex_glueshrink:D \tex_skip:D ##1 }
{ \tex_skip:D ##1 }
#1
@@ -4753,19 +4770,19 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_escaped:N}
+% \begin{macro}[aux]{\@@_replacement_escaped:N}
% As in parsing a regular expression, we use an auxiliary built from
% |#1| if defined. Otherwise, check for escaped digits (standing from
% submatches from $0$ to $9$): anything else is a raw character.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_replacement_escaped:N #1
+\cs_new_protected:Npn \@@_replacement_escaped:N #1
{
- \cs_if_exist_use:cF { regex_replacement_#1:w }
+ \cs_if_exist_use:cF { @@_replacement_#1:w }
{
- \if_num:w \c_one < 1#1 \exp_stop_f:
- \regex_replacement_put_submatch:n {#1}
+ \if_int_compare:w \c_one < 1#1 \exp_stop_f:
+ \@@_replacement_put_submatch:n {#1}
\else:
- \tl_build_one:n #1
+ \__tl_build_one:n #1
\fi:
}
}
@@ -4774,7 +4791,7 @@
%
% \subsubsection{Submatches}
%
-% \begin{macro}[aux]{\regex_replacement_put_submatch:n}
+% \begin{macro}[aux]{\@@_replacement_put_submatch:n}
% Insert a submatch in the replacement text. This is dropped if the
% submatch number is larger than the number of capturing groups.
% Unless the submatch appears inside a |\c{...}| or |\u{...}|
@@ -4784,53 +4801,53 @@
% expandable, and would be expanded too early (short of adding
% \cs{exp_not:N}, making the code messy again).
% \begin{macrocode}
-\cs_new_protected:Npn \regex_replacement_put_submatch:n #1
+\cs_new_protected:Npn \@@_replacement_put_submatch:n #1
{
- \if_num:w #1 < \l_regex_capturing_group_int
- \tl_build_one:n { \regex_query_submatch:n { #1 + ##1 } }
- \if_num:w \l_regex_replacement_csnames_int = \c_zero
- \tl_put_right:Nn \l_regex_balance_tl
- { + \regex_submatch_balance:n { \int_eval:w #1+##1 \int_eval_end: } }
+ \if_int_compare:w #1 < \l_@@_capturing_group_int
+ \__tl_build_one:n { \@@_query_submatch:n { #1 + ##1 } }
+ \if_int_compare:w \l_@@_replacement_csnames_int = \c_zero
+ \tl_put_right:Nn \l_@@_balance_tl
+ { + \@@_submatch_balance:n { \__int_eval:w #1+##1 \__int_eval_end: } }
\fi:
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_g:w, \regex_replacement_g_digits:NN}
+% \begin{macro}[aux]{\@@_replacement_g:w, \@@_replacement_g_digits:NN}
% An ugly method to grab digits for the |\g| escape sequence. At the
% end of the run of digits, check that it ends with a right brace.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_replacement_g:w #1#2
+\cs_new_protected:Npn \@@_replacement_g:w #1#2
{
- \str_if_eq:xxTF { #1#2 } { \tl_build_one:n \c_lbrace_str }
+ \str_if_eq_x:nnTF { #1#2 } { \__tl_build_one:n \c_lbrace_str }
{
- \int_zero:N \l_regex_internal_a_int
- \regex_replacement_g_digits:NN
+ \int_zero:N \l_@@_internal_a_int
+ \@@_replacement_g_digits:NN
}
- { \regex_replacement_error:NNN g #1 #2 }
+ { \@@_replacement_error:NNN g #1 #2 }
}
-\cs_new_protected:Npn \regex_replacement_g_digits:NN #1#2
+\cs_new_protected:Npn \@@_replacement_g_digits:NN #1#2
{
- \token_if_eq_meaning:NNTF #1 \tl_build_one:n
+ \token_if_eq_meaning:NNTF #1 \__tl_build_one:n
{
- \if_num:w \c_one < 1#2 \exp_stop_f:
- \int_set:Nn \l_regex_internal_a_int
- { \c_ten * \l_regex_internal_a_int + #2 }
+ \if_int_compare:w \c_one < 1#2 \exp_stop_f:
+ \int_set:Nn \l_@@_internal_a_int
+ { \c_ten * \l_@@_internal_a_int + #2 }
\exp_after:wN \use_i:nnn
- \exp_after:wN \regex_replacement_g_digits:NN
+ \exp_after:wN \@@_replacement_g_digits:NN
\else:
- \exp_after:wN \regex_replacement_error:NNN
+ \exp_after:wN \@@_replacement_error:NNN
\exp_after:wN g
\fi:
}
{
- \if_meaning:w \regex_replacement_rbrace:N #1
- \exp_args:No \regex_replacement_put_submatch:n
- { \int_use:N \l_regex_internal_a_int }
+ \if_meaning:w \@@_replacement_rbrace:N #1
+ \exp_args:No \@@_replacement_put_submatch:n
+ { \int_use:N \l_@@_internal_a_int }
\exp_after:wN \use_none:nn
\else:
- \exp_after:wN \regex_replacement_error:NNN
+ \exp_after:wN \@@_replacement_error:NNN
\exp_after:wN g
\fi:
}
@@ -4841,8 +4858,8 @@
%
% \subsubsection{Csnames in replacement}
%
-% \begin{macro}[aux]{\regex_replacement_c:w}
-% \begin{macro}[aux]+\regex_replacement_c_{:w+
+% \begin{macro}[aux]{\@@_replacement_c:w}
+% \begin{macro}[aux]+\@@_replacement_c_{:w+
% |\c| can be followed by a left brace, or by a letter for which we
% have defined a way to produce that category of characters. The
% appropriate definitions for catcodes are introduced later. For
@@ -4851,62 +4868,62 @@
% with a weird cross-over between \cs{exp_not:n} and \cs{exp_not:N}
% (see this helper's description for an explanation).
% \begin{macrocode}
-\cs_new_protected:Npn \regex_replacement_c:w #1#2
+\cs_new_protected:Npn \@@_replacement_c:w #1#2
{
- \token_if_eq_meaning:NNTF #1 \tl_build_one:n
+ \token_if_eq_meaning:NNTF #1 \__tl_build_one:n
{
- \cs_if_exist_use:cF { regex_replacement_c_#2:w }
- { \regex_replacement_error:NNN c #1#2 }
+ \cs_if_exist_use:cF { @@_replacement_c_#2:w }
+ { \@@_replacement_error:NNN c #1#2 }
}
- { \regex_replacement_error:NNN c #1#2 }
+ { \@@_replacement_error:NNN c #1#2 }
}
-\cs_new_protected_nopar:cpn { regex_replacement_c_ \c_lbrace_str :w }
+\cs_new_protected_nopar:cpn { @@_replacement_c_ \c_lbrace_str :w }
{
- \if_case:w \l_regex_replacement_csnames_int
- \tl_build_one:n
- { \exp_not:n { \exp_after:wN \regex_replacement_exp_not:N \cs:w } }
+ \if_case:w \l_@@_replacement_csnames_int
+ \__tl_build_one:n
+ { \exp_not:n { \exp_after:wN \@@_replacement_exp_not:N \cs:w } }
\else:
- \tl_build_one:n { \exp_not:n { \exp_after:wN \tl_to_str:N \cs:w } }
+ \__tl_build_one:n { \exp_not:n { \exp_after:wN \tl_to_str:N \cs:w } }
\fi:
- \int_incr:N \l_regex_replacement_csnames_int
+ \int_incr:N \l_@@_replacement_csnames_int
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_u:w}
+% \begin{macro}[aux]{\@@_replacement_u:w}
% Check that |\u| is followed by a left brace. If so, start a control
% sequence with \cs{cs:w}, which is then unpacked either with
% \cs{exp_not:V} or \cs{tl_to_str:V} depending on the current context.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_replacement_u:w #1#2
+\cs_new_protected:Npn \@@_replacement_u:w #1#2
{
- \str_if_eq:xxTF { #1#2 } { \tl_build_one:n \c_lbrace_str }
+ \str_if_eq_x:nnTF { #1#2 } { \__tl_build_one:n \c_lbrace_str }
{
- \if_case:w \l_regex_replacement_csnames_int
- \tl_build_one:n { \exp_not:n { \exp_after:wN \exp_not:V \cs:w } }
+ \if_case:w \l_@@_replacement_csnames_int
+ \__tl_build_one:n { \exp_not:n { \exp_after:wN \exp_not:V \cs:w } }
\else:
- \tl_build_one:n { \exp_not:n { \exp_after:wN \tl_to_str:V \cs:w } }
+ \__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
+ \int_incr:N \l_@@_replacement_csnames_int
}
- { \regex_replacement_error:NNN u #1#2 }
+ { \@@_replacement_error:NNN u #1#2 }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_rbrace:N}
+% \begin{macro}[aux]{\@@_replacement_rbrace:N}
% Within a |\c{...}| or |\u{...}| construction, end the control
% sequence, and decrease the brace count. Otherwise, this is a raw
% right brace.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_replacement_rbrace:N #1
+\cs_new_protected:Npn \@@_replacement_rbrace:N #1
{
- \if_int_compare:w \l_regex_replacement_csnames_int > \c_zero
- \tl_build_one:n \cs_end:
- \int_decr:N \l_regex_replacement_csnames_int
+ \if_int_compare:w \l_@@_replacement_csnames_int > \c_zero
+ \__tl_build_one:n \cs_end:
+ \int_decr:N \l_@@_replacement_csnames_int
\else:
- \tl_build_one:n #1
+ \__tl_build_one:n #1
\fi:
}
% \end{macrocode}
@@ -4923,7 +4940,7 @@
\group_begin:
% \end{macrocode}
%
-% \begin{macro}[aux]{\regex_replacement_char:nNN}
+% \begin{macro}[aux]{\@@_replacement_char:nNN}
% The only way to produce an arbitrary character--catcode pair is to
% use the \tn{lowercase} or \tn{uppercase} primitives. This is a
% wrapper for our purposes. The first argument is the null character
@@ -4931,30 +4948,30 @@
% from the input stream: |#3| is the character whose character code to
% reproduce.
% \begin{macrocode}
- \cs_new_protected:Npn \regex_replacement_char:nNN #1#2#3
+ \cs_new_protected:Npn \@@_replacement_char:nNN #1#2#3
{
\if_meaning:w \prg_do_nothing: #3
- \msg_kernel_error:nn { regex } { replacement-catcode-end }
+ \__msg_kernel_error:nn { regex } { replacement-catcode-end }
\else:
\tex_lccode:D \c_zero = `#3 \scan_stop:
- \tl_to_lowercase:n { \tl_build_one:n {#1} }
+ \tl_to_lowercase:n { \__tl_build_one:n {#1} }
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_c_A:w}
+% \begin{macro}[aux]{\@@_replacement_c_A:w}
% For an active character, expansion must be avoided, twice because we
% later do two \texttt{x}-expansions, to unpack \tn{toks} for the
% query, and to expand their contents to tokens of the query.
% \begin{macrocode}
\char_set_catcode_active:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_A:w
- { \regex_replacement_char:nNN { \exp_not:n { \exp_not:N ^^@ } } }
+ \cs_new_protected_nopar:Npn \@@_replacement_c_A:w
+ { \@@_replacement_char:nNN { \exp_not:n { \exp_not:N ^^@ } } }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_c_B:w}
+% \begin{macro}[aux]{\@@_replacement_c_B:w}
% An explicit begin-group token increases the balance, unless within a
% |\c{...}| or |\u{...}| construction. Add the desired begin-group
% character, using the standard \cs{if_false:} trick. We eventually
@@ -4964,82 +4981,82 @@
% with \pkg{l3tl-analysis}.
% \begin{macrocode}
\char_set_catcode_group_begin:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_B:w
+ \cs_new_protected_nopar:Npn \@@_replacement_c_B:w
{
- \if_num:w \l_regex_replacement_csnames_int = \c_zero
- \int_incr:N \l_regex_balance_int
+ \if_int_compare:w \l_@@_replacement_csnames_int = \c_zero
+ \int_incr:N \l_@@_balance_int
\fi:
- \regex_replacement_char:nNN
+ \@@_replacement_char:nNN
{ \exp_not:n { \exp_after:wN ^^@ \if_false: } \fi: } }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_c_C:w}
+% \begin{macro}[aux]{\@@_replacement_c_C:w}
% This is not quite catcode-related: when the user requests a
% character with category \enquote{control sequence}, the
% one-character control symbol is returned. As for the active
% character, we prepare for two \texttt{x}-expansions.
% \begin{macrocode}
- \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} } }
+ \cs_new_protected:Npn \@@_replacement_c_C:w #1#2
+ { \__tl_build_one:n { \exp_not:N \exp_not:N \exp_not:c {#2} } }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_c_D:w}
+% \begin{macro}[aux]{\@@_replacement_c_D:w}
% Subscripts fit the mould: \tn{lowercase} the null byte with the
% correct category.
% \begin{macrocode}
\char_set_catcode_math_subscript:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_D:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \@@_replacement_c_D:w
+ { \@@_replacement_char:nNN { ^^@ } }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_c_E:w}
+% \begin{macro}[aux]{\@@_replacement_c_E:w}
% Similar to the begin-group case, the second \texttt{x}-expansion
% produces the bare end-group token.
% \begin{macrocode}
\char_set_catcode_group_end:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_E:w
+ \cs_new_protected_nopar:Npn \@@_replacement_c_E:w
{
- \if_num:w \l_regex_replacement_csnames_int = \c_zero
- \int_decr:N \l_regex_balance_int
+ \if_int_compare:w \l_@@_replacement_csnames_int = \c_zero
+ \int_decr:N \l_@@_balance_int
\fi:
- \regex_replacement_char:nNN
+ \@@_replacement_char:nNN
{ \exp_not:n { \if_false: { \fi: ^^@ } }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_c_L:w}
+% \begin{macro}[aux]{\@@_replacement_c_L:w}
% Simply \tn{lowercase} a letter null byte to produce an arbitrary letter.
% \begin{macrocode}
\char_set_catcode_letter:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_L:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \@@_replacement_c_L:w
+ { \@@_replacement_char:nNN { ^^@ } }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_c_M:w}
+% \begin{macro}[aux]{\@@_replacement_c_M:w}
% No surprise here, we lowercase the null math toggle.
% \begin{macrocode}
\char_set_catcode_math_toggle:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_M:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \@@_replacement_c_M:w
+ { \@@_replacement_char:nNN { ^^@ } }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_c_O:w}
+% \begin{macro}[aux]{\@@_replacement_c_O:w}
% Lowercase an other null byte.
% \begin{macrocode}
\char_set_catcode_other:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_O:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \@@_replacement_c_O:w
+ { \@@_replacement_char:nNN { ^^@ } }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_c_P:w}
+% \begin{macro}[aux]{\@@_replacement_c_P:w}
% For macro parameters, expansion is a tricky issue. We need to
% prepare for two \texttt{x}-expansions and passing through various
% macro definitions. Note that we cannot replace one \cs{exp_not:n} by
@@ -5048,53 +5065,53 @@
% parameter character would be doubled.
% \begin{macrocode}
\char_set_catcode_parameter:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_P:w
+ \cs_new_protected_nopar:Npn \@@_replacement_c_P:w
{
- \regex_replacement_char:nNN
+ \@@_replacement_char:nNN
{ \exp_not:n { \exp_not:n { ^^@^^@^^@^^@ } } }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_c_S:w}
+% \begin{macro}[aux]{\@@_replacement_c_S:w}
% Spaces are normalized on input by \TeX{} to have character code
% $32$. It is in fact impossible to get a token with character code
% $0$ and category code $10$. Hence we use $32$ instead of $0$ as our
% base character.
% \begin{macrocode}
- \cs_new_protected:Npn \regex_replacement_c_S:w #1#2
+ \cs_new_protected:Npn \@@_replacement_c_S:w #1#2
{
\if_meaning:w \prg_do_nothing: #2
- \msg_kernel_error:nn { regex } { replacement-catcode-end }
+ \__msg_kernel_error:nn { regex } { replacement-catcode-end }
\else:
- \if_num:w `#2 = \c_zero
- \msg_kernel_error:nn { regex } { replacement-null-space }
+ \if_int_compare:w `#2 = \c_zero
+ \__msg_kernel_error:nn { regex } { replacement-null-space }
\fi:
\tex_lccode:D 32 = `#2 \scan_stop:
- \tl_to_lowercase:n { \tl_build_one:n {~} }
+ \tl_to_lowercase:n { \__tl_build_one:n {~} }
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_c_T:w}
+% \begin{macro}[aux]{\@@_replacement_c_T:w}
% No surprise for alignment tabs here. Those are surrounded by the
% appropriate braces whenever necessary, hence they don't cause
% trouble in alignment settings.
% \begin{macrocode}
\char_set_catcode_alignment:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_T:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \@@_replacement_c_T:w
+ { \@@_replacement_char:nNN { ^^@ } }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replacement_c_U:w}
-% Simple call to \cs{regex_replacement_char:nNN} which lowercases the
+% \begin{macro}[aux]{\@@_replacement_c_U:w}
+% Simple call to \cs{@@_replacement_char:nNN} which lowercases the
% math superscript |^^@|.
% \begin{macrocode}
\char_set_catcode_math_superscript:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_U:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \@@_replacement_c_U:w
+ { \@@_replacement_char:nNN { ^^@ } }
% \end{macrocode}
% \end{macro}
%
@@ -5105,14 +5122,14 @@
%
% \subsubsection{An error}
%
-% \begin{macro}[aux]{\regex_replacement_error:NNN}
+% \begin{macro}[aux]{\@@_replacement_error:NNN}
% Simple error reporting by calling one of the messages
% \texttt{replacement-c}, \texttt{replacement-g}, or
% \texttt{replacement-u}.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_replacement_error:NNN #1#2#3
+\cs_new_protected:Npn \@@_replacement_error:NNN #1#2#3
{
- \msg_kernel_error:nnx { regex } { replacement-#1 } {#3}
+ \__msg_kernel_error:nnx { regex } { replacement-#1 } {#3}
#2 #3
}
% \end{macrocode}
@@ -5125,7 +5142,7 @@
% nothing.
% \begin{macrocode}
\cs_new_protected:Npn \regex_new:N #1
- { \cs_new_eq:NN #1 \c_regex_no_match_regex }
+ { \cs_new_eq:NN #1 \c_@@_no_match_regex }
% \end{macrocode}
% \end{macro}
%
@@ -5135,18 +5152,18 @@
% \begin{macrocode}
\cs_new_protected_nopar:Npn \regex_set:Nn #1#2
{
- \regex_compile:n {#2}
- \tl_set_eq:NN #1 \l_regex_internal_regex
+ \@@_compile:n {#2}
+ \tl_set_eq:NN #1 \l_@@_internal_regex
}
\cs_new_protected_nopar:Npn \regex_gset:Nn #1#2
{
- \regex_compile:n {#2}
- \tl_gset_eq:NN #1 \l_regex_internal_regex
+ \@@_compile:n {#2}
+ \tl_gset_eq:NN #1 \l_@@_internal_regex
}
\cs_new_protected_nopar:Npn \regex_const:Nn #1#2
{
- \regex_compile:n {#2}
- \tl_const:Nx #1 { \exp_not:o \l_regex_internal_regex }
+ \@@_compile:n {#2}
+ \tl_const:Nx #1 { \exp_not:o \l_@@_internal_regex }
}
% \end{macrocode}
% \end{macro}
@@ -5154,16 +5171,16 @@
% \begin{macro}{\regex_show:N, \regex_show:n}
% User functions: the \texttt{n} variant requires compilation first.
% Then show the variable with some appropriate text. The auxiliary
-% \cs{regex_show_aux:Nx} is defined in a different section.
+% \cs{@@_show:Nx} is defined in a different section.
% \begin{macrocode}
\cs_new_protected:Npn \regex_show:n #1
{
- \regex_compile:n {#1}
- \regex_show_aux:Nx \l_regex_internal_regex
+ \@@_compile:n {#1}
+ \@@_show:Nx \l_@@_internal_regex
{ { \tl_to_str:n {#1} } }
}
\cs_new_protected:Npn \regex_show:N #1
- { \regex_show_aux:Nx #1 { variable~\token_to_str:N #1 } }
+ { \@@_show:Nx #1 { variable~\token_to_str:N #1 } }
% \end{macrocode}
% \end{macro}
%
@@ -5176,13 +5193,13 @@
% \begin{macrocode}
\prg_new_protected_conditional:Npnn \regex_match:nn #1#2 { T , F , TF }
{
- \regex_match_aux:nn { \regex_build:n {#1} } {#2}
- \regex_aux_return:
+ \@@_if_match:nn { \@@_build:n {#1} } {#2}
+ \@@_return:
}
\prg_new_protected_conditional:Npnn \regex_match:Nn #1#2 { T , F , TF }
{
- \regex_match_aux:nn { \regex_build:N #1 } {#2}
- \regex_aux_return:
+ \@@_if_match:nn { \@@_build:N #1 } {#2}
+ \@@_return:
}
% \end{macrocode}
% \end{macro}
@@ -5191,9 +5208,9 @@
% Again, use an auxiliary whose first argument builds the \textsc{nfa}.
% \begin{macrocode}
\cs_new_protected:Npn \regex_count:nnN #1
- { \regex_count_aux:nnN { \regex_build:n {#1} } }
+ { \@@_count:nnN { \@@_build:n {#1} } }
\cs_new_protected:Npn \regex_count:NnN #1
- { \regex_count_aux:nnN { \regex_build:N #1 } }
+ { \@@_count:nnN { \@@_build:N #1 } }
% \end{macrocode}
% \end{macro}
%
@@ -5214,60 +5231,60 @@
% \regex_split:nnN, \regex_split:NnN
% }
% We define here $40$ user functions, following a common pattern in
-% terms of \texttt{_aux:nnN} auxiliaries, defined in the coming
-% subsections. The auxiliary is handed \cs{regex_build:n} or
-% \cs{regex_build:N} with the appropriate regex argument, then all
+% terms of \texttt{:nnN} auxiliaries, defined in the coming
+% subsections. The auxiliary is handed \cs{@@_build:n} or
+% \cs{@@_build:N} with the appropriate regex argument, then all
% other necessary arguments (replacement text, token list, \emph{etc.}
-% The conditionals call \cs{regex_aux_return:} to return either
+% The conditionals call \cs{@@_return:} to return either
% \texttt{true} or \texttt{false} once matching has been performed.
% \begin{macrocode}
-\cs_set_protected:Npn \regex_tmp:w #1#2#3
+\cs_set_protected:Npn \@@_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 } }
+ \cs_new_protected:Npn #2 ##1 { #1 { \@@_build:n {##1} } }
+ \cs_new_protected:Npn #3 ##1 { #1 { \@@_build:N ##1 } }
\prg_new_protected_conditional:Npnn #2 ##1##2##3 { T , F , TF }
- { #1 { \regex_build:n {##1} } {##2} ##3 \regex_aux_return: }
+ { #1 { \@@_build:n {##1} } {##2} ##3 \@@_return: }
\prg_new_protected_conditional:Npnn #3 ##1##2##3 { T , F , TF }
- { #1 { \regex_build:N ##1 } {##2} ##3 \regex_aux_return: }
+ { #1 { \@@_build:N ##1 } {##2} ##3 \@@_return: }
}
-\regex_tmp:w \regex_extract_once_aux:nnN
+\@@_tmp:w \@@_extract_once:nnN
\regex_extract_once:nnN \regex_extract_once:NnN
-\regex_tmp:w \regex_extract_all_aux:nnN
+\@@_tmp:w \@@_extract_all:nnN
\regex_extract_all:nnN \regex_extract_all:NnN
-\regex_tmp:w \regex_replace_once_aux:nnN
+\@@_tmp:w \@@_replace_once:nnN
\regex_replace_once:nnN \regex_replace_once:NnN
-\regex_tmp:w \regex_replace_all_aux:nnN
+\@@_tmp:w \@@_replace_all:nnN
\regex_replace_all:nnN \regex_replace_all:NnN
-\regex_tmp:w \regex_split_aux:nnN \regex_split:nnN \regex_split:NnN
+\@@_tmp:w \@@_split:nnN \regex_split:nnN \regex_split:NnN
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsubsection{Variables and helpers for user functions}
%
-% \begin{variable}{\l_regex_match_count_int}
+% \begin{variable}{\l_@@_match_count_int}
% The number of matches found so far is stored
-% in \cs{l_regex_match_count_int}. This is only used
+% in \cs{l_@@_match_count_int}. This is only used
% in the \cs{regex_count:nnN} functions.
% \begin{macrocode}
-\int_new:N \l_regex_match_count_int
+\int_new:N \l_@@_match_count_int
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{regex_begin, regex_end}
+% \begin{variable}{@@_begin, @@_end}
% Those flags are raised to indicate extra begin-group
% or end-group tokens when extracting submatches.
% \begin{macrocode}
-\flag_new:n { regex_begin }
-\flag_new:n { regex_end }
+\flag_new:n { @@_begin }
+\flag_new:n { @@_end }
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_regex_submatch_int, \l_regex_zeroth_submatch_int}
+% \begin{variable}{\l_@@_submatch_int, \l_@@_zeroth_submatch_int}
% The end-points of each submatch are stored as main and stretch
% components of \tn{skip}\meta{submatch}, where \meta{submatch} ranges
-% from \cs{l_regex_max_state_int} (inclusive) to
-% \cs{l_regex_submatch_int} (exclusive). Each successful match comes
+% from \cs{l_@@_max_state_int} (inclusive) to
+% \cs{l_@@_submatch_int} (exclusive). Each successful match comes
% with a $0$-th submatch (the full match), and one match for each
% capturing group: submatches corresponding to the last successful
% match are labelled starting at
@@ -5275,19 +5292,19 @@
% $0$-th submatch is the position at which that match attempt started:
% this is used for splitting and replacements.
% \begin{macrocode}
-\int_new:N \l_regex_submatch_int
-\int_new:N \l_regex_zeroth_submatch_int
+\int_new:N \l_@@_submatch_int
+\int_new:N \l_@@_zeroth_submatch_int
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}[aux]{\regex_aux_return:}
+% \begin{macro}[aux]{\@@_return:}
% This function triggers either \cs{prg_return_false:} or
% \cs{prg_return_true:} as appropriate to whether a match was found or
% not. It is used by all user conditionals.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_aux_return:
+\cs_new_protected_nopar:Npn \@@_return:
{
- \if_meaning:w \c_true_bool \g_regex_success_bool
+ \if_meaning:w \c_true_bool \g_@@_success_bool
\prg_return_true:
\else:
\prg_return_false:
@@ -5298,73 +5315,73 @@
%
% \subsubsection{Matching}
%
-% \begin{macro}[aux]{\regex_match_aux:nn}
+% \begin{macro}[aux]{\@@_if_match:nn}
% We don't track submatches, and stop after a single match. Build the
% \textsc{nfa} with |#1|, and perform the match on the query |#2|.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_match_aux:nn #1#2
+\cs_new_protected:Npn \@@_if_match:nn #1#2
{
\group_begin:
- \regex_disable_submatches:
- \regex_single_match:
+ \@@_disable_submatches:
+ \@@_single_match:
#1
- \regex_match:n {#2}
+ \@@_match:n {#2}
\group_end:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_count_aux:nnN}
+% \begin{macro}[aux]{\@@_count:nnN}
% Again, we don't care about submatches. Instead of aborting after the
% first \enquote{longest match} is found, we search for multiple
-% matches, incrementing \cs{l_regex_match_count_int} every time to
+% matches, incrementing \cs{l_@@_match_count_int} every time to
% record the number of matches. Build the \textsc{nfa} and match. At
% the end, store the result in the user's variable.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_count_aux:nnN #1#2#3
+\cs_new_protected:Npn \@@_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 }
+ \@@_disable_submatches:
+ \int_zero:N \l_@@_match_count_int
+ \@@_multi_match:n { \int_incr:N \l_@@_match_count_int }
#1
- \regex_match:n {#2}
+ \@@_match:n {#2}
\exp_args:NNNo
\group_end:
- \int_set:Nn #3 { \int_use:N \l_regex_match_count_int }
+ \int_set:Nn #3 { \int_use:N \l_@@_match_count_int }
}
% \end{macrocode}
% \end{macro}
%
% \subsubsection{Extracting submatches}
%
-% \begin{macro}[aux]{\regex_extract_once_aux:nnN, \regex_extract_all_aux:nnN}
+% \begin{macro}[aux]{\@@_extract_once:nnN, \@@_extract_all:nnN}
% Match once or multiple times. After each match (or after the only
-% match), extract the submatches using \cs{regex_extract:}. At the
+% match), extract the submatches using \cs{@@_extract:}. At the
% end, store the sequence containing all the submatches into the user
% variable |#3| after closing the group.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_extract_once_aux:nnN #1#2#3
+\cs_new_protected:Npn \@@_extract_once:nnN #1#2#3
{
\group_begin:
- \regex_single_match:
+ \@@_single_match:
#1
- \regex_match:n {#2}
- \regex_extract:
- \regex_group_end_extract_seq:N #3
+ \@@_match:n {#2}
+ \@@_extract:
+ \@@_group_end_extract_seq:N #3
}
-\cs_new_protected:Npn \regex_extract_all_aux:nnN #1#2#3
+\cs_new_protected:Npn \@@_extract_all:nnN #1#2#3
{
\group_begin:
- \regex_multi_match:n { \regex_extract: }
+ \@@_multi_match:n { \@@_extract: }
#1
- \regex_match:n {#2}
- \regex_group_end_extract_seq:N #3
+ \@@_match:n {#2}
+ \@@_group_end_extract_seq:N #3
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_split_aux:nnN}
+% \begin{macro}[aux]{\@@_split:nnN}
% Splitting at submatches is a bit more tricky. For each match,
% extract all submatches, and replace the zeroth submatch by the part
% of the query between the start of the match attempt and the start of
@@ -5373,101 +5390,101 @@
% match, store the last part of the token list, which ranges from the
% start of the match attempt to the end of the query. This step is
% inhibited if the last match was empty and at the very end: decrement
-% \cs{l_regex_submatch_int}, which controls which \tn{skip} registers
+% \cs{l_@@_submatch_int}, which controls which \tn{skip} registers
% will be used.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_split_aux:nnN #1#2#3
+\cs_new_protected:Npn \@@_split:nnN #1#2#3
{
\group_begin:
- \regex_multi_match:n
+ \@@_multi_match:n
{
- \if_num:w \l_regex_start_pos_int < \l_regex_success_pos_int
- \regex_extract:
- \tex_skip:D \l_regex_zeroth_submatch_int
- = \l_regex_start_pos_int sp
- plus \tex_skip:D \l_regex_zeroth_submatch_int \scan_stop:
+ \if_int_compare:w \l_@@_start_pos_int < \l_@@_success_pos_int
+ \@@_extract:
+ \tex_skip:D \l_@@_zeroth_submatch_int
+ = \l_@@_start_pos_int sp
+ plus \tex_skip:D \l_@@_zeroth_submatch_int \scan_stop:
\fi:
}
#1
- \regex_match:n {#2}
-%<assert>\assert_int:n { \l_regex_current_pos_int = \l_regex_max_pos_int }
- \tex_skip:D \l_regex_submatch_int
- = \l_regex_start_pos_int sp plus \l_regex_max_pos_int sp \scan_stop:
- \int_incr:N \l_regex_submatch_int
- \if_meaning:w \c_true_bool \l_regex_empty_success_bool
- \if_num:w \l_regex_start_pos_int = \l_regex_max_pos_int
- \int_decr:N \l_regex_submatch_int
+ \@@_match:n {#2}
+%<assert>\assert_int:n { \l_@@_current_pos_int = \l_@@_max_pos_int }
+ \tex_skip:D \l_@@_submatch_int
+ = \l_@@_start_pos_int sp plus \l_@@_max_pos_int sp \scan_stop:
+ \int_incr:N \l_@@_submatch_int
+ \if_meaning:w \c_true_bool \l_@@_empty_success_bool
+ \if_int_compare:w \l_@@_start_pos_int = \l_@@_max_pos_int
+ \int_decr:N \l_@@_submatch_int
\fi:
\fi:
- \regex_group_end_extract_seq:N #3
+ \@@_group_end_extract_seq:N #3
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_group_end_extract_seq:N}
+% \begin{macro}[aux]{\@@_group_end_extract_seq:N}
% The end-points of submatches are stored as the main and stretch
-% components of \tn{skip} registers from \cs{l_regex_max_state_int} to
-% \cs{l_regex_submatch_int} (exclusive). Extract the relevant ranges
-% into \cs{l_regex_internal_a_tl}. We detect unbalanced results using
-% the two flags \texttt{regex_begin} and \texttt{regex_end}, raised
+% components of \tn{skip} registers from \cs{l_@@_max_state_int} to
+% \cs{l_@@_submatch_int} (exclusive). Extract the relevant ranges
+% into \cs{l_@@_internal_a_tl}. We detect unbalanced results using
+% the two flags \texttt{@@_begin} and \texttt{@@_end}, raised
% whenever we see too many begin-group or end-group tokens in a
-% submatch. We disable \cs{seq_item:n} to prevent two
+% submatch. We disable \cs{__seq_item:n} to prevent two
% \texttt{x}-expansions.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_group_end_extract_seq:N #1
+\cs_new_protected:Npn \@@_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
+ \cs_set_eq:NN \__seq_item:n \scan_stop:
+ \flag_clear:n { @@_begin }
+ \flag_clear:n { @@_end }
+ \tl_set:Nx \l_@@_internal_a_tl
{
- \prg_stepwise_function:nnnN
- { \c_two * \l_regex_max_state_int }
+ \int_step_function:nnnN
+ { \c_two * \l_@@_max_state_int }
\c_one
- { \l_regex_submatch_int - \c_one }
- \regex_extract_seq_aux:n
+ { \l_@@_submatch_int - \c_one }
+ \@@_extract_seq_aux:n
}
\int_compare:nNnF
- { \flag_height:n { regex_begin } + \flag_height:n { regex_end } }
+ { \flag_height:n { @@_begin } + \flag_height:n { @@_end } }
= \c_zero
{
- \msg_kernel_error:nnxxx { regex } { result-unbalanced }
+ \__msg_kernel_error:nnxxx { regex } { result-unbalanced }
{ splitting~or~extracting~submatches }
- { \flag_height:n { regex_end } }
- { \flag_height:n { regex_begin } }
+ { \flag_height:n { @@_end } }
+ { \flag_height:n { @@_begin } }
}
\use:x
{
\group_end:
- \tl_set:Nn \exp_not:N #1 { \l_regex_internal_a_tl }
+ \tl_set:Nn \exp_not:N #1 { \l_@@_internal_a_tl }
}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux, EXP]{\regex_extract_seq_aux:n, \regex_extract_seq_aux:ww}
+% \begin{macro}[aux, EXP]{\@@_extract_seq_aux:n, \@@_extract_seq_aux:ww}
% The \texttt{:n} auxiliary builds one item of the sequence of
% submatches. First compute the brace balance of the submatch, then
% extract the submatch from the query, adding the appropriate braces
% and raising a flag if the submatch is not balanced.
% \begin{macrocode}
-\cs_new:Npn \regex_extract_seq_aux:n #1
+\cs_new:Npn \@@_extract_seq_aux:n #1
{
- \seq_item:n
+ \__seq_item:n
{
- \exp_after:wN \regex_extract_seq_aux:ww
- \int_value:w \regex_submatch_balance:n {#1} ; #1;
+ \exp_after:wN \@@_extract_seq_aux:ww
+ \__int_value:w \@@_submatch_balance:n {#1} ; #1;
}
}
-\cs_new:Npn \regex_extract_seq_aux:ww #1; #2;
+\cs_new:Npn \@@_extract_seq_aux:ww #1; #2;
{
- \if_num:w #1 < \c_zero
- \flag_raise:n { regex_end }
+ \if_int_compare:w #1 < \c_zero
+ \flag_raise:n { @@_end }
\prg_replicate:nn {-#1} { \exp_not:n { { \if_false: } \fi: } }
\fi:
- \regex_query_submatch:n {#2}
- \if_num:w #1 > \c_zero
- \flag_raise:n { regex_begin }
+ \@@_query_submatch:n {#2}
+ \if_int_compare:w #1 > \c_zero
+ \flag_raise:n { @@_begin }
\prg_replicate:nn {#1} { \exp_not:n { \if_false: { \fi: } } }
\fi:
}
@@ -5475,11 +5492,11 @@
% \end{macro}
%
% \begin{macro}[aux]
-% {\regex_extract:, \regex_extract_aux_b:wn, \regex_extract_aux_e:wn}
+% {\@@_extract:, \@@_extract_b:wn, \@@_extract_e:wn}
% Our task here is to extract from the property list
-% \cs{l_regex_success_submatches_prop} the list of end-points of
+% \cs{l_@@_success_submatches_prop} the list of end-points of
% submatches, and store them in \tn{skip} registers, from
-% \cs{l_regex_zeroth_submatch_int} upwards. We begin by emptying those
+% \cs{l_@@_zeroth_submatch_int} upwards. We begin by emptying those
% \tn{skip} registers. Then for each \meta{key}--\meta{value} pair in
% the property list update the appropriate \tn{skip} component. This
% is somewhat a hack: the \meta{key} is a non-negative integer
@@ -5487,35 +5504,35 @@
% end, store the information about the position at which the match
% attempt started, as a shrink component.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_extract:
+\cs_new_protected_nopar:Npn \@@_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
+ \if_meaning:w \c_true_bool \g_@@_success_bool
+ \int_set_eq:NN \l_@@_zeroth_submatch_int \l_@@_submatch_int
+ \prg_replicate:nn \l_@@_capturing_group_int
{
- \tex_skip:D \l_regex_submatch_int \c_zero sp \scan_stop:
- \int_incr:N \l_regex_submatch_int
+ \tex_skip:D \l_@@_submatch_int \c_zero sp \scan_stop:
+ \int_incr:N \l_@@_submatch_int
}
- \prop_map_inline:Nn \l_regex_success_submatches_prop
+ \prop_map_inline:Nn \l_@@_success_submatches_prop
{
- \if_num:w ##1 \c_minus_one
- \exp_after:wN \regex_extract_aux_e:wn \int_value:w
+ \if_int_compare:w ##1 \c_minus_one
+ \exp_after:wN \@@_extract_e:wn \__int_value:w
\else:
- \exp_after:wN \regex_extract_aux_b:wn \int_value:w
+ \exp_after:wN \@@_extract_b:wn \__int_value:w
\fi:
- \int_eval:w \l_regex_zeroth_submatch_int + ##1 {##2}
+ \__int_eval:w \l_@@_zeroth_submatch_int + ##1 {##2}
}
- \tex_skip:D \l_regex_zeroth_submatch_int
- = \tex_the:D \tex_skip:D \l_regex_zeroth_submatch_int
- minus \l_regex_start_pos_int sp \scan_stop:
+ \tex_skip:D \l_@@_zeroth_submatch_int
+ = \tex_the:D \tex_skip:D \l_@@_zeroth_submatch_int
+ minus \l_@@_start_pos_int sp \scan_stop:
\fi:
}
-\cs_new_protected:Npn \regex_extract_aux_b:wn #1 < #2
+\cs_new_protected:Npn \@@_extract_b:wn #1 < #2
{
\tex_skip:D #1 = #2 sp
plus \etex_gluestretch:D \tex_skip:D #1 \scan_stop:
}
-\cs_new_protected:Npn \regex_extract_aux_e:wn #1 > #2
+\cs_new_protected:Npn \@@_extract_e:wn #1 > #2
{
\tex_skip:D #1
= 1 \tex_skip:D #1 plus #2 sp \scan_stop:
@@ -5525,7 +5542,7 @@
%
% \subsubsection{Replacement}
%
-% \begin{macro}[aux]{\regex_replace_once_aux:nnN}
+% \begin{macro}[aux]{\@@_replace_once:nnN}
% Build the \textsc{nfa} and the replacement functions, then find a
% single match. If the match failed, simply exit the
% group. Otherwise, we do the replacement. Extract submatches. Compute
@@ -5539,106 +5556,106 @@
% \texttt{x}-expansion, and checks that braces are balanced in the
% final result.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_replace_once_aux:nnN #1#2#3
+\cs_new_protected:Npn \@@_replace_once:nnN #1#2#3
{
\group_begin:
- \regex_single_match:
+ \@@_single_match:
#1
- \regex_replacement:n {#2}
- \exp_args:No \regex_match:n { #3 }
- \if_meaning:w \c_false_bool \g_regex_success_bool
+ \@@_replacement:n {#2}
+ \exp_args:No \@@_match:n { #3 }
+ \if_meaning:w \c_false_bool \g_@@_success_bool
\group_end:
\else:
- \regex_extract:
- \int_set:Nn \l_regex_balance_int
+ \@@_extract:
+ \int_set:Nn \l_@@_balance_int
{
- \regex_replacement_balance_one_match:n
- { \l_regex_zeroth_submatch_int }
+ \@@_replacement_balance_one_match:n
+ { \l_@@_zeroth_submatch_int }
}
- \tl_set:Nx \l_regex_internal_a_tl
+ \tl_set:Nx \l_@@_internal_a_tl
{
- \regex_replacement_do_one_match:n { \l_regex_zeroth_submatch_int }
- \regex_query_range:nn
- { \etex_gluestretch:D \tex_skip:D \l_regex_zeroth_submatch_int }
- { \l_regex_max_pos_int }
+ \@@_replacement_do_one_match:n { \l_@@_zeroth_submatch_int }
+ \@@_query_range:nn
+ { \etex_gluestretch:D \tex_skip:D \l_@@_zeroth_submatch_int }
+ { \l_@@_max_pos_int }
}
- \regex_group_end_replace:N #3
+ \@@_group_end_replace:N #3
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_replace_all_aux:nnN}
+% \begin{macro}[aux]{\@@_replace_all:nnN}
% Match multiple times, and for every match, extract submatches and
% additionally store the position at which the match attempt started
% (as the shrink component of a \tn{skip} register). The \tn{skip}
-% registers from \cs{l_regex_max_state_int} to
-% \cs{l_regex_submatch_int} hold information about submatches of every
+% registers from \cs{l_@@_max_state_int} to
+% \cs{l_@@_submatch_int} hold information about submatches of every
% match in order; each match corresponds to
-% \cs{l_regex_capturing_group_int} consecutive \tn{skip} registers.
+% \cs{l_@@_capturing_group_int} consecutive \tn{skip} registers.
% Compute the brace balance corresponding to doing all the
% replacements: this is the sum of brace balances for replacing each
% match. Join together the replacement texts for each match (including
% the part of the query before the match), and the end of the query.
% \begin{macrocode}
-\cs_new_protected:Npn \regex_replace_all_aux:nnN #1#2#3
+\cs_new_protected:Npn \@@_replace_all:nnN #1#2#3
{
\group_begin:
- \regex_multi_match:n { \regex_extract: }
+ \@@_multi_match:n { \@@_extract: }
#1
- \regex_replacement:n {#2}
- \exp_args:No \regex_match:n {#3}
- \int_set:Nn \l_regex_balance_int
+ \@@_replacement:n {#2}
+ \exp_args:No \@@_match:n {#3}
+ \int_set:Nn \l_@@_balance_int
{
0
- \prg_stepwise_function:nnnN
- { \c_two * \l_regex_max_state_int }
- \l_regex_capturing_group_int
- { \l_regex_submatch_int - \c_one }
- \regex_replacement_balance_one_match:n
+ \int_step_function:nnnN
+ { \c_two * \l_@@_max_state_int }
+ \l_@@_capturing_group_int
+ { \l_@@_submatch_int - \c_one }
+ \@@_replacement_balance_one_match:n
}
- \tl_set:Nx \l_regex_internal_a_tl
+ \tl_set:Nx \l_@@_internal_a_tl
{
- \prg_stepwise_function:nnnN
- { \c_two * \l_regex_max_state_int }
- \l_regex_capturing_group_int
- { \l_regex_submatch_int - \c_one }
- \regex_replacement_do_one_match:n
- \regex_query_range:nn
- \l_regex_start_pos_int \l_regex_max_pos_int
+ \int_step_function:nnnN
+ { \c_two * \l_@@_max_state_int }
+ \l_@@_capturing_group_int
+ { \l_@@_submatch_int - \c_one }
+ \@@_replacement_do_one_match:n
+ \@@_query_range:nn
+ \l_@@_start_pos_int \l_@@_max_pos_int
}
- \regex_group_end_replace:N #3
+ \@@_group_end_replace:N #3
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux]{\regex_group_end_replace:N}
+% \begin{macro}[aux]{\@@_group_end_replace:N}
% If the brace balance is not $0$, raise an error. Then set the user's
% variable |#1| to the \texttt{x}-expansion of
-% \cs{l_regex_internal_a_tl}, adding the appropriate braces to produce
+% \cs{l_@@_internal_a_tl}, adding the appropriate braces to produce
% a balanced result. And end the group.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \regex_group_end_replace:N #1
+\cs_new_protected_nopar:Npn \@@_group_end_replace:N #1
{
- \if_num:w \l_regex_balance_int = \c_zero
+ \if_int_compare:w \l_@@_balance_int = \c_zero
\else:
- \msg_kernel_error:nnxxx { regex } { result-unbalanced }
+ \__msg_kernel_error:nnxxx { regex } { result-unbalanced }
{ replacing }
- { \int_max:nn { - \l_regex_balance_int } { \c_zero } }
- { \int_max:nn { \l_regex_balance_int } { \c_zero } }
+ { \int_max:nn { - \l_@@_balance_int } { \c_zero } }
+ { \int_max:nn { \l_@@_balance_int } { \c_zero } }
\fi:
\use:x
{
\group_end:
\tl_set:Nn \exp_not:N #1
{
- \if_int_compare:w \l_regex_balance_int < \c_zero
- \prg_replicate:nn { - \l_regex_balance_int }
+ \if_int_compare:w \l_@@_balance_int < \c_zero
+ \prg_replicate:nn { - \l_@@_balance_int }
{ { \if_false: } \fi: }
\fi:
- \l_regex_internal_a_tl
- \if_int_compare:w \l_regex_balance_int > \c_zero
- \prg_replicate:nn { \l_regex_balance_int }
+ \l_@@_internal_a_tl
+ \if_int_compare:w \l_@@_balance_int > \c_zero
+ \prg_replicate:nn { \l_@@_balance_int }
{ \if_false: { \fi: } }
\fi:
}
@@ -5653,20 +5670,20 @@
%
% Messages for the preparsing phase.
% \begin{macrocode}
-\msg_kernel_new:nnnn { regex } { trailing-backslash }
+\__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 }
+\__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\{\int_to_hexadecimal:n{#1}'.~
The~closing~brace~is~missing.
}
-\msg_kernel_new:nnnn { regex } { x-overflow }
+\__msg_kernel_new:nnnn { regex } { x-overflow }
{ Character~code~'#1'~too~large~in~\iow_char:N\\x~hexadecimal~sequence. }
{
You~wrote~something~like~
@@ -5677,7 +5694,7 @@
%
% Invalid quantifier.
% \begin{macrocode}
-\msg_kernel_new:nnnn { regex } { invalid-quantifier }
+\__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'.~
@@ -5689,13 +5706,13 @@
% Messages for missing or extra closing brackets and parentheses, with
% some fancy singular/plural handling for the case of parentheses.
% \begin{macrocode}
-\msg_kernel_new:nnnn { regex } { missing-rbrack }
+\__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 }
+\__msg_kernel_new:nnnn { regex } { missing-rparen }
{
Missing~right~parenthes\int_compare:nTF{#1=1}{i}{e}s~
inserted~in~regular~expression.
@@ -5705,7 +5722,7 @@
more~left~parenthes\int_compare:nTF{#1=1}{i}{e}s~than~right~
parenthes\int_compare:nTF{#1=1}{i}{e}s.
}
-\msg_kernel_new:nnnn { regex } { extra-rparen }
+\__msg_kernel_new:nnnn { regex } { extra-rparen }
{ Extra~right~parenthesis~ignored~in~regular~expression. }
{
LaTeX~came~across~a~closing~parenthesis~when~no~submatch~group~
@@ -5715,25 +5732,25 @@
%
% Some escaped alphanumerics are not allowed everywhere.
% \begin{macrocode}
-\msg_kernel_new:nnnn { regex } { bad-escape }
+\__msg_kernel_new:nnnn { regex } { bad-escape }
{
Invalid~escape~\c_backslash_str #1~
- \regex_if_in_cs:TF { within~a~control~sequence. }
+ \@@_if_in_cs:TF { within~a~control~sequence. }
{
- \regex_if_in_class:TF
+ \@@_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
+ \@@_if_in_cs:TF
{
within~a~control~sequence~test~introduced~by~
\iow_char:N\\c\iow_char:N\{.
}
{
- \regex_if_in_class:TF
+ \@@_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.
@@ -5743,14 +5760,14 @@
%
% Range errors.
% \begin{macrocode}
-\msg_kernel_new:nnnn { regex } { range-missing-end }
+\__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 }
+\__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,~
@@ -5762,27 +5779,27 @@
%
% Errors related to |\c| and |\u|.
% \begin{macrocode}
-\msg_kernel_new:nnnn { regex } { c-bad-mode }
+\__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 }
+\__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 }
+\__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 }
+\__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~
@@ -5790,17 +5807,17 @@
capital~letter~representing~a~character~category,~namely~
one~of~ABCDELMOPSTU.
}
-\msg_kernel_new:nnnn { regex } { u-missing-lbrace }
+\__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 }
+\__msg_kernel_new:nnnn { regex } { u-missing-rbrace }
{ Missing~right~brace~inserted~for~\iow_char:N\\u~escape. }
{
LaTeX~
- \tl_if_empty:xTF {#2}
+ \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.
@@ -5809,14 +5826,14 @@
%
% Errors when encountering the \textsc{posix} syntax |[:...:]|.
% \begin{macrocode}
-\msg_kernel_new:nnnn { regex } { posix-unsupported }
+\__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 }
+\__msg_kernel_new:nnnn { regex } { posix-unknown }
{ POSIX~class~[:#1:]~unknown. }
{
[:#1:]~is~not~among~the~known~POSIX~classes~
@@ -5825,7 +5842,7 @@
[:print:],~[:punct:],~[:space:],~[:upper:],~
[:word:],~and~[:xdigit:].
}
-\msg_kernel_new:nnnn { regex } { posix-missing-close }
+\__msg_kernel_new:nnnn { regex } { posix-missing-close }
{ Missing~closing~':]'~for~POSIX~class. }
{ The~POSIX~syntax~'#1'~must~be~followed~by~':]',~not~'#2'. }
% \end{macrocode}
@@ -5834,7 +5851,7 @@
% with an unbalanced token list, which we must re-balance by adding
% begin-group or end-group character tokens.
% \begin{macrocode}
-\msg_kernel_new:nnnn { regex } { result-unbalanced }
+\__msg_kernel_new:nnnn { regex } { result-unbalanced }
{ Missing~brace~inserted~when~#1. }
{
LaTeX~was~asked~to~do~some~regular~expression~operation,~
@@ -5846,7 +5863,7 @@
%
% Error message for unknown options.
% \begin{macrocode}
-\msg_kernel_new:nnnn { regex } { unknown-option }
+\__msg_kernel_new:nnnn { regex } { unknown-option }
{ Unknown~option~`#1'~for~regular~expressions. }
{
The~only~available~option~is~'case-insensitive',~toggled~by~
@@ -5856,28 +5873,28 @@
%
% Errors in the replacement text.
% \begin{macrocode}
-\msg_kernel_new:nnnn { regex } { replacement-c }
+\__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 }
+\__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 }
+\__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 }
+\__msg_kernel_new:nnnn { regex } { replacement-catcode-end }
{
Missing~character~for~the~\iow_char:N\\c<category><character>~
construction~in~a~replacement~text.
@@ -5888,7 +5905,7 @@
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-null-space }
+\__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',~
@@ -5897,26 +5914,26 @@
This~specific~case~is~impossible~and~will~be~replaced~
by~a~normal~space.
}
-\msg_kernel_new:nnnn { regex } { replacement-missing-rbrace }
+\__msg_kernel_new:nnnn { regex } { replacement-missing-rbrace }
{ Missing~right~brace~inserted~in~replacement~text. }
{
- There~were~\int_use:N \l_regex_replacement_csnames_int \
+ There~were~\int_use:N \l_@@_replacement_csnames_int \
missing~right~braces.
}
% \end{macrocode}
%
-% \begin{macro}[aux]{\regex_msg_repeated:nnN}
+% \begin{macro}[aux]{\@@_msg_repeated:nnN}
% This is not technically a message, but seems related enough to go
% there. The arguments are: |#1| is the minimum number of repetitions;
% |#2| is the number of allowed extra repetitions ($-1$ for infinite
% number), and |#3| tells us aboud lazyness.
% \begin{macrocode}
-\cs_new:Npn \regex_msg_repeated:nnN #1#2#3
+\cs_new:Npn \@@_msg_repeated:nnN #1#2#3
{
- \str_if_eq:xxF { #1 #2 } { 1 0 }
+ \str_if_eq_x:nnF { #1 #2 } { 1 0 }
{
, ~ repeated ~
- \prg_case_int:nnn {#2}
+ \int_case:nnn {#2}
{
{ -1 } { #1~or~more~times,~\bool_if:NTF #3 { lazy } { greedy } }
{ 0 } { #1~times }
@@ -5935,18 +5952,18 @@
% The tracing code is still very experimental, and is meant to be used
% with the \pkg{l3trace} package, currently in \texttt{l3trial}.
%
-% \begin{macro}[int]{\regex_trace_states:n}
+% \begin{macro}[int]{\@@_trace_states:n}
% This function lists the contents of all states of the \textsc{nfa},
-% stored in \tn{toks} from $0$ to \cs{l_regex_max_state_int}
+% stored in \tn{toks} from $0$ to \cs{l_@@_max_state_int}
% (excluded).
% \begin{macrocode}
%<*trace>
-\cs_new_protected:Npn \regex_trace_states:n #1
+\cs_new_protected:Npn \@@_trace_states:n #1
{
- \prg_stepwise_inline:nnnn
- \l_regex_min_state_int
+ \int_step_inline:nnnn
+ \l_@@_min_state_int
\c_one
- { \l_regex_max_state_int - 1 }
+ { \l_@@_max_state_int - 1 }
{
\trace:nnx { regex } { #1 }
{ \iow_char:N \\toks ##1 = { \tex_the:D \tex_toks:D ##1 } }
@@ -5957,11 +5974,12 @@
% \end{macro}
%
% \begin{macrocode}
-%</package>
+%</initex|package>
% \end{macrocode}
%
% \end{implementation}
%
+% \PrintIndex
% \endinput
%^^A NOT IMPLEMENTED
%^^A \p{xx} a character with the xx property
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx
index ef2bc9b5460..51c42856c3c 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx
@@ -35,8 +35,8 @@
%
%<*driver|package>
\RequirePackage{expl3}
-\GetIdInfo$Id: l3str.dtx 3460 2012-02-26 12:16:41Z will $
- {L3 Experimental Strings}
+\GetIdInfo$Id: l3str.dtx 3940 2012-07-09 00:41:44Z bruno $
+ {L3 Experimental strings}
%</driver|package>
%<*driver>
\documentclass[full]{l3doc}
@@ -96,6 +96,11 @@
%
% \section{Building strings}
%
+% \begin{variable}{\c_max_char_int}
+% The maximum valid character code, $255$ for pdf\TeX{}, and $1114111$
+% for \XeTeX{} and \LuaTeX{}.
+% \end{variable}
+%
% \begin{variable}
% {
% \c_backslash_str,
@@ -192,15 +197,16 @@
% \section{Accessing the contents of a string}
%
% \begin{function}[EXP]
-% {\str_length:N, \str_length:n, \str_length_ignore_spaces:n}
+% {\str_count:N, \str_count:n, \str_count_ignore_spaces:n}
% \begin{syntax}
-% \cs{str_length:n} \Arg{token list}
+% \cs{str_count:n} \Arg{token list}
% \end{syntax}
-% Leaves the length of the string representation of \meta{token list}
+% Leaves the number of tokens in the string representation of
+% \meta{token list}
% in the input stream as an integer denotation. The functions differ
-% in their treatment of spaces. In the case of \cs{str_length:N} and
-% \cs{str_length:n}, all characters including spaces are counted. The
-% \cs{str_length_ignore_spaces:n} leaves the number of non-space
+% in their treatment of spaces. In the case of \cs{str_count:N} and
+% \cs{str_count:n}, all characters including spaces are counted. The
+% \cs{str_count_ignore_spaces:n} leaves the number of non-space
% characters in the input stream.
% \end{function}
%
@@ -256,7 +262,7 @@
% account. The \cs{str_item_ignore_spaces:nn} function skips spaces
% in its argument. If the \meta{integer expression} is negative,
% characters are counted from the end of the \meta{string}. Hence,
-% $-1$ is the right-most character, \emph{etc.}, while $0$ is the
+% $-1$ is the right-most character, \emph{etc.}, while $1$ is the
% first (left-most) character.
% \end{function}
%
@@ -267,28 +273,27 @@
% \end{syntax}
% Converts the \meta{token list} to a \meta{string}, and leaves in the
% input stream the characters from the \meta{start index} inclusive to
-% the \meta{end index} exclusive. Note that the length of the
+% the \meta{end index} exclusive. Note that the token count of the
% substring is equal to the difference between the two \meta{indices}.
% If either of \meta{start index} or \meta{end index} is negative,
-% then it is incremented by the length of the list. If either of
+% then it is incremented by the token count of the list. If either of
% \meta{start index} or \meta{end index} is empty, it is replaced by
% the corresponding end-point of the string. Both \meta{start index}
-% and \meta{end index} count from $0$ for the first (left most)
+% and \meta{end index} count from $1$ for the first (left most)
% character. For instance,
% \begin{verbatim}
-% \iow_term:x { \str_substr:nnn { abcdef } { 1 } { 4 } }
+% \iow_term:x { \str_substr:nnn { abcdef } { 2 } { 5 } }
% \iow_term:x { \str_substr:nnn { abcdef } { -4 } { } }
% \end{verbatim}
-% will print \texttt{bcd} and \texttt{cdef}.
+% will print \texttt{bcd} and \texttt{cdef} to the terminal.
% \end{function}
%
% \section{String conditionals}
%
-% \begin{function}[EXP, pTF]
+% \begin{function}[EXP,pTF]
% {
-% \str_if_eq:NN,
% \str_if_eq:nn, \str_if_eq:Vn, \str_if_eq:on, \str_if_eq:no,
-% \str_if_eq:nV, \str_if_eq:VV, \str_if_eq:xx
+% \str_if_eq:nV, \str_if_eq:VV
% }
% \begin{syntax}
% \cs{str_if_eq_p:nn} \Arg{tl_1} \Arg{tl_2}
@@ -298,11 +303,63 @@
% basis, and is \texttt{true} if the two lists contain the same
% characters in the same order. Thus for example
% \begin{verbatim}
-% \str_if_eq_p:xx { abc } { \tl_to_str:n { abc } }
+% \str_if_eq_p:no { abc } { \tl_to_str:n { abc } }
+% \end{verbatim}
+% is logically \texttt{true}.
+% \end{function}
+%
+% \begin{function}[EXP,pTF, added = 2012-06-05]{\str_if_eq_x:nn}
+% \begin{syntax}
+% \cs{str_if_eq_x_p:nn} \Arg{tl_1} \Arg{tl_2}
+% \cs{str_if_eq_x:nnTF} \Arg{tl_1} \Arg{tl_2} \Arg{true code} \Arg{false code}
+% \end{syntax}
+% Compares the full expansion of two \meta{token lists} on a character by
+% character basis, and is \texttt{true} if the two lists contain the same
+% characters in the same order. Thus for example
+% \begin{verbatim}
+% \str_if_eq_x_p:nn { abc } { \tl_to_str:n { abc } }
% \end{verbatim}
-% is logically \texttt{true}. All versions of these functions are
-% fully expandable (including those involving an \texttt{x}-type
-% expansion).
+% is logically \texttt{true}.
+% \end{function}
+%
+% \begin{function}[added = 2012-06-03, EXP]{\str_case:nnn, \str_case:onn}
+% \begin{syntax}
+% \cs{str_case:nnn} \Arg{test string} \\
+% ~~|{| \\
+% ~~~~\Arg{string case1} \Arg{code case1} \\
+% ~~~~\Arg{string case2} \Arg{code case2} \\
+% ~~~~\ldots \\
+% ~~~~\Arg{string case$\sb{n}$} \Arg{code case$\sb{n}$} \\
+% ~~|}| \\
+% ~~\Arg{else case}
+% \end{syntax}
+% This function compares the \meta{test string} in turn with each
+% of the \meta{string cases}. If the two are equal (as described for
+% \cs{str_if_eq:nnTF} then the
+% associated \meta{code} is left in the input stream. If none of
+% the tests are \texttt{true} then the \texttt{else code} will be
+% left in the input stream.
+% \end{function}
+%
+% \begin{function}[added = 2012-06-05, EXP]{\str_case_x:nnn}
+% \begin{syntax}
+% \cs{str_case_x:nnn} \Arg{test string} \\
+% ~~|{| \\
+% ~~~~\Arg{string case1} \Arg{code case1} \\
+% ~~~~\Arg{string case2} \Arg{code case2} \\
+% ~~~~\ldots \\
+% ~~~~\Arg{string case$\sb{n}$} \Arg{code case$\sb{n}$} \\
+% ~~|}| \\
+% ~~\Arg{else case}
+% \end{syntax}
+% This function compares the full expansion of the \meta{test string}
+% in turn with the full expansion of the \meta{string cases}. If the two
+% full expansions are equal (as described for \cs{str_if_eq:nnTF} then the
+% associated \meta{code} is left in the input stream. If none of the tests
+% are \texttt{true} then the \texttt{else code} will be left in the input
+% stream. The \meta{test string} is expanded in each comparison, and must
+% always yield the same result: for example, random numbers must
+% not be used within this string.
% \end{function}
%
% \section{Viewing strings}
@@ -314,6 +371,22 @@
% Displays the content of the \meta{str~var} on the terminal.
% \end{function}
%
+% \section{Scratch strings}
+%
+% \begin{variable}{\l_tmpa_str, \l_tmpb_str}
+% Scratch strings for local assignment. These are never used by
+% the kernel code, and so are safe for use with any \LaTeX3-defined
+% function. However, they may be overwritten by other non-kernel
+% code and so should only be used for short-term storage.
+% \end{variable}
+%
+% \begin{variable}{\g_tmpa_str, \g_tmpb_str}
+% Scratch strings for global assignment. These are never used by
+% the kernel code, and so are safe for use with any \LaTeX3-defined
+% function. However, they may be overwritten by other non-kernel
+% code and so should only be used for short-term storage.
+% \end{variable}
+%
% \section{Encoding functions}
%
% Traditionally, string encodings only specify how strings of characters
@@ -448,87 +521,39 @@
%
% \section{Internal string functions}
%
-% \begin{variable}{\c_max_char_int}
-% The maximum valid character code, $255$ for pdf\TeX{}, and $1114111$
-% for the two other engines.
-% \end{variable}
-%
-% \begin{function}{\str_aux_hexadecimal_use:NTF}
+% \begin{function}{\__str_gset_other:Nn}
% \begin{syntax}
-% \cs{str_aux_hexadecimal_use:NTF} \meta{token} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% If the \meta{token} is a hexdecimal digit (upper case or lower
-% case), its upper-case version is left in the input stream,
-% \emph{followed} by the \meta{true code}. Otherwise, the \meta{false
-% code} is left in the input stream.
-% \begin{texnote}
-% This function will fail if the escape character is a hexadecimal
-% digit, or has a character code in the range $[0,5]$. We are thus
-% careful to set the escape character to a known value before using
-% it.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{\str_aux_octal_use:NTF}
-% \begin{syntax}
-% \cs{str_aux_octal_use:NTF} \meta{token} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% If the \meta{token} is an octal digit, it is left in the input
-% stream, \emph{followed} by the \meta{true code}. Otherwise, the
-% \meta{false code} is left in the input stream.
-% \begin{texnote}
-% This function will fail if the escape character is an octal
-% digit. We are thus careful to set the escape character to a known
-% value before using it.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}[EXP]{\tl_to_other_str:n}
-% \begin{syntax}
-% \cs{tl_to_other_str:n} \Arg{token list}
-% \end{syntax}
-% Converts the \meta{token list} to a \meta{other string}, where
-% spaces have category code \enquote{other}.
-% \begin{texnote}
-% This function can be \texttt{f}-expanded without fear of losing a
-% leading space, since spaces do not have category code $10$ in its
-% result. This function takes a time quadratic in the length of the
-% string; \cs{str_gset_other:Nn} is faster but not expandable.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}{\str_gset_other:Nn}
-% \begin{syntax}
-% \cs{str_gset_other:Nn} \meta{tl~var} \Arg{token list}
+% \cs{__str_gset_other:Nn} \meta{tl~var} \Arg{token list}
% \end{syntax}
% Converts the \meta{token list} to an \meta{other string}, where
% spaces have category code \enquote{other}, and assigns the result to
% the \meta{tl~var}, globally.
% \end{function}
%
-% \begin{function}[EXP]
-% {
-% \str_if_contains_char:NNT,
-% \str_if_contains_char:NNTF,
-% \str_if_contains_char:nNTF
-% }
+% \begin{function}{\__str_hexadecimal_use:NTF}
% \begin{syntax}
-% \cs{str_if_contains_char:nNTF} \Arg{token list} \meta{char}
+% \cs{__str_hexadecimal_use:NTF} \meta{token} \Arg{true code} \Arg{false code}
% \end{syntax}
-% Converts the \meta{token list} to a \meta{string} and tests whether
-% the \meta{char} is present in the \meta{string}. Spaces are
-% ignored.
+% If the \meta{token} is a hexadecimal digit (upper case or lower
+% case), its upper-case version is left in the input stream,
+% \emph{followed} by the \meta{true code}. Otherwise, the \meta{false
+% code} is left in the input stream.
+% \begin{texnote}
+% This function fails on some inputs if the escape character is a
+% hexadecimal digit. We are thus careful to set the escape
+% character to a known (safe) value before using it.
+% \end{texnote}
% \end{function}
%
-% \begin{function}{\str_declare_eight_bit_encoding:nnn}
+% \begin{function}[EXP]{\__str_output_byte:n}
% \begin{syntax}
-% \cs{str_declare_eight_bit_encoding:nnn} \Arg{name} \Arg{mapping} \Arg{missing}
+% \cs{__str_output_byte:n} \Arg{intexpr}
% \end{syntax}
-% This declares the encoding \meta{name} to map bytes to Unicode
-% characters according to the \meta{mapping}, and map those bytes
-% which are not mentionned in the \meta{mapping} either to the
-% replacement character (if they appear in \meta{missing}), or to
-% themselves.
+% Expands to a character token with category other and character code
+% equal to the value of \meta{intexpr}. The value of \meta{intexpr}
+% must be in the range $[-1, 255]$, and any value outside this range
+% results in undefined behaviour. The special value $-1$ is used to
+% produce an empty result.
% \end{function}
%
% \section{Possibilities, and things to do}
@@ -541,7 +566,7 @@
% \item Add documentation about each encoding and escaping method, and
% add examples.
% \item The \texttt{hex} unescaping should raise an error for
-% odd-length strings.
+% odd-token count strings.
% \item Decide what bytes should be escaped in the \texttt{url}
% escaping. Perhaps |!'()*-./0123456789_| are safe, and all other
% characters should be escaped?
@@ -555,6 +580,7 @@
%
% Other string tasks.
% \begin{itemize}
+% \item Expandable \cs{str_if_in:nnTF}?
% \item \cs{str_if_head_eq:nN}
% \item \cs{str_if_numeric/decimal/integer:n}, perhaps in \pkg{l3fp}?
% \item Should \cs{str_item:Nn} be \cs{str_char:Nn}?
@@ -565,6 +591,7 @@
% either one integer expression, two integer expressions separated
% by |:|, or three integer expressions separated by |:|, \emph{cf.}
% Python's extended slice syntax?
+% \item Analog of \texttt{printf}?
% \end{itemize}
%
% \end{documentation}
@@ -578,6 +605,10 @@
% \end{macrocode}
%
% \begin{macrocode}
+%<@@=str>
+% \end{macrocode}
+%
+% \begin{macrocode}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\RequirePackage{l3tl-analysis,l3tl-build,l3flag}
@@ -587,13 +618,13 @@
% \pkg{l3kernel}.
% \begin{itemize}
% \item \cs{str_if_eq:nn}[pTF] and variants,
-% \item \cs{str_if_eq_return:on}, \cs{str_if_eq_return:xx}
+% \item \cs{str_if_eq_x_return:on}, \cs{str_if_eq_x_return:nn}
% \item \cs{tl_to_str:n}, \cs{tl_to_str:N}, \cs{tl_to_str:c},
% \item \cs{token_to_str:N}, \cs{cs_to_str:N}
-% \item \cs{str_head:n}, \cs{str_head_aux:w}, (copied here)
-% \item \cs{str_tail:n}, \cs{str_tail_aux:w}, (copied here)
-% \item \cs{str_length_skip_spaces} (deprecated)
-% \item \cs{str_length_loop:NNNNNNNNN} (unchanged)
+% \item \cs{str_head:n}, \cs{__str_head:w}, (copied here)
+% \item \cs{str_tail:n}, \cs{__str_tail:w}, (copied here)
+% \item \cs{str_count_ignore_spaces} (unchanged)
+% \item \cs{str_count_loop:NNNNNNNNN} (unchanged)
% \end{itemize}
%
% \subsection{Helpers}
@@ -657,27 +688,27 @@
%
% \subsubsection{Variables and constants}
%
-% \begin{macro}{\str_tmp:w}
-% \begin{variable}{\l_str_internal_int}
-% \begin{variable}{\l_str_internal_tl}
+% \begin{macro}{\@@_tmp:w}
+% \begin{variable}{\l_@@_internal_int}
+% \begin{variable}{\l_@@_internal_tl}
% Internal scratch space for some functions.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \str_tmp:w { }
-\tl_new:N \l_str_internal_tl
-\int_new:N \l_str_internal_int
+\cs_new_protected_nopar:Npn \@@_tmp:w { }
+\tl_new:N \l_@@_internal_tl
+\int_new:N \l_@@_internal_int
% \end{macrocode}
% \end{variable}
% \end{variable}
% \end{macro}
%
-% \begin{variable}{\g_str_result_tl}
-% The \cs{g_str_result_tl} variable is used to hold the result of
+% \begin{variable}{\g_@@_result_tl}
+% The \cs{g_@@_result_tl} variable is used to hold the result of
% various internal string operations (mostly conversions) which are
% typically performed in a group. The variable is global so that it
% remains defined outside the group, to be assigned to a user-provided
% variable.
% \begin{macrocode}
-\tl_new:N \g_str_result_tl
+\tl_new:N \g_@@_result_tl
% \end{macrocode}
% \end{variable}
%
@@ -709,11 +740,11 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\c_str_replacement_char_int}
+% \begin{variable}{\c_@@_replacement_char_int}
% When converting, invalid bytes are replaced by the Unicode
% replacement character \hexnum{FFFD}.
% \begin{macrocode}
-\int_const:Nn \c_str_replacement_char_int { "FFFD }
+\int_const:Nn \c_@@_replacement_char_int { "FFFD }
% \end{macrocode}
% \end{variable}
%
@@ -726,7 +757,7 @@
% \c_tilde_str,
% \c_percent_str
% }
-% For all of those strings, \cs{cs_to_str:N} produces characters with
+% For all of those strings, use \cs{cs_to_str:N} to get characters with
% the correct category code.
% \begin{macrocode}
\tl_const:Nx \c_backslash_str { \cs_to_str:N \\ }
@@ -738,36 +769,36 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\g_str_file_prop}
+% \begin{variable}{\g_@@_alias_prop}
% To avoid needing one file per encoding/escaping alias, we keep track
% of those in a property list.
% \begin{macrocode}
-\prop_new:N \g_str_file_prop
-\prop_gput:Nnn \g_str_file_prop { latin1 } { iso88591 }
-\prop_gput:Nnn \g_str_file_prop { latin2 } { iso88592 }
-\prop_gput:Nnn \g_str_file_prop { latin3 } { iso88593 }
-\prop_gput:Nnn \g_str_file_prop { latin4 } { iso88594 }
-\prop_gput:Nnn \g_str_file_prop { latin5 } { iso88599 }
-\prop_gput:Nnn \g_str_file_prop { latin6 } { iso885910 }
-\prop_gput:Nnn \g_str_file_prop { latin7 } { iso885913 }
-\prop_gput:Nnn \g_str_file_prop { latin8 } { iso885914 }
-\prop_gput:Nnn \g_str_file_prop { latin9 } { iso885915 }
-\prop_gput:Nnn \g_str_file_prop { latin10 } { iso885916 }
-\prop_gput:Nnn \g_str_file_prop { utf16le } { utf16 }
-\prop_gput:Nnn \g_str_file_prop { utf16be } { utf16 }
-\prop_gput:Nnn \g_str_file_prop { utf32le } { utf32 }
-\prop_gput:Nnn \g_str_file_prop { utf32be } { utf32 }
-\prop_gput:Nnn \g_str_file_prop { hexadecimal } { hex }
+\prop_new:N \g_@@_alias_prop
+\prop_gput:Nnn \g_@@_alias_prop { latin1 } { iso88591 }
+\prop_gput:Nnn \g_@@_alias_prop { latin2 } { iso88592 }
+\prop_gput:Nnn \g_@@_alias_prop { latin3 } { iso88593 }
+\prop_gput:Nnn \g_@@_alias_prop { latin4 } { iso88594 }
+\prop_gput:Nnn \g_@@_alias_prop { latin5 } { iso88599 }
+\prop_gput:Nnn \g_@@_alias_prop { latin6 } { iso885910 }
+\prop_gput:Nnn \g_@@_alias_prop { latin7 } { iso885913 }
+\prop_gput:Nnn \g_@@_alias_prop { latin8 } { iso885914 }
+\prop_gput:Nnn \g_@@_alias_prop { latin9 } { iso885915 }
+\prop_gput:Nnn \g_@@_alias_prop { latin10 } { iso885916 }
+\prop_gput:Nnn \g_@@_alias_prop { utf16le } { utf16 }
+\prop_gput:Nnn \g_@@_alias_prop { utf16be } { utf16 }
+\prop_gput:Nnn \g_@@_alias_prop { utf32le } { utf32 }
+\prop_gput:Nnn \g_@@_alias_prop { utf32be } { utf32 }
+\prop_gput:Nnn \g_@@_alias_prop { hexadecimal } { hex }
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\g_str_error_bool}
+% \begin{variable}{\g_@@_error_bool}
% In conversion functions with a built-in conditional, errors are not
% reported directly to the user, but the information is collected in
% this boolean, used at the end to decide on which branch of the
% conditional to take.
% \begin{macrocode}
-\bool_new:N \g_str_error_bool
+\bool_new:N \g_@@_error_bool
% \end{macrocode}
% \end{variable}
%
@@ -783,12 +814,20 @@
%
% \subsubsection{Escaping spaces}
%
-% \begin{macro}[EXP]{\tl_to_other_str:n}
-% \begin{macro}[EXP,aux]{\tl_to_other_str_loop:w, \tl_to_other_str_end:w}
-% Replaces all spaces by \enquote{other} spaces, after converting the
-% token list to a string via \cs{tl_to_str:n}. This function is
-% \texttt{f}-expandable, storing the part of the string with escaped
-% spaces between the \cs{q_mark} and \cs{q_stop} markers.
+% \begin{macro}[EXP]{\@@_to_other:n}
+% \begin{macro}[EXP, aux]{\@@_to_other_loop:w, \@@_to_other_end:w}
+% \begin{syntax}
+% \cs{@@_to_other:n} \Arg{token list}
+% \end{syntax}
+% Converts the \meta{token list} to a \meta{other string}, where
+% spaces have category code \enquote{other}. First apply
+% \cs{tl_to_str:n}, then replace all spaces by \enquote{other} spaces,
+% $8$ at a time, storing the converted part of the string between the
+% \cs{q_mark} and \cs{q_stop} markers. This function can be
+% \texttt{f}-expanded without fear of losing a leading space, since
+% spaces do not have category code $10$ in its result. This function
+% takes a time quadratic in the token count of the string;
+% \cs{@@_gset_other:Nn} is faster but not expandable.
% \begin{macrocode}
\group_begin:
\char_set_lccode:nn { `\* } { `\ }
@@ -796,31 +835,31 @@
\tl_to_lowercase:n
{
\group_end:
- \cs_new:Npn \tl_to_other_str:n #1
+ \cs_new:Npn \@@_to_other:n #1
{
- \exp_after:wN \tl_to_other_str_loop:w \tl_to_str:n {#1} ~ %
+ \exp_after:wN \@@_to_other_loop:w \tl_to_str:n {#1} ~ %
A ~ A ~ A ~ A ~ A ~ A ~ A ~ A ~ \q_mark \q_stop
}
- \cs_new:Npn \tl_to_other_str_loop:w
+ \cs_new:Npn \@@_to_other_loop:w
#1 ~ #2 ~ #3 ~ #4 ~ #5 ~ #6 ~ #7 ~ #8 ~ #9 \q_stop
{
\if_meaning:w A #8
- \tl_to_other_str_end:w
+ \@@_to_other_end:w
\fi:
- \tl_to_other_str_loop:w
+ \@@_to_other_loop:w
#9 #1 * #2 * #3 * #4 * #5 * #6 * #7 * #8 * \q_stop
}
- \cs_new:Npn \tl_to_other_str_end:w \fi: #1 \q_mark #2 * A #3 \q_stop
+ \cs_new:Npn \@@_to_other_end:w \fi: #1 \q_mark #2 * A #3 \q_stop
{ \fi: #2 }
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\str_gset_other:Nn}
-% \begin{macro}[aux,EXP]{\str_gset_other_loop:w}
-% \begin{macro}[aux,EXP]{\str_gset_other_end:w}
-% This function could be done by using \cs{tl_to_other_str:n} within
+% \begin{macro}[int]{\@@_gset_other:Nn}
+% \begin{macro}[aux,EXP]{\@@_gset_other_loop:w}
+% \begin{macro}[aux,EXP]{\@@_gset_other_end:w}
+% This function could be done by using \cs{@@_to_other:n} within
% an \texttt{x}-expansion, but that would take a time quadratic in the
% size of the string. Instead, we can \enquote{leave the result behind
% us} in the input stream, to be captured into the expanding
@@ -832,24 +871,24 @@
\tl_to_lowercase:n
{
\group_end:
- \cs_new_protected:Npn \str_gset_other:Nn #1#2
+ \cs_new_protected:Npn \@@_gset_other:Nn #1#2
{
\tl_gset:Nx #1
{
- \exp_after:wN \str_gset_other_loop:w \tl_to_str:n {#2} ~ %
+ \exp_after:wN \@@_gset_other_loop:w \tl_to_str:n {#2} ~ %
A ~ A ~ A ~ A ~ A ~ A ~ A ~ A ~ A ~ \q_stop
}
}
- \cs_new:Npn \str_gset_other_loop:w
+ \cs_new:Npn \@@_gset_other_loop:w
#1 ~ #2 ~ #3 ~ #4 ~ #5 ~ #6 ~ #7 ~ #8 ~ #9 ~
{
\if_meaning:w A #9
- \str_gset_other_end:w
+ \@@_gset_other_end:w
\fi:
#1 * #2 * #3 * #4 * #5 * #6 * #7 * #8 * #9
- \str_gset_other_loop:w *
+ \@@_gset_other_loop:w *
}
- \cs_new:Npn \str_gset_other_end:w \fi: #1 * A #2 \q_stop
+ \cs_new:Npn \@@_gset_other_end:w \fi: #1 * A #2 \q_stop
{ \fi: #1 }
}
% \end{macrocode}
@@ -861,7 +900,7 @@
%
% \begin{macro}[EXP]{\str_count_spaces:N}
% \begin{macro}[EXP]{\str_count_spaces:n}
-% \begin{macro}[EXP,aux]{\str_count_spaces_loop:wwwwwwwww}
+% \begin{macro}[EXP,aux]{\@@_count_spaces_loop:wwwwwwwww}
% To speed up this function, we grab $9$ spaces in each step. The
% loop stops when the last argument is one of the trailing
% |X|\meta{number}, and that \meta{number} is added to the sum of $9$
@@ -873,31 +912,31 @@
{
\int_eval:n
{
- \exp_after:wN \str_count_spaces_loop:wwwwwwwww
+ \exp_after:wN \@@_count_spaces_loop:wwwwwwwww
\tl_to_str:n {#1} ~
X 7 ~ X 6 ~ X 5 ~ X 4 ~ X 3 ~ X 2 ~ X 1 ~ X 0 ~ X -1 ~
\q_stop
}
}
-\cs_new:Npn \str_count_spaces_loop:wwwwwwwww #1~#2~#3~#4~#5~#6~#7~#8~#9~
+\cs_new:Npn \@@_count_spaces_loop:wwwwwwwww #1~#2~#3~#4~#5~#6~#7~#8~#9~
{
\if_meaning:w X #9
\exp_after:wN \use_none_delimit_by_q_stop:w
\fi:
- \c_nine + \str_count_spaces_loop:wwwwwwwww
+ \c_nine + \@@_count_spaces_loop:wwwwwwwww
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[EXP]{\str_length:N}
-% \begin{macro}[EXP]{\str_length:n}
-% \begin{macro}[EXP]{\str_length_unsafe:n}
-% \begin{macro}[EXP]{\str_length_ignore_spaces:n}
-% \begin{macro}[EXP,aux]{\str_length_aux:n, \str_length_loop:NNNNNNNNN}
-% To measure the length of a string we could first escape all spaces
-% using \cs{tl_to_other_str:N}, then measure the length of this token
+% \begin{macro}[EXP]{\str_count:N}
+% \begin{macro}[EXP]{\str_count:n}
+% \begin{macro}[EXP]{\@@_count_unsafe:n}
+% \begin{macro}[EXP]{\str_count_ignore_spaces:n}
+% \begin{macro}[EXP,aux]{\@@_count:n, \@@_count_loop:NNNNNNNNN}
+% To measure the token count of a string we could first escape all spaces
+% using \cs{@@_to_other:o}, then measure the count of this token
% list. However, this would be quadratic in the length of the string,
% and we can do better. Namely, add the number of spaces (counted
% using the functions defined above) to the length ignoring spaces.
@@ -907,26 +946,26 @@
% \texttt{_unsafe} variant expects a token list consisting entirely of
% category code $12$ characters.
% \begin{macrocode}
-\cs_new_nopar:Npn \str_length:N { \exp_args:No \str_length:n }
-\cs_new:Npn \str_length:n #1
+\cs_new_nopar:Npn \str_count:N { \exp_args:No \str_count:n }
+\cs_new:Npn \str_count:n #1
{
- \str_length_aux:n
+ \@@_count:n
{
\str_count_spaces:n {#1}
- + \exp_after:wN \str_length_loop:NNNNNNNNN \tl_to_str:n {#1}
+ + \exp_after:wN \@@_count_loop:NNNNNNNNN \tl_to_str:n {#1}
}
}
-\cs_new:Npn \str_length_unsafe:n #1
+\cs_new:Npn \@@_count_unsafe:n #1
{
- \str_length_aux:n
- { \str_length_loop:NNNNNNNNN #1 }
+ \@@_count:n
+ { \@@_count_loop:NNNNNNNNN #1 }
}
-\cs_new:Npn \str_length_ignore_spaces:n #1
+\cs_new:Npn \str_count_ignore_spaces:n #1
{
- \str_length_aux:n
- { \exp_after:wN \str_length_loop:NNNNNNNNN \tl_to_str:n {#1} }
+ \@@_count:n
+ { \exp_after:wN \@@_count_loop:NNNNNNNNN \tl_to_str:n {#1} }
}
-\cs_new:Npn \str_length_aux:n #1
+\cs_new:Npn \@@_count:n #1
{
\int_eval:n
{
@@ -937,12 +976,12 @@
\q_stop
}
}
-\cs_set:Npn \str_length_loop:NNNNNNNNN #1#2#3#4#5#6#7#8#9
+\cs_set:Npn \@@_count_loop:NNNNNNNNN #1#2#3#4#5#6#7#8#9
{
\if_meaning:w X #9
\exp_after:wN \use_none_delimit_by_q_stop:w
\fi:
- \c_nine + \str_length_loop:NNNNNNNNN
+ \c_nine + \@@_count_loop:NNNNNNNNN
}
% \end{macrocode}
% \end{macro}
@@ -954,16 +993,16 @@
% \begin{macro}[EXP]{\str_head:N}
% \begin{macro}[EXP]{\str_head:n}
% \begin{macro}[EXP]{\str_head_ignore_spaces:n}
-% \begin{macro}[EXP,aux]{\str_head_aux:w}
+% \begin{macro}[EXP,aux]{\@@_head:w}
% The \texttt{_ignore_spaces} variant is almost identical to
% \cs{tl_head:n}. As usual, \cs{str_head:N} expands its argument and
% hands it to \cs{str_head:n}. To circumvent the fact that \TeX{}
% skips spaces when grabbing undelimited macro parameters,
-% \cs{str_head_aux:w} takes an argument delimited by a space. If |#1|
+% \cs{@@_head:w} takes an argument delimited by a space. If |#1|
% starts with a non-space character, \cs{use_i_delimit_by_q_stop:nw}
% leaves that in the input stream. On the other hand, if |#1| starts
-% with a space, the \cs{str_head_aux:w} takes an empty argument, and
-% the single (braced) space in the definition of \cs{str_head_aux:w}
+% with a space, the \cs{@@_head:w} takes an empty argument, and
+% the single (braced) space in the definition of \cs{@@_head:w}
% makes its way to the output. Finally, for an empty argument, the
% (braced) empty brace group in the definition of \cs{str_head:n}
% gives an empty result after passing through
@@ -972,11 +1011,11 @@
\cs_new_nopar:Npn \str_head:N { \exp_args:No \str_head:n }
\cs_set:Npn \str_head:n #1
{
- \exp_after:wN \str_head_aux:w
+ \exp_after:wN \@@_head:w
\tl_to_str:n {#1}
{ { } } ~ \q_stop
}
-\cs_set:Npn \str_head_aux:w #1 ~ %
+\cs_set:Npn \@@_head:w #1 ~ %
{ \use_i_delimit_by_q_stop:nw #1 { ~ } }
\cs_new:Npn \str_head_ignore_spaces:n #1
{
@@ -992,8 +1031,8 @@
% \begin{macro}[EXP]{\str_tail:N}
% \begin{macro}[EXP]{\str_tail:n}
% \begin{macro}[EXP]{\str_tail_ignore_spaces:n}
-% \begin{macro}[EXP,aux]{\str_tail_aux:w}
-% \begin{macro}[EXP,aux]{\str_tail_aux_ii:w}
+% \begin{macro}[EXP,aux]{\@@_tail:w}
+% \begin{macro}[EXP,aux]{\@@_tail_ii:w}
% As when fetching the head of a string, the \texttt{_ignore_spaces}
% variant is similar to \cs{tl_tail:n}. The more commonly used
% \cs{str_tail:n} function is a little bit more convoluted: hitting
@@ -1007,17 +1046,17 @@
\cs_new_nopar:Npn \str_tail:N { \exp_args:No \str_tail:n }
\cs_set:Npn \str_tail:n #1
{
- \exp_after:wN \str_tail_aux:w
+ \exp_after:wN \@@_tail:w
\reverse_if:N \if_charcode:w
\scan_stop: \tl_to_str:n {#1} X X \q_stop
}
-\cs_set:Npn \str_tail_aux:w #1 X #2 \q_stop { \fi: #1 }
+\cs_set:Npn \@@_tail:w #1 X #2 \q_stop { \fi: #1 }
\cs_new:Npn \str_tail_ignore_spaces:n #1
{
- \exp_after:wN \str_tail_aux_ii:w
+ \exp_after:wN \@@_tail_ii:w
\tl_to_str:n {#1} X X \q_stop
}
-\cs_new:Npn \str_tail_aux_ii:w #1 #2 X #3 \q_stop { #2 }
+\cs_new:Npn \@@_tail_ii:w #1 #2 X #3 \q_stop { #2 }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1025,88 +1064,88 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[EXP, int]{\str_skip_c_zero:w}
-% \begin{macro}[EXP, aux]{\str_skip_aux:wNNNNNNNN}
-% \begin{macro}[EXP, aux]{\str_skip_end:w, \str_skip_end_ii:NNNNNNNN}
+% \begin{macro}[EXP, int]{\@@_skip_c_zero:w}
+% \begin{macro}[EXP, aux]{\@@_skip_loop:wNNNNNNNN}
+% \begin{macro}[EXP, aux]{\@@_skip_end:w, \@@_skip_end_ii:NNNNNNNN}
% Removes |max(#1,0)| characters from the input stream, and then
% leaves \cs{c_zero}. This should be expanded using
% \cs{tex_romannumeral:D}. We remove characters $8$ at a time until
% there are at most $8$ to remove. Then we do a dirty trick: the
% \cs{if_case:w} construction leaves between $0$ and $8$ times the
% \cs{or:} control sequence, and those \cs{or:} become arguments of
-% \cs{str_skip_end_ii:NNNNNNNN}. If the number of characters to remove
+% \cs{@@_skip_end_ii:NNNNNNNN}. If the number of characters to remove
% is $6$, say, then there are two \cs{or:} left, and the $8$ arguments
-% of \cs{str_skip_end_ii:NNNNNNNN} are the two \cs{or:}, and $6$
+% of \cs{@@_skip_end_ii:NNNNNNNN} are the two \cs{or:}, and $6$
% characters from the input stream, exactly what we wanted to
% remove. Then close the \cs{if_case:w} conditional with \cs{fi:}, and
% stop the initial expansion with \cs{c_zero} (see places where
-% \cs{str_skip_c_zero:w} is called).
+% \cs{@@_skip_c_zero:w} is called).
% \begin{macrocode}
-\cs_new:Npn \str_skip_c_zero:w #1;
+\cs_new:Npn \@@_skip_c_zero:w #1;
{
- \if_num:w \int_eval:w #1 > \c_eight
- \exp_after:wN \str_skip_aux:wNNNNNNNN
+ \if_int_compare:w \__int_eval:w #1 > \c_eight
+ \exp_after:wN \@@_skip_loop:wNNNNNNNN
\else:
- \exp_after:wN \str_skip_end:w
- \int_use:N \int_eval:w
+ \exp_after:wN \@@_skip_end:w
+ \int_use:N \__int_eval:w
\fi:
#1 ;
}
-\cs_new:Npn \str_skip_aux:wNNNNNNNN #1; #2#3#4#5#6#7#8#9
- { \exp_after:wN \str_skip_c_zero:w \int_use:N \int_eval:w #1 - \c_eight ; }
-\cs_new:Npn \str_skip_end:w #1 ;
+\cs_new:Npn \@@_skip_loop:wNNNNNNNN #1; #2#3#4#5#6#7#8#9
+ { \exp_after:wN \@@_skip_c_zero:w \int_use:N \__int_eval:w #1 - \c_eight ; }
+\cs_new:Npn \@@_skip_end:w #1 ;
{
- \exp_after:wN \str_skip_end_ii:NNNNNNNN
- \if_case:w \if_num:w #1 > \c_zero #1 \else: 0 \fi: \exp_stop_f:
+ \exp_after:wN \@@_skip_end_ii:NNNNNNNN
+ \if_case:w \if_int_compare:w #1 > \c_zero #1 \else: 0 \fi: \exp_stop_f:
\or: \or: \or: \or: \or: \or: \or: \or:
}
-\cs_new:Npn \str_skip_end_ii:NNNNNNNN #1#2#3#4#5#6#7#8 { \fi: \c_zero }
+\cs_new:Npn \@@_skip_end_ii:NNNNNNNN #1#2#3#4#5#6#7#8 { \fi: \c_zero }
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[EXP,int]{\str_collect_delimit_by_q_stop:w}
-% \begin{macro}[EXP,aux]{\str_collect_aux:wn, \str_collect_aux:wnNNNNNNN}
+% \begin{macro}[EXP,int]{\@@_collect_delimit_by_q_stop:w}
+% \begin{macro}[EXP,aux]{\@@_collect_loop:wn, \@@_collect_loop_ii:wnNNNNNNN}
% \begin{macro}[EXP,aux]
-% {\str_collect_end:wn, \str_collect_end_ii:nnnnnnnnw} Collects
+% {\@@_collect_end:wn, \@@_collect_end_ii:nnnnnnnnw} Collects
% |max(#1,0)| characters, and removes everything else until
-% \cs{q_stop}. This is somewhat similar to \cs{str_skip_c_zero:w}, but
+% \cs{q_stop}. This is somewhat similar to \cs{@@_skip_c_zero:w}, but
% this time we can only grab $7$ characters at a time. At the end, we
% use an \cs{if_case:w} trick again, so that the $8$ first arguments
-% of \cs{str_collect_end_ii:nnnnnnnnw} are some \cs{or:}, followed by
-% an \cs{if:}, followed by |#1| characters from the input
+% of \cs{@@_collect_end_ii:nnnnnnnnw} are some \cs{or:}, followed by
+% an \cs{fi:}, followed by |#1| characters from the input
% stream. Simply leaving this in the input stream will close the
% conditional properly and the \cs{or:} disappear.
% \begin{macrocode}
-\cs_new:Npn \str_collect_delimit_by_q_stop:w #1;
+\cs_new:Npn \@@_collect_delimit_by_q_stop:w #1;
{
- \exp_after:wN \str_collect_aux:wn
- \int_use:N \int_eval:w #1 ;
+ \exp_after:wN \@@_collect_loop:wn
+ \int_use:N \__int_eval:w #1 ;
{ }
}
-\cs_new:Npn \str_collect_aux:wn #1 ;
+\cs_new:Npn \@@_collect_loop:wn #1 ;
{
- \if_num:w #1 > \c_seven
- \exp_after:wN \str_collect_aux:wnNNNNNNN
+ \if_int_compare:w #1 > \c_seven
+ \exp_after:wN \@@_collect_loop_ii:wnNNNNNNN
\else:
- \exp_after:wN \str_collect_end:wn
+ \exp_after:wN \@@_collect_end:wn
\fi:
#1 ;
}
-\cs_new:Npn \str_collect_aux:wnNNNNNNN #1; #2 #3#4#5#6#7#8#9
+\cs_new:Npn \@@_collect_loop_ii:wnNNNNNNN #1; #2 #3#4#5#6#7#8#9
{
- \exp_after:wN \str_collect_aux:wn
- \int_use:N \int_eval:w #1 - \c_seven ;
+ \exp_after:wN \@@_collect_loop:wn
+ \int_use:N \__int_eval:w #1 - \c_seven ;
{ #2 #3#4#5#6#7#8#9 }
}
-\cs_new:Npn \str_collect_end:wn #1 ;
+\cs_new:Npn \@@_collect_end:wn #1 ;
{
- \exp_after:wN \str_collect_end_ii:nnnnnnnnw
- \if_case:w \if_num:w #1 > \c_zero #1 \else: 0 \fi: \exp_stop_f:
+ \exp_after:wN \@@_collect_end_ii:nnnnnnnnw
+ \if_case:w \if_int_compare:w #1 > \c_zero #1 \else: 0 \fi: \exp_stop_f:
\or: \or: \or: \or: \or: \or: \fi:
}
-\cs_new:Npn \str_collect_end_ii:nnnnnnnnw #1#2#3#4#5#6#7#8 #9 \q_stop
+\cs_new:Npn \@@_collect_end_ii:nnnnnnnnw #1#2#3#4#5#6#7#8 #9 \q_stop
{ #1#2#3#4#5#6#7#8 }
% \end{macrocode}
% \end{macro}
@@ -1116,33 +1155,36 @@
% \begin{macro}[EXP]{\str_item:Nn}
% \begin{macro}[EXP]{\str_item:nn}
% \begin{macro}[EXP]{\str_item_ignore_spaces:nn}
-% \begin{macro}[EXP]{\str_item_unsafe:nn}
-% \begin{macro}[EXP,aux]{\str_item_aux:ww}
+% \begin{macro}[EXP]{\@@_item_unsafe:nn}
+% \begin{macro}[EXP,aux]{\@@_item:ww}
% This is mostly shuffling arguments around to avoid measuring the
% length of the string more than once, and make sure that the
-% parameters given to \cs{str_skip_c_zero:w} are necessarily within
+% parameters given to \cs{@@_skip_c_zero:w} are necessarily within
% the bounds of the length of the string. The \texttt{_ignore_spaces}
% function cheats a little bit in that it doesn't hand to
-% \cs{str_item_unsafe:nn} an \enquote{other string}. This is alright,
+% \cs{@@_item_unsafe:nn} an \enquote{other string}. This is alright,
% as everything else is done with undelimited arguments.
% \begin{macrocode}
\cs_new_nopar:Npn \str_item:Nn { \exp_args:No \str_item:nn }
-\cs_new:Npn \str_item:nn #1
+\cs_new:Npn \str_item:nn #1#2
{
- \exp_last_unbraced:Nf \token_to_str:N
- \exp_args:Nf \str_item_unsafe:nn { \tl_to_other_str:n {#1} }
+ \exp_args:Nf \tl_to_str:n
+ {
+ \exp_args:Nf \@@_item_unsafe:nn
+ { \@@_to_other:n {#1} } {#2}
+ }
}
\cs_new:Npn \str_item_ignore_spaces:nn #1
- { \exp_args:No \str_item_unsafe:nn { \tl_to_str:n {#1} } }
-\cs_new:Npn \str_item_unsafe:nn #1#2
+ { \exp_args:No \@@_item_unsafe:nn { \tl_to_str:n {#1} } }
+\cs_new:Npn \@@_item_unsafe:nn #1#2
{
- \exp_after:wN \str_item_aux:ww
- \int_use:N \int_eval:w #2 \exp_after:wN ;
- \int_value:w \str_length_unsafe:n {#1} ;
- #1
+ \exp_after:wN \@@_item:ww
+ \int_use:N \__int_eval:w #2 \exp_after:wN ;
+ \__int_value:w \@@_count_unsafe:n {#1} ;
+ { } #1
\q_stop
}
-\cs_new:Npn \str_item_aux:ww #1; #2;
+\cs_new:Npn \@@_item:ww #1; #2;
{
\int_compare:nNnTF {#1} < \c_zero
{
@@ -1150,16 +1192,16 @@
{ \use_none_delimit_by_q_stop:w }
{
\exp_after:wN \use_i_delimit_by_q_stop:nw
- \tex_romannumeral:D \str_skip_c_zero:w #1 + #2 ;
+ \tex_romannumeral:D \@@_skip_c_zero:w #1 + #2 + \c_one ;
}
}
{
- \int_compare:nNnTF {#1} < {#2}
+ \int_compare:nNnTF {#1} > {#2}
+ { \use_none_delimit_by_q_stop:w }
{
\exp_after:wN \use_i_delimit_by_q_stop:nw
- \tex_romannumeral:D \str_skip_c_zero:w #1 ;
+ \tex_romannumeral:D \@@_skip_c_zero:w #1 ;
}
- { \use_none_delimit_by_q_stop:w }
}
}
% \end{macrocode}
@@ -1174,21 +1216,14 @@
% \begin{macro}[EXP]{\str_substr_ignore_spaces:nnn}
% \begin{macro}[EXP,aux]
% {
-% \str_substr_unsafe:nnn,
-% \str_substr_aux:nN,
-% \str_substr_aux:www,
-% \str_substr_aux:nnw,
-% \str_substr_normalize_range:nn
+% \@@_substr_unsafe:nnn,
+% \@@_substr_i:nN,
+% \@@_substr_ii:www,
+% \@@_substr_iii:nnw,
+% \@@_substr_normalize_range:nn
% }
% Sanitize the string. Then evaluate the arguments, replacing them by
-% \cs{c_zero} or \cs{c_max_int} if they are empty. This is done by
-% using the construction
-% \begin{verbatim}
-% \int_use:N \int_eval:w #2 \c_zero \c_zero ;
-% \end{verbatim}
-% which expands to the value of |#2|, followed by |\c_zero \c_zero ;|
-% if |#2| is an expression, and expands to |0\c_zero ;| otherwise.
-% The same is done to the end-point of the range. Then limit the
+% \cs{c_zero} or \cs{c_max_int} if they are empty. Then limit the
% range to be at most the length of the string (this avoids needing to
% check for the end of the string when grabbing characters).
% Afterwards, skip characters, then keep some more, and finally drop
@@ -1199,51 +1234,51 @@
{
\exp_args:Nf \tl_to_str:n
{
- \exp_args:Nf \str_substr_unsafe:nnn
- { \tl_to_other_str:n {#1} } {#2} {#3}
+ \exp_args:Nf \@@_substr_unsafe:nnn
+ { \@@_to_other:n {#1} } {#2} {#3}
}
}
\cs_new:Npn \str_substr_ignore_spaces:nnn #1
- { \exp_args:No \str_substr_unsafe:nnn { \tl_to_str:n {#1} } }
-\cs_new:Npn \str_substr_unsafe:nnn #1#2#3
+ { \exp_args:No \@@_substr_unsafe:nnn { \tl_to_str:n {#1} } }
+\cs_new:Npn \@@_substr_unsafe:nnn #1#2#3
{
- \exp_after:wN \str_substr_aux:www
- \int_value:w \str_length_unsafe:n {#1} \exp_after:wN ;
- \int_use:N \int_eval:w #2 + \c_zero \exp_after:wN ;
- \int_use:N \int_eval:w
- \exp_args:Nf \str_substr_aux:nN {#3} \c_max_int ;
- #1
+ \exp_after:wN \@@_substr_ii:www
+ \__int_value:w \@@_count_unsafe:n {#1} \exp_after:wN ;
+ \int_use:N \__int_eval:w #2 + \c_zero \exp_after:wN ;
+ \int_use:N \__int_eval:w
+ \exp_args:Nf \@@_substr_i:nN {#3} \c_max_int ;
+ { } #1
\q_stop
}
-\cs_new:Npn \str_substr_aux:nN #1 #2
+\cs_new:Npn \@@_substr_i:nN #1 #2
{ \tl_if_empty:nTF {#1} {#2} {#1} }
-\cs_new:Npn \str_substr_aux:www #1; #2; #3;
+\cs_new:Npn \@@_substr_ii:www #1; #2; #3;
{
- \exp_args:Nf \str_substr_aux:nnw
- { \str_substr_normalize_range:nn {#2} {#1} }
- { \str_substr_normalize_range:nn {#3} {#1} }
+ \exp_args:Nf \@@_substr_iii:nnw
+ { \@@_substr_normalize_range:nn {#2} {#1} }
+ { \@@_substr_normalize_range:nn {#3} {#1} }
}
-\cs_new:Npn \str_substr_aux:nnw #1#2
+\cs_new:Npn \@@_substr_iii:nnw #1#2
{
- \exp_after:wN \str_collect_delimit_by_q_stop:w
- \int_use:N \int_eval:w #2 - #1 \exp_after:wN ;
- \tex_romannumeral:D \str_skip_c_zero:w #1 ;
+ \exp_after:wN \@@_collect_delimit_by_q_stop:w
+ \int_use:N \__int_eval:w #2 + \c_one - #1 \exp_after:wN ;
+ \tex_romannumeral:D \@@_skip_c_zero:w #1 ;
}
-\cs_new:Npn \str_substr_normalize_range:nn #1#2
+\cs_new:Npn \@@_substr_normalize_range:nn #1#2
{
\int_eval:n
{
- \if_num:w #1 < \c_zero
- \if_num:w #1 < - #2 \exp_stop_f:
+ \if_int_compare:w #1 < \c_zero
+ \if_int_compare:w #1 < - #2 \exp_stop_f:
\c_zero
\else:
- #1 + #2
+ #1 + #2 + \c_one
\fi:
\else:
- \if_num:w #1 < #2 \exp_stop_f:
- #1
- \else:
+ \if_int_compare:w #1 > #2 \exp_stop_f:
#2
+ \else:
+ #1
\fi:
\fi:
}
@@ -1257,9 +1292,8 @@
% \subsection{String conditionals}
%
% \begin{macro}[EXP,pTF]{\str_if_eq:NN}
-% \begin{macro}[EXP,pTF]{\str_if_eq:nn,\str_if_eq:xx}
-% The \texttt{nn} and \texttt{xx} variants are already defined in
-% \pkg{l3basics}. Note that \cs{str_if_eq:NN} is different from
+% \begin{macro}[EXP,pTF]{\str_if_eq:nn,\str_if_eq_x:nn}
+% Note that \cs{str_if_eq:NN} is different from
% \cs{tl_if_eq:NN} because it needs to ignore category codes.
% \begin{macrocode}
\prg_new_conditional:Npnn \str_if_eq:NN #1#2 { p , TF , T , F }
@@ -1271,52 +1305,73 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[EXP]{\str_if_contains_char:NNT, \str_if_contains_char:NNTF}
-% \begin{macro}[EXP]{\str_if_contains_char:nNTF}
-% \begin{macro}[EXP,aux]{\str_if_contains_char_aux:NN}
-% \begin{macro}[EXP,aux]{\str_if_contains_char_true:}
+% \begin{macro}{\str_case:nnn, \str_case:onn, \str_case_x:nnn}
+% Defined in \pkg{l3basics} at present.
+% \end{macro}
+%
+% \begin{macro}[EXP]{\@@_if_contains_char:NNT, \@@_if_contains_char:NNTF}
+% \begin{macro}[EXP]{\@@_if_contains_char:nNTF}
+% \begin{macro}[EXP,aux]{\@@_if_contains_char_aux:NN}
+% \begin{macro}[EXP,aux]{\@@_if_contains_char_true:}
+% \begin{syntax}
+% \cs{@@_if_contains_char:nNTF} \Arg{token list} \meta{char}
+% \end{syntax}
+% Converts the \meta{token list} to a \meta{string} and tests whether
+% the \meta{char} is present in the \meta{string}. Spaces are
+% ignored.
% Loop over the characters of the string, comparing character codes.
% The loop is broken if character codes match. Otherwise we return
% \enquote{false}.
% \begin{macrocode}
-\prg_new_conditional:Npnn \str_if_contains_char:NN #1#2 { T , TF }
+\prg_new_conditional:Npnn \@@_if_contains_char:NN #1#2 { T , TF }
{
- \exp_after:wN \str_if_contains_char_aux:NN \exp_after:wN #2
- \tl_to_str:n \exp_after:wN {#1} { \prg_map_break:n { ? \fi: } }
- \prg_break_point:n { }
+ \exp_after:wN \@@_if_contains_char_aux:NN \exp_after:wN #2
+ \etex_detokenize:D \exp_after:wN {#1} { \__prg_break:n { ? \fi: } }
+ \__prg_break_point:
\prg_return_false:
}
-\prg_new_conditional:Npnn \str_if_contains_char:nN #1#2 { TF }
+\prg_new_conditional:Npnn \@@_if_contains_char:nN #1#2 { TF }
{
- \exp_after:wN \str_if_contains_char_aux:NN \exp_after:wN #2
- \tl_to_str:n {#1} { \prg_map_break:n { ? \fi: } }
- \prg_break_point:n { }
+ \exp_after:wN \@@_if_contains_char_aux:NN \exp_after:wN #2
+ \tl_to_str:n {#1} { \__prg_break:n { ? \fi: } }
+ \__prg_break_point:
\prg_return_false:
}
-\cs_new:Npn \str_if_contains_char_aux:NN #1#2
+\cs_new:Npn \@@_if_contains_char_aux:NN #1#2
{
\if_charcode:w #1 #2
- \exp_after:wN \str_if_contains_char_true:
+ \exp_after:wN \@@_if_contains_char_true:
\fi:
- \str_if_contains_char_aux:NN #1
+ \@@_if_contains_char_aux:NN #1
}
-\cs_new_nopar:Npn \str_if_contains_char_true:
- { \prg_map_break:n { \prg_return_true: \use_none:n } }
+\cs_new_nopar:Npn \@@_if_contains_char_true:
+ { \__prg_break:n { \prg_return_true: \use_none:n } }
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[aux, rEXP]{\str_aux_octal_use:NTF}
+% \begin{macro}[aux, rEXP]{\@@_octal_use:NTF}
+% \begin{syntax}
+% \cs{@@_octal_use:NTF} \meta{token} \Arg{true code} \Arg{false code}
+% \end{syntax}
+% If the \meta{token} is an octal digit, it is left in the input
+% stream, \emph{followed} by the \meta{true code}. Otherwise, the
+% \meta{false code} is left in the input stream.
+% \begin{texnote}
+% This function will fail if the escape character is an octal
+% digit. We are thus careful to set the escape character to a known
+% value before using it.
+% \end{texnote}
% \TeX{} dutifully detects octal digits for us: if |#1| is an octal
% digit, then the right-hand side of the comparison is |'1#1|, greater
% than $1$. Otherwise, the right-hand side stops as |'1|, and the
% conditional takes the \texttt{false} branch.
% \begin{macrocode}
-\prg_new_conditional:Npnn \str_aux_octal_use:N #1 { TF }
+\prg_new_conditional:Npnn \@@_octal_use:N #1 { TF }
{
- \if_num:w \c_one < '1 \token_to_str:N #1 \exp_stop_f:
+ \if_int_compare:w \c_one < '1 \token_to_str:N #1 \exp_stop_f:
#1 \prg_return_true:
\else:
\prg_return_false:
@@ -1325,19 +1380,19 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux, rEXP]{\str_aux_hexadecimal_use:NTF}
+% \begin{macro}[aux, rEXP]{\@@_hexadecimal_use:NTF}
% \TeX{} detects uppercase hexadecimal digits for us (see
-% \cs{str_aux_octal_use:NTF}), but not the lowercase letters, which we
+% \cs{@@_octal_use:NTF}), but not the lowercase letters, which we
% need to detect and replace by their uppercase counterpart.
% \begin{macrocode}
-\prg_new_conditional:Npnn \str_aux_hexadecimal_use:N #1 { TF }
+\prg_new_conditional:Npnn \@@_hexadecimal_use:N #1 { TF }
{
- \if_num:w \c_two < "1 \token_to_str:N #1 \exp_stop_f:
+ \if_int_compare:w \c_two < "1 \token_to_str:N #1 \exp_stop_f:
#1 \prg_return_true:
\else:
- \if_case:w \int_eval:w
+ \if_case:w \__int_eval:w
\exp_after:wN ` \token_to_str:N #1 - `a
- \int_eval_end:
+ \__int_eval_end:
A
\or: B
\or: C
@@ -1369,8 +1424,8 @@
%
% \subsubsection{Producing one byte or character}
%
-% \begin{variable}{\c_str_byte_0_tl, \c_str_byte_1_tl, \c_str_byte_255_tl}
-% \begin{variable}{\c_str_byte_-1_tl}
+% \begin{variable}{\c_@@_byte_0_tl, \c_@@_byte_1_tl, \c_@@_byte_255_tl}
+% \begin{variable}{\c_@@_byte_-1_tl}
% For each integer $N$ in the range $[0,255]$, we create a constant
% token list which holds three character tokens with category code
% other: the character with character code $N$, followed by the
@@ -1380,59 +1435,59 @@
% \begin{macrocode}
\group_begin:
\char_set_catcode_other:n { \c_zero }
- \tl_set:Nx \l_str_internal_tl { \tl_to_str:n { 0123456789ABCDEF } }
- \exp_args:No \tl_map_inline:nn { \l_str_internal_tl " }
+ \tl_set:Nx \l_@@_internal_tl { \tl_to_str:n { 0123456789ABCDEF } }
+ \exp_args:No \tl_map_inline:nn { \l_@@_internal_tl " }
{ \char_set_lccode:nn {`#1} { \c_zero } }
- \tl_map_inline:Nn \l_str_internal_tl
+ \tl_map_inline:Nn \l_@@_internal_tl
{
- \tl_map_inline:Nn \l_str_internal_tl
+ \tl_map_inline:Nn \l_@@_internal_tl
{
\char_set_lccode:nn { \c_zero } {"#1##1}
\tl_to_lowercase:n
{
\tl_const:cx
- { c_str_byte_ \int_eval:n {"#1##1} _tl }
+ { c_@@_byte_ \int_eval:n {"#1##1} _tl }
{ ^^@ #1 ##1 }
}
}
}
\group_end:
-\tl_const:cn { c_str_byte_-1_tl } { { } \use_none:n { } }
+\tl_const:cn { c_@@_byte_-1_tl } { { } \use_none:n { } }
% \end{macrocode}
% \end{variable}
% \end{variable}
%
-% \begin{macro}[int, EXP]{\str_output_byte:n}
-% \begin{macro}[int, EXP]{\str_output_byte:w}
-% \begin{macro}[int, EXP]{\str_output_hexadecimal:n}
-% \begin{macro}[int, EXP]{\str_output_hexadecimal:w}
-% \begin{macro}[int, EXP]{\str_output_end:}
+% \begin{macro}[int, EXP]{\@@_output_byte:n}
+% \begin{macro}[int, EXP]{\@@_output_byte:w}
+% \begin{macro}[int, EXP]{\@@_output_hexadecimal:n}
+% \begin{macro}[int, EXP]{\@@_output_hexadecimal:w}
+% \begin{macro}[int, EXP]{\@@_output_end:}
% Those functions must be used carefully: feeding them a value outside
% the range $[-1,255]$ will attempt to use the undefined token list
-% variable \cs{c_str_byte_\meta{number}_tl}. Assuming that the
+% variable \cs{c_@@_byte_\meta{number}_tl}. Assuming that the
% argument is in the right range, we expand the corresponding token
% list, and pick either the byte (first token) or the hexadecimal
% representations (second and third tokens). The value $-1$ produces
% an empty result in both cases.
% \begin{macrocode}
-\cs_new:Npn \str_output_byte:n #1
- { \str_output_byte:w #1 \str_output_end: }
-\cs_new_nopar:Npn \str_output_byte:w
+\cs_new:Npn \@@_output_byte:n #1
+ { \@@_output_byte:w #1 \@@_output_end: }
+\cs_new_nopar:Npn \@@_output_byte:w
{
\exp_after:wN \exp_after:wN
\exp_after:wN \use_i:nnn
- \cs:w c_str_byte_ \int_use:N \int_eval:w
+ \cs:w c_@@_byte_ \int_use:N \__int_eval:w
}
-\cs_new:Npn \str_output_hexadecimal:n #1
- { \str_output_hexadecimal:w #1 \str_output_end: }
-\cs_new_nopar:Npn \str_output_hexadecimal:w
+\cs_new:Npn \@@_output_hexadecimal:n #1
+ { \@@_output_hexadecimal:w #1 \@@_output_end: }
+\cs_new_nopar:Npn \@@_output_hexadecimal:w
{
\exp_after:wN \exp_after:wN
\exp_after:wN \use_none:n
- \cs:w c_str_byte_ \int_use:N \int_eval:w
+ \cs:w c_@@_byte_ \int_use:N \__int_eval:w
}
-\cs_new_nopar:Npn \str_output_end:
- { \int_eval_end: _tl \cs_end: }
+\cs_new_nopar:Npn \@@_output_end:
+ { \__int_eval_end: _tl \cs_end: }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1440,27 +1495,27 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int, rEXP]{\str_output_byte_pair_be:n}
-% \begin{macro}[int, rEXP]{\str_output_byte_pair_le:n}
-% \begin{macro}[aux, rEXP]{\str_output_byte_pair_aux:nnN}
+% \begin{macro}[int, rEXP]{\@@_output_byte_pair_be:n}
+% \begin{macro}[int, rEXP]{\@@_output_byte_pair_le:n}
+% \begin{macro}[aux, rEXP]{\@@_output_byte_pair:nnN}
% Convert a number in the range $[0,65535]$ to a pair of bytes, either
% big-endian or little-endian.
% \begin{macrocode}
-\cs_new:Npn \str_output_byte_pair_be:n #1
+\cs_new:Npn \@@_output_byte_pair_be:n #1
{
- \exp_args:Nf \str_output_byte_pair_aux:nnN
+ \exp_args:Nf \@@_output_byte_pair:nnN
{ \int_div_truncate:nn { #1 } { "100 } } {#1} \use:nn
}
-\cs_new:Npn \str_output_byte_pair_le:n #1
+\cs_new:Npn \@@_output_byte_pair_le:n #1
{
- \exp_args:Nf \str_output_byte_pair_aux:nnN
+ \exp_args:Nf \@@_output_byte_pair:nnN
{ \int_div_truncate:nn { #1 } { "100 } } {#1} \use_ii_i:nn
}
-\cs_new:Npn \str_output_byte_pair_aux:nnN #1#2#3
+\cs_new:Npn \@@_output_byte_pair:nnN #1#2#3
{
#3
- { \str_output_byte:n { #1 } }
- { \str_output_byte:n { #2 - #1 * "100 } }
+ { \@@_output_byte:n { #1 } }
+ { \@@_output_byte:n { #2 - #1 * "100 } }
}
% \end{macrocode}
% \end{macro}
@@ -1469,52 +1524,52 @@
%
% \subsubsection{Mapping functions for conversions}
%
-% \begin{macro}{\str_convert_gmap:N}
-% \begin{macro}[aux, rEXP]{\str_convert_gmap_loop:NN}
+% \begin{macro}{\@@_convert_gmap:N}
+% \begin{macro}[aux, rEXP]{\@@_convert_gmap_loop:NN}
% This maps the function |#1| over all characters in
-% \cs{g_str_result_tl}, which should be a byte string in most cases,
+% \cs{g_@@_result_tl}, which should be a byte string in most cases,
% sometimes a native string.
% \begin{macrocode}
-\cs_new_protected:Npn \str_convert_gmap:N #1
+\cs_new_protected:Npn \@@_convert_gmap:N #1
{
- \tl_gset:Nx \g_str_result_tl
+ \tl_gset:Nx \g_@@_result_tl
{
- \exp_after:wN \str_convert_gmap_loop:NN
+ \exp_after:wN \@@_convert_gmap_loop:NN
\exp_after:wN #1
- \g_str_result_tl { ? \prg_map_break: }
- \prg_break_point:n { }
+ \g_@@_result_tl { ? \__prg_break: }
+ \__prg_break_point:
}
}
-\cs_new:Npn \str_convert_gmap_loop:NN #1#2
+\cs_new:Npn \@@_convert_gmap_loop:NN #1#2
{
\use_none:n #2
#1#2
- \str_convert_gmap_loop:NN #1
+ \@@_convert_gmap_loop:NN #1
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\str_convert_gmap_internal:N}
-% \begin{macro}[aux, rEXP]{\str_convert_gmap_internal_loop:Nw}
+% \begin{macro}{\@@_convert_gmap_internal:N}
+% \begin{macro}[aux, rEXP]{\@@_convert_gmap_internal_loop:Nw}
% This maps the function |#1| over all character codes in
-% \cs{g_str_result_tl}, which must be in the internal representation.
+% \cs{g_@@_result_tl}, which must be in the internal representation.
% \begin{macrocode}
-\cs_new_protected:Npn \str_convert_gmap_internal:N #1
+\cs_new_protected:Npn \@@_convert_gmap_internal:N #1
{
- \tl_gset:Nx \g_str_result_tl
+ \tl_gset:Nx \g_@@_result_tl
{
- \exp_after:wN \str_convert_gmap_internal_loop:Nww
+ \exp_after:wN \@@_convert_gmap_internal_loop:Nww
\exp_after:wN #1
- \g_str_result_tl \s_tl \q_stop \prg_map_break: \s_tl
- \prg_break_point:n { }
+ \g_@@_result_tl \s__tl \q_stop \__prg_break: \s__tl
+ \__prg_break_point:
}
}
-\cs_new:Npn \str_convert_gmap_internal_loop:Nww #1 #2 \s_tl #3 \s_tl
+\cs_new:Npn \@@_convert_gmap_internal_loop:Nww #1 #2 \s__tl #3 \s__tl
{
\use_none_delimit_by_q_stop:w #3 \q_stop
#1 {#3}
- \str_convert_gmap_internal_loop:Nww #1
+ \@@_convert_gmap_internal_loop:Nww #1
}
% \end{macrocode}
% \end{macro}
@@ -1522,38 +1577,38 @@
%
% \subsubsection{Error-reporting during conversion}
%
-% \begin{macro}[int]{\str_if_flag_error:nnx}
-% \begin{macro}[aux]{\str_if_flag_no_error:nnx}
+% \begin{macro}[int]{\@@_if_flag_error:nnx}
+% \begin{macro}[aux]{\@@_if_flag_no_error:nnx}
% When converting using the function \cs{str_set_convert:Nnnn}, errors
% should be reported to the user after each step in the
% conversion. Errors are signalled by raising some flag (typically
-% \texttt{str_error}), so here we test that flag: if it is raised,
+% \texttt{@@_error}), so here we test that flag: if it is raised,
% give the user an error, otherwise remove the arguments. On the other
% hand, in the conditional functions \cs{str_set_convert:NnnnTF},
% errors should be suppressed. This is done by changing
-% \cs{str_if_flag_error:nnx} into \cs{str_if_flag_no_error:nnx}
+% \cs{@@_if_flag_error:nnx} into \cs{@@_if_flag_no_error:nnx}
% locally.
% \begin{macrocode}
-\cs_new_protected:Npn \str_if_flag_error:nnx #1
+\cs_new_protected:Npn \@@_if_flag_error:nnx #1
{
\flag_if_raised:nTF {#1}
- { \msg_kernel_error:nnx { str } }
+ { \__msg_kernel_error:nnx { str } }
{ \use_none:nn }
}
-\cs_new_protected:Npn \str_if_flag_no_error:nnx #1#2#3
- { \flag_if_raised:nT {#1} { \bool_gset_true:N \g_str_error_bool } }
+\cs_new_protected:Npn \@@_if_flag_no_error:nnx #1#2#3
+ { \flag_if_raised:nT {#1} { \bool_gset_true:N \g_@@_error_bool } }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\str_if_flag_times:nT}
+% \begin{macro}[int]{\@@_if_flag_times:nT}
% At the end of each conversion step, we raise all relevant errors as
% one error message, built on the fly. The height of each flag
% indicates how many times a given error was encountered. This
% function prints |#2| followed by the number of occurrences of an
% error if it occurred, nothing otherwise.
% \begin{macrocode}
-\cs_new_protected:Npn \str_if_flag_times:nT #1#2
+\cs_new_protected:Npn \@@_if_flag_times:nT #1#2
{ \flag_if_raised:nT {#1} { #2~(x \flag_height:n {#1} ) } }
% \end{macrocode}
% \end{macro}
@@ -1575,7 +1630,7 @@
% to a list of Unicode characters in an internal representation,
% with items of the form
% \begin{quote}
-% \meta{bytes} \cs{s_tl} \meta{Unicode code point} \cs{s_tl}
+% \meta{bytes} \cs{s__tl} \meta{Unicode code point} \cs{s__tl}
% \end{quote}
% where we have collected the \meta{bytes} which combined to form
% this particular Unicode character, and the \meta{Unicode code
@@ -1593,63 +1648,63 @@
%
% \begin{macro}{\str_set_convert:Nnnn, \str_gset_convert:Nnnn}
% \begin{macro}[TF]{\str_set_convert:Nnnn, \str_gset_convert:Nnnn}
-% \begin{macro}[aux]{\str_convert_aux_i:nNNnnn}
-% The input string is stored in \cs{g_str_result_tl}, then we:
+% \begin{macro}[aux]{\@@_convert_i:nNNnnn}
+% The input string is stored in \cs{g_@@_result_tl}, then we:
% unescape and decode; encode and escape; exit the group and store the
% result in the user's variable. The various conversion functions all
-% act on \cs{g_str_result_tl}. Errors are silenced for the conditional
-% functions by redefining \cs{str_if_flag_error:nnx} locally.
+% act on \cs{g_@@_result_tl}. Errors are silenced for the conditional
+% functions by redefining \cs{@@_if_flag_error:nnx} locally.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \str_set_convert:Nnnn
- { \str_convert_aux_i:nNNnnn { } \tl_set_eq:NN }
+ { \@@_convert_i:nNNnnn { } \tl_set_eq:NN }
\cs_new_protected_nopar:Npn \str_gset_convert:Nnnn
- { \str_convert_aux_i:nNNnnn { } \tl_gset_eq:NN }
+ { \@@_convert_i:nNNnnn { } \tl_gset_eq:NN }
\prg_new_protected_conditional:Npnn
\str_set_convert:Nnnn #1#2#3#4 { T , F , TF }
{
- \bool_gset_false:N \g_str_error_bool
- \str_convert_aux_i:nNNnnn
- { \cs_set_eq:NN \str_if_flag_error:nnx \str_if_flag_no_error:nnx }
+ \bool_gset_false:N \g_@@_error_bool
+ \@@_convert_i:nNNnnn
+ { \cs_set_eq:NN \@@_if_flag_error:nnx \@@_if_flag_no_error:nnx }
\tl_set_eq:NN #1 {#2} {#3} {#4}
- \bool_if:NTF \g_str_error_bool \prg_return_false: \prg_return_true:
+ \bool_if:NTF \g_@@_error_bool \prg_return_false: \prg_return_true:
}
\prg_new_protected_conditional:Npnn
\str_gset_convert:Nnnn #1#2#3#4 { T , F , TF }
{
- \bool_gset_false:N \g_str_error_bool
- \str_convert_aux_i:nNNnnn
- { \cs_set_eq:NN \str_if_flag_error:nnx \str_if_flag_no_error:nnx }
+ \bool_gset_false:N \g_@@_error_bool
+ \@@_convert_i:nNNnnn
+ { \cs_set_eq:NN \@@_if_flag_error:nnx \@@_if_flag_no_error:nnx }
\tl_gset_eq:NN #1 {#2} {#3} {#4}
- \bool_if:NTF \g_str_error_bool \prg_return_false: \prg_return_true:
+ \bool_if:NTF \g_@@_error_bool \prg_return_false: \prg_return_true:
}
-\cs_new_protected:Npn \str_convert_aux_i:nNNnnn #1#2#3#4#5#6
+\cs_new_protected:Npn \@@_convert_i:nNNnnn #1#2#3#4#5#6
{
\group_begin:
#1
- \str_gset_other:Nn \g_str_result_tl {#4}
- \exp_after:wN \str_convert_aux_ii:wwwnn
+ \@@_gset_other:Nn \g_@@_result_tl {#4}
+ \exp_after:wN \@@_convert_ii:wwwnn
\tl_to_str:n {#5} /// \q_stop
{ decode } { unescape }
\prg_do_nothing:
- \str_convert_decode_:
- \exp_after:wN \str_convert_aux_ii:wwwnn
+ \@@_convert_decode_:
+ \exp_after:wN \@@_convert_ii:wwwnn
\tl_to_str:n {#6} /// \q_stop
{ encode } { escape }
\use_ii_i:nn
- \str_convert_encode_:
+ \@@_convert_encode_:
\group_end:
- #2 #3 \g_str_result_tl
+ #2 #3 \g_@@_result_tl
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[aux]{\str_convert_aux_ii:wwwnn}
-% \begin{macro}[aux]{\str_convert_aux_iii:NNnNN}
-% The task of \cs{str_convert_aux_ii:wwwnn} is to split
+% \begin{macro}[aux]{\@@_convert_ii:wwwnn}
+% \begin{macro}[aux]{\@@_convert_iii:NNnNN}
+% The task of \cs{@@_convert_ii:wwwnn} is to split
% \meta{encoding}/\meta{escaping} pairs into their components, |#1|
-% and |#2|. Calls to \cs{str_convert_aux_iv:nnn} ensure that the
+% and |#2|. Calls to \cs{@@_convert_iv:nnn} ensure that the
% corresponding conversion functions are defined. The third auxiliary
% does the main work.
% \begin{itemize}
@@ -1669,19 +1724,19 @@
% (native), then the escaping should be ignored, with an error if any
% was given, and only the encoding, |#1|, should be performed.
% \begin{macrocode}
-\cs_new_protected:Npn \str_convert_aux_ii:wwwnn
+\cs_new_protected:Npn \@@_convert_ii:wwwnn
#1 / #2 // #3 \q_stop #4#5
{
- \str_convert_aux_iv:nnn {enc} {#4} {#1}
- \str_convert_aux_iv:nnn {esc} {#5} {#2}
- \exp_args:Ncc \str_convert_aux_iii:NNnNN
- { str_convert_#4_#1: } { str_convert_#5_#2: } {#2}
+ \@@_convert_iv:nnn {enc} {#4} {#1}
+ \@@_convert_iv:nnn {esc} {#5} {#2}
+ \exp_args:Ncc \@@_convert_iii:NNnNN
+ { @@_convert_#4_#1: } { @@_convert_#5_#2: } {#2}
}
-\cs_new_protected:Npn \str_convert_aux_iii:NNnNN #1#2#3#4#5
+\cs_new_protected:Npn \@@_convert_iii:NNnNN #1#2#3#4#5
{
\if_meaning:w #1 #5
\tl_if_empty:nF {#3}
- { \msg_kernel_error:nnx { str } { native-escaping } {#3} }
+ { \__msg_kernel_error:nnx { str } { native-escaping } {#3} }
#1
\else:
#4 #2 #1
@@ -1691,15 +1746,15 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[aux]{\str_convert_aux_iv:nnn}
-% \begin{macro}[aux]{\str_convert_aux_v:nnnn}
-% The arguments of \cs{str_convert_aux_iv:nnn} are: \texttt{enc} or
+% \begin{macro}[aux]{\@@_convert_iv:nnn}
+% \begin{macro}[aux]{\@@_convert_v:nnnn}
+% The arguments of \cs{@@_convert_iv:nnn} are: \texttt{enc} or
% \texttt{esc}, used to build filenames, the type of the conversion
% (unescape, decode, encode, escape), and the encoding or escaping
% name. If the function is already defined, no need to do anything.
% Otherwise, filter out all non-alphanumerics in the name, and
% lowercase it. Feed that, and the same three arguments, to
-% \cs{str_convert_aux_v:nnnn}. The task is then to make sure that the
+% \cs{@@_convert_v:nnnn}. The task is then to make sure that the
% conversion function |#3_#1| corresponding to the type |#3| and
% filtered name |#1| is defined, then set our initial conversion
% function |#3_#4| equal to that.
@@ -1707,10 +1762,10 @@
% How do we get the |#3_#1| conversion to be defined if it isn't?
% Two main cases.
%
-% First, if |#1| is a key in \cs{g_str_file_prop}, then the value
-% \cs{l_str_internal_tl} tells us what file to load. Loading is
+% First, if |#1| is a key in \cs{g_@@_alias_prop}, then the value
+% \cs{l_@@_internal_tl} tells us what file to load. Loading is
% skipped if the file was already read, \emph{i.e.}, if the conversion
-% command based on \cs{l_str_internal_tl} already exists. Otherwise,
+% command based on \cs{l_@@_internal_tl} already exists. Otherwise,
% try to load the file; if that fails, there is an error, use the
% default empty name instead.
%
@@ -1720,96 +1775,96 @@
% third-party \texttt{.def} files). If the file is not found, there is
% an error, use the default empty name instead.
%
-% In all cases, the conversion based on \cs{l_str_internal_tl} is
+% In all cases, the conversion based on \cs{l_@@_internal_tl} is
% defined, so we can set the |#3_#1| function equal to that. In some
% cases (\emph{e.g.}, \texttt{utf16be}), the |#3_#1| function is
% actually defined within the file we just loaded, and it is different
-% from the \cs{l_str_internal_tl}-based function: we mustn't clobber
+% from the \cs{l_@@_internal_tl}-based function: we mustn't clobber
% that different definition.
% \begin{macrocode}
-\cs_new_protected:Npn \str_convert_aux_iv:nnn #1#2#3
+\cs_new_protected:Npn \@@_convert_iv:nnn #1#2#3
{
- \cs_if_exist:cF { str_convert_#2_#3: }
+ \cs_if_exist:cF { @@_convert_#2_#3: }
{
- \exp_args:Nx \str_convert_aux_v:nnnn
- { \str_convert_lowercase_alphanum:n {#3} }
+ \exp_args:Nx \@@_convert_v:nnnn
+ { \@@_convert_lowercase_alphanum:n {#3} }
{#1} {#2} {#3}
}
}
-\cs_new_protected:Npn \str_convert_aux_v:nnnn #1#2#3#4
+\cs_new_protected:Npn \@@_convert_v:nnnn #1#2#3#4
{
- \cs_if_exist:cF { str_convert_#3_#1: }
+ \cs_if_exist:cF { @@_convert_#3_#1: }
{
- \prop_get:NnNF \g_str_file_prop {#1} \l_str_internal_tl
- { \tl_set:Nn \l_str_internal_tl {#1} }
- \cs_if_exist:cF { str_convert_#3_ \l_str_internal_tl : }
+ \prop_get:NnNF \g_@@_alias_prop {#1} \l_@@_internal_tl
+ { \tl_set:Nn \l_@@_internal_tl {#1} }
+ \cs_if_exist:cF { @@_convert_#3_ \l_@@_internal_tl : }
{
- \file_if_exist:nTF { l3str-#2- \l_str_internal_tl .def }
+ \file_if_exist:nTF { l3str-#2- \l_@@_internal_tl .def }
{
\group_begin:
- \str_load_catcodes:
- \file_input:n { l3str-#2- \l_str_internal_tl .def }
+ \@@_load_catcodes:
+ \file_input:n { l3str-#2- \l_@@_internal_tl .def }
\group_end:
}
{
- \tl_clear:N \l_str_internal_tl
- \msg_kernel_error:nnxx { str } { unknown-#2 } {#4} {#1}
+ \tl_clear:N \l_@@_internal_tl
+ \__msg_kernel_error:nnxx { str } { unknown-#2 } {#4} {#1}
}
}
- \cs_if_exist:cF { str_convert_#3_#1: }
+ \cs_if_exist:cF { @@_convert_#3_#1: }
{
- \cs_gset_eq:cc { str_convert_#3_#1: }
- { str_convert_#3_ \l_str_internal_tl : }
+ \cs_gset_eq:cc { @@_convert_#3_#1: }
+ { @@_convert_#3_ \l_@@_internal_tl : }
}
}
- \cs_gset_eq:cc { str_convert_#3_#4: } { str_convert_#3_#1: }
+ \cs_gset_eq:cc { @@_convert_#3_#4: } { @@_convert_#3_#1: }
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int, rEXP]{\str_convert_lowercase_alphanum:n}
-% \begin{macro}[aux, rEXP]{\str_convert_lowercase_alphanum_loop:N}
+% \begin{macro}[int, rEXP]{\@@_convert_lowercase_alphanum:n}
+% \begin{macro}[aux, rEXP]{\@@_convert_lowercase_alphanum_loop:N}
% This function keeps only letters and digits, with upper case letters
% converted to lower case.
% \begin{macrocode}
-\cs_new:Npn \str_convert_lowercase_alphanum:n #1
+\cs_new:Npn \@@_convert_lowercase_alphanum:n #1
{
- \exp_after:wN \str_convert_lowercase_alphanum_loop:N
- \tl_to_str:n {#1} { ? \prg_map_break: }
- \prg_break_point:n { }
+ \exp_after:wN \@@_convert_lowercase_alphanum_loop:N
+ \tl_to_str:n {#1} { ? \__prg_break: }
+ \__prg_break_point:
}
-\cs_new:Npn \str_convert_lowercase_alphanum_loop:N #1
+\cs_new:Npn \@@_convert_lowercase_alphanum_loop:N #1
{
\use_none:n #1
- \if_num:w `#1 < \c_ninety_one
- \if_num:w `#1 < \c_sixty_five
- \if_num:w \c_one < 1#1 \exp_stop_f:
+ \if_int_compare:w `#1 < \c_ninety_one
+ \if_int_compare:w `#1 < \c_sixty_five
+ \if_int_compare:w \c_one < 1#1 \exp_stop_f:
#1
\fi:
\else:
- \str_output_byte:n { `#1 + \c_thirty_two }
+ \@@_output_byte:n { `#1 + \c_thirty_two }
\fi:
\else:
- \if_num:w `#1 < \c_one_hundred_twenty_three
- \if_num:w `#1 < \c_ninety_seven
+ \if_int_compare:w `#1 < \c_one_hundred_twenty_three
+ \if_int_compare:w `#1 < \c_ninety_seven
\else:
#1
\fi:
\fi:
\fi:
- \str_convert_lowercase_alphanum_loop:N
+ \@@_convert_lowercase_alphanum_loop:N
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\str_load_catcodes:}
+% \begin{macro}[int]{\@@_load_catcodes:}
% Since encoding files may be loaded at arbitrary places in a \TeX{}
% document, including within verbatim mode, we set the catcodes of all
% characters appearing in any encoding definition file.
% \begin{macrocode}
-\cs_new_protected:Npn \str_load_catcodes:
+\cs_new_protected:Npn \@@_load_catcodes:
{
\char_set_catcode_escape:N \\
\char_set_catcode_group_begin:N \{
@@ -1837,84 +1892,84 @@
% needed. By default, on input any non-byte is filtered out, while the
% output simply consists in letting bytes through.
%
-% \begin{macro}[int, rEXP]{\str_filter_bytes:n}
-% \begin{macro}[aux, rEXP]{\str_filter_bytes_aux:N}
+% \begin{macro}[int, rEXP]{\@@_filter_bytes:n}
+% \begin{macro}[aux, rEXP]{\@@_filter_bytes_aux:N}
% In the case of pdf\TeX{}, every character is a byte. For
% Unicode-aware engines, test the character code; non-bytes cause us
% to raise the flag \texttt{str_byte}. Spaces have already been given
% the correct category code when this function is called.
% \begin{macrocode}
\pdftex_if_engine:TF
- { \cs_new_eq:NN \str_filter_bytes:n \use:n }
+ { \cs_new_eq:NN \@@_filter_bytes:n \use:n }
{
- \cs_new:Npn \str_filter_bytes:n #1
+ \cs_new:Npn \@@_filter_bytes:n #1
{
- \str_filter_bytes_aux:N #1
- { ? \prg_map_break: }
- \prg_break_point:n { }
+ \@@_filter_bytes_aux:N #1
+ { ? \__prg_break: }
+ \__prg_break_point:
}
- \cs_new:Npn \str_filter_bytes_aux:N #1
+ \cs_new:Npn \@@_filter_bytes_aux:N #1
{
\use_none:n #1
- \if_num:w `#1 < 256 \exp_stop_f:
+ \if_int_compare:w `#1 < 256 \exp_stop_f:
#1
\else:
\flag_raise:n { str_byte }
\fi:
- \str_filter_bytes_aux:N
+ \@@_filter_bytes_aux:N
}
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\str_convert_unescape_:}
-% \begin{macro}[int]{\str_convert_unescape_bytes:}
+% \begin{macro}[int]{\@@_convert_unescape_:}
+% \begin{macro}[int]{\@@_convert_unescape_bytes:}
% The simplest unescaping method removes non-bytes from
-% \cs{g_str_result_tl}.
+% \cs{g_@@_result_tl}.
% \begin{macrocode}
\pdftex_if_engine:TF
- { \cs_new_protected_nopar:Npn \str_convert_unescape_: { } }
+ { \cs_new_protected_nopar:Npn \@@_convert_unescape_: { } }
{
- \cs_new_protected_nopar:Npn \str_convert_unescape_:
+ \cs_new_protected_nopar:Npn \@@_convert_unescape_:
{
\flag_clear:n { str_byte }
- \tl_gset:Nx \g_str_result_tl
- { \exp_args:No \str_filter_bytes:n \g_str_result_tl }
- \str_if_flag_error:nnx { str_byte } { non-byte } { bytes }
+ \tl_gset:Nx \g_@@_result_tl
+ { \exp_args:No \@@_filter_bytes:n \g_@@_result_tl }
+ \@@_if_flag_error:nnx { str_byte } { non-byte } { bytes }
}
}
-\cs_new_eq:NN \str_convert_unescape_bytes: \str_convert_unescape_:
+\cs_new_eq:NN \@@_convert_unescape_bytes: \@@_convert_unescape_:
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\str_convert_escape_:}
-% \begin{macro}[int]{\str_convert_escape_bytes:}
+% \begin{macro}[int]{\@@_convert_escape_:}
+% \begin{macro}[int]{\@@_convert_escape_bytes:}
% The simplest form of escape leaves the bytes from the previous step
% of the conversion unchanged.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \str_convert_escape_: { }
-\cs_new_eq:NN \str_convert_escape_bytes: \str_convert_escape_:
+\cs_new_protected_nopar:Npn \@@_convert_escape_: { }
+\cs_new_eq:NN \@@_convert_escape_bytes: \@@_convert_escape_:
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsubsection{Native strings}
%
-% \begin{macro}[int]{\str_convert_decode_:}
-% \begin{macro}[aux, rEXP]{\str_decode_native_char:N}
+% \begin{macro}[int]{\@@_convert_decode_:}
+% \begin{macro}[aux, rEXP]{\@@_decode_native_char:N}
% Convert each character to its character code, one at a time.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \str_convert_decode_:
- { \str_convert_gmap:N \str_decode_native_char:N }
-\cs_new:Npn \str_decode_native_char:N #1
- { #1 \s_tl \int_value:w `#1 \s_tl }
+\cs_new_protected_nopar:Npn \@@_convert_decode_:
+ { \@@_convert_gmap:N \@@_decode_native_char:N }
+\cs_new:Npn \@@_decode_native_char:N #1
+ { #1 \s__tl \__int_value:w `#1 \s__tl }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\str_convert_encode_:}
+% \begin{macro}[int]{\@@_convert_encode_:}
% The conversion from an internal string to native character tokens is
% very different in pdf\TeX{} and in other engines. For Unicode-aware
% engines, we need the definitions to be read when the null byte has
@@ -1924,7 +1979,7 @@
\char_set_catcode_other:n { 0 }
\pdftex_if_engine:TF
% \end{macrocode}
-% \begin{macro}[aux, EXP]{\str_encode_native_char:n}
+% \begin{macro}[aux, EXP]{\@@_encode_native_char:n}
% Since pdf\TeX{} only supports 8-bit characters, and we have a table
% of all bytes, the conversion can be done in linear time within an
% \texttt{x}-expanding assignment. Look out for character codes larger
@@ -1932,23 +1987,23 @@
% which then triggers a pdf\TeX{}-specific error.
% \begin{macrocode}
{
- \cs_new_protected_nopar:Npn \str_convert_encode_:
+ \cs_new_protected_nopar:Npn \@@_convert_encode_:
{
\flag_clear:n { str_error }
- \str_convert_gmap_internal:N \str_encode_native_char:n
- \str_if_flag_error:nnx { str_error }
+ \@@_convert_gmap_internal:N \@@_encode_native_char:n
+ \@@_if_flag_error:nnx { str_error }
{ pdfTeX-native-overflow } { }
}
- \cs_new:Npn \str_encode_native_char:n #1
+ \cs_new:Npn \@@_encode_native_char:n #1
{
- \if_num:w #1 < \c_two_hundred_fifty_six
- \str_output_byte:n {#1}
+ \if_int_compare:w #1 < \c_two_hundred_fifty_six
+ \@@_output_byte:n {#1}
\else:
\flag_raise:n { str_error }
?
\fi:
}
- \msg_kernel_new:nnnn { str } { pdfTeX-native-overflow }
+ \__msg_kernel_new:nnnn { str } { pdfTeX-native-overflow }
{ Character~code~too~large~for~pdfTeX. }
{
The~pdfTeX~engine~only~supports~8-bit~characters:~
@@ -1958,9 +2013,9 @@
}
% \end{macrocode}
% \end{macro}
-% \begin{macro}[aux]{\str_encode_native_loop:w}
-% \begin{macro}[aux]{\str_encode_native_flush:}
-% \begin{macro}[aux, rEXP]{\str_encode_native_filter:N}
+% \begin{macro}[aux]{\@@_encode_native_loop:w}
+% \begin{macro}[aux]{\@@_encode_native_flush:}
+% \begin{macro}[aux, rEXP]{\@@_encode_native_filter:N}
% In Unicode-aware engines, since building particular characters
% cannot be done expandably in \TeX{}, we cannot hope to get a
% linear-time function. However, we get quite close using the
@@ -1968,28 +2023,28 @@
% linear time. Use the standard lowercase trick to produce an
% arbitrary character from the null character, and add that character
% to the end of the token list being built. At the end of the loop,
-% put the token list together with \cs{tl_build_end:}. Note that we
+% put the token list together with \cs{__tl_build_end:}. Note that we
% use an \texttt{x}-expanding assignment because it is slightly
% faster. Unicode-aware engines will never incur an overflow because
% the internal string is guaranteed to only contain code points in
% $[0,\hexnum{10FFFF}]$.
% \begin{macrocode}
{
- \cs_new_protected_nopar:Npn \str_convert_encode_:
+ \cs_new_protected_nopar:Npn \@@_convert_encode_:
{
- \int_zero:N \l_tl_build_offset_int
- \tl_gset_build_x:Nw \g_str_result_tl
- \exp_after:wN \str_encode_native_loop:w
- \g_str_result_tl \s_tl { \q_stop \prg_map_break: } \s_tl
- \prg_break_point:n { }
- \tl_build_end:
+ \int_zero:N \l__tl_build_offset_int
+ \__tl_gbuild_x:Nw \g_@@_result_tl
+ \exp_after:wN \@@_encode_native_loop:w
+ \g_@@_result_tl \s__tl { \q_stop \__prg_break: } \s__tl
+ \__prg_break_point:
+ \__tl_build_end:
}
- \cs_new_protected:Npn \str_encode_native_loop:w #1 \s_tl #2 \s_tl
+ \cs_new_protected:Npn \@@_encode_native_loop:w #1 \s__tl #2 \s__tl
{
\use_none_delimit_by_q_stop:w #2 \q_stop
- \tex_lccode:D \l_str_internal_int \int_eval:w #2 \int_eval_end:
- \tl_to_lowercase:n { \tl_build_one:n { ^^@ } }
- \str_encode_native_loop:w
+ \tex_lccode:D \l_@@_internal_int \__int_eval:w #2 \__int_eval_end:
+ \tl_to_lowercase:n { \__tl_build_one:n { ^^@ } }
+ \@@_encode_native_loop:w
}
}
% \end{macrocode}
@@ -2020,9 +2075,18 @@
% All the 8-bit encodings which \pkg{l3str} supports rely on the same
% internal functions.
%
-% \begin{macro}[int]{\str_declare_eight_bit_encoding:nnn}
+% \begin{macro}[int]{\@@_declare_eight_bit_encoding:nnn}
+% \begin{syntax}
+% \cs{@@_declare_eight_bit_encoding:nnn} \Arg{name} \Arg{mapping} \Arg{missing}
+% \end{syntax}
+% This declares the encoding \meta{name} to map bytes to Unicode
+% characters according to the \meta{mapping}, and map those bytes
+% which are not mentionned in the \meta{mapping} either to the
+% replacement character (if they appear in \meta{missing}), or to
+% themselves.
+%
% All the 8-bit encoding definition file start with
-% \cs{str_declare_eight_bit_encoding:nnn} \Arg{encoding name}
+% \cs{@@_declare_eight_bit_encoding:nnn} \Arg{encoding name}
% \Arg{mapping} \Arg{missing bytes}. The \meta{mapping} argument is a
% token list of pairs \Arg{byte} \Arg{Unicode} expressed in uppercase
% hexadecimal notation. The \meta{missing} argument is a token list
@@ -2030,70 +2094,70 @@
% \meta{mapping} nor the \meta{missing} lists maps to the same code
% point in Unicode.
% \begin{macrocode}
-\cs_new_protected:Npn \str_declare_eight_bit_encoding:nnn #1#2#3
+\cs_new_protected:Npn \@@_declare_eight_bit_encoding:nnn #1#2#3
{
- \tl_set:Nn \l_str_internal_tl {#1}
- \cs_new_protected_nopar:cpn { str_convert_decode_#1: }
- { \str_convert_decode_eight_bit:n {#1} }
- \cs_new_protected_nopar:cpn { str_convert_encode_#1: }
- { \str_convert_encode_eight_bit:n {#1} }
- \tl_const:cn { c_str_encoding_#1_tl } {#2}
- \tl_const:cn { c_str_encoding_#1_missing_tl } {#3}
+ \tl_set:Nn \l_@@_internal_tl {#1}
+ \cs_new_protected_nopar:cpn { @@_convert_decode_#1: }
+ { \@@_convert_decode_eight_bit:n {#1} }
+ \cs_new_protected_nopar:cpn { @@_convert_encode_#1: }
+ { \@@_convert_encode_eight_bit:n {#1} }
+ \tl_const:cn { c_@@_encoding_#1_tl } {#2}
+ \tl_const:cn { c_@@_encoding_#1_missing_tl } {#3}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\str_convert_decode_eight_bit:n}
-% \begin{macro}[aux]{\str_decode_eight_bit_load:nn}
-% \begin{macro}[aux]{\str_decode_eight_bit_load_missing:n}
-% \begin{macro}[aux, EXP]{\str_decode_eight_bit_char:N}
+% \begin{macro}[int]{\@@_convert_decode_eight_bit:n}
+% \begin{macro}[aux]{\@@_decode_eight_bit_load:nn}
+% \begin{macro}[aux]{\@@_decode_eight_bit_load_missing:n}
+% \begin{macro}[aux, EXP]{\@@_decode_eight_bit_char:N}
%^^A todo: document
% \begin{macrocode}
-\cs_new_protected:Npn \str_convert_decode_eight_bit:n #1
+\cs_new_protected:Npn \@@_convert_decode_eight_bit:n #1
{
\group_begin:
- \int_zero:N \l_str_internal_int
- \exp_last_unbraced:Nx \str_decode_eight_bit_load:nn
- { \tl_use:c { c_str_encoding_#1_tl } }
- { \q_stop \prg_map_break: } { }
- \prg_break_point:n { }
- \exp_last_unbraced:Nx \str_decode_eight_bit_load_missing:n
- { \tl_use:c { c_str_encoding_#1_missing_tl } }
- { \q_stop \prg_map_break: }
- \prg_break_point:n { }
+ \int_zero:N \l_@@_internal_int
+ \exp_last_unbraced:Nx \@@_decode_eight_bit_load:nn
+ { \tl_use:c { c_@@_encoding_#1_tl } }
+ { \q_stop \__prg_break: } { }
+ \__prg_break_point:
+ \exp_last_unbraced:Nx \@@_decode_eight_bit_load_missing:n
+ { \tl_use:c { c_@@_encoding_#1_missing_tl } }
+ { \q_stop \__prg_break: }
+ \__prg_break_point:
\flag_clear:n { str_error }
- \str_convert_gmap:N \str_decode_eight_bit_char:N
- \str_if_flag_error:nnx { str_error } { decode-8-bit } {#1}
+ \@@_convert_gmap:N \@@_decode_eight_bit_char:N
+ \@@_if_flag_error:nnx { str_error } { decode-8-bit } {#1}
\group_end:
}
-\cs_new_protected:Npn \str_decode_eight_bit_load:nn #1#2
+\cs_new_protected:Npn \@@_decode_eight_bit_load:nn #1#2
{
\use_none_delimit_by_q_stop:w #1 \q_stop
- \tex_dimen:D "#1 = \l_str_internal_int sp \scan_stop:
- \tex_skip:D \l_str_internal_int = "#1 sp \scan_stop:
- \tex_toks:D \l_str_internal_int \exp_after:wN { \int_value:w "#2 }
- \tex_advance:D \l_str_internal_int \c_one
- \str_decode_eight_bit_load:nn
+ \tex_dimen:D "#1 = \l_@@_internal_int sp \scan_stop:
+ \tex_skip:D \l_@@_internal_int = "#1 sp \scan_stop:
+ \tex_toks:D \l_@@_internal_int \exp_after:wN { \__int_value:w "#2 }
+ \tex_advance:D \l_@@_internal_int \c_one
+ \@@_decode_eight_bit_load:nn
}
-\cs_new_protected:Npn \str_decode_eight_bit_load_missing:n #1
+\cs_new_protected:Npn \@@_decode_eight_bit_load_missing:n #1
{
\use_none_delimit_by_q_stop:w #1 \q_stop
- \tex_dimen:D "#1 = \l_str_internal_int sp \scan_stop:
- \tex_skip:D \l_str_internal_int = "#1 sp \scan_stop:
- \tex_toks:D \l_str_internal_int \exp_after:wN
- { \int_use:N \c_str_replacement_char_int }
- \tex_advance:D \l_str_internal_int \c_one
- \str_decode_eight_bit_load_missing:n
+ \tex_dimen:D "#1 = \l_@@_internal_int sp \scan_stop:
+ \tex_skip:D \l_@@_internal_int = "#1 sp \scan_stop:
+ \tex_toks:D \l_@@_internal_int \exp_after:wN
+ { \int_use:N \c_@@_replacement_char_int }
+ \tex_advance:D \l_@@_internal_int \c_one
+ \@@_decode_eight_bit_load_missing:n
}
-\cs_new:Npn \str_decode_eight_bit_char:N #1
+\cs_new:Npn \@@_decode_eight_bit_char:N #1
{
- #1 \s_tl
- \if_num:w \tex_dimen:D `#1 < \l_str_internal_int
- \if_num:w \tex_skip:D \tex_dimen:D `#1 = `#1 \exp_stop_f:
+ #1 \s__tl
+ \if_int_compare:w \tex_dimen:D `#1 < \l_@@_internal_int
+ \if_int_compare:w \tex_skip:D \tex_dimen:D `#1 = `#1 \exp_stop_f:
\tex_the:D \tex_toks:D \tex_dimen:D
\fi:
\fi:
- \int_value:w `#1 \s_tl
+ \__int_value:w `#1 \s__tl
}
% \end{macrocode}
% \end{macro}
@@ -2101,53 +2165,53 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\str_convert_encode_eight_bit:n}
-% \begin{macro}[aux]{\str_encode_eight_bit_load:nn}
-% \begin{macro}[aux, rEXP]{\str_encode_eight_bit_char:n}
-% \begin{macro}[aux, rEXP]{\str_encode_eight_bit_char_aux:n}
+% \begin{macro}[int]{\@@_convert_encode_eight_bit:n}
+% \begin{macro}[aux]{\@@_encode_eight_bit_load:nn}
+% \begin{macro}[aux, rEXP]{\@@_encode_eight_bit_char:n}
+% \begin{macro}[aux, rEXP]{\@@_encode_eight_bit_char_aux:n}
%^^A todo: document
% \begin{macrocode}
-\cs_new_protected:Npn \str_convert_encode_eight_bit:n #1
+\cs_new_protected:Npn \@@_convert_encode_eight_bit:n #1
{
\group_begin:
- \int_zero:N \l_str_internal_int
- \exp_last_unbraced:Nx \str_encode_eight_bit_load:nn
- { \tl_use:c { c_str_encoding_#1_tl } }
- { \q_stop \prg_map_break: } { }
- \prg_break_point:n { }
+ \int_zero:N \l_@@_internal_int
+ \exp_last_unbraced:Nx \@@_encode_eight_bit_load:nn
+ { \tl_use:c { c_@@_encoding_#1_tl } }
+ { \q_stop \__prg_break: } { }
+ \__prg_break_point:
\flag_clear:n { str_error }
- \str_convert_gmap_internal:N \str_encode_eight_bit_char:n
- \str_if_flag_error:nnx { str_error } { encode-8-bit } {#1}
+ \@@_convert_gmap_internal:N \@@_encode_eight_bit_char:n
+ \@@_if_flag_error:nnx { str_error } { encode-8-bit } {#1}
\group_end:
}
-\cs_new_protected:Npn \str_encode_eight_bit_load:nn #1#2
+\cs_new_protected:Npn \@@_encode_eight_bit_load:nn #1#2
{
\use_none_delimit_by_q_stop:w #1 \q_stop
- \tex_dimen:D "#2 = \l_str_internal_int sp \scan_stop:
- \tex_skip:D \l_str_internal_int = "#2 sp \scan_stop:
- \exp_args:NNf \tex_toks:D \l_str_internal_int
- { \str_output_byte:n { "#1 } }
- \tex_advance:D \l_str_internal_int \c_one
- \str_encode_eight_bit_load:nn
+ \tex_dimen:D "#2 = \l_@@_internal_int sp \scan_stop:
+ \tex_skip:D \l_@@_internal_int = "#2 sp \scan_stop:
+ \exp_args:NNf \tex_toks:D \l_@@_internal_int
+ { \@@_output_byte:n { "#1 } }
+ \tex_advance:D \l_@@_internal_int \c_one
+ \@@_encode_eight_bit_load:nn
}
-\cs_new:Npn \str_encode_eight_bit_char:n #1
+\cs_new:Npn \@@_encode_eight_bit_char:n #1
{
- \if_num:w #1 > \c_max_register_int
+ \if_int_compare:w #1 > \c_max_register_int
\flag_raise:n { str_error }
\else:
- \if_num:w \tex_dimen:D #1 < \l_str_internal_int
- \if_num:w \tex_skip:D \tex_dimen:D #1 = #1 \exp_stop_f:
+ \if_int_compare:w \tex_dimen:D #1 < \l_@@_internal_int
+ \if_int_compare:w \tex_skip:D \tex_dimen:D #1 = #1 \exp_stop_f:
\tex_the:D \tex_toks:D \tex_dimen:D #1 \exp_stop_f:
\exp_after:wN \exp_after:wN \exp_after:wN \use_none:nn
\fi:
\fi:
- \str_encode_eight_bit_char_aux:n {#1}
+ \@@_encode_eight_bit_char_aux:n {#1}
\fi:
}
-\cs_new:Npn \str_encode_eight_bit_char_aux:n #1
+\cs_new:Npn \@@_encode_eight_bit_char_aux:n #1
{
- \if_num:w #1 < \c_two_hundred_fifty_six
- \str_output_byte:n {#1}
+ \if_int_compare:w #1 < \c_two_hundred_fifty_six
+ \@@_output_byte:n {#1}
\else:
\flag_raise:n { str_error }
\fi:
@@ -2163,18 +2227,18 @@
% General messages, and messages for the encodings and escapings loaded
% by default (\enquote{native}, and \enquote{bytes}).
% \begin{macrocode}
-\msg_kernel_new:nnn { str } { unknown-esc }
+\__msg_kernel_new:nnn { str } { unknown-esc }
{ Escaping~scheme~'#1'~(filtered:~'#2')~unknown. }
-\msg_kernel_new:nnn { str } { unknown-enc }
+\__msg_kernel_new:nnn { str } { unknown-enc }
{ Encoding~scheme~'#1'~(filtered:~'#2')~unknown. }
-\msg_kernel_new:nnnn { str } { native-escaping }
+\__msg_kernel_new:nnnn { str } { native-escaping }
{ The~'native'~encoding~scheme~does~not~support~any~escaping. }
{
Since~native~strings~do~not~consist~in~bytes,~
none~of~the~escaping~methods~make~sense.~
The~specified~escaping,~'#1',~will be ignored.
}
-\msg_kernel_new:nnn { str } { file-not-found }
+\__msg_kernel_new:nnn { str } { file-not-found }
{ File~'l3str-#1.def'~not~found. }
% \end{macrocode}
%
@@ -2186,7 +2250,7 @@
% \begin{macrocode}
\pdftex_if_engine:F
{
- \msg_kernel_new:nnnn { str } { non-byte }
+ \__msg_kernel_new:nnnn { str } { non-byte }
{ String~invalid~in~escaping~'#1':~it~may~only~contain~bytes. }
{
Some~characters~in~the~string~you~asked~to~convert~are~not~
@@ -2204,13 +2268,13 @@
%
% Those messages are used when converting to and from 8-bit encodings.
% \begin{macrocode}
-\msg_kernel_new:nnnn { str } { decode-8-bit }
+\__msg_kernel_new:nnnn { str } { decode-8-bit }
{ Invalid~string~in~encoding~'#1'. }
{
LaTeX~came~across~a~byte~which~is~not~defined~to~represent~
any~character~in~the~encoding~'#1'.
}
-\msg_kernel_new:nnnn { str } { encode-8-bit }
+\__msg_kernel_new:nnnn { str } { encode-8-bit }
{ Unicode~string~cannot~be~converted~to~encoding~'#1'. }
{
The~encoding~'#1'~only~contains~a~subset~of~all~Unicode~characters.~
@@ -2220,14 +2284,14 @@
% \end{macrocode}
%
% \subsection{Deprecated string functions}
-%
-% \begin{macro}{\str_length_skip_spaces:N, \str_length_skip_spaces:n}
-% The naming scheme is a little bit more consistent with
-% \enquote{ignore_spaces} instead of \enquote{skip_spaces}.
+%
+% Deprecated 2012-05-13 for removal by 2012-08-31.
+%
+% \begin{macro}{\str_length:N, \str_length:n, \str_length_ignore_spaces:n}
% \begin{macrocode}
-\cs_set:Npn \str_length_skip_spaces:N
- { \exp_args:No \str_length_skip_spaces:n }
-\cs_set_eq:NN \str_length_skip_spaces:n \str_length_ignore_spaces:n
+\cs_new_eq:NN \str_length:N \str_count:N
+\cs_new_eq:NN \str_length:n \str_count:n
+\cs_new_eq:NN \str_length_ignore_spaces:n \str_count_ignore_spaces:n
% \end{macrocode}
% \end{macro}
%
@@ -2253,9 +2317,9 @@
%
% \subsubsection{Unescape methods}
%
-% \begin{macro}[int]{\str_convert_unescape_hex:}
-% \begin{macro}[aux, rEXP]{\str_unescape_hex_i:N}
-% \begin{macro}[aux, rEXP]{\str_unescape_hex_ii:N}
+% \begin{macro}[int]{\@@_convert_unescape_hex:}
+% \begin{macro}[aux, rEXP]{\@@_unescape_hex_i:N}
+% \begin{macro}[aux, rEXP]{\@@_unescape_hex_ii:N}
% Take chars two by two, and interpret each pair as the hexadecimal
% code for a byte. Anything else than hexadecimal digits is ignored,
% raising the flag. A string which contains an odd number of
@@ -2263,46 +2327,47 @@
% appending a |0| in all cases, and dropping it if it is alone.
% \begin{macrocode}
%<*hex>
-\cs_new_protected_nopar:Npn \str_convert_unescape_hex:
+\cs_new_protected_nopar:Npn \@@_convert_unescape_hex:
{
\group_begin:
\flag_clear:n { str_error }
\int_set:Nn \tex_escapechar:D { 92 }
- \tl_gset:Nx \g_str_result_tl
+ \tl_gset:Nx \g_@@_result_tl
{
- \str_output_byte:w "
- \exp_last_unbraced:Nf \str_unescape_hex_i:N
- { \tl_to_str:N \g_str_result_tl }
- 0 { ? 0 - \c_one \prg_map_break: }
- \prg_break_point:n { \str_output_end: }
+ \@@_output_byte:w "
+ \exp_last_unbraced:Nf \@@_unescape_hex_i:N
+ { \tl_to_str:N \g_@@_result_tl }
+ 0 { ? 0 - \c_one \__prg_break: }
+ \__prg_break_point:
+ \@@_output_end:
}
- \str_if_flag_error:nnx { str_error } { unescape-hex } { }
+ \@@_if_flag_error:nnx { str_error } { unescape-hex } { }
\group_end:
}
-\cs_new:Npn \str_unescape_hex_i:N #1
+\cs_new:Npn \@@_unescape_hex_i:N #1
{
\use_none:n #1
- \str_aux_hexadecimal_use:NTF #1
- { \str_unescape_hex_ii:N }
+ \@@_hexadecimal_use:NTF #1
+ { \@@_unescape_hex_ii:N }
{
\flag_raise:n { str_error }
- \str_unescape_hex_i:N
+ \@@_unescape_hex_i:N
}
}
-\cs_new:Npn \str_unescape_hex_ii:N #1
+\cs_new:Npn \@@_unescape_hex_ii:N #1
{
\use_none:n #1
- \str_aux_hexadecimal_use:NTF #1
+ \@@_hexadecimal_use:NTF #1
{
- \str_output_end:
- \str_output_byte:w " \str_unescape_hex_i:N
+ \@@_output_end:
+ \@@_output_byte:w " \@@_unescape_hex_i:N
}
{
\flag_raise:n { str_error }
- \str_unescape_hex_ii:N
+ \@@_unescape_hex_ii:N
}
}
-\msg_kernel_new:nnnn { str } { unescape-hex }
+\__msg_kernel_new:nnnn { str } { unescape-hex }
{ String~invalid~in~escaping~'hex':~only~hexadecimal~digits~allowed. }
{
Some~characters~in~the~string~you~asked~to~convert~are~not~
@@ -2314,58 +2379,58 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\str_convert_unescape_name:}
-% \begin{macro}[aux, rEXP]{\str_unescape_name_loop:wNN}
-% \begin{macro}[int]{\str_convert_unescape_url:}
-% \begin{macro}[aux, rEXP]{\str_unescape_url_loop:wNN}
-% The \cs{str_convert_unescape_name:} function replaces each
+% \begin{macro}[int]{\@@_convert_unescape_name:}
+% \begin{macro}[aux, rEXP]{\@@_unescape_name_loop:wNN}
+% \begin{macro}[int]{\@@_convert_unescape_url:}
+% \begin{macro}[aux, rEXP]{\@@_unescape_url_loop:wNN}
+% The \cs{@@_convert_unescape_name:} function replaces each
% occurrence of |#| followed by two hexadecimal digits in
-% \cs{g_str_result_tl} by the corresponding byte. The \texttt{url}
+% \cs{g_@@_result_tl} by the corresponding byte. The \texttt{url}
% function is identical, with escape character |%| instead of |#|.
-% Thus we define the two together. The arguments of \cs{str_tmp:w} are
+% Thus we define the two together. The arguments of \cs{@@_tmp:w} are
% the character code of |#| or |%| in hexadecimal, the name of the
% main function to define, and the name of the auxiliary which
% performs the loop.
%
% The looping auxiliary |#3| finds the next escape character, reads
% the following two characters, and tests them. The test
-% \cs{str_aux_hexadecimal_use:NTF} leaves the upper-case digit in the
+% \cs{@@_hexadecimal_use:NTF} leaves the upper-case digit in the
% input stream, hence we surround the test with
-% \cs{str_output_byte:w}~|"| and \cs{str_output_end:}. If both
+% \cs{@@_output_byte:w}~|"| and \cs{@@_output_end:}. If both
% characters are hexadecimal digits, they should be removed before
% looping: this is done by \cs{use_i:nnn}. If one of the characters
% is not a hexadecimal digit, then feed |"#1| to
-% \cs{str_output_byte:w} to produce the escape character, raise the
+% \cs{@@_output_byte:w} to produce the escape character, raise the
% flag, and call the looping function followed by the two characters
% (remove \cs{use_i:nnn}).
% \begin{macrocode}
%<*name|url>
-\cs_set_protected:Npn \str_tmp:w #1#2#3
+\cs_set_protected:Npn \@@_tmp:w #1#2#3
{
- \cs_new_protected:cpn { str_convert_unescape_#2: }
+ \cs_new_protected:cpn { @@_convert_unescape_#2: }
{
\group_begin:
\flag_clear:n { str_byte }
\flag_clear:n { str_error }
\int_set:Nn \tex_escapechar:D { 92 }
- \tl_gset:Nx \g_str_result_tl
+ \tl_gset:Nx \g_@@_result_tl
{
- \exp_after:wN #3 \g_str_result_tl
- #1 ? { ? \prg_map_break: }
- \prg_break_point:n { }
+ \exp_after:wN #3 \g_@@_result_tl
+ #1 ? { ? \__prg_break: }
+ \__prg_break_point:
}
- \str_if_flag_error:nnx { str_byte } { non-byte } { #2 }
- \str_if_flag_error:nnx { str_error } { unescape-#2 } { }
+ \@@_if_flag_error:nnx { str_byte } { non-byte } { #2 }
+ \@@_if_flag_error:nnx { str_error } { unescape-#2 } { }
\group_end:
}
\cs_new:Npn #3 ##1#1##2##3
{
- \str_filter_bytes:n {##1}
+ \@@_filter_bytes:n {##1}
\use_none:n ##3
- \str_output_byte:w "
- \str_aux_hexadecimal_use:NTF ##2
+ \@@_output_byte:w "
+ \@@_hexadecimal_use:NTF ##2
{
- \str_aux_hexadecimal_use:NTF ##3
+ \@@_hexadecimal_use:NTF ##3
{ }
{
\flag_raise:n { str_error }
@@ -2376,10 +2441,10 @@
\flag_raise:n { str_error }
0 + `#1 \use_i:nn
}
- \str_output_end:
+ \@@_output_end:
\use_i:nnn #3 ##2##3
}
- \msg_kernel_new:nnnn { str } { unescape-#2 }
+ \__msg_kernel_new:nnnn { str } { unescape-#2 }
{ String~invalid~in~escaping~'#2'. }
{
LaTeX~came~across~the~escape~character~'#1'~not~followed~by~
@@ -2387,20 +2452,24 @@
}
}
%</name|url>
-%<name>\exp_after:wN \str_tmp:w \c_hash_str { name }
-%<name> \str_unescape_name_loop:wNN
-%<url>\exp_after:wN \str_tmp:w \c_percent_str { url }
-%<url> \str_unescape_url_loop:wNN
+%<*name>
+\exp_after:wN \@@_tmp:w \c_hash_str { name }
+ \@@_unescape_name_loop:wNN
+%</name>
+%<*url>
+\exp_after:wN \@@_tmp:w \c_percent_str { url }
+ \@@_unescape_url_loop:wNN
+%</url>
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\str_convert_unescape_string:}
-% \begin{macro}[aux, rEXP]{\str_unescape_string_newlines:wN}
-% \begin{macro}[aux, rEXP]{\str_unescape_string_loop:wNNN}
-% \begin{macro}[aux, rEXP]{\str_unescape_string_repeat:NNNNNN}
+% \begin{macro}[int]{\@@_convert_unescape_string:}
+% \begin{macro}[aux, rEXP]{\@@_unescape_string_newlines:wN}
+% \begin{macro}[aux, rEXP]{\@@_unescape_string_loop:wNNN}
+% \begin{macro}[aux, rEXP]{\@@_unescape_string_repeat:NNNNNN}
% The \texttt{string} escaping is somewhat similar to the
% \texttt{name} and \texttt{url} escapings, with escape character |\|.
% The first step is to convert all three line endings, |^^J|, |^^M|,
@@ -2432,51 +2501,51 @@
\char_set_catcode_other:N \^^M
\tl_to_lowercase:n
{
- \cs_new_protected_nopar:Npn \str_convert_unescape_string:
+ \cs_new_protected_nopar:Npn \@@_convert_unescape_string:
{
\group_begin:
\flag_clear:n { str_byte }
\flag_clear:n { str_error }
\int_set:Nn \tex_escapechar:D { 92 }
- \tl_gset:Nx \g_str_result_tl
+ \tl_gset:Nx \g_@@_result_tl
{
- \exp_after:wN \str_unescape_string_newlines:wN
- \g_str_result_tl \prg_map_break: ^^M ?
- \prg_break_point:n { }
+ \exp_after:wN \@@_unescape_string_newlines:wN
+ \g_@@_result_tl \__prg_break: ^^M ?
+ \__prg_break_point:
}
- \tl_gset:Nx \g_str_result_tl
+ \tl_gset:Nx \g_@@_result_tl
{
- \exp_after:wN \str_unescape_string_loop:wNNN
- \g_str_result_tl * ?? { ? \prg_map_break: }
- \prg_break_point:n { }
+ \exp_after:wN \@@_unescape_string_loop:wNNN
+ \g_@@_result_tl * ?? { ? \__prg_break: }
+ \__prg_break_point:
}
- \str_if_flag_error:nnx { str_byte } { non-byte } { string }
- \str_if_flag_error:nnx { str_error } { unescape-string } { }
+ \@@_if_flag_error:nnx { str_byte } { non-byte } { string }
+ \@@_if_flag_error:nnx { str_error } { unescape-string } { }
\group_end:
}
- \cs_new:Npn \str_unescape_string_loop:wNNN #1 *#2#3#4
+ \cs_new:Npn \@@_unescape_string_loop:wNNN #1 *#2#3#4
}
{
- \str_filter_bytes:n {#1}
+ \@@_filter_bytes:n {#1}
\use_none:n #4
- \str_output_byte:w '
- \str_aux_octal_use:NTF #2
+ \@@_output_byte:w '
+ \@@_octal_use:NTF #2
{
- \str_aux_octal_use:NTF #3
+ \@@_octal_use:NTF #3
{
- \str_aux_octal_use:NTF #4
+ \@@_octal_use:NTF #4
{
\if_int_compare:w #2 > \c_three
- 256
\fi:
- \str_unescape_string_repeat:NNNNNN
+ \@@_unescape_string_repeat:NNNNNN
}
- { \str_unescape_string_repeat:NNNNNN ? }
+ { \@@_unescape_string_repeat:NNNNNN ? }
}
- { \str_unescape_string_repeat:NNNNNN ?? }
+ { \@@_unescape_string_repeat:NNNNNN ?? }
}
{
- \prg_case_str:xxn {#2}
+ \str_case_x:nnn {#2}
{
{ \c_backslash_str } { 134 }
{ ( } { 50 }
@@ -2493,18 +2562,18 @@
0 - \c_one \use_i:nn
}
}
- \str_output_end:
- \use_i:nn \str_unescape_string_loop:wNNN #2#3#4
+ \@@_output_end:
+ \use_i:nn \@@_unescape_string_loop:wNNN #2#3#4
}
- \cs_new:Npn \str_unescape_string_repeat:NNNNNN #1#2#3#4#5#6
- { \str_output_end: \str_unescape_string_loop:wNNN }
- \cs_new:Npn \str_unescape_string_newlines:wN #1 ^^M #2
+ \cs_new:Npn \@@_unescape_string_repeat:NNNNNN #1#2#3#4#5#6
+ { \@@_output_end: \@@_unescape_string_loop:wNNN }
+ \cs_new:Npn \@@_unescape_string_newlines:wN #1 ^^M #2
{
#1
\if_charcode:w ^^J #2 \else: ^^J \fi:
- \str_unescape_string_newlines:wN #2
+ \@@_unescape_string_newlines:wN #2
}
- \msg_kernel_new:nnnn { str } { unescape-string }
+ \__msg_kernel_new:nnnn { str } { unescape-string }
{ String~invalid~in~escaping~'string'. }
{
LaTeX~came~across~an~escape~character~'\c_backslash_str'~
@@ -2525,52 +2594,52 @@
% Currently, none of the escape methods can lead to errors, assuming
% that their input is made out of bytes.
%
-% \begin{macro}[int]{\str_convert_escape_hex:}
-% \begin{macro}[aux, rEXP]{\str_escape_hex_char:N}
+% \begin{macro}[int]{\@@_convert_escape_hex:}
+% \begin{macro}[aux, rEXP]{\@@_escape_hex_char:N}
% Loop and convert each byte to hexadecimal.
% \begin{macrocode}
%<*hex>
-\cs_new_protected_nopar:Npn \str_convert_escape_hex:
- { \str_convert_gmap:N \str_escape_hex_char:N }
-\cs_new:Npn \str_escape_hex_char:N #1
- { \str_output_hexadecimal:n { `#1 } }
+\cs_new_protected_nopar:Npn \@@_convert_escape_hex:
+ { \@@_convert_gmap:N \@@_escape_hex_char:N }
+\cs_new:Npn \@@_escape_hex_char:N #1
+ { \@@_output_hexadecimal:n { `#1 } }
%</hex>
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\str_convert_escape_name:}
-% \begin{macro}[aux, rEXP]{\str_escape_name_char:N}
-% \begin{macro}[aux, rEXP]{\str_if_escape_name:NTF}
-% \begin{variable}{\c_str_escape_name_str}
-% \begin{variable}{\c_str_escape_name_not_str}
+% \begin{macro}[int]{\@@_convert_escape_name:}
+% \begin{macro}[aux, rEXP]{\@@_escape_name_char:N}
+% \begin{macro}[aux, rEXP]{\@@_if_escape_name:NTF}
+% \begin{variable}{\c_@@_escape_name_str}
+% \begin{variable}{\c_@@_escape_name_not_str}
% For each byte, test whether it should be output as is, or be
% \enquote{hash-encoded}. Roughly, bytes outside the range
% $[\hexnum{2A},\hexnum{7E}]$ are hash-encoded. We keep two lists of
-% exceptions: characters in \cs{c_str_escape_name_not_str} are not
-% hash-encoded, and characters in the \cs{c_str_escape_name_str} are
+% exceptions: characters in \cs{c_@@_escape_name_not_str} are not
+% hash-encoded, and characters in the \cs{c_@@_escape_name_str} are
% encoded.
% \begin{macrocode}
%<*name>
-\str_const:Nn \c_str_escape_name_not_str { ! " $ & ' } %$
-\str_const:Nn \c_str_escape_name_str { {}/<>[] }
-\cs_new_protected_nopar:Npn \str_convert_escape_name:
- { \str_convert_gmap:N \str_escape_name_char:N }
-\cs_new:Npn \str_escape_name_char:N #1
+\str_const:Nn \c_@@_escape_name_not_str { ! " $ & ' } %$
+\str_const:Nn \c_@@_escape_name_str { {}/<>[] }
+\cs_new_protected_nopar:Npn \@@_convert_escape_name:
+ { \@@_convert_gmap:N \@@_escape_name_char:N }
+\cs_new:Npn \@@_escape_name_char:N #1
{
- \str_if_escape_name:NTF #1 {#1}
- { \c_hash_str \str_output_hexadecimal:n {`#1} }
+ \@@_if_escape_name:NTF #1 {#1}
+ { \c_hash_str \@@_output_hexadecimal:n {`#1} }
}
-\prg_new_conditional:Npnn \str_if_escape_name:N #1 { TF }
+\prg_new_conditional:Npnn \@@_if_escape_name:N #1 { TF }
{
- \if_num:w `#1 < "2A \exp_stop_f:
- \str_if_contains_char:NNTF \c_str_escape_name_not_str #1
+ \if_int_compare:w `#1 < "2A \exp_stop_f:
+ \@@_if_contains_char:NNTF \c_@@_escape_name_not_str #1
\prg_return_true: \prg_return_false:
\else:
- \if_num:w `#1 > "7E \exp_stop_f:
+ \if_int_compare:w `#1 > "7E \exp_stop_f:
\prg_return_false:
\else:
- \str_if_contains_char:NNTF \c_str_escape_name_str #1
+ \@@_if_contains_char:NNTF \c_@@_escape_name_str #1
\prg_return_false: \prg_return_true:
\fi:
\fi:
@@ -2583,25 +2652,25 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\str_convert_escape_string:}
-% \begin{macro}[aux, rEXP]{\str_escape_string_char:N}
-% \begin{macro}[aux, rEXP]{\str_if_escape_string:NTF}
-% \begin{variable}{\c_str_escape_string_str}
+% \begin{macro}[int]{\@@_convert_escape_string:}
+% \begin{macro}[aux, rEXP]{\@@_escape_string_char:N}
+% \begin{macro}[aux, rEXP]{\@@_if_escape_string:NTF}
+% \begin{variable}{\c_@@_escape_string_str}
% Any character below (and including) space, and any character above
% (and including) \texttt{del}, are converted to octal. One backslash
% is added before each parenthesis and backslash.
% \begin{macrocode}
%<*string>
-\str_const:Nx \c_str_escape_string_str
+\str_const:Nx \c_@@_escape_string_str
{ \c_backslash_str ( ) }
-\cs_new_protected_nopar:Npn \str_convert_escape_string:
- { \str_convert_gmap:N \str_escape_string_char:N }
-\cs_new:Npn \str_escape_string_char:N #1
+\cs_new_protected_nopar:Npn \@@_convert_escape_string:
+ { \@@_convert_gmap:N \@@_escape_string_char:N }
+\cs_new:Npn \@@_escape_string_char:N #1
{
- \str_if_escape_string:NTF #1
+ \@@_if_escape_string:NTF #1
{
- \str_if_contains_char:NNT
- \c_str_escape_string_str #1
+ \@@_if_contains_char:NNT
+ \c_@@_escape_string_str #1
{ \c_backslash_str }
#1
}
@@ -2612,12 +2681,12 @@
\int_mod:nn {`#1} \c_eight
}
}
-\prg_new_conditional:Npnn \str_if_escape_string:N #1 { TF }
+\prg_new_conditional:Npnn \@@_if_escape_string:N #1 { TF }
{
- \if_num:w `#1 < "21 \exp_stop_f:
+ \if_int_compare:w `#1 < "21 \exp_stop_f:
\prg_return_false:
\else:
- \if_num:w `#1 > "7E \exp_stop_f:
+ \if_int_compare:w `#1 > "7E \exp_stop_f:
\prg_return_false:
\else:
\prg_return_true:
@@ -2631,30 +2700,30 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\str_convert_escape_url:}
-% \begin{macro}[aux, rEXP]{\str_escape_url_char:N}
-% \begin{macro}[aux, rEXP]{\str_if_escape_url:NTF}
-% This function is similar to \cs{str_convert_escape_name:}, escaping
+% \begin{macro}[int]{\@@_convert_escape_url:}
+% \begin{macro}[aux, rEXP]{\@@_escape_url_char:N}
+% \begin{macro}[aux, rEXP]{\@@_if_escape_url:NTF}
+% This function is similar to \cs{@@_convert_escape_name:}, escaping
% different characters.
% \begin{macrocode}
%<*url>
-\cs_new_protected_nopar:Npn \str_convert_escape_url:
- { \str_convert_gmap:N \str_escape_url_char:N }
-\cs_new:Npn \str_escape_url_char:N #1
+\cs_new_protected_nopar:Npn \@@_convert_escape_url:
+ { \@@_convert_gmap:N \@@_escape_url_char:N }
+\cs_new:Npn \@@_escape_url_char:N #1
{
- \str_if_escape_url:NTF #1 {#1}
- { \c_percent_str \str_output_hexadecimal:n { `#1 } }
+ \@@_if_escape_url:NTF #1 {#1}
+ { \c_percent_str \@@_output_hexadecimal:n { `#1 } }
}
-\prg_new_conditional:Npnn \str_if_escape_url:N #1 { TF }
+\prg_new_conditional:Npnn \@@_if_escape_url:N #1 { TF }
{
- \if_num:w `#1 < "41 \exp_stop_f:
- \str_if_contains_char:nNTF { "-.<> } #1
+ \if_int_compare:w `#1 < "41 \exp_stop_f:
+ \@@_if_contains_char:nNTF { "-.<> } #1
\prg_return_true: \prg_return_false:
\else:
- \if_num:w `#1 > "7E \exp_stop_f:
+ \if_int_compare:w `#1 > "7E \exp_stop_f:
\prg_return_false:
\else:
- \str_if_contains_char:nNTF { [ ] } #1
+ \@@_if_contains_char:nNTF { [ ] } #1
\prg_return_false: \prg_return_true:
\fi:
\fi:
@@ -2683,9 +2752,9 @@
%<*utf8>
% \end{macrocode}
%
-% \begin{macro}[int]{\str_convert_encode_utf8:}
-% \begin{macro}[aux, rEXP]{\str_encode_utf_viii_char:n}
-% \begin{macro}[aux, rEXP]{\str_encode_utf_viii_loop:wwnnw}
+% \begin{macro}[int]{\@@_convert_encode_utf8:}
+% \begin{macro}[aux, rEXP]{\@@_encode_utf_viii_char:n}
+% \begin{macro}[aux, rEXP]{\@@_encode_utf_viii_loop:wwnnw}
% Loop through the internal string, and convert each character to its
% \textsc{utf-8} representation. The representation is built from the
% right-most (least significant) byte to the left-most (most
@@ -2706,7 +2775,7 @@
% repeat, producing a last continuation byte, and offset the quotient
% by $240$ for the leading byte.
%
-% How is that implemented? \cs{str_encode_utf_vii_loop:wwnnw} takes
+% How is that implemented? \cs{@@_encode_utf_vii_loop:wwnnw} takes
% successive quotients as its first argument, the quotient from the
% previous step as its second argument (except in step~$1$), the bound
% for quotients that trigger one more step or not, and finally the
@@ -2722,27 +2791,27 @@
% construction |\c_minus_one + \c_zero *| removes the spurious initial
% continuation byte (better methods welcome).
% \begin{macrocode}
-\cs_new_protected_nopar:cpn { str_convert_encode_utf8: }
- { \str_convert_gmap_internal:N \str_encode_utf_viii_char:n }
-\cs_new:Npn \str_encode_utf_viii_char:n #1
+\cs_new_protected_nopar:cpn { @@_convert_encode_utf8: }
+ { \@@_convert_gmap_internal:N \@@_encode_utf_viii_char:n }
+\cs_new:Npn \@@_encode_utf_viii_char:n #1
{
- \str_encode_utf_viii_loop:wwnnw #1 ; \c_minus_one + \c_zero * ;
+ \@@_encode_utf_viii_loop:wwnnw #1 ; \c_minus_one + \c_zero * ;
{ 128 } { \c_zero }
{ 32 } { 192 }
{ 16 } { 224 }
{ 8 } { 240 }
\q_stop
}
-\cs_new:Npn \str_encode_utf_viii_loop:wwnnw #1; #2; #3#4 #5 \q_stop
+\cs_new:Npn \@@_encode_utf_viii_loop:wwnnw #1; #2; #3#4 #5 \q_stop
{
- \if_num:w #1 < #3 \exp_stop_f:
- \str_output_byte:n { #1 + #4 }
+ \if_int_compare:w #1 < #3 \exp_stop_f:
+ \@@_output_byte:n { #1 + #4 }
\exp_after:wN \use_none_delimit_by_q_stop:w
\fi:
- \exp_after:wN \str_encode_utf_viii_loop:wwnnw
- \int_value:w \int_div_truncate:nn {#1} {64} ; #1 ;
+ \exp_after:wN \@@_encode_utf_viii_loop:wwnnw
+ \__int_value:w \int_div_truncate:nn {#1} {64} ; #1 ;
#5 \q_stop
- \str_output_byte:n { #2 - 64 * ( #1 - \c_two ) }
+ \@@_output_byte:n { #2 - 64 * ( #1 - \c_two ) }
}
% \end{macrocode}
% \end{macro}
@@ -2751,10 +2820,10 @@
%
% \begin{variable}
% {
-% \l_str_missing_flag ,
-% \l_str_extra_flag ,
-% \l_str_overlong_flag ,
-% \l_str_overflow_flag ,
+% \l_@@_missing_flag ,
+% \l_@@_extra_flag ,
+% \l_@@_overlong_flag ,
+% \l_@@_overflow_flag ,
% }
% When decoding a string that is purportedly in the \textsc{utf-8}
% encoding, four different errors can occur, signalled by a specific
@@ -2783,13 +2852,13 @@
\flag_clear_new:n { str_extra }
\flag_clear_new:n { str_overlong }
\flag_clear_new:n { str_overflow }
-\msg_kernel_new:nnnn { str } { utf8-decode }
+\__msg_kernel_new:nnnn { str } { utf8-decode }
{
Invalid~UTF-8~string: \exp_last_unbraced:Nf \use_none:n
- \str_if_flag_times:nT { str_missing } { ,~missing~continuation~byte }
- \str_if_flag_times:nT { str_extra } { ,~extra~continuation~byte }
- \str_if_flag_times:nT { str_overlong } { ,~overlong~form }
- \str_if_flag_times:nT { str_overflow } { ,~code~point~too~large }
+ \@@_if_flag_times:nT { str_missing } { ,~missing~continuation~byte }
+ \@@_if_flag_times:nT { str_extra } { ,~extra~continuation~byte }
+ \@@_if_flag_times:nT { str_overlong } { ,~overlong~form }
+ \@@_if_flag_times:nT { str_overflow } { ,~code~point~too~large }
.
}
{
@@ -2830,15 +2899,15 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}[int]{\str_convert_decode_utf8:}
+% \begin{macro}[int]{\@@_convert_decode_utf8:}
% \begin{macro}[aux, rEXP]
% {
-% \str_decode_utf_viii_start:N,
-% \str_decode_utf_viii_continuation:wwN,
-% \str_decode_utf_viii_aux:wNnnwN
+% \@@_decode_utf_viii_start:N,
+% \@@_decode_utf_viii_continuation:wwN,
+% \@@_decode_utf_viii_aux:wNnnwN
% }
% \begin{macro}[aux, rEXP]
-% {\str_decode_utf_viii_overflow:w, \str_decode_utf_viii_end:}
+% {\@@_decode_utf_viii_overflow:w, \@@_decode_utf_viii_end:}
% Decoding is significantly harder than encoding. As before, lower
% some flags, which are tested at the end (in bulk, to trigger at most
% one \LaTeX3 error, as explained above). We expect successive
@@ -2889,105 +2958,107 @@
% need to check whether we reached the end of the string. In a correct
% \textsc{utf-8} string, this happens automatically when the
% \texttt{_start} auxiliary leaves its first argument in the input
-% stream: the end-marker begins with \cs{prg_map_break:}, which ends
+% stream: the end-marker begins with \cs{__prg_break:}, which ends
% the loop. On the other hand, if the end is reached when looking for
% a continuation byte, the \cs{use_none:n} |#3| construction removes
% the first token from the end-marker, and leaves the \texttt{_end}
% auxiliary, which raises the appropriate error flag before ending the
% mapping.
% \begin{macrocode}
-\cs_new_protected_nopar:cpn { str_convert_decode_utf8: }
+\cs_new_protected_nopar:cpn { @@_convert_decode_utf8: }
{
\flag_clear:n { str_error }
\flag_clear:n { str_missing }
\flag_clear:n { str_extra }
\flag_clear:n { str_overlong }
\flag_clear:n { str_overflow }
- \tl_gset:Nx \g_str_result_tl
+ \tl_gset:Nx \g_@@_result_tl
{
- \exp_after:wN \str_decode_utf_viii_start:N \g_str_result_tl
- { \prg_map_break: \str_decode_utf_viii_end: }
- \prg_break_point:n { }
+ \exp_after:wN \@@_decode_utf_viii_start:N \g_@@_result_tl
+ { \__prg_break: \@@_decode_utf_viii_end: }
+ \__prg_break_point:
}
- \str_if_flag_error:nnx { str_error } { utf8-decode } { }
+ \@@_if_flag_error:nnx { str_error } { utf8-decode } { }
}
-\cs_new:Npn \str_decode_utf_viii_start:N #1
+\cs_new:Npn \@@_decode_utf_viii_start:N #1
{
#1
- \if_num:w `#1 < "C0 \exp_stop_f:
- \s_tl
- \if_num:w `#1 < "80 \exp_stop_f:
- \int_value:w `#1
+ \if_int_compare:w `#1 < "C0 \exp_stop_f:
+ \s__tl
+ \if_int_compare:w `#1 < "80 \exp_stop_f:
+ \__int_value:w `#1
\else:
\flag_raise:n { str_extra }
\flag_raise:n { str_error }
- \int_use:N \c_str_replacement_char_int
+ \int_use:N \c_@@_replacement_char_int
\fi:
\else:
- \exp_after:wN \str_decode_utf_viii_continuation:wwN
- \int_use:N \int_eval:w `#1 - "C0 \exp_after:wN \int_eval_end:
+ \exp_after:wN \@@_decode_utf_viii_continuation:wwN
+ \int_use:N \__int_eval:w `#1 - "C0 \exp_after:wN \__int_eval_end:
\fi:
- \s_tl
+ \s__tl
\use_none_delimit_by_q_stop:w {"80} {"800} {"10000} {"110000} \q_stop
- \str_decode_utf_viii_start:N
+ \@@_decode_utf_viii_start:N
}
-\cs_new:Npn \str_decode_utf_viii_continuation:wwN
- #1 \s_tl #2 \str_decode_utf_viii_start:N #3
+\cs_new:Npn \@@_decode_utf_viii_continuation:wwN
+ #1 \s__tl #2 \@@_decode_utf_viii_start:N #3
{
\use_none:n #3
- \if_num:w `#3 < \if_num:w `#3 < "80 \exp_stop_f: - \fi: "C0 \exp_stop_f:
+ \if_int_compare:w `#3 <
+ \if_int_compare:w `#3 < "80 \exp_stop_f: - \fi:
+ "C0 \exp_stop_f:
#3
- \exp_after:wN \str_decode_utf_viii_aux:wNnnwN
- \int_use:N \int_eval:w
+ \exp_after:wN \@@_decode_utf_viii_aux:wNnnwN
+ \int_use:N \__int_eval:w
#1 * "40 + `#3 - "80
- \exp_after:wN \int_eval_end:
+ \exp_after:wN \__int_eval_end:
\else:
- \s_tl
+ \s__tl
\flag_raise:n { str_missing }
\flag_raise:n { str_error }
- \int_use:N \c_str_replacement_char_int
+ \int_use:N \c_@@_replacement_char_int
\fi:
- \s_tl
+ \s__tl
#2
- \str_decode_utf_viii_start:N #3
+ \@@_decode_utf_viii_start:N #3
}
-\cs_new:Npn \str_decode_utf_viii_aux:wNnnwN
- #1 \s_tl #2#3#4 #5 \str_decode_utf_viii_start:N #6
+\cs_new:Npn \@@_decode_utf_viii_aux:wNnnwN
+ #1 \s__tl #2#3#4 #5 \@@_decode_utf_viii_start:N #6
{
- \if_num:w #1 < #4 \exp_stop_f:
- \s_tl
- \if_num:w #1 < #3 \exp_stop_f:
+ \if_int_compare:w #1 < #4 \exp_stop_f:
+ \s__tl
+ \if_int_compare:w #1 < #3 \exp_stop_f:
\flag_raise:n { str_overlong }
\flag_raise:n { str_error }
- \int_use:N \c_str_replacement_char_int
+ \int_use:N \c_@@_replacement_char_int
\else:
#1
\fi:
\else:
\if_meaning:w \q_stop #5
- \str_decode_utf_viii_overflow:w #1
+ \@@_decode_utf_viii_overflow:w #1
\fi:
- \exp_after:wN \str_decode_utf_viii_continuation:wwN
- \int_use:N \int_eval:w #1 - #4 \exp_after:wN \int_eval_end:
+ \exp_after:wN \@@_decode_utf_viii_continuation:wwN
+ \int_use:N \__int_eval:w #1 - #4 \exp_after:wN \__int_eval_end:
\fi:
- \s_tl
+ \s__tl
#2 {#4} #5
- \str_decode_utf_viii_start:N
+ \@@_decode_utf_viii_start:N
}
-\cs_new:Npn \str_decode_utf_viii_overflow:w #1 \fi: #2 \fi:
+\cs_new:Npn \@@_decode_utf_viii_overflow:w #1 \fi: #2 \fi:
{
\fi: \fi:
\flag_raise:n { str_overflow }
\flag_raise:n { str_error }
- \int_use:N \c_str_replacement_char_int
+ \int_use:N \c_@@_replacement_char_int
}
-\cs_new_nopar:Npn \str_decode_utf_viii_end:
+\cs_new_nopar:Npn \@@_decode_utf_viii_end:
{
- \s_tl
+ \s__tl
\flag_raise:n { str_missing }
\flag_raise:n { str_error }
- \int_use:N \c_str_replacement_char_int \s_tl
- \prg_map_break:
+ \int_use:N \c_@@_replacement_char_int \s__tl
+ \__prg_break:
}
% \end{macrocode}
% \end{macro}
@@ -3011,14 +3082,14 @@
%
% \begin{macro}[int]
% {
-% \str_convert_encode_utf16: ,
-% \str_convert_encode_utf16be: ,
-% \str_convert_encode_utf16le: ,
+% \@@_convert_encode_utf16: ,
+% \@@_convert_encode_utf16be: ,
+% \@@_convert_encode_utf16le: ,
% }
% \begin{macro}[aux, rEXP]
% {
-% \str_encode_utf_xvi_aux:N ,
-% \str_encode_utf_xvi_char:n ,
+% \@@_encode_utf_xvi_aux:N ,
+% \@@_encode_utf_xvi_char:n ,
% }
% When the endianness is not specified, it is big-endian by default,
% and we add a byte-order mark. Convert characters one by one in a
@@ -3033,45 +3104,45 @@
% surrogates, each two bytes. The magic \hexnum{D7C0} is
% $\hexnum{D800}-\hexnum{10000}/\hexnum{400}$.
% \end{itemize}
-% For the duration of this operation, \cs{str_tmp:w} is defined as a
+% For the duration of this operation, \cs{@@_tmp:w} is defined as a
% function to convert a number in the range $[0, \hexnum{FFFF}]$ to a
% pair of bytes (either big endian or little endian), by feeding the
% quotient of the division of |#1| by \hexnum{100}, followed by |#1|
-% to \cs{str_encode_utf_xvi_be:nn} or its \texttt{le} analog: those
+% to \cs{@@_encode_utf_xvi_be:nn} or its \texttt{le} analog: those
% compute the remainder, and output two bytes for the quotient and
% remainder.
% \begin{macrocode}
- \cs_new_protected_nopar:cpn { str_convert_encode_utf16: }
+ \cs_new_protected_nopar:cpn { @@_convert_encode_utf16: }
{
- \str_encode_utf_xvi_aux:N \str_output_byte_pair_be:n
- \tl_gput_left:Nx \g_str_result_tl { ^^fe ^^ff }
+ \@@_encode_utf_xvi_aux:N \@@_output_byte_pair_be:n
+ \tl_gput_left:Nx \g_@@_result_tl { ^^fe ^^ff }
}
- \cs_new_protected_nopar:cpn { str_convert_encode_utf16be: }
- { \str_encode_utf_xvi_aux:N \str_output_byte_pair_be:n }
- \cs_new_protected_nopar:cpn { str_convert_encode_utf16le: }
- { \str_encode_utf_xvi_aux:N \str_output_byte_pair_le:n }
- \cs_new_protected:Npn \str_encode_utf_xvi_aux:N #1
+ \cs_new_protected_nopar:cpn { @@_convert_encode_utf16be: }
+ { \@@_encode_utf_xvi_aux:N \@@_output_byte_pair_be:n }
+ \cs_new_protected_nopar:cpn { @@_convert_encode_utf16le: }
+ { \@@_encode_utf_xvi_aux:N \@@_output_byte_pair_le:n }
+ \cs_new_protected:Npn \@@_encode_utf_xvi_aux:N #1
{
\flag_clear:n { str_error }
- \cs_set_eq:NN \str_tmp:w #1
- \str_convert_gmap_internal:N \str_encode_utf_xvi_char:n
- \str_if_flag_error:nnx { str_error } { utf16-encode } { }
+ \cs_set_eq:NN \@@_tmp:w #1
+ \@@_convert_gmap_internal:N \@@_encode_utf_xvi_char:n
+ \@@_if_flag_error:nnx { str_error } { utf16-encode } { }
}
- \cs_new:Npn \str_encode_utf_xvi_char:n #1
+ \cs_new:Npn \@@_encode_utf_xvi_char:n #1
{
\if_int_compare:w #1 < "D800 \exp_stop_f:
- \str_tmp:w {#1}
+ \@@_tmp:w {#1}
\else:
\if_int_compare:w #1 < "10000 \exp_stop_f:
\if_int_compare:w #1 < "E000 \exp_stop_f:
\flag_raise:n { str_error }
- \str_tmp:w { \c_str_replacement_char_int }
+ \@@_tmp:w { \c_@@_replacement_char_int }
\else:
- \str_tmp:w {#1}
+ \@@_tmp:w {#1}
\fi:
\else:
- \exp_args:Nf \str_tmp:w { \int_div_truncate:nn {#1} {"400} + "D7C0 }
- \exp_args:Nf \str_tmp:w { \int_mod:nn {#1} {"400} + "DC00 }
+ \exp_args:Nf \@@_tmp:w { \int_div_truncate:nn {#1} {"400} + "D7C0 }
+ \exp_args:Nf \@@_tmp:w { \int_mod:nn {#1} {"400} + "DC00 }
\fi:
\fi:
}
@@ -3081,14 +3152,14 @@
%
% \begin{variable}
% {
-% \l_str_missing_flag ,
-% \l_str_extra_flag ,
-% \l_str_end_flag ,
+% \l_@@_missing_flag ,
+% \l_@@_extra_flag ,
+% \l_@@_end_flag ,
% }
% When encoding a Unicode string to \textsc{utf-16}, only one error
% can occur: code points in the range $[\hexnum{D800},
% \hexnum{DFFF}]$, corresponding to surrogates, cannot be encoded. We
-% use the all-purpose flag \texttt{str_error} to signal that error.
+% use the all-purpose flag \texttt{@@_error} to signal that error.
%
% When decoding a Unicode string which is purportedly in
% \textsc{utf-16}, three errors can occur: a missing trail surrogate,
@@ -3098,19 +3169,19 @@
\flag_clear_new:n { str_missing }
\flag_clear_new:n { str_extra }
\flag_clear_new:n { str_end }
- \msg_kernel_new:nnnn { str } { utf16-encode }
+ \__msg_kernel_new:nnnn { str } { utf16-encode }
{ Unicode~string~cannot~be~expressed~in~UTF-16:~surrogate. }
{
Surrogate~code~points~(in~the~range~[U+D800,~U+DFFF])~
can~be~expressed~in~the~UTF-8~and~UTF-32~encodings,~
but~not~in~the~UTF-16~encoding.
}
- \msg_kernel_new:nnnn { str } { utf16-decode }
+ \__msg_kernel_new:nnnn { str } { utf16-decode }
{
Invalid~UTF-16~string: \exp_last_unbraced:Nf \use_none:n
- \str_if_flag_times:nT { str_missing } { ,~missing~trail~surrogate }
- \str_if_flag_times:nT { str_extra } { ,~extra~trail~surrogate }
- \str_if_flag_times:nT { str_end } { ,~odd~number~of~bytes }
+ \@@_if_flag_times:nT { str_missing } { ,~missing~trail~surrogate }
+ \@@_if_flag_times:nT { str_extra } { ,~extra~trail~surrogate }
+ \@@_if_flag_times:nT { str_end } { ,~odd~number~of~bytes }
.
}
{
@@ -3148,11 +3219,11 @@
%
% \begin{macro}[int]
% {
-% \str_convert_decode_utf16: ,
-% \str_convert_decode_utf16be: ,
-% \str_convert_decode_utf16le: ,
+% \@@_convert_decode_utf16: ,
+% \@@_convert_decode_utf16be: ,
+% \@@_convert_decode_utf16le: ,
% }
-% \begin{macro}[aux]{\str_decode_utf_xvi_bom:NN, \str_decode_utf_xvi:Nw}
+% \begin{macro}[aux]{\@@_decode_utf_xvi_bom:NN, \@@_decode_utf_xvi:Nw}
% As for \textsc{utf-8}, decoding \textsc{utf-16} is harder than
% encoding it. If the endianness is unknown, check the first two
% bytes: if those are \hexnum{FE} and \hexnum{FF} in either order,
@@ -3160,48 +3231,48 @@
% big-endianness. The three endianness cases are based on a common
% auxiliary whose first argument is $1$ for big-endian and $2$ for
% little-endian, and whose second argument, delimited by the scan mark
-% \cs{s_stop}, is expanded once (the string may be long; passing
-% \cs{g_str_result_tl} as an argument before expansion is cheaper).
+% \cs{s__stop}, is expanded once (the string may be long; passing
+% \cs{g_@@_result_tl} as an argument before expansion is cheaper).
%
-% The \cs{strr_decode_utf_xvi:Nw} function defines \cs{str_tmp:w} to
+% The \cs{@@_decode_utf_xvi:Nw} function defines \cs{@@_tmp:w} to
% take two arguments and return the character code of the first one if
% the string is big-endian, and the second one if the string is
% little-endian, then loops over the string using
-% \cs{str_decode_utf_xvi_pair:NN} described below.
+% \cs{@@_decode_utf_xvi_pair:NN} described below.
% \begin{macrocode}
- \cs_new_protected_nopar:cpn { str_convert_decode_utf16be: }
- { \str_decode_utf_xvi:Nw 1 \g_str_result_tl \s_stop }
- \cs_new_protected_nopar:cpn { str_convert_decode_utf16le: }
- { \str_decode_utf_xvi:Nw 2 \g_str_result_tl \s_stop }
- \cs_new_protected_nopar:cpn { str_convert_decode_utf16: }
+ \cs_new_protected_nopar:cpn { @@_convert_decode_utf16be: }
+ { \@@_decode_utf_xvi:Nw 1 \g_@@_result_tl \s__stop }
+ \cs_new_protected_nopar:cpn { @@_convert_decode_utf16le: }
+ { \@@_decode_utf_xvi:Nw 2 \g_@@_result_tl \s__stop }
+ \cs_new_protected_nopar:cpn { @@_convert_decode_utf16: }
{
- \exp_after:wN \str_decode_utf_xvi_bom:NN
- \g_str_result_tl \s_stop \s_stop \s_stop
+ \exp_after:wN \@@_decode_utf_xvi_bom:NN
+ \g_@@_result_tl \s__stop \s__stop \s__stop
}
- \cs_new_protected:Npn \str_decode_utf_xvi_bom:NN #1#2
+ \cs_new_protected:Npn \@@_decode_utf_xvi_bom:NN #1#2
{
- \str_if_eq:xxTF { #1#2 } { ^^ff ^^fe }
- { \str_decode_utf_xvi:Nw 2 }
+ \str_if_eq_x:nnTF { #1#2 } { ^^ff ^^fe }
+ { \@@_decode_utf_xvi:Nw 2 }
{
- \str_if_eq:xxTF { #1#2 } { ^^fe ^^ff }
- { \str_decode_utf_xvi:Nw 1 }
- { \str_decode_utf_xvi:Nw 1 #1#2 }
+ \str_if_eq_x:nnTF { #1#2 } { ^^fe ^^ff }
+ { \@@_decode_utf_xvi:Nw 1 }
+ { \@@_decode_utf_xvi:Nw 1 #1#2 }
}
}
- \cs_new_protected:Npn \str_decode_utf_xvi:Nw #1#2 \s_stop
+ \cs_new_protected:Npn \@@_decode_utf_xvi:Nw #1#2 \s__stop
{
\flag_clear:n { str_error }
\flag_clear:n { str_missing }
\flag_clear:n { str_extra }
\flag_clear:n { str_end }
- \cs_set:Npn \str_tmp:w ##1 ##2 { ` ## #1 }
- \tl_gset:Nx \g_str_result_tl
+ \cs_set:Npn \@@_tmp:w ##1 ##2 { ` ## #1 }
+ \tl_gset:Nx \g_@@_result_tl
{
- \exp_after:wN \str_decode_utf_xvi_pair:NN
+ \exp_after:wN \@@_decode_utf_xvi_pair:NN
#2 \q_nil \q_nil
- \prg_break_point:n { }
+ \__prg_break_point:
}
- \str_if_flag_error:nnx { str_error } { utf16-decode } { }
+ \@@_if_flag_error:nnx { str_error } { utf16-decode } { }
}
% \end{macrocode}
% \end{macro}
@@ -3209,16 +3280,16 @@
%
% \begin{macro}[aux, rEXP]
% {
-% \str_decode_utf_xvi_pair:NN ,
-% \str_decode_utf_xvi_quad:NNwNN ,
-% \str_decode_utf_xvi_pair_end:Nw ,
+% \@@_decode_utf_xvi_pair:NN ,
+% \@@_decode_utf_xvi_quad:NNwNN ,
+% \@@_decode_utf_xvi_pair_end:Nw ,
% }
% \begin{macro}[aux, rEXP]
% {
-% \str_decode_utf_xvi_error:nNN ,
-% \str_decode_utf_xvi_extra:NNw ,
+% \@@_decode_utf_xvi_error:nNN ,
+% \@@_decode_utf_xvi_extra:NNw ,
% }
-% Bytes are read two at a time. At this stage, |\str_tmp:w #1#2|
+% Bytes are read two at a time. At this stage, |\@@_tmp:w #1#2|
% expands to the character code of the most significant byte, and we
% distinguish cases depending on which range it lies in:
% \begin{itemize}
@@ -3239,9 +3310,9 @@
% range $[\hexnum{DC}, \hexnum{DF}]$ (trail surrogate). The test is
% similar to the test used for continuation bytes in the
% \textsc{utf-8} decoding functions. In the case where |#4#5| is
-% indeed a trail surrogate, leave |#1#2#4#5| \cs{s_tl}
-% \meta{code~point} \cs{s_tl}, and remove the pair |#4#5| before
-% looping with \cs{str_decode_utf_xvi_pair:NN}. Otherwise, of course,
+% indeed a trail surrogate, leave |#1#2#4#5| \cs{s__tl}
+% \meta{code~point} \cs{s__tl}, and remove the pair |#4#5| before
+% looping with \cs{@@_decode_utf_xvi_pair:NN}. Otherwise, of course,
% complain about the missing surrogate.
%
% The magic number \hexnum{D7F7} is such that
@@ -3253,63 +3324,63 @@
% string had an even length. Also, if the end is reached when
% expecting a trail surrogate, we treat that as a missing surrogate.
% \begin{macrocode}
- \cs_new:Npn \str_decode_utf_xvi_pair:NN #1#2
+ \cs_new:Npn \@@_decode_utf_xvi_pair:NN #1#2
{
\if_meaning:w \q_nil #2
- \str_decode_utf_xvi_pair_end:Nw #1
+ \@@_decode_utf_xvi_pair_end:Nw #1
\fi:
\if_case:w
- \int_eval:w ( \str_tmp:w #1#2 - "D6 ) / \c_four \int_eval_end:
- \or: \exp_after:wN \str_decode_utf_xvi_quad:NNwNN
- \or: \exp_after:wN \str_decode_utf_xvi_extra:NNw
+ \__int_eval:w ( \@@_tmp:w #1#2 - "D6 ) / \c_four \__int_eval_end:
+ \or: \exp_after:wN \@@_decode_utf_xvi_quad:NNwNN
+ \or: \exp_after:wN \@@_decode_utf_xvi_extra:NNw
\fi:
- #1#2 \s_tl
- \int_eval:n { "100 * \str_tmp:w #1#2 + \str_tmp:w #2#1 } \s_tl
- \str_decode_utf_xvi_pair:NN
+ #1#2 \s__tl
+ \int_eval:n { "100 * \@@_tmp:w #1#2 + \@@_tmp:w #2#1 } \s__tl
+ \@@_decode_utf_xvi_pair:NN
}
- \cs_new:Npn \str_decode_utf_xvi_quad:NNwNN
- #1#2 #3 \str_decode_utf_xvi_pair:NN #4#5
+ \cs_new:Npn \@@_decode_utf_xvi_quad:NNwNN
+ #1#2 #3 \@@_decode_utf_xvi_pair:NN #4#5
{
\if_meaning:w \q_nil #5
- \str_decode_utf_xvi_error:nNN { missing } #1#2
- \str_decode_utf_xvi_pair_end:Nw #4
+ \@@_decode_utf_xvi_error:nNN { missing } #1#2
+ \@@_decode_utf_xvi_pair_end:Nw #4
\fi:
- \if_num:w
- \if_num:w \str_tmp:w #4#5 < "DC \exp_stop_f:
+ \if_int_compare:w
+ \if_int_compare:w \@@_tmp:w #4#5 < "DC \exp_stop_f:
\c_zero = \c_one
\else:
- \str_tmp:w #4#5 < "E0 \exp_stop_f:
+ \@@_tmp:w #4#5 < "E0 \exp_stop_f:
\fi:
- #1 #2 #4 #5 \s_tl
+ #1 #2 #4 #5 \s__tl
\int_eval:n
{
- ( "100 * \str_tmp:w #1#2 + \str_tmp:w #2#1 - "D7F7 ) * "400
- + "100 * \str_tmp:w #4#5 + \str_tmp:w #5#4
+ ( "100 * \@@_tmp:w #1#2 + \@@_tmp:w #2#1 - "D7F7 ) * "400
+ + "100 * \@@_tmp:w #4#5 + \@@_tmp:w #5#4
}
- \s_tl
+ \s__tl
\exp_after:wN \use_i:nnn
\else:
- \str_decode_utf_xvi_error:nNN { missing } #1#2
+ \@@_decode_utf_xvi_error:nNN { missing } #1#2
\fi:
- \str_decode_utf_xvi_pair:NN #4#5
+ \@@_decode_utf_xvi_pair:NN #4#5
}
- \cs_new:Npn \str_decode_utf_xvi_pair_end:Nw #1 \fi:
+ \cs_new:Npn \@@_decode_utf_xvi_pair_end:Nw #1 \fi:
{
\fi:
\if_meaning:w \q_nil #1
\else:
- \str_decode_utf_xvi_error:nNN { end } #1 \prg_do_nothing:
+ \@@_decode_utf_xvi_error:nNN { end } #1 \prg_do_nothing:
\fi:
- \prg_map_break:
+ \__prg_break:
}
- \cs_new:Npn \str_decode_utf_xvi_extra:NNw #1#2 \s_tl #3 \s_tl
- { \str_decode_utf_xvi_error:nNN { extra } #1#2 }
- \cs_new:Npn \str_decode_utf_xvi_error:nNN #1#2#3
+ \cs_new:Npn \@@_decode_utf_xvi_extra:NNw #1#2 \s__tl #3 \s__tl
+ { \@@_decode_utf_xvi_error:nNN { extra } #1#2 }
+ \cs_new:Npn \@@_decode_utf_xvi_error:nNN #1#2#3
{
\flag_raise:n { str_error }
\flag_raise:n { str_#1 }
- #2 #3 \s_tl
- \int_use:N \c_str_replacement_char_int \s_tl
+ #2 #3 \s__tl
+ \int_use:N \c_@@_replacement_char_int \s__tl
}
% \end{macrocode}
% \end{macro}
@@ -3336,51 +3407,51 @@
%
% \begin{macro}[int]
% {
-% \str_convert_encode_utf32: ,
-% \str_convert_encode_utf32be: ,
-% \str_convert_encode_utf32le: ,
+% \@@_convert_encode_utf32: ,
+% \@@_convert_encode_utf32be: ,
+% \@@_convert_encode_utf32le: ,
% }
% \begin{macro}[aux, rEXP]
% {
-% \str_encode_utf_xxxii_be:n ,
-% \str_encode_utf_xxxii_be_aux:nn ,
-% \str_encode_utf_xxxii_le:n ,
-% \str_encode_utf_xxxii_le_aux:nn ,
+% \@@_encode_utf_xxxii_be:n ,
+% \@@_encode_utf_xxxii_be_aux:nn ,
+% \@@_encode_utf_xxxii_le:n ,
+% \@@_encode_utf_xxxii_le_aux:nn ,
% }
-% Convert each integer in the comma-list \cs{g_str_result_tl} to a
+% Convert each integer in the comma-list \cs{g_@@_result_tl} to a
% sequence of four bytes. The functions for big-endian and
% little-endian encodings are very similar, but the
-% \cs{str_output_byte:n} instructions are reversed.
+% \cs{@@_output_byte:n} instructions are reversed.
% \begin{macrocode}
- \cs_new_protected_nopar:cpn { str_convert_encode_utf32: }
+ \cs_new_protected_nopar:cpn { @@_convert_encode_utf32: }
{
- \str_convert_gmap_internal:N \str_encode_utf_xxxii_be:n
- \tl_gput_left:Nx \g_str_result_tl { ^^00 ^^00 ^^fe ^^ff }
+ \@@_convert_gmap_internal:N \@@_encode_utf_xxxii_be:n
+ \tl_gput_left:Nx \g_@@_result_tl { ^^00 ^^00 ^^fe ^^ff }
}
- \cs_new_protected_nopar:cpn { str_convert_encode_utf32be: }
- { \str_convert_gmap_internal:N \str_encode_utf_xxxii_be:n }
- \cs_new_protected_nopar:cpn { str_convert_encode_utf32le: }
- { \str_convert_gmap_internal:N \str_encode_utf_xxxii_le:n }
- \cs_new:Npn \str_encode_utf_xxxii_be:n #1
+ \cs_new_protected_nopar:cpn { @@_convert_encode_utf32be: }
+ { \@@_convert_gmap_internal:N \@@_encode_utf_xxxii_be:n }
+ \cs_new_protected_nopar:cpn { @@_convert_encode_utf32le: }
+ { \@@_convert_gmap_internal:N \@@_encode_utf_xxxii_le:n }
+ \cs_new:Npn \@@_encode_utf_xxxii_be:n #1
{
- \exp_args:Nf \str_encode_utf_xxxii_be_aux:nn
+ \exp_args:Nf \@@_encode_utf_xxxii_be_aux:nn
{ \int_div_truncate:nn {#1} { "100 } } {#1}
}
- \cs_new:Npn \str_encode_utf_xxxii_be_aux:nn #1#2
+ \cs_new:Npn \@@_encode_utf_xxxii_be_aux:nn #1#2
{
^^00
- \str_output_byte_pair_be:n {#1}
- \str_output_byte:n { #2 - #1 * "100 }
+ \@@_output_byte_pair_be:n {#1}
+ \@@_output_byte:n { #2 - #1 * "100 }
}
- \cs_new:Npn \str_encode_utf_xxxii_le:n #1
+ \cs_new:Npn \@@_encode_utf_xxxii_le:n #1
{
- \exp_args:Nf \str_encode_utf_xxxii_le_aux:nn
+ \exp_args:Nf \@@_encode_utf_xxxii_le_aux:nn
{ \int_div_truncate:nn {#1} { "100 } } {#1}
}
- \cs_new:Npn \str_encode_utf_xxxii_le_aux:nn #1#2
+ \cs_new:Npn \@@_encode_utf_xxxii_le_aux:nn #1#2
{
- \str_output_byte:n { #2 - #1 * "100 }
- \str_output_byte_pair_le:n {#1}
+ \@@_output_byte:n { #2 - #1 * "100 }
+ \@@_output_byte_pair_le:n {#1}
^^00
}
% \end{macrocode}
@@ -3396,11 +3467,11 @@
% \begin{macrocode}
\flag_clear_new:n { str_overflow }
\flag_clear_new:n { str_end }
- \msg_kernel_new:nnnn { str } { utf32-decode }
+ \__msg_kernel_new:nnnn { str } { utf32-decode }
{
Invalid~UTF-32~string: \exp_last_unbraced:Nf \use_none:n
- \str_if_flag_times:nT { str_overflow } { ,~code~point~too~large }
- \str_if_flag_times:nT { str_end } { ,~truncated~string }
+ \@@_if_flag_times:nT { str_overflow } { ,~code~point~too~large }
+ \@@_if_flag_times:nT { str_end } { ,~truncated~string }
.
}
{
@@ -3425,103 +3496,103 @@
%
% \begin{macro}[int]
% {
-% \str_convert_decode_utf32: ,
-% \str_convert_decode_utf32be: ,
-% \str_convert_decode_utf32le: ,
+% \@@_convert_decode_utf32: ,
+% \@@_convert_decode_utf32be: ,
+% \@@_convert_decode_utf32le: ,
% }
% \begin{macro}[aux]
-% {\str_decode_utf_xxxii_bom:NNNN, \str_decode_utf_xxxii:Nw}
+% {\@@_decode_utf_xxxii_bom:NNNN, \@@_decode_utf_xxxii:Nw}
% \begin{macro}[aux, rEXP]
-% {\str_decode_utf_xxxii_loop:NNNN, \str_decode_utf_xxxii_end:w}
+% {\@@_decode_utf_xxxii_loop:NNNN, \@@_decode_utf_xxxii_end:w}
%
% The structure is similar to \textsc{utf-16} decoding functions. If
% the endianness is not given, test the first $4$ bytes of the string
-% (possibly \cs{s_stop} if the string is too short) for the presence
+% (possibly \cs{s__stop} if the string is too short) for the presence
% of a byte-order mark. If there is a byte-order mark, use that
% endianness, and remove the $4$ bytes, otherwise default to
% big-endian, and leave the $4$ bytes in place. The
-% \cs{str_decode_utf_xxxii:Nw} auxiliary recieves $1$ or $2$ as its
+% \cs{@@_decode_utf_xxxii:Nw} auxiliary recieves $1$ or $2$ as its
% first argument indicating endianness, and the string to convert as
-% its second argument (expanded or not). It sets \cs{str_tmp:w} to
+% its second argument (expanded or not). It sets \cs{@@_tmp:w} to
% expand to the character code of either of its two arguments
% depending on endianness, then triggers the \texttt{_loop} auxiliary
-% inside an \texttt{x}-expanding assignment to \cs{g_str_result_tl}.
+% inside an \texttt{x}-expanding assignment to \cs{g_@@_result_tl}.
%
% The \texttt{_loop} auxiliary first checks for the end-of-string
-% marker \cs{s_stop}, calling the \texttt{_end} auxiliary if
-% appropriate. Otherwise, leave the \meta{4~bytes} \cs{s_tl} behind,
+% marker \cs{s__stop}, calling the \texttt{_end} auxiliary if
+% appropriate. Otherwise, leave the \meta{4~bytes} \cs{s__tl} behind,
% then check that the code point is not overflowing: the leading byte
% must be $0$, and the following byte at most $16$.
%
% In the ending code, we check that there remains no byte: there
-% should be nothing left until the first \cs{s_stop}. Break the map.
+% should be nothing left until the first \cs{s__stop}. Break the map.
% \begin{macrocode}
- \cs_new_protected_nopar:cpn { str_convert_decode_utf32be: }
- { \str_decode_utf_xxxii:Nw 1 \g_str_result_tl \s_stop }
- \cs_new_protected_nopar:cpn { str_convert_decode_utf32le: }
- { \str_decode_utf_xxxii:Nw 2 \g_str_result_tl \s_stop }
- \cs_new_protected_nopar:cpn { str_convert_decode_utf32: }
+ \cs_new_protected_nopar:cpn { @@_convert_decode_utf32be: }
+ { \@@_decode_utf_xxxii:Nw 1 \g_@@_result_tl \s__stop }
+ \cs_new_protected_nopar:cpn { @@_convert_decode_utf32le: }
+ { \@@_decode_utf_xxxii:Nw 2 \g_@@_result_tl \s__stop }
+ \cs_new_protected_nopar:cpn { @@_convert_decode_utf32: }
{
- \exp_after:wN \str_decode_utf_xxxii_bom:NNNN \g_str_result_tl
- \s_stop \s_stop \s_stop \s_stop \s_stop
+ \exp_after:wN \@@_decode_utf_xxxii_bom:NNNN \g_@@_result_tl
+ \s__stop \s__stop \s__stop \s__stop \s__stop
}
- \cs_new_protected:Npn \str_decode_utf_xxxii_bom:NNNN #1#2#3#4
+ \cs_new_protected:Npn \@@_decode_utf_xxxii_bom:NNNN #1#2#3#4
{
- \str_if_eq:xxTF { #1#2#3#4 } { ^^ff ^^fe ^^00 ^^00 }
- { \str_decode_utf_xxxii:Nw 2 }
+ \str_if_eq_x:nnTF { #1#2#3#4 } { ^^ff ^^fe ^^00 ^^00 }
+ { \@@_decode_utf_xxxii:Nw 2 }
{
- \str_if_eq:xxTF { #1#2#3#4 } { ^^00 ^^00 ^^fe ^^ff }
- { \str_decode_utf_xxxii:Nw 1 }
- { \str_decode_utf_xxxii:Nw 1 #1#2#3#4 }
+ \str_if_eq_x:nnTF { #1#2#3#4 } { ^^00 ^^00 ^^fe ^^ff }
+ { \@@_decode_utf_xxxii:Nw 1 }
+ { \@@_decode_utf_xxxii:Nw 1 #1#2#3#4 }
}
}
- \cs_new_protected:Npn \str_decode_utf_xxxii:Nw #1#2 \s_stop
+ \cs_new_protected:Npn \@@_decode_utf_xxxii:Nw #1#2 \s__stop
{
\flag_clear:n { str_overflow }
\flag_clear:n { str_end }
\flag_clear:n { str_error }
- \cs_set:Npn \str_tmp:w ##1 ##2 { ` ## #1 }
- \tl_gset:Nx \g_str_result_tl
+ \cs_set:Npn \@@_tmp:w ##1 ##2 { ` ## #1 }
+ \tl_gset:Nx \g_@@_result_tl
{
- \exp_after:wN \str_decode_utf_xxxii_loop:NNNN
- #2 \s_stop \s_stop \s_stop \s_stop
- \prg_break_point:n { }
+ \exp_after:wN \@@_decode_utf_xxxii_loop:NNNN
+ #2 \s__stop \s__stop \s__stop \s__stop
+ \__prg_break_point:
}
- \str_if_flag_error:nnx { str_error } { utf32-decode } { }
+ \@@_if_flag_error:nnx { str_error } { utf32-decode } { }
}
- \cs_new:Npn \str_decode_utf_xxxii_loop:NNNN #1#2#3#4
+ \cs_new:Npn \@@_decode_utf_xxxii_loop:NNNN #1#2#3#4
{
- \if_meaning:w \s_stop #4
- \exp_after:wN \str_decode_utf_xxxii_end:w
+ \if_meaning:w \s__stop #4
+ \exp_after:wN \@@_decode_utf_xxxii_end:w
\fi:
- #1#2#3#4 \s_tl
- \if_num:w \str_tmp:w #1#4 > \c_zero
+ #1#2#3#4 \s__tl
+ \if_int_compare:w \@@_tmp:w #1#4 > \c_zero
\flag_raise:n { str_overflow }
\flag_raise:n { str_error }
- \int_use:N \c_str_replacement_char_int
+ \int_use:N \c_@@_replacement_char_int
\else:
- \if_num:w \str_tmp:w #2#3 > \c_sixteen
+ \if_int_compare:w \@@_tmp:w #2#3 > \c_sixteen
\flag_raise:n { str_overflow }
\flag_raise:n { str_error }
- \int_use:N \c_str_replacement_char_int
+ \int_use:N \c_@@_replacement_char_int
\else:
\int_eval:n
- { \str_tmp:w #2#3*"10000 + \str_tmp:w #3#2*"100 + \str_tmp:w #4#1 }
+ { \@@_tmp:w #2#3*"10000 + \@@_tmp:w #3#2*"100 + \@@_tmp:w #4#1 }
\fi:
\fi:
- \s_tl
- \str_decode_utf_xxxii_loop:NNNN
+ \s__tl
+ \@@_decode_utf_xxxii_loop:NNNN
}
- \cs_new:Npn \str_decode_utf_xxxii_end:w #1 \s_stop
+ \cs_new:Npn \@@_decode_utf_xxxii_end:w #1 \s__stop
{
\tl_if_empty:nF {#1}
{
\flag_raise:n { str_end }
\flag_raise:n { str_error }
- #1 \s_tl
- \int_use:N \c_str_replacement_char_int \s_tl
+ #1 \s__tl
+ \int_use:N \c_@@_replacement_char_int \s__tl
}
- \prg_map_break:
+ \__prg_break:
}
% \end{macrocode}
% \end{macro}
@@ -3541,7 +3612,7 @@
% family, we keep track only of differences, and of unassigned bytes.
% \begin{macrocode}
%<*iso88591>
-\str_declare_eight_bit_encoding:nnn { iso88591 }
+\@@_declare_eight_bit_encoding:nnn { iso88591 }
{
}
{
@@ -3551,7 +3622,7 @@
%
% \begin{macrocode}
%<*iso88592>
-\str_declare_eight_bit_encoding:nnn { iso88592 }
+\@@_declare_eight_bit_encoding:nnn { iso88592 }
{
{ A1 } { 0104 }
{ A2 } { 02D8 }
@@ -3618,7 +3689,7 @@
%
% \begin{macrocode}
%<*iso88593>
-\str_declare_eight_bit_encoding:nnn { iso88593 }
+\@@_declare_eight_bit_encoding:nnn { iso88593 }
{
{ A1 } { 0126 }
{ A2 } { 02D8 }
@@ -3663,7 +3734,7 @@
%
% \begin{macrocode}
%<*iso88594>
-\str_declare_eight_bit_encoding:nnn { iso88594 }
+\@@_declare_eight_bit_encoding:nnn { iso88594 }
{
{ A1 } { 0104 }
{ A2 } { 0138 }
@@ -3723,7 +3794,7 @@
%
% \begin{macrocode}
%<*iso88595>
-\str_declare_eight_bit_encoding:nnn { iso88595 }
+\@@_declare_eight_bit_encoding:nnn { iso88595 }
{
{ A1 } { 0401 }
{ A2 } { 0402 }
@@ -3827,7 +3898,7 @@
%
% \begin{macrocode}
%<*iso88596>
-\str_declare_eight_bit_encoding:nnn { iso88596 }
+\@@_declare_eight_bit_encoding:nnn { iso88596 }
{
{ AC } { 060C }
{ BB } { 061B }
@@ -3917,7 +3988,7 @@
%
% \begin{macrocode}
%<*iso88597>
-\str_declare_eight_bit_encoding:nnn { iso88597 }
+\@@_declare_eight_bit_encoding:nnn { iso88597 }
{
{ A1 } { 2018 }
{ A2 } { 2019 }
@@ -4006,7 +4077,7 @@
%
% \begin{macrocode}
%<*iso88598>
-\str_declare_eight_bit_encoding:nnn { iso88598 }
+\@@_declare_eight_bit_encoding:nnn { iso88598 }
{
{ AA } { 00D7 }
{ BA } { 00F7 }
@@ -4083,7 +4154,7 @@
%
% \begin{macrocode}
%<*iso88599>
-\str_declare_eight_bit_encoding:nnn { iso88599 }
+\@@_declare_eight_bit_encoding:nnn { iso88599 }
{
{ D0 } { 011E }
{ DD } { 0130 }
@@ -4099,7 +4170,7 @@
%
% \begin{macrocode}
%<*iso885910>
-\str_declare_eight_bit_encoding:nnn { iso885910 }
+\@@_declare_eight_bit_encoding:nnn { iso885910 }
{
{ A1 } { 0104 }
{ A2 } { 0112 }
@@ -4155,7 +4226,7 @@
%
% \begin{macrocode}
%<*iso885911>
-\str_declare_eight_bit_encoding:nnn { iso885911 }
+\@@_declare_eight_bit_encoding:nnn { iso885911 }
{
{ A1 } { 0E01 }
{ A2 } { 0E02 }
@@ -4256,7 +4327,7 @@
%
% \begin{macrocode}
%<*iso885913>
-\str_declare_eight_bit_encoding:nnn { iso885913 }
+\@@_declare_eight_bit_encoding:nnn { iso885913 }
{
{ A1 } { 201D }
{ A5 } { 201E }
@@ -4322,7 +4393,7 @@
%
% \begin{macrocode}
%<*iso885914>
-\str_declare_eight_bit_encoding:nnn { iso885914 }
+\@@_declare_eight_bit_encoding:nnn { iso885914 }
{
{ A1 } { 1E02 }
{ A2 } { 1E03 }
@@ -4363,7 +4434,7 @@
%
% \begin{macrocode}
%<*iso885915>
-\str_declare_eight_bit_encoding:nnn { iso885915 }
+\@@_declare_eight_bit_encoding:nnn { iso885915 }
{
{ A4 } { 20AC }
{ A6 } { 0160 }
@@ -4381,7 +4452,7 @@
%
% \begin{macrocode}
%<*iso885916>
-\str_declare_eight_bit_encoding:nnn { iso885916 }
+\@@_declare_eight_bit_encoding:nnn { iso885916 }
{
{ A1 } { 0104 }
{ A2 } { 0105 }
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins
index 7dc0c00357d..d8429f908fa 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins
+++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins
@@ -16,7 +16,7 @@ The released version of this bundle is available from CTAN.
\fi
-\input docstrip.tex
+\input l3docstrip.tex
\askforoverwritefalse
\preamble
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx
index 89ce9c22f3d..ef4d26bfe75 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx
@@ -36,7 +36,7 @@
%<*driver|package>
\RequirePackage{expl3}
\GetIdInfo$Id: l3tl-analysis.dtx 3039 2011-12-08 09:22:35Z bruno $
- {L3 Experimental Analysis of Token lists}
+ {L3 Experimental token lists analysis}
%</driver|package>
%<*driver>
\documentclass[full]{l3doc}
@@ -88,14 +88,14 @@
%
% \subsection{Internal functions}
%
-% \begin{variable}{\s_tl}
+% \begin{variable}{\s__tl}
% The format used to store token lists internally uses the scan mark
-% \cs{s_tl} as a delimiter.
+% \cs{s__tl} as a delimiter.
% \end{variable}
%
-% \begin{function}{\tl_analysis_map_inline:nn}
+% \begin{function}{\__tl_analysis_map_inline:nn}
% \begin{syntax}
-% \cs{tl_analysis_map_inline:nn} \Arg{token list} \Arg{inline function}
+% \cs{__tl_analysis_map_inline:nn} \Arg{token list} \Arg{inline function}
% \end{syntax}
% Applies the \meta{inline function} to each individual \meta{token}
% in the \meta{token list}. The \meta{inline function} receives three
@@ -116,8 +116,8 @@
% \end{function}
%
% For optimizations in \pkg{l3regex} (when matching control sequences),
-% it may be useful to provide a \cs{tl_analysis_from_str_map_inline:nn}
-% function, perhaps named \cs{str_analysis_map_inline:nn}.
+% it may be useful to provide a \cs{__tl_analysis_from_str_map_inline:nn}
+% function, perhaps named \cs{__str_analysis_map_inline:nn}.
%
% \subsection{Internal format}
%
@@ -138,7 +138,7 @@
% regexes are catcode-agnostic. The internal format thus takes the form
% of a succession of items of the form
% \begin{quote}
-% \meta{tokens} \cs{s_tl} \meta{catcode} \meta{char code} \cs{s_tl}
+% \meta{tokens} \cs{s__tl} \meta{catcode} \meta{char code} \cs{s__tl}
% \end{quote}
% The \meta{tokens} \texttt{o}- \emph{and} \texttt{x}-expand to the
% original token in the token list or to the cluster of tokens
@@ -149,7 +149,7 @@
%
% Using delimited arguments lets us build the \meta{tokens}
% progressively when doing an encoding conversion in \pkg{l3str}. On the
-% other hand, the delimiter \cs{s_tl} may not appear unbraced in
+% other hand, the delimiter \cs{s__tl} may not appear unbraced in
% \meta{tokens}. This is not a problem because we are careful to wrap
% control sequences in braces (as an argument to \cs{exp_not:n}) when
% converting from a general token list to the internal format.
@@ -159,15 +159,15 @@
% it is the following.
% \begin{itemize}
% \item A control sequence |\cs| becomes |\exp_not:n { \cs }|
-% \cs{s_tl} $0$ $-1$ \cs{s_tl}.
+% \cs{s__tl} $0$ $-1$ \cs{s__tl}.
% \item A begin-group character |{| becomes \cs{exp_after:wN} |{|
-% \cs{if_false:} |}| \cs{fi:} \cs{s_tl} $1$ \meta{char code}
-% \cs{s_tl}.
+% \cs{if_false:} |}| \cs{fi:} \cs{s__tl} $1$ \meta{char code}
+% \cs{s__tl}.
% \item An end-group character |}| becomes \cs{if_false:} |{| \cs{fi:}
-% |}| \cs{s_tl} $2$ \meta{char code} \cs{s_tl}.
+% |}| \cs{s__tl} $2$ \meta{char code} \cs{s__tl}.
% \item A character with any other category code becomes
-% \cs{exp_not:n} \Arg{character} \cs{s_tl} \meta{hex catcode}
-% \meta{char code} \cs{s_tl}.
+% \cs{exp_not:n} \Arg{character} \cs{s__tl} \meta{hex catcode}
+% \meta{char code} \cs{s__tl}.
% \end{itemize}
%
% ^^A todo: ask LuaTeX list for an \ifx\undefined <active char>
@@ -184,6 +184,10 @@
% \end{macrocode}
%
% \begin{macrocode}
+%<@@=tl_analysis>
+% \end{macrocode}
+%
+% \begin{macrocode}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\RequirePackage{l3str}
@@ -191,127 +195,127 @@
%
% \subsection{Variables and helper functions}
%
-% \begin{variable}{\s_tl}
-% The scan mark \cs{s_tl} is used as a delimiter in the internal
+% \begin{variable}{\s__tl}
+% The scan mark \cs{s__tl} is used as a delimiter in the internal
% format. This is more practical than using a quark, because we would
% then need to control expansion much more carefully: compare
-% \cs{int_value:w} |`#1| \cs{s_tl} with \cs{int_value:w} |`#1|
+% \cs{__int_value:w} |`#1| \cs{s__tl} with \cs{__int_value:w} |`#1|
% \cs{exp_stop_f:} \cs{exp_not:N} \cs{q_mark} to extract a character
% code followed by the delimiter in an \texttt{x}-expansion.
% \begin{macrocode}
-\scan_new:N \s_tl
+\__scan_new:N \s__tl
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_tl_analysis_internal_tl}
+% \begin{variable}{\l_@@_internal_tl}
% This token list variable is used to hand the argument of
% \cs{tl_show_analysis:n} to \cs{tl_show_analysis:N}.
% \begin{macrocode}
-\tl_new:N \l_tl_analysis_internal_tl
+\tl_new:N \l_@@_internal_tl
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_tl_analysis_token}
-% \begin{variable}{\l_tl_analysis_char_token}
+% \begin{variable}{\l_@@_token}
+% \begin{variable}{\l_@@_char_token}
% The tokens in the token list are probed with the \TeX{} primitive
-% \tn{futurelet}. We use \cs{l_tl_analysis_token} in that
+% \tn{futurelet}. We use \cs{l_@@_token} in that
% construction. In some cases, we convert the following token to a
% string before probing it: then the token variable used is
-% \cs{l_tl_analysis_char_token}.
+% \cs{l_@@_char_token}.
% \begin{macrocode}
-\cs_new_eq:NN \l_tl_analysis_token ?
-\cs_new_eq:NN \l_tl_analysis_char_token ?
+\cs_new_eq:NN \l_@@_token ?
+\cs_new_eq:NN \l_@@_char_token ?
% \end{macrocode}
% \end{variable}
% \end{variable}
%
-% \begin{variable}{\l_tl_analysis_normal_int}
+% \begin{variable}{\l_@@_normal_int}
% The number of normal (\texttt{N}-type argument) tokens since the
% last special token.
% \begin{macrocode}
-\int_new:N \l_tl_analysis_normal_int
+\int_new:N \l_@@_normal_int
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_tl_analysis_index_int}
+% \begin{variable}{\l_@@_index_int}
% During the first pass, this is the index in the array being built.
% During the second pass, it is equal to the maximum index in the
% array from the first pass.
% \begin{macrocode}
-\int_new:N \l_tl_analysis_index_int
+\int_new:N \l_@@_index_int
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_tl_analysis_nesting_int}
+% \begin{variable}{\l_@@_nesting_int}
% Nesting depth of explicit begin-group and end-group characters
% during the first pass. This lets us detect the end of the token list
% without a reserved end-marker.
% \begin{macrocode}
-\int_new:N \l_tl_analysis_nesting_int
+\int_new:N \l_@@_nesting_int
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_tl_analysis_type_int}
+% \begin{variable}{\l_@@_type_int}
% When encountering special characters, we record their \enquote{type}
% in this integer.
% \begin{macrocode}
-\int_new:N \l_tl_analysis_type_int
+\int_new:N \l_@@_type_int
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\g_tl_analysis_result_tl}
+% \begin{variable}{\g_@@_result_tl}
% The result of the conversion is stored in this token list, with a
% succession of items of the form
% \begin{quote}
-% \meta{tokens} \cs{s_tl} \meta{catcode} \meta{char code} \cs{s_tl}
+% \meta{tokens} \cs{s__tl} \meta{catcode} \meta{char code} \cs{s__tl}
% \end{quote}
% \begin{macrocode}
-\tl_new:N \g_tl_analysis_result_tl
+\tl_new:N \g_@@_result_tl
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}[int, EXP]{\tl_analysis_extract_charcode:}
-% \begin{macro}[aux, EXP]{\tl_analysis_extract_charcode_aux:w}
+% \begin{macro}[int, EXP]{\@@_extract_charcode:}
+% \begin{macro}[aux, EXP]{\@@_extract_charcode_aux:w}
% Extracting the character code from the meaning of
-% \cs{l_tl_analysis_token}. This has no error checking, and should
+% \cs{l_@@_token}. This has no error checking, and should
% only be assumed to work for begin-group and end-group character
% tokens. It produces a number in the form |`|\meta{char}.
% \begin{macrocode}
-\cs_new_nopar:Npn \tl_analysis_extract_charcode:
+\cs_new_nopar:Npn \@@_extract_charcode:
{
- \exp_after:wN \tl_analysis_extract_charcode_aux:w
- \token_to_meaning:N \l_tl_analysis_token
+ \exp_after:wN \@@_extract_charcode_aux:w
+ \token_to_meaning:N \l_@@_token
}
-\cs_new:Npn \tl_analysis_extract_charcode_aux:w #1 ~ #2 ~ { ` }
+\cs_new:Npn \@@_extract_charcode_aux:w #1 ~ #2 ~ { ` }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int, EXP]{\tl_analysis_cs_space_count:NN}
-% \begin{macro}[aux, EXP]{\tl_analysis_cs_space_count:w}
-% \begin{macro}[aux, EXP]{\tl_analysis_cs_space_count_end:w}
+% \begin{macro}[int, EXP]{\@@_cs_space_count:NN}
+% \begin{macro}[aux, EXP]{\@@_cs_space_count:w}
+% \begin{macro}[aux, EXP]{\@@_cs_space_count_end:w}
% Counts the number of spaces in the string representation of its
% second argument, as well as the number of characters following the
% last space in that representation, and feeds the two numbers as
% semicolon-delimited arguments to the first argument. When this
% function is used, the escape character is printable and non-space.
% \begin{macrocode}
-\cs_new:Npn \tl_analysis_cs_space_count:NN #1 #2
+\cs_new:Npn \@@_cs_space_count:NN #1 #2
{
\exp_after:wN #1
- \int_value:w \int_eval:w \c_zero
- \exp_after:wN \tl_analysis_cs_space_count:w
+ \__int_value:w \__int_eval:w \c_zero
+ \exp_after:wN \@@_cs_space_count:w
\token_to_str:N #2
- \fi: \tl_analysis_cs_space_count_end:w ; ~ !
+ \fi: \@@_cs_space_count_end:w ; ~ !
}
-\cs_new:Npn \tl_analysis_cs_space_count:w #1 ~
+\cs_new:Npn \@@_cs_space_count:w #1 ~
{
\if_false: #1 #1 \fi:
+ \c_one
- \tl_analysis_cs_space_count:w
+ \@@_cs_space_count:w
}
-\cs_new:Npn \tl_analysis_cs_space_count_end:w ; #1 \fi: #2 !
- { \exp_after:wN ; \int_value:w \str_length_ignore_spaces:n {#1} ; }
+\cs_new:Npn \@@_cs_space_count_end:w ; #1 \fi: #2 !
+ { \exp_after:wN ; \__int_value:w \str_count_ignore_spaces:n {#1} ; }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -321,10 +325,10 @@
%
% Our goal is to produce a token list of the form roughly
% \begin{quote}
-% \meta{token 1} \cs{s_tl} \meta{catcode 1} \meta{char code 1} \cs{s_tl} \\
-% \meta{token 2} \cs{s_tl} \meta{catcode 2} \meta{char code 2} \cs{s_tl} \\
+% \meta{token 1} \cs{s__tl} \meta{catcode 1} \meta{char code 1} \cs{s__tl} \\
+% \meta{token 2} \cs{s__tl} \meta{catcode 2} \meta{char code 2} \cs{s__tl} \\
% \ldots{}
-% \meta{token N} \cs{s_tl} \meta{catcode N} \meta{char code N} \cs{s_tl}
+% \meta{token N} \cs{s__tl} \meta{catcode N} \meta{char code N} \cs{s__tl}
% \end{quote}
% Most but not all tokens can be grabbed as an undelimited
% (\texttt{N}-type) argument by \TeX{}. The plan is to have a two pass
@@ -337,7 +341,7 @@
% result one item at a time.
%
% To ease the difficult first pass, we first do some setup with
-% \cs{tl_analysis_setup:n}. Active characters set equal to non-active
+% \cs{@@_setup:n}. Active characters set equal to non-active
% characters cause trouble, so we disable all active characters by
% setting them equal to \texttt{undefined} locally. We also set there
% the escape character to be printable (backslash, but this later
@@ -373,19 +377,19 @@
%
% The second pass is a simple exercise in expandable loops.
%
-% \begin{macro}[int]{\tl_analysis:n}
+% \begin{macro}[int]{\@@:n}
% Everything is done within a group, and all definitions will be
% local. We use \cs{group_align_safe_begin/end:} to avoid problems in
-% case \cs{tl_analysis:n} is used within an alignment and its argument
+% case \cs{@@:n} is used within an alignment and its argument
% contains alignment tab tokens.
% \begin{macrocode}
-\cs_new_protected:Npn \tl_analysis:n #1
+\cs_new_protected:Npn \@@:n #1
{
\group_begin:
\group_align_safe_begin:
- \tl_analysis_setup:n {#1}
- \tl_analysis_i:n {#1}
- \tl_analysis_ii:n {#1}
+ \@@_setup:n {#1}
+ \@@_i:n {#1}
+ \@@_ii:n {#1}
\group_align_safe_end:
\group_end:
}
@@ -394,8 +398,8 @@
%
% \subsection{Setup}
%
-% \begin{macro}[int]{\tl_analysis_setup:n}
-% \begin{macro}[aux]{\tl_analysis_disable_loop:N}
+% \begin{macro}[int]{\@@_setup:n}
+% \begin{macro}[aux]{\@@_disable_loop:N}
% Active characters can cause problems later on in the processing,
% so the first step is to disable them, by setting them to
% \texttt{undefined}. Since Unicode contains too many characters
@@ -407,20 +411,20 @@
% and we end the loop by feeding an odd non-\texttt{N}-type
% argument to the looping macro.
% \begin{macrocode}
-\cs_new_protected:Npn \tl_analysis_setup:n #1
+\cs_new_protected:Npn \@@_setup:n #1
{
\int_set_eq:NN \tex_escapechar:D \c_minus_one
- \exp_after:wN \tl_analysis_disable_loop:N
- \tl_to_str:n {#1} { ~ } { ? ~ \prg_map_break: }
- \prg_break_point:n { }
+ \exp_after:wN \@@_disable_loop:N
+ \tl_to_str:n {#1} { ~ } { ? ~ \__prg_break: }
+ \__prg_break_point:
}
\group_begin:
\char_set_catcode_active:N \^^@
- \cs_new_protected:Npn \tl_analysis_disable_loop:N #1
+ \cs_new_protected:Npn \@@_disable_loop:N #1
{
\tex_lccode:D \c_zero `#1 ~
\tl_to_lowercase:n { \tex_let:D ^^@ } \c_undefined:D
- \tl_analysis_disable_loop:N
+ \@@_disable_loop:N
}
\group_end:
% \end{macrocode}
@@ -463,36 +467,36 @@
% \cs{str_tail:n} \Arg{token} is non-empty, because the
% escape character is printable.
%
-% \begin{macro}[int]{\tl_analysis_i:n}
+% \begin{macro}[int]{\@@_i:n}
% We read tokens one by one using \tn{futurelet}.
% While performing the loop, we keep track of the number of
% true begin-group characters minus the number of
-% true end-group characters in \cs{l_tl_analysis_nesting_int}.
+% true end-group characters in \cs{l_@@_nesting_int}.
% This reaches $-1$ when we read the closing brace.
% \begin{macrocode}
-\cs_new_protected:Npn \tl_analysis_i:n #1
+\cs_new_protected:Npn \@@_i: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_i_loop:w #1 }
- \int_decr:N \l_tl_analysis_index_int
+ \int_zero:N \l_@@_normal_int
+ \int_zero:N \l_@@_index_int
+ \int_zero:N \l_@@_nesting_int
+ \if_false: { \fi: \@@_i_loop:w #1 }
+ \int_decr:N \l_@@_index_int
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\tl_analysis_i_loop:w}
+% \begin{macro}[int]{\@@_i_loop:w}
% Read one character and check its type.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \tl_analysis_i_loop:w
- { \tex_futurelet:D \l_tl_analysis_token \tl_analysis_i_type:w }
+\cs_new_protected_nopar:Npn \@@_i_loop:w
+ { \tex_futurelet:D \l_@@_token \@@_i_type:w }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\tl_analysis_i_type:w}
-% At this point, \cs{l_tl_analysis_token} holds the meaning
-% of the following token. We store in \cs{l_tl_analysis_type_int}
+% \begin{macro}[int]{\@@_i_type:w}
+% At this point, \cs{l_@@_token} holds the meaning
+% of the following token. We store in \cs{l_@@_type_int}
% the meaning of the token ahead:
% \begin{itemize}
% \item 0 space token;
@@ -504,45 +508,45 @@
% character changes the nesting level ($2$ is used only here,
% and is irrelevant later). Then call the auxiliary for each case.
% Note that nesting conditionals here is safe because we only skip
-% over \cs{l_tl_analysis_token} if it matches with one of the
+% over \cs{l_@@_token} if it matches with one of the
% character tokens (hence is not a primitive conditional).
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \tl_analysis_i_type:w
+\cs_new_protected_nopar:Npn \@@_i_type:w
{
- \l_tl_analysis_type_int =
- \if_meaning:w \l_tl_analysis_token \c_space_token
+ \l_@@_type_int =
+ \if_meaning:w \l_@@_token \c_space_token
\c_zero
\else:
- \if_catcode:w \exp_not:N \l_tl_analysis_token \c_group_begin_token
+ \if_catcode:w \exp_not:N \l_@@_token \c_group_begin_token
\c_one
\else:
- \if_catcode:w \exp_not:N \l_tl_analysis_token \c_group_end_token
+ \if_catcode:w \exp_not:N \l_@@_token \c_group_end_token
\c_minus_one
\else:
\c_two
\fi:
\fi:
\fi:
- \if_case:w \l_tl_analysis_type_int
- \exp_after:wN \tl_analysis_i_space:w
- \or: \exp_after:wN \tl_analysis_i_bgroup:w
- \or: \exp_after:wN \tl_analysis_i_safe:N
- \else: \exp_after:wN \tl_analysis_i_egroup:w
+ \if_case:w \l_@@_type_int
+ \exp_after:wN \@@_i_space:w
+ \or: \exp_after:wN \@@_i_bgroup:w
+ \or: \exp_after:wN \@@_i_safe:N
+ \else: \exp_after:wN \@@_i_egroup:w
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\tl_analysis_i_space:w}
-% \begin{macro}[aux]{\tl_analysis_i_space_test:w}
+% \begin{macro}[int]{\@@_i_space:w}
+% \begin{macro}[aux]{\@@_i_space_test:w}
% In this branch, the following token's meaning is a blank space.
% Apply \tn{string} to that token: if it is a control sequence
% the result starts with the escape character; otherwise it is
% a true blank space, whose string representation is also a blank space.
-% We test for that in \cs{tl_analysis_i_space_test:w},
-% after grabbing as \cs{l_tl_analysis_char_token} the first character
+% We test for that in \cs{@@_i_space_test:w},
+% after grabbing as \cs{l_@@_char_token} the first character
% of the string representation.
-% Also, since \cs{tl_analysis_i_store:} expects the special token to be
+% Also, since \cs{@@_i_store:} expects the special token to be
% stored in the relevant \tn{toks} register, we do that. The extra
% \cs{exp_not:n} is unnecessary of course, but it makes the treatment
% of all tokens more homogeneous.
@@ -555,30 +559,30 @@
% so that the second pass does not need to test the meaning of tokens,
% only strings.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \tl_analysis_i_space:w
+\cs_new_protected_nopar:Npn \@@_i_space:w
{
- \tex_afterassignment:D \tl_analysis_i_space_test:w
+ \tex_afterassignment:D \@@_i_space_test:w
\exp_after:wN \cs_set_eq:NN
- \exp_after:wN \l_tl_analysis_char_token
+ \exp_after:wN \l_@@_char_token
\token_to_str:N
}
-\cs_new_protected_nopar:Npn \tl_analysis_i_space_test:w
+\cs_new_protected_nopar:Npn \@@_i_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_i_store:
+ \if_meaning:w \l_@@_char_token \c_space_token
+ \tex_toks:D \l_@@_index_int { \exp_not:n { ~ } }
+ \@@_i_store:
\else:
- \int_incr:N \l_tl_analysis_normal_int
+ \int_incr:N \l_@@_normal_int
\fi:
- \tl_analysis_i_loop:w
+ \@@_i_loop:w
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\tl_analysis_i_bgroup:w, \tl_analysis_i_egroup:w}
-% \begin{macro}[aux]{\tl_analysis_i_group:nw}
-% \begin{macro}[aux]{\tl_analysis_i_group_test:w}
+% \begin{macro}[int]{\@@_i_bgroup:w, \@@_i_egroup:w}
+% \begin{macro}[aux]{\@@_i_group:nw}
+% \begin{macro}[aux]{\@@_i_group_test:w}
% The token might be either a true character token with
% catcode $1$ or $2$, or it could be a control sequence.
% The only tricky case is if the character code happens
@@ -588,50 +592,50 @@
% and of a control sequence set equal to it start differently.
% Then probe what the first character of that string
% representation is: this is the place where we need
-% \cs{l_tl_analysis_char_token} to be a separate control
-% sequence from \cs{l_tl_analysis_token}, to compare them.
+% \cs{l_@@_char_token} to be a separate control
+% sequence from \cs{l_@@_token}, to compare them.
% \begin{macrocode}
\group_begin:
\char_set_catcode_group_begin:N \^^@
\char_set_catcode_group_end:N \^^E
- \cs_new_protected_nopar:Npn \tl_analysis_i_bgroup:w
- { \tl_analysis_i_group:nw { \exp_after:wN ^^@ \if_false: ^^E \fi: } }
+ \cs_new_protected_nopar:Npn \@@_i_bgroup:w
+ { \@@_i_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_nopar:Npn \tl_analysis_i_egroup:w
- { \tl_analysis_i_group:nw { \if_false: ^^B \fi: ^^@ } }
+ \cs_new_protected_nopar:Npn \@@_i_egroup:w
+ { \@@_i_group:nw { \if_false: ^^B \fi: ^^@ } }
\group_end:
-\cs_new_protected:Npn \tl_analysis_i_group:nw #1
+\cs_new_protected:Npn \@@_i_group:nw #1
{
- \tex_lccode:D \c_zero = \tl_analysis_extract_charcode: \scan_stop:
- \tl_to_lowercase:n { \tex_toks:D \l_tl_analysis_index_int {#1} }
- \if_num:w \tex_lccode:D \c_zero = \tex_escapechar:D
+ \tex_lccode:D \c_zero = \@@_extract_charcode: \scan_stop:
+ \tl_to_lowercase:n { \tex_toks:D \l_@@_index_int {#1} }
+ \if_int_compare:w \tex_lccode:D \c_zero = \tex_escapechar:D
\int_set:Nn \tex_escapechar:D { 139 - \tex_escapechar:D }
\fi:
- \tex_afterassignment:D \tl_analysis_i_group_test:w
+ \tex_afterassignment:D \@@_i_group_test:w
\exp_after:wN \cs_set_eq:NN
- \exp_after:wN \l_tl_analysis_char_token
+ \exp_after:wN \l_@@_char_token
\token_to_str:N
}
-\cs_new_protected_nopar:Npn \tl_analysis_i_group_test:w
+\cs_new_protected_nopar:Npn \@@_i_group_test:w
{
- \if_charcode:w \l_tl_analysis_token \l_tl_analysis_char_token
- \tl_analysis_i_store:
+ \if_charcode:w \l_@@_token \l_@@_char_token
+ \@@_i_store:
\else:
- \int_incr:N \l_tl_analysis_normal_int
+ \int_incr:N \l_@@_normal_int
\fi:
- \tl_analysis_i_loop:w
+ \@@_i_loop:w
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\tl_analysis_i_store:}
+% \begin{macro}[int]{\@@_i_store:}
% This function is called each time we meet a special token;
-% at this point, the \tn{toks} register \cs{l_tl_analysis_index_int}
+% at this point, the \tn{toks} register \cs{l_@@_index_int}
% holds a token list which expands to the given special token.
-% Also, the value of \cs{l_tl_analysis_type_int} indicates which case
+% Also, the value of \cs{l_@@_type_int} indicates which case
% we are in:
% \begin{itemize}
% \item -1 end-group character;
@@ -651,31 +655,31 @@
% \item 2 space begin-group character.
% \end{itemize}
% This has the property that non-space characters correspond to odd
-% values of \cs{l_tl_analysis_type_int}.
+% values of \cs{l_@@_type_int}.
% The number of normal tokens, and the type of special token,
% are packed into a \tn{skip} register.
% Finally, we check whether we reached the last closing brace, in which
% case we stop by disabling the looping function (locally).
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \tl_analysis_i_store:
+\cs_new_protected_nopar:Npn \@@_i_store:
{
- \tex_advance:D \l_tl_analysis_nesting_int \l_tl_analysis_type_int
- \if_num:w \tex_lccode:D \c_zero = \c_thirty_two
- \tex_multiply:D \l_tl_analysis_type_int \c_two
+ \tex_advance:D \l_@@_nesting_int \l_@@_type_int
+ \if_int_compare:w \tex_lccode:D \c_zero = \c_thirty_two
+ \tex_multiply:D \l_@@_type_int \c_two
\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_num:w \l_tl_analysis_nesting_int = \c_minus_one
- \cs_set_eq:NN \tl_analysis_i_loop:w \scan_stop:
+ \tex_skip:D \l_@@_index_int
+ = \l_@@_normal_int sp plus \l_@@_type_int sp \scan_stop:
+ \int_incr:N \l_@@_index_int
+ \int_zero:N \l_@@_normal_int
+ \if_int_compare:w \l_@@_nesting_int = \c_minus_one
+ \cs_set_eq:NN \@@_i_loop:w \scan_stop:
\fi:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\tl_analysis_i_safe:N}
-% \begin{macro}[aux]{\tl_analysis_i_cs:ww}
+% \begin{macro}[int]{\@@_i_safe:N}
+% \begin{macro}[aux]{\@@_i_cs:ww}
% This should be the simplest case: since the upcoming token is safe,
% we can simply grab it in a second pass. However, other branches of
% the code must pass their tokens through \tn{string}, hence we do it
@@ -689,32 +693,32 @@
% if the control sequence name contains no space, count that token
% as a number of normal tokens equal to its string length. If the
% control sequence contains spaces, they should be registered as
-% special characters by increasing \cs{l_tl_analysis_index_int}
+% special characters by increasing \cs{l_@@_index_int}
% (no need to carefully count character between each space), and
% all characters after the last space should be counted in the
% following sequence of \enquote{normal} tokens.
% \begin{macrocode}
-\cs_new_protected:Npn \tl_analysis_i_safe:N #1
+\cs_new_protected:Npn \@@_i_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
+ \int_incr:N \l_@@_normal_int
\else:
- \tl_analysis_cs_space_count:NN \tl_analysis_i_cs:ww #1
+ \@@_cs_space_count:NN \@@_i_cs:ww #1
\fi:
- \tl_analysis_i_loop:w
+ \@@_i_loop:w
}
-\cs_new_protected:Npn \tl_analysis_i_cs:ww #1; #2;
+\cs_new_protected:Npn \@@_i_cs:ww #1; #2;
{
- \if_num:w #1 > \c_zero
- \tex_skip:D \l_tl_analysis_index_int
- = \int_eval:w \l_tl_analysis_normal_int + \c_one sp \scan_stop:
- \tex_advance:D \l_tl_analysis_index_int #1 \exp_stop_f:
- \l_tl_analysis_normal_int #2 \exp_stop_f:
+ \if_int_compare:w #1 > \c_zero
+ \tex_skip:D \l_@@_index_int
+ = \__int_eval:w \l_@@_normal_int + \c_one sp \scan_stop:
+ \tex_advance:D \l_@@_index_int #1 \exp_stop_f:
+ \l_@@_normal_int #2 \exp_stop_f:
\else:
- \tex_advance:D \l_tl_analysis_normal_int #2 \exp_stop_f:
+ \tex_advance:D \l_@@_normal_int #2 \exp_stop_f:
\fi:
}
% \end{macrocode}
@@ -727,60 +731,60 @@
% All the necessary information is stored in \tn{skip}
% and \tn{toks} registers.
%
-% \begin{macro}[int]{\tl_analysis_ii:n}
-% \begin{macro}[int, EXP]{\tl_analysis_ii_loop:w}
+% \begin{macro}[int]{\@@_ii:n}
+% \begin{macro}[int, EXP]{\@@_ii_loop:w}
% Start the loop with the index $0$. No need for an end-marker:
% the loop will stop by itself when the last index is read.
% We will repeatedly oscillate between reading long stretches
% of normal tokens, and reading special tokens.
% \begin{macrocode}
-\cs_new_protected:Npn \tl_analysis_ii:n #1
+\cs_new_protected:Npn \@@_ii:n #1
{
- \tl_gset:Nx \g_tl_analysis_result_tl
+ \tl_gset:Nx \g_@@_result_tl
{
- \tl_analysis_ii_loop:w 0; #1
- \prg_break_point:n { }
+ \@@_ii_loop:w 0; #1
+ \__prg_break_point:
}
}
-\cs_new:Npn \tl_analysis_ii_loop:w #1;
+\cs_new:Npn \@@_ii_loop:w #1;
{
- \exp_after:wN \tl_analysis_ii_normals:ww
- \int_value:w \tex_skip:D #1 ; #1 ;
+ \exp_after:wN \@@_ii_normals:ww
+ \__int_value:w \tex_skip:D #1 ; #1 ;
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int, EXP]{\tl_analysis_ii_normals:ww}
-% \begin{macro}[aux, EXP]{\tl_analysis_ii_normal:wwN}
+% \begin{macro}[int, EXP]{\@@_ii_normals:ww}
+% \begin{macro}[aux, EXP]{\@@_ii_normal:wwN}
% The first argument is the number of normal tokens which remain
% to be read, and the second argument is the index in the array
% produced in the first step.
% A character's string representation is always one character long,
% while a control sequence is always longer (we have set the escape
% character to a printable value). In both cases, we leave
-% \cs{exp_not:n} \Arg{token} \cs{s_tl} in the input stream
+% \cs{exp_not:n} \Arg{token} \cs{s__tl} in the input stream
% (after \texttt{x}-expansion). Here, \cs{exp_not:n} is used
-% rather than \cs{exp_not:N} because |#3| could be \cs{s_tl},
+% rather than \cs{exp_not:N} because |#3| could be \cs{s__tl},
% hence must be hidden behind braces in the result.
% \begin{macrocode}
-\cs_new:Npn \tl_analysis_ii_normals:ww #1;
+\cs_new:Npn \@@_ii_normals:ww #1;
{
- \if_num:w #1 = \c_zero
- \tl_analysis_ii_special:w
+ \if_int_compare:w #1 = \c_zero
+ \@@_ii_special:w
\fi:
- \tl_analysis_ii_normal:wwN #1;
+ \@@_ii_normal:wwN #1;
}
-\cs_new:Npn \tl_analysis_ii_normal:wwN #1; #2; #3
+\cs_new:Npn \@@_ii_normal:wwN #1; #2; #3
{
- \exp_not:n { \exp_not:n { #3 } } \s_tl
+ \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_ii_char:Nww
+ \exp_after:wN \@@_ii_char:Nww
\else:
- \exp_after:wN \tl_analysis_ii_cs:Nww
+ \exp_after:wN \@@_ii_cs:Nww
\fi:
#3 #1; #2;
}
@@ -788,10 +792,10 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int, EXP]{\tl_analysis_ii_char:Nww}
+% \begin{macro}[int, EXP]{\@@_ii_char:Nww}
% If the normal token we grab is a character, leave
-% \meta{catcode} \meta{charcode} followed by \cs{s_tl}
-% in the input stream, and call \cs{tl_analysis_ii_normals:ww}
+% \meta{catcode} \meta{charcode} followed by \cs{s__tl}
+% in the input stream, and call \cs{@@_ii_normals:ww}
% with its first argument decremented.
% \begin{macrocode}
\group_begin:
@@ -801,7 +805,7 @@
\char_set_uccode:nn { `? } { `D }
\tl_to_uppercase:n
{
- \cs_new:Npn \tl_analysis_ii_char:Nww #1
+ \cs_new:Npn \@@_ii_char:Nww #1
{
\if_meaning:w #1 \c_undefined:D ? \else:
\if_catcode:w #1 \c_catcode_other_token C \else:
@@ -813,47 +817,47 @@
\if_catcode:w #1 \c_space_token A \else:
6
\fi: \fi: \fi: \fi: \fi: \fi: \fi: \fi:
- \int_value:w `#1 \s_tl
- \exp_after:wN \tl_analysis_ii_normals:ww
- \int_use:N \int_eval:w \c_minus_one +
+ \__int_value:w `#1 \s__tl
+ \exp_after:wN \@@_ii_normals:ww
+ \int_use:N \__int_eval:w \c_minus_one +
}
}
\group_end:
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int, EXP]{\tl_analysis_ii_cs:Nww}
-% \begin{macro}[aux, EXP]{\tl_analysis_ii_cs_test:ww}
+% \begin{macro}[int, EXP]{\@@_ii_cs:Nww}
+% \begin{macro}[aux, EXP]{\@@_ii_cs_test:ww}
% If the token we grab is a control sequence, leave
% |0 -1| (as category code and character code) in the input stream,
-% followed by \cs{s_tl},
-% and call \cs{tl_analysis_ii_normals:ww} with updated arguments.
+% followed by \cs{s__tl},
+% and call \cs{@@_ii_normals:ww} with updated arguments.
% \begin{macrocode}
-\cs_new:Npn \tl_analysis_ii_cs:Nww #1
+\cs_new:Npn \@@_ii_cs:Nww #1
{
- 0 -1 \s_tl
- \tl_analysis_cs_space_count:NN \tl_analysis_ii_cs_test:ww #1
+ 0 -1 \s__tl
+ \@@_cs_space_count:NN \@@_ii_cs_test:ww #1
}
-\cs_new:Npn \tl_analysis_ii_cs_test:ww #1 ; #2 ; #3 ; #4 ;
+\cs_new:Npn \@@_ii_cs_test:ww #1 ; #2 ; #3 ; #4 ;
{
- \exp_after:wN \tl_analysis_ii_normals:ww
- \int_use:N \int_eval:w
- \if_num:w #1 = \c_zero
+ \exp_after:wN \@@_ii_normals:ww
+ \int_use:N \__int_eval:w
+ \if_int_compare:w #1 = \c_zero
#3
\else:
- \tex_skip:D \int_eval:w #4 + #1 \int_eval_end:
+ \tex_skip:D \__int_eval:w #4 + #1 \__int_eval_end:
\fi:
- #2
\exp_after:wN ;
- \int_use:N \int_eval:w #4 + #1 ;
+ \int_use:N \__int_eval:w #4 + #1 ;
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int, EXP]{\tl_analysis_ii_special:w}
-% \begin{macro}[aux, EXP]{\tl_analysis_ii_special_char:wN}
-% \begin{macro}[aux, EXP]{\tl_analysis_ii_special_space:w}
+% \begin{macro}[int, EXP]{\@@_ii_special:w}
+% \begin{macro}[aux, EXP]{\@@_ii_special_char:wN}
+% \begin{macro}[aux, EXP]{\@@_ii_special_space:w}
% Here, |#1| is the current index in the array built in the first pass.
% Check now whether we reached the end (we shouldn't keep the trailing
% end-group character that marked the end of the token list in the
@@ -861,18 +865,18 @@
% Unpack the \tn{toks} register: when \texttt{x}-expanding again,
% we will get the special token.
% Then leave the category code in the input stream, followed by
-% the character code, and call \cs{tl_analysis_ii_loop:w} with the next index.
+% the character code, and call \cs{@@_ii_loop:w} with the next index.
% \begin{macrocode}
\group_begin:
\char_set_catcode_other:N A
- \cs_new:Npn \tl_analysis_ii_special:w
- \fi: \tl_analysis_ii_normal:wwN 0 ; #1 ;
+ \cs_new:Npn \@@_ii_special:w
+ \fi: \@@_ii_normal:wwN 0 ; #1 ;
{
\fi:
- \if_num:w #1 = \l_tl_analysis_index_int
- \exp_after:wN \prg_map_break:
+ \if_int_compare:w #1 = \l_@@_index_int
+ \exp_after:wN \__prg_break:
\fi:
- \tex_the:D \tex_toks:D #1 \s_tl
+ \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
@@ -880,23 +884,23 @@
\else: 2
\fi:
\if_int_odd:w \etex_gluestretch:D \tex_skip:D #1 \exp_stop_f:
- \exp_after:wN \tl_analysis_ii_special_char:wN \int_use:N
+ \exp_after:wN \@@_ii_special_char:wN \int_use:N
\else:
- \exp_after:wN \tl_analysis_ii_special_space:w \int_use:N
+ \exp_after:wN \@@_ii_special_space:w \int_use:N
\fi:
- \int_eval:w \c_one + #1 \exp_after:wN ;
+ \__int_eval:w \c_one + #1 \exp_after:wN ;
\token_to_str:N
}
\group_end:
-\cs_new:Npn \tl_analysis_ii_special_char:wN #1 ; #2
+\cs_new:Npn \@@_ii_special_char:wN #1 ; #2
{
- \int_value:w `#2 \s_tl
- \tl_analysis_ii_loop:w #1 ;
+ \__int_value:w `#2 \s__tl
+ \@@_ii_loop:w #1 ;
}
-\cs_new:Npn \tl_analysis_ii_special_space:w #1 ; ~
+\cs_new:Npn \@@_ii_special_space:w #1 ; ~
{
- 32 \s_tl
- \tl_analysis_ii_loop:w #1 ;
+ 32 \s__tl
+ \@@_ii_loop:w #1 ;
}
% \end{macrocode}
% \end{macro}
@@ -905,38 +909,38 @@
%
% \subsection{Mapping through the analysis}
%
-% \begin{macro}[int]{\tl_analysis_map_inline:nn}
-% \begin{macro}[aux]{\tl_analysis_map_inline_aux:Nn}
+% \begin{macro}[int]{\@@_map_inline:nn}
+% \begin{macro}[aux]{\@@_map_inline_aux:Nn}
% First obtain the analysis of the token list into
-% \cs{g_tl_analysis_result_tl}. To allow nested mappings, increase the
-% nesting depth \cs{g_prg_map_int} (shared between all modules), then
+% \cs{g_@@_result_tl}. To allow nested mappings, increase the
+% nesting depth \cs{g__prg_map_int} (shared between all modules), then
% define the looping macro, which has a name specific to that nesting
% depth. That looping grabs the \meta{tokens}, \meta{catcode} and
% \meta{char code}; it checks for the end of the loop with
% \cs{use_none:n} |##2|, normally empty, but which becomes
-% \cs{prg_map_break:} at the end; it then performs the user's code
+% \cs{tl_map_break:} at the end; it then performs the user's code
% |#2|, and loops by calling itself. When the loop ends, remember to
% decrease the nesting depth.
% \begin{macrocode}
-\cs_new_protected:Npn \tl_analysis_map_inline:nn #1
+\cs_new_protected:Npn \@@_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 }
+ \@@:n {#1}
+ \int_gincr:N \g__prg_map_int
+ \exp_args:Nc \@@_map_inline_aux:Nn
+ { @@_map_inline_ \int_use:N \g__prg_map_int :wNw }
}
-\cs_new_protected:Npn \tl_analysis_map_inline_aux:Nn #1#2
+\cs_new_protected:Npn \@@_map_inline_aux:Nn #1#2
{
- \cs_gset_protected:Npn #1 ##1 \s_tl ##2 ##3 \s_tl
+ \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 { ? \prg_map_break: } \s_tl
- \prg_break_point:n { \int_gdecr:N \g_prg_map_int }
+ \g_@@_result_tl
+ \s__tl { ? \tl_map_break: } \s__tl
+ \__prg_break_point:Nn \tl_map_break: { \int_gdecr:N \g__prg_map_int }
}
% \end{macrocode}
% \end{macro}
@@ -946,29 +950,29 @@
%
% \begin{macro}{\tl_show_analysis:N}
% \begin{macro}{\tl_show_analysis:n}
-% Add to \cs{tl_analysis:n} a third pass to display tokens to the terminal.
+% Add to \cs{@@:n} a third pass to display tokens to the terminal.
% \begin{macrocode}
\cs_new_protected:Npn \tl_show_analysis:N #1
{
- \exp_args:No \tl_analysis:n {#1}
- \msg_aux_show:Nnx #1
+ \exp_args:No \@@:n {#1}
+ \__msg_show_variable:Nnn #1
{ tl-analysis }
{
- \exp_after:wN \tl_show_analysis_loop:wNw \g_tl_analysis_result_tl
- \s_tl { ? \prg_map_break: } \s_tl
- \prg_break_point:n { }
+ \exp_after:wN \@@_show_loop:wNw \g_@@_result_tl
+ \s__tl { ? \__prg_break: } \s__tl
+ \__prg_break_point:
}
}
\cs_new_protected:Npn \tl_show_analysis:n #1
{
- \tl_set:Nn \l_tl_analysis_internal_tl {#1}
- \tl_show_analysis:N \l_tl_analysis_internal_tl
+ \tl_set:Nn \l_@@_internal_tl {#1}
+ \tl_show_analysis:N \l_@@_internal_tl
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[aux, rEXP]{\tl_show_analysis_loop:wNw}
+% \begin{macro}[aux, rEXP]{\@@_show_loop:wNw}
% Here, |#1| \texttt{o}- and \texttt{x}-expands to the token;
% |#2| is the category code (one uppercase hexadecimal digit),
% $0$ for control sequences;
@@ -977,34 +981,34 @@
% the meaning may overflow one line, and we want to truncate
% it. Those cases are thus separated out.
% \begin{macrocode}
-\cs_new:Npn \tl_show_analysis_loop:wNw #1 \s_tl #2 #3 \s_tl
+\cs_new:Npn \@@_show_loop:wNw #1 \s__tl #2 #3 \s__tl
{
\use_none:n #2
\iow_newline: > \c_space_tl \c_space_tl
- \if_num:w "#2 = \c_zero
- \exp_after:wN \tl_show_analysis_cs:n
+ \if_int_compare:w "#2 = \c_zero
+ \exp_after:wN \@@_show_cs:n
\else:
- \if_num:w "#2 = \c_thirteen
+ \if_int_compare:w "#2 = \c_thirteen
\exp_after:wN \exp_after:wN
- \exp_after:wN \tl_show_analysis_active:n
+ \exp_after:wN \@@_show_active:n
\else:
\exp_after:wN \exp_after:wN
- \exp_after:wN \tl_show_analysis_normal:n
+ \exp_after:wN \@@_show_normal:n
\fi:
\fi:
{#1}
- \tl_show_analysis_loop:wNw
+ \@@_show_loop:wNw
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux, rEXP]{\tl_show_analysis_normal:n}
+% \begin{macro}[aux, rEXP]{\@@_show_normal:n}
% Non-active characters are a simple matter of printing
% the character, and its meaning. Our test suite checks that
% begin-group and end-group characters do not mess up
% \TeX{}'s alignment status.
% \begin{macrocode}
-\cs_new:Npn \tl_show_analysis_normal:n #1
+\cs_new:Npn \@@_show_normal:n #1
{
\exp_after:wN \token_to_str:N #1 ~
( \exp_after:wN \token_to_meaning:N #1 )
@@ -1012,63 +1016,63 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[EXP]{\tl_show_analysis_value:N}
+% \begin{macro}[EXP]{\@@_show_value:N}
% This expands to the value of |#1| if it has any.
% \begin{macrocode}
-\cs_new:Npn \tl_show_analysis_value:N #1
+\cs_new:Npn \@@_show_value:N #1
{
\token_if_expandable:NF #1
{
- \token_if_chardef:NTF #1 \prg_map_break: { }
- \token_if_mathchardef:NTF #1 \prg_map_break: { }
- \token_if_dim_register:NTF #1 \prg_map_break: { }
- \token_if_int_register:NTF #1 \prg_map_break: { }
- \token_if_skip_register:NTF #1 \prg_map_break: { }
- \token_if_toks_register:NTF #1 \prg_map_break: { }
- \use_none:nnnn
- \prg_break_point:n { }
+ \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 { = \tex_the:D #1 }
}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux, rEXP]{\tl_show_analysis_cs:n}
-% \begin{macro}[aux, rEXP]{\tl_show_analysis_active:n}
-% \begin{macro}[aux, rEXP]{\tl_show_analysis_long:nn}
-% \begin{macro}[aux, rEXP]{\tl_show_analysis_long_aux:nnnn}
+% \begin{macro}[aux, rEXP]{\@@_show_cs:n}
+% \begin{macro}[aux, rEXP]{\@@_show_active:n}
+% \begin{macro}[aux, rEXP]{\@@_show_long:nn}
+% \begin{macro}[aux, rEXP]{\@@_show_long_aux:nnnn}
% Control sequences and active characters are printed in the same way,
-% making sure not to go beyond the \cs{l_iow_line_length_int}. In case
+% making sure not to go beyond the \cs{l_iow_line_count_int}. In case
% of an overflow, we replace the last characters by
-% \cs{c_tl_show_analysis_etc_str}.
+% \cs{c_@@_show_etc_str}.
% \begin{macrocode}
-\cs_new:Npn \tl_show_analysis_cs:n #1
- { \exp_args:No \tl_show_analysis_long:nn {#1} { control~sequence= } }
-\cs_new:Npn \tl_show_analysis_active:n #1
- { \exp_args:No \tl_show_analysis_long:nn {#1} { active~character= } }
-\cs_new:Npn \tl_show_analysis_long:nn #1
+\cs_new:Npn \@@_show_cs:n #1
+ { \exp_args:No \@@_show_long:nn {#1} { control~sequence= } }
+\cs_new:Npn \@@_show_active:n #1
+ { \exp_args:No \@@_show_long:nn {#1} { active~character= } }
+\cs_new:Npn \@@_show_long:nn #1
{
- \tl_show_analysis_long_aux:oofn
+ \@@_show_long_aux:oofn
{ \token_to_str:N #1 }
{ \token_to_meaning:N #1 }
- { \tl_show_analysis_value:N #1 }
+ { \@@_show_value:N #1 }
}
-\cs_new:Npn \tl_show_analysis_long_aux:nnnn #1#2#3#4
+\cs_new:Npn \@@_show_long_aux:nnnn #1#2#3#4
{
\int_compare:nNnTF
- { \str_length:n { #1 ~ ( #4 #2 #3 ) } }
- > { \l_iow_line_length_int - \c_three }
+ { \str_count:n { #1 ~ ( #4 #2 #3 ) } }
+ > { \l_iow_line_count_int - \c_three }
{
- \str_substr:nnn { #1 ~ ( #4 #2 #3 ) } \c_zero
+ \str_substr:nnn { #1 ~ ( #4 #2 #3 ) } \c_one
{
- \l_iow_line_length_int - \c_three
- - \str_length:N \c_tl_show_analysis_etc_str
+ \l_iow_line_count_int - \c_three
+ - \str_count:N \c_@@_show_etc_str
}
- \c_tl_show_analysis_etc_str
+ \c_@@_show_etc_str
}
{ #1 ~ ( #4 #2 #3 ) }
}
-\cs_generate_variant:Nn \tl_show_analysis_long_aux:nnnn { oof }
+\cs_generate_variant:Nn \@@_show_long_aux:nnnn { oof }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1077,21 +1081,21 @@
%
% \subsection{Messages}
%
-% \begin{variable}{\c_tl_show_analysis_etc_str}
+% \begin{variable}{\c_@@_show_etc_str}
% When a control sequence (or active character)
% and its meaning are too long to fit in one line
% of the terminal, the end is replaced by this token list.
% \begin{macrocode}
-\tl_const:Nx \c_tl_show_analysis_etc_str % (
+\tl_const:Nx \c_@@_show_etc_str % (
{ \token_to_str:N \ETC.) }
% \end{macrocode}
% \end{variable}
%
% \begin{macrocode}
-\msg_kernel_new:nnn { tl-analysis } { show }
+\__msg_kernel_new:nnn { kernel } { show-tl-analysis }
{
The~token~list~
- \str_if_eq:nnF {#1} { \l_tl_analysis_internal_tl }
+ \str_if_eq:nnF {#1} { \l_@@_internal_tl }
{ \token_to_str:N #1 ~ }
\tl_if_empty:NTF #1
{ is~empty }
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-build.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-build.dtx
index d3fa2d4e366..ad4d20f7aba 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-build.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-build.dtx
@@ -36,7 +36,7 @@
%<*driver|package>
\RequirePackage{expl3}
\GetIdInfo$Id: l3tl-build.dtx 3039 2011-12-08 09:22:35Z bruno $
- {L3 Experimental Build of Token lists}
+ {L3 Experimental token list construction}
%</driver|package>
%<*driver>
\documentclass[full]{l3doc}
@@ -71,7 +71,8 @@
%
% \section{\pkg{l3tl-build} documentation}
%
-% This module provides no user function.
+% This module provides no user function: it is meant for kernel use
+% only.
%
% There are two main ways of building token lists from individual
% tokens. Either in one go within an \texttt{x}-expanding assignment, or
@@ -103,37 +104,37 @@
%
% \begin{function}
% {
-% \tl_set_build:Nw, \tl_gset_build:Nw,
-% \tl_set_build_x:Nw, \tl_gset_build_x:Nw
+% \__tl_build:Nw, \__tl_gbuild:Nw,
+% \__tl_build_x:Nw, \__tl_gbuild_x:Nw
% }
% \begin{syntax}
-% \cs{tl_set_build:Nw} \meta{tl~var} \texttt{\ldots{}}
-% \cs{tl_build_one:n} \Arg{tokens_1} \texttt{\ldots{}}
-% \cs{tl_build_one:n} \Arg{tokens_2} \texttt{\ldots{}}
+% \cs{__tl_build:Nw} \meta{tl~var} \texttt{\ldots{}}
+% \cs{__tl_build_one:n} \Arg{tokens_1} \texttt{\ldots{}}
+% \cs{__tl_build_one:n} \Arg{tokens_2} \texttt{\ldots{}}
% \ldots{}
-% \cs{tl_build_end:}
+% \cs{__tl_build_end:}
% \end{syntax}
% Defines the \meta{tl~var} to contain the contens of \meta{tokens1}
% followed by \meta{tokens2}, \emph{etc.} This is built in such a way
% to be more efficient than repeatedly using \cs{tl_put_right:Nn}. The
% code in \enquote{\texttt{\ldots{}}} does not need to be
-% expandable. The commands \cs{tl_set_build:Nw} and \cs{tl_build_end:}
+% expandable. The commands \cs{__tl_build:Nw} and \cs{__tl_build_end:}
% start and end a group. The assignment to the \meta{tl~var} occurs
% just after the end of that group, using \cs{tl_set:Nn},
% \cs{tl_gset:Nn}, \cs{tl_set:Nx}, or \cs{tl_gset:Nx}.
% \end{function}
%
-% \begin{function}{\tl_build_one:n, \tl_build_one:o, \tl_build_one:x}
+% \begin{function}{\__tl_build_one:n, \__tl_build_one:o, \__tl_build_one:x}
% \begin{syntax}
-% \cs{tl_build_one:n} \Arg{tokens}
+% \cs{__tl_build_one:n} \Arg{tokens}
% \end{syntax}
% This function may only be used within the scope of a
-% \cs{tl_set_build:Nw} function. It adds the \meta{tokens} on the
+% \cs{__tl_build:Nw} function. It adds the \meta{tokens} on the
% right of the current token list.
% \end{function}
%
-% \begin{function}{\tl_build_end:}
-% Ends the scope started by \cs{tl_set_build:Nw}, and performs the
+% \begin{function}{\__tl_build_end:}
+% Ends the scope started by \cs{__tl_build:Nw}, and performs the
% relevant assignment.
% \end{function}
%
@@ -148,36 +149,40 @@
% \end{macrocode}
%
% \begin{macrocode}
+%<@@=tl_build>
+% \end{macrocode}
+%
+% \begin{macrocode}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
% \end{macrocode}
%
% \subsection{Variables and helper functions}
%
-% \begin{variable}{\l_tl_build_start_index_int, \l_tl_build_index_int}
+% \begin{variable}{\l_@@_start_index_int, \l_@@_index_int}
% Integers pointing to the starting index (currently always starts at
% zero), and the current index. The corresponding \tn{toks} are
% accessed directly by number.
% \begin{macrocode}
-\int_new:N \l_tl_build_start_index_int
-\int_new:N \l_tl_build_index_int
+\int_new:N \l_@@_start_index_int
+\int_new:N \l_@@_index_int
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_tl_build_result_tl}
+% \begin{variable}{\l_@@_result_tl}
% The resulting token list is normally built in one go by unpacking
% all \tn{toks} in some range. In the rare cases where there are too
-% many \cs{tl_build_one:n} commands, leading to the depletion of
+% many \cs{@@_one:n} commands, leading to the depletion of
% registers, the contents of the current set of \tn{toks} is unpacked
-% into \cs{l_tl_build_result_tl}. This prevents overflow from
+% into \cs{l_@@_result_tl}. This prevents overflow from
% affecting the end-user (beyond an obvious performance hit).
% \begin{macrocode}
-\tl_new:N \l_tl_build_result_tl
+\tl_new:N \l_@@_result_tl
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}{\tl_build_unpack:}
-% \begin{macro}[aux, EXP]{\tl_build_unpack_loop:w}
+% \begin{macro}{\@@_unpack:}
+% \begin{macro}[aux, EXP]{\@@_unpack_loop:w}
% The various pieces of the token list are built in \tn{toks} from the
% \texttt{start_index} (inclusive) to the (current) \texttt{index}
% (excluded). Those \tn{toks} are unpacked and stored in order in the
@@ -186,23 +191,23 @@
% expanding to |\the\toks#10...\the\toks#19|, but this should be kept
% for much later.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \tl_build_unpack:
+\cs_new_protected_nopar:Npn \@@_unpack:
{
- \tl_put_right:Nx \l_tl_build_result_tl
+ \tl_put_right:Nx \l_@@_result_tl
{
- \exp_after:wN \tl_build_unpack_loop:w
- \int_use:N \l_tl_build_start_index_int ;
- \prg_break_point:n { }
+ \exp_after:wN \@@_unpack_loop:w
+ \int_use:N \l_@@_start_index_int ;
+ \__prg_break_point:
}
}
-\cs_new:Npn \tl_build_unpack_loop:w #1 ;
+\cs_new:Npn \@@_unpack_loop:w #1 ;
{
- \if_num:w #1 = \l_tl_build_index_int
- \exp_after:wN \prg_map_break:
+ \if_int_compare:w #1 = \l_@@_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 + \c_one ;
+ \exp_after:wN \@@_unpack_loop:w
+ \int_use:N \__int_eval:w #1 + \c_one ;
}
% \end{macrocode}
% \end{macro}
@@ -212,83 +217,83 @@
%
% \begin{macro}
% {
-% \tl_set_build:Nw , \tl_set_build_x:Nw ,
-% \tl_gset_build:Nw , \tl_gset_build_x:Nw
+% \@@:Nw , \@@_x:Nw ,
+% \__tl_gbuild:Nw , \__tl_gbuild_x:Nw
% }
-% \begin{macro}[aux]{\tl_set_build_aux:NNw}
+% \begin{macro}[aux]{\@@_aux:NNw}
% Similar to what is done for coffins: redefine some command, here
-% \cs{tl_build_end_aux:n} to hold the relevant assignment (see
-% \cs{tl_build_end:} for details). Then initialize the start index and
+% \cs{@@_end_aux:n} to hold the relevant assignment (see
+% \cs{@@_end:} for details). Then initialize the start index and
% the current index at zero, and empty the \texttt{result} token list.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \tl_set_build:Nw
- { \tl_set_build_aux:NNw \tl_set:Nn }
-\cs_new_protected_nopar:Npn \tl_set_build_x:Nw
- { \tl_set_build_aux:NNw \tl_set:Nx }
-\cs_new_protected_nopar:Npn \tl_gset_build:Nw
- { \tl_set_build_aux:NNw \tl_gset:Nn }
-\cs_new_protected_nopar:Npn \tl_gset_build_x:Nw
- { \tl_set_build_aux:NNw \tl_gset:Nx }
-\cs_new_protected:Npn \tl_set_build_aux:NNw #1#2
+\cs_new_protected_nopar:Npn \@@:Nw
+ { \@@_aux:NNw \tl_set:Nn }
+\cs_new_protected_nopar:Npn \@@_x:Nw
+ { \@@_aux:NNw \tl_set:Nx }
+\cs_new_protected_nopar:Npn \__tl_gbuild:Nw
+ { \@@_aux:NNw \tl_gset:Nn }
+\cs_new_protected_nopar:Npn \__tl_gbuild_x:Nw
+ { \@@_aux:NNw \tl_gset:Nx }
+\cs_new_protected:Npn \@@_aux:NNw #1#2
{
\group_begin:
- \cs_set_nopar:Npn \tl_build_end_assignment:n
+ \cs_set_nopar:Npn \@@_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
+ \int_zero:N \l_@@_start_index_int
+ \int_zero:N \l_@@_index_int
+ \tl_clear:N \l_@@_result_tl
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\tl_build_end:}
-% \begin{macro}[aux]{\tl_build_end_assignment:n}
+% \begin{macro}{\@@_end:}
+% \begin{macro}[aux]{\@@_end_assignment:n}
% When we are done building a token list, unpack all \tn{toks} into
% the \texttt{result} token list, and expand this list before closing
-% the group. The \cs{tl_build_end_assignment:n} function is defined by
-% \cs{tl_set_build_aux:NNw} to end the group and hold the relevant
+% the group. The \cs{@@_end_assignment:n} function is defined by
+% \cs{@@_aux:NNw} to end the group and hold the relevant
% assignment. Its value outside is irrelevant, but just in case, we
% set it to a function which would clean up the contents of
-% \cs{l_tl_build_result_tl}.
+% \cs{l_@@_result_tl}.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \tl_build_end:
+\cs_new_protected_nopar:Npn \@@_end:
{
- \tl_build_unpack:
+ \@@_unpack:
\exp_args:No
- \tl_build_end_assignment:n \l_tl_build_result_tl
+ \@@_end_assignment:n \l_@@_result_tl
}
-\cs_new_eq:NN \tl_build_end_assignment:n \use_none:n
+\cs_new_eq:NN \@@_end_assignment:n \use_none:n
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\tl_build_one:n, \tl_build_one:o, \tl_build_one:x}
+% \begin{macro}{\@@_one:n, \@@_one:o, \@@_one:x}
% Store the tokens in a free \tn{toks}, then move the pointer to the
% next one. If we overflow, unpack the current \tn{toks}, and reset
% the current index, preparing to fill more \tn{toks}. This could be
% optimized by avoiding to read |#1|, using \tn{afterassignment}.
% \begin{macrocode}
-\cs_new_protected:Npn \tl_build_one:n #1
+\cs_new_protected:Npn \@@_one:n #1
{
- \tex_toks:D \l_tl_build_index_int {#1}
- \tex_advance:D \l_tl_build_index_int \c_one
- \if_num:w \l_tl_build_index_int > \c_max_register_int
- \tl_build_unpack:
- \l_tl_build_index_int \l_tl_build_start_index_int
+ \tex_toks:D \l_@@_index_int {#1}
+ \tex_advance:D \l_@@_index_int \c_one
+ \if_int_compare:w \l_@@_index_int > \c_max_register_int
+ \@@_unpack:
+ \l_@@_index_int \l_@@_start_index_int
\fi:
}
-\cs_new_protected:Npn \tl_build_one:o #1
+\cs_new_protected:Npn \@@_one:o #1
{
- \tex_toks:D \l_tl_build_index_int \exp_after:wN {#1}
- \tex_advance:D \l_tl_build_index_int \c_one
- \if_num:w \l_tl_build_index_int > \c_max_register_int
- \tl_build_unpack:
- \l_tl_build_index_int \l_tl_build_start_index_int
+ \tex_toks:D \l_@@_index_int \exp_after:wN {#1}
+ \tex_advance:D \l_@@_index_int \c_one
+ \if_int_compare:w \l_@@_index_int > \c_max_register_int
+ \@@_unpack:
+ \l_@@_index_int \l_@@_start_index_int
\fi:
}
-\cs_new_protected:Npn \tl_build_one:x #1
- { \use:x { \tl_build_one:n {#1} } }
+\cs_new_protected:Npn \@@_one:x #1
+ { \use:x { \@@_one:n {#1} } }
% \end{macrocode}
% \end{macro}
%
diff --git a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx
index f8639cd6807..0cee83f61ab 100644
--- a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx
@@ -36,7 +36,7 @@
%
%<*driver|package>
\RequirePackage{xparse}
-\GetIdInfo$Id: xcoffins.dtx 3483 2012-03-03 18:56:29Z bruno $
+\GetIdInfo$Id: xcoffins.dtx 3876 2012-06-30 15:35:39Z joseph $
{L3 Experimental design-level coffins}
%</driver|package>
%<*driver>
@@ -335,7 +335,7 @@
%
% \begin{function}{\ResizeCoffin}
% \begin{syntax}
-% \cs{RotateCoffin} \meta{coffin} \Arg{width} \Arg{total-height}
+% \cs{ResizeCoffin} \meta{coffin} \Arg{width} \Arg{total-height}
% \end{syntax}
% Resized the \meta{coffin} to \meta{width} and \meta{total-height},
% both of which should be given as dimension expressions. These may
@@ -618,7 +618,7 @@
%
% \begin{function}{\CoffinWidth}
% \begin{syntax}
-% \cs{CoffinHeight} \meta{coffin}
+% \cs{CoffinWidth} \meta{coffin}
% \end{syntax}
% Calculates the width of the \meta{coffin} in a form
% suitable for use in a \meta{dimension expression}, for example
@@ -702,6 +702,10 @@
% \begin{macrocode}
%<*package>
% \end{macrocode}
+%
+% \begin{macrocode}
+%<@@=coffin>
+% \end{macrocode}
%
% \begin{macrocode}
\ProvidesExplPackage
@@ -711,13 +715,13 @@
%
% \begin{variable}
% {
-% \l_coffin_A_hpole_tl ,
-% \l_coffin_A_vpole_tl ,
-% \l_coffin_B_hpole_tl ,
-% \l_coffin_B_vpole_tl ,
-% \l_coffin_bound_box_grow_bool ,
-% \l_coffin_hoffset_dim ,
-% \l_coffin_voffset_dim
+% \l_@@_A_hpole_tl ,
+% \l_@@_A_vpole_tl ,
+% \l_@@_B_hpole_tl ,
+% \l_@@_B_vpole_tl ,
+% \l_@@_bound_box_grow_bool ,
+% \l_@@_hoffset_dim ,
+% \l_@@_voffset_dim
% }
% Key--value definitions for the alignment system. With the exception
% of \texttt{grow-bounding-box}, all of these have to be given with a
@@ -725,19 +729,19 @@
% \begin{macrocode}
\keys_define:nn { coffin }
{
- coffin1-hpole .tl_set:N = \l_coffin_A_hpole_tl ,
+ coffin1-hpole .tl_set:N = \l_@@_A_hpole_tl ,
coffin1-hpole .value_required: ,
- coffin1-vpole .tl_set:N = \l_coffin_A_vpole_tl ,
+ coffin1-vpole .tl_set:N = \l_@@_A_vpole_tl ,
coffin1-vpole .value_required: ,
- coffin2-hpole .tl_set:N = \l_coffin_B_hpole_tl ,
+ coffin2-hpole .tl_set:N = \l_@@_B_hpole_tl ,
coffin2-hpole .value_required: ,
- coffin2-vpole .tl_set:N = \l_coffin_B_vpole_tl ,
+ coffin2-vpole .tl_set:N = \l_@@_B_vpole_tl ,
coffin2-vpole .value_required: ,
- grow-bounding-box .bool_set:N = \l_coffin_bound_box_grow_bool ,
+ grow-bounding-box .bool_set:N = \l_@@_bound_box_grow_bool ,
grow-bounding-box .default:n = true ,
- hoffset .dim_set:N = \l_coffin_hoffset_dim ,
+ hoffset .dim_set:N = \l_@@_hoffset_dim ,
hoffset .value_required: ,
- voffset .dim_set:N = \l_coffin_voffset_dim ,
+ voffset .dim_set:N = \l_@@_voffset_dim ,
voffset .value_required:
}
\keys_set:nn { coffin }
@@ -768,10 +772,10 @@
% \begin{macrocode}
\NewDocumentCommand \BoxToCoffin { m }
{
- \prop_clear_new:c { l_coffin_corners_ \int_value:w #1 _prop }
- \prop_clear_new:c { l_coffin_poles_ \int_value:w #1 _prop }
- \coffin_update_corners:N #1
- \coffin_update_poles:N #1
+ \prop_clear_new:c { l_@@_corners_ \__int_value:w #1 _prop }
+ \prop_clear_new:c { l_@@_poles_ \__int_value:w #1 _prop }
+ \@@_update_corners:N #1
+ \@@_update_poles:N #1
}
% \end{macrocode}
% \end{macro}
@@ -828,22 +832,22 @@
{
\group_begin:
\keys_set:nn { coffin } {#1}
- \tl_set:Nx \l_coffin_tmp_tl
+ \tl_set:Nx \l_@@_tmp_tl
{
\group_end:
- \bool_if:NTF \l_coffin_bound_box_grow_bool
+ \bool_if:NTF \l_@@_bound_box_grow_bool
{ \coffin_join:NnnNnnnn }
{ \coffin_attach:NnnNnnnn }
\exp_not:N #3
- { \exp_not:o { \l_coffin_A_hpole_tl } }
- { \exp_not:o { \l_coffin_A_vpole_tl } }
+ { \exp_not:o { \l_@@_A_hpole_tl } }
+ { \exp_not:o { \l_@@_A_vpole_tl } }
\exp_not:N #5
- { \exp_not:o { \l_coffin_B_hpole_tl } }
- { \exp_not:o { \l_coffin_B_vpole_tl } }
- { \dim_use:N \l_coffin_hoffset_dim }
- { \dim_use:N \l_coffin_voffset_dim }
+ { \exp_not:o { \l_@@_B_hpole_tl } }
+ { \exp_not:o { \l_@@_B_vpole_tl } }
+ { \dim_use:N \l_@@_hoffset_dim }
+ { \dim_use:N \l_@@_voffset_dim }
}
- \l_coffin_tmp_tl
+ \l_@@_tmp_tl
}
}
% \end{macrocode}
@@ -890,7 +894,7 @@
\NewDocumentCommand \CoffinHeight { m }
{ \coffin_ht:N #1 }
\NewDocumentCommand \CoffinTotalHeight { m }
- { \dim_eval:w \coffin_ht:N #1 + \coffin_dp:N #1 \dim_eval_end: }
+ { \__dim_eval:w \coffin_ht:N #1 + \coffin_dp:N #1 \__dim_eval_end: }
\NewDocumentCommand \CoffinWidth { m }
{ \coffin_wd:N #1 }
% \end{macrocode}
diff --git a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.ins b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.ins
index f57dc329b3c..f4289cf66fc 100644
--- a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.ins
+++ b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.ins
@@ -16,7 +16,7 @@ The released version of this bundle is available from CTAN.
\fi
-\input docstrip.tex
+\input l3docstrip.tex
\askforoverwritefalse
\preamble
diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx
index bb07281e01b..77b6456d15e 100644
--- a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx
@@ -37,7 +37,7 @@
%
%<*driver|package>
\RequirePackage{xparse}
-\GetIdInfo$Id: l3galley.dtx 3325 2012-02-06 22:07:00Z joseph $
+\GetIdInfo$Id: l3galley.dtx 3918 2012-07-05 00:32:37Z bruno $
{L3 Experimental galley code}
%</driver|package>
%<*driver>
@@ -172,6 +172,12 @@
% \end{function}
%
% \subsection{Between paragraphs}
+%
+% \begin{variable}{\g_galley_previous_par_lines_int}
+% The number of lines in the preceding conceptual paragraph. This may not
+% correspond to the \TeX{} \tn{prevgraf} primitive value as one conceptual
+% paragraph may contain several \TeX{} \tn{par} primitive tokens.
+% \end{variable}
%
% \begin{variable}{\g_galley_restore_running_tl}
% When galley settings need to be reset at the end of a paragraph, the
@@ -298,7 +304,7 @@
%
% \begin{variable}{\l_galley_par_indent_dim}
% Fixed space added to the start of each paragraph except for those where
-% \cs{l_galley_omit_next_indent_bool} is \texttt{true}.
+% \cs{g_galley_omit_next_indent_bool} is \texttt{true}.
% \end{variable}
%
% \begin{variable}{\l_galley_last_line_fit_int}
@@ -351,6 +357,12 @@
% the interaction of a display block with the paragraphs before and after it
% can be adjusted independent of the design of text.
% \end{function}
+%
+% \subsection{Hyphenation}
+%
+% \begin{variable}{\l_galley_hyphen_left_int}
+% THIS IS A HACK: SEE CODE!
+% \end{variable}
%
% \subsection{Line breaking}
%
@@ -552,9 +564,9 @@
%
% \section{Additional effects}
%
-% \begin{function}{\galley_end_par:n}
+% \begin{function}{\@@_end_par:n}
% \begin{syntax}
-% \cs{galley_end_par:n} \Arg{tokens}
+% \cs{@@_end_par:n} \Arg{tokens}
% \end{syntax}
% Adds the \meta{tokens} to the material collected for the last paragraph
% before finalising the last paragraph in the usual way. This function should
@@ -655,12 +667,15 @@
% \begin{macrocode}
%<*initex|package>
% \end{macrocode}
+%
+% \begin{macrocode}
+%<@@=galley>
+% \end{macrocode}
%
% \begin{macrocode}
%<*package>
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
-\package_check_loaded_expl:
%</package>
% \end{macrocode}
%
@@ -669,14 +684,6 @@
% Functions or settings which are needed by the galley but perhaps also
% elsewhere.
%
-% \begin{macro}{\galley_leave_vmode:}
-% The standard mode to leave vertical mode, starting a paragraph.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_leave_vmode:
- { \hbox_unpack:N \c_empty_box }
-% \end{macrocode}
-% \end{macro}
-%
% The default hyphenation character should be set and hyphenation should be
% enabled.
% \begin{macrocode}
@@ -692,24 +699,24 @@
%
% \begin{variable}
% {
-% \l_galley_parshape_left_indent_clist,
-% \l_galley_parshape_right_indent_clist
+% \l_@@_parshape_left_indent_clist,
+% \l_@@_parshape_right_indent_clist
% }
% \begin{variable}
% {
-% \l_galley_parshape_multipar_bool,
-% \l_galley_parshape_resume_std_bool,
-% \l_galley_parshape_fixed_lines_bool
+% \l_@@_parshape_multipar_bool,
+% \l_@@_parshape_resume_std_bool,
+% \l_@@_parshape_fixed_lines_bool
% }
% Setting up paragraph shape interacts with setting up the measure. The only
% way to keep things flexible is to have a rather \enquote{rich} set of data
% available.
% \begin{macrocode}
-\clist_new:N \l_galley_parshape_left_indent_clist
-\clist_new:N \l_galley_parshape_right_indent_clist
-\bool_new:N \l_galley_parshape_multipar_bool
-\bool_new:N \l_galley_parshape_resume_std_bool
-\bool_new:N \l_galley_parshape_fixed_lines_bool
+\clist_new:N \l_@@_parshape_left_indent_clist
+\clist_new:N \l_@@_parshape_right_indent_clist
+\bool_new:N \l_@@_parshape_multipar_bool
+\bool_new:N \l_@@_parshape_resume_std_bool
+\bool_new:N \l_@@_parshape_fixed_lines_bool
\int_new:N \l_galley_parshape_std_lines_int
% \end{macrocode}
% \end{variable}
@@ -745,7 +752,7 @@
% \end{variable}
%
% \begin{variable}
-% {\l_galley_interpar_penalty_skip, \l_galley_interpar_vspace_skip}
+% {\l_galley_interpar_penalty_int, \l_galley_interpar_vspace_skip}
% Items between paragraphs at the design level.
% \begin{macrocode}
\int_new:N \l_galley_interpar_penalty_int
@@ -770,18 +777,18 @@
% globally. To allow different galley levels to exist, a local variant is
% defined for each one to save the value when starting a new level.
%
-% \begin{variable}{\g_galley_begin_level_bool, \l_galley_begin_level_bool}
+% \begin{variable}{\g_@@_begin_level_bool, \l_@@_begin_level_bool}
% Indicates that the galley is at the very beginning of the level, and that
% no material has yet been set. As a result, the global version is set
% \texttt{true} to begin with.
% \begin{macrocode}
-\bool_new:N \g_galley_begin_level_bool
-\bool_new:N \l_galley_begin_level_bool
+\bool_new:N \g_@@_begin_level_bool
+\bool_new:N \l_@@_begin_level_bool
% \end{macrocode}
% \end{variable}
%
% \begin{variable}
-% {\g_galley_omit_next_indent_bool, \l_galley_omit_next_indent_bool}
+% {\g_galley_omit_next_indent_bool, \l_@@_omit_next_indent_bool}
% A global flag is needed for suppressing indentation of the next
% paragraph. This does not need a \enquote{running} version since that
% should be handled using the \texttt{justification} object: the two
@@ -790,65 +797,65 @@
% following a heading.
% \begin{macrocode}
\bool_new:N \g_galley_omit_next_indent_bool
-\bool_new:N \l_galley_omit_next_indent_bool
+\bool_new:N \l_@@_omit_next_indent_bool
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\g_galley_parshape_set_bool, \l_galley_parshape_set_bool}
+% \begin{variable}{\g_@@_parshape_set_bool, \l_@@_parshape_set_bool}
% This is not a setting for paragraph shape, but rather a tracker for the
% galley system.
% \begin{macrocode}
-\bool_new:N \g_galley_parshape_set_bool
-\bool_new:N \l_galley_parshape_set_bool
+\bool_new:N \g_@@_parshape_set_bool
+\bool_new:N \l_@@_parshape_set_bool
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\g_galley_nobreak_next_bool, \l_galley_nobreak_next_bool}
+% \begin{variable}{\g_galley_no_break_next_bool, \l_@@_no_break_next_bool}
% Dealing with the no-break flag is pretty much the same as the case
% for the indent: this applies on a single paragraph basis.
% \begin{macrocode}
-\bool_new:N \g_galley_nobreak_next_bool
-\bool_new:N \l_galley_nobreak_next_bool
+\bool_new:N \g_galley_no_break_next_bool
+\bool_new:N \l_@@_no_break_next_bool
% \end{macrocode}
% \end{variable}
%
% \begin{variable}
% {
-% \g_galley_par_begin_hook_tl, \l_galley_par_begin_hook_tl,
-% \g_galley_par_end_hook_tl, \l_galley_par_end_hook_tl,
+% \g_galley_par_begin_hook_tl, \l_@@_galley_par_begin_hook_tl,
+% \g_galley_par_end_hook_tl, \l_@@_galley_par_end_hook_tl,
% }
% Hooks for user-level code: these are not used by the galley itself.
% \begin{macrocode}
\tl_new:N \g_galley_par_begin_hook_tl
-\tl_new:N \l_galley_par_begin_hook_tl
+\tl_new:N \l_@@_galley_par_begin_hook_tl
\tl_new:N \g_galley_par_end_hook_tl
-\tl_new:N \l_galley_par_end_hook_tl
+\tl_new:N \l_@@_galley_par_end_hook_tl
% \end{macrocode}
% \end{variable}
%
% \begin{variable}
-% {\g_galley_par_after_hook_tl, \l_galley_par_after_hook_tl}
+% {\g_galley_par_after_hook_tl, \l_@@_par_after_hook_tl}
% This one is used by the galley: it happens \enquote{after} the current
% paragraph, and is used for reset purposes.
% \begin{macrocode}
\tl_new:N \g_galley_par_after_hook_tl
-\tl_new:N \l_galley_par_after_hook_tl
+\tl_new:N \l_@@_par_after_hook_tl
% \end{macrocode}
% \end{variable}
%
% \begin{variable}
-% {\g_galley_previous_par_lines_int, \l_galley_previous_par_lines_int}
+% {\g_galley_previous_par_lines_int, \l_@@_previous_par_lines_int}
% The number of lines in the previous typeset paragraph. This is reset at
% the start of the paragraph and \emph{added to} when each \cs{tex_par:D}
% primitive is used: \LaTeX{} uses the primitive in places that do not end
% a (conceptual) paragraph.
% \begin{macrocode}
\int_new:N \g_galley_previous_par_lines_int
-\int_new:N \l_galley_previous_par_lines_int
+\int_new:N \l_@@_previous_par_lines_int
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\g_galley_restore_running_tl, \l_galley_restore_running_tl}
+% \begin{variable}{\g_galley_restore_running_tl, \l_@@_restore_running_tl}
% When a parameter is altered from the \enquote{running} value to a
% different \enquote{current} one, there needs to be a method to restore
% the \enquote{running} value. This is done by adding the necessary
@@ -857,14 +864,14 @@
% structure, and so there has to be a local save version.
% \begin{macrocode}
\tl_new:N \g_galley_restore_running_tl
-\tl_new:N \l_galley_restore_running_tl
+\tl_new:N \l_@@_restore_running_tl
% \end{macrocode}
% \end{variable}
%
% \begin{variable}
% {
-% \g_galley_whatsit_next_tl, \l_galley_whatsit_next_tl,
-% \g_galley_whatsit_previous_tl, \l_galley_whatsit_previous_tl
+% \g_galley_whatsit_next_tl, \l_@@_whatsit_next_tl,
+% \g_galley_whatsit_previous_tl, \l_@@_whatsit_previous_tl
% }
% Whatsits only apply on a per-paragraph basis and so there is no need
% to differentiate between current and running values. However, there
@@ -873,30 +880,30 @@
% paragraph.
% \begin{macrocode}
\tl_new:N \g_galley_whatsit_next_tl
-\tl_new:N \l_galley_whatsit_next_tl
+\tl_new:N \l_@@_whatsit_next_tl
\tl_new:N \g_galley_whatsit_previous_tl
-\tl_new:N \l_galley_whatsit_previous_tl
+\tl_new:N \l_@@_whatsit_previous_tl
% \end{macrocode}
% \end{variable}
%
% \begin{variable}
-% {\g_galley_interpar_penalty_user_tl, \l_galley_interpar_penalty_user_tl}
+% {\g_@@_interpar_penalty_user_tl, \l_@@_interpar_penalty_user_tl}
% The user may want to over-ride the penalty for a break between
% paragraphs, for example to prevent a break when the overall design
% allows one. This is handled using an additional penalty.
% \begin{macrocode}
-\tl_new:N \g_galley_interpar_penalty_user_tl
-\tl_new:N \l_galley_interpar_penalty_user_tl
+\tl_new:N \g_@@_interpar_penalty_user_tl
+\tl_new:N \l_@@_interpar_penalty_user_tl
% \end{macrocode}
% \end{variable}
%
% \begin{variable}
-% {\g_galley_interpar_vspace_user_tl, \l_galley_interpar_vspace_user_tl}
+% {\g_@@_interpar_vspace_user_tl, \l_@@_interpar_vspace_user_tl}
% Arbitrary vertical space can be inserted by the user on a one-off
% basis. This is used in place of any running space between paragraphs.
% \begin{macrocode}
-\tl_new:N \g_galley_interpar_vspace_user_tl
-\tl_new:N \l_galley_interpar_vspace_user_tl
+\tl_new:N \g_@@_interpar_vspace_user_tl
+\tl_new:N \l_@@_interpar_vspace_user_tl
% \end{macrocode}
% \end{variable}
%
@@ -908,38 +915,38 @@
% achieved by storing the data structures in \emph{local} variables. The
% later are only used to save and restore the global value, and so \TeX{}
% grouping will manage the values correctly. This implies that each
-% galley level must form a group: galley levels are tided to vertical
+% galley level must form a group: galley levels are tied to vertical
% boxes and so this is a reasonable requirements.
%
-% \begin{macro}{\galley_initialise_variables:}
+% \begin{macro}{\@@_initialise_variables:}
% At the start of a galley level, both the global and local variables
% will need to be reset to standard values. For example, the measure
% is set to the galley width and any paragraph shape is cleared.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_initialise_variables:
+\cs_new_protected_nopar:Npn \@@_initialise_variables:
{
- \bool_gset_true:N \g_galley_begin_level_bool
- \tl_gclear:N \g_galley_interpar_penalty_user_tl
- \tl_gclear:N \g_galley_interpar_vspace_user_tl
+ \bool_gset_true:N \g_@@_begin_level_bool
+ \tl_gclear:N \g_@@_interpar_penalty_user_tl
+ \tl_gclear:N \g_@@_interpar_vspace_user_tl
\bool_gset_true:N \g_galley_omit_next_indent_bool
- \bool_gset_false:N \g_galley_nobreak_next_bool
+ \bool_gset_false:N \g_galley_no_break_next_bool
\tl_gclear:N \g_galley_par_begin_hook_tl
\tl_gclear:N \g_galley_par_end_hook_tl
\tl_gclear:N \g_galley_par_after_hook_tl
- \bool_gset_false:N \g_galley_parshape_set_bool
+ \bool_gset_false:N \g_@@_parshape_set_bool
\int_gzero:N \g_galley_previous_par_lines_int
\tl_gclear:N \g_galley_restore_running_tl
\tl_gclear:N \g_galley_whatsit_previous_tl
\tl_gclear:N \g_galley_whatsit_next_tl
}
-\galley_initialise_variables:
+\@@_initialise_variables:
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\galley_initialise_settings:}
+% \begin{macro}{\@@_initialise_settings:}
% This sets the local values of the various galley settings.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_initialise_settings:
+\cs_new_protected_nopar:Npn \@@_initialise_settings:
{
\dim_set_eq:NN \l_galley_text_width_dim \l_galley_width_dim
\dim_zero:N \l_galley_total_left_margin_dim
@@ -948,84 +955,84 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\galley_save_parameters:, \galley_restore_parameters:}
+% \begin{macro}{\@@_save_parameters:, \@@_restore_parameters:}
% Saving and restoring parameters is carried out by a series of copy
% functions.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_save_parameters:
+\cs_new_protected_nopar:Npn \@@_save_parameters:
{
- \bool_set_eq:NN \l_galley_begin_level_bool
- \g_galley_begin_level_bool
- \tl_set_eq:NN \l_galley_interpar_penalty_user_tl
- \g_galley_interpar_penalty_user_tl
- \tl_set_eq:NN \l_galley_interpar_vspace_user_tl
- \g_galley_interpar_vspace_user_tl
- \bool_set_eq:NN \l_galley_omit_next_indent_bool
+ \bool_set_eq:NN \l_@@_begin_level_bool
+ \g_@@_begin_level_bool
+ \tl_set_eq:NN \l_@@_interpar_penalty_user_tl
+ \g_@@_interpar_penalty_user_tl
+ \tl_set_eq:NN \l_@@_interpar_vspace_user_tl
+ \g_@@_interpar_vspace_user_tl
+ \bool_set_eq:NN \l_@@_omit_next_indent_bool
\g_galley_omit_next_indent_bool
- \bool_set_eq:NN \l_galley_nobreak_next_bool
- \g_galley_nobreak_next_bool
- \tl_set_eq:NN \l_galley_par_begin_hook_tl
+ \bool_set_eq:NN \l_@@_no_break_next_bool
+ \g_galley_no_break_next_bool
+ \tl_set_eq:NN \l_@@_galley_par_begin_hook_tl
\g_galley_par_begin_hook_tl
- \tl_set_eq:NN \l_galley_par_end_hook_tl
+ \tl_set_eq:NN \l_@@_galley_par_end_hook_tl
\g_galley_par_end_hook_tl
- \tl_set_eq:NN \l_galley_par_after_hook_tl
+ \tl_set_eq:NN \l_@@_par_after_hook_tl
\g_galley_par_after_hook_tl
- \bool_set_eq:NN \l_galley_parshape_set_bool
- \g_galley_parshape_set_bool
- \int_set_eq:NN \l_galley_previous_par_lines_int
+ \bool_set_eq:NN \l_@@_parshape_set_bool
+ \g_@@_parshape_set_bool
+ \int_set_eq:NN \l_@@_previous_par_lines_int
\g_galley_previous_par_lines_int
- \tl_set_eq:NN \l_galley_restore_running_tl
+ \tl_set_eq:NN \l_@@_restore_running_tl
\g_galley_restore_running_tl
- \tl_set_eq:NN \l_galley_whatsit_previous_tl
+ \tl_set_eq:NN \l_@@_whatsit_previous_tl
\g_galley_whatsit_previous_tl
- \tl_set_eq:NN \l_galley_whatsit_next_tl
+ \tl_set_eq:NN \l_@@_whatsit_next_tl
\g_galley_whatsit_next_tl
}
-\cs_new_protected_nopar:Npn \galley_restore_parameters:
+\cs_new_protected_nopar:Npn \@@_restore_parameters:
{
- \bool_gset_eq:NN \g_galley_begin_level_bool
- \l_galley_begin_level_bool
- \tl_gset_eq:NN \g_galley_interpar_penalty_user_tl
- \l_galley_interpar_penalty_user_tl
- \tl_gset_eq:NN \g_galley_interpar_vspace_user_tl
- \l_galley_interpar_vspace_user_tl
+ \bool_gset_eq:NN \g_@@_begin_level_bool
+ \l_@@_begin_level_bool
+ \tl_gset_eq:NN \g_@@_interpar_penalty_user_tl
+ \l_@@_interpar_penalty_user_tl
+ \tl_gset_eq:NN \g_@@_interpar_vspace_user_tl
+ \l_@@_interpar_vspace_user_tl
\bool_gset_eq:NN \g_galley_omit_next_indent_bool
- \l_galley_omit_next_indent_bool
- \bool_gset_eq:NN \g_galley_nobreak_next_bool
- \l_galley_nobreak_next_bool
+ \l_@@_omit_next_indent_bool
+ \bool_gset_eq:NN \g_galley_no_break_next_bool
+ \l_@@_no_break_next_bool
\tl_gset_eq:NN \g_galley_par_begin_hook_tl
- \l_galley_par_begin_hook_tl
+ \l_@@_galley_par_begin_hook_tl
\tl_gset_eq:NN \g_galley_par_end_hook_tl
- \l_galley_par_end_hook_tl
+ \l_@@_galley_par_end_hook_tl
\tl_gset_eq:NN \g_galley_par_after_hook_tl
- \l_galley_par_after_hook_tl
- \bool_gset_eq:NN \g_galley_parshape_set_bool
- \l_galley_parshape_set_bool
+ \l_@@_par_after_hook_tl
+ \bool_gset_eq:NN \g_@@_parshape_set_bool
+ \l_@@_parshape_set_bool
\int_gset_eq:NN \g_galley_previous_par_lines_int
- \l_galley_previous_par_lines_int
+ \l_@@_previous_par_lines_int
\tl_gset_eq:NN \g_galley_restore_running_tl
- \l_galley_restore_running_tl
+ \l_@@_restore_running_tl
\tl_gset_eq:NN \g_galley_whatsit_previous_tl
- \l_galley_whatsit_previous_tl
+ \l_@@_whatsit_previous_tl
\tl_gset_eq:NN \g_galley_whatsit_next_tl
- \l_galley_whatsit_next_tl
+ \l_@@_whatsit_next_tl
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\galley_level:}
-% \begin{macro}[aux]{\galley_level_end:}
+% \begin{macro}[aux]{\@@_level_end:}
% Galley levels are created by saving all of the current global
% settings, starting a group then initialising both the local and global
% variables.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \galley_level:
{
- \galley_save_parameters:
+ \@@_save_parameters:
\group_begin:
- \galley_initialise_variables:
- \galley_initialise_settings:
- \group_insert_after:N \galley_level_end:
+ \@@_initialise_variables:
+ \@@_initialise_settings:
+ \group_insert_after:N \@@_level_end:
}
% \end{macrocode}
% At the end of the level, the global values are restored using the
@@ -1035,10 +1042,10 @@
% must come in a fixed location. All of this relies on the the
% \enquote{colour safe} group used inside a box.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_level_end:
+\cs_new_protected_nopar:Npn \@@_level_end:
{
\par
- \galley_restore_parameters:
+ \@@_restore_parameters:
\group_end:
}
% \end{macrocode}
@@ -1047,44 +1054,44 @@
%
% \subsection{The \cs{par} token}
%
-% \begin{variable}{\s_par_omit}
+% \begin{variable}{\s__par_omit}
% Used to indicate that a paragraph should be omitted.
% \begin{macrocode}
-\scan_new:N \s_par_omit
+\__scan_new:N \s__par_omit
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}{\galley_std_par:}
-% \begin{macro}[aux]{\galley_std_par_aux_i:, \galley_std_par_aux_ii:}
-% \begin{macro}[aux]{\galley_std_par_aux:N}
+% \begin{macro}{\@@_std_par:}
+% \begin{macro}[aux]{\@@_std_par_aux_i:, \@@_std_par_aux_ii:}
+% \begin{macro}[aux]{\@@_std_par_aux:N}
% The idea here is to expand the next token in exactly the same way as \TeX{}
% would do anyway. The \texttt{f}-type expansion will ignore any protection,
% but will stop at a scan marker. Thus the code can test for an
% \enquote{omit paragraph} marker.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_std_par:
+\cs_new_protected_nopar:Npn \@@_std_par:
{
- \s_par_omit
- \exp_after:wN \galley_std_par_aux_i: \tex_romannumeral:D - `0
+ \s__par_omit
+ \exp_after:wN \@@_std_par_aux_i: \tex_romannumeral:D - `0
}
-\cs_new_protected:Npn \galley_std_par_aux_i:
+\cs_new_protected:Npn \@@_std_par_aux_i:
{
- \peek_meaning:NTF \s_par_omit
- { \galley_std_par_aux:N }
- { \galley_std_par_aux_ii: }
+ \peek_meaning:NTF \s__par_omit
+ { \@@_std_par_aux:N }
+ { \@@_std_par_aux_ii: }
}
-\cs_new_protected:Npn \galley_std_par_aux:N #1
+\cs_new_protected:Npn \@@_std_par_aux:N #1
{
- \str_if_eq:xxF {#1} { \s_par_omit }
+ \str_if_eq_x:nnF {#1} { \s__par_omit }
{
- \galley_std_par_aux_ii:
+ \@@_std_par_aux_ii:
#1
}
}
% \end{macrocode}
% No marker, so really insert a paragraph. In vertical mode,
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_std_par_aux_ii:
+\cs_new_protected_nopar:Npn \@@_std_par_aux_ii:
{
\mode_if_vertical:TF
{ \tex_par:D }
@@ -1100,7 +1107,7 @@
% \begin{macrocode}
{
\g_galley_par_end_hook_tl
- \galley_set_measure_and_parshape:
+ \@@_set_measure_and_parshape:
\group_begin:
\tex_par:D
\group_end:
@@ -1121,17 +1128,17 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\galley_end_par:n}
+% \begin{macro}{\@@_end_par:n}
% Inserts tokens such that they are appended to the end of the last
% paragraph, using the paragraph-omitting system.
% \begin{macrocode}
-\cs_new_protected:Npn \galley_end_par:n #1
+\cs_new_protected:Npn \@@_end_par:n #1
{
- \s_par_omit
- \bool_if:nF \g_galley_begin_level_bool
+ \s__par_omit
+ \bool_if:nF \g_@@_begin_level_bool
{
#1
- \galley_std_par:
+ \@@_std_par:
}
}
% \end{macrocode}
@@ -1141,7 +1148,7 @@
% The meaning of the token \cs{par} itself starts off as a standard
% paragraph.
% \begin{macrocode}
-\cs_set_protected_nopar:Npn \par { \galley_std_par: }
+\cs_set_protected_nopar:Npn \par { \@@_std_par: }
% \end{macrocode}
% \end{macro}
%
@@ -1151,7 +1158,7 @@
% so this will only be needed in package mode.
% \begin{macrocode}
%<*package>
-\tl_set:Nn \@par { \galley_std_par: }
+\tl_set:Nn \@par { \@@_std_par: }
%</package>
% \end{macrocode}
% \end{macro}
@@ -1159,8 +1166,8 @@
% \subsection{Display levels}
%
% \begin{macro}{\galley_display_begin:, \galley_display_end:}
-% \begin{macro}[aux]{\galley_display_penalty:N, \galley_display_vspace:N}
-% \begin{macro}[aux]{\galley_display_par_setup:, \galley_display_par:}
+% \begin{macro}[aux]{\@@_display_penalty:N, \@@_display_vspace:N}
+% \begin{macro}[aux]{\@@_display_par_setup:, \@@_display_par:}
% Display items within the galley are a bit like galley levels: they
% may have different paragraph settings to the main part of the galley.
% On the other hand, unlike independent galleys they should inherit the
@@ -1170,15 +1177,15 @@
\cs_new_protected_nopar:Npn \galley_display_begin:
{
\group_begin:
- \galley_save_parameters:
+ \@@_save_parameters:
\mode_if_vertical:TF
{
- \galley_display_penalty:N \l_galley_display_begin_par_penalty_tl
- \galley_display_vspace:N \l_galley_display_begin_par_vspace_tl
+ \@@_display_penalty:N \l_galley_display_begin_par_penalty_tl
+ \@@_display_vspace:N \l_galley_display_begin_par_vspace_tl
}
{
- \galley_display_penalty:N \l_galley_display_begin_penalty_tl
- \galley_display_vspace:N \l_galley_display_begin_vspace_tl
+ \@@_display_penalty:N \l_galley_display_begin_penalty_tl
+ \@@_display_vspace:N \l_galley_display_begin_vspace_tl
}
\par
}
@@ -1188,7 +1195,7 @@
% token list, before setting up the value to the special value needed
% in this one case.
% \begin{macrocode}
-\cs_new_protected:Npn \galley_display_penalty:N #1
+\cs_new_protected:Npn \@@_display_penalty:N #1
{
\tl_if_empty:NF #1
{
@@ -1200,7 +1207,7 @@
\int_gset:Nn \g_galley_penalty_int {#1}
}
}
-\cs_new_protected:Npn \galley_display_vspace:N #1
+\cs_new_protected:Npn \@@_display_vspace:N #1
{
\tl_if_empty:NF #1
{
@@ -1223,12 +1230,12 @@
\cs_new_protected_nopar:Npn \galley_display_end:
{
\par
- \galley_restore_parameters:
+ \@@_restore_parameters:
\group_end:
%<*package>
\group_insert_after:N \group_insert_after:N
%</package>
- \group_insert_after:N \galley_display_par_setup:
+ \group_insert_after:N \@@_display_par_setup:
}
% \end{macrocode}
% The method used here is to assume that the next piece of horizontal
@@ -1237,10 +1244,10 @@
% \cs{par} token is then altered so that a check can be made to see if
% this assumption was correct.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_display_par_setup:
+\cs_new_protected_nopar:Npn \@@_display_par_setup:
{
\bool_gset_false:N \g_galley_omit_next_indent_bool
- \cs_set_eq:NN \par \galley_display_par:
+ \cs_set_eq:NN \par \@@_display_par:
}
% \end{macrocode}
% The \enquote{special} meaning of the paragraph token starts by putting
@@ -1253,24 +1260,24 @@
% case where \TeX{} is in horizontal mode then a \cs{tex_par:D} primitive
% is required in the same way as in \cs{galley_standard_par:}.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_display_par:
+\cs_new_protected_nopar:Npn \@@_display_par:
{
- \cs_set_eq:NN \par \galley_std_par:
+ \cs_set_eq:NN \par \@@_std_par:
\mode_if_vertical:TF
{
\par
\bool_gset_false:N \g_galley_omit_next_indent_bool
- \galley_display_penalty:N \l_galley_display_end_par_penalty_tl
- \galley_display_vspace:N \l_galley_display_end_par_vspace_tl
+ \@@_display_penalty:N \l_galley_display_end_par_penalty_tl
+ \@@_display_vspace:N \l_galley_display_end_par_vspace_tl
}
{
- \galley_set_measure_and_parshape:
+ \@@_set_measure_and_parshape:
\group_begin:
\tex_par:D
\group_end:
\int_gadd:Nn \g_galley_previous_par_lines_int \tex_prevgraf:D
- \galley_display_penalty:N \l_galley_display_end_penalty_tl
- \galley_display_vspace:N \l_galley_display_end_vspace_tl
+ \@@_display_penalty:N \l_galley_display_end_penalty_tl
+ \@@_display_vspace:N \l_galley_display_end_vspace_tl
}
}
% \end{macrocode}
@@ -1298,9 +1305,9 @@
%<*initex>
\tex_everypar:D % TEMP
{
- \bool_if:NTF \g_galley_begin_level_bool
- { \galley_start_paragraph_first: }
- { \galley_start_paragraph_std: }
+ \bool_if:NTF \g_@@_begin_level_bool
+ { \@@_start_paragraph_first: }
+ { \@@_start_paragraph_std: }
}
%</initex>
%<*package>
@@ -1310,9 +1317,9 @@
{
\tex_everypar:D
{
- \bool_if:NTF \g_galley_begin_level_bool
- { \galley_start_paragraph_first: }
- { \galley_start_paragraph_std: }
+ \bool_if:NTF \g_@@_begin_level_bool
+ { \@@_start_paragraph_first: }
+ { \@@_start_paragraph_std: }
\tex_the:D \everypar
}
}
@@ -1322,13 +1329,13 @@
%
% \subsection{The galley mechanism}
%
-% \begin{variable}{\g_galley_last_box}
+% \begin{variable}{\g_@@_last_box}
% A temporary box to hold the box inserted by \TeX{} when a paragraph
% is inserted with an indent. The galley actually inserts the space
% (\emph{i.e.}~\cs{tex_parindent:D} is globally zero), but there is
% still an empty box to test for.
% \begin{macrocode}
-\box_new:N \g_galley_last_box
+\box_new:N \g_@@_last_box
% \end{macrocode}
% \end{variable}
%
@@ -1341,7 +1348,7 @@
% \end{verbatim}
% and so anything applied here must be done globally.
%
-% \begin{macro}[int]{\galley_start_paragraph_std:}
+% \begin{macro}[int]{\@@_start_paragraph_std:}
% The routine at the start of a paragraph starts by removing any
% (empty) indent box from the vertical list. As there may be vertical
% mode items still to insert, a \cs{tex_par:D} primitive is used to
@@ -1352,48 +1359,48 @@
% tidied up before sorting out any items which have been set on a
% single-paragraph basis.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_start_paragraph_std:
+\cs_new_protected_nopar:Npn \@@_start_paragraph_std:
{
\group_begin:
- \box_gset_to_last:N \g_galley_last_box
+ \box_gset_to_last:N \g_@@_last_box
\tex_par:D
- \galley_insert_vertical_items:
+ \@@_insert_vertical_items:
\tex_everypar:D { }
\tex_noindent:D
\group_end:
\int_gzero:N \g_galley_previous_par_lines_int
- \galley_insert_horizontal_items:
- \galley_restore_running_parameters:
+ \@@_insert_horizontal_items:
+ \@@_restore_running_parameters:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\galley_start_paragraph_first:}
+% \begin{macro}[int]{\@@_start_paragraph_first:}
% For the very first paragraph in a galley, the code needs to avoid
% adding any unnecessary vertical items at the top as it will interfere with
% vertical positioning in \cs{tex_vtop:D}.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_start_paragraph_first:
+\cs_new_protected_nopar:Npn \@@_start_paragraph_first:
{
- \bool_gset_false:N \g_galley_begin_level_bool
+ \bool_gset_false:N \g_@@_begin_level_bool
\mode_if_horizontal:TF
{
\group_begin:
- \box_gset_to_last:N \g_galley_last_box
+ \box_gset_to_last:N \g_@@_last_box
\tex_par:D
- \galley_insert_vspace:
+ \@@_insert_vspace:
\tex_everypar:D { }
\tex_noindent:D
\group_end:
}
- { \galley_insert_vspace: }
- \galley_insert_horizontal_items:
- \galley_restore_running_parameters:
+ { \@@_insert_vspace: }
+ \@@_insert_horizontal_items:
+ \@@_restore_running_parameters:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\galley_insert_vertical_items, \galley_insert_vspace:}
+% \begin{macro}[int]{\@@_insert_vertical_items, \@@_insert_vspace:}
% The aim here is to insert the vertical items such that they attach to
% the correct place. This function is used as part of the \cs{tex_everypar:D}
% mechanism, meaning that the immediately-preceding item on the vertical
@@ -1404,52 +1411,52 @@
% or the running penalty unless the no-break flag is set. Finally,
% the inter-paragraph space is applied.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_insert_vertical_items:
+\cs_new_protected_nopar:Npn \@@_insert_vertical_items:
{
\g_galley_whatsit_previous_tl
\tl_gclear:N \g_galley_whatsit_previous_tl
- \tl_if_empty:NTF \g_galley_interpar_penalty_user_tl
+ \tl_if_empty:NTF \g_@@_interpar_penalty_user_tl
{
- \bool_if:NTF \g_galley_nobreak_next_bool
+ \bool_if:NTF \g_galley_no_break_next_bool
{ \tex_penalty:D \c_ten_thousand }
{ \tex_penalty:D \l_galley_interpar_penalty_int }
}
{
\tex_penalty:D
- \int_eval:w \g_galley_interpar_penalty_user_tl \int_eval_end:
- \tl_gclear:N \g_galley_interpar_penalty_user_tl
+ \__int_eval:w \g_@@_interpar_penalty_user_tl \__int_eval_end:
+ \tl_gclear:N \g_@@_interpar_penalty_user_tl
}
- \bool_gset_false:N \g_galley_nobreak_next_bool
- \galley_insert_vspace:
+ \bool_gset_false:N \g_galley_no_break_next_bool
+ \@@_insert_vspace:
}
% \end{macrocode}
% Inserting vertical space is set up as a separate function as it comes
% up in a few places. The idea here is that any user-set space will
% override the design value, and only one space is ever inserted.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_insert_vspace:
+\cs_new_protected_nopar:Npn \@@_insert_vspace:
{
- \tl_if_empty:NTF \g_galley_interpar_vspace_user_tl
+ \tl_if_empty:NTF \g_@@_interpar_vspace_user_tl
{ \skip_vertical:N \l_galley_interpar_vspace_skip }
{
- \skip_vertical:n { \g_galley_interpar_vspace_user_tl }
- \tl_gclear:N \g_galley_interpar_vspace_user_tl
+ \skip_vertical:n { \g_@@_interpar_vspace_user_tl }
+ \tl_gclear:N \g_@@_interpar_vspace_user_tl
}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\galley_insert_horizontal_items:}
+% \begin{macro}[int]{\@@_insert_horizontal_items:}
% Horizontal mode objects start with the whatsits for the next paragraph. An
% indent is then included if the removed box was not void.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_insert_horizontal_items:
+\cs_new_protected_nopar:Npn \@@_insert_horizontal_items:
{
\g_galley_whatsit_next_tl
\tl_gclear:N \g_galley_whatsit_next_tl
\bool_if:NF \g_galley_omit_next_indent_bool
{
- \box_if_empty:NF \g_galley_last_box
+ \box_if_empty:NF \g_@@_last_box
{ \hbox_to_wd:nn \l_galley_par_indent_dim { } }
}
\skip_horizontal:N \l_galley_par_begin_skip
@@ -1459,12 +1466,12 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\galley_restore_running_parameters:}
+% \begin{macro}[int]{\@@_restore_running_parameters:}
% Restoring the ongoing parameters just means using the token list
% variable in which the appropriate assignments are stored. The
% list can then be cleared.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_restore_running_parameters:
+\cs_new_protected_nopar:Npn \@@_restore_running_parameters:
{
\g_galley_restore_running_tl
\tl_gclear:N \g_galley_restore_running_tl
@@ -1521,32 +1528,32 @@
% \begin{macrocode}
\cs_new_protected:Npn \galley_parshape_fixed_lines:nnn #1#2#3
{
- \bool_gset_true:N \g_galley_parshape_set_bool
- \bool_set_true:N \l_galley_parshape_fixed_lines_bool
+ \bool_gset_true:N \g_@@_parshape_set_bool
+ \bool_set_true:N \l_@@_parshape_fixed_lines_bool
\int_set:Nn \l_galley_parshape_std_lines_int {#1}
- \clist_set:Nn \l_galley_parshape_left_indent_clist {#2}
- \clist_set:Nn \l_galley_parshape_right_indent_clist {#3}
- \bool_set_true:N \l_galley_parshape_resume_std_bool
+ \clist_set:Nn \l_@@_parshape_left_indent_clist {#2}
+ \clist_set:Nn \l_@@_parshape_right_indent_clist {#3}
+ \bool_set_true:N \l_@@_parshape_resume_std_bool
}
\cs_new_protected:Npn \galley_parshape_multi_par:nnnN #1#2#3#4
{
- \bool_gset_true:N \g_galley_parshape_set_bool
- \bool_set_true:N \l_galley_parshape_multipar_bool
- \bool_set_false:N \l_galley_parshape_fixed_lines_bool
+ \bool_gset_true:N \g_@@_parshape_set_bool
+ \bool_set_true:N \l_@@_parshape_multipar_bool
+ \bool_set_false:N \l_@@_parshape_fixed_lines_bool
\int_set:Nn \l_galley_parshape_std_lines_int {#1}
- \clist_set:Nn \l_galley_parshape_left_indent_clist {#2}
- \clist_set:Nn \l_galley_parshape_right_indent_clist {#3}
- \bool_set_eq:NN \l_galley_parshape_resume_std_bool #4
+ \clist_set:Nn \l_@@_parshape_left_indent_clist {#2}
+ \clist_set:Nn \l_@@_parshape_right_indent_clist {#3}
+ \bool_set_eq:NN \l_@@_parshape_resume_std_bool #4
}
\cs_new_protected:Npn \galley_parshape_single_par:nnnN #1#2#3#4
{
- \bool_gset_true:N \g_galley_parshape_set_bool
- \bool_set_false:N \l_galley_parshape_multipar_bool
- \bool_set_false:N \l_galley_parshape_fixed_lines_bool
+ \bool_gset_true:N \g_@@_parshape_set_bool
+ \bool_set_false:N \l_@@_parshape_multipar_bool
+ \bool_set_false:N \l_@@_parshape_fixed_lines_bool
\int_set:Nn \l_galley_parshape_std_lines_int {#1}
- \clist_set:Nn \l_galley_parshape_left_indent_clist {#2}
- \clist_set:Nn \l_galley_parshape_right_indent_clist {#3}
- \bool_set_eq:NN \l_galley_parshape_resume_std_bool #4
+ \clist_set:Nn \l_@@_parshape_left_indent_clist {#2}
+ \clist_set:Nn \l_@@_parshape_right_indent_clist {#3}
+ \bool_set_eq:NN \l_@@_parshape_resume_std_bool #4
}
\cs_generate_variant:Nn \galley_parshape_fixed_lines:nnn { nVV }
\cs_generate_variant:Nn \galley_parshape_multi_par:nnnN { nVV }
@@ -1554,25 +1561,25 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\galley_set_measure_and_parshape:}
+% \begin{macro}[int]{\@@_set_measure_and_parshape:}
% To set the paragraph shape for the current paragraph, there is a check to
% see if the measure alone should be used. If not, then the shape may be
% built by paragraph or based on the number of lines required.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_set_measure_and_parshape:
+\cs_new_protected_nopar:Npn \@@_set_measure_and_parshape:
{
- \bool_if:NTF \g_galley_parshape_set_bool
+ \bool_if:NTF \g_@@_parshape_set_bool
{
- \bool_if:NTF \l_galley_parshape_fixed_lines_bool
+ \bool_if:NTF \l_@@_parshape_fixed_lines_bool
{
\int_compare:nNnTF \g_galley_previous_par_lines_int > \c_zero
- { \galley_generate_parshape_lines: }
- { \galley_generate_parshape: }
+ { \@@_generate_parshape_lines: }
+ { \@@_generate_parshape: }
}
{
- \bool_gset_eq:NN \g_galley_parshape_set_bool
- \l_galley_parshape_multipar_bool
- \galley_generate_parshape:
+ \bool_gset_eq:NN \g_@@_parshape_set_bool
+ \l_@@_parshape_multipar_bool
+ \@@_generate_parshape:
}
}
{
@@ -1586,23 +1593,23 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int]{\galley_generate_parshape:}
-% \begin{macro}[aux]{\galley_set_parshape_map:nn, \galley_set_parshape_map:oo}
-% \begin{macro}[aux]{\galley_set_parshape_map_aux:nw}
+% \begin{macro}[int]{\@@_generate_parshape:}
+% \begin{macro}[aux]{\@@_set_parshape_map:nn, \@@_set_parshape_map:oo}
+% \begin{macro}[aux]{\@@_set_parshape_map_aux:nw}
% For a shape to apply on a paragraph basis, the two user-supplied comma
% lists are taken and converted into left-side offsets and line lengths.
% This is all dependent on the current measure.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_generate_parshape:
+\cs_new_protected_nopar:Npn \@@_generate_parshape:
{
\tex_global:D \tex_parshape:D
- \int_eval:w
+ \__int_eval:w
\l_galley_parshape_std_lines_int +
\int_min:nn
- { \clist_length:N \l_galley_parshape_left_indent_clist }
- { \clist_length:N \l_galley_parshape_right_indent_clist }
- \bool_if:NT \l_galley_parshape_resume_std_bool { + 1 }
- \int_eval_end:
+ { \clist_count:N \l_@@_parshape_left_indent_clist }
+ { \clist_count:N \l_@@_parshape_right_indent_clist }
+ \bool_if:NT \l_@@_parshape_resume_std_bool { + 1 }
+ \__int_eval_end:
\prg_replicate:nn \l_galley_parshape_std_lines_int
{
\dim_use:N \l_galley_total_left_margin_dim
@@ -1610,10 +1617,10 @@
\dim_use:N \l_galley_text_width_dim
\c_space_tl
}
- \galley_set_parshape_map:oo
- \l_galley_parshape_left_indent_clist
- \l_galley_parshape_right_indent_clist
- \bool_if:NT \l_galley_parshape_resume_std_bool
+ \@@_set_parshape_map:oo
+ \l_@@_parshape_left_indent_clist
+ \l_@@_parshape_right_indent_clist
+ \bool_if:NT \l_@@_parshape_resume_std_bool
{
\c_space_tl
\dim_use:N \l_galley_total_left_margin_dim
@@ -1621,10 +1628,10 @@
\dim_use:N \l_galley_text_width_dim
}
}
-\cs_new:Npn \galley_set_parshape_map:nn #1#2
- { \galley_set_parshape_map_aux:nw { } #1 , \q_mark #2 , \q_stop }
-\cs_generate_variant:Nn \galley_set_parshape_map:nn { oo }
-\cs_new:Npn \galley_set_parshape_map_aux:nw #1#2 , #3 \q_mark #4 , #5 \q_stop
+\cs_new:Npn \@@_set_parshape_map:nn #1#2
+ { \@@_set_parshape_map_aux:nw { } #1 , \q_mark #2 , \q_stop }
+\cs_generate_variant:Nn \@@_set_parshape_map:nn { oo }
+\cs_new:Npn \@@_set_parshape_map_aux:nw #1#2 , #3 \q_mark #4 , #5 \q_stop
{
\bool_if:nTF { \tl_if_empty_p:n {#3} || \tl_if_empty_p:n {#5} }
{
@@ -1634,7 +1641,7 @@
\dim_eval:n { \l_galley_text_width_dim - ( ( #2 ) + ( #4 ) ) }
}
{
- \galley_set_parshape_map_aux:nw
+ \@@_set_parshape_map_aux:nw
{
#1
\dim_eval:n { \l_galley_total_left_margin_dim + ( #2 ) }
@@ -1650,27 +1657,27 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\galley_generate_parshape_lines:}
-% \begin{macro}[aux]{\galley_generate_parshape_lines_aux:n}
+% \begin{macro}[int]{\@@_generate_parshape_lines:}
+% \begin{macro}[aux]{\@@_generate_parshape_lines:n}
% The idea here is to construct a paragraph shape based on the remaining
% lines from the shape in the previous paragraph. If the previous paragraph
% was sufficiently long, then life is \enquote{back to normal} and the
% standard shape is set. If a special shape is needed, this is recovered
% from the paragraph shape using the \eTeX{} primitives.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_generate_parshape_lines:
+\cs_new_protected_nopar:Npn \@@_generate_parshape_lines:
{
\int_compare:nNnTF \tex_parshape:D > \g_galley_previous_par_lines_int
{
\tex_global:D \tex_parshape:D
- \int_eval:w \tex_parshape:D - \g_galley_previous_par_lines_int
- \int_eval_end:
- \prg_stepwise_function:nnnN
+ \__int_eval:w \tex_parshape:D - \g_galley_previous_par_lines_int
+ \__int_eval_end:
+ \int_step_function:nnnN
{ \g_galley_previous_par_lines_int + \c_one }
- \c_one \tex_parshape:D \galley_generate_parshape_lines_aux:n
+ \c_one \tex_parshape:D \@@_generate_parshape_lines:n
}
{
- \bool_gset_false:N \g_galley_parshape_set_bool
+ \bool_gset_false:N \g_@@_parshape_set_bool
\tex_global:D \tex_parshape:D
\c_one
\dim_use:N \l_galley_total_left_margin_dim
@@ -1678,7 +1685,7 @@
\dim_use:N \l_galley_text_width_dim
}
}
-\cs_new:Npn \galley_generate_parshape_lines_aux:n #1
+\cs_new:Npn \@@_generate_parshape_lines:n #1
{
\etex_parshapeindent:D #1
~
@@ -1697,9 +1704,9 @@
% deals with this nicely.
% \begin{macrocode}
\cs_new_protected:Npn \galley_set_user_penalty:n #1
- { \tl_gset:Nx \g_galley_interpar_penalty_user_tl { \int_eval:n {#1} } }
+ { \tl_gset:Nx \g_@@_interpar_penalty_user_tl { \int_eval:n {#1} } }
\cs_new_protected:Npn \galley_set_user_vspace:n #1
- { \tl_gset:Nx \g_galley_interpar_vspace_user_tl { \skip_eval:n {#1} } }
+ { \tl_gset:Nx \g_@@_interpar_vspace_user_tl { \skip_eval:n {#1} } }
% \end{macrocode}
% \end{macro}
%
@@ -1837,7 +1844,7 @@
\cs_new_protected:Npn \galley_break_line:Nn #1#2
{
\mode_if_vertical:TF
- { \msg_kernel_error:nn { galley } { no-line-to-end } }
+ { \__msg_kernel_error:nn { galley } { no-line-to-end } }
{
\tex_unskip:D
\bool_if:NF #1
@@ -1905,7 +1912,7 @@
\cs_new_protected:Npn \galley_set_display_widow_penalties:n #1
{
\etex_displaywidowpenalties:D
- \int_eval:w \clist_length:n {#1} + \c_one \int_eval_end:
+ \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end:
\clist_map_function:nN {#1} \galley_set_aux:n
\c_zero
}
@@ -1913,7 +1920,7 @@
\cs_new_protected:Npn \galley_set_widow_penalties:n #1
{
\etex_widowpenalties:D
- \int_eval:w \clist_length:n {#1} + \c_one \int_eval_end:
+ \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end:
\clist_map_function:nN {#1} \galley_set_aux:n
\c_zero
}
@@ -1940,13 +1947,13 @@
\cs_new_protected:Npn \galley_set_club_penalties:n #1
{
\clist_set:Nn \l_galley_club_penalties_clist {#1}
- \galley_calc_interline_penalties:
+ \@@_calc_interline_penalties:
}
\cs_generate_variant:Nn \galley_set_club_penalties:n { V , v }
\cs_new_protected:Npn \galley_set_interline_penalties:n #1
{
\clist_set:Nn \l_galley_line_penalties_clist {#1}
- \galley_calc_interline_penalties:
+ \@@_calc_interline_penalties:
}
\cs_generate_variant:Nn \galley_set_interline_penalties:n { V , v }
% \end{macrocode}
@@ -1964,21 +1971,21 @@
\cs_new_protected:Npn \galley_set_display_club_penalties:n #1
{
\etex_clubpenalties:D
- \int_eval:w \clist_length:n {#1} + \c_one \int_eval_end:
+ \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end:
\clist_map_function:nN {#1} \galley_set_aux:n
\c_zero
- \galley_calc_interline_penalties:
+ \@@_calc_interline_penalties:
}
\cs_generate_variant:Nn \galley_set_display_club_penalties:n { V , v }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\galley_set_interline_penalty:n}
-% \begin{macro}[aux]{\galley_set_interline_penalty_aux:nn}
+% \begin{macro}[aux]{\@@_set_interline_penalty:nn}
% \begin{macro}[aux]
% {
-% \galley_set_interline_penalty_aux_i:n,
-% \galley_set_interline_penalty_aux_ii:n
+% \@@_set_interline_penalty_i:n,
+% \@@_set_interline_penalty_ii:n
% }
% Dealing with the general interline penalty is handled in one shot.
% The idea is that for lines with no special penalty, the old general
@@ -1991,47 +1998,47 @@
{
\int_compare:nNnTF { \etex_interlinepenalties:D \c_zero } = \c_zero
{
- \etex_interlinepenalties:D \c_one \int_eval:w #1 \int_eval_end:
- \galley_calc_interline_penalties:
+ \etex_interlinepenalties:D \c_one \__int_eval:w #1 \__int_eval_end:
+ \@@_calc_interline_penalties:
}
{
- \cs_set:Npn \galley_set_interline_penalty_aux_ii:n ##1
+ \cs_set:Npn \@@_set_interline_penalty_ii:n ##1
{
- \int_eval:w
+ \__int_eval:w
\etex_interlinepenalties:D ##1
- \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero
+ #1
- \int_eval_end:
+ \__int_eval_end:
}
- \exp_args:Nf \galley_set_interline_penalty_aux:nn
- { \clist_length:N \l_galley_line_penalties_clist } {#1}
+ \exp_args:Nf \@@_set_interline_penalty:nn
+ { \clist_count:N \l_galley_line_penalties_clist } {#1}
}
}
-\cs_new_protected:Npn \galley_set_interline_penalty_aux:nn #1#2
+\cs_new_protected:Npn \@@_set_interline_penalty:nn #1#2
{
\etex_interlinepenalties:D
\etex_interlinepenalties:D \c_zero
- \prg_stepwise_function:nnnN \c_one \c_one {#1}
- \galley_set_interline_penalty_aux_i:n
- \prg_stepwise_function:nnnN { #1 + \c_one } \c_one
+ \int_step_function:nnnN \c_one \c_one {#1}
+ \@@_set_interline_penalty_i:n
+ \int_step_function:nnnN { #1 + \c_one } \c_one
{ \etex_interlinepenalties:D \c_zero - \c_one }
- \galley_set_interline_penalty_aux_ii:n
- \int_eval:w #2 \int_eval_end:
+ \@@_set_interline_penalty_ii:n
+ \__int_eval:w #2 \__int_eval_end:
}
-\cs_new:Npn \galley_set_interline_penalty_aux_i:n #1
- { \etex_interlinepenalties:D \int_eval:w #1 \int_eval_end: }
-\cs_new:Npn \galley_set_interline_penalty_aux_ii:n #1 { }
+\cs_new:Npn \@@_set_interline_penalty_i:n #1
+ { \etex_interlinepenalties:D \__int_eval:w #1 \__int_eval_end: }
+\cs_new:Npn \@@_set_interline_penalty_ii:n #1 { }
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}[int]{\galley_calc_interline_penalties:}
-% \begin{macro}[aux]{\galley_calc_interline_penalties_aux:nn}
+% \begin{macro}[int]{\@@_calc_interline_penalties:}
+% \begin{macro}[aux]{\@@_calc_interline_penalties:nn}
% \begin{macro}[aux]
% {
-% \galley_calc_interline_penalties_aux_i:n,
-% \galley_calc_interline_penalties_aux_ii:n
+% \@@_calc_interline_penalties_i:n,
+% \@@_calc_interline_penalties_ii:n
% }
% The underlying interline penalty array has to deal with club penalties,
% display club penalties and any special line penalties, and include
@@ -2040,28 +2047,28 @@
% so an \texttt{f}-type expansion is used to make life a little less
% complex.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \galley_calc_interline_penalties:
+\cs_new_protected_nopar:Npn \@@_calc_interline_penalties:
{
- \exp_args:Nff \galley_calc_interline_penalties_aux:nn
+ \exp_args:Nff \@@_calc_interline_penalties:nn
{
\int_eval:n
{
\int_max:nn
{
- \clist_length:N \l_galley_club_penalties_clist
+ \clist_count:N \l_galley_club_penalties_clist
+ \c_one
}
{
\int_max:nn
{
- \clist_length:N \l_galley_line_penalties_clist
+ \clist_count:N \l_galley_line_penalties_clist
+ \c_one
}
{ \etex_clubpenalties:D \c_zero }
}
}
}
- { \clist_length:N \l_galley_line_penalties_clist }
+ { \clist_count:N \l_galley_line_penalties_clist }
}
% \end{macrocode}
% The idea is now to calculate the correct penalties. Two auxiliary functions
@@ -2069,32 +2076,30 @@
% normal lines. At the end of the process, the standard interline
% penalty is always included.
% \begin{macrocode}
-\cs_new_protected:Npn \galley_calc_interline_penalties_aux:nn #1#2
+\cs_new_protected:Npn \@@_calc_interline_penalties:nn #1#2
{
\etex_interlinepenalties:D #1 ~
- \prg_stepwise_function:nnnN \c_one \c_one {#2}
- \galley_calc_interline_penalties_aux_i:n
- \prg_stepwise_function:nnnN { #2 + \c_one } \c_one { #1 - \c_one }
- \galley_calc_interline_penalties_aux_ii:n
+ \int_step_function:nnnN \c_one \c_one {#2}
+ \@@_calc_interline_penalties_i:n
+ \int_step_function:nnnN { #2 + \c_one } \c_one { #1 - \c_one }
+ \@@_calc_interline_penalties_ii:n
\etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero
}
-\cs_new:Npn \galley_calc_interline_penalties_aux_i:n #1
+\cs_new:Npn \@@_calc_interline_penalties_i:n #1
{
- \int_eval:w
- \clist_item:Nn \l_galley_line_penalties_clist { #1 - \c_one }
- + 0 \clist_item:Nn \l_galley_club_penalties_clist
- { #1 - \c_one }
+ \__int_eval:w
+ \clist_item:Nn \l_galley_line_penalties_clist {#1}
+ + 0 \clist_item:Nn \l_galley_club_penalties_clist {#1}
- \etex_clubpenalties:D #1 ~
- \int_eval_end:
+ \__int_eval_end:
}
-\cs_new:Npn \galley_calc_interline_penalties_aux_ii:n #1
+\cs_new:Npn \@@_calc_interline_penalties_ii:n #1
{
- \int_eval:w
+ \__int_eval:w
\etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero
- + 0 \clist_item:Nn \l_galley_club_penalties_clist
- { #1 - \c_one }
+ + 0 \clist_item:Nn \l_galley_club_penalties_clist {#1}
- \etex_clubpenalties:D #1 ~
- \int_eval_end:
+ \__int_eval_end:
}
% \end{macrocode}
% \end{macro}
@@ -2111,9 +2116,9 @@
% }
% \begin{macro}[aux]
% {
-% \galley_save_display_club_penalties_aux:n,
-% \galley_save_display_widow_penalties_aux:n,
-% \galley_save_widow_penalties_aux:n
+% \@@_save_display_club_penalties:n,
+% \@@_save_display_widow_penalties:n,
+% \@@_save_widow_penalties:n
% }
% \begin{macro}{\galley_interline_penalty:}
% Saving the array penalties varies in complexity depending on how they are
@@ -2131,35 +2136,35 @@
{
\clist_set:Nx #1
{
- \prg_stepwise_function:nnnN \c_one \c_one
+ \int_step_function:nnnN \c_one \c_one
{ \etex_clubpenalties:D \c_zero - \c_one }
\galley_save_display_club_penalties:_aux:n
}
}
\cs_new:Npn \galley_save_display_club_penalties:_aux:n #1
- { \int_use:N \etex_clubpenaltes:D \int_eval:w #1 \int_eval_end: , }
+ { \int_use:N \etex_clubpenaltes:D \__int_eval:w #1 \__int_eval_end: , }
\cs_new_protected:Npn \galley_save_display_widow_penalties:N #1
{
\clist_set:Nx #1
{
- \prg_stepwise_function:nnnN \c_one \c_one
+ \int_step_function:nnnN \c_one \c_one
{ \etex_displaywidowpenalties:D \c_zero - \c_one }
\galley_save_display_widow_penalties:_aux:n
}
}
\cs_new:Npn \galley_save_display_widow_penalties:_aux:n #1
- { \int_use:N \etex_displaywidowpenalties:D \int_eval:w #1 \int_eval_end: , }
+ { \int_use:N \etex_displaywidowpenalties:D \__int_eval:w #1 \__int_eval_end: , }
\cs_new_protected:Npn \galley_save_widow_penalties:N #1
{
\clist_set:Nx #1
{
- \prg_stepwise_function:nnnN \c_one \c_one
+ \int_step_function:nnnN \c_one \c_one
{ \etex_widowpenalties:D \c_zero - \c_one }
\galley_save_widow_penalties:_aux:n
}
}
\cs_new:Npn \galley_save_widow_penalties:_aux:n #1
- { \int_use:N \etex_widowpenalties:D \int_eval:w #1 \int_eval_end: , }
+ { \int_use:N \etex_widowpenalties:D \__int_eval:w #1 \__int_eval_end: , }
% \end{macrocode}
% This one is not an array, but is stored in a primitive, so there is
% a simple conversion. The general interline penalty is always the
@@ -2175,7 +2180,7 @@
% \subsection{Messages}
%
% \begin{macrocode}
-\msg_kernel_new:nnn { galley } { no-line-to-end }
+\__msg_kernel_new:nnn { galley } { no-line-to-end }
{ There's~no~line~here~to~end. }
% \end{macrocode}
%
@@ -2262,7 +2267,7 @@
% \begin{macro}{\@@par}
% The primitive is moved as otherwise the clever skipping code will fail.
% \begin{macrocode}
-\cs_set_eq:NN \@@par \galley_std_par:
+\cs_set_eq:NN \@@par \@@_std_par:
% \end{macrocode}
% \end{macro}
%
diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx
index bba0907bbd8..87b30d0ce25 100644
--- a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx
@@ -37,7 +37,7 @@
%
%<*driver|package>
\RequirePackage{l3names}
-\GetIdInfo$Id: xgalley.dtx 3253 2012-01-28 14:59:55Z joseph $
+\GetIdInfo$Id: xgalley.dtx 3879 2012-07-01 09:17:47Z joseph $
{L3 Experimental galley}
%</driver|package>
%<*driver>
@@ -758,6 +758,10 @@
% \begin{macrocode}
%<*package>
% \end{macrocode}
+%
+% \begin{macrocode}
+%<@@=galley>
+% \end{macrocode}
%
% \begin{macrocode}
\ProvidesExplPackage
@@ -767,11 +771,11 @@
%
% \subsection{Variables}
%
-% \begin{variable}{\l_galley_tmpa_clist, \l_galley_tmpb_clist}
+% \begin{variable}{\l_@@_tmpa_clist, \l_@@_tmpb_clist}
% Scratch space.
% \begin{macrocode}
-\clist_new:N \l_galley_tmpa_clist
-\clist_new:N \l_galley_tmpb_clist
+\clist_new:N \l_@@_tmpa_clist
+\clist_new:N \l_@@_tmpb_clist
% \end{macrocode}
% \end{variable}
%
@@ -799,26 +803,26 @@
}
% \end{macrocode}
%
-% \begin{variable}{\l_galley_left_margin_dim, \l_galley_right_margin_dim}
-% In the \texttt{absolute} template, the two margin values are relative
-% to the edges of the galley. This means that any existing offset or
-% line-length adjustment are ignored.
+% \begin{variable}{\l_@@_left_margin_dim, \l_@@_right_margin_dim}
+% In the \texttt{absolute} template, the two margin values are relative
+% to the edges of the galley. This means that any existing offset or
+% line-length adjustment are ignored.
% \begin{macrocode}
%<*package>
-\cs_new_eq:NN \l_galley_left_margin_dim \leftmargin
+\cs_new_eq:NN \l_@@_left_margin_dim \leftmargin
%</package>
%<*package>
-\cs_new_eq:NN \l_galley_right_margin_dim \rightmargin
+\cs_new_eq:NN \l_@@_right_margin_dim \rightmargin
%</package>
\DeclareTemplateCode { measure } { absolute } { 0 }
{
- left-margin = \l_galley_left_margin_dim ,
- right-margin = \l_galley_right_margin_dim
+ left-margin = \l_@@_left_margin_dim ,
+ right-margin = \l_@@_right_margin_dim
}
{
\AssignTemplateKeys
- \galley_margins_set_absolute:nn \l_galley_left_margin_dim
- \l_galley_right_margin_dim
+ \galley_margins_set_absolute:nn \l_@@_left_margin_dim
+ \l_@@_right_margin_dim
}
% \end{macrocode}
% On the other hand, the \texttt{relative} template works relative to
@@ -826,13 +830,13 @@
% \begin{macrocode}
\DeclareTemplateCode { measure } { relative } { 0 }
{
- left-margin = \l_galley_left_margin_dim ,
- right-margin = \l_galley_right_margin_dim
+ left-margin = \l_@@_left_margin_dim ,
+ right-margin = \l_@@_right_margin_dim
}
{
\AssignTemplateKeys
- \galley_margins_set_relative:nn \l_galley_left_margin_dim
- \l_galley_right_margin_dim
+ \galley_margins_set_relative:nn \l_@@_left_margin_dim
+ \l_@@_right_margin_dim
}
% \end{macrocode}
% \end{variable}
@@ -866,66 +870,66 @@
lines : integer = 2
}
% \end{macrocode}
-% \begin{variable}{\l_galley_parshape_indent_dim}
-% \begin{variable}{\l_galley_parshape_on_left_bool}
-% \begin{variable}{\l_galley_parshape_lines_int}
-% Both of the templates are implemented as special cases of the more
-% general function defined earlier.
+% \begin{variable}{\l_@@_parshape_indent_dim}
+% \begin{variable}{\l_@@_parshape_on_left_bool}
+% \begin{variable}{\l_@@_parshape_lines_int}
+% Both of the templates are implemented as special cases of the more
+% general function defined earlier.
% \begin{macrocode}
\DeclareTemplateCode { parshape } { hang } { 0 }
{
- indent = \l_galley_parshape_indent_dim ,
- on-left-side = \l_galley_parshape_on_left_bool ,
- lines = \l_galley_parshape_lines_int
+ indent = \l_@@_parshape_indent_dim ,
+ on-left-side = \l_@@_parshape_on_left_bool ,
+ lines = \l_@@_parshape_lines_int
}
{
\AssignTemplateKeys
- \bool_if:NTF \l_galley_parshape_on_left_bool
+ \bool_if:NTF \l_@@_parshape_on_left_bool
{
\galley_parshape_single_par:nVVN
- \l_galley_parshape_lines_int
- \l_galley_parshape_indent_dim
+ \l_@@_parshape_lines_int
+ \l_@@_parshape_indent_dim
\c_zero_dim
\c_false_bool
}
{
\galley_parshape_single_par:nVVN
- \l_galley_parshape_lines_int
+ \l_@@_parshape_lines_int
\c_zero_dim
- \l_galley_parshape_indent_dim
+ \l_@@_parshape_indent_dim
\c_false_bool
}
}
\DeclareTemplateCode { parshape } { initial } { 0 }
{
- indent = \l_galley_parshape_indent_dim ,
- on-left-side = \l_galley_parshape_on_left_bool ,
- lines = \l_galley_parshape_lines_int
+ indent = \l_@@_parshape_indent_dim ,
+ on-left-side = \l_@@_parshape_on_left_bool ,
+ lines = \l_@@_parshape_lines_int
}
{
\AssignTemplateKeys
- \clist_clear:N \l_galley_tmpa_clist
- \clist_clear:N \l_galley_tmpb_clist
- \prg_replicate:nn { \l_galley_parshape_lines_int }
+ \clist_clear:N \l_@@_tmpa_clist
+ \clist_clear:N \l_@@_tmpb_clist
+ \prg_replicate:nn { \l_@@_parshape_lines_int }
{
- \clist_put_right:Nn \l_galley_tmpa_clist
- { \l_galley_parshape_indent_dim }
- \clist_put_right:Nn \l_galley_tmpb_clist
+ \clist_put_right:Nn \l_@@_tmpa_clist
+ { \l_@@_parshape_indent_dim }
+ \clist_put_right:Nn \l_@@_tmpb_clist
{ \c_zero_dim }
}
- \bool_if:NTF \l_galley_parshape_on_left_bool
+ \bool_if:NTF \l_@@_parshape_on_left_bool
{
\galley_parshape_single_par:nVVN
\c_zero
- \l_galley_tmpa_clist
- \l_galley_tmpb_clist
+ \l_@@_tmpa_clist
+ \l_@@_tmpb_clist
\c_true_bool
}
{
\galley_parshape_single_par:nVVN
\c_zero
- \l_galley_tmpb_clist
- \l_galley_tmpa_clist
+ \l_@@_tmpb_clist
+ \l_@@_tmpa_clist
\c_true_bool
}
}
@@ -1012,12 +1016,12 @@
\tex_defaulthyphenchar:D 45 \scan_stop:
% \end{macrocode}
%
-% \begin{variable}{\l_galley_justification_other_tl}
+% \begin{variable}{\l_@@_justification_other_tl}
% Used for the reset system for justification: using this token list means
% that there is no need to remove anything from
% \cs{g_galley_restore_running_tl}.
% \begin{macrocode}
-\tl_new:N \l_galley_justification_other_tl
+\tl_new:N \l_@@_justification_other_tl
% \end{macrocode}
% \end{variable}
%
@@ -1068,7 +1072,7 @@
}
{
\AssignTemplateKeys
- \tl_clear:N \l_galley_justification_other_tl
+ \tl_clear:N \l_@@_justification_other_tl
\galley_set_interword_spacing:N \l_galley_fixed_spacing_bool
\bool_if:NTF \l_galley_par_stretch_last_bool
{ \int_set_eq:NN \l_galley_last_line_fit_int \c_one_thousand }
@@ -1092,7 +1096,7 @@
stretch-last-line = \l_galley_par_stretch_last_bool
}
{
- \tl_put_left:Nx \l_galley_justification_other_tl
+ \tl_put_left:Nx \l_@@_justification_other_tl
{
\skip_set:Nn \exp_not:N \l_galley_par_end_skip
{ \skip_use:N \l_galley_par_end_skip }
@@ -1115,7 +1119,7 @@
{ \skip_use:N \l_galley_line_right_skip }
}
\tl_gput_right:Nn \g_galley_restore_running_tl
- { \l_galley_justification_other_tl }
+ { \l_@@_justification_other_tl }
\AssignTemplateKeys
\galley_set_interword_spacing:N \l_galley_fixed_spacing_bool
\bool_if:NTF \l_galley_par_stretch_last_bool
@@ -1191,7 +1195,7 @@
}
% \end{macrocode}
%
-% \begin{macro}{\galley_justification_first:, \galley_justification_other:}
+% \begin{macro}{\@@_justification_first:, \@@_justification_other:}
% A second form of justification template is the case where the first
% paragraph is different from all of the others. This is set up by
% getting the justification to reset itself after the first paragraph.
@@ -1205,16 +1209,16 @@
}
\DeclareTemplateCode { justification } { compound } { 0 }
{
- first-paragraph = \galley_justification_first: ,
- other-paragraphs = \galley_justification_other:
+ first-paragraph = \@@_justification_first: ,
+ other-paragraphs = \@@_justification_other:
}
{
\AssignTemplateKeys
- \galley_justification_first:
- \tl_set:Nn \l_galley_justification_other_tl
- { \galley_justification_other: }
+ \@@_justification_first:
+ \tl_set:Nn \l_@@_justification_other_tl
+ { \@@_justification_other: }
\tl_gput_right:Nn \g_galley_restore_running_tl
- { \l_galley_justification_other_tl }
+ { \l_@@_justification_other_tl }
}
% \end{macrocode}
% \end{macro}
@@ -1251,15 +1255,15 @@
\DeclareTemplateCode{ line-breaking } { std } { 0 }
{
badness = \l_galley_linebreak_badness_int ,
- binop-penalty = \l_galley_binop_penalty_int ,
+ binop-penalty = \l_@@_binop_penalty_int ,
double-hyphen-demerits = \l_galley_double_hyphen_demerits_int ,
emergency-stretch = \l_galley_emergency_stretch_skip ,
final-hyphen-demerits = \l_galley_final_hyphen_demerits_int ,
fuzz = \l_galley_linebreak_fuzz_dim ,
- line-penalty = \l_galley_linebreak_penalty_int ,
+ line-penalty = \l_@@_linebreak_penalty_int ,
mismatch-demerits = \l_galley_mismatch_demerits_int ,
pretolerance = \l_galley_linebreak_pretolerance_int ,
- relation-penalty = \l_galley_relation_penalty_int ,
+ relation-penalty = \l_@@_relation_penalty_int ,
tolerance = \l_galley_linebreak_tolerance_int
}
{ \AssignTemplateKeys }
@@ -1278,11 +1282,11 @@
%
% \begin{variable}
% {
-% \l_galley_club_penalty_int ,
-% \l_galley_display_club_penalty_int ,
-% \l_galley_display_widow_penalty_int ,
-% \l_galley_interline_penalty_int ,
-% \l_galley_widow_penalty_int
+% \l_@@_club_penalty_int ,
+% \l_@@_display_club_penalty_int ,
+% \l_@@_display_widow_penalty_int ,
+% \l_@@_interline_penalty_int ,
+% \l_@@_widow_penalty_int
% }
% The second object here sets up how \TeX{} acts to break paragraphs at
% page boundaries. As with the \texttt{line-breaking} object, there is not
@@ -1307,23 +1311,23 @@
\DeclareTemplateCode { paragraph-breaking } { std } { 0 }
{
badness = \l_galley_parbreak_badness_int ,
- broken-penalty = \l_galley_broken_penalty_int ,
- club-penalty = \l_galley_club_penalty_int ,
- display-club-penalty = \l_galley_display_club_penalty_int ,
- display-widow-penalty = \l_galley_display_widow_penalty_int ,
+ broken-penalty = \l_@@_broken_penalty_int ,
+ club-penalty = \l_@@_club_penalty_int ,
+ display-club-penalty = \l_@@_display_club_penalty_int ,
+ display-widow-penalty = \l_@@_display_widow_penalty_int ,
fuzz = \l_galley_parbreak_fuzz_dim ,
- interline-penalty = \l_galley_interline_penalty_int ,
- post-display-penalty = \l_galley_post_display_penalty_int ,
- pre-display-penalty = \l_galley_pre_display_penalty_int ,
- widow-penalty = \l_galley_widow_penalty_int
+ interline-penalty = \l_@@_interline_penalty_int ,
+ post-display-penalty = \l_@@_post_display_penalty_int ,
+ pre-display-penalty = \l_@@_pre_display_penalty_int ,
+ widow-penalty = \l_@@_widow_penalty_int
}
{
\AssignTemplateKeys
- \galley_set_club_penalties:V \l_galley_club_penalty_int
- \galley_set_display_club_penalties:V \l_galley_display_club_penalty_int
- \galley_set_display_widow_penalties:V \l_galley_display_widow_penalty_int
- \galley_set_interline_penalty:n \l_galley_interline_penalty_int
- \galley_set_widow_penalties:V \l_galley_widow_penalty_int
+ \galley_set_club_penalties:V \l_@@_club_penalty_int
+ \galley_set_display_club_penalties:V \l_@@_display_club_penalty_int
+ \galley_set_display_widow_penalties:V \l_@@_display_widow_penalty_int
+ \galley_set_interline_penalty:n \l_@@_interline_penalty_int
+ \galley_set_widow_penalties:V \l_@@_widow_penalty_int
}
% \end{macrocode}
% \end{variable}
@@ -1351,18 +1355,18 @@
% \end{macrocode}
% \begin{variable}
% {
-% \l_galley_parbreak_badness_tl ,
-% \l_galley_broken_penalty_tl ,
-% \l_galley_club_penalties_tl ,
-% \l_galley_display_club_penalties_tl ,
-% \l_galley_display_widow_penalties_tl ,
-% \l_galley_parbreak_fuzz_tl ,
-% \l_galley_interline_penalty_tl ,
-% \l_galley_post_display_penalty_tl ,
-% \l_galley_pre_display_penalty_tl ,
-% \l_galley_widow_penalties_tl ,
-% \c_galley_parbreak_multi_seq ,
-% \c_galley_parbreak_single_seq
+% \l_@@_parbreak_badness_tl ,
+% \l_@@_broken_penalty_tl ,
+% \l_@@_club_penalties_tl ,
+% \l_@@_display_club_penalties_tl ,
+% \l_@@_display_widow_penalties_tl ,
+% \l_@@_parbreak_fuzz_tl ,
+% \l_@@_interline_penalty_tl ,
+% \l_@@_post_display_penalty_tl ,
+% \l_@@_pre_display_penalty_tl ,
+% \l_@@_widow_penalties_tl ,
+% \c_@@_parbreak_multi_seq ,
+% \c_@@_parbreak_single_seq
% }
% There is also a version of this code which applies only to one
% paragraph. This is done by storing the input in token list variables
@@ -1383,16 +1387,16 @@
}
\DeclareTemplateCode { paragraph-breaking } { single } { 0 }
{
- badness = \l_galley_parbreak_badness_tl ,
- broken-penalty = \l_galley_broken_penalty_tl ,
- club-penalty = \l_galley_club_penalties_tl ,
- display-club-penalty = \l_galley_display_club_penalties_tl ,
- display-widow-penalty = \l_galley_display_widow_penalties_tl ,
- fuzz = \l_galley_parbreak_fuzz_tl ,
- interline-penalty = \l_galley_interline_penalty_tl ,
- post-display-penalty = \l_galley_post_display_penalty_tl ,
- pre-display-penalty = \l_galley_pre_display_penalty_tl ,
- widow-penalty = \l_galley_widow_penalties_tl
+ badness = \l_@@_parbreak_badness_tl ,
+ broken-penalty = \l_@@_broken_penalty_tl ,
+ club-penalty = \l_@@_club_penalties_tl ,
+ display-club-penalty = \l_@@_display_club_penalties_tl ,
+ display-widow-penalty = \l_@@_display_widow_penalties_tl ,
+ fuzz = \l_@@_parbreak_fuzz_tl ,
+ interline-penalty = \l_@@_interline_penalty_tl ,
+ post-display-penalty = \l_@@_post_display_penalty_tl ,
+ pre-display-penalty = \l_@@_pre_display_penalty_tl ,
+ widow-penalty = \l_@@_widow_penalties_tl
}
{
\AssignTemplateKeys
@@ -1400,30 +1404,30 @@
% The fuzz and interline penalties are handled explicitly as they have
% particular requirements.
% \begin{macrocode}
- \tl_if_empty:NF \l_galley_interline_penalty_tl
+ \tl_if_empty:NF \l_@@_interline_penalty_tl
{
\tl_gput_right:Nx \g_galley_par_after_hook_tl
{
- \int_set:Nn \exp_not:N \l_galley_interline_penalty_int
+ \int_set:Nn \exp_not:N \l_@@_interline_penalty_int
{ \galley_interline_penalty: }
}
- \int_set:Nn \l_galley_interline_penalty_int
- { \l_galley_interline_penalty_tl }
+ \int_set:Nn \l_@@_interline_penalty_int
+ { \l_@@_interline_penalty_tl }
}
- \tl_if_empty:NF \l_galley_parbreak_fuzz_tl
+ \tl_if_empty:NF \l_@@_parbreak_fuzz_tl
{
\tl_gput_right:Nx \g_galley_par_after_hook_tl
{
\dim_set:Nn \exp_not:N \l_galley_parbreak_fuzz_dim
{ \dim_use:N \l_galley_parbreak_fuzz_dim }
}
- \dim_set:Nn \l_galley_parbreak_fuzz_dim { \l_galley_parbreak_fuzz_tl }
+ \dim_set:Nn \l_galley_parbreak_fuzz_dim { \l_@@_parbreak_fuzz_tl }
}
% \end{macrocode}
% For the single integer penalties, a simple check is needed to save the
% value.
% \begin{macrocode}
- \seq_map_inline:Nn \c_galley_parbreak_single_seq
+ \seq_map_inline:Nn \c_@@_parbreak_single_seq
{
\tl_if_empty:cF { l_galley_ ##1 _tl }
{
@@ -1440,30 +1444,30 @@
% A bit more complex for the array penalties. Although the interface here
% does not expose the arrays, it is necessary to correctly save them.
% \begin{macrocode}
- \seq_map_inline:Nn \c_galley_parbreak_multi_seq
+ \seq_map_inline:Nn \c_@@_parbreak_multi_seq
{
\tl_if_empty:cF { l_galley_ ##1 _tl }
{
- \use:c { galley_save_ ##1 :N } \l_galley_tmpa_clist
+ \use:c { galley_save_ ##1 :N } \l_@@_tmpa_clist
\tl_gput_right:Nx \g_galley_par_after_hook_tl
{
\exp_not:c { galley_set_ ##1 :n }
- { \exp_not:o \l_galley_tmpa_clist }
+ { \exp_not:o \l_@@_tmpa_clist }
}
\use:c { galley_set_ ##1 :v } { l_galley_ ##1 _tl }
}
}
}
-\seq_new:N \c_galley_parbreak_multi_seq
-\seq_gput_right:Nn \c_galley_parbreak_multi_seq { club_penalties }
-\seq_gput_right:Nn \c_galley_parbreak_multi_seq { display_club_penalties }
-\seq_gput_right:Nn \c_galley_parbreak_multi_seq { display_widow_penalties }
-\seq_gput_right:Nn \c_galley_parbreak_multi_seq { widow_penalties }
-\seq_new:N \c_galley_parbreak_single_seq
-\seq_gput_right:Nn \c_galley_parbreak_single_seq { parbreak_badness }
-\seq_gput_right:Nn \c_galley_parbreak_single_seq { broken_penalty }
-\seq_gput_right:Nn \c_galley_parbreak_single_seq { post_display_penalty }
-\seq_gput_right:Nn \c_galley_parbreak_single_seq { pre_display_penalty }
+\seq_new:N \c_@@_parbreak_multi_seq
+\seq_gput_right:Nn \c_@@_parbreak_multi_seq { club_penalties }
+\seq_gput_right:Nn \c_@@_parbreak_multi_seq { display_club_penalties }
+\seq_gput_right:Nn \c_@@_parbreak_multi_seq { display_widow_penalties }
+\seq_gput_right:Nn \c_@@_parbreak_multi_seq { widow_penalties }
+\seq_new:N \c_@@_parbreak_single_seq
+\seq_gput_right:Nn \c_@@_parbreak_single_seq { parbreak_badness }
+\seq_gput_right:Nn \c_@@_parbreak_single_seq { broken_penalty }
+\seq_gput_right:Nn \c_@@_parbreak_single_seq { post_display_penalty }
+\seq_gput_right:Nn \c_@@_parbreak_single_seq { pre_display_penalty }
% \end{macrocode}
% \end{variable}
% \begin{macrocode}
diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.ins b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.ins
index cadc1d2a98f..d29df2ffb2f 100644
--- a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.ins
+++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.ins
@@ -1,6 +1,6 @@
\iffalse meta-comment
-File xgalley.ins Copyright (C) 2010,2011 The LaTeX3 Project
+File xgalley.ins Copyright (C) 2010-2012 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
@@ -16,7 +16,7 @@ The released version of this bundle is available from CTAN.
\fi
-\input docstrip.tex
+\input l3docstrip.tex
\askforoverwritefalse
\preamble
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3dt/l3dt.sty b/Master/texmf-dist/tex/latex/l3experimental/l3dt/l3dt.sty
index 99bd83e7764..a672181b903 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/l3dt/l3dt.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/l3dt/l3dt.sty
@@ -47,21 +47,20 @@
%% -----------------------------------------------------------------------
%%
\RequirePackage{expl3}
-\GetIdInfo$Id: l3dt.dtx 3459 2012-02-26 08:58:53Z joseph $
+\GetIdInfo$Id: l3dt.dtx 3877 2012-06-30 22:24:42Z joseph $
{L3 Experimental data tables}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
-\package_check_loaded_expl:
-\quark_new:N \q_dt
-\quark_new:N \q_dt_row
-\quark_new:N \q_dt_header
+\quark_new:N \q__dt
+\quark_new:N \q__dt_row
+\quark_new:N \q__dt_header
\tl_const:Nn \c_empty_dt
{
{ 0 }
- \q_dt
+ \q__dt
\q_nil
- \q_dt_header
- \q_dt_row
+ \q__dt_header
+ \q__dt_row
}
\cs_new_protected:Npn \dt_new:N #1 { \cs_new_eq:NN #1 \c_empty_dt }
\cs_new_protected:Npn \dt_clear:N #1 { \cs_set_eq:NN #1 \c_empty_dt }
@@ -76,168 +75,166 @@
\dt_new:N \l_tmpb_dt
\dt_new:N \g_tmpa_dt
\dt_new:N \g_tmpb_dt
-\cs_new_protected:Npn \dt_split_aux:nnnn #1#2#3#4 { #3 #2 }
-\cs_new_protected:Npn \dt_split_aux:w { }
-\cs_new:Npn \dt_split_header:NT #1#2
- { \exp_after:wN \dt_split_header_aux:wn #1 \q_stop {#2} }
-\cs_new:Npn \dt_split_header_aux:wn #1 \q_nil \q_dt_header #2 \q_stop #3
- { #3 {#1} { \q_dt_header #2 } }
-\cs_new_protected:Npn \dt_split_key:nnTF #1#2
- { \exp_args:No \dt_split_key_aux:nnTF { \tl_to_str:n {#2} } {#1} }
-\cs_new_protected:Npn \dt_split_key_aux:nnTF #1#2
- {
- \cs_set_protected:Npn \dt_split_aux:w
- ##1 \q_dt #1 \q_dt ##2##3##4 \q_mark ##5 \q_stop
- { \dt_split_aux:nnnn ##3 { { ##1 \q_dt } {##2} {##4} } }
- \dt_split_aux:w #2 \q_mark
- \q_dt #1 \q_dt { } { ? \use_ii:nn { } } \q_mark \q_stop
- }
-\cs_new_protected:Npn \dt_split_key_list:NnTF #1#2
- { \exp_args:NNo \dt_split_key_list_aux:NnTF #1 { \tl_to_str:n {#2} } }
-\cs_new_protected:Npn \dt_split_key_list_aux:NnTF #1#2
- {
- \cs_set_protected:Npn \dt_split_aux:w
- ##1##2 \q_dt #2 \q_dt ##3##4 \q_dt_header ##5 \q_mark ##6 \q_stop
+\cs_new_protected:Npn \__dt_split:nnnn #1#2#3#4 { #3 #2 }
+\cs_new_protected:Npn \__dt_split:w { }
+\cs_new:Npn \__dt_split_header:NT #1#2
+ { \exp_after:wN \__dt_split_header:wn #1 \q_stop {#2} }
+\cs_new:Npn \__dt_split_header:wn #1 \q_nil \q__dt_header #2 \q_stop #3
+ { #3 {#1} { \q__dt_header #2 } }
+\cs_new_protected:Npn \__dt_split_key:nnTF #1#2
+ { \exp_args:No \__dt_split_key_aux:nnTF { \tl_to_str:n {#2} } {#1} }
+\cs_new_protected:Npn \__dt_split_key_aux:nnTF #1#2
+ {
+ \cs_set_protected:Npn \__dt_split:w
+ ##1 \q__dt #1 \q__dt ##2##3##4 \q_mark ##5 \q_stop
+ { \__dt_split:nnnn ##3 { { ##1 \q__dt } {##2} {##4} } }
+ \__dt_split:w #2 \q_mark
+ \q__dt #1 \q__dt { } { ? \use_ii:nn { } } \q_mark \q_stop
+ }
+\cs_new_protected:Npn \__dt_split_key_list:NnTF #1#2
+ { \exp_args:NNo \__dt_split_key_list_aux:NnTF #1 { \tl_to_str:n {#2} } }
+\cs_new_protected:Npn \__dt_split_key_list_aux:NnTF #1#2
+ {
+ \cs_set_protected:Npn \__dt_split:w
+ ##1##2 \q__dt #2 \q__dt ##3##4 \q__dt_header ##5 \q_mark ##6 \q_stop
{
- \dt_split_aux:nnnn ##3
- { { {##1} ##2 \q_dt } { ##3##4 \q_dt_header ##5 } }
+ \__dt_split:nnnn ##3
+ { { {##1} ##2 \q__dt } { ##3##4 \q__dt_header ##5 } }
}
- \exp_after:wN \dt_split_aux:w #1 \q_mark
- \q_dt #2 \q_dt { ? \use_ii:nn { } } \q_dt_header \q_mark \q_stop
+ \exp_after:wN \__dt_split:w #1 \q_mark
+ \q__dt #2 \q__dt { ? \use_ii:nn { } } \q__dt_header \q_mark \q_stop
}
-\cs_new_protected:Npn \dt_split_row:NnTF #1#2
- { \dt_split_row_aux:NfTF #1 { \int_eval:n {#2} } }
-\cs_new_protected:Npn \dt_split_row_aux:NnTF #1#2
+\cs_new_protected:Npn \__dt_split_row:NnTF #1#2
+ { \__dt_split_row_aux:NfTF #1 { \int_eval:n {#2} } }
+\cs_new_protected:Npn \__dt_split_row_aux:NnTF #1#2
{
- \cs_set_protected:Npn \dt_split_aux:w
- ##1 \q_dt_row #2 \q_dt ##2##3 \q_dt_row ##4 \q_mark ##5 \q_stop
+ \cs_set_protected:Npn \__dt_split:w
+ ##1 \q__dt_row #2 \q__dt ##2##3 \q__dt_row ##4 \q_mark ##5 \q_stop
{
- \dt_split_aux:nnnn ##2
- { { ##1 \q_dt_row } { #2 \q_dt ##2##3 } {##4} }
+ \__dt_split:nnnn ##2
+ { { ##1 \q__dt_row } { #2 \q__dt ##2##3 } {##4} }
}
- \exp_after:wN \dt_split_aux:w #1 \q_mark
- \q_dt_row #2 \q_dt { ? \use_ii:nn { } } \q_dt_row \q_mark \q_stop
+ \exp_after:wN \__dt_split:w #1 \q_mark
+ \q__dt_row #2 \q__dt { ? \use_ii:nn { } } \q__dt_row \q_mark \q_stop
}
-\cs_generate_variant:Nn \dt_split_row_aux:NnTF { Nf }
-\cs_new_protected_nopar:Npn \dt_add_key:Nn { \dt_add_key_aux:NNn \tl_set:Nx }
-\cs_new_protected_nopar:Npn \dt_gadd_key:Nn { \dt_add_key_aux:NNn \tl_gset:Nx }
-\cs_new_protected:Npn \dt_add_key_aux:NNn #1#2#3
+\cs_generate_variant:Nn \__dt_split_row_aux:NnTF { Nf }
+\cs_new_protected_nopar:Npn \dt_add_key:Nn { \__dt_add_key:NNn \tl_set:Nx }
+\cs_new_protected_nopar:Npn \dt_gadd_key:Nn { \__dt_add_key:NNn \tl_gset:Nx }
+\cs_new_protected:Npn \__dt_add_key:NNn #1#2#3
{
- \dt_split_key_list:NnTF #2 {#3}
+ \__dt_split_key_list:NnTF #2 {#3}
{ \use_none:nn }
{
- \dt_split_header:NT #2
- { \dt_add_key_aux:NNnnn #1 #2 {#3} }
+ \__dt_split_header:NT #2
+ { \__dt_add_key:NNnnn #1 #2 {#3} }
}
}
-\cs_new_protected:Npn \dt_add_key_aux:NNnnn #1#2#3#4#5
+\cs_new_protected:Npn \__dt_add_key:NNnnn #1#2#3#4#5
{
#1 #2
{
\exp_not:n {#4}
\tl_to_str:n {#3}
- \exp_not:n { \q_dt \q_nil #5 }
+ \exp_not:n { \q__dt \q_nil #5 }
}
}
-\cs_new_protected_nopar:Npn \dt_add_row:N { \dt_add_row_aux:NN \tl_set:Nx }
-\cs_new_protected_nopar:Npn \dt_gadd_row:N { \dt_add_row_aux:NN \tl_gset:Nx }
-\cs_new_protected:Npn \dt_add_row_aux:NN #1#2
- { \exp_args:NNf \dt_add_row_aux:NnN #1 { \dt_rows:N #2 } #2 }
-\cs_new_protected:Npn \dt_add_row_aux:NnN #1#2#3
+\cs_new_protected_nopar:Npn \dt_add_row:N { \__dt_add_row:NN \tl_set:Nx }
+\cs_new_protected_nopar:Npn \dt_gadd_row:N { \__dt_add_row:NN \tl_gset:Nx }
+\cs_new_protected:Npn \__dt_add_row:NN #1#2
+ { \exp_args:NNf \__dt_add_row:NnN #1 { \dt_rows:N #2 } #2 }
+\cs_new_protected:Npn \__dt_add_row:NnN #1#2#3
{
#1 #3
{
{ \int_eval:n { #2 + \c_one } }
- \exp_after:wN \dt_add_row_aux:nw #3 \q_stop
+ \exp_after:wN \__dt_add_row:nw #3 \q_stop
#2
- \exp_not:n { \q_dt \q_nil \q_dt_row }
+ \exp_not:n { \q__dt \q_nil \q__dt_row }
}
}
-\cs_new:Npn \dt_add_row_aux:nw #1#2 \q_stop { \exp_not:n {#2} }
+\cs_new:Npn \__dt_add_row:nw #1#2 \q_stop { \exp_not:n {#2} }
\cs_new_protected:Npn \dt_put:Nnn #1
{ \dt_put:Nnnn #1 { \dt_rows:N #1 - \c_one } }
\cs_new_protected:Npn \dt_gput:Nnn #1
{ \dt_gput:Nnnn #1 { \dt_rows:N #1 - \c_one } }
\cs_new_protected_nopar:Npn \dt_put:Nnnn
- { \dt_put_aux:NNNnnn \dt_add_key:Nn \tl_set:Nx }
+ { \__dt_put:NNNnnn \dt_add_key:Nn \tl_set:Nx }
\cs_new_protected_nopar:Npn \dt_gput:Nnnn
- { \dt_put_aux:NNNnnn \dt_gadd_key:Nn \tl_gset:Nx }
-\cs_new_protected:Npn \dt_put_aux:NNNnnn #1#2#3#4#5#6
+ { \__dt_put:NNNnnn \dt_gadd_key:Nn \tl_gset:Nx }
+\cs_new_protected:Npn \__dt_put:NNNnnn #1#2#3#4#5#6
{
#1 #3 {#5}
- \dt_split_row:NnTF #3 {#4}
- { \dt_put_aux:NNnnnnn #2 #3 {#5} {#6} }
+ \__dt_split_row:NnTF #3 {#4}
+ { \__dt_put:NNnnnnn #2 #3 {#5} {#6} }
{
- \msg_kernel_error:nnxxx { dt } { unknown-row }
+ \__msg_kernel_error:nnxxx { dt } { unknown-row }
{ \token_to_str:N #3 } { \int_eval:n {#4} } { \dt_rows:N #3 }
}
}
-\cs_new_protected:Npn \dt_put_aux:NNnnnnn #1#2#3#4#5#6#7
+\cs_new_protected:Npn \__dt_put:NNnnnnn #1#2#3#4#5#6#7
{
- \dt_split_key:nnTF {#6} {#3}
- { \dt_put_update:NNnnnnnnn #1 #2 {#3} {#4} {#5} {#7} }
- { \dt_put_add_to_row:NNnnnnn #1 #2 {#3} {#4} {#5} {#6} {#7} }
+ \__dt_split_key:nnTF {#6} {#3}
+ { \__dt_put_update:NNnnnnnnn #1 #2 {#3} {#4} {#5} {#7} }
+ { \__dt_put_add_to_row:NNnnnnn #1 #2 {#3} {#4} {#5} {#6} {#7} }
}
-\cs_new_protected:Npn \dt_put_update:NNnnnnnnn #1#2#3#4#5#6#7#8#9
+\cs_new_protected:Npn \__dt_put_update:NNnnnnnnn #1#2#3#4#5#6#7#8#9
{
#1 #2
{
\exp_not:n { #5 #7 }
\tl_to_str:n {#3}
- \exp_not:n { \q_dt {#4} \q_dt #9 \q_dt_row #6 }
+ \exp_not:n { \q__dt {#4} \q__dt #9 \q__dt_row #6 }
}
}
-\cs_new_protected:Npn \dt_put_add_to_row:NNnnnnn #1#2#3#4#5#6#7
+\cs_new_protected:Npn \__dt_put_add_to_row:NNnnnnn #1#2#3#4#5#6#7
{
#1 #2
{
\exp_not:n {#5}
- \exp_not:o { \dt_put_add_row_aux:w #6 }
+ \exp_not:o { \__dt_put_add_to_row_aux:w #6 }
\tl_to_str:n {#3}
- \exp_not:n { \q_dt {#4} \q_dt \q_nil \q_dt_row #7 }
+ \exp_not:n { \q__dt {#4} \q__dt \q_nil \q__dt_row #7 }
}
}
-\cs_new:Npn \dt_put_add_row_aux:w #1 \q_nil {#1}
+\cs_new:Npn \__dt_put_add_to_row_aux:w #1 \q_nil {#1}
\cs_new:Npn \dt_keys:N #1
- { \dt_split_header:NT #1 { \dt_keys_aux:nn } }
-\cs_new:Npn \dt_keys_aux:nn #1#2
+ { \__dt_split_header:NT #1 { \__dt_keys:nn } }
+\cs_new:Npn \__dt_keys:nn #1#2
{
\int_eval:n
{
0
- \exp_after:wN \dt_keys_aux:wN \use_none:nn #1 \q_recursion_tail \q_dt
- \prg_break_point:n { }
+ \exp_after:wN \__dt_keys:wN \use_none:nn #1 \q_recursion_tail \q__dt
+ \__prg_break_point:Nn \dt_map_break: { }
}
}
-\cs_new:Npn \dt_keys_aux:wN #1 \q_dt
+\cs_new:Npn \__dt_keys:wN #1 \q__dt
{
- \if_meaning:w \q_recursion_tail #1
- \exp_after:wN \prg_map_break:
- \fi:
+ \__quark_if_recursion_tail_break:nN {#1} \dt_map_break:
+1
- \dt_keys_aux:wN
+ \__dt_keys:wN
}
\cs_new:Npn \dt_rows:N #1
{ \exp_after:wN \use_i_delimit_by_q_stop:nw #1 \q_stop }
-\cs_new_protected:Npn \dt_del:Nn #1 { \dt_del:Nnn #1
+\cs_new_protected:Npn \dt_remove:Nn #1 { \dt_remove:Nnn #1
{ \dt_rows:N #1 - \c_one } }
-\cs_new_protected:Npn \dt_gdel:Nn #1 { \dt_gdel:Nnn #1
+\cs_new_protected:Npn \dt_gremove:Nn #1 { \dt_gremove:Nnn #1
{ \dt_rows:N #1 - \c_one } }
-\cs_new_protected_nopar:Npn \dt_del:Nnn { \dt_del_aux:NNnn \tl_set:Nn }
-\cs_new_protected_nopar:Npn \dt_gdel:Nnn { \dt_del_aux:NNnn \tl_gset:Nn }
-\cs_new_protected:Npn \dt_del_aux:NNnn #1#2#3#4
+\cs_new_protected_nopar:Npn \dt_remove:Nnn { \dt_remove_aux:NNnn \tl_set:Nn }
+\cs_new_protected_nopar:Npn \dt_gremove:Nnn { \dt_remove_aux:NNnn \tl_gset:Nn }
+\cs_new_protected:Npn \dt_remove_aux:NNnn #1#2#3#4
{
- \dt_split_row:NnTF #2 {#3}
- { \dt_del_aux:NNnnnn #1 #2 {#4} }
+ \__dt_split_row:NnTF #2 {#3}
+ { \dt_remove_aux:NNnnnn #1 #2 {#4} }
{ }
}
-\cs_new_protected:Npn \dt_del_aux:NNnnnn #1#2#3#4#5#6
+\cs_new_protected:Npn \dt_remove_aux:NNnnnn #1#2#3#4#5#6
{
- \dt_split_key:nnTF {#5} {#3}
- { \dt_del_aux:NNnnnnn #1 #2 {#4} {#6} }
+ \__dt_split_key:nnTF {#5} {#3}
+ { \dt_remove_aux:NNnnnnn #1 #2 {#4} {#6} }
{ }
}
-\cs_new_protected:Npn \dt_del_aux:NNnnnnn #1#2#3#4#5#6#7
+\cs_new_protected:Npn \dt_remove_aux:NNnnnnn #1#2#3#4#5#6#7
{ #1 #2 { #3 #5 #7 #4 } }
\cs_new_protected_nopar:Npn \dt_remove_key:Nn
{ \dt_remove_key_aux:NNn \tl_set:Nx }
@@ -245,25 +242,23 @@
{ \dt_remove_key_aux:NNn \tl_gset:Nx }
\cs_new_protected:Npn \dt_remove_key_aux:NNn #1#2#3
{
- \dt_split_key_list:NnTF #2 {#3}
+ \__dt_split_key_list:NnTF #2 {#3}
{ \exp_args:No \dt_remove_key_aux:nNNnn { \tl_to_str:n {#3} } #1 #2 }
{ }
}
\cs_new_protected:Npn \dt_remove_key_aux:nNNnn #1#2#3#4#5
{
- \cs_set:Npn \dt_remove_key_aux:w ##1 \q_dt #1 \q_dt ##2 ##3
+ \cs_set:Npn \dt_remove_key_aux:w ##1 \q__dt #1 \q__dt ##2 ##3
{
\exp_not:n {##1}
- \if_meaning:w \q_recursion_tail ##3
- \exp_after:wN \prg_map_break:
- \fi:
+ \__quark_if_recursion_tail_break:nN {##3} \dt_map_break:
\dt_remove_key_aux:w ##3
}
#2 #3
{
\exp_not:n {#4}
- \dt_remove_key_aux:w #5 \q_dt #1 \q_dt { } \q_recursion_tail
- \prg_break_point:n { }
+ \dt_remove_key_aux:w #5 \q__dt #1 \q__dt { } \q_recursion_tail
+ \__prg_break_point:Nn \dt_map_break: { }
}
}
\cs_new:Npn \dt_remove_key_aux:w { }
@@ -273,7 +268,7 @@
{ \dt_remove_row_aux:NNn \tl_gset:Nx }
\cs_new_protected:Npn \dt_remove_row_aux:NNn #1#2#3
{
- \dt_split_row:NnTF #2 {#3}
+ \__dt_split_row:NnTF #2 {#3}
{ \dt_remove_row_aux:NNnnn #1 #2 }
{ }
}
@@ -283,46 +278,44 @@
{
{ \int_eval:n { \dt_rows:N #2 - \c_one } }
\dt_remove_row_aux:nw #3 \q_stop
- \dt_remove_row_loop:nw #5 \q_recursion_tail \q_dt_row
- \prg_break_point:n { }
+ \dt_remove_row_loop:nw #5 \q_recursion_tail \q__dt_row
+ \__prg_break_point:Nn \dt_map_break: { }
}
}
-\cs_new_eq:NN \dt_remove_row_aux:nw \dt_add_row_aux:nw
-\cs_new:Npn \dt_remove_row_loop:nw #1#2 \q_dt_row
+\cs_new_eq:NN \dt_remove_row_aux:nw \__dt_add_row:nw
+\cs_new:Npn \dt_remove_row_loop:nw #1#2 \q__dt_row
{
- \if_meaning:w \q_recursion_tail #1
- \exp_after:wN \prg_map_break:
- \fi:
+ \__quark_if_recursion_tail_break:nN {#1} \dt_map_break:
\int_eval:n { #1 - \c_one }
- \exp_not:n { #2 \q_dt_row }
+ \exp_not:n { #2 \q__dt_row }
\dt_remove_row_loop:nw
}
\cs_new_protected:Npn \dt_get:NnnN #1#2#3#4
{
- \dt_split_row:NnTF #1 {#2}
+ \__dt_split_row:NnTF #1 {#2}
{ \dt_get_aux:nNnnn {#3} #4 }
{ \tl_set:Nn #4 { \q_no_value } }
}
\cs_new_protected:Npn \dt_get_aux:nNnnn #1#2#3#4#5
{
- \dt_split_key:nnTF {#4} {#1}
+ \__dt_split_key:nnTF {#4} {#1}
{ \dt_get_aux:Nnnn #2 }
{ \tl_set:Nn #2 { \q_no_value } }
}
\cs_new_protected:Npn \dt_get_aux:Nnnn #1#2#3#4 { \tl_set:Nn #1 {#3} }
\prg_new_protected_conditional:Npnn \dt_get:NnnN #1#2#3#4 { T , F , TF }
{
- \dt_split_row:NnTF #1 {#2}
- { \dt_get_aux_true:nNnnn {#3} #4 }
+ \__dt_split_row:NnTF #1 {#2}
+ { \__dt_get_true:nNnnn {#3} #4 }
{ \prg_return_false: }
}
-\cs_new_protected:Npn \dt_get_aux_true:nNnnn #1#2#3#4#5
+\cs_new_protected:Npn \__dt_get_true:nNnnn #1#2#3#4#5
{
- \dt_split_key:nnTF {#4} {#1}
- { \dt_get_aux_true:Nnnn #2 }
+ \__dt_split_key:nnTF {#4} {#1}
+ { \__dt_get_true:Nnnn #2 }
{ \prg_return_false: }
}
-\cs_new_protected:Npn \dt_get_aux_true:Nnnn #1#2#3#4
+\cs_new_protected:Npn \__dt_get_true:Nnnn #1#2#3#4
{
\tl_set:Nn #1 {#3}
\prg_return_true:
@@ -340,36 +333,37 @@
{
\int_gincr:N \g_dt_map_level_int
\seq_gclear_new:c { g_dt_map_ \int_use:N \g_dt_map_level_int _seq }
- \keyval_parse:NNn \use_none:n \dt_map_variables_key:nn {#2}
- \dt_split_header:NT #1 { \dt_map_variables_aux:nnn {#3} }
+ \keyval_parse:NNn \use_none:n \__dt_map_variables_key:nn {#2}
+ \__dt_split_header:NT #1 { \__dt_map_variables:nnn {#3} }
}
-\cs_new_protected:Npn \dt_map_variables_key:nn #1#2
+\cs_new_protected:Npn \__dt_map_variables_key:nn #1#2
{
\seq_gput_right:cn { g_dt_map_ \int_use:N \g_dt_map_level_int _seq }
{ {#1} #2 }
}
-\cs_new_protected:Npn \dt_map_variables_aux:nnn #1#2#3
- { \dt_map_variables_aux:nNNw {#1} #3 \q_stop }
-\cs_new_protected:Npn \dt_map_variables_aux:nNNw
- #1 \q_dt_header \q_dt_row #2 \q_stop
+\cs_new_protected:Npn \__dt_map_variables:nnn #1#2#3
+ { \__dt_map_variables:nNNw {#1} #3 \q_stop }
+\cs_new_protected:Npn \__dt_map_variables:nNNw
+ #1 \q__dt_header \q__dt_row #2 \q_stop
{
\int_zero_new:c { l_dt_map_ \int_use:N \g_dt_map_level_int _row_int }
- \dt_map_variables_aux:nnw {#1} #2 { } \q_recursion_tail \q_dt_row
- \prg_break_point:n { \int_gdecr:N \g_dt_map_level_int }
+ \__dt_map_variables:nnw {#1} #2 { } \q_recursion_tail \q__dt_row
+ \__prg_break_point:Nn \dt_map_break:
+ { \int_gdecr:N \g_dt_map_level_int }
}
-\cs_new_protected:Npn \dt_map_variables_aux:nnw #1#2#3#4 \q_dt_row
+\cs_new_protected:Npn \__dt_map_variables:nnw #1#2#3#4 \q__dt_row
{
- \if_meaning:w \q_recursion_tail #3
- \exp_after:wN \dt_map_break:
- \fi:
+ \__quark_if_recursion_tail_break:nN {#3} \dt_map_break:
\seq_map_inline:cn { g_dt_map_ \int_use:N \g_dt_map_level_int _seq }
{ \dt_get_aux:nNnnn ##1 { } {#3#4} { } }
#1
\int_incr:c { l_dt_map_ \int_use:N \g_dt_map_level_int _row_int }
- \dt_map_variables_aux:nnw {#1}
+ \__dt_map_variables:nnw {#1}
}
-\cs_new_eq:NN \dt_map_break: \prg_map_break:
-\cs_new_eq:NN \dt_map_break:n \prg_map_break:n
+\cs_new_nopar:Npn \dt_map_break:
+ { \__prg_map_break:Nn \dt_map_break: { } }
+\cs_new_nopar:Npn \dt_map_break:n
+ { \__prg_map_break:Nn \dt_map_break: }
\prg_new_conditional:Npnn \dt_if_empty:N #1 { T , F , TF , p }
{
\if_meaning:w #1 \c_empty_dt
@@ -379,36 +373,36 @@
\fi:
}
\prg_new_conditional:Npnn \dt_if_in:Nn #1#2 { p , T , F , TF }
- { \dt_split_header:NT #1 { \dt_if_in_aux:nnn {#2} } }
-\cs_new:Npn \dt_if_in_aux:nnn #1#2#3
+ { \__dt_split_header:NT #1 { \__dt_if_in:nnn {#2} } }
+\cs_new:Npn \__dt_if_in:nnn #1#2#3
{
- \exp_last_unbraced:Nno \dt_if_in_aux:nwN {#1} { \use_none:nn #2 }
- \q_recursion_tail \q_dt
- \prg_break_point:n { }
+ \exp_last_unbraced:Nno \__dt_if_in:nwN {#1} { \use_none:nn #2 }
+ \q_recursion_tail \q__dt
+ \__prg_break_point:
}
-\cs_new:Npn \dt_if_in_aux:nwN #1#2 \q_dt
+\cs_new:Npn \__dt_if_in:nwN #1#2 \q__dt
{
\if_meaning:w \q_recursion_tail #2
- \exp_after:wN \prg_map_break:n
+ \exp_after:wN \__prg_break:n
\else:
\exp_after:wN \use_none:n
\fi:
{ \prg_return_false: }
\str_if_eq:nnTF {#1} {#2}
- { \prg_map_break:n { \prg_return_true: } }
- { \dt_if_in_aux:nwN {#1} }
+ { \__prg_break:n { \prg_return_true: } }
+ { \__dt_if_in:nwN {#1} }
}
\prg_new_conditional:Npnn \dt_if_in_row:Nnn #1#2#3 { p , T , F , TF }
{
- \exp_last_unbraced:Nno \dt_if_in_row_aux:nw {#2} #1
+ \exp_last_unbraced:Nno \__dt_if_in_row:nw {#2} #1
\q_recursion_tail \q_nil
- \prg_break_point:n { }
+ \__prg_break_point:
{ \tl_to_str:n {#3} }
}
-\cs_new:Npn \dt_if_in_row_aux:nw #1#2 \q_dt_row #3#4 \q_nil
+\cs_new:Npn \__dt_if_in_row:nw #1#2 \q__dt_row #3#4 \q_nil
{
\if_meaning:w \q_recursion_tail #3
- \exp_after:wN \prg_map_break:n
+ \exp_after:wN \__prg_break:n
\else:
\exp_after:wN \use_none:n
\fi:
@@ -417,28 +411,28 @@
\prg_return_false:
}
\int_compare:nNnTF {#1} = {#3}
- { \prg_map_break:n { \exp_args:Nno \dt_if_in_row_aux:nn {#4} } }
- { \dt_if_in_row_aux:nw {#1} }
+ { \__prg_break:n { \exp_args:Nno \__dt_if_in_row:nn {#4} } }
+ { \__dt_if_in_row:nw {#1} }
}
-\cs_new:Npn \dt_if_in_row_aux:nn #1#2
+\cs_new:Npn \__dt_if_in_row:nn #1#2
{
- \dt_if_in_row_aux:nwn {#2} #1 {#2} \q_dt { } \q_recursion_tail
- \prg_break_point:n { }
+ \__dt_if_in_row:nwn {#2} #1 {#2} \q__dt { } \q_recursion_tail
+ \__prg_break_point:
}
-\cs_new:Npn \dt_if_in_row_aux:nwn #1 \q_dt #2 \q_dt #3
+\cs_new:Npn \__dt_if_in_row:nwn #1 \q__dt #2 \q__dt #3
{
\str_if_eq:xxTF {#1} {#2}
- { \dt_if_in_row_aux:N }
- { \dt_if_in_row_aux:nwn {#1} }
+ { \__dt_if_in_row:N }
+ { \__dt_if_in_row:nwn {#1} }
}
-\cs_new:Npn \dt_if_in_row_aux:N #1
+\cs_new:Npn \__dt_if_in_row:N #1
{
- \if_meaning:w \q_dt #1
+ \if_meaning:w \q__dt #1
\prg_return_true:
\else:
\prg_return_false:
\fi:
- \prg_map_break:
+ \__prg_break:
}
\cs_new:Npn \dt_if_in_row_p:Nn #1 { \dt_if_in_row_p:Nnn #1
{ \dt_rows:N #1 - \c_one } }
@@ -448,7 +442,7 @@
{ \dt_rows:N #1 - \c_one } }
\cs_new:Npn \dt_if_in_row:NnTF #1 { \dt_if_in_row:NnnTF #1
{ \dt_rows:N #1 - \c_one } }
-\msg_kernel_new:nnnn { dt } { unknown-row }
+\__msg_kernel_new:nnnn { dt } { unknown-row }
{ Data~table~#1~does~not~contain~a~row~'#2'. }
{
Data~table~#1~contains~#3~rows.~These~must~be~accessed~by~number:~row~
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3sort/l3sort.sty b/Master/texmf-dist/tex/latex/l3experimental/l3sort/l3sort.sty
index b24bacd3794..b9adcd3eeeb 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/l3sort/l3sort.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/l3sort/l3sort.sty
@@ -47,176 +47,202 @@
%% -----------------------------------------------------------------------
%%
\RequirePackage{expl3}
-\GetIdInfo$Id: l3sort.dtx 3467 2012-02-26 15:39:35Z bruno $
+\GetIdInfo$Id: l3sort.dtx 3953 2012-07-11 16:15:09Z bruno $
{L3 Experimental sorting functions}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
-\package_check_loaded_expl:
-\int_const:Nn \c_sort_max_length_int
+\int_const:Nn \c__sort_max_length_int
{ \luatex_if_engine:TF { 49152 } { 24576 } }
-\int_new:N \l_sort_length_int
-\int_new:N \l_sort_block_int
-\int_new:N \l_sort_begin_int
-\int_new:N \l_sort_end_int
-\int_new:N \l_sort_A_int
-\int_new:N \l_sort_B_int
-\int_new:N \l_sort_C_int
-\cs_new_protected:Npn \sort_aux:NNnNn #1#2#3#4#5
+\int_new:N \l__sort_length_int
+\int_new:N \l__sort_block_int
+\int_new:N \l__sort_begin_int
+\int_new:N \l__sort_end_int
+\int_new:N \l__sort_A_int
+\int_new:N \l__sort_B_int
+\int_new:N \l__sort_C_int
+\cs_new:Npn \tl_sort:nN #1#2 { \__sort_quick_i:nNn {#1} #2 { } }
+\cs_new:Npn \__sort_quick_i:nNn #1#2
+ {
+ \exp_after:wN \__sort_quick_ii:wn
+ \use_none:n #1 \__prg_break_point:
+ \__sort_quick_iii:nnNnn { } { } #2
+ #1
+ { \__prg_break_point: }
+ \__prg_break_point:
+ }
+\cs_new:Npn \__sort_quick_ii:wn #1 \__prg_break_point: #2 {#2}
+\cs_new:Npn \__sort_quick_iii:nnNnn #1#2#3#4#5
+ {
+ \__prg_break: #5
+ \__sort_quick_iv:nnNnwn {#1} {#2}
+ \__prg_break_point:
+ #3 {#4} {#5}
+ { \__sort_quick_iii:nnNnn {#1} { #2 {#5} } }
+ { \__sort_quick_iii:nnNnn { #1 {#5} } {#2} }
+ #3 {#4}
+ }
+\cs_new:Npn \__sort_quick_iv:nnNnwn
+ #1#2 \__prg_break_point: #3#4 #5 \__prg_break_point: #6
+ {
+ \__sort_quick_i:nNn {#2} #3
+ { \__sort_quick_i:nNn {#1} #3 {#6} {#4} }
+ }
+\cs_new_protected:Npn \__sort_main:NNNnNn #1#2#3#4#5#6
{
\group_begin:
- \l_sort_length_int \c_zero
- #2 #4
+ \l__sort_length_int \c_zero
+ #2 #5
{
- \if_num:w \l_sort_length_int = \c_sort_max_length_int
- \sort_too_long_error:Nw #4
+ \if_int_compare:w \l__sort_length_int = \c__sort_max_length_int
+ \__sort_too_long_error:NNw #3 #5
\fi:
- \tex_toks:D \l_sort_length_int {##1}
- \tex_advance:D \l_sort_length_int \c_one
+ \tex_toks:D \l__sort_length_int {##1}
+ \tex_advance:D \l__sort_length_int \c_one
}
- \cs_set:Npn \sort_compare:nn ##1 ##2 { #5 }
- \l_sort_block_int \c_one
- \sort_level:
+ \cs_set:Npn \sort_compare:nn ##1 ##2 { #6 }
+ \l__sort_block_int \c_one
+ \__sort_level:
\use:x
{
\group_end:
- #1 \exp_not:N #4 {#3}
+ #1 \exp_not:N #5 {#4}
}
}
\cs_new_protected_nopar:Npn \seq_sort:Nn
{
- \sort_aux:NNnNn \tl_set:Nn
- \seq_map_inline:Nn
- { \sort_toks:NNw \exp_not:N \seq_item:n 0 ; }
+ \__sort_main:NNNnNn \tl_set:Nn
+ \seq_map_inline:Nn \seq_map_break:
+ { \__sort_toks:NNw \exp_not:N \__seq_item:n 0 ; }
}
\cs_new_protected_nopar:Npn \seq_gsort:Nn
{
- \sort_aux:NNnNn \tl_gset:Nn
- \seq_map_inline:Nn
- { \sort_toks:NNw \exp_not:N \seq_item:n 0 ; }
+ \__sort_main:NNNnNn \tl_gset:Nn
+ \seq_map_inline:Nn \seq_map_break:
+ { \__sort_toks:NNw \exp_not:N \__seq_item:n 0 ; }
}
\cs_new_protected_nopar:Npn \tl_sort:Nn
{
- \sort_aux:NNnNn \tl_set:Nn
- \tl_map_inline:Nn
- { \sort_toks:NNw \prg_do_nothing: \prg_do_nothing: 0 ; }
+ \__sort_main:NNNnNn \tl_set:Nn
+ \tl_map_inline:Nn \tl_map_break:
+ { \__sort_toks:NNw \prg_do_nothing: \prg_do_nothing: 0 ; }
}
\cs_new_protected_nopar:Npn \tl_gsort:Nn
{
- \sort_aux:NNnNn \tl_gset:Nn
- \tl_map_inline:Nn
- { \sort_toks:NNw \prg_do_nothing: \prg_do_nothing: 0 ; }
+ \__sort_main:NNNnNn \tl_gset:Nn
+ \tl_map_inline:Nn \tl_map_break:
+ { \__sort_toks:NNw \prg_do_nothing: \prg_do_nothing: 0 ; }
}
\cs_new_protected_nopar:Npn \clist_sort:Nn
- { \clist_sort_aux:NNn \tl_set:Nn }
+ { \__sort_sort:NNn \tl_set:Nn }
\cs_new_protected_nopar:Npn \clist_gsort:Nn
- { \clist_sort_aux:NNn \tl_gset:Nn }
-\cs_new_protected:Npn \clist_sort_aux:NNn #1#2#3
+ { \__sort_sort:NNn \tl_gset:Nn }
+\cs_new_protected:Npn \__sort_sort:NNn #1#2#3
{
\clist_if_empty:NF #2
{
- \sort_aux:NNnNn #1
- \clist_map_inline:Nn
+ \__sort_main:NNNnNn #1
+ \clist_map_inline:Nn \clist_map_break:
{
\exp_last_unbraced:Nf \use_none:n
- { \sort_toks:NNw \exp_args:No \clist_wrap_item:n 0 ; }
+ { \__sort_toks:NNw \exp_args:No \__clist_wrap_item:n 0 ; }
}
#2 {#3}
}
}
-\cs_new:Npn \sort_toks:NNw #1#2#3 ;
+\cs_new:Npn \__sort_toks:NNw #1#2#3 ;
{
- \if_num:w #3 < \l_sort_length_int
+ \if_int_compare:w #3 < \l__sort_length_int
#1 #2 { \tex_the:D \tex_toks:D #3 }
- \exp_after:wN \sort_toks:NNw \exp_after:wN #1 \exp_after:wN #2
- \int_use:N \int_eval:w #3 + \c_one \exp_after:wN ;
+ \exp_after:wN \__sort_toks:NNw \exp_after:wN #1 \exp_after:wN #2
+ \int_use:N \__int_eval:w #3 + \c_one \exp_after:wN ;
\fi:
}
-\cs_new_protected_nopar:Npn \sort_level:
+\cs_new_protected_nopar:Npn \__sort_level:
{
- \if_num:w \l_sort_block_int < \l_sort_length_int
- \l_sort_end_int \c_zero
- \sort_merge_blocks:
- \tex_multiply:D \l_sort_block_int \c_two
- \exp_after:wN \sort_level:
+ \if_int_compare:w \l__sort_block_int < \l__sort_length_int
+ \l__sort_end_int \c_zero
+ \__sort_merge_blocks:
+ \tex_multiply:D \l__sort_block_int \c_two
+ \exp_after:wN \__sort_level:
\fi:
}
-\cs_new_protected_nopar:Npn \sort_merge_blocks:
+\cs_new_protected_nopar:Npn \__sort_merge_blocks:
{
- \l_sort_begin_int \l_sort_end_int
- \tex_advance:D \l_sort_end_int \l_sort_block_int
- \if_num:w \int_eval:w \l_sort_end_int < \l_sort_length_int
- \l_sort_A_int \l_sort_end_int
- \tex_advance:D \l_sort_end_int \l_sort_block_int
- \if_num:w \l_sort_end_int > \l_sort_length_int
- \l_sort_end_int \l_sort_length_int
+ \l__sort_begin_int \l__sort_end_int
+ \tex_advance:D \l__sort_end_int \l__sort_block_int
+ \if_int_compare:w \__int_eval:w \l__sort_end_int < \l__sort_length_int
+ \l__sort_A_int \l__sort_end_int
+ \tex_advance:D \l__sort_end_int \l__sort_block_int
+ \if_int_compare:w \l__sort_end_int > \l__sort_length_int
+ \l__sort_end_int \l__sort_length_int
\fi:
- \l_sort_B_int \l_sort_A_int
- \l_sort_C_int \l_sort_length_int
+ \l__sort_B_int \l__sort_A_int
+ \l__sort_C_int \l__sort_length_int
\sort_copy_block:
- \tex_advance:D \l_sort_A_int \c_minus_one
- \tex_advance:D \l_sort_B_int \c_minus_one
- \tex_advance:D \l_sort_C_int \c_minus_one
- \sort_merge_blocks_aux:
- \exp_after:wN \sort_merge_blocks:
+ \tex_advance:D \l__sort_A_int \c_minus_one
+ \tex_advance:D \l__sort_B_int \c_minus_one
+ \tex_advance:D \l__sort_C_int \c_minus_one
+ \__sort_merge_blocks_aux:
+ \exp_after:wN \__sort_merge_blocks:
\fi:
}
\cs_new_protected_nopar:Npn \sort_copy_block:
{
- \tex_toks:D \l_sort_C_int \tex_toks:D \l_sort_B_int
- \tex_advance:D \l_sort_C_int \c_one
- \tex_advance:D \l_sort_B_int \c_one
- \if_num:w \l_sort_B_int = \l_sort_end_int
+ \tex_toks:D \l__sort_C_int \tex_toks:D \l__sort_B_int
+ \tex_advance:D \l__sort_C_int \c_one
+ \tex_advance:D \l__sort_B_int \c_one
+ \if_int_compare:w \l__sort_B_int = \l__sort_end_int
\use_i:nn
\fi:
\sort_copy_block:
}
-\cs_new_protected_nopar:Npn \sort_merge_blocks_aux:
+\cs_new_protected_nopar:Npn \__sort_merge_blocks_aux:
{
\exp_after:wN \sort_compare:nn \exp_after:wN
- { \tex_the:D \tex_toks:D \exp_after:wN \l_sort_A_int \exp_after:wN }
- \exp_after:wN { \tex_the:D \tex_toks:D \l_sort_C_int }
+ { \tex_the:D \tex_toks:D \exp_after:wN \l__sort_A_int \exp_after:wN }
+ \exp_after:wN { \tex_the:D \tex_toks:D \l__sort_C_int }
}
\cs_new_protected_nopar:Npn \sort_ordered:
{
- \tex_toks:D \l_sort_B_int \tex_toks:D \l_sort_C_int
- \tex_advance:D \l_sort_B_int \c_minus_one
- \tex_advance:D \l_sort_C_int \c_minus_one
- \if_num:w \l_sort_C_int < \l_sort_length_int
+ \tex_toks:D \l__sort_B_int \tex_toks:D \l__sort_C_int
+ \tex_advance:D \l__sort_B_int \c_minus_one
+ \tex_advance:D \l__sort_C_int \c_minus_one
+ \if_int_compare:w \l__sort_C_int < \l__sort_length_int
\use_i:nn
\fi:
- \sort_merge_blocks_aux:
+ \__sort_merge_blocks_aux:
}
\cs_new_protected_nopar:Npn \sort_reversed:
{
- \tex_toks:D \l_sort_B_int \tex_toks:D \l_sort_A_int
- \tex_advance:D \l_sort_B_int \c_minus_one
- \tex_advance:D \l_sort_A_int \c_minus_one
- \if_num:w \l_sort_A_int < \l_sort_begin_int
- \sort_merge_blocks_end: \use_i:nn
+ \tex_toks:D \l__sort_B_int \tex_toks:D \l__sort_A_int
+ \tex_advance:D \l__sort_B_int \c_minus_one
+ \tex_advance:D \l__sort_A_int \c_minus_one
+ \if_int_compare:w \l__sort_A_int < \l__sort_begin_int
+ \__sort_merge_blocks_end: \use_i:nn
\fi:
- \sort_merge_blocks_aux:
+ \__sort_merge_blocks_aux:
}
-\cs_new_protected_nopar:Npn \sort_merge_blocks_end:
+\cs_new_protected_nopar:Npn \__sort_merge_blocks_end:
{
- \tex_toks:D \l_sort_B_int \tex_toks:D \l_sort_C_int
- \tex_advance:D \l_sort_B_int \c_minus_one
- \tex_advance:D \l_sort_C_int \c_minus_one
- \if_num:w \l_sort_B_int < \l_sort_begin_int
+ \tex_toks:D \l__sort_B_int \tex_toks:D \l__sort_C_int
+ \tex_advance:D \l__sort_B_int \c_minus_one
+ \tex_advance:D \l__sort_C_int \c_minus_one
+ \if_int_compare:w \l__sort_B_int < \l__sort_begin_int
\use_i:nn
\fi:
- \sort_merge_blocks_end:
+ \__sort_merge_blocks_end:
}
-\cs_new_protected:Npn \sort_too_long_error:Nw #1 \fi:
+\cs_new_protected:Npn \__sort_too_long_error:NNw #1#2 \fi:
{
\fi:
- \msg_kernel_error:nnx { sort } { too-large } { \token_to_str:N #1 }
- \prg_map_break:
+ \__msg_kernel_error:nnx { sort } { too-large } { \token_to_str:N #2 }
+ #1
}
-\msg_kernel_new:nnnn { sort } { too-large }
+\__msg_kernel_new:nnnn { sort } { too-large }
{ The~list~#1~is~too~long~to~be~sorted~by~TeX. }
{
- TeX~has~\int_use:N \c_max_register_int \ registers~available:~
- this~only~allows~to~sorts~with~up~to~\int_use:N \c_sort_max_length_int
+ TeX~has~\int_eval:n { \c_max_register_int + 1 }~registers~available:~
+ this~only~allows~to~sorts~with~up~to~\int_use:N \c__sort_max_length_int
\ items.~All~extra~items~will~be~ignored.
}
%%
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty
index b56100853ab..63970cdd45d 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty
@@ -47,59 +47,59 @@
%% -----------------------------------------------------------------------
\RequirePackage{expl3}
\GetIdInfo$Id: l3flag.dtx 3039 2011-12-08 09:22:35Z bruno $
- {L3 Experimental Flags}
+ {L3 Experimental flags}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\cs_new_protected:Npn \flag_new:n #1
{
- \cs_new:cpn { flag_trap_#1:w } ##1 ;
- { \exp_after:wN \use_none:n \cs:w l_#1_##1_flag \cs_end: }
+ \cs_new:cpn { __flag_trap_#1:w } ##1 ;
+ { \exp_after:wN \use_none:n \cs:w __flag_#1_##1: \cs_end: }
}
\cs_new_protected:Npn \flag_clear:n #1
- { \flag_clear_aux:ww 0 ; #1 \q_stop }
-\cs_new_protected:Npn \flag_clear_aux:ww #1 ; #2 \q_stop
+ { \__flag_clear:ww 0 ; #1 \q_stop }
+\cs_new_protected:Npn \__flag_clear:ww #1 ; #2 \q_stop
{
- \if_cs_exist:w l_#2_#1_flag \cs_end:
+ \if_cs_exist:w __flag_#2_#1: \cs_end:
\else:
\exp_after:wN \use_none_delimit_by_q_stop:w
\fi:
- \cs_set_eq:cN { l_#2_#1_flag } \c_undefined:D
- \exp_after:wN \flag_clear_aux:ww
- \int_use:N \int_eval:w \c_one + #1 ;
+ \cs_set_eq:cN { __flag_#2_#1: } \c_undefined:D
+ \exp_after:wN \__flag_clear:ww
+ \int_use:N \__int_eval:w \c_one + #1 ;
#2 \q_stop
}
\cs_new_protected:Npn \flag_clear_new:n #1
{ \flag_if_exist:nTF {#1} { \flag_clear:n } { \flag_new:n } {#1} }
\cs_new_protected:Npn \flag_set_trap:nn #1#2
- { \cs_set:cpn { flag_trap_#1:w } ##1 ; {#2} }
+ { \cs_set:cpn { __flag_trap_#1:w } ##1 ; {#2} }
\prg_new_conditional:Npnn \flag_if_exist:n #1 { p , T , F , TF }
{
- \cs_if_exist:cTF { flag_trap_#1:w }
+ \cs_if_exist:cTF { __flag_trap_#1:w }
{ \prg_return_true: } { \prg_return_false: }
}
\prg_new_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF }
{
- \if_cs_exist:w l_#1_0_flag \cs_end:
+ \if_cs_exist:w __flag_#1_0: \cs_end:
\prg_return_true:
\else:
\prg_return_false:
\fi:
}
-\cs_new:Npn \flag_height:n #1 { \flag_height_loop:ww 0; #1 \q_stop }
-\cs_new:Npn \flag_height_loop:ww #1 ; #2 \q_stop
+\cs_new:Npn \flag_height:n #1 { \__flag_height_loop:ww 0; #1 \q_stop }
+\cs_new:Npn \__flag_height_loop:ww #1 ; #2 \q_stop
{
- \if_cs_exist:w l_#2_#1_flag \cs_end:
- \exp_after:wN \flag_height_loop:ww \int_use:N \int_eval:w \c_one +
+ \if_cs_exist:w __flag_#2_#1: \cs_end:
+ \exp_after:wN \__flag_height_loop:ww \int_use:N \__int_eval:w \c_one +
\else:
- \exp_after:wN \flag_height_end:ww
+ \exp_after:wN \__flag_height_end:ww
\fi:
#1 ; #2 \q_stop
}
-\cs_new:Npn \flag_height_end:ww #1 ; #2 \q_stop { #1 }
+\cs_new:Npn \__flag_height_end:ww #1 ; #2 \q_stop { #1 }
\cs_new:Npn \flag_raise:n #1
{
- \cs:w flag_trap_#1:w \exp_after:wN \cs_end:
- \int_value:w \flag_height:n {#1} ;
+ \cs:w __flag_trap_#1:w \exp_after:wN \cs_end:
+ \__int_value:w \flag_height:n {#1} ;
}
%%
%%
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty
index 0208088744a..7b31ebc4613 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty
@@ -46,448 +46,448 @@
%%
%% -----------------------------------------------------------------------
\RequirePackage{expl3}
-\GetIdInfo$Id: l3regex.dtx 3488 2012-03-03 19:49:03Z bruno $
- {L3 Experimental Regular Expressions}
+\GetIdInfo$Id: l3regex.dtx 3940 2012-07-09 00:41:44Z bruno $
+ {L3 Experimental regular expressions}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\RequirePackage{l3tl-build, l3tl-analysis, l3flag, l3str}
\cs_generate_variant:Nn \tl_to_str:n { V }
-\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 }
- }
-\int_new:N \l_regex_balance_int
-\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
+\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 }
+ }
+\int_new:N \l__regex_balance_int
+\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
+ \__regex_break_point:TF { } \__regex_break_true:w
}
-\cs_new_protected:Npn \regex_item_caseful_equal:n #1
+\cs_new_protected:Npn \__regex_item_caseful_equal:n #1
{
- \if_num:w #1 = \l_regex_current_char_int
- \exp_after:wN \regex_break_true:w
+ \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
+\cs_new_protected:Npn \__regex_item_caseful_range:nn #1 #2
{
- \reverse_if:N \if_num:w #1 > \l_regex_current_char_int
- \reverse_if:N \if_num:w #2 < \l_regex_current_char_int
- \exp_after:wN \exp_after:wN \exp_after:wN \regex_break_true:w
+ \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
+\cs_new_protected:Npn \__regex_item_caseless_equal:n #1
{
- \if_num:w #1 = \l_regex_current_char_int
- \exp_after:wN \regex_break_true:w
+ \if_int_compare:w #1 = \l__regex_current_char_int
+ \exp_after:wN \__regex_break_true:w
\fi:
- \if_num:w \l_regex_case_changed_char_int = \c_max_int
- \regex_compute_case_changed_char:
+ \if_int_compare:w \l__regex_case_changed_char_int = \c_max_int
+ \__regex_compute_case_changed_char:
\fi:
- \if_num:w #1 = \l_regex_case_changed_char_int
- \exp_after:wN \regex_break_true:w
+ \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
+\cs_new_protected:Npn \__regex_item_caseless_range:nn #1 #2
{
- \reverse_if:N \if_num:w #1 > \l_regex_current_char_int
- \reverse_if:N \if_num:w #2 < \l_regex_current_char_int
- \exp_after:wN \exp_after:wN \exp_after:wN \regex_break_true:w
+ \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_num:w \l_regex_case_changed_char_int = \c_max_int
- \regex_compute_case_changed_char:
+ \if_int_compare:w \l__regex_case_changed_char_int = \c_max_int
+ \__regex_compute_case_changed_char:
\fi:
- \reverse_if:N \if_num:w #1 > \l_regex_case_changed_char_int
- \reverse_if:N \if_num:w #2 < \l_regex_case_changed_char_int
- \exp_after:wN \exp_after:wN \exp_after:wN \regex_break_true:w
+ \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_nopar:Npn \regex_compute_case_changed_char:
+\cs_new_protected_nopar:Npn \__regex_compute_case_changed_char:
{
- \int_set_eq:NN \l_regex_case_changed_char_int \l_regex_current_char_int
- \if_num:w \l_regex_current_char_int < \c_ninety_one
- \if_num:w \l_regex_current_char_int < \c_sixty_five
+ \int_set_eq:NN \l__regex_case_changed_char_int \l__regex_current_char_int
+ \if_int_compare:w \l__regex_current_char_int < \c_ninety_one
+ \if_int_compare:w \l__regex_current_char_int < \c_sixty_five
\else:
- \int_add:Nn \l_regex_case_changed_char_int { \c_thirty_two }
+ \int_add:Nn \l__regex_case_changed_char_int { \c_thirty_two }
\fi:
\else:
- \if_num:w \l_regex_current_char_int < \c_one_hundred_twenty_three
- \if_num:w \l_regex_current_char_int < \c_ninety_seven
+ \if_int_compare:w \l__regex_current_char_int < \c_one_hundred_twenty_three
+ \if_int_compare:w \l__regex_current_char_int < \c_ninety_seven
\else:
- \int_sub:Nn \l_regex_case_changed_char_int { \c_thirty_two }
+ \int_sub:Nn \l__regex_case_changed_char_int { \c_thirty_two }
\fi:
\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_aux:
+\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
+ \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*\c_zero
\fi:
}
-\cs_new_protected:Npn \regex_item_catcode:nT #1
+\cs_new_protected:Npn \__regex_item_catcode:nT #1
{
- \if_int_odd:w \int_eval:w #1 / \regex_item_catcode_aux: \int_eval_end:
+ \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
+\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_num:w #1 = \l_regex_current_catcode_int
- \if_num:w #2 = \l_regex_current_char_int
- \exp_after:wN \exp_after:wN \exp_after:wN \regex_break_true:w
+ \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:c #1
+\cs_new_protected:Npn \__regex_item_exact_cs:c #1
{
- \int_compare:nNnTF \l_regex_current_catcode_int = \c_zero
+ \int_compare:nNnTF \l__regex_current_catcode_int = \c_zero
{
- \str_if_eq:xxTF
+ \str_if_eq_x:nnTF
{
\exp_after:wN \exp_after:wN \exp_after:wN \cs_to_str:N
- \tex_the:D \tex_toks:D \l_regex_current_pos_int
+ \tex_the:D \tex_toks:D \l__regex_current_pos_int
}
{ #1 }
- { \regex_break_true:w } { }
+ { \__regex_break_true:w } { }
}
{ }
}
-\cs_new_protected:Npn \regex_item_cs:n #1
+\cs_new_protected:Npn \__regex_item_cs:n #1
{
- \int_compare:nNnT \l_regex_current_catcode_int = \c_zero
+ \int_compare:nNnT \l__regex_current_catcode_int = \c_zero
{
\group_begin:
- \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:Nx \regex_match:n
+ \__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:Nx \__regex_match:n
{
\exp_after:wN \exp_after:wN
\exp_after:wN \cs_to_str:N
- \tex_the:D \tex_toks:D \l_regex_current_pos_int
+ \tex_the:D \tex_toks:D \l__regex_current_pos_int
}
- \if_meaning:w \c_true_bool \g_regex_success_bool
- \group_insert_after:N \regex_break_true:w
+ \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
+ \bool_gset_eq:NN \g__regex_success_bool \l__regex_saved_success_bool
\group_end:
}
}
-\cs_new_protected_nopar:Npn \regex_prop_d:
- { \regex_item_caseful_range:nn \c_forty_eight { 57 } } % 0--9
-\cs_new_protected_nopar:Npn \regex_prop_h:
- {
- \regex_item_caseful_equal:n \c_thirty_two % space
- \regex_item_caseful_equal:n \c_nine % tab
- }
-\cs_new_protected_nopar:Npn \regex_prop_s:
- {
- \regex_item_caseful_equal:n \c_thirty_two % space
- \regex_item_caseful_equal:n \c_nine % tab
- \regex_item_caseful_equal:n \c_ten % lf
- \regex_item_caseful_equal:n \c_twelve % ff
- \regex_item_caseful_equal:n \c_thirteen % cr
- }
-\cs_new_protected_nopar:Npn \regex_prop_v:
- { \regex_item_caseful_range:nn \c_ten \c_thirteen } % lf, vtab, ff, cr
-\cs_new_protected_nopar:Npn \regex_prop_w:
- {
- \regex_item_caseful_range:nn \c_ninety_seven { 122 } % a--z
- \regex_item_caseful_range:nn \c_sixty_five { 90 } % A--Z
- \regex_item_caseful_range:nn \c_forty_eight { 57 } % 0--9
- \regex_item_caseful_equal:n { 95 } % _
- }
-\cs_new_protected_nopar:Npn \regex_prop_N:
- { \regex_item_reverse:n { \regex_item_caseful_equal:n \c_ten } }
-\cs_new_protected_nopar:Npn \regex_posix_alnum:
- { \regex_posix_alpha: \regex_posix_digit: }
-\cs_new_protected_nopar:Npn \regex_posix_alpha:
- { \regex_posix_lower: \regex_posix_upper: }
-\cs_new_protected_nopar:Npn \regex_posix_ascii:
- { \regex_item_caseful_range:nn \c_zero \c_one_hundred_twenty_seven }
-\cs_new_eq:NN \regex_posix_blank: \regex_prop_h:
-\cs_new_protected_nopar:Npn \regex_posix_cntrl:
- {
- \regex_item_caseful_range:nn \c_zero { 31 }
- \regex_item_caseful_equal:n \c_one_hundred_twenty_seven
- }
-\cs_new_eq:NN \regex_posix_digit: \regex_prop_d:
-\cs_new_protected_nopar:Npn \regex_posix_graph:
- { \regex_item_caseful_range:nn { 33 } { 126 } }
-\cs_new_protected_nopar:Npn \regex_posix_lower:
- { \regex_item_caseful_range:nn \c_ninety_seven { 122 } }
-\cs_new_protected_nopar:Npn \regex_posix_print:
- { \regex_item_caseful_range:nn \c_thirty_two { 126 } }
-\cs_new_protected_nopar:Npn \regex_posix_punct:
- {
- \regex_item_caseful_range:nn { 33 } { 47 }
- \regex_item_caseful_range:nn { 58 } { 64 }
- \regex_item_caseful_range:nn { 91 } { 96 }
- \regex_item_caseful_range:nn { 123 } { 126 }
- }
-\cs_new_protected_nopar:Npn \regex_posix_space:
- {
- \regex_item_caseful_equal:n \c_thirty_two
- \regex_item_caseful_range:nn \c_nine \c_thirteen
- }
-\cs_new_protected_nopar:Npn \regex_posix_upper:
- { \regex_item_caseful_range:nn \c_sixty_five { 90 } }
-\cs_new_eq:NN \regex_posix_word: \regex_prop_w:
-\cs_new_protected_nopar:Npn \regex_posix_xdigit:
- {
- \regex_posix_digit:
- \regex_item_caseful_range:nn \c_sixty_five { 70 }
- \regex_item_caseful_range:nn \c_ninety_seven { 102 }
- }
-\cs_new_protected:Npn \regex_escape_use:nnnn #1#2#3#4
- {
- \trace_push:nnn { regex } { 1 } { regex_escape_use:nnnn }
- \tl_set_build:Nw \l_regex_internal_a_tl
- \cs_set_nopar:Npn \regex_escape_unescaped:N ##1 { #1 }
- \cs_set_nopar:Npn \regex_escape_escaped:N ##1 { #2 }
- \cs_set_nopar:Npn \regex_escape_raw:N ##1 { #3 }
+\cs_new_protected_nopar:Npn \__regex_prop_d:
+ { \__regex_item_caseful_range:nn \c_forty_eight { 57 } } % 0--9
+\cs_new_protected_nopar:Npn \__regex_prop_h:
+ {
+ \__regex_item_caseful_equal:n \c_thirty_two % space
+ \__regex_item_caseful_equal:n \c_nine % tab
+ }
+\cs_new_protected_nopar:Npn \__regex_prop_s:
+ {
+ \__regex_item_caseful_equal:n \c_thirty_two % space
+ \__regex_item_caseful_equal:n \c_nine % tab
+ \__regex_item_caseful_equal:n \c_ten % lf
+ \__regex_item_caseful_equal:n \c_twelve % ff
+ \__regex_item_caseful_equal:n \c_thirteen % cr
+ }
+\cs_new_protected_nopar:Npn \__regex_prop_v:
+ { \__regex_item_caseful_range:nn \c_ten \c_thirteen } % lf, vtab, ff, cr
+\cs_new_protected_nopar:Npn \__regex_prop_w:
+ {
+ \__regex_item_caseful_range:nn \c_ninety_seven { 122 } % a--z
+ \__regex_item_caseful_range:nn \c_sixty_five { 90 } % A--Z
+ \__regex_item_caseful_range:nn \c_forty_eight { 57 } % 0--9
+ \__regex_item_caseful_equal:n { 95 } % _
+ }
+\cs_new_protected_nopar:Npn \__regex_prop_N:
+ { \__regex_item_reverse:n { \__regex_item_caseful_equal:n \c_ten } }
+\cs_new_protected_nopar:Npn \__regex_posix_alnum:
+ { \__regex_posix_alpha: \__regex_posix_digit: }
+\cs_new_protected_nopar:Npn \__regex_posix_alpha:
+ { \__regex_posix_lower: \__regex_posix_upper: }
+\cs_new_protected_nopar:Npn \__regex_posix_ascii:
+ { \__regex_item_caseful_range:nn \c_zero \c_one_hundred_twenty_seven }
+\cs_new_eq:NN \__regex_posix_blank: \__regex_prop_h:
+\cs_new_protected_nopar:Npn \__regex_posix_cntrl:
+ {
+ \__regex_item_caseful_range:nn \c_zero { 31 }
+ \__regex_item_caseful_equal:n \c_one_hundred_twenty_seven
+ }
+\cs_new_eq:NN \__regex_posix_digit: \__regex_prop_d:
+\cs_new_protected_nopar:Npn \__regex_posix_graph:
+ { \__regex_item_caseful_range:nn { 33 } { 126 } }
+\cs_new_protected_nopar:Npn \__regex_posix_lower:
+ { \__regex_item_caseful_range:nn \c_ninety_seven { 122 } }
+\cs_new_protected_nopar:Npn \__regex_posix_print:
+ { \__regex_item_caseful_range:nn \c_thirty_two { 126 } }
+\cs_new_protected_nopar:Npn \__regex_posix_punct:
+ {
+ \__regex_item_caseful_range:nn { 33 } { 47 }
+ \__regex_item_caseful_range:nn { 58 } { 64 }
+ \__regex_item_caseful_range:nn { 91 } { 96 }
+ \__regex_item_caseful_range:nn { 123 } { 126 }
+ }
+\cs_new_protected_nopar:Npn \__regex_posix_space:
+ {
+ \__regex_item_caseful_equal:n \c_thirty_two
+ \__regex_item_caseful_range:nn \c_nine \c_thirteen
+ }
+\cs_new_protected_nopar:Npn \__regex_posix_upper:
+ { \__regex_item_caseful_range:nn \c_sixty_five { 90 } }
+\cs_new_eq:NN \__regex_posix_word: \__regex_prop_w:
+\cs_new_protected_nopar:Npn \__regex_posix_xdigit:
+ {
+ \__regex_posix_digit:
+ \__regex_item_caseful_range:nn \c_sixty_five { 70 }
+ \__regex_item_caseful_range:nn \c_ninety_seven { 102 }
+ }
+\cs_new_protected:Npn \__regex_escape_use:nnnn #1#2#3#4
+ {
+ \trace_push:nnn { regex } { 1 } { @@_escape_use:nnnn }
+ \__tl_build:Nw \l__regex_internal_a_tl
+ \cs_set_nopar:Npn \__regex_escape_unescaped:N ##1 { #1 }
+ \cs_set_nopar:Npn \__regex_escape_escaped:N ##1 { #2 }
+ \cs_set_nopar:Npn \__regex_escape_raw:N ##1 { #3 }
\int_set:Nn \tex_escapechar:D { 92 }
- \str_gset_other:Nn \g_regex_internal_tl { #4 }
- \tl_set:Nx \l_regex_internal_b_tl
+ \__str_gset_other:Nn \g__regex_internal_tl { #4 }
+ \tl_set:Nx \l__regex_internal_b_tl
{
- \exp_after:wN \regex_escape_loop:N \g_regex_internal_tl
- { break } \prg_break_point:n { }
+ \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
+ \__tl_build_one:o \l__regex_internal_b_tl
+ \__tl_build_end:
+ \trace_pop:nnn { regex } { 1 } { @@_escape_use:nnnn }
+ \l__regex_internal_a_tl
}
-\cs_new:Npn \regex_escape_loop:N #1
+\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_if_exist_use:cF { __regex_escape_\token_to_str:N #1:w }
+ { \__regex_escape_unescaped:N #1 }
+ \__regex_escape_loop:N
}
-\cs_new_nopar:cpn { regex_escape_ \c_backslash_str :w }
- \regex_escape_loop:N #1
+\cs_new_nopar: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_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_map_break:
-\cs_new_nopar:cpn { regex_escape_/break:w }
+\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_nopar:cpn { __regex_escape_/break:w }
{
\if_false: { \fi: }
- \msg_kernel_error:nn { regex } { trailing-backslash }
+ \__msg_kernel_error:nn { regex } { trailing-backslash }
\exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi:
}
-\cs_new_nopar:cpn { regex_escape_~:w } { }
-\cs_new_nopar:cpx { regex_escape_/a:w }
- { \exp_not:N \regex_escape_raw:N \iow_char:N \^^G }
-\cs_new_nopar:cpx { regex_escape_/t:w }
- { \exp_not:N \regex_escape_raw:N \iow_char:N \^^I }
-\cs_new_nopar:cpx { regex_escape_/n:w }
- { \exp_not:N \regex_escape_raw:N \iow_char:N \^^J }
-\cs_new_nopar:cpx { regex_escape_/f:w }
- { \exp_not:N \regex_escape_raw:N \iow_char:N \^^L }
-\cs_new_nopar:cpx { regex_escape_/r:w }
- { \exp_not:N \regex_escape_raw:N \iow_char:N \^^M }
-\cs_new_nopar: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 ;
+\cs_new_nopar:cpn { __regex_escape_~:w } { }
+\cs_new_nopar:cpx { __regex_escape_/a:w }
+ { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^G }
+\cs_new_nopar:cpx { __regex_escape_/t:w }
+ { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^I }
+\cs_new_nopar:cpx { __regex_escape_/n:w }
+ { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^J }
+\cs_new_nopar:cpx { __regex_escape_/f:w }
+ { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^L }
+\cs_new_nopar:cpx { __regex_escape_/r:w }
+ { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^M }
+\cs_new_nopar: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_two_hundred_fifty_six
{
- \exp_last_unbraced:Nf \regex_escape_raw:N
- { \str_output_byte:n {#1} }
+ \exp_last_unbraced:Nf \__regex_escape_raw:N
+ { \__str_output_byte:n {#1} }
}
- { \regex_escape_x_large:n {#1} }
+ { \__regex_escape_x_large:n {#1} }
}
\group_begin:
\char_set_catcode_other:n { 0 }
- \cs_new:Npn \regex_escape_x_large:n #1
+ \cs_new:Npn \__regex_escape_x_large:n #1
{
\if_false: { \fi: }
- \tl_build_one:o \l_regex_internal_b_tl
+ \__tl_build_one:o \l__regex_internal_b_tl
\int_compare:nNnTF {#1} > \c_max_char_int
{
- \msg_kernel_error:nnx { regex } { x-overflow } {#1}
- \tl_set:Nx \l_regex_internal_b_tl
- { \if_false: } \fi: \regex_escape_loop:N
+ \__msg_kernel_error:nnx { regex } { x-overflow } {#1}
+ \tl_set:Nx \l__regex_internal_b_tl
+ { \if_false: } \fi: \__regex_escape_loop:N
}
{
\char_set_lccode:nn { \c_zero } {#1}
\tl_to_lowercase:n
{
- \tl_set:Nx \l_regex_internal_b_tl
+ \tl_set:Nx \l__regex_internal_b_tl
{ \if_false: } \fi:
- \regex_escape_raw:N ^^@
- \regex_escape_loop:N
+ \__regex_escape_raw:N ^^@
+ \__regex_escape_loop:N
}
}
}
\group_end:
-\cs_new:Npn \regex_escape_x_test:N #1
+\cs_new:Npn \__regex_escape_x_test:N #1
{
- \str_if_eq:xxTF {#1} { break } { ; }
+ \str_if_eq_x:nnTF {#1} { break } { ; }
{
\if_charcode:w \c_space_token #1
- \exp_after:wN \regex_escape_x_test:N
+ \exp_after:wN \__regex_escape_x_test:N
\else:
- \exp_after:wN \regex_escape_x_test_ii:N
+ \exp_after:wN \__regex_escape_x_test_ii:N
\exp_after:wN #1
\fi:
}
}
-\cs_new:Npn \regex_escape_x_test_ii:N #1
+\cs_new:Npn \__regex_escape_x_test_ii:N #1
{
\if_charcode:w \c_lbrace_str #1
- \exp_after:wN \regex_escape_x_loop:N
+ \exp_after:wN \__regex_escape_x_loop:N
\else:
- \str_aux_hexadecimal_use:NTF #1
- { \exp_after:wN \regex_escape_x_ii:N }
- { ; \exp_after:wN \regex_escape_loop:N \exp_after:wN #1 }
+ \__str_hexadecimal_use:NTF #1
+ { \exp_after:wN \__regex_escape_x_ii:N }
+ { ; \exp_after:wN \__regex_escape_loop:N \exp_after:wN #1 }
\fi:
}
-\cs_new:Npn \regex_escape_x_ii:N #1
+\cs_new:Npn \__regex_escape_x_ii:N #1
{
- \str_if_eq:xxTF {#1} { break } { ; }
+ \str_if_eq_x:nnTF {#1} { break } { ; }
{
- \str_aux_hexadecimal_use:NTF #1
- { ; \regex_escape_loop:N }
- { ; \regex_escape_loop:N #1 }
+ \__str_hexadecimal_use:NTF #1
+ { ; \__regex_escape_loop:N }
+ { ; \__regex_escape_loop:N #1 }
}
}
-\cs_new:Npn \regex_escape_x_loop:N #1
+\cs_new:Npn \__regex_escape_x_loop:N #1
{
- \str_aux_hexadecimal_use:NTF #1
- { \regex_escape_x_loop:N }
+ \__str_hexadecimal_use:NTF #1
+ { \__regex_escape_x_loop:N }
{
\token_if_eq_charcode:NNTF \c_space_token #1
- { \regex_escape_x_loop:N }
+ { \__regex_escape_x_loop:N }
{
;
\exp_after:wN \token_if_eq_charcode:NNTF \c_rbrace_str #1
- { \regex_escape_loop:N }
+ { \__regex_escape_loop:N }
{
\if_false: { \fi: }
- \tl_build_one:o \l_regex_internal_b_tl
- \msg_kernel_error:nn { regex } { x-missing-rbrace } {#1}
- \tl_set:Nx \l_regex_internal_b_tl
- { \if_false: } \fi: \regex_escape_loop:N #1
+ \__tl_build_one:o \l__regex_internal_b_tl
+ \__msg_kernel_error:nn { 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_char_if_special:N #1 { TF }
+\prg_new_conditional:Npnn \__regex_char_if_special:N #1 { TF }
{
- \if_num:w `#1 < \c_ninety_one
- \if_num:w `#1 < \c_fifty_eight
- \if_num:w `#1 < \c_forty_eight
- \if_num:w `#1 < \c_thirty_two
+ \if_int_compare:w `#1 < \c_ninety_one
+ \if_int_compare:w `#1 < \c_fifty_eight
+ \if_int_compare:w `#1 < \c_forty_eight
+ \if_int_compare:w `#1 < \c_thirty_two
\prg_return_false: \else: \prg_return_true: \fi:
\else: \prg_return_false: \fi:
\else:
- \if_num:w `#1 < \c_sixty_five
+ \if_int_compare:w `#1 < \c_sixty_five
\prg_return_true: \else: \prg_return_false: \fi:
\fi:
\else:
- \if_num:w `#1 < \c_one_hundred_twenty_three
- \if_num:w `#1 < \c_ninety_seven
+ \if_int_compare:w `#1 < \c_one_hundred_twenty_three
+ \if_int_compare:w `#1 < \c_ninety_seven
\prg_return_true: \else: \prg_return_false: \fi:
\else:
- \if_num:w `#1 < \c_one_hundred_twenty_seven
+ \if_int_compare:w `#1 < \c_one_hundred_twenty_seven
\prg_return_true: \else: \prg_return_false: \fi:
\fi:
\fi:
}
-\prg_new_conditional:Npnn \regex_char_if_alphanumeric:N #1 { TF }
+\prg_new_conditional:Npnn \__regex_char_if_alphanumeric:N #1 { TF }
{
- \if_num:w `#1 < \c_ninety_one
- \if_num:w `#1 < \c_fifty_eight
- \if_num:w `#1 < \c_forty_eight
+ \if_int_compare:w `#1 < \c_ninety_one
+ \if_int_compare:w `#1 < \c_fifty_eight
+ \if_int_compare:w `#1 < \c_forty_eight
\prg_return_false: \else: \prg_return_true: \fi:
\else:
- \if_num:w `#1 < \c_sixty_five
+ \if_int_compare:w `#1 < \c_sixty_five
\prg_return_false: \else: \prg_return_true: \fi:
\fi:
\else:
- \if_num:w `#1 < \c_one_hundred_twenty_three
- \if_num:w `#1 < \c_ninety_seven
+ \if_int_compare:w `#1 < \c_one_hundred_twenty_three
+ \if_int_compare:w `#1 < \c_ninety_seven
\prg_return_false: \else: \prg_return_true: \fi:
\else:
\prg_return_false:
\fi:
\fi:
}
-\int_new:N \l_regex_group_level_int
-\int_new:N \l_regex_mode_int
-\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} }
+\int_new:N \l__regex_group_level_int
+\int_new:N \l__regex_mode_int
+\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
+\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} }
+ \__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 }
+\prg_new_conditional:Npnn \__regex_if_raw_digit:NN #1#2 { TF }
{
- \if_meaning:w \regex_compile_raw:N #1
+ \if_meaning:w \__regex_compile_raw:N #1
\if_int_compare:w \c_one < 1 #2 \exp_stop_f:
\prg_return_true:
\else:
@@ -497,305 +497,305 @@
\prg_return_false:
\fi:
}
-\cs_new_nopar:Npn \regex_if_in_class:TF
+\cs_new_nopar:Npn \__regex_if_in_class:TF
{
- \if_int_odd:w \l_regex_mode_int
+ \if_int_odd:w \l__regex_mode_int
\exp_after:wN \use_i:nn
\else:
\exp_after:wN \use_ii:nn
\fi:
}
-\cs_new_nopar:Npn \regex_if_in_cs:TF
+\cs_new_nopar:Npn \__regex_if_in_cs:TF
{
- \if_int_odd:w \l_regex_mode_int
+ \if_int_odd:w \l__regex_mode_int
\exp_after:wN \use_ii:nn
\else:
- \if_int_compare:w \l_regex_mode_int < \c_zero
+ \if_int_compare:w \l__regex_mode_int < \c_zero
\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_nopar:Npn \regex_if_in_class_or_catcode:TF
+\cs_new_nopar:Npn \__regex_if_in_class_or_catcode:TF
{
- \if_int_odd:w \l_regex_mode_int
+ \if_int_odd:w \l__regex_mode_int
\exp_after:wN \use_i:nn
\else:
- \if_int_compare:w \l_regex_mode_int > \c_zero
+ \if_int_compare:w \l__regex_mode_int > \c_zero
\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_nopar:Npn \regex_if_within_catcode:TF
+\cs_new_nopar:Npn \__regex_if_within_catcode:TF
{
- \if_int_compare:w \l_regex_mode_int > \c_zero
+ \if_int_compare:w \l__regex_mode_int > \c_zero
\exp_after:wN \use_i:nn
\else:
\exp_after:wN \use_ii:nn
\fi:
}
-\cs_new_protected:Npn \regex_chk_c_allowed:T
+\cs_new_protected:Npn \__regex_chk_c_allowed:T
{
- \if_num:w \l_regex_mode_int = \c_zero
+ \if_int_compare:w \l__regex_mode_int = \c_zero
\exp_after:wN \use:n
\else:
- \if_num:w \l_regex_mode_int = \c_three
+ \if_int_compare:w \l__regex_mode_int = \c_three
\exp_after:wN \exp_after:wN \exp_after:wN \use:n
\else:
- \msg_kernel_error:nn { regex } { c-bad-mode }
+ \__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:
+\cs_new_protected:Npn \__regex_mode_quit_c:
{
- \if_num:w \l_regex_mode_int = \c_two
- \l_regex_mode_int = \c_zero
+ \if_int_compare:w \l__regex_mode_int = \c_two
+ \l__regex_mode_int = \c_zero
\else:
- \if_num:w \l_regex_mode_int = \c_six
- \l_regex_mode_int = \c_three
+ \if_int_compare:w \l__regex_mode_int = \c_six
+ \l__regex_mode_int = \c_three
\fi:
\fi:
}
-\cs_new_protected_nopar:Npn \regex_compile:w
+\cs_new_protected_nopar:Npn \__regex_compile:w
{
- \tl_set_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_nopar:Npn \regex_item_equal:n { \regex_item_caseful_equal:n }
- \cs_set_nopar:Npn \regex_item_range:nn { \regex_item_caseful_range:nn }
- \tl_build_one:n { \regex_branch:n { \if_false: } \fi: }
+ \__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_nopar:Npn \__regex_item_equal:n { \__regex_item_caseful_equal:n }
+ \cs_set_nopar:Npn \__regex_item_range:nn { \__regex_item_caseful_range:nn }
+ \__tl_build_one:n { \__regex_branch:n { \if_false: } \fi: }
}
-\cs_new_protected_nopar:Npn \regex_compile_end:
+\cs_new_protected_nopar:Npn \__regex_compile_end:
{
- \regex_if_in_class:TF
+ \__regex_if_in_class:TF
{
- \msg_kernel_error:nn { regex } { missing-rbrack }
- \use:c { regex_compile_]: }
+ \__msg_kernel_error:nn { regex } { missing-rbrack }
+ \use:c { __regex_compile_]: }
\prg_do_nothing: \prg_do_nothing:
}
{ }
- \if_num:w \l_regex_group_level_int > \c_zero
- \msg_kernel_error:nnx { regex } { missing-rparen }
- { \int_use:N \l_regex_group_level_int }
+ \if_int_compare:w \l__regex_group_level_int > \c_zero
+ \__msg_kernel_error:nnx { regex } { missing-rparen }
+ { \int_use:N \l__regex_group_level_int }
\prg_replicate:nn
- { \l_regex_group_level_int }
+ { \l__regex_group_level_int }
{
- \tl_build_one:n
+ \__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
+ \__tl_build_end:
+ \__tl_build_one:o \l__regex_internal_regex
}
\fi:
- \tl_build_one:n { \if_false: { \fi: } }
- \tl_build_end:
+ \__tl_build_one:n { \if_false: { \fi: } }
+ \__tl_build_end:
}
-\cs_new_protected:Npn \regex_compile:n #1
+\cs_new_protected:Npn \__regex_compile:n #1
{
- \regex_compile:w
+ \__regex_compile:w
\int_set:Nn \tex_escapechar:D { 92 }
- \int_set_eq:NN \l_regex_mode_int \c_zero
- \regex_escape_use:nnnn
+ \int_set_eq:NN \l__regex_mode_int \c_zero
+ \__regex_escape_use:nnnn
{
- \regex_char_if_special:NTF ##1
- \regex_compile_special:N \regex_compile_raw:N ##1
+ \__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_char_if_alphanumeric:NTF ##1
+ \__regex_compile_escaped:N \__regex_compile_raw:N ##1
}
- { \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_zero
+ \int_compare:nNnT \l__regex_mode_int < \c_zero
{
- \msg_kernel_error:nn { regex } { c-missing-rbrace }
- \regex_compile_end:
- \regex_compile_one:x
- { \regex_item_cs:n { \exp_not:o \l_regex_internal_regex } }
+ \__msg_kernel_error:nn { regex } { c-missing-rbrace }
+ \__regex_compile_end:
+ \__regex_compile_one:x
+ { \__regex_item_cs:n { \exp_not:o \l__regex_internal_regex } }
\prg_do_nothing: \prg_do_nothing:
\prg_do_nothing: \prg_do_nothing:
}
- \regex_compile_end:
+ \__regex_compile_end:
}
-\cs_new_protected:Npn \regex_compile_special:N #1
+\cs_new_protected:Npn \__regex_compile_special:N #1
{
- \cs_if_exist_use:cF { regex_compile_#1: }
- { \regex_compile_raw: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_new_protected:Npn \__regex_compile_escaped:N #1
{
- \cs_if_exist_use:cF { regex_compile_/#1: }
- { \regex_compile_raw:N #1 }
+ \cs_if_exist_use:cF { __regex_compile_/#1: }
+ { \__regex_compile_raw:N #1 }
}
-\cs_new_protected:Npn \regex_compile_one:x #1
+\cs_new_protected:Npn \__regex_compile_one:x #1
{
- \regex_mode_quit_c:
- \regex_if_in_class:TF { }
+ \__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:n
+ { \__regex_class:NnnnN \c_true_bool { \if_false: } \fi: }
}
- \tl_build_one:x
+ \__tl_build_one:x
{
- \if_num:w \l_regex_catcodes_int < \c_regex_all_catcodes_int
- \regex_item_catcode:nT { \int_use:N \l_regex_catcodes_int }
+ \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 }
+ \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
+\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
+ \__regex_compile_raw:N
}
}
-\cs_generate_variant:Nn \regex_compile_abort_tokens:n { x }
-\cs_new_protected:Npn \regex_compile_quantifier:w #1#2
+\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
+ \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 }
+ \cs_if_exist_use:cF { __regex_compile_quantifier_#2:w }
+ { \__regex_compile_quantifier_none: #1 #2 }
}
- { \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
+\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}
+ \__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
+\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 } }
+ \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 }
+ \__tl_build_one:n { \if_false: { \fi: } { #1 } { #2 } \c_false_bool }
#3 #4
}
}
-\cs_new_protected_nopar:cpn { regex_compile_quantifier_?:w }
- { \regex_compile_quantifier_lazyness:nnNN { 0 } { 1 } }
-\cs_new_protected_nopar:cpn { regex_compile_quantifier_*:w }
- { \regex_compile_quantifier_lazyness:nnNN { 0 } { -1 } }
-\cs_new_protected_nopar:cpn { regex_compile_quantifier_+:w }
- { \regex_compile_quantifier_lazyness:nnNN { 1 } { -1 } }
-\cs_new_protected:cpn { regex_compile_quantifier_ \c_lbrace_str :w }
+\cs_new_protected_nopar:cpn { __regex_compile_quantifier_?:w }
+ { \__regex_compile_quantifier_lazyness:nnNN { 0 } { 1 } }
+\cs_new_protected_nopar:cpn { __regex_compile_quantifier_*:w }
+ { \__regex_compile_quantifier_lazyness:nnNN { 0 } { -1 } }
+\cs_new_protected_nopar:cpn { __regex_compile_quantifier_+:w }
+ { \__regex_compile_quantifier_lazyness:nnNN { 1 } { -1 } }
+\cs_new_protected:cpn { __regex_compile_quantifier_ \c_lbrace_str :w }
{
- \regex_get_digits:NTFw \l_regex_internal_a_int
- { \regex_compile_quantifier_braced_i:w }
- { \regex_compile_quantifier_abort:xNN { \c_lbrace_str } }
+ \__regex_get_digits:NTFw \l__regex_internal_a_int
+ { \__regex_compile_quantifier_braced_i:w }
+ { \__regex_compile_quantifier_abort:xNN { \c_lbrace_str } }
}
-\cs_new_protected:Npn \regex_compile_quantifier_braced_i:w #1#2
+\cs_new_protected:Npn \__regex_compile_quantifier_braced_i:w #1#2
{
- \prg_case_str:xxn { #1 #2 }
+ \str_case_x:nnn { #1 #2 }
{
- { \regex_compile_special:N \c_rbrace_str }
+ { \__regex_compile_special:N \c_rbrace_str }
{
- \exp_args:No \regex_compile_quantifier_lazyness:nnNN
- { \int_use:N \l_regex_internal_a_int } { 0 }
+ \exp_args:No \__regex_compile_quantifier_lazyness:nnNN
+ { \int_use:N \l__regex_internal_a_int } { 0 }
}
- { \regex_compile_special:N , }
+ { \__regex_compile_special:N , }
{
- \regex_get_digits:NTFw \l_regex_internal_b_int
- { \regex_compile_quantifier_braced_iii:w }
- { \regex_compile_quantifier_braced_ii:w }
+ \__regex_get_digits:NTFw \l__regex_internal_b_int
+ { \__regex_compile_quantifier_braced_iii:w }
+ { \__regex_compile_quantifier_braced_ii:w }
}
}
{
- \regex_compile_quantifier_abort:xNN
- { \c_lbrace_str \int_use:N \l_regex_internal_a_int }
+ \__regex_compile_quantifier_abort:xNN
+ { \c_lbrace_str \int_use:N \l__regex_internal_a_int }
#1 #2
}
}
-\cs_new_protected:Npn \regex_compile_quantifier_braced_ii:w #1#2
+\cs_new_protected:Npn \__regex_compile_quantifier_braced_ii:w #1#2
{
- \str_if_eq:xxTF
- { #1 #2 } { \regex_compile_special:N \c_rbrace_str }
+ \str_if_eq_x:nnTF
+ { #1 #2 } { \__regex_compile_special:N \c_rbrace_str }
{
- \exp_args:No \regex_compile_quantifier_lazyness:nnNN
- { \int_use:N \l_regex_internal_a_int } { -1 }
+ \exp_args:No \__regex_compile_quantifier_lazyness:nnNN
+ { \int_use:N \l__regex_internal_a_int } { -1 }
}
{
- \regex_compile_quantifier_abort:xNN
- { \c_lbrace_str \int_use:N \l_regex_internal_a_int , }
+ \__regex_compile_quantifier_abort:xNN
+ { \c_lbrace_str \int_use:N \l__regex_internal_a_int , }
#1 #2
}
}
-\cs_new_protected:Npn \regex_compile_quantifier_braced_iii:w #1#2
+\cs_new_protected:Npn \__regex_compile_quantifier_braced_iii:w #1#2
{
- \str_if_eq:xxTF
- { #1 #2 } { \regex_compile_special:N \c_rbrace_str }
+ \str_if_eq_x:nnTF
+ { #1 #2 } { \__regex_compile_special:N \c_rbrace_str }
{
- \if_num: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
+ \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
+ \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 }
+ \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
+ \__regex_compile_quantifier_abort:xNN
{
\c_lbrace_str
- \int_use:N \l_regex_internal_a_int ,
- \int_use:N \l_regex_internal_b_int
+ \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
+\cs_new_protected:Npn \__regex_compile_raw_error:N #1
{
- \msg_kernel_error:nnx { regex } { bad-escape } {#1}
- \regex_compile_raw: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
+\cs_new_protected:Npn \__regex_compile_raw:N #1#2#3
{
- \regex_if_in_class:TF
+ \__regex_if_in_class:TF
{
- \str_if_eq:nnTF {#2#3} { \regex_compile_special:N - }
- { \regex_compile_range:Nw #1 }
+ \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 ~ } }
+ \__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 ~ } }
+ \__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 }
+\prg_new_protected_conditional:Npnn \__regex_if_end_range:NN #1#2 { TF }
{
- \if_meaning:w \regex_compile_raw:N #1
+ \if_meaning:w \__regex_compile_raw:N #1
\prg_return_true:
\else:
- \if_meaning:w \regex_compile_special:N #1
+ \if_meaning:w \__regex_compile_special:N #1
\if_charcode:w ] #2
\prg_return_false:
\else:
@@ -806,1815 +806,1823 @@
\fi:
\fi:
}
-\cs_new_protected:Npn \regex_compile_range:Nw #1#2#3
+\cs_new_protected:Npn \__regex_compile_range:Nw #1#2#3
{
- \regex_if_end_range:NNTF #2 #3
+ \__regex_if_end_range:NNTF #2 #3
{
- \if_num:w `#1 > `#3 \exp_stop_f:
- \msg_kernel_error:nnxx { regex } { range-backwards } {#1} {#3}
+ \if_int_compare:w `#1 > `#3 \exp_stop_f:
+ \__msg_kernel_error:nnxx { regex } { range-backwards } {#1} {#3}
\else:
- \tl_build_one:x
+ \__tl_build_one:x
{
- \if_num:w `#1 = `#3 \exp_stop_f:
- \regex_item_equal:n
+ \if_int_compare:w `#1 = `#3 \exp_stop_f:
+ \__regex_item_equal:n
\else:
- \regex_item_range:nn { \int_value:w `#1 ~ }
+ \__regex_item_range:nn { \__int_value:w `#1 ~ }
\fi:
- { \int_value:w `#3 ~ }
+ { \__int_value:w `#3 ~ }
}
\fi:
}
{
- \msg_kernel_warning:nnxx { regex } { range-missing-end }
+ \__msg_kernel_warning:nnxx { regex } { range-missing-end }
{#1} { \c_backslash_str #3 }
- \tl_build_one:x
+ \__tl_build_one:x
{
- \regex_item_equal:n { \int_value:w `#1 ~ }
- \regex_item_equal:n { \int_value:w `- ~ }
+ \__regex_item_equal:n { \__int_value:w `#1 ~ }
+ \__regex_item_equal:n { \__int_value:w `- ~ }
}
#2#3
}
}
-\cs_new_protected_nopar:cpx { regex_compile_.: }
+\cs_new_protected_nopar:cpx { __regex_compile_.: }
{
- \exp_not:N \regex_if_in_class:TF
- { \regex_compile_raw:N . }
- { \regex_compile_one:x \exp_not:c { regex_prop_.: } }
+ \exp_not:N \__regex_if_in_class:TF
+ { \__regex_compile_raw:N . }
+ { \__regex_compile_one:x \exp_not:c { __regex_prop_.: } }
}
-\cs_new_protected_nopar:cpn { regex_prop_.: }
+\cs_new_protected_nopar:cpn { __regex_prop_.: }
{
- \if_num:w \l_regex_current_char_int > - \c_two
- \exp_after:wN \regex_break_true:w
+ \if_int_compare:w \l__regex_current_char_int > - \c_two
+ \exp_after:wN \__regex_break_true:w
\fi:
}
-\cs_set_protected:Npn \regex_tmp:w #1#2
+\cs_set_protected:Npn \__regex_tmp:w #1#2
{
- \cs_new_protected_nopar:cpx { regex_compile_/#1: }
- { \regex_compile_one:x \exp_not:c { regex_prop_#1: } }
- \cs_new_protected_nopar:cpx { regex_compile_/#2: }
+ \cs_new_protected_nopar:cpx { __regex_compile_/#1: }
+ { \__regex_compile_one:x \exp_not:c { __regex_prop_#1: } }
+ \cs_new_protected_nopar:cpx { __regex_compile_/#2: }
{
- \regex_compile_one:x
- { \regex_item_reverse:n \exp_not:c { regex_prop_#1: } }
+ \__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_nopar:cpn { regex_compile_/N: }
- { \regex_compile_one:x \regex_prop_N: }
-\cs_new_protected:Npn \regex_compile_anchor:NF #1#2
+\__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_nopar: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}
+ \__regex_if_in_class_or_catcode:TF {#2}
{
- \tl_build_one:n
- { \regex_assertion:Nn \c_true_bool { \regex_anchor:N #1 } }
+ \__tl_build_one:n
+ { \__regex_assertion:Nn \c_true_bool { \__regex_anchor:N #1 } }
}
}
-\cs_set_protected:Npn \regex_tmp:w #1#2
+\cs_set_protected:Npn \__regex_tmp:w #1#2
{
- \cs_new_protected_nopar:cpn { regex_compile_/#1: }
- { \regex_compile_anchor:NF #2 { \regex_compile_raw_error:N #1 } }
+ \cs_new_protected_nopar: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
+\__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_nopar:cpn { regex_compile_#1: }
- { \regex_compile_anchor:NF #2 { \regex_compile_raw:N #1 } }
+ \cs_new_protected_nopar: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_nopar:cpn { regex_compile_/b: }
+\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_nopar:cpn { __regex_compile_/b: }
{
- \regex_if_in_class_or_catcode:TF
- { \regex_compile_raw_error:N 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: } }
+ \__tl_build_one:n
+ { \__regex_assertion:Nn \c_true_bool { \__regex_b_test: } }
}
}
-\cs_new_protected_nopar:cpn { regex_compile_/B: }
+\cs_new_protected_nopar:cpn { __regex_compile_/B: }
{
- \regex_if_in_class_or_catcode:TF
- { \regex_compile_raw_error:N 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: } }
+ \__tl_build_one:n
+ { \__regex_assertion:Nn \c_false_bool { \__regex_b_test: } }
}
}
-\cs_new_protected:cpn { regex_compile_]: }
+\cs_new_protected:cpn { __regex_compile_]: }
{
- \regex_if_in_class:TF
+ \__regex_if_in_class:TF
{
- \if_num:w \l_regex_mode_int > \c_sixteen
- \tl_build_one:n { \if_false: { \fi: } }
+ \if_int_compare:w \l__regex_mode_int > \c_sixteen
+ \__tl_build_one:n { \if_false: { \fi: } }
\fi:
- \tex_advance:D \l_regex_mode_int - \c_fifteen
- \tex_divide:D \l_regex_mode_int \c_thirteen
- \if_int_odd:w \l_regex_mode_int \else:
- \exp_after:wN \regex_compile_quantifier:w
+ \tex_advance:D \l__regex_mode_int - \c_fifteen
+ \tex_divide:D \l__regex_mode_int \c_thirteen
+ \if_int_odd:w \l__regex_mode_int \else:
+ \exp_after:wN \__regex_compile_quantifier:w
\fi:
}
- { \regex_compile_raw:N ] }
+ { \__regex_compile_raw:N ] }
}
-\cs_new_protected_nopar:cpn { regex_compile_[: }
+\cs_new_protected_nopar:cpn { __regex_compile_[: }
{
- \regex_if_in_class:TF
- { \regex_compile_class_posix_test:w }
+ \__regex_if_in_class:TF
+ { \__regex_compile_class_posix_test:w }
{
- \regex_if_within_catcode:TF
+ \__regex_if_within_catcode:TF
{
- \exp_after:wN \regex_compile_class_catcode:w
- \int_use:N \l_regex_catcodes_int ;
+ \exp_after:wN \__regex_compile_class_catcode:w
+ \int_use:N \l__regex_catcodes_int ;
}
- { \regex_compile_class_normal:w }
+ { \__regex_compile_class_normal:w }
}
}
-\cs_new_protected_nopar:Npn \regex_compile_class_normal:w
+\cs_new_protected_nopar:Npn \__regex_compile_class_normal:w
{
- \regex_compile_class:TFNN
- { \regex_class:NnnnN \c_true_bool }
- { \regex_class:NnnnN \c_false_bool }
+ \__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;
+\cs_new_protected:Npn \__regex_compile_class_catcode:w #1;
{
- \if_int_compare:w \l_regex_mode_int = \c_two
- \tl_build_one:n
- { \regex_class:NnnnN \c_true_bool { \if_false: } \fi: }
+ \if_int_compare:w \l__regex_mode_int = \c_two
+ \__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} }
+ \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
+\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 ^ }
+ \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_ii:NN
+ \__tl_build_one:n { #2 { \if_false: } \fi: }
+ \__regex_compile_class_ii:NN
}
{
- \tl_build_one:n { #1 { \if_false: } \fi: }
- \regex_compile_class_ii:NN #3 #4
+ \__tl_build_one:n { #1 { \if_false: } \fi: }
+ \__regex_compile_class_ii:NN #3 #4
}
}
-\cs_new_protected:Npn \regex_compile_class_ii:NN #1#2
+\cs_new_protected:Npn \__regex_compile_class_ii:NN #1#2
{
\token_if_eq_charcode:NNTF #2 ]
- { \regex_compile_raw:N #2 }
+ { \__regex_compile_raw:N #2 }
{ #1 #2 }
}
-\cs_new_protected:Npn \regex_compile_class_posix_test:w #1#2
+\cs_new_protected:Npn \__regex_compile_class_posix_test:w #1#2
{
- \token_if_eq_meaning:NNT \regex_compile_special:N #1
+ \token_if_eq_meaning:NNT \__regex_compile_special:N #1
{
- \prg_case_str:nnn { #2 }
+ \str_case:nnn { #2 }
{
- : { \regex_compile_class_posix:NNNNw }
- = { \msg_kernel_warning:nnx { regex } { posix-unsupported } { = } }
- . { \msg_kernel_warning:nnx { regex } { posix-unsupported } { . } }
+ : { \__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
+ \__regex_compile_raw:N [ #1 #2
}
-\cs_new_protected:Npn \regex_compile_class_posix:NNNNw #1#2#3#4#5#6
+\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 ^ }
+ \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_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
+ \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
+\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 }
+ \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
+\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 ] }
+ { \__regex_compile_special:N : \__regex_compile_special:N ] }
{
- \cs_if_exist:cTF { regex_posix_ \l_regex_internal_a_tl : }
+ \cs_if_exist:cTF { __regex_posix_ \l__regex_internal_a_tl : }
{
- \regex_compile_one:x
+ \__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 : }
+ \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
+ \__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 :]
+ [: \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 }
+ \__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
+\cs_new_protected:Npn \__regex_compile_group_begin:N #1
{
- \tl_build_one:n { #1 { \if_false: } \fi: }
- \regex_mode_quit_c:
- \tl_set_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: }
+ \__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:
+\cs_new_protected:Npn \__regex_compile_group_end:
{
- \if_num:w \l_regex_group_level_int > \c_zero
- \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
+ \if_int_compare:w \l__regex_group_level_int > \c_zero
+ \__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 )
+ \__msg_kernel_warning:nn { regex } { extra-rparen }
+ \exp_after:wN \__regex_compile_raw:N \exp_after:wN )
\fi:
}
-\cs_new_protected_nopar:cpn { regex_compile_(: }
+\cs_new_protected_nopar:cpn { __regex_compile_(: }
{
- \regex_if_in_class:TF { \regex_compile_raw:N ( }
- { \regex_compile_lparen:w }
+ \__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
+\cs_new_protected:Npn \__regex_compile_lparen:w #1#2#3#4
{
- \str_if_eq:nnTF { #1 #2 } { \regex_compile_special:N ? }
+ \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 }
+ { __regex_compile_special_group_\token_to_str:N #4 :w }
{
- \msg_kernel_warning:nnx { regex } { special-group-unknown }
+ \__msg_kernel_warning:nnx { regex } { special-group-unknown }
{ (? \token_to_str:N #4 }
- \regex_compile_group_begin:N \regex_group:nnnN
- \regex_compile_raw:N ? #3 #4
+ \__regex_compile_group_begin:N \__regex_group:nnnN
+ \__regex_compile_raw:N ? #3 #4
}
}
{
- \regex_compile_group_begin:N \regex_group:nnnN
+ \__regex_compile_group_begin:N \__regex_group:nnnN
#1 #2 #3 #4
}
}
-\cs_new_protected_nopar:cpn { regex_compile_|: }
+\cs_new_protected_nopar:cpn { __regex_compile_|: }
{
- \regex_if_in_class:TF { \regex_compile_raw:N | }
+ \__regex_if_in_class:TF { \__regex_compile_raw:N | }
{
- \tl_build_one:n
- { \if_false: { \fi: } \regex_branch:n { \if_false: } \fi: }
+ \__tl_build_one:n
+ { \if_false: { \fi: } \__regex_branch:n { \if_false: } \fi: }
}
}
-\cs_new_protected_nopar:cpn { regex_compile_): }
+\cs_new_protected_nopar:cpn { __regex_compile_): }
{
- \regex_if_in_class:TF { \regex_compile_raw:N ) }
- { \regex_compile_group_end: }
+ \__regex_if_in_class:TF { \__regex_compile_raw:N ) }
+ { \__regex_compile_group_end: }
}
-\cs_new_protected_nopar:cpn { regex_compile_special_group_::w }
- { \regex_compile_group_begin:N \regex_group_no_capture:nnnN }
-\cs_new_protected_nopar: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
+\cs_new_protected_nopar:cpn { __regex_compile_special_group_::w }
+ { \__regex_compile_group_begin:N \__regex_group_no_capture:nnnN }
+\cs_new_protected_nopar: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 ) }
+ \str_if_eq:nnTF { #1 #2 } { \__regex_compile_special:N ) }
{
- \cs_set_nopar:Npn \regex_item_equal:n { \regex_item_caseless_equal:n }
- \cs_set_nopar:Npn \regex_item_range:nn { \regex_item_caseless_range:nn }
+ \cs_set_nopar:Npn \__regex_item_equal:n { \__regex_item_caseless_equal:n }
+ \cs_set_nopar: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
+ \__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_nopar:cpn { regex_compile_special_group_-:w } #1#2#3#4
+\cs_new_protected_nopar: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 ) }
+ { \__regex_compile_raw:N i \__regex_compile_special:N ) }
{
- \cs_set_nopar:Npn \regex_item_equal:n { \regex_item_caseful_equal:n }
- \cs_set_nopar:Npn \regex_item_range:nn { \regex_item_caseful_range:nn }
+ \cs_set_nopar:Npn \__regex_item_equal:n { \__regex_item_caseful_equal:n }
+ \cs_set_nopar: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 -
+ \__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
+\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
+ \token_if_eq_meaning:NNTF #1 \__regex_compile_raw:N
{
- \int_if_exist:cTF { c_regex_catcode_#2_int }
+ \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_two \else: \c_six \fi:
+ \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_two \else: \c_six \fi:
}
}
- { \cs_if_exist_use:cF { regex_compile_c_#2:w } }
+ { \cs_if_exist_use:cF { __regex_compile_c_#2:w } }
{
- \msg_kernel_error:nnx { regex } { c-missing-category } {#2}
+ \__msg_kernel_error:nnx { regex } { c-missing-category } {#2}
#1 #2
}
}
-\cs_new_protected:cpn { regex_compile_c_[:w } #1#2
+\cs_new_protected:cpn { __regex_compile_c_[:w } #1#2
{
- \l_regex_mode_int
- = \if_case:w \l_regex_mode_int \c_two \else: \c_six \fi:
- \int_zero:N \l_regex_catcodes_int
- \str_if_eq:nnTF { #1 #2 } { \regex_compile_special:N ^ }
+ \l__regex_mode_int
+ = \if_case:w \l__regex_mode_int \c_two \else: \c_six \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_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
+ \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
+\cs_new_protected:Npn \__regex_compile_c_lbrack_loop:NN #1#2
{
- \token_if_eq_meaning:NNTF #1 \regex_compile_raw:N
+ \token_if_eq_meaning:NNTF #1 \__regex_compile_raw:N
{
- \int_if_exist:cTF { c_regex_catcode_#2_int }
+ \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
+ \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: }
+ { \__regex_compile_c_lbrack_end: }
}
{
- \msg_kernel_error:nnx { regex } { c-missing-rbrack } {#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
+\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:
+ \if_int_odd:w \__int_eval:w \l__regex_catcodes_int / #1 \__int_eval_end:
\else:
- \tex_advance:D \l_regex_catcodes_int #1
+ \tex_advance:D \l__regex_catcodes_int #1
\fi:
}
-\cs_new_protected_nopar:Npn \regex_compile_c_lbrack_end:
+\cs_new_protected_nopar: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 }
+ \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_nopar:cpn { regex_compile_c_ \c_lbrace_str :w }
+\cs_new_protected_nopar:cpn { __regex_compile_c_ \c_lbrace_str :w }
{
- \regex_compile:w
- \regex_disable_submatches:
- \l_regex_mode_int
- = - \if_case:w \l_regex_mode_int \c_two \else: \c_six \fi:
+ \__regex_compile:w
+ \__regex_disable_submatches:
+ \l__regex_mode_int
+ = - \if_case:w \l__regex_mode_int \c_two \else: \c_six \fi:
}
-\cs_new_protected:cpn { regex_compile_ \c_rbrace_str : }
+\cs_new_protected:cpn { __regex_compile_ \c_rbrace_str : }
{
- \regex_if_in_cs:TF
+ \__regex_if_in_cs:TF
{
- \regex_compile_end:
- \regex_compile_one:x
- { \regex_item_cs:n { \exp_not:o \l_regex_internal_regex } }
+ \__regex_compile_end:
+ \__regex_compile_one:x
+ { \__regex_item_cs:n { \exp_not:o \l__regex_internal_regex } }
}
- { \exp_after:wN \regex_compile_raw:N \c_rbrace_str }
+ { \exp_after:wN \__regex_compile_raw:N \c_rbrace_str }
}
-\cs_new_protected:cpn { regex_compile_/u: } #1#2
+\cs_new_protected:cpn { __regex_compile_/u: } #1#2
{
- \regex_if_in_class_or_catcode:TF
- { \regex_compile_raw_error:N u #1 #2 }
+ \__regex_if_in_class_or_catcode:TF
+ { \__regex_compile_raw_error:N u #1 #2 }
{
- \str_if_eq:xxTF {#1#2} { \regex_compile_special:N \c_lbrace_str }
+ \str_if_eq_x:nnTF {#1#2} { \__regex_compile_special:N \c_lbrace_str }
{
- \tl_set:Nx \l_regex_internal_a_tl { \if_false: } \fi:
- \regex_compile_u_loop:NN
+ \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
+ \__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
+\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_raw:N
+ { #2 \__regex_compile_u_loop:NN }
{
- \token_if_eq_meaning:NNTF #1 \regex_compile_special:N
+ \token_if_eq_meaning:NNTF #1 \__regex_compile_special:N
{
\exp_after:wN \token_if_eq_charcode:NNTF \c_rbrace_str #2
- { \if_false: { \fi: } \regex_compile_u_end: }
- { #2 \regex_compile_u_loop:NN }
+ { \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:
+ \__msg_kernel_error:nnx { regex } { u-missing-rbrace } {#2}
+ \__regex_compile_u_end:
#1 #2
}
}
}
-\cs_new_protected:Npn \regex_compile_u_end:
+\cs_new_protected:Npn \__regex_compile_u_end:
{
- \tl_set:Nv \l_regex_internal_a_tl { \l_regex_internal_a_tl }
- \if_num:w \l_regex_mode_int = \c_zero
- \regex_compile_u_not_cs:
+ \tl_set:Nv \l__regex_internal_a_tl { \l__regex_internal_a_tl }
+ \if_int_compare:w \l__regex_mode_int = \c_zero
+ \__regex_compile_u_not_cs:
\else:
- \regex_compile_u_in_cs:
+ \__regex_compile_u_in_cs:
\fi:
}
-\cs_new_protected:Npn \regex_compile_u_in_cs:
+\cs_new_protected:Npn \__regex_compile_u_in_cs:
{
- \exp_args:NNo \str_gset_other:Nn \g_regex_internal_tl
- { \l_regex_internal_a_tl }
- \tl_build_one:x
+ \exp_args:NNo \__str_gset_other:Nn \g__regex_internal_tl
+ { \l__regex_internal_a_tl }
+ \__tl_build_one:x
{
- \tl_map_function:NN \g_regex_internal_tl
- \regex_compile_u_in_cs_aux:n
+ \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
+\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 } }
+ \__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:
+\cs_new_protected:Npn \__regex_compile_u_not_cs:
{
- \exp_args:No \tl_analysis_map_inline:nn { \l_regex_internal_a_tl }
+ \exp_args:No \__tl_analysis_map_inline:nn { \l__regex_internal_a_tl }
{
- \tl_build_one:n
+ \__tl_build_one:n
{
- \regex_class:NnnnN \c_true_bool
+ \__regex_class:NnnnN \c_true_bool
{
- \if_num:w "##2 = \c_zero
- \regex_item_exact_cs:c { \exp_after:wN \cs_to_str:N ##1 }
+ \if_int_compare:w "##2 = \c_zero
+ \__regex_item_exact_cs:c { \exp_after:wN \cs_to_str:N ##1 }
\else:
- \regex_item_exact:nn { \int_value:w "##2 } { ##3 }
+ \__regex_item_exact:nn { \__int_value:w "##2 } { ##3 }
\fi:
}
{ 1 } { 0 } \c_false_bool
}
}
}
-\cs_new_protected_nopar:cpn { regex_compile_/K: }
+\cs_new_protected_nopar:cpn { __regex_compile_/K: }
{
- \int_compare:nNnTF \l_regex_mode_int = \c_zero
- { \tl_build_one:n { \regex_command_K: } }
- { \regex_compile_raw_error:N K }
+ \int_compare:nNnTF \l__regex_mode_int = \c_zero
+ { \__tl_build_one:n { \__regex_command_K: } }
+ { \__regex_compile_raw_error:N K }
}
-\cs_new_protected:Npn \regex_show_aux:Nx #1#2
+\cs_new_protected:Npn \__regex_show:Nx #1#2
{
- \tl_set_build:Nw \l_regex_internal_a_tl
- \cs_set_protected_nopar:Npn \regex_branch:n
+ \__tl_build:Nw \l__regex_internal_a_tl
+ \cs_set_protected_nopar: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
+ \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_nopar:Npn \regex_group:nnnN
- { \regex_show_group_aux:nnnnN { } }
- \cs_set_protected_nopar:Npn \regex_group_no_capture:nnnN
- { \regex_show_group_aux:nnnnN { ~(no~capture) } }
- \cs_set_protected_nopar: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_nopar: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_nopar: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
+ \cs_set_protected_nopar:Npn \__regex_group:nnnN
+ { \__regex_show_group_aux:nnnnN { } }
+ \cs_set_protected_nopar:Npn \__regex_group_no_capture:nnnN
+ { \__regex_show_group_aux:nnnnN { ~(no~capture) } }
+ \cs_set_protected_nopar: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_nopar: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_nopar: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
+ \__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_protected:Npn \regex_item_exact_cs:c ##1
- { \regex_show_one:n { control~sequence~\iow_char:N\\##1 } }
- \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_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_protected:Npn \__regex_item_exact_cs:c ##1
+ { \__regex_show_one:n { control~sequence~\iow_char:N\\##1 } }
+ \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 { ~ }
#1
- \tl_build_end:
- \msg_aux_show:x { > Compiled~regex~#2: \l_regex_internal_a_tl }
+ \__tl_build_end:
+ \__msg_show_variable:x { > Compiled~regex~#2: \l__regex_internal_a_tl }
}
-\cs_new_protected:Npn \regex_show_one:n #1
+\cs_new_protected:Npn \__regex_show_one:n #1
{
- \int_incr:N \l_regex_show_lines_int
- \tl_build_one:x
- { \iow_newline: \seq_use:N \l_regex_show_prefix_seq #1 }
+ \int_incr:N \l__regex_show_lines_int
+ \__tl_build_one:x
+ {
+ \iow_newline:
+ \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
+\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 { ~ }
+ \__regex_show_one:n {#1}
+ \__regex_show_push:n { ~ }
#2
- \regex_show_pop:
+ \__regex_show_pop:
}
-\cs_new_protected:Npn \regex_show_group_aux:nnnnN #1#2#3#4#5
+\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 { | }
+ \__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 }
+ \__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
+\cs_set:Npn \__regex_show_class:NnnnN #1#2#3#4#5
{
- \tl_set_build:Nw \l_regex_internal_a_tl
- \int_zero:N \l_regex_show_lines_int
- \regex_show_push:n {~}
+ \__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
- \prg_case_int:nnn { \l_regex_show_lines_int }
+ \int_case:nnn { \l__regex_show_lines_int }
{
{0}
{
- \tl_build_end:
- \regex_show_one:n { \bool_if:NTF #1 { Fail } { Pass } }
+ \__tl_build_end:
+ \__regex_show_one:n { \bool_if:NTF #1 { Fail } { Pass } }
}
{1}
{
- \tl_build_end:
+ \__tl_build_end:
\bool_if:NTF #1
{
#2
- \tl_build_one:n { \regex_msg_repeated:nnN {#3} {#4} #5 }
+ \__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
+ \__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
+ \__tl_build_end:
+ \__regex_show_one:n
{
\bool_if:NTF #1 { M } { Don't~m } atch
- \regex_msg_repeated:nnN {#3} {#4} #5
+ \__regex_msg_repeated:nnN {#3} {#4} #5
}
- \tl_build_one:o \l_regex_internal_a_tl
+ \__tl_build_one:o \l__regex_internal_a_tl
}
}
-\cs_new:Npn \regex_show_anchor_to_str:N #1
+\cs_new:Npn \__regex_show_anchor_to_str:N #1
{
anchor~at~
- \prg_case_str:nnn { #1 }
+ \str_case:nnn { #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) }
+ { \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
+\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
+ \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_use:N \l_regex_internal_seq, ~
+ categories~
+ \seq_map_function:NN \l__regex_internal_seq \use:n
+ , ~
\bool_if:NF #1 { negative~ } class
}
}
-\int_new:N \l_regex_min_state_int
-\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
+\int_new:N \l__regex_min_state_int
+\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
+ \__regex_compile:n {#1}
+ \__regex_build:N \l__regex_internal_regex
}
-\cs_new_protected:Npn \regex_build:N #1
+\cs_new_protected:Npn \__regex_build:N #1
{
- \trace_push:nnn { regex } { 1 } { regex_build }
+ \trace_push:nnn { regex } { 1 } { @@_build }
\int_set:Nn \tex_escapechar:D { 92 }
- \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:
+ \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: }
+ \@@_trace_states:n { 2 }
+ \trace_pop:nnn { regex } { 1 } { @@_build }
+ }
+\cs_new_protected:Npn \__regex_build_for_cs:n #1
+ {
+ \trace_push:nnn { regex } { 1 } { @@_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
+ \__regex_pop_lr_states:
+ \__regex_toks_put_right:Nn \l__regex_right_state_int
{
- \if_num:w \l_regex_current_pos_int = \l_regex_max_pos_int
- \exp_after:wN \regex_action_success:
+ \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 }
+ \@@_trace_states:n { 2 }
+ \trace_pop:nnn { regex } { 1 } { @@_build_for_cs }
}
-\cs_new_protected_nopar:Npn \regex_push_lr_states:
+\cs_new_protected_nopar: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 }
+ \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_nopar:Npn \regex_pop_lr_states:
+\cs_new_protected_nopar: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
+ \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_toks_put_left:Nx #1#2
+\cs_new_protected:Npn \__regex_toks_put_left:Nx #1#2
{
- \cs_set_nopar:Npx \regex_tmp:w { #2 }
+ \cs_set_nopar: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 }
+ { \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_new_protected:Npn \__regex_toks_put_right:Nx #1#2
{
- \cs_set_nopar:Npx \regex_tmp:w {#2}
+ \cs_set_nopar: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 }
+ { \tex_the:D \tex_toks:D \exp_after:wN #1 \__regex_tmp:w }
}
-\cs_new_protected:Npn \regex_toks_put_right:Nn #1#2
+\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_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_nopar:Npn \regex_build_new_state:
+\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_nopar: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 + \c_one }
+ 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 + \c_one }
}
- \tex_toks:D \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
+ \tex_toks:D \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
+\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
+ \__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 } }
+ #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 } }
+ #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_new_protected:Npn \__regex_class:NnnnN #1#2#3#4#5
{
- \cs_set_nopar:Npx \regex_tests_action_cost:n ##1
+ \cs_set_nopar: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} } }
+ { \__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
+ \__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
+\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
+ \__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
+\cs_new_protected:Npn \__regex_class_repeat:nN #1#2
{
- \if_num:w #1 = \c_zero
- \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
+ \if_int_compare:w #1 = \c_zero
+ \__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
+ \__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
+\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 - \c_one }
+ \__regex_class_repeat:n {#1}
+ \int_set:Nn \l__regex_internal_a_int
+ { \l__regex_max_state_int + #2 - \c_one }
\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
+ \__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
+\cs_new_protected:Npn \__regex_group_aux:nnnnN #1#2#3#4#5
{
- \trace_push:nnn { regex } { 1 } { regex_group }
- \if_num:w #3 = \c_zero
- \regex_build_new_state:
- \regex_build_transition_right:nNn \regex_action_free_group:n
- \l_regex_left_state_int \l_regex_right_state_int
+ \trace_push:nnn { regex } { 1 } { @@_group }
+ \if_int_compare:w #3 = \c_zero
+ \__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:
+ \__regex_build_new_state:
+ \__regex_push_lr_states:
#2
- \regex_pop_lr_states:
+ \__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
+ \__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 }
+ \trace_pop:nnn { regex } { 1 } { @@_group }
}
-\cs_new_protected:Npn \regex_group:nnnN #1
+\cs_new_protected:Npn \__regex_group:nnnN #1
{
- \exp_args:No \regex_group_aux:nnnnN
- { \int_use:N \l_regex_capturing_group_int }
+ \exp_args:No \__regex_group_aux:nnnnN
+ { \int_use:N \l__regex_capturing_group_int }
{
- \int_incr:N \l_regex_capturing_group_int
+ \int_incr:N \l__regex_capturing_group_int
#1
}
}
-\cs_new_protected_nopar:Npn \regex_group_no_capture:nnnN
- { \regex_group_aux:nnnnN { -1 } }
-\cs_new_protected:Npn \regex_group_resetting:nnnN #1
+\cs_new_protected_nopar: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 }
+ \__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 }
+ \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_map_break:n } { }
- \prg_break_point:n { }
+ { ?? \__prg_break:n } { }
+ \__prg_break_point:
}
}
-\cs_new_protected:Npn \regex_group_resetting_loop:nnNn #1#2#3#4
+\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}
+ \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 } }
+ \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
+\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
+ \trace_push:nnn { regex } { 1 } { @@_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 }
+ \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 } { @@_branch }
}
-\cs_new_protected:Npn \regex_group_repeat:nn #1#2
+\cs_new_protected:Npn \__regex_group_repeat:nn #1#2
{
- \if_num:w #2 = \c_zero
- \int_set:Nn \l_regex_max_state_int
- { \l_regex_left_state_int - \c_one }
- \regex_build_new_state:
+ \if_int_compare:w #2 = \c_zero
+ \int_set:Nn \l__regex_max_state_int
+ { \l__regex_left_state_int - \c_one }
+ \__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:
+ \__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
+\cs_new_protected:Npn \__regex_group_submatches:nNN #1#2#3
{
- \if_num:w #1 > \c_minus_one
- \regex_toks_put_left:Nx #2 { \regex_action_submatch:n { #1 < } }
- \regex_toks_put_left:Nx #3 { \regex_action_submatch:n { #1 > } }
+ \if_int_compare:w #1 > \c_minus_one
+ \__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
+\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_num:w \int_eval:w #1 > \c_one
- \int_set:Nn \l_regex_internal_c_int
+ \__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 > \c_one
+ \int_set:Nn \l__regex_internal_c_int
{
( #1 - \c_one )
- * ( \l_regex_internal_b_int - \l_regex_internal_a_int )
+ * ( \l__regex_internal_b_int - \l__regex_internal_a_int )
}
- \tex_advance:D \l_regex_right_state_int \l_regex_internal_c_int
- \tex_advance:D \l_regex_max_state_int \l_regex_internal_c_int
- \prg_replicate:nn \l_regex_internal_c_int
+ \tex_advance:D \l__regex_right_state_int \l__regex_internal_c_int
+ \tex_advance:D \l__regex_max_state_int \l__regex_internal_c_int
+ \prg_replicate:nn \l__regex_internal_c_int
{
- \tex_toks:D \l_regex_internal_b_int
- = \tex_toks:D \l_regex_internal_a_int
- \tex_advance:D \l_regex_internal_a_int \c_one
- \tex_advance:D \l_regex_internal_b_int \c_one
+ \tex_toks:D \l__regex_internal_b_int
+ = \tex_toks:D \l__regex_internal_a_int
+ \tex_advance:D \l__regex_internal_a_int \c_one
+ \tex_advance:D \l__regex_internal_b_int \c_one
}
\fi:
}
-\cs_new_protected:Npn \regex_group_repeat:nnN #1#2#3
+\cs_new_protected:Npn \__regex_group_repeat:nnN #1#2#3
{
- \if_num:w #2 = \c_zero
- \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 - \c_one }
- \regex_build_transition_right:nNn \regex_action_free:n
- \l_regex_right_state_int \l_regex_internal_a_int
- \regex_build_new_state:
+ \if_int_compare:w #2 = \c_zero
+ \__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 - \c_one }
+ \__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
+ \__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
+ \__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
+ \__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
+ \__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
+ \__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:
+ \__regex_build_new_state:
\fi:
}
-\cs_new_protected:Npn \regex_group_repeat:nnnN #1#2#3#4
+\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 }
+ \__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
+ \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
+ \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 - \c_one }
{
- \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
+ \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_num:w #2 = \c_zero
- \int_set:Nn \l_regex_right_state_int
- { \l_regex_left_state_int - \c_one }
+ \if_int_compare:w #2 = \c_zero
+ \int_set:Nn \l__regex_right_state_int
+ { \l__regex_left_state_int - \c_one }
\else:
- \int_sub:Nn \l_regex_right_state_int
- { \l_regex_internal_b_int - \l_regex_internal_a_int }
+ \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
+ \__regex_build_transition_right:nNn \__regex_action_free:n
+ \l__regex_right_state_int \l__regex_max_state_int
\fi:
- \regex_build_new_state:
+ \__regex_build_new_state:
}
-\cs_new_protected:Npn \regex_assertion:Nn #1#2
+\cs_new_protected:Npn \__regex_assertion:Nn #1#2
{
- \regex_build_new_state:
- \regex_toks_put_right:Nx \l_regex_left_state_int
+ \__regex_build_new_state:
+ \__regex_toks_put_right:Nx \l__regex_left_state_int
{
\exp_not:n {#2}
- \regex_break_point:TF
+ \__regex_break_point:TF
\bool_if:NF #1 { { } }
{
- \regex_action_free:n
+ \__regex_action_free:n
{
\int_eval:n
- { \l_regex_right_state_int - \l_regex_left_state_int }
+ { \l__regex_right_state_int - \l__regex_left_state_int }
}
}
\bool_if:NT #1 { { } }
}
}
-\cs_new_protected:Npn \regex_anchor:N #1
+\cs_new_protected:Npn \__regex_anchor:N #1
{
- \if_num:w #1 = \l_regex_current_pos_int
- \exp_after:wN \regex_break_true:w
+ \if_int_compare:w #1 = \l__regex_current_pos_int
+ \exp_after:wN \__regex_break_true:w
\fi:
}
-\cs_new_protected_nopar:Npn \regex_b_test:
+\cs_new_protected_nopar: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_nopar: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
-\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 }
+ \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_nopar: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
+\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 } { @@_match }
\trace:nnx { regex } { 1 } { analyzing~query~token~list }
- \int_zero:N \l_regex_balance_int
- \int_set:Nn \l_regex_current_pos_int { \c_two * \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 }
+ \int_zero:N \l__regex_balance_int
+ \int_set:Nn \l__regex_current_pos_int { \c_two * \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
- \prg_stepwise_inline:nnnn
- \l_regex_min_state_int \c_one { \l_regex_max_state_int - \c_one }
+ \bool_gset_false:N \g__regex_success_bool
+ \int_step_inline:nnnn
+ \l__regex_min_state_int \c_one { \l__regex_max_state_int - \c_one }
{ \tex_dimen:D ##1 \c_one sp \scan_stop: }
- \int_set_eq:NN \l_regex_min_active_int \l_regex_max_state_int
- \int_set_eq:NN \l_regex_step_int \c_zero
- \int_set_eq:NN \l_regex_success_pos_int \l_regex_min_pos_int
- \int_set:Nn \l_regex_submatch_int
- { \c_two * \l_regex_max_state_int }
- \bool_set_false:N \l_regex_empty_success_bool
- \regex_match_once:
- \trace_pop:nnx { regex } { 1 } { regex_match }
- }
-\cs_new_protected_nopar:Npn \regex_match_once:
- {
- \if_meaning:w \c_true_bool \l_regex_empty_success_bool
- \cs_set_nopar:Npn \regex_if_two_empty_matches:F
- { \int_compare:nNnF \l_regex_start_pos_int = \l_regex_current_pos_int }
+ \int_set_eq:NN \l__regex_min_active_int \l__regex_max_state_int
+ \int_set_eq:NN \l__regex_step_int \c_zero
+ \int_set_eq:NN \l__regex_success_pos_int \l__regex_min_pos_int
+ \int_set:Nn \l__regex_submatch_int
+ { \c_two * \l__regex_max_state_int }
+ \bool_set_false:N \l__regex_empty_success_bool
+ \__regex_match_once:
+ \trace_pop:nnx { regex } { 1 } { @@_match }
+ }
+\cs_new_protected_nopar:Npn \__regex_match_once:
+ {
+ \if_meaning:w \c_true_bool \l__regex_empty_success_bool
+ \cs_set_nopar: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
+ \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 - \c_one }
- \regex_query_get:
- \regex_match_loop:
- \l_regex_every_match_tl
+ \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 - \c_one }
+ \__regex_query_get:
+ \__regex_match_loop:
+ \l__regex_every_match_tl
}
-\cs_new_protected_nopar:Npn \regex_single_match:
+\cs_new_protected_nopar: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 }
+ \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
+\cs_new_protected:Npn \__regex_multi_match:n #1
{
- \tl_set:Nn \l_regex_every_match_tl
+ \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
+ \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:
+ \exp_after:wN \__regex_match_once:
\fi:
}
}
-\cs_new_protected_nopar:Npn \regex_match_loop:
+\cs_new_protected_nopar:Npn \__regex_match_loop:
{
- \tex_advance:D \l_regex_step_int \c_two
- \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:
+ \tex_advance:D \l__regex_step_int \c_two
+ \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
- \exp_after:wN \regex_match_one_active:w
- \int_use:N \l_regex_min_active_int ;
+ \int_set_eq:NN \l__regex_max_active_int \l__regex_min_active_int
+ \exp_after:wN \__regex_match_one_active:w
+ \int_use:N \l__regex_min_active_int ;
}
- \prg_break_point:n { \bool_set_false:N \l_regex_fresh_thread_bool }
- \if_num:w \l_regex_max_active_int > \l_regex_min_active_int
- \if_num:w \l_regex_current_pos_int < \l_regex_max_pos_int
- \exp_after:wN \exp_after:wN \exp_after:wN \regex_match_loop:
+ \__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:w #1;
+\cs_new:Npn \__regex_match_one_active:w #1;
{
- \if_num:w #1 < \l_regex_max_active_int
- \regex_use_state_and_submatches:nn
- { \int_value:w \tex_skip:D #1 }
+ \if_int_compare:w #1 < \l__regex_max_active_int
+ \__regex_use_state_and_submatches:nn
+ { \__int_value:w \tex_skip:D #1 }
{ \tex_the:D \tex_toks:D #1 }
- \exp_after:wN \regex_match_one_active:w
- \int_use:N \int_eval:w #1 + \c_one \exp_after:wN ;
+ \exp_after:wN \__regex_match_one_active:w
+ \int_use:N \__int_eval:w #1 + \c_one \exp_after:wN ;
\fi:
}
-\cs_new_protected:Npn \regex_query_set:nnn #1#2#3
+\cs_new_protected:Npn \__regex_query_set:nnn #1#2#3
{
- \tex_muskip:D \l_regex_current_pos_int
+ \tex_muskip:D \l__regex_current_pos_int
= \etex_gluetomu:D
#3 sp
plus #2 sp
- minus \l_regex_balance_int sp
+ minus \l__regex_balance_int sp
\scan_stop:
- \tex_toks:D \l_regex_current_pos_int {#1}
- \int_incr:N \l_regex_current_pos_int
+ \tex_toks:D \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
+ \or: \int_incr:N \l__regex_balance_int
+ \or: \int_decr:N \l__regex_balance_int
\fi:
}
-\cs_new_protected_nopar:Npn \regex_query_get:
+\cs_new_protected_nopar:Npn \__regex_query_get:
{
- \l_regex_current_char_int
- = \etex_mutoglue:D \tex_muskip:D \l_regex_current_pos_int
- \l_regex_current_catcode_int = \etex_gluestretch:D
- \etex_mutoglue:D \tex_muskip:D \l_regex_current_pos_int
+ \l__regex_current_char_int
+ = \etex_mutoglue:D \tex_muskip:D \l__regex_current_pos_int
+ \l__regex_current_catcode_int = \etex_gluestretch:D
+ \etex_mutoglue:D \tex_muskip:D \l__regex_current_pos_int
}
-\cs_new_protected_nopar:Npn \regex_use_state:
+\cs_new_protected_nopar:Npn \__regex_use_state:
{
- \trace:nnx { regex } { 2 } { state~\int_use:N \l_regex_current_state_int }
- \tex_dimen:D \l_regex_current_state_int
- = \l_regex_step_int sp \scan_stop:
- \tex_the:D \tex_toks:D \l_regex_current_state_int
- \tex_dimen:D \l_regex_current_state_int
- = \int_eval:w \l_regex_step_int + \c_one \int_eval_end: sp \scan_stop:
+ \trace:nnx { regex } { 2 } { state~\int_use:N \l__regex_current_state_int }
+ \tex_dimen:D \l__regex_current_state_int
+ = \l__regex_step_int sp \scan_stop:
+ \tex_the:D \tex_toks:D \l__regex_current_state_int
+ \tex_dimen:D \l__regex_current_state_int
+ = \__int_eval:w \l__regex_step_int + \c_one \__int_eval_end: sp \scan_stop:
}
-\cs_new_protected:Npn \regex_use_state_and_submatches:nn #1 #2
+\cs_new_protected:Npn \__regex_use_state_and_submatches:nn #1 #2
{
- \int_set:Nn \l_regex_current_state_int {#1}
- \if_num:w \tex_dimen:D \l_regex_current_state_int < \l_regex_step_int
- \tl_set:Nn \l_regex_current_submatches_prop {#2}
- \exp_after:wN \regex_use_state:
+ \int_set:Nn \l__regex_current_state_int {#1}
+ \if_int_compare:w \tex_dimen:D \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_nopar:Npn \regex_action_start_wildcard:
+\cs_new_protected_nopar: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}
+ \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_nopar:Npn \regex_action_free:n
- { \regex_action_free_aux:nn { > \l_regex_step_int \else: } }
-\cs_new_protected_nopar: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
+\cs_new_protected_nopar:Npn \__regex_action_free:n
+ { \__regex_action_free_aux:nn { > \l__regex_step_int \else: } }
+\cs_new_protected_nopar: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}
+ \int_add:Nn \l__regex_current_state_int {#2}
\exp_not:n
{
- \if_num:w \tex_dimen:D \l_regex_current_state_int #1
- \exp_after:wN \regex_use_state:
+ \if_int_compare:w \tex_dimen:D \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 }
+ \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
+\cs_new_protected:Npn \__regex_action_cost:n #1
{
- \exp_args:No \regex_store_state:n
- { \int_use:N \int_eval:w \l_regex_current_state_int + #1 }
+ \exp_args:No \__regex_store_state:n
+ { \int_use:N \__int_eval:w \l__regex_current_state_int + #1 }
}
-\cs_new_protected:Npn \regex_store_state:n #1
+\cs_new_protected:Npn \__regex_store_state:n #1
{
- \regex_store_submatches:
- \tex_skip:D \l_regex_max_active_int = #1 sp \scan_stop:
- \int_incr:N \l_regex_max_active_int
+ \__regex_store_submatches:
+ \tex_skip:D \l__regex_max_active_int = #1 sp \scan_stop:
+ \int_incr:N \l__regex_max_active_int
}
-\cs_new_protected_nopar:Npn \regex_store_submatches:
+\cs_new_protected_nopar:Npn \__regex_store_submatches:
{
- \tex_toks:D \l_regex_max_active_int \exp_after:wN
- { \l_regex_current_submatches_prop }
+ \tex_toks:D \l__regex_max_active_int \exp_after:wN
+ { \l__regex_current_submatches_prop }
}
-\cs_new_protected_nopar:Npn \regex_disable_submatches:
+\cs_new_protected_nopar:Npn \__regex_disable_submatches:
{
- \cs_set_protected_nopar:Npn \regex_store_submatches: { }
- \cs_set_protected:Npn \regex_action_submatch:n ##1 { }
+ \cs_set_protected_nopar:Npn \__regex_store_submatches: { }
+ \cs_set_protected:Npn \__regex_action_submatch:n ##1 { }
}
-\cs_new_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 }
+ \prop_put:Nno \l__regex_current_submatches_prop {#1}
+ { \int_use:N \l__regex_current_pos_int }
}
-\cs_new_protected_nopar:Npn \regex_action_success:
+\cs_new_protected_nopar:Npn \__regex_action_success:
{
- \regex_if_two_empty_matches:F
+ \__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_map_break:
+ \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_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
+\int_new:N \l__regex_replacement_csnames_int
+\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
+ \__regex_query_range:nn
{ \etex_glueshrink:D \tex_skip:D #1 }
{ \tex_skip:D #1 }
}
-\cs_new:Npn \regex_replacement_exp_not:N #1 { \exp_not:n {#1} }
-\cs_new:Npn \regex_query_range:nn #1#2
+\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_use:N \int_eval:w #1 \exp_after:wN ;
- \int_use:N \int_eval:w #2 ;
- \prg_break_point:n { }
+ \exp_after:wN \__regex_query_range_loop:ww
+ \int_use:N \__int_eval:w #1 \exp_after:wN ;
+ \int_use:N \__int_eval:w #2 ;
+ \__prg_break_point:
}
-\cs_new:Npn \regex_query_range_loop:ww #1 ; #2 ;
+\cs_new:Npn \__regex_query_range_loop:ww #1 ; #2 ;
{
- \if_num:w #1 < #2 \exp_stop_f:
+ \if_int_compare:w #1 < #2 \exp_stop_f:
\else:
- \exp_after:wN \prg_map_break:
+ \exp_after:wN \__prg_break:
\fi:
\tex_the:D \tex_toks:D #1 \exp_stop_f:
- \exp_after:wN \regex_query_range_loop:ww
- \int_use:N \int_eval:w #1 + \c_one ; #2 ;
+ \exp_after:wN \__regex_query_range_loop:ww
+ \int_use:N \__int_eval:w #1 + \c_one ; #2 ;
}
-\cs_new:Npn \regex_query_submatch:n #1
+\cs_new:Npn \__regex_query_submatch:n #1
{
- \regex_query_range:nn
- { \tex_skip:D \int_eval:w #1 }
- { \etex_gluestretch:D \tex_skip:D \int_eval:w #1 }
+ \__regex_query_range:nn
+ { \tex_skip:D \__int_eval:w #1 }
+ { \etex_gluestretch:D \tex_skip:D \__int_eval:w #1 }
}
-\cs_new_protected:Npn \regex_submatch_balance:n #1
+\cs_new_protected:Npn \__regex_submatch_balance:n #1
{
\etex_glueshrink:D \etex_mutoglue:D \etex_muexpr:D
\tex_muskip:D \etex_gluestretch:D \tex_skip:D #1
- \tex_muskip:D \tex_skip:D #1
\scan_stop:
}
-\cs_new_protected:Npn \regex_replacement:n #1
+\cs_new_protected:Npn \__regex_replacement:n #1
{
- \trace_push:nnn { regex } { 1 } { regex_replacement:n }
- \tl_set_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
+ \trace_push:nnn { regex } { 1 } { @@_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_rbrace_str ##1
- \regex_replacement_rbrace:N \else: \tl_build_one:n \fi: ##1
+ \__regex_replacement_rbrace:N \else: \__tl_build_one:n \fi: ##1
}
- { \regex_replacement_escaped:N ##1 }
- { \tl_build_one:n ##1 }
+ { \__regex_replacement_escaped:N ##1 }
+ { \__tl_build_one:n ##1 }
{#1}
\prg_do_nothing: \prg_do_nothing:
- \if_int_compare:w \l_regex_replacement_csnames_int > \c_zero
- \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: }
+ \if_int_compare:w \l__regex_replacement_csnames_int > \c_zero
+ \__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:
- \cs_gset:Npx \regex_replacement_balance_one_match:n ##1
+ \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}
+ + \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 }
+ \__tl_build_end:
+ \exp_args:No \__regex_replacement_aux:n \l__regex_internal_a_tl
+ \trace_pop:nnn { regex } { 1 } { @@_replacement:n }
}
-\cs_new_protected:Npn \regex_replacement_aux:n #1
+\cs_new_protected:Npn \__regex_replacement_aux:n #1
{
- \cs_set:Npn \regex_replacement_do_one_match:n ##1
+ \cs_set:Npn \__regex_replacement_do_one_match:n ##1
{
- \regex_query_range:nn
+ \__regex_query_range:nn
{ \etex_glueshrink:D \tex_skip:D ##1 }
{ \tex_skip:D ##1 }
#1
}
}
-\cs_new_protected:Npn \regex_replacement_escaped:N #1
+\cs_new_protected:Npn \__regex_replacement_escaped:N #1
{
- \cs_if_exist_use:cF { regex_replacement_#1:w }
+ \cs_if_exist_use:cF { __regex_replacement_#1:w }
{
- \if_num:w \c_one < 1#1 \exp_stop_f:
- \regex_replacement_put_submatch:n {#1}
+ \if_int_compare:w \c_one < 1#1 \exp_stop_f:
+ \__regex_replacement_put_submatch:n {#1}
\else:
- \tl_build_one:n #1
+ \__tl_build_one:n #1
\fi:
}
}
-\cs_new_protected:Npn \regex_replacement_put_submatch:n #1
+\cs_new_protected:Npn \__regex_replacement_put_submatch:n #1
{
- \if_num:w #1 < \l_regex_capturing_group_int
- \tl_build_one:n { \regex_query_submatch:n { #1 + ##1 } }
- \if_num:w \l_regex_replacement_csnames_int = \c_zero
- \tl_put_right:Nn \l_regex_balance_tl
- { + \regex_submatch_balance:n { \int_eval:w #1+##1 \int_eval_end: } }
+ \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 = \c_zero
+ \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
+\cs_new_protected:Npn \__regex_replacement_g:w #1#2
{
- \str_if_eq:xxTF { #1#2 } { \tl_build_one:n \c_lbrace_str }
+ \str_if_eq_x:nnTF { #1#2 } { \__tl_build_one:n \c_lbrace_str }
{
- \int_zero:N \l_regex_internal_a_int
- \regex_replacement_g_digits:NN
+ \int_zero:N \l__regex_internal_a_int
+ \__regex_replacement_g_digits:NN
}
- { \regex_replacement_error:NNN g #1 #2 }
+ { \__regex_replacement_error:NNN g #1 #2 }
}
-\cs_new_protected:Npn \regex_replacement_g_digits:NN #1#2
+\cs_new_protected:Npn \__regex_replacement_g_digits:NN #1#2
{
- \token_if_eq_meaning:NNTF #1 \tl_build_one:n
+ \token_if_eq_meaning:NNTF #1 \__tl_build_one:n
{
- \if_num:w \c_one < 1#2 \exp_stop_f:
- \int_set:Nn \l_regex_internal_a_int
- { \c_ten * \l_regex_internal_a_int + #2 }
+ \if_int_compare:w \c_one < 1#2 \exp_stop_f:
+ \int_set:Nn \l__regex_internal_a_int
+ { \c_ten * \l__regex_internal_a_int + #2 }
\exp_after:wN \use_i:nnn
- \exp_after:wN \regex_replacement_g_digits:NN
+ \exp_after:wN \__regex_replacement_g_digits:NN
\else:
- \exp_after:wN \regex_replacement_error:NNN
+ \exp_after:wN \__regex_replacement_error:NNN
\exp_after:wN g
\fi:
}
{
- \if_meaning:w \regex_replacement_rbrace:N #1
- \exp_args:No \regex_replacement_put_submatch:n
- { \int_use:N \l_regex_internal_a_int }
+ \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 \__regex_replacement_error:NNN
\exp_after:wN g
\fi:
}
#1 #2
}
-\cs_new_protected:Npn \regex_replacement_c:w #1#2
+\cs_new_protected:Npn \__regex_replacement_c:w #1#2
{
- \token_if_eq_meaning:NNTF #1 \tl_build_one:n
+ \token_if_eq_meaning:NNTF #1 \__tl_build_one:n
{
- \cs_if_exist_use:cF { regex_replacement_c_#2:w }
- { \regex_replacement_error:NNN c #1#2 }
+ \cs_if_exist_use:cF { __regex_replacement_c_#2:w }
+ { \__regex_replacement_error:NNN c #1#2 }
}
- { \regex_replacement_error:NNN c #1#2 }
+ { \__regex_replacement_error:NNN c #1#2 }
}
-\cs_new_protected_nopar:cpn { regex_replacement_c_ \c_lbrace_str :w }
+\cs_new_protected_nopar:cpn { __regex_replacement_c_ \c_lbrace_str :w }
{
- \if_case:w \l_regex_replacement_csnames_int
- \tl_build_one:n
- { \exp_not:n { \exp_after:wN \regex_replacement_exp_not:N \cs:w } }
+ \if_case:w \l__regex_replacement_csnames_int
+ \__tl_build_one:n
+ { \exp_not:n { \exp_after:wN \__regex_replacement_exp_not:N \cs:w } }
\else:
- \tl_build_one:n { \exp_not:n { \exp_after:wN \tl_to_str:N \cs:w } }
+ \__tl_build_one:n { \exp_not:n { \exp_after:wN \tl_to_str:N \cs:w } }
\fi:
- \int_incr:N \l_regex_replacement_csnames_int
+ \int_incr:N \l__regex_replacement_csnames_int
}
-\cs_new_protected:Npn \regex_replacement_u:w #1#2
+\cs_new_protected:Npn \__regex_replacement_u:w #1#2
{
- \str_if_eq:xxTF { #1#2 } { \tl_build_one:n \c_lbrace_str }
+ \str_if_eq_x:nnTF { #1#2 } { \__tl_build_one:n \c_lbrace_str }
{
- \if_case:w \l_regex_replacement_csnames_int
- \tl_build_one:n { \exp_not:n { \exp_after:wN \exp_not:V \cs:w } }
+ \if_case:w \l__regex_replacement_csnames_int
+ \__tl_build_one:n { \exp_not:n { \exp_after:wN \exp_not:V \cs:w } }
\else:
- \tl_build_one:n { \exp_not:n { \exp_after:wN \tl_to_str:V \cs:w } }
+ \__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
+ \int_incr:N \l__regex_replacement_csnames_int
}
- { \regex_replacement_error:NNN u #1#2 }
+ { \__regex_replacement_error:NNN u #1#2 }
}
-\cs_new_protected:Npn \regex_replacement_rbrace:N #1
+\cs_new_protected:Npn \__regex_replacement_rbrace:N #1
{
- \if_int_compare:w \l_regex_replacement_csnames_int > \c_zero
- \tl_build_one:n \cs_end:
- \int_decr:N \l_regex_replacement_csnames_int
+ \if_int_compare:w \l__regex_replacement_csnames_int > \c_zero
+ \__tl_build_one:n \cs_end:
+ \int_decr:N \l__regex_replacement_csnames_int
\else:
- \tl_build_one:n #1
+ \__tl_build_one:n #1
\fi:
}
\group_begin:
- \cs_new_protected:Npn \regex_replacement_char:nNN #1#2#3
+ \cs_new_protected:Npn \__regex_replacement_char:nNN #1#2#3
{
\if_meaning:w \prg_do_nothing: #3
- \msg_kernel_error:nn { regex } { replacement-catcode-end }
+ \__msg_kernel_error:nn { regex } { replacement-catcode-end }
\else:
\tex_lccode:D \c_zero = `#3 \scan_stop:
- \tl_to_lowercase:n { \tl_build_one:n {#1} }
+ \tl_to_lowercase:n { \__tl_build_one:n {#1} }
\fi:
}
\char_set_catcode_active:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_A:w
- { \regex_replacement_char:nNN { \exp_not:n { \exp_not:N ^^@ } } }
+ \cs_new_protected_nopar: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_nopar:Npn \regex_replacement_c_B:w
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_B:w
{
- \if_num:w \l_regex_replacement_csnames_int = \c_zero
- \int_incr:N \l_regex_balance_int
+ \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero
+ \int_incr:N \l__regex_balance_int
\fi:
- \regex_replacement_char:nNN
+ \__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} } }
+ \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_nopar:Npn \regex_replacement_c_D:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_D:w
+ { \__regex_replacement_char:nNN { ^^@ } }
\char_set_catcode_group_end:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_E:w
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_E:w
{
- \if_num:w \l_regex_replacement_csnames_int = \c_zero
- \int_decr:N \l_regex_balance_int
+ \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero
+ \int_decr:N \l__regex_balance_int
\fi:
- \regex_replacement_char:nNN
+ \__regex_replacement_char:nNN
{ \exp_not:n { \if_false: { \fi: ^^@ } }
}
\char_set_catcode_letter:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_L:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_L:w
+ { \__regex_replacement_char:nNN { ^^@ } }
\char_set_catcode_math_toggle:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_M:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_M:w
+ { \__regex_replacement_char:nNN { ^^@ } }
\char_set_catcode_other:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_O:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_O:w
+ { \__regex_replacement_char:nNN { ^^@ } }
\char_set_catcode_parameter:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_P:w
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_P:w
{
- \regex_replacement_char:nNN
+ \__regex_replacement_char:nNN
{ \exp_not:n { \exp_not:n { ^^@^^@^^@^^@ } } }
}
- \cs_new_protected:Npn \regex_replacement_c_S:w #1#2
+ \cs_new_protected:Npn \__regex_replacement_c_S:w #1#2
{
\if_meaning:w \prg_do_nothing: #2
- \msg_kernel_error:nn { regex } { replacement-catcode-end }
+ \__msg_kernel_error:nn { regex } { replacement-catcode-end }
\else:
- \if_num:w `#2 = \c_zero
- \msg_kernel_error:nn { regex } { replacement-null-space }
+ \if_int_compare:w `#2 = \c_zero
+ \__msg_kernel_error:nn { regex } { replacement-null-space }
\fi:
\tex_lccode:D 32 = `#2 \scan_stop:
- \tl_to_lowercase:n { \tl_build_one:n {~} }
+ \tl_to_lowercase:n { \__tl_build_one:n {~} }
\fi:
}
\char_set_catcode_alignment:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_T:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_T:w
+ { \__regex_replacement_char:nNN { ^^@ } }
\char_set_catcode_math_superscript:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_U:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_U:w
+ { \__regex_replacement_char:nNN { ^^@ } }
\group_end:
-\cs_new_protected:Npn \regex_replacement_error:NNN #1#2#3
+\cs_new_protected:Npn \__regex_replacement_error:NNN #1#2#3
{
- \msg_kernel_error:nnx { regex } { replacement-#1 } {#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_eq:NN #1 \c__regex_no_match_regex }
\cs_new_protected_nopar:Npn \regex_set:Nn #1#2
{
- \regex_compile:n {#2}
- \tl_set_eq:NN #1 \l_regex_internal_regex
+ \__regex_compile:n {#2}
+ \tl_set_eq:NN #1 \l__regex_internal_regex
}
\cs_new_protected_nopar:Npn \regex_gset:Nn #1#2
{
- \regex_compile:n {#2}
- \tl_gset_eq:NN #1 \l_regex_internal_regex
+ \__regex_compile:n {#2}
+ \tl_gset_eq:NN #1 \l__regex_internal_regex
}
\cs_new_protected_nopar:Npn \regex_const:Nn #1#2
{
- \regex_compile:n {#2}
- \tl_const:Nx #1 { \exp_not:o \l_regex_internal_regex }
+ \__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_aux:Nx \l_regex_internal_regex
+ \__regex_compile:n {#1}
+ \__regex_show:Nx \l__regex_internal_regex
{ { \tl_to_str:n {#1} } }
}
\cs_new_protected:Npn \regex_show:N #1
- { \regex_show_aux:Nx #1 { variable~\token_to_str:N #1 } }
+ { \__regex_show:Nx #1 { variable~\token_to_str:N #1 } }
\prg_new_protected_conditional:Npnn \regex_match:nn #1#2 { T , F , TF }
{
- \regex_match_aux:nn { \regex_build:n {#1} } {#2}
- \regex_aux_return:
+ \__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_match_aux:nn { \regex_build:N #1 } {#2}
- \regex_aux_return:
+ \__regex_if_match:nn { \__regex_build:N #1 } {#2}
+ \__regex_return:
}
\cs_new_protected:Npn \regex_count:nnN #1
- { \regex_count_aux:nnN { \regex_build:n {#1} } }
+ { \__regex_count:nnN { \__regex_build:n {#1} } }
\cs_new_protected:Npn \regex_count:NnN #1
- { \regex_count_aux:nnN { \regex_build:N #1 } }
-\cs_set_protected:Npn \regex_tmp:w #1#2#3
+ { \__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 } }
+ \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_aux_return: }
+ { #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_aux_return: }
+ { #1 { \__regex_build:N ##1 } {##2} ##3 \__regex_return: }
}
-\regex_tmp:w \regex_extract_once_aux:nnN
+\__regex_tmp:w \__regex_extract_once:nnN
\regex_extract_once:nnN \regex_extract_once:NnN
-\regex_tmp:w \regex_extract_all_aux:nnN
+\__regex_tmp:w \__regex_extract_all:nnN
\regex_extract_all:nnN \regex_extract_all:NnN
-\regex_tmp:w \regex_replace_once_aux:nnN
+\__regex_tmp:w \__regex_replace_once:nnN
\regex_replace_once:nnN \regex_replace_once:NnN
-\regex_tmp:w \regex_replace_all_aux:nnN
+\__regex_tmp:w \__regex_replace_all:nnN
\regex_replace_all:nnN \regex_replace_all:NnN
-\regex_tmp:w \regex_split_aux: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_submatch_int
-\int_new:N \l_regex_zeroth_submatch_int
-\cs_new_protected_nopar:Npn \regex_aux_return:
- {
- \if_meaning:w \c_true_bool \g_regex_success_bool
+\__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_submatch_int
+\int_new:N \l__regex_zeroth_submatch_int
+\cs_new_protected_nopar: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_match_aux:nn #1#2
+\cs_new_protected:Npn \__regex_if_match:nn #1#2
{
\group_begin:
- \regex_disable_submatches:
- \regex_single_match:
+ \__regex_disable_submatches:
+ \__regex_single_match:
#1
- \regex_match:n {#2}
+ \__regex_match:n {#2}
\group_end:
}
-\cs_new_protected:Npn \regex_count_aux:nnN #1#2#3
+\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 }
+ \__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}
+ \__regex_match:n {#2}
\exp_args:NNNo
\group_end:
- \int_set:Nn #3 { \int_use:N \l_regex_match_count_int }
+ \int_set:Nn #3 { \int_use:N \l__regex_match_count_int }
}
-\cs_new_protected:Npn \regex_extract_once_aux:nnN #1#2#3
+\cs_new_protected:Npn \__regex_extract_once:nnN #1#2#3
{
\group_begin:
- \regex_single_match:
+ \__regex_single_match:
#1
- \regex_match:n {#2}
- \regex_extract:
- \regex_group_end_extract_seq:N #3
+ \__regex_match:n {#2}
+ \__regex_extract:
+ \__regex_group_end_extract_seq:N #3
}
-\cs_new_protected:Npn \regex_extract_all_aux:nnN #1#2#3
+\cs_new_protected:Npn \__regex_extract_all:nnN #1#2#3
{
\group_begin:
- \regex_multi_match:n { \regex_extract: }
+ \__regex_multi_match:n { \__regex_extract: }
#1
- \regex_match:n {#2}
- \regex_group_end_extract_seq:N #3
+ \__regex_match:n {#2}
+ \__regex_group_end_extract_seq:N #3
}
-\cs_new_protected:Npn \regex_split_aux:nnN #1#2#3
+\cs_new_protected:Npn \__regex_split:nnN #1#2#3
{
\group_begin:
- \regex_multi_match:n
+ \__regex_multi_match:n
{
- \if_num:w \l_regex_start_pos_int < \l_regex_success_pos_int
- \regex_extract:
- \tex_skip:D \l_regex_zeroth_submatch_int
- = \l_regex_start_pos_int sp
- plus \tex_skip:D \l_regex_zeroth_submatch_int \scan_stop:
+ \if_int_compare:w \l__regex_start_pos_int < \l__regex_success_pos_int
+ \__regex_extract:
+ \tex_skip:D \l__regex_zeroth_submatch_int
+ = \l__regex_start_pos_int sp
+ plus \tex_skip:D \l__regex_zeroth_submatch_int \scan_stop:
\fi:
}
#1
- \regex_match:n {#2}
- \tex_skip:D \l_regex_submatch_int
- = \l_regex_start_pos_int sp plus \l_regex_max_pos_int sp \scan_stop:
- \int_incr:N \l_regex_submatch_int
- \if_meaning:w \c_true_bool \l_regex_empty_success_bool
- \if_num:w \l_regex_start_pos_int = \l_regex_max_pos_int
- \int_decr:N \l_regex_submatch_int
+ \__regex_match:n {#2}
+ \tex_skip:D \l__regex_submatch_int
+ = \l__regex_start_pos_int sp plus \l__regex_max_pos_int sp \scan_stop:
+ \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
+ \__regex_group_end_extract_seq:N #3
}
-\cs_new_protected:Npn \regex_group_end_extract_seq:N #1
+\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
+ \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
{
- \prg_stepwise_function:nnnN
- { \c_two * \l_regex_max_state_int }
+ \int_step_function:nnnN
+ { \c_two * \l__regex_max_state_int }
\c_one
- { \l_regex_submatch_int - \c_one }
- \regex_extract_seq_aux:n
+ { \l__regex_submatch_int - \c_one }
+ \__regex_extract_seq_aux:n
}
\int_compare:nNnF
- { \flag_height:n { regex_begin } + \flag_height:n { regex_end } }
+ { \flag_height:n { __regex_begin } + \flag_height:n { __regex_end } }
= \c_zero
{
- \msg_kernel_error:nnxxx { regex } { result-unbalanced }
+ \__msg_kernel_error:nnxxx { regex } { result-unbalanced }
{ splitting~or~extracting~submatches }
- { \flag_height:n { regex_end } }
- { \flag_height:n { regex_begin } }
+ { \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 }
+ \tl_set:Nn \exp_not:N #1 { \l__regex_internal_a_tl }
}
}
-\cs_new:Npn \regex_extract_seq_aux:n #1
+\cs_new:Npn \__regex_extract_seq_aux:n #1
{
- \seq_item:n
+ \__seq_item:n
{
- \exp_after:wN \regex_extract_seq_aux:ww
- \int_value:w \regex_submatch_balance:n {#1} ; #1;
+ \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;
+\cs_new:Npn \__regex_extract_seq_aux:ww #1; #2;
{
- \if_num:w #1 < \c_zero
- \flag_raise:n { regex_end }
+ \if_int_compare:w #1 < \c_zero
+ \flag_raise:n { __regex_end }
\prg_replicate:nn {-#1} { \exp_not:n { { \if_false: } \fi: } }
\fi:
- \regex_query_submatch:n {#2}
- \if_num:w #1 > \c_zero
- \flag_raise:n { regex_begin }
+ \__regex_query_submatch:n {#2}
+ \if_int_compare:w #1 > \c_zero
+ \flag_raise:n { __regex_begin }
\prg_replicate:nn {#1} { \exp_not:n { \if_false: { \fi: } } }
\fi:
}
-\cs_new_protected_nopar:Npn \regex_extract:
+\cs_new_protected_nopar: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
+ \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
{
- \tex_skip:D \l_regex_submatch_int \c_zero sp \scan_stop:
- \int_incr:N \l_regex_submatch_int
+ \tex_skip:D \l__regex_submatch_int \c_zero sp \scan_stop:
+ \int_incr:N \l__regex_submatch_int
}
- \prop_map_inline:Nn \l_regex_success_submatches_prop
+ \prop_map_inline:Nn \l__regex_success_submatches_prop
{
- \if_num:w ##1 \c_minus_one
- \exp_after:wN \regex_extract_aux_e:wn \int_value:w
+ \if_int_compare:w ##1 \c_minus_one
+ \exp_after:wN \__regex_extract_e:wn \__int_value:w
\else:
- \exp_after:wN \regex_extract_aux_b:wn \int_value:w
+ \exp_after:wN \__regex_extract_b:wn \__int_value:w
\fi:
- \int_eval:w \l_regex_zeroth_submatch_int + ##1 {##2}
+ \__int_eval:w \l__regex_zeroth_submatch_int + ##1 {##2}
}
- \tex_skip:D \l_regex_zeroth_submatch_int
- = \tex_the:D \tex_skip:D \l_regex_zeroth_submatch_int
- minus \l_regex_start_pos_int sp \scan_stop:
+ \tex_skip:D \l__regex_zeroth_submatch_int
+ = \tex_the:D \tex_skip:D \l__regex_zeroth_submatch_int
+ minus \l__regex_start_pos_int sp \scan_stop:
\fi:
}
-\cs_new_protected:Npn \regex_extract_aux_b:wn #1 < #2
+\cs_new_protected:Npn \__regex_extract_b:wn #1 < #2
{
\tex_skip:D #1 = #2 sp
plus \etex_gluestretch:D \tex_skip:D #1 \scan_stop:
}
-\cs_new_protected:Npn \regex_extract_aux_e:wn #1 > #2
+\cs_new_protected:Npn \__regex_extract_e:wn #1 > #2
{
\tex_skip:D #1
= 1 \tex_skip:D #1 plus #2 sp \scan_stop:
}
-\cs_new_protected:Npn \regex_replace_once_aux:nnN #1#2#3
+\cs_new_protected:Npn \__regex_replace_once:nnN #1#2#3
{
\group_begin:
- \regex_single_match:
+ \__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
+ \__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_extract:
+ \int_set:Nn \l__regex_balance_int
{
- \regex_replacement_balance_one_match:n
- { \l_regex_zeroth_submatch_int }
+ \__regex_replacement_balance_one_match:n
+ { \l__regex_zeroth_submatch_int }
}
- \tl_set:Nx \l_regex_internal_a_tl
+ \tl_set:Nx \l__regex_internal_a_tl
{
- \regex_replacement_do_one_match:n { \l_regex_zeroth_submatch_int }
- \regex_query_range:nn
- { \etex_gluestretch:D \tex_skip:D \l_regex_zeroth_submatch_int }
- { \l_regex_max_pos_int }
+ \__regex_replacement_do_one_match:n { \l__regex_zeroth_submatch_int }
+ \__regex_query_range:nn
+ { \etex_gluestretch:D \tex_skip:D \l__regex_zeroth_submatch_int }
+ { \l__regex_max_pos_int }
}
- \regex_group_end_replace:N #3
+ \__regex_group_end_replace:N #3
\fi:
}
-\cs_new_protected:Npn \regex_replace_all_aux:nnN #1#2#3
+\cs_new_protected:Npn \__regex_replace_all:nnN #1#2#3
{
\group_begin:
- \regex_multi_match:n { \regex_extract: }
+ \__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
+ \__regex_replacement:n {#2}
+ \exp_args:No \__regex_match:n {#3}
+ \int_set:Nn \l__regex_balance_int
{
0
- \prg_stepwise_function:nnnN
- { \c_two * \l_regex_max_state_int }
- \l_regex_capturing_group_int
- { \l_regex_submatch_int - \c_one }
- \regex_replacement_balance_one_match:n
+ \int_step_function:nnnN
+ { \c_two * \l__regex_max_state_int }
+ \l__regex_capturing_group_int
+ { \l__regex_submatch_int - \c_one }
+ \__regex_replacement_balance_one_match:n
}
- \tl_set:Nx \l_regex_internal_a_tl
+ \tl_set:Nx \l__regex_internal_a_tl
{
- \prg_stepwise_function:nnnN
- { \c_two * \l_regex_max_state_int }
- \l_regex_capturing_group_int
- { \l_regex_submatch_int - \c_one }
- \regex_replacement_do_one_match:n
- \regex_query_range:nn
- \l_regex_start_pos_int \l_regex_max_pos_int
+ \int_step_function:nnnN
+ { \c_two * \l__regex_max_state_int }
+ \l__regex_capturing_group_int
+ { \l__regex_submatch_int - \c_one }
+ \__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
+ \__regex_group_end_replace:N #3
}
-\cs_new_protected_nopar:Npn \regex_group_end_replace:N #1
+\cs_new_protected_nopar:Npn \__regex_group_end_replace:N #1
{
- \if_num:w \l_regex_balance_int = \c_zero
+ \if_int_compare:w \l__regex_balance_int = \c_zero
\else:
- \msg_kernel_error:nnxxx { regex } { result-unbalanced }
+ \__msg_kernel_error:nnxxx { regex } { result-unbalanced }
{ replacing }
- { \int_max:nn { - \l_regex_balance_int } { \c_zero } }
- { \int_max:nn { \l_regex_balance_int } { \c_zero } }
+ { \int_max:nn { - \l__regex_balance_int } { \c_zero } }
+ { \int_max:nn { \l__regex_balance_int } { \c_zero } }
\fi:
\use:x
{
\group_end:
\tl_set:Nn \exp_not:N #1
{
- \if_int_compare:w \l_regex_balance_int < \c_zero
- \prg_replicate:nn { - \l_regex_balance_int }
+ \if_int_compare:w \l__regex_balance_int < \c_zero
+ \prg_replicate:nn { - \l__regex_balance_int }
{ { \if_false: } \fi: }
\fi:
- \l_regex_internal_a_tl
- \if_int_compare:w \l_regex_balance_int > \c_zero
- \prg_replicate:nn { \l_regex_balance_int }
+ \l__regex_internal_a_tl
+ \if_int_compare:w \l__regex_balance_int > \c_zero
+ \prg_replicate:nn { \l__regex_balance_int }
{ \if_false: { \fi: } }
\fi:
}
}
}
-\msg_kernel_new:nnnn { regex } { trailing-backslash }
+\__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 }
+\__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\{\int_to_hexadecimal:n{#1}'.~
The~closing~brace~is~missing.
}
-\msg_kernel_new:nnnn { regex } { x-overflow }
+\__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_hexadecimal:n{#1}\}'.~
The~character~code~'#1'~is~larger~than~\int_use:N \c_max_char_int.
}
-\msg_kernel_new:nnnn { regex } { invalid-quantifier }
+\__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>}',~followed~or~not~by~'?'.
}
-\msg_kernel_new:nnnn { regex } { missing-rbrack }
+\__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 }
+\__msg_kernel_new:nnnn { regex } { missing-rparen }
{
Missing~right~parenthes\int_compare:nTF{#1=1}{i}{e}s~
inserted~in~regular~expression.
@@ -2624,44 +2632,44 @@
more~left~parenthes\int_compare:nTF{#1=1}{i}{e}s~than~right~
parenthes\int_compare:nTF{#1=1}{i}{e}s.
}
-\msg_kernel_new:nnnn { regex } { extra-rparen }
+\__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 }
+\__msg_kernel_new:nnnn { regex } { bad-escape }
{
Invalid~escape~\c_backslash_str #1~
- \regex_if_in_cs:TF { within~a~control~sequence. }
+ \__regex_if_in_cs:TF { within~a~control~sequence. }
{
- \regex_if_in_class:TF
+ \__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
+ \__regex_if_in_cs:TF
{
within~a~control~sequence~test~introduced~by~
\iow_char:N\\c\iow_char:N\{.
}
{
- \regex_if_in_class:TF
+ \__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 }
+\__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 }
+\__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,~
@@ -2669,27 +2677,27 @@
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 }
+\__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 }
+\__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 }
+\__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 }
+\__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~
@@ -2697,29 +2705,29 @@
capital~letter~representing~a~character~category,~namely~
one~of~ABCDELMOPSTU.
}
-\msg_kernel_new:nnnn { regex } { u-missing-lbrace }
+\__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 }
+\__msg_kernel_new:nnnn { regex } { u-missing-rbrace }
{ Missing~right~brace~inserted~for~\iow_char:N\\u~escape. }
{
LaTeX~
- \tl_if_empty:xTF {#2}
+ \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 }
+\__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 }
+\__msg_kernel_new:nnnn { regex } { posix-unknown }
{ POSIX~class~[:#1:]~unknown. }
{
[:#1:]~is~not~among~the~known~POSIX~classes~
@@ -2728,10 +2736,10 @@
[:print:],~[:punct:],~[:space:],~[:upper:],~
[:word:],~and~[:xdigit:].
}
-\msg_kernel_new:nnnn { regex } { posix-missing-close }
+\__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 }
+\__msg_kernel_new:nnnn { regex } { result-unbalanced }
{ Missing~brace~inserted~when~#1. }
{
LaTeX~was~asked~to~do~some~regular~expression~operation,~
@@ -2739,34 +2747,34 @@
of~begin-group~and~end-group~tokens.~Braces~were~inserted:~
#2~left,~#3~right.
}
-\msg_kernel_new:nnnn { regex } { unknown-option }
+\__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 } { replacement-c }
+\__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 }
+\__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 }
+\__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 }
+\__msg_kernel_new:nnnn { regex } { replacement-catcode-end }
{
Missing~character~for~the~\iow_char:N\\c<category><character>~
construction~in~a~replacement~text.
@@ -2777,7 +2785,7 @@
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-null-space }
+\__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',~
@@ -2786,18 +2794,18 @@
This~specific~case~is~impossible~and~will~be~replaced~
by~a~normal~space.
}
-\msg_kernel_new:nnnn { regex } { replacement-missing-rbrace }
+\__msg_kernel_new:nnnn { regex } { replacement-missing-rbrace }
{ Missing~right~brace~inserted~in~replacement~text. }
{
- There~were~\int_use:N \l_regex_replacement_csnames_int \
+ There~were~\int_use:N \l__regex_replacement_csnames_int \
missing~right~braces.
}
-\cs_new:Npn \regex_msg_repeated:nnN #1#2#3
+\cs_new:Npn \__regex_msg_repeated:nnN #1#2#3
{
- \str_if_eq:xxF { #1 #2 } { 1 0 }
+ \str_if_eq_x:nnF { #1 #2 } { 1 0 }
{
, ~ repeated ~
- \prg_case_int:nnn {#2}
+ \int_case:nnn {#2}
{
{ -1 } { #1~or~more~times,~\bool_if:NTF #3 { lazy } { greedy } }
{ 0 } { #1~times }
@@ -2808,12 +2816,12 @@
}
}
}
-\cs_new_protected:Npn \regex_trace_states:n #1
+\cs_new_protected:Npn \__regex_trace_states:n #1
{
- \prg_stepwise_inline:nnnn
- \l_regex_min_state_int
+ \int_step_inline:nnnn
+ \l__regex_min_state_int
\c_one
- { \l_regex_max_state_int - 1 }
+ { \l__regex_max_state_int - 1 }
{
\trace:nnx { regex } { #1 }
{ \iow_char:N \\toks ##1 = { \tex_the:D \tex_toks:D ##1 } }
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty
index d6babc2b1b7..2ba86a82c86 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty
@@ -46,446 +46,446 @@
%%
%% -----------------------------------------------------------------------
\RequirePackage{expl3}
-\GetIdInfo$Id: l3regex.dtx 3488 2012-03-03 19:49:03Z bruno $
- {L3 Experimental Regular Expressions}
+\GetIdInfo$Id: l3regex.dtx 3940 2012-07-09 00:41:44Z bruno $
+ {L3 Experimental regular expressions}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\RequirePackage{l3tl-build, l3tl-analysis, l3flag, l3str}
\cs_generate_variant:Nn \tl_to_str:n { V }
-\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 }
- }
-\int_new:N \l_regex_balance_int
-\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
+\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 }
+ }
+\int_new:N \l__regex_balance_int
+\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
+ \__regex_break_point:TF { } \__regex_break_true:w
}
-\cs_new_protected:Npn \regex_item_caseful_equal:n #1
+\cs_new_protected:Npn \__regex_item_caseful_equal:n #1
{
- \if_num:w #1 = \l_regex_current_char_int
- \exp_after:wN \regex_break_true:w
+ \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
+\cs_new_protected:Npn \__regex_item_caseful_range:nn #1 #2
{
- \reverse_if:N \if_num:w #1 > \l_regex_current_char_int
- \reverse_if:N \if_num:w #2 < \l_regex_current_char_int
- \exp_after:wN \exp_after:wN \exp_after:wN \regex_break_true:w
+ \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
+\cs_new_protected:Npn \__regex_item_caseless_equal:n #1
{
- \if_num:w #1 = \l_regex_current_char_int
- \exp_after:wN \regex_break_true:w
+ \if_int_compare:w #1 = \l__regex_current_char_int
+ \exp_after:wN \__regex_break_true:w
\fi:
- \if_num:w \l_regex_case_changed_char_int = \c_max_int
- \regex_compute_case_changed_char:
+ \if_int_compare:w \l__regex_case_changed_char_int = \c_max_int
+ \__regex_compute_case_changed_char:
\fi:
- \if_num:w #1 = \l_regex_case_changed_char_int
- \exp_after:wN \regex_break_true:w
+ \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
+\cs_new_protected:Npn \__regex_item_caseless_range:nn #1 #2
{
- \reverse_if:N \if_num:w #1 > \l_regex_current_char_int
- \reverse_if:N \if_num:w #2 < \l_regex_current_char_int
- \exp_after:wN \exp_after:wN \exp_after:wN \regex_break_true:w
+ \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_num:w \l_regex_case_changed_char_int = \c_max_int
- \regex_compute_case_changed_char:
+ \if_int_compare:w \l__regex_case_changed_char_int = \c_max_int
+ \__regex_compute_case_changed_char:
\fi:
- \reverse_if:N \if_num:w #1 > \l_regex_case_changed_char_int
- \reverse_if:N \if_num:w #2 < \l_regex_case_changed_char_int
- \exp_after:wN \exp_after:wN \exp_after:wN \regex_break_true:w
+ \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_nopar:Npn \regex_compute_case_changed_char:
+\cs_new_protected_nopar:Npn \__regex_compute_case_changed_char:
{
- \int_set_eq:NN \l_regex_case_changed_char_int \l_regex_current_char_int
- \if_num:w \l_regex_current_char_int < \c_ninety_one
- \if_num:w \l_regex_current_char_int < \c_sixty_five
+ \int_set_eq:NN \l__regex_case_changed_char_int \l__regex_current_char_int
+ \if_int_compare:w \l__regex_current_char_int < \c_ninety_one
+ \if_int_compare:w \l__regex_current_char_int < \c_sixty_five
\else:
- \int_add:Nn \l_regex_case_changed_char_int { \c_thirty_two }
+ \int_add:Nn \l__regex_case_changed_char_int { \c_thirty_two }
\fi:
\else:
- \if_num:w \l_regex_current_char_int < \c_one_hundred_twenty_three
- \if_num:w \l_regex_current_char_int < \c_ninety_seven
+ \if_int_compare:w \l__regex_current_char_int < \c_one_hundred_twenty_three
+ \if_int_compare:w \l__regex_current_char_int < \c_ninety_seven
\else:
- \int_sub:Nn \l_regex_case_changed_char_int { \c_thirty_two }
+ \int_sub:Nn \l__regex_case_changed_char_int { \c_thirty_two }
\fi:
\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_aux:
+\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
+ \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*\c_zero
\fi:
}
-\cs_new_protected:Npn \regex_item_catcode:nT #1
+\cs_new_protected:Npn \__regex_item_catcode:nT #1
{
- \if_int_odd:w \int_eval:w #1 / \regex_item_catcode_aux: \int_eval_end:
+ \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
+\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_num:w #1 = \l_regex_current_catcode_int
- \if_num:w #2 = \l_regex_current_char_int
- \exp_after:wN \exp_after:wN \exp_after:wN \regex_break_true:w
+ \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:c #1
+\cs_new_protected:Npn \__regex_item_exact_cs:c #1
{
- \int_compare:nNnTF \l_regex_current_catcode_int = \c_zero
+ \int_compare:nNnTF \l__regex_current_catcode_int = \c_zero
{
- \str_if_eq:xxTF
+ \str_if_eq_x:nnTF
{
\exp_after:wN \exp_after:wN \exp_after:wN \cs_to_str:N
- \tex_the:D \tex_toks:D \l_regex_current_pos_int
+ \tex_the:D \tex_toks:D \l__regex_current_pos_int
}
{ #1 }
- { \regex_break_true:w } { }
+ { \__regex_break_true:w } { }
}
{ }
}
-\cs_new_protected:Npn \regex_item_cs:n #1
+\cs_new_protected:Npn \__regex_item_cs:n #1
{
- \int_compare:nNnT \l_regex_current_catcode_int = \c_zero
+ \int_compare:nNnT \l__regex_current_catcode_int = \c_zero
{
\group_begin:
- \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:Nx \regex_match:n
+ \__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:Nx \__regex_match:n
{
\exp_after:wN \exp_after:wN
\exp_after:wN \cs_to_str:N
- \tex_the:D \tex_toks:D \l_regex_current_pos_int
+ \tex_the:D \tex_toks:D \l__regex_current_pos_int
}
- \if_meaning:w \c_true_bool \g_regex_success_bool
- \group_insert_after:N \regex_break_true:w
+ \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
+ \bool_gset_eq:NN \g__regex_success_bool \l__regex_saved_success_bool
\group_end:
}
}
-\cs_new_protected_nopar:Npn \regex_prop_d:
- { \regex_item_caseful_range:nn \c_forty_eight { 57 } } % 0--9
-\cs_new_protected_nopar:Npn \regex_prop_h:
- {
- \regex_item_caseful_equal:n \c_thirty_two % space
- \regex_item_caseful_equal:n \c_nine % tab
- }
-\cs_new_protected_nopar:Npn \regex_prop_s:
- {
- \regex_item_caseful_equal:n \c_thirty_two % space
- \regex_item_caseful_equal:n \c_nine % tab
- \regex_item_caseful_equal:n \c_ten % lf
- \regex_item_caseful_equal:n \c_twelve % ff
- \regex_item_caseful_equal:n \c_thirteen % cr
- }
-\cs_new_protected_nopar:Npn \regex_prop_v:
- { \regex_item_caseful_range:nn \c_ten \c_thirteen } % lf, vtab, ff, cr
-\cs_new_protected_nopar:Npn \regex_prop_w:
- {
- \regex_item_caseful_range:nn \c_ninety_seven { 122 } % a--z
- \regex_item_caseful_range:nn \c_sixty_five { 90 } % A--Z
- \regex_item_caseful_range:nn \c_forty_eight { 57 } % 0--9
- \regex_item_caseful_equal:n { 95 } % _
- }
-\cs_new_protected_nopar:Npn \regex_prop_N:
- { \regex_item_reverse:n { \regex_item_caseful_equal:n \c_ten } }
-\cs_new_protected_nopar:Npn \regex_posix_alnum:
- { \regex_posix_alpha: \regex_posix_digit: }
-\cs_new_protected_nopar:Npn \regex_posix_alpha:
- { \regex_posix_lower: \regex_posix_upper: }
-\cs_new_protected_nopar:Npn \regex_posix_ascii:
- { \regex_item_caseful_range:nn \c_zero \c_one_hundred_twenty_seven }
-\cs_new_eq:NN \regex_posix_blank: \regex_prop_h:
-\cs_new_protected_nopar:Npn \regex_posix_cntrl:
- {
- \regex_item_caseful_range:nn \c_zero { 31 }
- \regex_item_caseful_equal:n \c_one_hundred_twenty_seven
- }
-\cs_new_eq:NN \regex_posix_digit: \regex_prop_d:
-\cs_new_protected_nopar:Npn \regex_posix_graph:
- { \regex_item_caseful_range:nn { 33 } { 126 } }
-\cs_new_protected_nopar:Npn \regex_posix_lower:
- { \regex_item_caseful_range:nn \c_ninety_seven { 122 } }
-\cs_new_protected_nopar:Npn \regex_posix_print:
- { \regex_item_caseful_range:nn \c_thirty_two { 126 } }
-\cs_new_protected_nopar:Npn \regex_posix_punct:
- {
- \regex_item_caseful_range:nn { 33 } { 47 }
- \regex_item_caseful_range:nn { 58 } { 64 }
- \regex_item_caseful_range:nn { 91 } { 96 }
- \regex_item_caseful_range:nn { 123 } { 126 }
- }
-\cs_new_protected_nopar:Npn \regex_posix_space:
- {
- \regex_item_caseful_equal:n \c_thirty_two
- \regex_item_caseful_range:nn \c_nine \c_thirteen
- }
-\cs_new_protected_nopar:Npn \regex_posix_upper:
- { \regex_item_caseful_range:nn \c_sixty_five { 90 } }
-\cs_new_eq:NN \regex_posix_word: \regex_prop_w:
-\cs_new_protected_nopar:Npn \regex_posix_xdigit:
- {
- \regex_posix_digit:
- \regex_item_caseful_range:nn \c_sixty_five { 70 }
- \regex_item_caseful_range:nn \c_ninety_seven { 102 }
- }
-\cs_new_protected:Npn \regex_escape_use:nnnn #1#2#3#4
- {
- \tl_set_build:Nw \l_regex_internal_a_tl
- \cs_set_nopar:Npn \regex_escape_unescaped:N ##1 { #1 }
- \cs_set_nopar:Npn \regex_escape_escaped:N ##1 { #2 }
- \cs_set_nopar:Npn \regex_escape_raw:N ##1 { #3 }
+\cs_new_protected_nopar:Npn \__regex_prop_d:
+ { \__regex_item_caseful_range:nn \c_forty_eight { 57 } } % 0--9
+\cs_new_protected_nopar:Npn \__regex_prop_h:
+ {
+ \__regex_item_caseful_equal:n \c_thirty_two % space
+ \__regex_item_caseful_equal:n \c_nine % tab
+ }
+\cs_new_protected_nopar:Npn \__regex_prop_s:
+ {
+ \__regex_item_caseful_equal:n \c_thirty_two % space
+ \__regex_item_caseful_equal:n \c_nine % tab
+ \__regex_item_caseful_equal:n \c_ten % lf
+ \__regex_item_caseful_equal:n \c_twelve % ff
+ \__regex_item_caseful_equal:n \c_thirteen % cr
+ }
+\cs_new_protected_nopar:Npn \__regex_prop_v:
+ { \__regex_item_caseful_range:nn \c_ten \c_thirteen } % lf, vtab, ff, cr
+\cs_new_protected_nopar:Npn \__regex_prop_w:
+ {
+ \__regex_item_caseful_range:nn \c_ninety_seven { 122 } % a--z
+ \__regex_item_caseful_range:nn \c_sixty_five { 90 } % A--Z
+ \__regex_item_caseful_range:nn \c_forty_eight { 57 } % 0--9
+ \__regex_item_caseful_equal:n { 95 } % _
+ }
+\cs_new_protected_nopar:Npn \__regex_prop_N:
+ { \__regex_item_reverse:n { \__regex_item_caseful_equal:n \c_ten } }
+\cs_new_protected_nopar:Npn \__regex_posix_alnum:
+ { \__regex_posix_alpha: \__regex_posix_digit: }
+\cs_new_protected_nopar:Npn \__regex_posix_alpha:
+ { \__regex_posix_lower: \__regex_posix_upper: }
+\cs_new_protected_nopar:Npn \__regex_posix_ascii:
+ { \__regex_item_caseful_range:nn \c_zero \c_one_hundred_twenty_seven }
+\cs_new_eq:NN \__regex_posix_blank: \__regex_prop_h:
+\cs_new_protected_nopar:Npn \__regex_posix_cntrl:
+ {
+ \__regex_item_caseful_range:nn \c_zero { 31 }
+ \__regex_item_caseful_equal:n \c_one_hundred_twenty_seven
+ }
+\cs_new_eq:NN \__regex_posix_digit: \__regex_prop_d:
+\cs_new_protected_nopar:Npn \__regex_posix_graph:
+ { \__regex_item_caseful_range:nn { 33 } { 126 } }
+\cs_new_protected_nopar:Npn \__regex_posix_lower:
+ { \__regex_item_caseful_range:nn \c_ninety_seven { 122 } }
+\cs_new_protected_nopar:Npn \__regex_posix_print:
+ { \__regex_item_caseful_range:nn \c_thirty_two { 126 } }
+\cs_new_protected_nopar:Npn \__regex_posix_punct:
+ {
+ \__regex_item_caseful_range:nn { 33 } { 47 }
+ \__regex_item_caseful_range:nn { 58 } { 64 }
+ \__regex_item_caseful_range:nn { 91 } { 96 }
+ \__regex_item_caseful_range:nn { 123 } { 126 }
+ }
+\cs_new_protected_nopar:Npn \__regex_posix_space:
+ {
+ \__regex_item_caseful_equal:n \c_thirty_two
+ \__regex_item_caseful_range:nn \c_nine \c_thirteen
+ }
+\cs_new_protected_nopar:Npn \__regex_posix_upper:
+ { \__regex_item_caseful_range:nn \c_sixty_five { 90 } }
+\cs_new_eq:NN \__regex_posix_word: \__regex_prop_w:
+\cs_new_protected_nopar:Npn \__regex_posix_xdigit:
+ {
+ \__regex_posix_digit:
+ \__regex_item_caseful_range:nn \c_sixty_five { 70 }
+ \__regex_item_caseful_range:nn \c_ninety_seven { 102 }
+ }
+\cs_new_protected:Npn \__regex_escape_use:nnnn #1#2#3#4
+ {
+ \__tl_build:Nw \l__regex_internal_a_tl
+ \cs_set_nopar:Npn \__regex_escape_unescaped:N ##1 { #1 }
+ \cs_set_nopar:Npn \__regex_escape_escaped:N ##1 { #2 }
+ \cs_set_nopar:Npn \__regex_escape_raw:N ##1 { #3 }
\int_set:Nn \tex_escapechar:D { 92 }
- \str_gset_other:Nn \g_regex_internal_tl { #4 }
- \tl_set:Nx \l_regex_internal_b_tl
+ \__str_gset_other:Nn \g__regex_internal_tl { #4 }
+ \tl_set:Nx \l__regex_internal_b_tl
{
- \exp_after:wN \regex_escape_loop:N \g_regex_internal_tl
- { break } \prg_break_point:n { }
+ \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
+ \__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_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_if_exist_use:cF { __regex_escape_\token_to_str:N #1:w }
+ { \__regex_escape_unescaped:N #1 }
+ \__regex_escape_loop:N
}
-\cs_new_nopar:cpn { regex_escape_ \c_backslash_str :w }
- \regex_escape_loop:N #1
+\cs_new_nopar: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_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_map_break:
-\cs_new_nopar:cpn { regex_escape_/break:w }
+\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_nopar:cpn { __regex_escape_/break:w }
{
\if_false: { \fi: }
- \msg_kernel_error:nn { regex } { trailing-backslash }
+ \__msg_kernel_error:nn { regex } { trailing-backslash }
\exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi:
}
-\cs_new_nopar:cpn { regex_escape_~:w } { }
-\cs_new_nopar:cpx { regex_escape_/a:w }
- { \exp_not:N \regex_escape_raw:N \iow_char:N \^^G }
-\cs_new_nopar:cpx { regex_escape_/t:w }
- { \exp_not:N \regex_escape_raw:N \iow_char:N \^^I }
-\cs_new_nopar:cpx { regex_escape_/n:w }
- { \exp_not:N \regex_escape_raw:N \iow_char:N \^^J }
-\cs_new_nopar:cpx { regex_escape_/f:w }
- { \exp_not:N \regex_escape_raw:N \iow_char:N \^^L }
-\cs_new_nopar:cpx { regex_escape_/r:w }
- { \exp_not:N \regex_escape_raw:N \iow_char:N \^^M }
-\cs_new_nopar: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 ;
+\cs_new_nopar:cpn { __regex_escape_~:w } { }
+\cs_new_nopar:cpx { __regex_escape_/a:w }
+ { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^G }
+\cs_new_nopar:cpx { __regex_escape_/t:w }
+ { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^I }
+\cs_new_nopar:cpx { __regex_escape_/n:w }
+ { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^J }
+\cs_new_nopar:cpx { __regex_escape_/f:w }
+ { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^L }
+\cs_new_nopar:cpx { __regex_escape_/r:w }
+ { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^M }
+\cs_new_nopar: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_two_hundred_fifty_six
{
- \exp_last_unbraced:Nf \regex_escape_raw:N
- { \str_output_byte:n {#1} }
+ \exp_last_unbraced:Nf \__regex_escape_raw:N
+ { \__str_output_byte:n {#1} }
}
- { \regex_escape_x_large:n {#1} }
+ { \__regex_escape_x_large:n {#1} }
}
\group_begin:
\char_set_catcode_other:n { 0 }
- \cs_new:Npn \regex_escape_x_large:n #1
+ \cs_new:Npn \__regex_escape_x_large:n #1
{
\if_false: { \fi: }
- \tl_build_one:o \l_regex_internal_b_tl
+ \__tl_build_one:o \l__regex_internal_b_tl
\int_compare:nNnTF {#1} > \c_max_char_int
{
- \msg_kernel_error:nnx { regex } { x-overflow } {#1}
- \tl_set:Nx \l_regex_internal_b_tl
- { \if_false: } \fi: \regex_escape_loop:N
+ \__msg_kernel_error:nnx { regex } { x-overflow } {#1}
+ \tl_set:Nx \l__regex_internal_b_tl
+ { \if_false: } \fi: \__regex_escape_loop:N
}
{
\char_set_lccode:nn { \c_zero } {#1}
\tl_to_lowercase:n
{
- \tl_set:Nx \l_regex_internal_b_tl
+ \tl_set:Nx \l__regex_internal_b_tl
{ \if_false: } \fi:
- \regex_escape_raw:N ^^@
- \regex_escape_loop:N
+ \__regex_escape_raw:N ^^@
+ \__regex_escape_loop:N
}
}
}
\group_end:
-\cs_new:Npn \regex_escape_x_test:N #1
+\cs_new:Npn \__regex_escape_x_test:N #1
{
- \str_if_eq:xxTF {#1} { break } { ; }
+ \str_if_eq_x:nnTF {#1} { break } { ; }
{
\if_charcode:w \c_space_token #1
- \exp_after:wN \regex_escape_x_test:N
+ \exp_after:wN \__regex_escape_x_test:N
\else:
- \exp_after:wN \regex_escape_x_test_ii:N
+ \exp_after:wN \__regex_escape_x_test_ii:N
\exp_after:wN #1
\fi:
}
}
-\cs_new:Npn \regex_escape_x_test_ii:N #1
+\cs_new:Npn \__regex_escape_x_test_ii:N #1
{
\if_charcode:w \c_lbrace_str #1
- \exp_after:wN \regex_escape_x_loop:N
+ \exp_after:wN \__regex_escape_x_loop:N
\else:
- \str_aux_hexadecimal_use:NTF #1
- { \exp_after:wN \regex_escape_x_ii:N }
- { ; \exp_after:wN \regex_escape_loop:N \exp_after:wN #1 }
+ \__str_hexadecimal_use:NTF #1
+ { \exp_after:wN \__regex_escape_x_ii:N }
+ { ; \exp_after:wN \__regex_escape_loop:N \exp_after:wN #1 }
\fi:
}
-\cs_new:Npn \regex_escape_x_ii:N #1
+\cs_new:Npn \__regex_escape_x_ii:N #1
{
- \str_if_eq:xxTF {#1} { break } { ; }
+ \str_if_eq_x:nnTF {#1} { break } { ; }
{
- \str_aux_hexadecimal_use:NTF #1
- { ; \regex_escape_loop:N }
- { ; \regex_escape_loop:N #1 }
+ \__str_hexadecimal_use:NTF #1
+ { ; \__regex_escape_loop:N }
+ { ; \__regex_escape_loop:N #1 }
}
}
-\cs_new:Npn \regex_escape_x_loop:N #1
+\cs_new:Npn \__regex_escape_x_loop:N #1
{
- \str_aux_hexadecimal_use:NTF #1
- { \regex_escape_x_loop:N }
+ \__str_hexadecimal_use:NTF #1
+ { \__regex_escape_x_loop:N }
{
\token_if_eq_charcode:NNTF \c_space_token #1
- { \regex_escape_x_loop:N }
+ { \__regex_escape_x_loop:N }
{
;
\exp_after:wN \token_if_eq_charcode:NNTF \c_rbrace_str #1
- { \regex_escape_loop:N }
+ { \__regex_escape_loop:N }
{
\if_false: { \fi: }
- \tl_build_one:o \l_regex_internal_b_tl
- \msg_kernel_error:nn { regex } { x-missing-rbrace } {#1}
- \tl_set:Nx \l_regex_internal_b_tl
- { \if_false: } \fi: \regex_escape_loop:N #1
+ \__tl_build_one:o \l__regex_internal_b_tl
+ \__msg_kernel_error:nn { 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_char_if_special:N #1 { TF }
+\prg_new_conditional:Npnn \__regex_char_if_special:N #1 { TF }
{
- \if_num:w `#1 < \c_ninety_one
- \if_num:w `#1 < \c_fifty_eight
- \if_num:w `#1 < \c_forty_eight
- \if_num:w `#1 < \c_thirty_two
+ \if_int_compare:w `#1 < \c_ninety_one
+ \if_int_compare:w `#1 < \c_fifty_eight
+ \if_int_compare:w `#1 < \c_forty_eight
+ \if_int_compare:w `#1 < \c_thirty_two
\prg_return_false: \else: \prg_return_true: \fi:
\else: \prg_return_false: \fi:
\else:
- \if_num:w `#1 < \c_sixty_five
+ \if_int_compare:w `#1 < \c_sixty_five
\prg_return_true: \else: \prg_return_false: \fi:
\fi:
\else:
- \if_num:w `#1 < \c_one_hundred_twenty_three
- \if_num:w `#1 < \c_ninety_seven
+ \if_int_compare:w `#1 < \c_one_hundred_twenty_three
+ \if_int_compare:w `#1 < \c_ninety_seven
\prg_return_true: \else: \prg_return_false: \fi:
\else:
- \if_num:w `#1 < \c_one_hundred_twenty_seven
+ \if_int_compare:w `#1 < \c_one_hundred_twenty_seven
\prg_return_true: \else: \prg_return_false: \fi:
\fi:
\fi:
}
-\prg_new_conditional:Npnn \regex_char_if_alphanumeric:N #1 { TF }
+\prg_new_conditional:Npnn \__regex_char_if_alphanumeric:N #1 { TF }
{
- \if_num:w `#1 < \c_ninety_one
- \if_num:w `#1 < \c_fifty_eight
- \if_num:w `#1 < \c_forty_eight
+ \if_int_compare:w `#1 < \c_ninety_one
+ \if_int_compare:w `#1 < \c_fifty_eight
+ \if_int_compare:w `#1 < \c_forty_eight
\prg_return_false: \else: \prg_return_true: \fi:
\else:
- \if_num:w `#1 < \c_sixty_five
+ \if_int_compare:w `#1 < \c_sixty_five
\prg_return_false: \else: \prg_return_true: \fi:
\fi:
\else:
- \if_num:w `#1 < \c_one_hundred_twenty_three
- \if_num:w `#1 < \c_ninety_seven
+ \if_int_compare:w `#1 < \c_one_hundred_twenty_three
+ \if_int_compare:w `#1 < \c_ninety_seven
\prg_return_false: \else: \prg_return_true: \fi:
\else:
\prg_return_false:
\fi:
\fi:
}
-\int_new:N \l_regex_group_level_int
-\int_new:N \l_regex_mode_int
-\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} }
+\int_new:N \l__regex_group_level_int
+\int_new:N \l__regex_mode_int
+\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
+\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} }
+ \__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 }
+\prg_new_conditional:Npnn \__regex_if_raw_digit:NN #1#2 { TF }
{
- \if_meaning:w \regex_compile_raw:N #1
+ \if_meaning:w \__regex_compile_raw:N #1
\if_int_compare:w \c_one < 1 #2 \exp_stop_f:
\prg_return_true:
\else:
@@ -495,305 +495,305 @@
\prg_return_false:
\fi:
}
-\cs_new_nopar:Npn \regex_if_in_class:TF
+\cs_new_nopar:Npn \__regex_if_in_class:TF
{
- \if_int_odd:w \l_regex_mode_int
+ \if_int_odd:w \l__regex_mode_int
\exp_after:wN \use_i:nn
\else:
\exp_after:wN \use_ii:nn
\fi:
}
-\cs_new_nopar:Npn \regex_if_in_cs:TF
+\cs_new_nopar:Npn \__regex_if_in_cs:TF
{
- \if_int_odd:w \l_regex_mode_int
+ \if_int_odd:w \l__regex_mode_int
\exp_after:wN \use_ii:nn
\else:
- \if_int_compare:w \l_regex_mode_int < \c_zero
+ \if_int_compare:w \l__regex_mode_int < \c_zero
\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_nopar:Npn \regex_if_in_class_or_catcode:TF
+\cs_new_nopar:Npn \__regex_if_in_class_or_catcode:TF
{
- \if_int_odd:w \l_regex_mode_int
+ \if_int_odd:w \l__regex_mode_int
\exp_after:wN \use_i:nn
\else:
- \if_int_compare:w \l_regex_mode_int > \c_zero
+ \if_int_compare:w \l__regex_mode_int > \c_zero
\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_nopar:Npn \regex_if_within_catcode:TF
+\cs_new_nopar:Npn \__regex_if_within_catcode:TF
{
- \if_int_compare:w \l_regex_mode_int > \c_zero
+ \if_int_compare:w \l__regex_mode_int > \c_zero
\exp_after:wN \use_i:nn
\else:
\exp_after:wN \use_ii:nn
\fi:
}
-\cs_new_protected:Npn \regex_chk_c_allowed:T
+\cs_new_protected:Npn \__regex_chk_c_allowed:T
{
- \if_num:w \l_regex_mode_int = \c_zero
+ \if_int_compare:w \l__regex_mode_int = \c_zero
\exp_after:wN \use:n
\else:
- \if_num:w \l_regex_mode_int = \c_three
+ \if_int_compare:w \l__regex_mode_int = \c_three
\exp_after:wN \exp_after:wN \exp_after:wN \use:n
\else:
- \msg_kernel_error:nn { regex } { c-bad-mode }
+ \__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:
+\cs_new_protected:Npn \__regex_mode_quit_c:
{
- \if_num:w \l_regex_mode_int = \c_two
- \l_regex_mode_int = \c_zero
+ \if_int_compare:w \l__regex_mode_int = \c_two
+ \l__regex_mode_int = \c_zero
\else:
- \if_num:w \l_regex_mode_int = \c_six
- \l_regex_mode_int = \c_three
+ \if_int_compare:w \l__regex_mode_int = \c_six
+ \l__regex_mode_int = \c_three
\fi:
\fi:
}
-\cs_new_protected_nopar:Npn \regex_compile:w
+\cs_new_protected_nopar:Npn \__regex_compile:w
{
- \tl_set_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_nopar:Npn \regex_item_equal:n { \regex_item_caseful_equal:n }
- \cs_set_nopar:Npn \regex_item_range:nn { \regex_item_caseful_range:nn }
- \tl_build_one:n { \regex_branch:n { \if_false: } \fi: }
+ \__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_nopar:Npn \__regex_item_equal:n { \__regex_item_caseful_equal:n }
+ \cs_set_nopar:Npn \__regex_item_range:nn { \__regex_item_caseful_range:nn }
+ \__tl_build_one:n { \__regex_branch:n { \if_false: } \fi: }
}
-\cs_new_protected_nopar:Npn \regex_compile_end:
+\cs_new_protected_nopar:Npn \__regex_compile_end:
{
- \regex_if_in_class:TF
+ \__regex_if_in_class:TF
{
- \msg_kernel_error:nn { regex } { missing-rbrack }
- \use:c { regex_compile_]: }
+ \__msg_kernel_error:nn { regex } { missing-rbrack }
+ \use:c { __regex_compile_]: }
\prg_do_nothing: \prg_do_nothing:
}
{ }
- \if_num:w \l_regex_group_level_int > \c_zero
- \msg_kernel_error:nnx { regex } { missing-rparen }
- { \int_use:N \l_regex_group_level_int }
+ \if_int_compare:w \l__regex_group_level_int > \c_zero
+ \__msg_kernel_error:nnx { regex } { missing-rparen }
+ { \int_use:N \l__regex_group_level_int }
\prg_replicate:nn
- { \l_regex_group_level_int }
+ { \l__regex_group_level_int }
{
- \tl_build_one:n
+ \__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
+ \__tl_build_end:
+ \__tl_build_one:o \l__regex_internal_regex
}
\fi:
- \tl_build_one:n { \if_false: { \fi: } }
- \tl_build_end:
+ \__tl_build_one:n { \if_false: { \fi: } }
+ \__tl_build_end:
}
-\cs_new_protected:Npn \regex_compile:n #1
+\cs_new_protected:Npn \__regex_compile:n #1
{
- \regex_compile:w
+ \__regex_compile:w
\int_set:Nn \tex_escapechar:D { 92 }
- \int_set_eq:NN \l_regex_mode_int \c_zero
- \regex_escape_use:nnnn
+ \int_set_eq:NN \l__regex_mode_int \c_zero
+ \__regex_escape_use:nnnn
{
- \regex_char_if_special:NTF ##1
- \regex_compile_special:N \regex_compile_raw:N ##1
+ \__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_char_if_alphanumeric:NTF ##1
+ \__regex_compile_escaped:N \__regex_compile_raw:N ##1
}
- { \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_zero
+ \int_compare:nNnT \l__regex_mode_int < \c_zero
{
- \msg_kernel_error:nn { regex } { c-missing-rbrace }
- \regex_compile_end:
- \regex_compile_one:x
- { \regex_item_cs:n { \exp_not:o \l_regex_internal_regex } }
+ \__msg_kernel_error:nn { regex } { c-missing-rbrace }
+ \__regex_compile_end:
+ \__regex_compile_one:x
+ { \__regex_item_cs:n { \exp_not:o \l__regex_internal_regex } }
\prg_do_nothing: \prg_do_nothing:
\prg_do_nothing: \prg_do_nothing:
}
- \regex_compile_end:
+ \__regex_compile_end:
}
-\cs_new_protected:Npn \regex_compile_special:N #1
+\cs_new_protected:Npn \__regex_compile_special:N #1
{
- \cs_if_exist_use:cF { regex_compile_#1: }
- { \regex_compile_raw: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_new_protected:Npn \__regex_compile_escaped:N #1
{
- \cs_if_exist_use:cF { regex_compile_/#1: }
- { \regex_compile_raw:N #1 }
+ \cs_if_exist_use:cF { __regex_compile_/#1: }
+ { \__regex_compile_raw:N #1 }
}
-\cs_new_protected:Npn \regex_compile_one:x #1
+\cs_new_protected:Npn \__regex_compile_one:x #1
{
- \regex_mode_quit_c:
- \regex_if_in_class:TF { }
+ \__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:n
+ { \__regex_class:NnnnN \c_true_bool { \if_false: } \fi: }
}
- \tl_build_one:x
+ \__tl_build_one:x
{
- \if_num:w \l_regex_catcodes_int < \c_regex_all_catcodes_int
- \regex_item_catcode:nT { \int_use:N \l_regex_catcodes_int }
+ \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 }
+ \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
+\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
+ \__regex_compile_raw:N
}
}
-\cs_generate_variant:Nn \regex_compile_abort_tokens:n { x }
-\cs_new_protected:Npn \regex_compile_quantifier:w #1#2
+\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
+ \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 }
+ \cs_if_exist_use:cF { __regex_compile_quantifier_#2:w }
+ { \__regex_compile_quantifier_none: #1 #2 }
}
- { \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
+\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}
+ \__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
+\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 } }
+ \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 }
+ \__tl_build_one:n { \if_false: { \fi: } { #1 } { #2 } \c_false_bool }
#3 #4
}
}
-\cs_new_protected_nopar:cpn { regex_compile_quantifier_?:w }
- { \regex_compile_quantifier_lazyness:nnNN { 0 } { 1 } }
-\cs_new_protected_nopar:cpn { regex_compile_quantifier_*:w }
- { \regex_compile_quantifier_lazyness:nnNN { 0 } { -1 } }
-\cs_new_protected_nopar:cpn { regex_compile_quantifier_+:w }
- { \regex_compile_quantifier_lazyness:nnNN { 1 } { -1 } }
-\cs_new_protected:cpn { regex_compile_quantifier_ \c_lbrace_str :w }
+\cs_new_protected_nopar:cpn { __regex_compile_quantifier_?:w }
+ { \__regex_compile_quantifier_lazyness:nnNN { 0 } { 1 } }
+\cs_new_protected_nopar:cpn { __regex_compile_quantifier_*:w }
+ { \__regex_compile_quantifier_lazyness:nnNN { 0 } { -1 } }
+\cs_new_protected_nopar:cpn { __regex_compile_quantifier_+:w }
+ { \__regex_compile_quantifier_lazyness:nnNN { 1 } { -1 } }
+\cs_new_protected:cpn { __regex_compile_quantifier_ \c_lbrace_str :w }
{
- \regex_get_digits:NTFw \l_regex_internal_a_int
- { \regex_compile_quantifier_braced_i:w }
- { \regex_compile_quantifier_abort:xNN { \c_lbrace_str } }
+ \__regex_get_digits:NTFw \l__regex_internal_a_int
+ { \__regex_compile_quantifier_braced_i:w }
+ { \__regex_compile_quantifier_abort:xNN { \c_lbrace_str } }
}
-\cs_new_protected:Npn \regex_compile_quantifier_braced_i:w #1#2
+\cs_new_protected:Npn \__regex_compile_quantifier_braced_i:w #1#2
{
- \prg_case_str:xxn { #1 #2 }
+ \str_case_x:nnn { #1 #2 }
{
- { \regex_compile_special:N \c_rbrace_str }
+ { \__regex_compile_special:N \c_rbrace_str }
{
- \exp_args:No \regex_compile_quantifier_lazyness:nnNN
- { \int_use:N \l_regex_internal_a_int } { 0 }
+ \exp_args:No \__regex_compile_quantifier_lazyness:nnNN
+ { \int_use:N \l__regex_internal_a_int } { 0 }
}
- { \regex_compile_special:N , }
+ { \__regex_compile_special:N , }
{
- \regex_get_digits:NTFw \l_regex_internal_b_int
- { \regex_compile_quantifier_braced_iii:w }
- { \regex_compile_quantifier_braced_ii:w }
+ \__regex_get_digits:NTFw \l__regex_internal_b_int
+ { \__regex_compile_quantifier_braced_iii:w }
+ { \__regex_compile_quantifier_braced_ii:w }
}
}
{
- \regex_compile_quantifier_abort:xNN
- { \c_lbrace_str \int_use:N \l_regex_internal_a_int }
+ \__regex_compile_quantifier_abort:xNN
+ { \c_lbrace_str \int_use:N \l__regex_internal_a_int }
#1 #2
}
}
-\cs_new_protected:Npn \regex_compile_quantifier_braced_ii:w #1#2
+\cs_new_protected:Npn \__regex_compile_quantifier_braced_ii:w #1#2
{
- \str_if_eq:xxTF
- { #1 #2 } { \regex_compile_special:N \c_rbrace_str }
+ \str_if_eq_x:nnTF
+ { #1 #2 } { \__regex_compile_special:N \c_rbrace_str }
{
- \exp_args:No \regex_compile_quantifier_lazyness:nnNN
- { \int_use:N \l_regex_internal_a_int } { -1 }
+ \exp_args:No \__regex_compile_quantifier_lazyness:nnNN
+ { \int_use:N \l__regex_internal_a_int } { -1 }
}
{
- \regex_compile_quantifier_abort:xNN
- { \c_lbrace_str \int_use:N \l_regex_internal_a_int , }
+ \__regex_compile_quantifier_abort:xNN
+ { \c_lbrace_str \int_use:N \l__regex_internal_a_int , }
#1 #2
}
}
-\cs_new_protected:Npn \regex_compile_quantifier_braced_iii:w #1#2
+\cs_new_protected:Npn \__regex_compile_quantifier_braced_iii:w #1#2
{
- \str_if_eq:xxTF
- { #1 #2 } { \regex_compile_special:N \c_rbrace_str }
+ \str_if_eq_x:nnTF
+ { #1 #2 } { \__regex_compile_special:N \c_rbrace_str }
{
- \if_num: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
+ \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
+ \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 }
+ \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
+ \__regex_compile_quantifier_abort:xNN
{
\c_lbrace_str
- \int_use:N \l_regex_internal_a_int ,
- \int_use:N \l_regex_internal_b_int
+ \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
+\cs_new_protected:Npn \__regex_compile_raw_error:N #1
{
- \msg_kernel_error:nnx { regex } { bad-escape } {#1}
- \regex_compile_raw: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
+\cs_new_protected:Npn \__regex_compile_raw:N #1#2#3
{
- \regex_if_in_class:TF
+ \__regex_if_in_class:TF
{
- \str_if_eq:nnTF {#2#3} { \regex_compile_special:N - }
- { \regex_compile_range:Nw #1 }
+ \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 ~ } }
+ \__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 ~ } }
+ \__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 }
+\prg_new_protected_conditional:Npnn \__regex_if_end_range:NN #1#2 { TF }
{
- \if_meaning:w \regex_compile_raw:N #1
+ \if_meaning:w \__regex_compile_raw:N #1
\prg_return_true:
\else:
- \if_meaning:w \regex_compile_special:N #1
+ \if_meaning:w \__regex_compile_special:N #1
\if_charcode:w ] #2
\prg_return_false:
\else:
@@ -804,1790 +804,1798 @@
\fi:
\fi:
}
-\cs_new_protected:Npn \regex_compile_range:Nw #1#2#3
+\cs_new_protected:Npn \__regex_compile_range:Nw #1#2#3
{
- \regex_if_end_range:NNTF #2 #3
+ \__regex_if_end_range:NNTF #2 #3
{
- \if_num:w `#1 > `#3 \exp_stop_f:
- \msg_kernel_error:nnxx { regex } { range-backwards } {#1} {#3}
+ \if_int_compare:w `#1 > `#3 \exp_stop_f:
+ \__msg_kernel_error:nnxx { regex } { range-backwards } {#1} {#3}
\else:
- \tl_build_one:x
+ \__tl_build_one:x
{
- \if_num:w `#1 = `#3 \exp_stop_f:
- \regex_item_equal:n
+ \if_int_compare:w `#1 = `#3 \exp_stop_f:
+ \__regex_item_equal:n
\else:
- \regex_item_range:nn { \int_value:w `#1 ~ }
+ \__regex_item_range:nn { \__int_value:w `#1 ~ }
\fi:
- { \int_value:w `#3 ~ }
+ { \__int_value:w `#3 ~ }
}
\fi:
}
{
- \msg_kernel_warning:nnxx { regex } { range-missing-end }
+ \__msg_kernel_warning:nnxx { regex } { range-missing-end }
{#1} { \c_backslash_str #3 }
- \tl_build_one:x
+ \__tl_build_one:x
{
- \regex_item_equal:n { \int_value:w `#1 ~ }
- \regex_item_equal:n { \int_value:w `- ~ }
+ \__regex_item_equal:n { \__int_value:w `#1 ~ }
+ \__regex_item_equal:n { \__int_value:w `- ~ }
}
#2#3
}
}
-\cs_new_protected_nopar:cpx { regex_compile_.: }
+\cs_new_protected_nopar:cpx { __regex_compile_.: }
{
- \exp_not:N \regex_if_in_class:TF
- { \regex_compile_raw:N . }
- { \regex_compile_one:x \exp_not:c { regex_prop_.: } }
+ \exp_not:N \__regex_if_in_class:TF
+ { \__regex_compile_raw:N . }
+ { \__regex_compile_one:x \exp_not:c { __regex_prop_.: } }
}
-\cs_new_protected_nopar:cpn { regex_prop_.: }
+\cs_new_protected_nopar:cpn { __regex_prop_.: }
{
- \if_num:w \l_regex_current_char_int > - \c_two
- \exp_after:wN \regex_break_true:w
+ \if_int_compare:w \l__regex_current_char_int > - \c_two
+ \exp_after:wN \__regex_break_true:w
\fi:
}
-\cs_set_protected:Npn \regex_tmp:w #1#2
+\cs_set_protected:Npn \__regex_tmp:w #1#2
{
- \cs_new_protected_nopar:cpx { regex_compile_/#1: }
- { \regex_compile_one:x \exp_not:c { regex_prop_#1: } }
- \cs_new_protected_nopar:cpx { regex_compile_/#2: }
+ \cs_new_protected_nopar:cpx { __regex_compile_/#1: }
+ { \__regex_compile_one:x \exp_not:c { __regex_prop_#1: } }
+ \cs_new_protected_nopar:cpx { __regex_compile_/#2: }
{
- \regex_compile_one:x
- { \regex_item_reverse:n \exp_not:c { regex_prop_#1: } }
+ \__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_nopar:cpn { regex_compile_/N: }
- { \regex_compile_one:x \regex_prop_N: }
-\cs_new_protected:Npn \regex_compile_anchor:NF #1#2
+\__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_nopar: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}
+ \__regex_if_in_class_or_catcode:TF {#2}
{
- \tl_build_one:n
- { \regex_assertion:Nn \c_true_bool { \regex_anchor:N #1 } }
+ \__tl_build_one:n
+ { \__regex_assertion:Nn \c_true_bool { \__regex_anchor:N #1 } }
}
}
-\cs_set_protected:Npn \regex_tmp:w #1#2
+\cs_set_protected:Npn \__regex_tmp:w #1#2
{
- \cs_new_protected_nopar:cpn { regex_compile_/#1: }
- { \regex_compile_anchor:NF #2 { \regex_compile_raw_error:N #1 } }
+ \cs_new_protected_nopar: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
+\__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_nopar:cpn { regex_compile_#1: }
- { \regex_compile_anchor:NF #2 { \regex_compile_raw:N #1 } }
+ \cs_new_protected_nopar: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_nopar:cpn { regex_compile_/b: }
+\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_nopar:cpn { __regex_compile_/b: }
{
- \regex_if_in_class_or_catcode:TF
- { \regex_compile_raw_error:N 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: } }
+ \__tl_build_one:n
+ { \__regex_assertion:Nn \c_true_bool { \__regex_b_test: } }
}
}
-\cs_new_protected_nopar:cpn { regex_compile_/B: }
+\cs_new_protected_nopar:cpn { __regex_compile_/B: }
{
- \regex_if_in_class_or_catcode:TF
- { \regex_compile_raw_error:N 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: } }
+ \__tl_build_one:n
+ { \__regex_assertion:Nn \c_false_bool { \__regex_b_test: } }
}
}
-\cs_new_protected:cpn { regex_compile_]: }
+\cs_new_protected:cpn { __regex_compile_]: }
{
- \regex_if_in_class:TF
+ \__regex_if_in_class:TF
{
- \if_num:w \l_regex_mode_int > \c_sixteen
- \tl_build_one:n { \if_false: { \fi: } }
+ \if_int_compare:w \l__regex_mode_int > \c_sixteen
+ \__tl_build_one:n { \if_false: { \fi: } }
\fi:
- \tex_advance:D \l_regex_mode_int - \c_fifteen
- \tex_divide:D \l_regex_mode_int \c_thirteen
- \if_int_odd:w \l_regex_mode_int \else:
- \exp_after:wN \regex_compile_quantifier:w
+ \tex_advance:D \l__regex_mode_int - \c_fifteen
+ \tex_divide:D \l__regex_mode_int \c_thirteen
+ \if_int_odd:w \l__regex_mode_int \else:
+ \exp_after:wN \__regex_compile_quantifier:w
\fi:
}
- { \regex_compile_raw:N ] }
+ { \__regex_compile_raw:N ] }
}
-\cs_new_protected_nopar:cpn { regex_compile_[: }
+\cs_new_protected_nopar:cpn { __regex_compile_[: }
{
- \regex_if_in_class:TF
- { \regex_compile_class_posix_test:w }
+ \__regex_if_in_class:TF
+ { \__regex_compile_class_posix_test:w }
{
- \regex_if_within_catcode:TF
+ \__regex_if_within_catcode:TF
{
- \exp_after:wN \regex_compile_class_catcode:w
- \int_use:N \l_regex_catcodes_int ;
+ \exp_after:wN \__regex_compile_class_catcode:w
+ \int_use:N \l__regex_catcodes_int ;
}
- { \regex_compile_class_normal:w }
+ { \__regex_compile_class_normal:w }
}
}
-\cs_new_protected_nopar:Npn \regex_compile_class_normal:w
+\cs_new_protected_nopar:Npn \__regex_compile_class_normal:w
{
- \regex_compile_class:TFNN
- { \regex_class:NnnnN \c_true_bool }
- { \regex_class:NnnnN \c_false_bool }
+ \__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;
+\cs_new_protected:Npn \__regex_compile_class_catcode:w #1;
{
- \if_int_compare:w \l_regex_mode_int = \c_two
- \tl_build_one:n
- { \regex_class:NnnnN \c_true_bool { \if_false: } \fi: }
+ \if_int_compare:w \l__regex_mode_int = \c_two
+ \__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} }
+ \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
+\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 ^ }
+ \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_ii:NN
+ \__tl_build_one:n { #2 { \if_false: } \fi: }
+ \__regex_compile_class_ii:NN
}
{
- \tl_build_one:n { #1 { \if_false: } \fi: }
- \regex_compile_class_ii:NN #3 #4
+ \__tl_build_one:n { #1 { \if_false: } \fi: }
+ \__regex_compile_class_ii:NN #3 #4
}
}
-\cs_new_protected:Npn \regex_compile_class_ii:NN #1#2
+\cs_new_protected:Npn \__regex_compile_class_ii:NN #1#2
{
\token_if_eq_charcode:NNTF #2 ]
- { \regex_compile_raw:N #2 }
+ { \__regex_compile_raw:N #2 }
{ #1 #2 }
}
-\cs_new_protected:Npn \regex_compile_class_posix_test:w #1#2
+\cs_new_protected:Npn \__regex_compile_class_posix_test:w #1#2
{
- \token_if_eq_meaning:NNT \regex_compile_special:N #1
+ \token_if_eq_meaning:NNT \__regex_compile_special:N #1
{
- \prg_case_str:nnn { #2 }
+ \str_case:nnn { #2 }
{
- : { \regex_compile_class_posix:NNNNw }
- = { \msg_kernel_warning:nnx { regex } { posix-unsupported } { = } }
- . { \msg_kernel_warning:nnx { regex } { posix-unsupported } { . } }
+ : { \__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
+ \__regex_compile_raw:N [ #1 #2
}
-\cs_new_protected:Npn \regex_compile_class_posix:NNNNw #1#2#3#4#5#6
+\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 ^ }
+ \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_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
+ \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
+\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 }
+ \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
+\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 ] }
+ { \__regex_compile_special:N : \__regex_compile_special:N ] }
{
- \cs_if_exist:cTF { regex_posix_ \l_regex_internal_a_tl : }
+ \cs_if_exist:cTF { __regex_posix_ \l__regex_internal_a_tl : }
{
- \regex_compile_one:x
+ \__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 : }
+ \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
+ \__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 :]
+ [: \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 }
+ \__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
+\cs_new_protected:Npn \__regex_compile_group_begin:N #1
{
- \tl_build_one:n { #1 { \if_false: } \fi: }
- \regex_mode_quit_c:
- \tl_set_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: }
+ \__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:
+\cs_new_protected:Npn \__regex_compile_group_end:
{
- \if_num:w \l_regex_group_level_int > \c_zero
- \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
+ \if_int_compare:w \l__regex_group_level_int > \c_zero
+ \__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 )
+ \__msg_kernel_warning:nn { regex } { extra-rparen }
+ \exp_after:wN \__regex_compile_raw:N \exp_after:wN )
\fi:
}
-\cs_new_protected_nopar:cpn { regex_compile_(: }
+\cs_new_protected_nopar:cpn { __regex_compile_(: }
{
- \regex_if_in_class:TF { \regex_compile_raw:N ( }
- { \regex_compile_lparen:w }
+ \__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
+\cs_new_protected:Npn \__regex_compile_lparen:w #1#2#3#4
{
- \str_if_eq:nnTF { #1 #2 } { \regex_compile_special:N ? }
+ \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 }
+ { __regex_compile_special_group_\token_to_str:N #4 :w }
{
- \msg_kernel_warning:nnx { regex } { special-group-unknown }
+ \__msg_kernel_warning:nnx { regex } { special-group-unknown }
{ (? \token_to_str:N #4 }
- \regex_compile_group_begin:N \regex_group:nnnN
- \regex_compile_raw:N ? #3 #4
+ \__regex_compile_group_begin:N \__regex_group:nnnN
+ \__regex_compile_raw:N ? #3 #4
}
}
{
- \regex_compile_group_begin:N \regex_group:nnnN
+ \__regex_compile_group_begin:N \__regex_group:nnnN
#1 #2 #3 #4
}
}
-\cs_new_protected_nopar:cpn { regex_compile_|: }
+\cs_new_protected_nopar:cpn { __regex_compile_|: }
{
- \regex_if_in_class:TF { \regex_compile_raw:N | }
+ \__regex_if_in_class:TF { \__regex_compile_raw:N | }
{
- \tl_build_one:n
- { \if_false: { \fi: } \regex_branch:n { \if_false: } \fi: }
+ \__tl_build_one:n
+ { \if_false: { \fi: } \__regex_branch:n { \if_false: } \fi: }
}
}
-\cs_new_protected_nopar:cpn { regex_compile_): }
+\cs_new_protected_nopar:cpn { __regex_compile_): }
{
- \regex_if_in_class:TF { \regex_compile_raw:N ) }
- { \regex_compile_group_end: }
+ \__regex_if_in_class:TF { \__regex_compile_raw:N ) }
+ { \__regex_compile_group_end: }
}
-\cs_new_protected_nopar:cpn { regex_compile_special_group_::w }
- { \regex_compile_group_begin:N \regex_group_no_capture:nnnN }
-\cs_new_protected_nopar: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
+\cs_new_protected_nopar:cpn { __regex_compile_special_group_::w }
+ { \__regex_compile_group_begin:N \__regex_group_no_capture:nnnN }
+\cs_new_protected_nopar: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 ) }
+ \str_if_eq:nnTF { #1 #2 } { \__regex_compile_special:N ) }
{
- \cs_set_nopar:Npn \regex_item_equal:n { \regex_item_caseless_equal:n }
- \cs_set_nopar:Npn \regex_item_range:nn { \regex_item_caseless_range:nn }
+ \cs_set_nopar:Npn \__regex_item_equal:n { \__regex_item_caseless_equal:n }
+ \cs_set_nopar: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
+ \__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_nopar:cpn { regex_compile_special_group_-:w } #1#2#3#4
+\cs_new_protected_nopar: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 ) }
+ { \__regex_compile_raw:N i \__regex_compile_special:N ) }
{
- \cs_set_nopar:Npn \regex_item_equal:n { \regex_item_caseful_equal:n }
- \cs_set_nopar:Npn \regex_item_range:nn { \regex_item_caseful_range:nn }
+ \cs_set_nopar:Npn \__regex_item_equal:n { \__regex_item_caseful_equal:n }
+ \cs_set_nopar: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 -
+ \__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
+\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
+ \token_if_eq_meaning:NNTF #1 \__regex_compile_raw:N
{
- \int_if_exist:cTF { c_regex_catcode_#2_int }
+ \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_two \else: \c_six \fi:
+ \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_two \else: \c_six \fi:
}
}
- { \cs_if_exist_use:cF { regex_compile_c_#2:w } }
+ { \cs_if_exist_use:cF { __regex_compile_c_#2:w } }
{
- \msg_kernel_error:nnx { regex } { c-missing-category } {#2}
+ \__msg_kernel_error:nnx { regex } { c-missing-category } {#2}
#1 #2
}
}
-\cs_new_protected:cpn { regex_compile_c_[:w } #1#2
+\cs_new_protected:cpn { __regex_compile_c_[:w } #1#2
{
- \l_regex_mode_int
- = \if_case:w \l_regex_mode_int \c_two \else: \c_six \fi:
- \int_zero:N \l_regex_catcodes_int
- \str_if_eq:nnTF { #1 #2 } { \regex_compile_special:N ^ }
+ \l__regex_mode_int
+ = \if_case:w \l__regex_mode_int \c_two \else: \c_six \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_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
+ \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
+\cs_new_protected:Npn \__regex_compile_c_lbrack_loop:NN #1#2
{
- \token_if_eq_meaning:NNTF #1 \regex_compile_raw:N
+ \token_if_eq_meaning:NNTF #1 \__regex_compile_raw:N
{
- \int_if_exist:cTF { c_regex_catcode_#2_int }
+ \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
+ \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: }
+ { \__regex_compile_c_lbrack_end: }
}
{
- \msg_kernel_error:nnx { regex } { c-missing-rbrack } {#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
+\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:
+ \if_int_odd:w \__int_eval:w \l__regex_catcodes_int / #1 \__int_eval_end:
\else:
- \tex_advance:D \l_regex_catcodes_int #1
+ \tex_advance:D \l__regex_catcodes_int #1
\fi:
}
-\cs_new_protected_nopar:Npn \regex_compile_c_lbrack_end:
+\cs_new_protected_nopar: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 }
+ \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_nopar:cpn { regex_compile_c_ \c_lbrace_str :w }
+\cs_new_protected_nopar:cpn { __regex_compile_c_ \c_lbrace_str :w }
{
- \regex_compile:w
- \regex_disable_submatches:
- \l_regex_mode_int
- = - \if_case:w \l_regex_mode_int \c_two \else: \c_six \fi:
+ \__regex_compile:w
+ \__regex_disable_submatches:
+ \l__regex_mode_int
+ = - \if_case:w \l__regex_mode_int \c_two \else: \c_six \fi:
}
-\cs_new_protected:cpn { regex_compile_ \c_rbrace_str : }
+\cs_new_protected:cpn { __regex_compile_ \c_rbrace_str : }
{
- \regex_if_in_cs:TF
+ \__regex_if_in_cs:TF
{
- \regex_compile_end:
- \regex_compile_one:x
- { \regex_item_cs:n { \exp_not:o \l_regex_internal_regex } }
+ \__regex_compile_end:
+ \__regex_compile_one:x
+ { \__regex_item_cs:n { \exp_not:o \l__regex_internal_regex } }
}
- { \exp_after:wN \regex_compile_raw:N \c_rbrace_str }
+ { \exp_after:wN \__regex_compile_raw:N \c_rbrace_str }
}
-\cs_new_protected:cpn { regex_compile_/u: } #1#2
+\cs_new_protected:cpn { __regex_compile_/u: } #1#2
{
- \regex_if_in_class_or_catcode:TF
- { \regex_compile_raw_error:N u #1 #2 }
+ \__regex_if_in_class_or_catcode:TF
+ { \__regex_compile_raw_error:N u #1 #2 }
{
- \str_if_eq:xxTF {#1#2} { \regex_compile_special:N \c_lbrace_str }
+ \str_if_eq_x:nnTF {#1#2} { \__regex_compile_special:N \c_lbrace_str }
{
- \tl_set:Nx \l_regex_internal_a_tl { \if_false: } \fi:
- \regex_compile_u_loop:NN
+ \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
+ \__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
+\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_raw:N
+ { #2 \__regex_compile_u_loop:NN }
{
- \token_if_eq_meaning:NNTF #1 \regex_compile_special:N
+ \token_if_eq_meaning:NNTF #1 \__regex_compile_special:N
{
\exp_after:wN \token_if_eq_charcode:NNTF \c_rbrace_str #2
- { \if_false: { \fi: } \regex_compile_u_end: }
- { #2 \regex_compile_u_loop:NN }
+ { \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:
+ \__msg_kernel_error:nnx { regex } { u-missing-rbrace } {#2}
+ \__regex_compile_u_end:
#1 #2
}
}
}
-\cs_new_protected:Npn \regex_compile_u_end:
+\cs_new_protected:Npn \__regex_compile_u_end:
{
- \tl_set:Nv \l_regex_internal_a_tl { \l_regex_internal_a_tl }
- \if_num:w \l_regex_mode_int = \c_zero
- \regex_compile_u_not_cs:
+ \tl_set:Nv \l__regex_internal_a_tl { \l__regex_internal_a_tl }
+ \if_int_compare:w \l__regex_mode_int = \c_zero
+ \__regex_compile_u_not_cs:
\else:
- \regex_compile_u_in_cs:
+ \__regex_compile_u_in_cs:
\fi:
}
-\cs_new_protected:Npn \regex_compile_u_in_cs:
+\cs_new_protected:Npn \__regex_compile_u_in_cs:
{
- \exp_args:NNo \str_gset_other:Nn \g_regex_internal_tl
- { \l_regex_internal_a_tl }
- \tl_build_one:x
+ \exp_args:NNo \__str_gset_other:Nn \g__regex_internal_tl
+ { \l__regex_internal_a_tl }
+ \__tl_build_one:x
{
- \tl_map_function:NN \g_regex_internal_tl
- \regex_compile_u_in_cs_aux:n
+ \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
+\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 } }
+ \__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:
+\cs_new_protected:Npn \__regex_compile_u_not_cs:
{
- \exp_args:No \tl_analysis_map_inline:nn { \l_regex_internal_a_tl }
+ \exp_args:No \__tl_analysis_map_inline:nn { \l__regex_internal_a_tl }
{
- \tl_build_one:n
+ \__tl_build_one:n
{
- \regex_class:NnnnN \c_true_bool
+ \__regex_class:NnnnN \c_true_bool
{
- \if_num:w "##2 = \c_zero
- \regex_item_exact_cs:c { \exp_after:wN \cs_to_str:N ##1 }
+ \if_int_compare:w "##2 = \c_zero
+ \__regex_item_exact_cs:c { \exp_after:wN \cs_to_str:N ##1 }
\else:
- \regex_item_exact:nn { \int_value:w "##2 } { ##3 }
+ \__regex_item_exact:nn { \__int_value:w "##2 } { ##3 }
\fi:
}
{ 1 } { 0 } \c_false_bool
}
}
}
-\cs_new_protected_nopar:cpn { regex_compile_/K: }
+\cs_new_protected_nopar:cpn { __regex_compile_/K: }
{
- \int_compare:nNnTF \l_regex_mode_int = \c_zero
- { \tl_build_one:n { \regex_command_K: } }
- { \regex_compile_raw_error:N K }
+ \int_compare:nNnTF \l__regex_mode_int = \c_zero
+ { \__tl_build_one:n { \__regex_command_K: } }
+ { \__regex_compile_raw_error:N K }
}
-\cs_new_protected:Npn \regex_show_aux:Nx #1#2
+\cs_new_protected:Npn \__regex_show:Nx #1#2
{
- \tl_set_build:Nw \l_regex_internal_a_tl
- \cs_set_protected_nopar:Npn \regex_branch:n
+ \__tl_build:Nw \l__regex_internal_a_tl
+ \cs_set_protected_nopar: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
+ \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_nopar:Npn \regex_group:nnnN
- { \regex_show_group_aux:nnnnN { } }
- \cs_set_protected_nopar:Npn \regex_group_no_capture:nnnN
- { \regex_show_group_aux:nnnnN { ~(no~capture) } }
- \cs_set_protected_nopar: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_nopar: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_nopar: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
+ \cs_set_protected_nopar:Npn \__regex_group:nnnN
+ { \__regex_show_group_aux:nnnnN { } }
+ \cs_set_protected_nopar:Npn \__regex_group_no_capture:nnnN
+ { \__regex_show_group_aux:nnnnN { ~(no~capture) } }
+ \cs_set_protected_nopar: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_nopar: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_nopar: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
+ \__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_protected:Npn \regex_item_exact_cs:c ##1
- { \regex_show_one:n { control~sequence~\iow_char:N\\##1 } }
- \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_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_protected:Npn \__regex_item_exact_cs:c ##1
+ { \__regex_show_one:n { control~sequence~\iow_char:N\\##1 } }
+ \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 { ~ }
#1
- \tl_build_end:
- \msg_aux_show:x { > Compiled~regex~#2: \l_regex_internal_a_tl }
+ \__tl_build_end:
+ \__msg_show_variable:x { > Compiled~regex~#2: \l__regex_internal_a_tl }
}
-\cs_new_protected:Npn \regex_show_one:n #1
+\cs_new_protected:Npn \__regex_show_one:n #1
{
- \int_incr:N \l_regex_show_lines_int
- \tl_build_one:x
- { \iow_newline: \seq_use:N \l_regex_show_prefix_seq #1 }
+ \int_incr:N \l__regex_show_lines_int
+ \__tl_build_one:x
+ {
+ \iow_newline:
+ \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
+\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 { ~ }
+ \__regex_show_one:n {#1}
+ \__regex_show_push:n { ~ }
#2
- \regex_show_pop:
+ \__regex_show_pop:
}
-\cs_new_protected:Npn \regex_show_group_aux:nnnnN #1#2#3#4#5
+\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 { | }
+ \__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 }
+ \__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
+\cs_set:Npn \__regex_show_class:NnnnN #1#2#3#4#5
{
- \tl_set_build:Nw \l_regex_internal_a_tl
- \int_zero:N \l_regex_show_lines_int
- \regex_show_push:n {~}
+ \__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
- \prg_case_int:nnn { \l_regex_show_lines_int }
+ \int_case:nnn { \l__regex_show_lines_int }
{
{0}
{
- \tl_build_end:
- \regex_show_one:n { \bool_if:NTF #1 { Fail } { Pass } }
+ \__tl_build_end:
+ \__regex_show_one:n { \bool_if:NTF #1 { Fail } { Pass } }
}
{1}
{
- \tl_build_end:
+ \__tl_build_end:
\bool_if:NTF #1
{
#2
- \tl_build_one:n { \regex_msg_repeated:nnN {#3} {#4} #5 }
+ \__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
+ \__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
+ \__tl_build_end:
+ \__regex_show_one:n
{
\bool_if:NTF #1 { M } { Don't~m } atch
- \regex_msg_repeated:nnN {#3} {#4} #5
+ \__regex_msg_repeated:nnN {#3} {#4} #5
}
- \tl_build_one:o \l_regex_internal_a_tl
+ \__tl_build_one:o \l__regex_internal_a_tl
}
}
-\cs_new:Npn \regex_show_anchor_to_str:N #1
+\cs_new:Npn \__regex_show_anchor_to_str:N #1
{
anchor~at~
- \prg_case_str:nnn { #1 }
+ \str_case:nnn { #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) }
+ { \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
+\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
+ \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_use:N \l_regex_internal_seq, ~
+ categories~
+ \seq_map_function:NN \l__regex_internal_seq \use:n
+ , ~
\bool_if:NF #1 { negative~ } class
}
}
-\int_new:N \l_regex_min_state_int
-\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
+\int_new:N \l__regex_min_state_int
+\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
+ \__regex_compile:n {#1}
+ \__regex_build:N \l__regex_internal_regex
}
-\cs_new_protected:Npn \regex_build:N #1
+\cs_new_protected:Npn \__regex_build:N #1
{
\int_set:Nn \tex_escapechar:D { 92 }
- \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:
+ \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
+ \__regex_pop_lr_states:
+ \__regex_toks_put_right:Nn \l__regex_right_state_int
{
- \if_num:w \l_regex_current_pos_int = \l_regex_max_pos_int
- \exp_after:wN \regex_action_success:
+ \if_int_compare:w \l__regex_current_pos_int = \l__regex_max_pos_int
+ \exp_after:wN \__regex_action_success:
\fi:
}
}
-\cs_new_protected_nopar:Npn \regex_push_lr_states:
+\cs_new_protected_nopar: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 }
+ \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_nopar:Npn \regex_pop_lr_states:
+\cs_new_protected_nopar: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
+ \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_toks_put_left:Nx #1#2
+\cs_new_protected:Npn \__regex_toks_put_left:Nx #1#2
{
- \cs_set_nopar:Npx \regex_tmp:w { #2 }
+ \cs_set_nopar: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 }
+ { \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_new_protected:Npn \__regex_toks_put_right:Nx #1#2
{
- \cs_set_nopar:Npx \regex_tmp:w {#2}
+ \cs_set_nopar: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 }
+ { \tex_the:D \tex_toks:D \exp_after:wN #1 \__regex_tmp:w }
}
-\cs_new_protected:Npn \regex_toks_put_right:Nn #1#2
+\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_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_nopar:Npn \regex_build_new_state:
+\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_nopar:Npn \__regex_build_new_state:
{
- \tex_toks:D \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
+ \tex_toks:D \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
+\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
+ \__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 } }
+ #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 } }
+ #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_new_protected:Npn \__regex_class:NnnnN #1#2#3#4#5
{
- \cs_set_nopar:Npx \regex_tests_action_cost:n ##1
+ \cs_set_nopar: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} } }
+ { \__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
+ \__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
+\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
+ \__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
+\cs_new_protected:Npn \__regex_class_repeat:nN #1#2
{
- \if_num:w #1 = \c_zero
- \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
+ \if_int_compare:w #1 = \c_zero
+ \__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
+ \__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
+\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 - \c_one }
+ \__regex_class_repeat:n {#1}
+ \int_set:Nn \l__regex_internal_a_int
+ { \l__regex_max_state_int + #2 - \c_one }
\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
+ \__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
+\cs_new_protected:Npn \__regex_group_aux:nnnnN #1#2#3#4#5
{
- \if_num:w #3 = \c_zero
- \regex_build_new_state:
- \regex_build_transition_right:nNn \regex_action_free_group:n
- \l_regex_left_state_int \l_regex_right_state_int
+ \if_int_compare:w #3 = \c_zero
+ \__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:
+ \__regex_build_new_state:
+ \__regex_push_lr_states:
#2
- \regex_pop_lr_states:
+ \__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
+ \__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
+\cs_new_protected:Npn \__regex_group:nnnN #1
{
- \exp_args:No \regex_group_aux:nnnnN
- { \int_use:N \l_regex_capturing_group_int }
+ \exp_args:No \__regex_group_aux:nnnnN
+ { \int_use:N \l__regex_capturing_group_int }
{
- \int_incr:N \l_regex_capturing_group_int
+ \int_incr:N \l__regex_capturing_group_int
#1
}
}
-\cs_new_protected_nopar:Npn \regex_group_no_capture:nnnN
- { \regex_group_aux:nnnnN { -1 } }
-\cs_new_protected:Npn \regex_group_resetting:nnnN #1
+\cs_new_protected_nopar: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 }
+ \__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 }
+ \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_map_break:n } { }
- \prg_break_point:n { }
+ { ?? \__prg_break:n } { }
+ \__prg_break_point:
}
}
-\cs_new_protected:Npn \regex_group_resetting_loop:nnNn #1#2#3#4
+\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}
+ \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 } }
+ \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
+\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
+ \__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
+ \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
+\cs_new_protected:Npn \__regex_group_repeat:nn #1#2
{
- \if_num:w #2 = \c_zero
- \int_set:Nn \l_regex_max_state_int
- { \l_regex_left_state_int - \c_one }
- \regex_build_new_state:
+ \if_int_compare:w #2 = \c_zero
+ \int_set:Nn \l__regex_max_state_int
+ { \l__regex_left_state_int - \c_one }
+ \__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:
+ \__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
+\cs_new_protected:Npn \__regex_group_submatches:nNN #1#2#3
{
- \if_num:w #1 > \c_minus_one
- \regex_toks_put_left:Nx #2 { \regex_action_submatch:n { #1 < } }
- \regex_toks_put_left:Nx #3 { \regex_action_submatch:n { #1 > } }
+ \if_int_compare:w #1 > \c_minus_one
+ \__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
+\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_num:w \int_eval:w #1 > \c_one
- \int_set:Nn \l_regex_internal_c_int
+ \__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 > \c_one
+ \int_set:Nn \l__regex_internal_c_int
{
( #1 - \c_one )
- * ( \l_regex_internal_b_int - \l_regex_internal_a_int )
+ * ( \l__regex_internal_b_int - \l__regex_internal_a_int )
}
- \tex_advance:D \l_regex_right_state_int \l_regex_internal_c_int
- \tex_advance:D \l_regex_max_state_int \l_regex_internal_c_int
- \prg_replicate:nn \l_regex_internal_c_int
+ \tex_advance:D \l__regex_right_state_int \l__regex_internal_c_int
+ \tex_advance:D \l__regex_max_state_int \l__regex_internal_c_int
+ \prg_replicate:nn \l__regex_internal_c_int
{
- \tex_toks:D \l_regex_internal_b_int
- = \tex_toks:D \l_regex_internal_a_int
- \tex_advance:D \l_regex_internal_a_int \c_one
- \tex_advance:D \l_regex_internal_b_int \c_one
+ \tex_toks:D \l__regex_internal_b_int
+ = \tex_toks:D \l__regex_internal_a_int
+ \tex_advance:D \l__regex_internal_a_int \c_one
+ \tex_advance:D \l__regex_internal_b_int \c_one
}
\fi:
}
-\cs_new_protected:Npn \regex_group_repeat:nnN #1#2#3
+\cs_new_protected:Npn \__regex_group_repeat:nnN #1#2#3
{
- \if_num:w #2 = \c_zero
- \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 - \c_one }
- \regex_build_transition_right:nNn \regex_action_free:n
- \l_regex_right_state_int \l_regex_internal_a_int
- \regex_build_new_state:
+ \if_int_compare:w #2 = \c_zero
+ \__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 - \c_one }
+ \__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
+ \__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
+ \__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
+ \__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
+ \__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
+ \__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:
+ \__regex_build_new_state:
\fi:
}
-\cs_new_protected:Npn \regex_group_repeat:nnnN #1#2#3#4
+\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 }
+ \__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
+ \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
+ \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 - \c_one }
{
- \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
+ \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_num:w #2 = \c_zero
- \int_set:Nn \l_regex_right_state_int
- { \l_regex_left_state_int - \c_one }
+ \if_int_compare:w #2 = \c_zero
+ \int_set:Nn \l__regex_right_state_int
+ { \l__regex_left_state_int - \c_one }
\else:
- \int_sub:Nn \l_regex_right_state_int
- { \l_regex_internal_b_int - \l_regex_internal_a_int }
+ \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
+ \__regex_build_transition_right:nNn \__regex_action_free:n
+ \l__regex_right_state_int \l__regex_max_state_int
\fi:
- \regex_build_new_state:
+ \__regex_build_new_state:
}
-\cs_new_protected:Npn \regex_assertion:Nn #1#2
+\cs_new_protected:Npn \__regex_assertion:Nn #1#2
{
- \regex_build_new_state:
- \regex_toks_put_right:Nx \l_regex_left_state_int
+ \__regex_build_new_state:
+ \__regex_toks_put_right:Nx \l__regex_left_state_int
{
\exp_not:n {#2}
- \regex_break_point:TF
+ \__regex_break_point:TF
\bool_if:NF #1 { { } }
{
- \regex_action_free:n
+ \__regex_action_free:n
{
\int_eval:n
- { \l_regex_right_state_int - \l_regex_left_state_int }
+ { \l__regex_right_state_int - \l__regex_left_state_int }
}
}
\bool_if:NT #1 { { } }
}
}
-\cs_new_protected:Npn \regex_anchor:N #1
+\cs_new_protected:Npn \__regex_anchor:N #1
{
- \if_num:w #1 = \l_regex_current_pos_int
- \exp_after:wN \regex_break_true:w
+ \if_int_compare:w #1 = \l__regex_current_pos_int
+ \exp_after:wN \__regex_break_true:w
\fi:
}
-\cs_new_protected_nopar:Npn \regex_b_test:
+\cs_new_protected_nopar: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_nopar: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
-\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 { \c_two * \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
- \prg_stepwise_inline:nnnn
- \l_regex_min_state_int \c_one { \l_regex_max_state_int - \c_one }
+ \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_nopar: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
+\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 { \c_two * \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 \c_one { \l__regex_max_state_int - \c_one }
{ \tex_dimen:D ##1 \c_one sp \scan_stop: }
- \int_set_eq:NN \l_regex_min_active_int \l_regex_max_state_int
- \int_set_eq:NN \l_regex_step_int \c_zero
- \int_set_eq:NN \l_regex_success_pos_int \l_regex_min_pos_int
- \int_set:Nn \l_regex_submatch_int
- { \c_two * \l_regex_max_state_int }
- \bool_set_false:N \l_regex_empty_success_bool
- \regex_match_once:
- }
-\cs_new_protected_nopar:Npn \regex_match_once:
- {
- \if_meaning:w \c_true_bool \l_regex_empty_success_bool
- \cs_set_nopar:Npn \regex_if_two_empty_matches:F
- { \int_compare:nNnF \l_regex_start_pos_int = \l_regex_current_pos_int }
+ \int_set_eq:NN \l__regex_min_active_int \l__regex_max_state_int
+ \int_set_eq:NN \l__regex_step_int \c_zero
+ \int_set_eq:NN \l__regex_success_pos_int \l__regex_min_pos_int
+ \int_set:Nn \l__regex_submatch_int
+ { \c_two * \l__regex_max_state_int }
+ \bool_set_false:N \l__regex_empty_success_bool
+ \__regex_match_once:
+ }
+\cs_new_protected_nopar:Npn \__regex_match_once:
+ {
+ \if_meaning:w \c_true_bool \l__regex_empty_success_bool
+ \cs_set_nopar: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
+ \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 - \c_one }
- \regex_query_get:
- \regex_match_loop:
- \l_regex_every_match_tl
+ \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 - \c_one }
+ \__regex_query_get:
+ \__regex_match_loop:
+ \l__regex_every_match_tl
}
-\cs_new_protected_nopar:Npn \regex_single_match:
+\cs_new_protected_nopar: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 }
+ \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
+\cs_new_protected:Npn \__regex_multi_match:n #1
{
- \tl_set:Nn \l_regex_every_match_tl
+ \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
+ \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:
+ \exp_after:wN \__regex_match_once:
\fi:
}
}
-\cs_new_protected_nopar:Npn \regex_match_loop:
+\cs_new_protected_nopar:Npn \__regex_match_loop:
{
- \tex_advance:D \l_regex_step_int \c_two
- \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:
+ \tex_advance:D \l__regex_step_int \c_two
+ \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
- \exp_after:wN \regex_match_one_active:w
- \int_use:N \l_regex_min_active_int ;
+ \int_set_eq:NN \l__regex_max_active_int \l__regex_min_active_int
+ \exp_after:wN \__regex_match_one_active:w
+ \int_use:N \l__regex_min_active_int ;
}
- \prg_break_point:n { \bool_set_false:N \l_regex_fresh_thread_bool }
- \if_num:w \l_regex_max_active_int > \l_regex_min_active_int
- \if_num:w \l_regex_current_pos_int < \l_regex_max_pos_int
- \exp_after:wN \exp_after:wN \exp_after:wN \regex_match_loop:
+ \__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:w #1;
+\cs_new:Npn \__regex_match_one_active:w #1;
{
- \if_num:w #1 < \l_regex_max_active_int
- \regex_use_state_and_submatches:nn
- { \int_value:w \tex_skip:D #1 }
+ \if_int_compare:w #1 < \l__regex_max_active_int
+ \__regex_use_state_and_submatches:nn
+ { \__int_value:w \tex_skip:D #1 }
{ \tex_the:D \tex_toks:D #1 }
- \exp_after:wN \regex_match_one_active:w
- \int_use:N \int_eval:w #1 + \c_one \exp_after:wN ;
+ \exp_after:wN \__regex_match_one_active:w
+ \int_use:N \__int_eval:w #1 + \c_one \exp_after:wN ;
\fi:
}
-\cs_new_protected:Npn \regex_query_set:nnn #1#2#3
+\cs_new_protected:Npn \__regex_query_set:nnn #1#2#3
{
- \tex_muskip:D \l_regex_current_pos_int
+ \tex_muskip:D \l__regex_current_pos_int
= \etex_gluetomu:D
#3 sp
plus #2 sp
- minus \l_regex_balance_int sp
+ minus \l__regex_balance_int sp
\scan_stop:
- \tex_toks:D \l_regex_current_pos_int {#1}
- \int_incr:N \l_regex_current_pos_int
+ \tex_toks:D \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
+ \or: \int_incr:N \l__regex_balance_int
+ \or: \int_decr:N \l__regex_balance_int
\fi:
}
-\cs_new_protected_nopar:Npn \regex_query_get:
+\cs_new_protected_nopar:Npn \__regex_query_get:
{
- \l_regex_current_char_int
- = \etex_mutoglue:D \tex_muskip:D \l_regex_current_pos_int
- \l_regex_current_catcode_int = \etex_gluestretch:D
- \etex_mutoglue:D \tex_muskip:D \l_regex_current_pos_int
+ \l__regex_current_char_int
+ = \etex_mutoglue:D \tex_muskip:D \l__regex_current_pos_int
+ \l__regex_current_catcode_int = \etex_gluestretch:D
+ \etex_mutoglue:D \tex_muskip:D \l__regex_current_pos_int
}
-\cs_new_protected_nopar:Npn \regex_use_state:
+\cs_new_protected_nopar:Npn \__regex_use_state:
{
- \tex_dimen:D \l_regex_current_state_int
- = \l_regex_step_int sp \scan_stop:
- \tex_the:D \tex_toks:D \l_regex_current_state_int
- \tex_dimen:D \l_regex_current_state_int
- = \int_eval:w \l_regex_step_int + \c_one \int_eval_end: sp \scan_stop:
+ \tex_dimen:D \l__regex_current_state_int
+ = \l__regex_step_int sp \scan_stop:
+ \tex_the:D \tex_toks:D \l__regex_current_state_int
+ \tex_dimen:D \l__regex_current_state_int
+ = \__int_eval:w \l__regex_step_int + \c_one \__int_eval_end: sp \scan_stop:
}
-\cs_new_protected:Npn \regex_use_state_and_submatches:nn #1 #2
+\cs_new_protected:Npn \__regex_use_state_and_submatches:nn #1 #2
{
- \int_set:Nn \l_regex_current_state_int {#1}
- \if_num:w \tex_dimen:D \l_regex_current_state_int < \l_regex_step_int
- \tl_set:Nn \l_regex_current_submatches_prop {#2}
- \exp_after:wN \regex_use_state:
+ \int_set:Nn \l__regex_current_state_int {#1}
+ \if_int_compare:w \tex_dimen:D \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_nopar:Npn \regex_action_start_wildcard:
+\cs_new_protected_nopar: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}
+ \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_nopar:Npn \regex_action_free:n
- { \regex_action_free_aux:nn { > \l_regex_step_int \else: } }
-\cs_new_protected_nopar: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
+\cs_new_protected_nopar:Npn \__regex_action_free:n
+ { \__regex_action_free_aux:nn { > \l__regex_step_int \else: } }
+\cs_new_protected_nopar: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}
+ \int_add:Nn \l__regex_current_state_int {#2}
\exp_not:n
{
- \if_num:w \tex_dimen:D \l_regex_current_state_int #1
- \exp_after:wN \regex_use_state:
+ \if_int_compare:w \tex_dimen:D \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 }
+ \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
+\cs_new_protected:Npn \__regex_action_cost:n #1
{
- \exp_args:No \regex_store_state:n
- { \int_use:N \int_eval:w \l_regex_current_state_int + #1 }
+ \exp_args:No \__regex_store_state:n
+ { \int_use:N \__int_eval:w \l__regex_current_state_int + #1 }
}
-\cs_new_protected:Npn \regex_store_state:n #1
+\cs_new_protected:Npn \__regex_store_state:n #1
{
- \regex_store_submatches:
- \tex_skip:D \l_regex_max_active_int = #1 sp \scan_stop:
- \int_incr:N \l_regex_max_active_int
+ \__regex_store_submatches:
+ \tex_skip:D \l__regex_max_active_int = #1 sp \scan_stop:
+ \int_incr:N \l__regex_max_active_int
}
-\cs_new_protected_nopar:Npn \regex_store_submatches:
+\cs_new_protected_nopar:Npn \__regex_store_submatches:
{
- \tex_toks:D \l_regex_max_active_int \exp_after:wN
- { \l_regex_current_submatches_prop }
+ \tex_toks:D \l__regex_max_active_int \exp_after:wN
+ { \l__regex_current_submatches_prop }
}
-\cs_new_protected_nopar:Npn \regex_disable_submatches:
+\cs_new_protected_nopar:Npn \__regex_disable_submatches:
{
- \cs_set_protected_nopar:Npn \regex_store_submatches: { }
- \cs_set_protected:Npn \regex_action_submatch:n ##1 { }
+ \cs_set_protected_nopar:Npn \__regex_store_submatches: { }
+ \cs_set_protected:Npn \__regex_action_submatch:n ##1 { }
}
-\cs_new_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 }
+ \prop_put:Nno \l__regex_current_submatches_prop {#1}
+ { \int_use:N \l__regex_current_pos_int }
}
-\cs_new_protected_nopar:Npn \regex_action_success:
+\cs_new_protected_nopar:Npn \__regex_action_success:
{
- \regex_if_two_empty_matches:F
+ \__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_map_break:
+ \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_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
+\int_new:N \l__regex_replacement_csnames_int
+\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
+ \__regex_query_range:nn
{ \etex_glueshrink:D \tex_skip:D #1 }
{ \tex_skip:D #1 }
}
-\cs_new:Npn \regex_replacement_exp_not:N #1 { \exp_not:n {#1} }
-\cs_new:Npn \regex_query_range:nn #1#2
+\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_use:N \int_eval:w #1 \exp_after:wN ;
- \int_use:N \int_eval:w #2 ;
- \prg_break_point:n { }
+ \exp_after:wN \__regex_query_range_loop:ww
+ \int_use:N \__int_eval:w #1 \exp_after:wN ;
+ \int_use:N \__int_eval:w #2 ;
+ \__prg_break_point:
}
-\cs_new:Npn \regex_query_range_loop:ww #1 ; #2 ;
+\cs_new:Npn \__regex_query_range_loop:ww #1 ; #2 ;
{
- \if_num:w #1 < #2 \exp_stop_f:
+ \if_int_compare:w #1 < #2 \exp_stop_f:
\else:
- \exp_after:wN \prg_map_break:
+ \exp_after:wN \__prg_break:
\fi:
\tex_the:D \tex_toks:D #1 \exp_stop_f:
- \exp_after:wN \regex_query_range_loop:ww
- \int_use:N \int_eval:w #1 + \c_one ; #2 ;
+ \exp_after:wN \__regex_query_range_loop:ww
+ \int_use:N \__int_eval:w #1 + \c_one ; #2 ;
}
-\cs_new:Npn \regex_query_submatch:n #1
+\cs_new:Npn \__regex_query_submatch:n #1
{
- \regex_query_range:nn
- { \tex_skip:D \int_eval:w #1 }
- { \etex_gluestretch:D \tex_skip:D \int_eval:w #1 }
+ \__regex_query_range:nn
+ { \tex_skip:D \__int_eval:w #1 }
+ { \etex_gluestretch:D \tex_skip:D \__int_eval:w #1 }
}
-\cs_new_protected:Npn \regex_submatch_balance:n #1
+\cs_new_protected:Npn \__regex_submatch_balance:n #1
{
\etex_glueshrink:D \etex_mutoglue:D \etex_muexpr:D
\tex_muskip:D \etex_gluestretch:D \tex_skip:D #1
- \tex_muskip:D \tex_skip:D #1
\scan_stop:
}
-\cs_new_protected:Npn \regex_replacement:n #1
+\cs_new_protected:Npn \__regex_replacement:n #1
{
- \tl_set_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
+ \__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_rbrace_str ##1
- \regex_replacement_rbrace:N \else: \tl_build_one:n \fi: ##1
+ \__regex_replacement_rbrace:N \else: \__tl_build_one:n \fi: ##1
}
- { \regex_replacement_escaped:N ##1 }
- { \tl_build_one:n ##1 }
+ { \__regex_replacement_escaped:N ##1 }
+ { \__tl_build_one:n ##1 }
{#1}
\prg_do_nothing: \prg_do_nothing:
- \if_int_compare:w \l_regex_replacement_csnames_int > \c_zero
- \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: }
+ \if_int_compare:w \l__regex_replacement_csnames_int > \c_zero
+ \__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:
- \cs_gset:Npx \regex_replacement_balance_one_match:n ##1
+ \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}
+ + \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
+ \__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_new_protected:Npn \__regex_replacement_aux:n #1
{
- \cs_set:Npn \regex_replacement_do_one_match:n ##1
+ \cs_set:Npn \__regex_replacement_do_one_match:n ##1
{
- \regex_query_range:nn
+ \__regex_query_range:nn
{ \etex_glueshrink:D \tex_skip:D ##1 }
{ \tex_skip:D ##1 }
#1
}
}
-\cs_new_protected:Npn \regex_replacement_escaped:N #1
+\cs_new_protected:Npn \__regex_replacement_escaped:N #1
{
- \cs_if_exist_use:cF { regex_replacement_#1:w }
+ \cs_if_exist_use:cF { __regex_replacement_#1:w }
{
- \if_num:w \c_one < 1#1 \exp_stop_f:
- \regex_replacement_put_submatch:n {#1}
+ \if_int_compare:w \c_one < 1#1 \exp_stop_f:
+ \__regex_replacement_put_submatch:n {#1}
\else:
- \tl_build_one:n #1
+ \__tl_build_one:n #1
\fi:
}
}
-\cs_new_protected:Npn \regex_replacement_put_submatch:n #1
+\cs_new_protected:Npn \__regex_replacement_put_submatch:n #1
{
- \if_num:w #1 < \l_regex_capturing_group_int
- \tl_build_one:n { \regex_query_submatch:n { #1 + ##1 } }
- \if_num:w \l_regex_replacement_csnames_int = \c_zero
- \tl_put_right:Nn \l_regex_balance_tl
- { + \regex_submatch_balance:n { \int_eval:w #1+##1 \int_eval_end: } }
+ \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 = \c_zero
+ \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
+\cs_new_protected:Npn \__regex_replacement_g:w #1#2
{
- \str_if_eq:xxTF { #1#2 } { \tl_build_one:n \c_lbrace_str }
+ \str_if_eq_x:nnTF { #1#2 } { \__tl_build_one:n \c_lbrace_str }
{
- \int_zero:N \l_regex_internal_a_int
- \regex_replacement_g_digits:NN
+ \int_zero:N \l__regex_internal_a_int
+ \__regex_replacement_g_digits:NN
}
- { \regex_replacement_error:NNN g #1 #2 }
+ { \__regex_replacement_error:NNN g #1 #2 }
}
-\cs_new_protected:Npn \regex_replacement_g_digits:NN #1#2
+\cs_new_protected:Npn \__regex_replacement_g_digits:NN #1#2
{
- \token_if_eq_meaning:NNTF #1 \tl_build_one:n
+ \token_if_eq_meaning:NNTF #1 \__tl_build_one:n
{
- \if_num:w \c_one < 1#2 \exp_stop_f:
- \int_set:Nn \l_regex_internal_a_int
- { \c_ten * \l_regex_internal_a_int + #2 }
+ \if_int_compare:w \c_one < 1#2 \exp_stop_f:
+ \int_set:Nn \l__regex_internal_a_int
+ { \c_ten * \l__regex_internal_a_int + #2 }
\exp_after:wN \use_i:nnn
- \exp_after:wN \regex_replacement_g_digits:NN
+ \exp_after:wN \__regex_replacement_g_digits:NN
\else:
- \exp_after:wN \regex_replacement_error:NNN
+ \exp_after:wN \__regex_replacement_error:NNN
\exp_after:wN g
\fi:
}
{
- \if_meaning:w \regex_replacement_rbrace:N #1
- \exp_args:No \regex_replacement_put_submatch:n
- { \int_use:N \l_regex_internal_a_int }
+ \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 \__regex_replacement_error:NNN
\exp_after:wN g
\fi:
}
#1 #2
}
-\cs_new_protected:Npn \regex_replacement_c:w #1#2
+\cs_new_protected:Npn \__regex_replacement_c:w #1#2
{
- \token_if_eq_meaning:NNTF #1 \tl_build_one:n
+ \token_if_eq_meaning:NNTF #1 \__tl_build_one:n
{
- \cs_if_exist_use:cF { regex_replacement_c_#2:w }
- { \regex_replacement_error:NNN c #1#2 }
+ \cs_if_exist_use:cF { __regex_replacement_c_#2:w }
+ { \__regex_replacement_error:NNN c #1#2 }
}
- { \regex_replacement_error:NNN c #1#2 }
+ { \__regex_replacement_error:NNN c #1#2 }
}
-\cs_new_protected_nopar:cpn { regex_replacement_c_ \c_lbrace_str :w }
+\cs_new_protected_nopar:cpn { __regex_replacement_c_ \c_lbrace_str :w }
{
- \if_case:w \l_regex_replacement_csnames_int
- \tl_build_one:n
- { \exp_not:n { \exp_after:wN \regex_replacement_exp_not:N \cs:w } }
+ \if_case:w \l__regex_replacement_csnames_int
+ \__tl_build_one:n
+ { \exp_not:n { \exp_after:wN \__regex_replacement_exp_not:N \cs:w } }
\else:
- \tl_build_one:n { \exp_not:n { \exp_after:wN \tl_to_str:N \cs:w } }
+ \__tl_build_one:n { \exp_not:n { \exp_after:wN \tl_to_str:N \cs:w } }
\fi:
- \int_incr:N \l_regex_replacement_csnames_int
+ \int_incr:N \l__regex_replacement_csnames_int
}
-\cs_new_protected:Npn \regex_replacement_u:w #1#2
+\cs_new_protected:Npn \__regex_replacement_u:w #1#2
{
- \str_if_eq:xxTF { #1#2 } { \tl_build_one:n \c_lbrace_str }
+ \str_if_eq_x:nnTF { #1#2 } { \__tl_build_one:n \c_lbrace_str }
{
- \if_case:w \l_regex_replacement_csnames_int
- \tl_build_one:n { \exp_not:n { \exp_after:wN \exp_not:V \cs:w } }
+ \if_case:w \l__regex_replacement_csnames_int
+ \__tl_build_one:n { \exp_not:n { \exp_after:wN \exp_not:V \cs:w } }
\else:
- \tl_build_one:n { \exp_not:n { \exp_after:wN \tl_to_str:V \cs:w } }
+ \__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
+ \int_incr:N \l__regex_replacement_csnames_int
}
- { \regex_replacement_error:NNN u #1#2 }
+ { \__regex_replacement_error:NNN u #1#2 }
}
-\cs_new_protected:Npn \regex_replacement_rbrace:N #1
+\cs_new_protected:Npn \__regex_replacement_rbrace:N #1
{
- \if_int_compare:w \l_regex_replacement_csnames_int > \c_zero
- \tl_build_one:n \cs_end:
- \int_decr:N \l_regex_replacement_csnames_int
+ \if_int_compare:w \l__regex_replacement_csnames_int > \c_zero
+ \__tl_build_one:n \cs_end:
+ \int_decr:N \l__regex_replacement_csnames_int
\else:
- \tl_build_one:n #1
+ \__tl_build_one:n #1
\fi:
}
\group_begin:
- \cs_new_protected:Npn \regex_replacement_char:nNN #1#2#3
+ \cs_new_protected:Npn \__regex_replacement_char:nNN #1#2#3
{
\if_meaning:w \prg_do_nothing: #3
- \msg_kernel_error:nn { regex } { replacement-catcode-end }
+ \__msg_kernel_error:nn { regex } { replacement-catcode-end }
\else:
\tex_lccode:D \c_zero = `#3 \scan_stop:
- \tl_to_lowercase:n { \tl_build_one:n {#1} }
+ \tl_to_lowercase:n { \__tl_build_one:n {#1} }
\fi:
}
\char_set_catcode_active:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_A:w
- { \regex_replacement_char:nNN { \exp_not:n { \exp_not:N ^^@ } } }
+ \cs_new_protected_nopar: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_nopar:Npn \regex_replacement_c_B:w
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_B:w
{
- \if_num:w \l_regex_replacement_csnames_int = \c_zero
- \int_incr:N \l_regex_balance_int
+ \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero
+ \int_incr:N \l__regex_balance_int
\fi:
- \regex_replacement_char:nNN
+ \__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} } }
+ \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_nopar:Npn \regex_replacement_c_D:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_D:w
+ { \__regex_replacement_char:nNN { ^^@ } }
\char_set_catcode_group_end:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_E:w
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_E:w
{
- \if_num:w \l_regex_replacement_csnames_int = \c_zero
- \int_decr:N \l_regex_balance_int
+ \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero
+ \int_decr:N \l__regex_balance_int
\fi:
- \regex_replacement_char:nNN
+ \__regex_replacement_char:nNN
{ \exp_not:n { \if_false: { \fi: ^^@ } }
}
\char_set_catcode_letter:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_L:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_L:w
+ { \__regex_replacement_char:nNN { ^^@ } }
\char_set_catcode_math_toggle:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_M:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_M:w
+ { \__regex_replacement_char:nNN { ^^@ } }
\char_set_catcode_other:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_O:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_O:w
+ { \__regex_replacement_char:nNN { ^^@ } }
\char_set_catcode_parameter:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_P:w
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_P:w
{
- \regex_replacement_char:nNN
+ \__regex_replacement_char:nNN
{ \exp_not:n { \exp_not:n { ^^@^^@^^@^^@ } } }
}
- \cs_new_protected:Npn \regex_replacement_c_S:w #1#2
+ \cs_new_protected:Npn \__regex_replacement_c_S:w #1#2
{
\if_meaning:w \prg_do_nothing: #2
- \msg_kernel_error:nn { regex } { replacement-catcode-end }
+ \__msg_kernel_error:nn { regex } { replacement-catcode-end }
\else:
- \if_num:w `#2 = \c_zero
- \msg_kernel_error:nn { regex } { replacement-null-space }
+ \if_int_compare:w `#2 = \c_zero
+ \__msg_kernel_error:nn { regex } { replacement-null-space }
\fi:
\tex_lccode:D 32 = `#2 \scan_stop:
- \tl_to_lowercase:n { \tl_build_one:n {~} }
+ \tl_to_lowercase:n { \__tl_build_one:n {~} }
\fi:
}
\char_set_catcode_alignment:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_T:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_T:w
+ { \__regex_replacement_char:nNN { ^^@ } }
\char_set_catcode_math_superscript:N \^^@
- \cs_new_protected_nopar:Npn \regex_replacement_c_U:w
- { \regex_replacement_char:nNN { ^^@ } }
+ \cs_new_protected_nopar:Npn \__regex_replacement_c_U:w
+ { \__regex_replacement_char:nNN { ^^@ } }
\group_end:
-\cs_new_protected:Npn \regex_replacement_error:NNN #1#2#3
+\cs_new_protected:Npn \__regex_replacement_error:NNN #1#2#3
{
- \msg_kernel_error:nnx { regex } { replacement-#1 } {#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_eq:NN #1 \c__regex_no_match_regex }
\cs_new_protected_nopar:Npn \regex_set:Nn #1#2
{
- \regex_compile:n {#2}
- \tl_set_eq:NN #1 \l_regex_internal_regex
+ \__regex_compile:n {#2}
+ \tl_set_eq:NN #1 \l__regex_internal_regex
}
\cs_new_protected_nopar:Npn \regex_gset:Nn #1#2
{
- \regex_compile:n {#2}
- \tl_gset_eq:NN #1 \l_regex_internal_regex
+ \__regex_compile:n {#2}
+ \tl_gset_eq:NN #1 \l__regex_internal_regex
}
\cs_new_protected_nopar:Npn \regex_const:Nn #1#2
{
- \regex_compile:n {#2}
- \tl_const:Nx #1 { \exp_not:o \l_regex_internal_regex }
+ \__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_aux:Nx \l_regex_internal_regex
+ \__regex_compile:n {#1}
+ \__regex_show:Nx \l__regex_internal_regex
{ { \tl_to_str:n {#1} } }
}
\cs_new_protected:Npn \regex_show:N #1
- { \regex_show_aux:Nx #1 { variable~\token_to_str:N #1 } }
+ { \__regex_show:Nx #1 { variable~\token_to_str:N #1 } }
\prg_new_protected_conditional:Npnn \regex_match:nn #1#2 { T , F , TF }
{
- \regex_match_aux:nn { \regex_build:n {#1} } {#2}
- \regex_aux_return:
+ \__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_match_aux:nn { \regex_build:N #1 } {#2}
- \regex_aux_return:
+ \__regex_if_match:nn { \__regex_build:N #1 } {#2}
+ \__regex_return:
}
\cs_new_protected:Npn \regex_count:nnN #1
- { \regex_count_aux:nnN { \regex_build:n {#1} } }
+ { \__regex_count:nnN { \__regex_build:n {#1} } }
\cs_new_protected:Npn \regex_count:NnN #1
- { \regex_count_aux:nnN { \regex_build:N #1 } }
-\cs_set_protected:Npn \regex_tmp:w #1#2#3
+ { \__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 } }
+ \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_aux_return: }
+ { #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_aux_return: }
+ { #1 { \__regex_build:N ##1 } {##2} ##3 \__regex_return: }
}
-\regex_tmp:w \regex_extract_once_aux:nnN
+\__regex_tmp:w \__regex_extract_once:nnN
\regex_extract_once:nnN \regex_extract_once:NnN
-\regex_tmp:w \regex_extract_all_aux:nnN
+\__regex_tmp:w \__regex_extract_all:nnN
\regex_extract_all:nnN \regex_extract_all:NnN
-\regex_tmp:w \regex_replace_once_aux:nnN
+\__regex_tmp:w \__regex_replace_once:nnN
\regex_replace_once:nnN \regex_replace_once:NnN
-\regex_tmp:w \regex_replace_all_aux:nnN
+\__regex_tmp:w \__regex_replace_all:nnN
\regex_replace_all:nnN \regex_replace_all:NnN
-\regex_tmp:w \regex_split_aux: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_submatch_int
-\int_new:N \l_regex_zeroth_submatch_int
-\cs_new_protected_nopar:Npn \regex_aux_return:
- {
- \if_meaning:w \c_true_bool \g_regex_success_bool
+\__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_submatch_int
+\int_new:N \l__regex_zeroth_submatch_int
+\cs_new_protected_nopar: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_match_aux:nn #1#2
+\cs_new_protected:Npn \__regex_if_match:nn #1#2
{
\group_begin:
- \regex_disable_submatches:
- \regex_single_match:
+ \__regex_disable_submatches:
+ \__regex_single_match:
#1
- \regex_match:n {#2}
+ \__regex_match:n {#2}
\group_end:
}
-\cs_new_protected:Npn \regex_count_aux:nnN #1#2#3
+\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 }
+ \__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}
+ \__regex_match:n {#2}
\exp_args:NNNo
\group_end:
- \int_set:Nn #3 { \int_use:N \l_regex_match_count_int }
+ \int_set:Nn #3 { \int_use:N \l__regex_match_count_int }
}
-\cs_new_protected:Npn \regex_extract_once_aux:nnN #1#2#3
+\cs_new_protected:Npn \__regex_extract_once:nnN #1#2#3
{
\group_begin:
- \regex_single_match:
+ \__regex_single_match:
#1
- \regex_match:n {#2}
- \regex_extract:
- \regex_group_end_extract_seq:N #3
+ \__regex_match:n {#2}
+ \__regex_extract:
+ \__regex_group_end_extract_seq:N #3
}
-\cs_new_protected:Npn \regex_extract_all_aux:nnN #1#2#3
+\cs_new_protected:Npn \__regex_extract_all:nnN #1#2#3
{
\group_begin:
- \regex_multi_match:n { \regex_extract: }
+ \__regex_multi_match:n { \__regex_extract: }
#1
- \regex_match:n {#2}
- \regex_group_end_extract_seq:N #3
+ \__regex_match:n {#2}
+ \__regex_group_end_extract_seq:N #3
}
-\cs_new_protected:Npn \regex_split_aux:nnN #1#2#3
+\cs_new_protected:Npn \__regex_split:nnN #1#2#3
{
\group_begin:
- \regex_multi_match:n
+ \__regex_multi_match:n
{
- \if_num:w \l_regex_start_pos_int < \l_regex_success_pos_int
- \regex_extract:
- \tex_skip:D \l_regex_zeroth_submatch_int
- = \l_regex_start_pos_int sp
- plus \tex_skip:D \l_regex_zeroth_submatch_int \scan_stop:
+ \if_int_compare:w \l__regex_start_pos_int < \l__regex_success_pos_int
+ \__regex_extract:
+ \tex_skip:D \l__regex_zeroth_submatch_int
+ = \l__regex_start_pos_int sp
+ plus \tex_skip:D \l__regex_zeroth_submatch_int \scan_stop:
\fi:
}
#1
- \regex_match:n {#2}
- \tex_skip:D \l_regex_submatch_int
- = \l_regex_start_pos_int sp plus \l_regex_max_pos_int sp \scan_stop:
- \int_incr:N \l_regex_submatch_int
- \if_meaning:w \c_true_bool \l_regex_empty_success_bool
- \if_num:w \l_regex_start_pos_int = \l_regex_max_pos_int
- \int_decr:N \l_regex_submatch_int
+ \__regex_match:n {#2}
+ \tex_skip:D \l__regex_submatch_int
+ = \l__regex_start_pos_int sp plus \l__regex_max_pos_int sp \scan_stop:
+ \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
+ \__regex_group_end_extract_seq:N #3
}
-\cs_new_protected:Npn \regex_group_end_extract_seq:N #1
+\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
+ \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
{
- \prg_stepwise_function:nnnN
- { \c_two * \l_regex_max_state_int }
+ \int_step_function:nnnN
+ { \c_two * \l__regex_max_state_int }
\c_one
- { \l_regex_submatch_int - \c_one }
- \regex_extract_seq_aux:n
+ { \l__regex_submatch_int - \c_one }
+ \__regex_extract_seq_aux:n
}
\int_compare:nNnF
- { \flag_height:n { regex_begin } + \flag_height:n { regex_end } }
+ { \flag_height:n { __regex_begin } + \flag_height:n { __regex_end } }
= \c_zero
{
- \msg_kernel_error:nnxxx { regex } { result-unbalanced }
+ \__msg_kernel_error:nnxxx { regex } { result-unbalanced }
{ splitting~or~extracting~submatches }
- { \flag_height:n { regex_end } }
- { \flag_height:n { regex_begin } }
+ { \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 }
+ \tl_set:Nn \exp_not:N #1 { \l__regex_internal_a_tl }
}
}
-\cs_new:Npn \regex_extract_seq_aux:n #1
+\cs_new:Npn \__regex_extract_seq_aux:n #1
{
- \seq_item:n
+ \__seq_item:n
{
- \exp_after:wN \regex_extract_seq_aux:ww
- \int_value:w \regex_submatch_balance:n {#1} ; #1;
+ \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;
+\cs_new:Npn \__regex_extract_seq_aux:ww #1; #2;
{
- \if_num:w #1 < \c_zero
- \flag_raise:n { regex_end }
+ \if_int_compare:w #1 < \c_zero
+ \flag_raise:n { __regex_end }
\prg_replicate:nn {-#1} { \exp_not:n { { \if_false: } \fi: } }
\fi:
- \regex_query_submatch:n {#2}
- \if_num:w #1 > \c_zero
- \flag_raise:n { regex_begin }
+ \__regex_query_submatch:n {#2}
+ \if_int_compare:w #1 > \c_zero
+ \flag_raise:n { __regex_begin }
\prg_replicate:nn {#1} { \exp_not:n { \if_false: { \fi: } } }
\fi:
}
-\cs_new_protected_nopar:Npn \regex_extract:
+\cs_new_protected_nopar: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
+ \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
{
- \tex_skip:D \l_regex_submatch_int \c_zero sp \scan_stop:
- \int_incr:N \l_regex_submatch_int
+ \tex_skip:D \l__regex_submatch_int \c_zero sp \scan_stop:
+ \int_incr:N \l__regex_submatch_int
}
- \prop_map_inline:Nn \l_regex_success_submatches_prop
+ \prop_map_inline:Nn \l__regex_success_submatches_prop
{
- \if_num:w ##1 \c_minus_one
- \exp_after:wN \regex_extract_aux_e:wn \int_value:w
+ \if_int_compare:w ##1 \c_minus_one
+ \exp_after:wN \__regex_extract_e:wn \__int_value:w
\else:
- \exp_after:wN \regex_extract_aux_b:wn \int_value:w
+ \exp_after:wN \__regex_extract_b:wn \__int_value:w
\fi:
- \int_eval:w \l_regex_zeroth_submatch_int + ##1 {##2}
+ \__int_eval:w \l__regex_zeroth_submatch_int + ##1 {##2}
}
- \tex_skip:D \l_regex_zeroth_submatch_int
- = \tex_the:D \tex_skip:D \l_regex_zeroth_submatch_int
- minus \l_regex_start_pos_int sp \scan_stop:
+ \tex_skip:D \l__regex_zeroth_submatch_int
+ = \tex_the:D \tex_skip:D \l__regex_zeroth_submatch_int
+ minus \l__regex_start_pos_int sp \scan_stop:
\fi:
}
-\cs_new_protected:Npn \regex_extract_aux_b:wn #1 < #2
+\cs_new_protected:Npn \__regex_extract_b:wn #1 < #2
{
\tex_skip:D #1 = #2 sp
plus \etex_gluestretch:D \tex_skip:D #1 \scan_stop:
}
-\cs_new_protected:Npn \regex_extract_aux_e:wn #1 > #2
+\cs_new_protected:Npn \__regex_extract_e:wn #1 > #2
{
\tex_skip:D #1
= 1 \tex_skip:D #1 plus #2 sp \scan_stop:
}
-\cs_new_protected:Npn \regex_replace_once_aux:nnN #1#2#3
+\cs_new_protected:Npn \__regex_replace_once:nnN #1#2#3
{
\group_begin:
- \regex_single_match:
+ \__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
+ \__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_extract:
+ \int_set:Nn \l__regex_balance_int
{
- \regex_replacement_balance_one_match:n
- { \l_regex_zeroth_submatch_int }
+ \__regex_replacement_balance_one_match:n
+ { \l__regex_zeroth_submatch_int }
}
- \tl_set:Nx \l_regex_internal_a_tl
+ \tl_set:Nx \l__regex_internal_a_tl
{
- \regex_replacement_do_one_match:n { \l_regex_zeroth_submatch_int }
- \regex_query_range:nn
- { \etex_gluestretch:D \tex_skip:D \l_regex_zeroth_submatch_int }
- { \l_regex_max_pos_int }
+ \__regex_replacement_do_one_match:n { \l__regex_zeroth_submatch_int }
+ \__regex_query_range:nn
+ { \etex_gluestretch:D \tex_skip:D \l__regex_zeroth_submatch_int }
+ { \l__regex_max_pos_int }
}
- \regex_group_end_replace:N #3
+ \__regex_group_end_replace:N #3
\fi:
}
-\cs_new_protected:Npn \regex_replace_all_aux:nnN #1#2#3
+\cs_new_protected:Npn \__regex_replace_all:nnN #1#2#3
{
\group_begin:
- \regex_multi_match:n { \regex_extract: }
+ \__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
+ \__regex_replacement:n {#2}
+ \exp_args:No \__regex_match:n {#3}
+ \int_set:Nn \l__regex_balance_int
{
0
- \prg_stepwise_function:nnnN
- { \c_two * \l_regex_max_state_int }
- \l_regex_capturing_group_int
- { \l_regex_submatch_int - \c_one }
- \regex_replacement_balance_one_match:n
+ \int_step_function:nnnN
+ { \c_two * \l__regex_max_state_int }
+ \l__regex_capturing_group_int
+ { \l__regex_submatch_int - \c_one }
+ \__regex_replacement_balance_one_match:n
}
- \tl_set:Nx \l_regex_internal_a_tl
+ \tl_set:Nx \l__regex_internal_a_tl
{
- \prg_stepwise_function:nnnN
- { \c_two * \l_regex_max_state_int }
- \l_regex_capturing_group_int
- { \l_regex_submatch_int - \c_one }
- \regex_replacement_do_one_match:n
- \regex_query_range:nn
- \l_regex_start_pos_int \l_regex_max_pos_int
+ \int_step_function:nnnN
+ { \c_two * \l__regex_max_state_int }
+ \l__regex_capturing_group_int
+ { \l__regex_submatch_int - \c_one }
+ \__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
+ \__regex_group_end_replace:N #3
}
-\cs_new_protected_nopar:Npn \regex_group_end_replace:N #1
+\cs_new_protected_nopar:Npn \__regex_group_end_replace:N #1
{
- \if_num:w \l_regex_balance_int = \c_zero
+ \if_int_compare:w \l__regex_balance_int = \c_zero
\else:
- \msg_kernel_error:nnxxx { regex } { result-unbalanced }
+ \__msg_kernel_error:nnxxx { regex } { result-unbalanced }
{ replacing }
- { \int_max:nn { - \l_regex_balance_int } { \c_zero } }
- { \int_max:nn { \l_regex_balance_int } { \c_zero } }
+ { \int_max:nn { - \l__regex_balance_int } { \c_zero } }
+ { \int_max:nn { \l__regex_balance_int } { \c_zero } }
\fi:
\use:x
{
\group_end:
\tl_set:Nn \exp_not:N #1
{
- \if_int_compare:w \l_regex_balance_int < \c_zero
- \prg_replicate:nn { - \l_regex_balance_int }
+ \if_int_compare:w \l__regex_balance_int < \c_zero
+ \prg_replicate:nn { - \l__regex_balance_int }
{ { \if_false: } \fi: }
\fi:
- \l_regex_internal_a_tl
- \if_int_compare:w \l_regex_balance_int > \c_zero
- \prg_replicate:nn { \l_regex_balance_int }
+ \l__regex_internal_a_tl
+ \if_int_compare:w \l__regex_balance_int > \c_zero
+ \prg_replicate:nn { \l__regex_balance_int }
{ \if_false: { \fi: } }
\fi:
}
}
}
-\msg_kernel_new:nnnn { regex } { trailing-backslash }
+\__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 }
+\__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\{\int_to_hexadecimal:n{#1}'.~
The~closing~brace~is~missing.
}
-\msg_kernel_new:nnnn { regex } { x-overflow }
+\__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_hexadecimal:n{#1}\}'.~
The~character~code~'#1'~is~larger~than~\int_use:N \c_max_char_int.
}
-\msg_kernel_new:nnnn { regex } { invalid-quantifier }
+\__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>}',~followed~or~not~by~'?'.
}
-\msg_kernel_new:nnnn { regex } { missing-rbrack }
+\__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 }
+\__msg_kernel_new:nnnn { regex } { missing-rparen }
{
Missing~right~parenthes\int_compare:nTF{#1=1}{i}{e}s~
inserted~in~regular~expression.
@@ -2597,44 +2605,44 @@
more~left~parenthes\int_compare:nTF{#1=1}{i}{e}s~than~right~
parenthes\int_compare:nTF{#1=1}{i}{e}s.
}
-\msg_kernel_new:nnnn { regex } { extra-rparen }
+\__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 }
+\__msg_kernel_new:nnnn { regex } { bad-escape }
{
Invalid~escape~\c_backslash_str #1~
- \regex_if_in_cs:TF { within~a~control~sequence. }
+ \__regex_if_in_cs:TF { within~a~control~sequence. }
{
- \regex_if_in_class:TF
+ \__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
+ \__regex_if_in_cs:TF
{
within~a~control~sequence~test~introduced~by~
\iow_char:N\\c\iow_char:N\{.
}
{
- \regex_if_in_class:TF
+ \__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 }
+\__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 }
+\__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,~
@@ -2642,27 +2650,27 @@
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 }
+\__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 }
+\__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 }
+\__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 }
+\__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~
@@ -2670,29 +2678,29 @@
capital~letter~representing~a~character~category,~namely~
one~of~ABCDELMOPSTU.
}
-\msg_kernel_new:nnnn { regex } { u-missing-lbrace }
+\__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 }
+\__msg_kernel_new:nnnn { regex } { u-missing-rbrace }
{ Missing~right~brace~inserted~for~\iow_char:N\\u~escape. }
{
LaTeX~
- \tl_if_empty:xTF {#2}
+ \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 }
+\__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 }
+\__msg_kernel_new:nnnn { regex } { posix-unknown }
{ POSIX~class~[:#1:]~unknown. }
{
[:#1:]~is~not~among~the~known~POSIX~classes~
@@ -2701,10 +2709,10 @@
[:print:],~[:punct:],~[:space:],~[:upper:],~
[:word:],~and~[:xdigit:].
}
-\msg_kernel_new:nnnn { regex } { posix-missing-close }
+\__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 }
+\__msg_kernel_new:nnnn { regex } { result-unbalanced }
{ Missing~brace~inserted~when~#1. }
{
LaTeX~was~asked~to~do~some~regular~expression~operation,~
@@ -2712,34 +2720,34 @@
of~begin-group~and~end-group~tokens.~Braces~were~inserted:~
#2~left,~#3~right.
}
-\msg_kernel_new:nnnn { regex } { unknown-option }
+\__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 } { replacement-c }
+\__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 }
+\__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 }
+\__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 }
+\__msg_kernel_new:nnnn { regex } { replacement-catcode-end }
{
Missing~character~for~the~\iow_char:N\\c<category><character>~
construction~in~a~replacement~text.
@@ -2750,7 +2758,7 @@
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-null-space }
+\__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',~
@@ -2759,18 +2767,18 @@
This~specific~case~is~impossible~and~will~be~replaced~
by~a~normal~space.
}
-\msg_kernel_new:nnnn { regex } { replacement-missing-rbrace }
+\__msg_kernel_new:nnnn { regex } { replacement-missing-rbrace }
{ Missing~right~brace~inserted~in~replacement~text. }
{
- There~were~\int_use:N \l_regex_replacement_csnames_int \
+ There~were~\int_use:N \l__regex_replacement_csnames_int \
missing~right~braces.
}
-\cs_new:Npn \regex_msg_repeated:nnN #1#2#3
+\cs_new:Npn \__regex_msg_repeated:nnN #1#2#3
{
- \str_if_eq:xxF { #1 #2 } { 1 0 }
+ \str_if_eq_x:nnF { #1 #2 } { 1 0 }
{
, ~ repeated ~
- \prg_case_int:nnn {#2}
+ \int_case:nnn {#2}
{
{ -1 } { #1~or~more~times,~\bool_if:NTF #3 { lazy } { greedy } }
{ 0 } { #1~times }
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str.sty
index 88042a5337d..3ad97283e3b 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str.sty
@@ -46,8 +46,8 @@
%%
%% -----------------------------------------------------------------------
\RequirePackage{expl3}
-\GetIdInfo$Id: l3str.dtx 3460 2012-02-26 12:16:41Z will $
- {L3 Experimental Strings}
+\GetIdInfo$Id: l3str.dtx 3940 2012-07-09 00:41:44Z bruno $
+ {L3 Experimental strings}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\RequirePackage{l3tl-analysis,l3tl-build,l3flag}
@@ -70,10 +70,10 @@
{ \exp_not:c { tl_ #1 :Nx } ##1 { \exp_not:N \tl_to_str:n {##2} } }
\exp_args:Nc \cs_generate_variant:Nn { str_ #1 :Nn } { Nx , cn , cx }
}
-\cs_new_protected_nopar:Npn \str_tmp:w { }
-\tl_new:N \l_str_internal_tl
-\int_new:N \l_str_internal_int
-\tl_new:N \g_str_result_tl
+\cs_new_protected_nopar:Npn \__str_tmp:w { }
+\tl_new:N \l__str_internal_tl
+\int_new:N \l__str_internal_int
+\tl_new:N \g__str_result_tl
\int_const:Nn \c_forty_eight { 48 }
\int_const:Nn \c_fifty_eight { 58 }
\int_const:Nn \c_sixty_five { 65 }
@@ -83,30 +83,30 @@
\int_const:Nn \c_one_hundred_twenty_seven { 127 }
\int_const:Nn \c_max_char_int
{ \pdftex_if_engine:TF { "FF } { "10FFFF } }
-\int_const:Nn \c_str_replacement_char_int { "FFFD }
+\int_const:Nn \c__str_replacement_char_int { "FFFD }
\tl_const:Nx \c_backslash_str { \cs_to_str:N \\ }
\tl_const:Nx \c_lbrace_str { \cs_to_str:N \{ }
\tl_const:Nx \c_rbrace_str { \cs_to_str:N \} }
\tl_const:Nx \c_hash_str { \cs_to_str:N \# }
\tl_const:Nx \c_tilde_str { \cs_to_str:N \~ }
\tl_const:Nx \c_percent_str { \cs_to_str:N \% }
-\prop_new:N \g_str_file_prop
-\prop_gput:Nnn \g_str_file_prop { latin1 } { iso88591 }
-\prop_gput:Nnn \g_str_file_prop { latin2 } { iso88592 }
-\prop_gput:Nnn \g_str_file_prop { latin3 } { iso88593 }
-\prop_gput:Nnn \g_str_file_prop { latin4 } { iso88594 }
-\prop_gput:Nnn \g_str_file_prop { latin5 } { iso88599 }
-\prop_gput:Nnn \g_str_file_prop { latin6 } { iso885910 }
-\prop_gput:Nnn \g_str_file_prop { latin7 } { iso885913 }
-\prop_gput:Nnn \g_str_file_prop { latin8 } { iso885914 }
-\prop_gput:Nnn \g_str_file_prop { latin9 } { iso885915 }
-\prop_gput:Nnn \g_str_file_prop { latin10 } { iso885916 }
-\prop_gput:Nnn \g_str_file_prop { utf16le } { utf16 }
-\prop_gput:Nnn \g_str_file_prop { utf16be } { utf16 }
-\prop_gput:Nnn \g_str_file_prop { utf32le } { utf32 }
-\prop_gput:Nnn \g_str_file_prop { utf32be } { utf32 }
-\prop_gput:Nnn \g_str_file_prop { hexadecimal } { hex }
-\bool_new:N \g_str_error_bool
+\prop_new:N \g__str_alias_prop
+\prop_gput:Nnn \g__str_alias_prop { latin1 } { iso88591 }
+\prop_gput:Nnn \g__str_alias_prop { latin2 } { iso88592 }
+\prop_gput:Nnn \g__str_alias_prop { latin3 } { iso88593 }
+\prop_gput:Nnn \g__str_alias_prop { latin4 } { iso88594 }
+\prop_gput:Nnn \g__str_alias_prop { latin5 } { iso88599 }
+\prop_gput:Nnn \g__str_alias_prop { latin6 } { iso885910 }
+\prop_gput:Nnn \g__str_alias_prop { latin7 } { iso885913 }
+\prop_gput:Nnn \g__str_alias_prop { latin8 } { iso885914 }
+\prop_gput:Nnn \g__str_alias_prop { latin9 } { iso885915 }
+\prop_gput:Nnn \g__str_alias_prop { latin10 } { iso885916 }
+\prop_gput:Nnn \g__str_alias_prop { utf16le } { utf16 }
+\prop_gput:Nnn \g__str_alias_prop { utf16be } { utf16 }
+\prop_gput:Nnn \g__str_alias_prop { utf32le } { utf32 }
+\prop_gput:Nnn \g__str_alias_prop { utf32be } { utf32 }
+\prop_gput:Nnn \g__str_alias_prop { hexadecimal } { hex }
+\bool_new:N \g__str_error_bool
\flag_new:n { str_byte }
\flag_new:n { str_error }
\group_begin:
@@ -115,21 +115,21 @@
\tl_to_lowercase:n
{
\group_end:
- \cs_new:Npn \tl_to_other_str:n #1
+ \cs_new:Npn \__str_to_other:n #1
{
- \exp_after:wN \tl_to_other_str_loop:w \tl_to_str:n {#1} ~ %
+ \exp_after:wN \__str_to_other_loop:w \tl_to_str:n {#1} ~ %
A ~ A ~ A ~ A ~ A ~ A ~ A ~ A ~ \q_mark \q_stop
}
- \cs_new:Npn \tl_to_other_str_loop:w
+ \cs_new:Npn \__str_to_other_loop:w
#1 ~ #2 ~ #3 ~ #4 ~ #5 ~ #6 ~ #7 ~ #8 ~ #9 \q_stop
{
\if_meaning:w A #8
- \tl_to_other_str_end:w
+ \__str_to_other_end:w
\fi:
- \tl_to_other_str_loop:w
+ \__str_to_other_loop:w
#9 #1 * #2 * #3 * #4 * #5 * #6 * #7 * #8 * \q_stop
}
- \cs_new:Npn \tl_to_other_str_end:w \fi: #1 \q_mark #2 * A #3 \q_stop
+ \cs_new:Npn \__str_to_other_end:w \fi: #1 \q_mark #2 * A #3 \q_stop
{ \fi: #2 }
}
\group_begin:
@@ -138,24 +138,24 @@
\tl_to_lowercase:n
{
\group_end:
- \cs_new_protected:Npn \str_gset_other:Nn #1#2
+ \cs_new_protected:Npn \__str_gset_other:Nn #1#2
{
\tl_gset:Nx #1
{
- \exp_after:wN \str_gset_other_loop:w \tl_to_str:n {#2} ~ %
+ \exp_after:wN \__str_gset_other_loop:w \tl_to_str:n {#2} ~ %
A ~ A ~ A ~ A ~ A ~ A ~ A ~ A ~ A ~ \q_stop
}
}
- \cs_new:Npn \str_gset_other_loop:w
+ \cs_new:Npn \__str_gset_other_loop:w
#1 ~ #2 ~ #3 ~ #4 ~ #5 ~ #6 ~ #7 ~ #8 ~ #9 ~
{
\if_meaning:w A #9
- \str_gset_other_end:w
+ \__str_gset_other_end:w
\fi:
#1 * #2 * #3 * #4 * #5 * #6 * #7 * #8 * #9
- \str_gset_other_loop:w *
+ \__str_gset_other_loop:w *
}
- \cs_new:Npn \str_gset_other_end:w \fi: #1 * A #2 \q_stop
+ \cs_new:Npn \__str_gset_other_end:w \fi: #1 * A #2 \q_stop
{ \fi: #1 }
}
\cs_new:Npn \str_count_spaces:N
@@ -164,39 +164,39 @@
{
\int_eval:n
{
- \exp_after:wN \str_count_spaces_loop:wwwwwwwww
+ \exp_after:wN \__str_count_spaces_loop:wwwwwwwww
\tl_to_str:n {#1} ~
X 7 ~ X 6 ~ X 5 ~ X 4 ~ X 3 ~ X 2 ~ X 1 ~ X 0 ~ X -1 ~
\q_stop
}
}
-\cs_new:Npn \str_count_spaces_loop:wwwwwwwww #1~#2~#3~#4~#5~#6~#7~#8~#9~
+\cs_new:Npn \__str_count_spaces_loop:wwwwwwwww #1~#2~#3~#4~#5~#6~#7~#8~#9~
{
\if_meaning:w X #9
\exp_after:wN \use_none_delimit_by_q_stop:w
\fi:
- \c_nine + \str_count_spaces_loop:wwwwwwwww
+ \c_nine + \__str_count_spaces_loop:wwwwwwwww
}
-\cs_new_nopar:Npn \str_length:N { \exp_args:No \str_length:n }
-\cs_new:Npn \str_length:n #1
+\cs_new_nopar:Npn \str_count:N { \exp_args:No \str_count:n }
+\cs_new:Npn \str_count:n #1
{
- \str_length_aux:n
+ \__str_count:n
{
\str_count_spaces:n {#1}
- + \exp_after:wN \str_length_loop:NNNNNNNNN \tl_to_str:n {#1}
+ + \exp_after:wN \__str_count_loop:NNNNNNNNN \tl_to_str:n {#1}
}
}
-\cs_new:Npn \str_length_unsafe:n #1
+\cs_new:Npn \__str_count_unsafe:n #1
{
- \str_length_aux:n
- { \str_length_loop:NNNNNNNNN #1 }
+ \__str_count:n
+ { \__str_count_loop:NNNNNNNNN #1 }
}
-\cs_new:Npn \str_length_ignore_spaces:n #1
+\cs_new:Npn \str_count_ignore_spaces:n #1
{
- \str_length_aux:n
- { \exp_after:wN \str_length_loop:NNNNNNNNN \tl_to_str:n {#1} }
+ \__str_count:n
+ { \exp_after:wN \__str_count_loop:NNNNNNNNN \tl_to_str:n {#1} }
}
-\cs_new:Npn \str_length_aux:n #1
+\cs_new:Npn \__str_count:n #1
{
\int_eval:n
{
@@ -207,21 +207,21 @@
\q_stop
}
}
-\cs_set:Npn \str_length_loop:NNNNNNNNN #1#2#3#4#5#6#7#8#9
+\cs_set:Npn \__str_count_loop:NNNNNNNNN #1#2#3#4#5#6#7#8#9
{
\if_meaning:w X #9
\exp_after:wN \use_none_delimit_by_q_stop:w
\fi:
- \c_nine + \str_length_loop:NNNNNNNNN
+ \c_nine + \__str_count_loop:NNNNNNNNN
}
\cs_new_nopar:Npn \str_head:N { \exp_args:No \str_head:n }
\cs_set:Npn \str_head:n #1
{
- \exp_after:wN \str_head_aux:w
+ \exp_after:wN \__str_head:w
\tl_to_str:n {#1}
{ { } } ~ \q_stop
}
-\cs_set:Npn \str_head_aux:w #1 ~ %
+\cs_set:Npn \__str_head:w #1 ~ %
{ \use_i_delimit_by_q_stop:nw #1 { ~ } }
\cs_new:Npn \str_head_ignore_spaces:n #1
{
@@ -231,82 +231,85 @@
\cs_new_nopar:Npn \str_tail:N { \exp_args:No \str_tail:n }
\cs_set:Npn \str_tail:n #1
{
- \exp_after:wN \str_tail_aux:w
+ \exp_after:wN \__str_tail:w
\reverse_if:N \if_charcode:w
\scan_stop: \tl_to_str:n {#1} X X \q_stop
}
-\cs_set:Npn \str_tail_aux:w #1 X #2 \q_stop { \fi: #1 }
+\cs_set:Npn \__str_tail:w #1 X #2 \q_stop { \fi: #1 }
\cs_new:Npn \str_tail_ignore_spaces:n #1
{
- \exp_after:wN \str_tail_aux_ii:w
+ \exp_after:wN \__str_tail_ii:w
\tl_to_str:n {#1} X X \q_stop
}
-\cs_new:Npn \str_tail_aux_ii:w #1 #2 X #3 \q_stop { #2 }
-\cs_new:Npn \str_skip_c_zero:w #1;
+\cs_new:Npn \__str_tail_ii:w #1 #2 X #3 \q_stop { #2 }
+\cs_new:Npn \__str_skip_c_zero:w #1;
{
- \if_num:w \int_eval:w #1 > \c_eight
- \exp_after:wN \str_skip_aux:wNNNNNNNN
+ \if_int_compare:w \__int_eval:w #1 > \c_eight
+ \exp_after:wN \__str_skip_loop:wNNNNNNNN
\else:
- \exp_after:wN \str_skip_end:w
- \int_use:N \int_eval:w
+ \exp_after:wN \__str_skip_end:w
+ \int_use:N \__int_eval:w
\fi:
#1 ;
}
-\cs_new:Npn \str_skip_aux:wNNNNNNNN #1; #2#3#4#5#6#7#8#9
- { \exp_after:wN \str_skip_c_zero:w \int_use:N \int_eval:w #1 - \c_eight ; }
-\cs_new:Npn \str_skip_end:w #1 ;
+\cs_new:Npn \__str_skip_loop:wNNNNNNNN #1; #2#3#4#5#6#7#8#9
+ { \exp_after:wN \__str_skip_c_zero:w \int_use:N \__int_eval:w #1 - \c_eight ; }
+\cs_new:Npn \__str_skip_end:w #1 ;
{
- \exp_after:wN \str_skip_end_ii:NNNNNNNN
- \if_case:w \if_num:w #1 > \c_zero #1 \else: 0 \fi: \exp_stop_f:
+ \exp_after:wN \__str_skip_end_ii:NNNNNNNN
+ \if_case:w \if_int_compare:w #1 > \c_zero #1 \else: 0 \fi: \exp_stop_f:
\or: \or: \or: \or: \or: \or: \or: \or:
}
-\cs_new:Npn \str_skip_end_ii:NNNNNNNN #1#2#3#4#5#6#7#8 { \fi: \c_zero }
-\cs_new:Npn \str_collect_delimit_by_q_stop:w #1;
+\cs_new:Npn \__str_skip_end_ii:NNNNNNNN #1#2#3#4#5#6#7#8 { \fi: \c_zero }
+\cs_new:Npn \__str_collect_delimit_by_q_stop:w #1;
{
- \exp_after:wN \str_collect_aux:wn
- \int_use:N \int_eval:w #1 ;
+ \exp_after:wN \__str_collect_loop:wn
+ \int_use:N \__int_eval:w #1 ;
{ }
}
-\cs_new:Npn \str_collect_aux:wn #1 ;
+\cs_new:Npn \__str_collect_loop:wn #1 ;
{
- \if_num:w #1 > \c_seven
- \exp_after:wN \str_collect_aux:wnNNNNNNN
+ \if_int_compare:w #1 > \c_seven
+ \exp_after:wN \__str_collect_loop_ii:wnNNNNNNN
\else:
- \exp_after:wN \str_collect_end:wn
+ \exp_after:wN \__str_collect_end:wn
\fi:
#1 ;
}
-\cs_new:Npn \str_collect_aux:wnNNNNNNN #1; #2 #3#4#5#6#7#8#9
+\cs_new:Npn \__str_collect_loop_ii:wnNNNNNNN #1; #2 #3#4#5#6#7#8#9
{
- \exp_after:wN \str_collect_aux:wn
- \int_use:N \int_eval:w #1 - \c_seven ;
+ \exp_after:wN \__str_collect_loop:wn
+ \int_use:N \__int_eval:w #1 - \c_seven ;
{ #2 #3#4#5#6#7#8#9 }
}
-\cs_new:Npn \str_collect_end:wn #1 ;
+\cs_new:Npn \__str_collect_end:wn #1 ;
{
- \exp_after:wN \str_collect_end_ii:nnnnnnnnw
- \if_case:w \if_num:w #1 > \c_zero #1 \else: 0 \fi: \exp_stop_f:
+ \exp_after:wN \__str_collect_end_ii:nnnnnnnnw
+ \if_case:w \if_int_compare:w #1 > \c_zero #1 \else: 0 \fi: \exp_stop_f:
\or: \or: \or: \or: \or: \or: \fi:
}
-\cs_new:Npn \str_collect_end_ii:nnnnnnnnw #1#2#3#4#5#6#7#8 #9 \q_stop
+\cs_new:Npn \__str_collect_end_ii:nnnnnnnnw #1#2#3#4#5#6#7#8 #9 \q_stop
{ #1#2#3#4#5#6#7#8 }
\cs_new_nopar:Npn \str_item:Nn { \exp_args:No \str_item:nn }
-\cs_new:Npn \str_item:nn #1
+\cs_new:Npn \str_item:nn #1#2
{
- \exp_last_unbraced:Nf \token_to_str:N
- \exp_args:Nf \str_item_unsafe:nn { \tl_to_other_str:n {#1} }
+ \exp_args:Nf \tl_to_str:n
+ {
+ \exp_args:Nf \__str_item_unsafe:nn
+ { \__str_to_other:n {#1} } {#2}
+ }
}
\cs_new:Npn \str_item_ignore_spaces:nn #1
- { \exp_args:No \str_item_unsafe:nn { \tl_to_str:n {#1} } }
-\cs_new:Npn \str_item_unsafe:nn #1#2
+ { \exp_args:No \__str_item_unsafe:nn { \tl_to_str:n {#1} } }
+\cs_new:Npn \__str_item_unsafe:nn #1#2
{
- \exp_after:wN \str_item_aux:ww
- \int_use:N \int_eval:w #2 \exp_after:wN ;
- \int_value:w \str_length_unsafe:n {#1} ;
- #1
+ \exp_after:wN \__str_item:ww
+ \int_use:N \__int_eval:w #2 \exp_after:wN ;
+ \__int_value:w \__str_count_unsafe:n {#1} ;
+ { } #1
\q_stop
}
-\cs_new:Npn \str_item_aux:ww #1; #2;
+\cs_new:Npn \__str_item:ww #1; #2;
{
\int_compare:nNnTF {#1} < \c_zero
{
@@ -314,16 +317,16 @@
{ \use_none_delimit_by_q_stop:w }
{
\exp_after:wN \use_i_delimit_by_q_stop:nw
- \tex_romannumeral:D \str_skip_c_zero:w #1 + #2 ;
+ \tex_romannumeral:D \__str_skip_c_zero:w #1 + #2 + \c_one ;
}
}
{
- \int_compare:nNnTF {#1} < {#2}
+ \int_compare:nNnTF {#1} > {#2}
+ { \use_none_delimit_by_q_stop:w }
{
\exp_after:wN \use_i_delimit_by_q_stop:nw
- \tex_romannumeral:D \str_skip_c_zero:w #1 ;
+ \tex_romannumeral:D \__str_skip_c_zero:w #1 ;
}
- { \use_none_delimit_by_q_stop:w }
}
}
\cs_new_nopar:Npn \str_substr:Nnn { \exp_args:No \str_substr:nnn }
@@ -331,51 +334,51 @@
{
\exp_args:Nf \tl_to_str:n
{
- \exp_args:Nf \str_substr_unsafe:nnn
- { \tl_to_other_str:n {#1} } {#2} {#3}
+ \exp_args:Nf \__str_substr_unsafe:nnn
+ { \__str_to_other:n {#1} } {#2} {#3}
}
}
\cs_new:Npn \str_substr_ignore_spaces:nnn #1
- { \exp_args:No \str_substr_unsafe:nnn { \tl_to_str:n {#1} } }
-\cs_new:Npn \str_substr_unsafe:nnn #1#2#3
- {
- \exp_after:wN \str_substr_aux:www
- \int_value:w \str_length_unsafe:n {#1} \exp_after:wN ;
- \int_use:N \int_eval:w #2 + \c_zero \exp_after:wN ;
- \int_use:N \int_eval:w
- \exp_args:Nf \str_substr_aux:nN {#3} \c_max_int ;
- #1
+ { \exp_args:No \__str_substr_unsafe:nnn { \tl_to_str:n {#1} } }
+\cs_new:Npn \__str_substr_unsafe:nnn #1#2#3
+ {
+ \exp_after:wN \__str_substr_ii:www
+ \__int_value:w \__str_count_unsafe:n {#1} \exp_after:wN ;
+ \int_use:N \__int_eval:w #2 + \c_zero \exp_after:wN ;
+ \int_use:N \__int_eval:w
+ \exp_args:Nf \__str_substr_i:nN {#3} \c_max_int ;
+ { } #1
\q_stop
}
-\cs_new:Npn \str_substr_aux:nN #1 #2
+\cs_new:Npn \__str_substr_i:nN #1 #2
{ \tl_if_empty:nTF {#1} {#2} {#1} }
-\cs_new:Npn \str_substr_aux:www #1; #2; #3;
+\cs_new:Npn \__str_substr_ii:www #1; #2; #3;
{
- \exp_args:Nf \str_substr_aux:nnw
- { \str_substr_normalize_range:nn {#2} {#1} }
- { \str_substr_normalize_range:nn {#3} {#1} }
+ \exp_args:Nf \__str_substr_iii:nnw
+ { \__str_substr_normalize_range:nn {#2} {#1} }
+ { \__str_substr_normalize_range:nn {#3} {#1} }
}
-\cs_new:Npn \str_substr_aux:nnw #1#2
+\cs_new:Npn \__str_substr_iii:nnw #1#2
{
- \exp_after:wN \str_collect_delimit_by_q_stop:w
- \int_use:N \int_eval:w #2 - #1 \exp_after:wN ;
- \tex_romannumeral:D \str_skip_c_zero:w #1 ;
+ \exp_after:wN \__str_collect_delimit_by_q_stop:w
+ \int_use:N \__int_eval:w #2 + \c_one - #1 \exp_after:wN ;
+ \tex_romannumeral:D \__str_skip_c_zero:w #1 ;
}
-\cs_new:Npn \str_substr_normalize_range:nn #1#2
+\cs_new:Npn \__str_substr_normalize_range:nn #1#2
{
\int_eval:n
{
- \if_num:w #1 < \c_zero
- \if_num:w #1 < - #2 \exp_stop_f:
+ \if_int_compare:w #1 < \c_zero
+ \if_int_compare:w #1 < - #2 \exp_stop_f:
\c_zero
\else:
- #1 + #2
+ #1 + #2 + \c_one
\fi:
\else:
- \if_num:w #1 < #2 \exp_stop_f:
- #1
- \else:
+ \if_int_compare:w #1 > #2 \exp_stop_f:
#2
+ \else:
+ #1
\fi:
\fi:
}
@@ -385,45 +388,45 @@
\if_int_compare:w \pdftex_strcmp:D { \tl_to_str:N #1 } { \tl_to_str:N #2 }
= \c_zero \prg_return_true: \else: \prg_return_false: \fi:
}
-\prg_new_conditional:Npnn \str_if_contains_char:NN #1#2 { T , TF }
+\prg_new_conditional:Npnn \__str_if_contains_char:NN #1#2 { T , TF }
{
- \exp_after:wN \str_if_contains_char_aux:NN \exp_after:wN #2
- \tl_to_str:n \exp_after:wN {#1} { \prg_map_break:n { ? \fi: } }
- \prg_break_point:n { }
+ \exp_after:wN \__str_if_contains_char_aux:NN \exp_after:wN #2
+ \etex_detokenize:D \exp_after:wN {#1} { \__prg_break:n { ? \fi: } }
+ \__prg_break_point:
\prg_return_false:
}
-\prg_new_conditional:Npnn \str_if_contains_char:nN #1#2 { TF }
+\prg_new_conditional:Npnn \__str_if_contains_char:nN #1#2 { TF }
{
- \exp_after:wN \str_if_contains_char_aux:NN \exp_after:wN #2
- \tl_to_str:n {#1} { \prg_map_break:n { ? \fi: } }
- \prg_break_point:n { }
+ \exp_after:wN \__str_if_contains_char_aux:NN \exp_after:wN #2
+ \tl_to_str:n {#1} { \__prg_break:n { ? \fi: } }
+ \__prg_break_point:
\prg_return_false:
}
-\cs_new:Npn \str_if_contains_char_aux:NN #1#2
+\cs_new:Npn \__str_if_contains_char_aux:NN #1#2
{
\if_charcode:w #1 #2
- \exp_after:wN \str_if_contains_char_true:
+ \exp_after:wN \__str_if_contains_char_true:
\fi:
- \str_if_contains_char_aux:NN #1
+ \__str_if_contains_char_aux:NN #1
}
-\cs_new_nopar:Npn \str_if_contains_char_true:
- { \prg_map_break:n { \prg_return_true: \use_none:n } }
-\prg_new_conditional:Npnn \str_aux_octal_use:N #1 { TF }
+\cs_new_nopar:Npn \__str_if_contains_char_true:
+ { \__prg_break:n { \prg_return_true: \use_none:n } }
+\prg_new_conditional:Npnn \__str_octal_use:N #1 { TF }
{
- \if_num:w \c_one < '1 \token_to_str:N #1 \exp_stop_f:
+ \if_int_compare:w \c_one < '1 \token_to_str:N #1 \exp_stop_f:
#1 \prg_return_true:
\else:
\prg_return_false:
\fi:
}
-\prg_new_conditional:Npnn \str_aux_hexadecimal_use:N #1 { TF }
+\prg_new_conditional:Npnn \__str_hexadecimal_use:N #1 { TF }
{
- \if_num:w \c_two < "1 \token_to_str:N #1 \exp_stop_f:
+ \if_int_compare:w \c_two < "1 \token_to_str:N #1 \exp_stop_f:
#1 \prg_return_true:
\else:
- \if_case:w \int_eval:w
+ \if_case:w \__int_eval:w
\exp_after:wN ` \token_to_str:N #1 - `a
- \int_eval_end:
+ \__int_eval_end:
A
\or: B
\or: C
@@ -442,223 +445,223 @@
\cs_generate_variant:Nn \str_show:N { c }
\group_begin:
\char_set_catcode_other:n { \c_zero }
- \tl_set:Nx \l_str_internal_tl { \tl_to_str:n { 0123456789ABCDEF } }
- \exp_args:No \tl_map_inline:nn { \l_str_internal_tl " }
+ \tl_set:Nx \l__str_internal_tl { \tl_to_str:n { 0123456789ABCDEF } }
+ \exp_args:No \tl_map_inline:nn { \l__str_internal_tl " }
{ \char_set_lccode:nn {`#1} { \c_zero } }
- \tl_map_inline:Nn \l_str_internal_tl
+ \tl_map_inline:Nn \l__str_internal_tl
{
- \tl_map_inline:Nn \l_str_internal_tl
+ \tl_map_inline:Nn \l__str_internal_tl
{
\char_set_lccode:nn { \c_zero } {"#1##1}
\tl_to_lowercase:n
{
\tl_const:cx
- { c_str_byte_ \int_eval:n {"#1##1} _tl }
+ { c__str_byte_ \int_eval:n {"#1##1} _tl }
{ ^^@ #1 ##1 }
}
}
}
\group_end:
-\tl_const:cn { c_str_byte_-1_tl } { { } \use_none:n { } }
-\cs_new:Npn \str_output_byte:n #1
- { \str_output_byte:w #1 \str_output_end: }
-\cs_new_nopar:Npn \str_output_byte:w
+\tl_const:cn { c__str_byte_-1_tl } { { } \use_none:n { } }
+\cs_new:Npn \__str_output_byte:n #1
+ { \__str_output_byte:w #1 \__str_output_end: }
+\cs_new_nopar:Npn \__str_output_byte:w
{
\exp_after:wN \exp_after:wN
\exp_after:wN \use_i:nnn
- \cs:w c_str_byte_ \int_use:N \int_eval:w
+ \cs:w c__str_byte_ \int_use:N \__int_eval:w
}
-\cs_new:Npn \str_output_hexadecimal:n #1
- { \str_output_hexadecimal:w #1 \str_output_end: }
-\cs_new_nopar:Npn \str_output_hexadecimal:w
+\cs_new:Npn \__str_output_hexadecimal:n #1
+ { \__str_output_hexadecimal:w #1 \__str_output_end: }
+\cs_new_nopar:Npn \__str_output_hexadecimal:w
{
\exp_after:wN \exp_after:wN
\exp_after:wN \use_none:n
- \cs:w c_str_byte_ \int_use:N \int_eval:w
+ \cs:w c__str_byte_ \int_use:N \__int_eval:w
}
-\cs_new_nopar:Npn \str_output_end:
- { \int_eval_end: _tl \cs_end: }
-\cs_new:Npn \str_output_byte_pair_be:n #1
+\cs_new_nopar:Npn \__str_output_end:
+ { \__int_eval_end: _tl \cs_end: }
+\cs_new:Npn \__str_output_byte_pair_be:n #1
{
- \exp_args:Nf \str_output_byte_pair_aux:nnN
+ \exp_args:Nf \__str_output_byte_pair:nnN
{ \int_div_truncate:nn { #1 } { "100 } } {#1} \use:nn
}
-\cs_new:Npn \str_output_byte_pair_le:n #1
+\cs_new:Npn \__str_output_byte_pair_le:n #1
{
- \exp_args:Nf \str_output_byte_pair_aux:nnN
+ \exp_args:Nf \__str_output_byte_pair:nnN
{ \int_div_truncate:nn { #1 } { "100 } } {#1} \use_ii_i:nn
}
-\cs_new:Npn \str_output_byte_pair_aux:nnN #1#2#3
+\cs_new:Npn \__str_output_byte_pair:nnN #1#2#3
{
#3
- { \str_output_byte:n { #1 } }
- { \str_output_byte:n { #2 - #1 * "100 } }
+ { \__str_output_byte:n { #1 } }
+ { \__str_output_byte:n { #2 - #1 * "100 } }
}
-\cs_new_protected:Npn \str_convert_gmap:N #1
+\cs_new_protected:Npn \__str_convert_gmap:N #1
{
- \tl_gset:Nx \g_str_result_tl
+ \tl_gset:Nx \g__str_result_tl
{
- \exp_after:wN \str_convert_gmap_loop:NN
+ \exp_after:wN \__str_convert_gmap_loop:NN
\exp_after:wN #1
- \g_str_result_tl { ? \prg_map_break: }
- \prg_break_point:n { }
+ \g__str_result_tl { ? \__prg_break: }
+ \__prg_break_point:
}
}
-\cs_new:Npn \str_convert_gmap_loop:NN #1#2
+\cs_new:Npn \__str_convert_gmap_loop:NN #1#2
{
\use_none:n #2
#1#2
- \str_convert_gmap_loop:NN #1
+ \__str_convert_gmap_loop:NN #1
}
-\cs_new_protected:Npn \str_convert_gmap_internal:N #1
+\cs_new_protected:Npn \__str_convert_gmap_internal:N #1
{
- \tl_gset:Nx \g_str_result_tl
+ \tl_gset:Nx \g__str_result_tl
{
- \exp_after:wN \str_convert_gmap_internal_loop:Nww
+ \exp_after:wN \__str_convert_gmap_internal_loop:Nww
\exp_after:wN #1
- \g_str_result_tl \s_tl \q_stop \prg_map_break: \s_tl
- \prg_break_point:n { }
+ \g__str_result_tl \s__tl \q_stop \__prg_break: \s__tl
+ \__prg_break_point:
}
}
-\cs_new:Npn \str_convert_gmap_internal_loop:Nww #1 #2 \s_tl #3 \s_tl
+\cs_new:Npn \__str_convert_gmap_internal_loop:Nww #1 #2 \s__tl #3 \s__tl
{
\use_none_delimit_by_q_stop:w #3 \q_stop
#1 {#3}
- \str_convert_gmap_internal_loop:Nww #1
+ \__str_convert_gmap_internal_loop:Nww #1
}
-\cs_new_protected:Npn \str_if_flag_error:nnx #1
+\cs_new_protected:Npn \__str_if_flag_error:nnx #1
{
\flag_if_raised:nTF {#1}
- { \msg_kernel_error:nnx { str } }
+ { \__msg_kernel_error:nnx { str } }
{ \use_none:nn }
}
-\cs_new_protected:Npn \str_if_flag_no_error:nnx #1#2#3
- { \flag_if_raised:nT {#1} { \bool_gset_true:N \g_str_error_bool } }
-\cs_new_protected:Npn \str_if_flag_times:nT #1#2
+\cs_new_protected:Npn \__str_if_flag_no_error:nnx #1#2#3
+ { \flag_if_raised:nT {#1} { \bool_gset_true:N \g__str_error_bool } }
+\cs_new_protected:Npn \__str_if_flag_times:nT #1#2
{ \flag_if_raised:nT {#1} { #2~(x \flag_height:n {#1} ) } }
\cs_new_protected_nopar:Npn \str_set_convert:Nnnn
- { \str_convert_aux_i:nNNnnn { } \tl_set_eq:NN }
+ { \__str_convert_i:nNNnnn { } \tl_set_eq:NN }
\cs_new_protected_nopar:Npn \str_gset_convert:Nnnn
- { \str_convert_aux_i:nNNnnn { } \tl_gset_eq:NN }
+ { \__str_convert_i:nNNnnn { } \tl_gset_eq:NN }
\prg_new_protected_conditional:Npnn
\str_set_convert:Nnnn #1#2#3#4 { T , F , TF }
{
- \bool_gset_false:N \g_str_error_bool
- \str_convert_aux_i:nNNnnn
- { \cs_set_eq:NN \str_if_flag_error:nnx \str_if_flag_no_error:nnx }
+ \bool_gset_false:N \g__str_error_bool
+ \__str_convert_i:nNNnnn
+ { \cs_set_eq:NN \__str_if_flag_error:nnx \__str_if_flag_no_error:nnx }
\tl_set_eq:NN #1 {#2} {#3} {#4}
- \bool_if:NTF \g_str_error_bool \prg_return_false: \prg_return_true:
+ \bool_if:NTF \g__str_error_bool \prg_return_false: \prg_return_true:
}
\prg_new_protected_conditional:Npnn
\str_gset_convert:Nnnn #1#2#3#4 { T , F , TF }
{
- \bool_gset_false:N \g_str_error_bool
- \str_convert_aux_i:nNNnnn
- { \cs_set_eq:NN \str_if_flag_error:nnx \str_if_flag_no_error:nnx }
+ \bool_gset_false:N \g__str_error_bool
+ \__str_convert_i:nNNnnn
+ { \cs_set_eq:NN \__str_if_flag_error:nnx \__str_if_flag_no_error:nnx }
\tl_gset_eq:NN #1 {#2} {#3} {#4}
- \bool_if:NTF \g_str_error_bool \prg_return_false: \prg_return_true:
+ \bool_if:NTF \g__str_error_bool \prg_return_false: \prg_return_true:
}
-\cs_new_protected:Npn \str_convert_aux_i:nNNnnn #1#2#3#4#5#6
+\cs_new_protected:Npn \__str_convert_i:nNNnnn #1#2#3#4#5#6
{
\group_begin:
#1
- \str_gset_other:Nn \g_str_result_tl {#4}
- \exp_after:wN \str_convert_aux_ii:wwwnn
+ \__str_gset_other:Nn \g__str_result_tl {#4}
+ \exp_after:wN \__str_convert_ii:wwwnn
\tl_to_str:n {#5} /// \q_stop
{ decode } { unescape }
\prg_do_nothing:
- \str_convert_decode_:
- \exp_after:wN \str_convert_aux_ii:wwwnn
+ \__str_convert_decode_:
+ \exp_after:wN \__str_convert_ii:wwwnn
\tl_to_str:n {#6} /// \q_stop
{ encode } { escape }
\use_ii_i:nn
- \str_convert_encode_:
+ \__str_convert_encode_:
\group_end:
- #2 #3 \g_str_result_tl
+ #2 #3 \g__str_result_tl
}
-\cs_new_protected:Npn \str_convert_aux_ii:wwwnn
+\cs_new_protected:Npn \__str_convert_ii:wwwnn
#1 / #2 // #3 \q_stop #4#5
{
- \str_convert_aux_iv:nnn {enc} {#4} {#1}
- \str_convert_aux_iv:nnn {esc} {#5} {#2}
- \exp_args:Ncc \str_convert_aux_iii:NNnNN
- { str_convert_#4_#1: } { str_convert_#5_#2: } {#2}
+ \__str_convert_iv:nnn {enc} {#4} {#1}
+ \__str_convert_iv:nnn {esc} {#5} {#2}
+ \exp_args:Ncc \__str_convert_iii:NNnNN
+ { __str_convert_#4_#1: } { __str_convert_#5_#2: } {#2}
}
-\cs_new_protected:Npn \str_convert_aux_iii:NNnNN #1#2#3#4#5
+\cs_new_protected:Npn \__str_convert_iii:NNnNN #1#2#3#4#5
{
\if_meaning:w #1 #5
\tl_if_empty:nF {#3}
- { \msg_kernel_error:nnx { str } { native-escaping } {#3} }
+ { \__msg_kernel_error:nnx { str } { native-escaping } {#3} }
#1
\else:
#4 #2 #1
\fi:
}
-\cs_new_protected:Npn \str_convert_aux_iv:nnn #1#2#3
+\cs_new_protected:Npn \__str_convert_iv:nnn #1#2#3
{
- \cs_if_exist:cF { str_convert_#2_#3: }
+ \cs_if_exist:cF { __str_convert_#2_#3: }
{
- \exp_args:Nx \str_convert_aux_v:nnnn
- { \str_convert_lowercase_alphanum:n {#3} }
+ \exp_args:Nx \__str_convert_v:nnnn
+ { \__str_convert_lowercase_alphanum:n {#3} }
{#1} {#2} {#3}
}
}
-\cs_new_protected:Npn \str_convert_aux_v:nnnn #1#2#3#4
+\cs_new_protected:Npn \__str_convert_v:nnnn #1#2#3#4
{
- \cs_if_exist:cF { str_convert_#3_#1: }
+ \cs_if_exist:cF { __str_convert_#3_#1: }
{
- \prop_get:NnNF \g_str_file_prop {#1} \l_str_internal_tl
- { \tl_set:Nn \l_str_internal_tl {#1} }
- \cs_if_exist:cF { str_convert_#3_ \l_str_internal_tl : }
+ \prop_get:NnNF \g__str_alias_prop {#1} \l__str_internal_tl
+ { \tl_set:Nn \l__str_internal_tl {#1} }
+ \cs_if_exist:cF { __str_convert_#3_ \l__str_internal_tl : }
{
- \file_if_exist:nTF { l3str-#2- \l_str_internal_tl .def }
+ \file_if_exist:nTF { l3str-#2- \l__str_internal_tl .def }
{
\group_begin:
- \str_load_catcodes:
- \file_input:n { l3str-#2- \l_str_internal_tl .def }
+ \__str_load_catcodes:
+ \file_input:n { l3str-#2- \l__str_internal_tl .def }
\group_end:
}
{
- \tl_clear:N \l_str_internal_tl
- \msg_kernel_error:nnxx { str } { unknown-#2 } {#4} {#1}
+ \tl_clear:N \l__str_internal_tl
+ \__msg_kernel_error:nnxx { str } { unknown-#2 } {#4} {#1}
}
}
- \cs_if_exist:cF { str_convert_#3_#1: }
+ \cs_if_exist:cF { __str_convert_#3_#1: }
{
- \cs_gset_eq:cc { str_convert_#3_#1: }
- { str_convert_#3_ \l_str_internal_tl : }
+ \cs_gset_eq:cc { __str_convert_#3_#1: }
+ { __str_convert_#3_ \l__str_internal_tl : }
}
}
- \cs_gset_eq:cc { str_convert_#3_#4: } { str_convert_#3_#1: }
+ \cs_gset_eq:cc { __str_convert_#3_#4: } { __str_convert_#3_#1: }
}
-\cs_new:Npn \str_convert_lowercase_alphanum:n #1
+\cs_new:Npn \__str_convert_lowercase_alphanum:n #1
{
- \exp_after:wN \str_convert_lowercase_alphanum_loop:N
- \tl_to_str:n {#1} { ? \prg_map_break: }
- \prg_break_point:n { }
+ \exp_after:wN \__str_convert_lowercase_alphanum_loop:N
+ \tl_to_str:n {#1} { ? \__prg_break: }
+ \__prg_break_point:
}
-\cs_new:Npn \str_convert_lowercase_alphanum_loop:N #1
+\cs_new:Npn \__str_convert_lowercase_alphanum_loop:N #1
{
\use_none:n #1
- \if_num:w `#1 < \c_ninety_one
- \if_num:w `#1 < \c_sixty_five
- \if_num:w \c_one < 1#1 \exp_stop_f:
+ \if_int_compare:w `#1 < \c_ninety_one
+ \if_int_compare:w `#1 < \c_sixty_five
+ \if_int_compare:w \c_one < 1#1 \exp_stop_f:
#1
\fi:
\else:
- \str_output_byte:n { `#1 + \c_thirty_two }
+ \__str_output_byte:n { `#1 + \c_thirty_two }
\fi:
\else:
- \if_num:w `#1 < \c_one_hundred_twenty_three
- \if_num:w `#1 < \c_ninety_seven
+ \if_int_compare:w `#1 < \c_one_hundred_twenty_three
+ \if_int_compare:w `#1 < \c_ninety_seven
\else:
#1
\fi:
\fi:
\fi:
- \str_convert_lowercase_alphanum_loop:N
+ \__str_convert_lowercase_alphanum_loop:N
}
-\cs_new_protected:Npn \str_load_catcodes:
+\cs_new_protected:Npn \__str_load_catcodes:
{
\char_set_catcode_escape:N \\
\char_set_catcode_group_begin:N \{
@@ -677,64 +680,64 @@
\int_set:Nn \tex_endlinechar:D {32}
}
\pdftex_if_engine:TF
- { \cs_new_eq:NN \str_filter_bytes:n \use:n }
+ { \cs_new_eq:NN \__str_filter_bytes:n \use:n }
{
- \cs_new:Npn \str_filter_bytes:n #1
+ \cs_new:Npn \__str_filter_bytes:n #1
{
- \str_filter_bytes_aux:N #1
- { ? \prg_map_break: }
- \prg_break_point:n { }
+ \__str_filter_bytes_aux:N #1
+ { ? \__prg_break: }
+ \__prg_break_point:
}
- \cs_new:Npn \str_filter_bytes_aux:N #1
+ \cs_new:Npn \__str_filter_bytes_aux:N #1
{
\use_none:n #1
- \if_num:w `#1 < 256 \exp_stop_f:
+ \if_int_compare:w `#1 < 256 \exp_stop_f:
#1
\else:
\flag_raise:n { str_byte }
\fi:
- \str_filter_bytes_aux:N
+ \__str_filter_bytes_aux:N
}
}
\pdftex_if_engine:TF
- { \cs_new_protected_nopar:Npn \str_convert_unescape_: { } }
+ { \cs_new_protected_nopar:Npn \__str_convert_unescape_: { } }
{
- \cs_new_protected_nopar:Npn \str_convert_unescape_:
+ \cs_new_protected_nopar:Npn \__str_convert_unescape_:
{
\flag_clear:n { str_byte }
- \tl_gset:Nx \g_str_result_tl
- { \exp_args:No \str_filter_bytes:n \g_str_result_tl }
- \str_if_flag_error:nnx { str_byte } { non-byte } { bytes }
+ \tl_gset:Nx \g__str_result_tl
+ { \exp_args:No \__str_filter_bytes:n \g__str_result_tl }
+ \__str_if_flag_error:nnx { str_byte } { non-byte } { bytes }
}
}
-\cs_new_eq:NN \str_convert_unescape_bytes: \str_convert_unescape_:
-\cs_new_protected_nopar:Npn \str_convert_escape_: { }
-\cs_new_eq:NN \str_convert_escape_bytes: \str_convert_escape_:
-\cs_new_protected_nopar:Npn \str_convert_decode_:
- { \str_convert_gmap:N \str_decode_native_char:N }
-\cs_new:Npn \str_decode_native_char:N #1
- { #1 \s_tl \int_value:w `#1 \s_tl }
+\cs_new_eq:NN \__str_convert_unescape_bytes: \__str_convert_unescape_:
+\cs_new_protected_nopar:Npn \__str_convert_escape_: { }
+\cs_new_eq:NN \__str_convert_escape_bytes: \__str_convert_escape_:
+\cs_new_protected_nopar:Npn \__str_convert_decode_:
+ { \__str_convert_gmap:N \__str_decode_native_char:N }
+\cs_new:Npn \__str_decode_native_char:N #1
+ { #1 \s__tl \__int_value:w `#1 \s__tl }
\group_begin:
\char_set_catcode_other:n { 0 }
\pdftex_if_engine:TF
{
- \cs_new_protected_nopar:Npn \str_convert_encode_:
+ \cs_new_protected_nopar:Npn \__str_convert_encode_:
{
\flag_clear:n { str_error }
- \str_convert_gmap_internal:N \str_encode_native_char:n
- \str_if_flag_error:nnx { str_error }
+ \__str_convert_gmap_internal:N \__str_encode_native_char:n
+ \__str_if_flag_error:nnx { str_error }
{ pdfTeX-native-overflow } { }
}
- \cs_new:Npn \str_encode_native_char:n #1
+ \cs_new:Npn \__str_encode_native_char:n #1
{
- \if_num:w #1 < \c_two_hundred_fifty_six
- \str_output_byte:n {#1}
+ \if_int_compare:w #1 < \c_two_hundred_fifty_six
+ \__str_output_byte:n {#1}
\else:
\flag_raise:n { str_error }
?
\fi:
}
- \msg_kernel_new:nnnn { str } { pdfTeX-native-overflow }
+ \__msg_kernel_new:nnnn { str } { pdfTeX-native-overflow }
{ Character~code~too~large~for~pdfTeX. }
{
The~pdfTeX~engine~only~supports~8-bit~characters:~
@@ -743,141 +746,141 @@
}
}
{
- \cs_new_protected_nopar:Npn \str_convert_encode_:
+ \cs_new_protected_nopar:Npn \__str_convert_encode_:
{
- \int_zero:N \l_tl_build_offset_int
- \tl_gset_build_x:Nw \g_str_result_tl
- \exp_after:wN \str_encode_native_loop:w
- \g_str_result_tl \s_tl { \q_stop \prg_map_break: } \s_tl
- \prg_break_point:n { }
- \tl_build_end:
+ \int_zero:N \l__tl_build_offset_int
+ \__tl_gbuild_x:Nw \g__str_result_tl
+ \exp_after:wN \__str_encode_native_loop:w
+ \g__str_result_tl \s__tl { \q_stop \__prg_break: } \s__tl
+ \__prg_break_point:
+ \__tl_build_end:
}
- \cs_new_protected:Npn \str_encode_native_loop:w #1 \s_tl #2 \s_tl
+ \cs_new_protected:Npn \__str_encode_native_loop:w #1 \s__tl #2 \s__tl
{
\use_none_delimit_by_q_stop:w #2 \q_stop
- \tex_lccode:D \l_str_internal_int \int_eval:w #2 \int_eval_end:
- \tl_to_lowercase:n { \tl_build_one:n { ^^@ } }
- \str_encode_native_loop:w
+ \tex_lccode:D \l__str_internal_int \__int_eval:w #2 \__int_eval_end:
+ \tl_to_lowercase:n { \__tl_build_one:n { ^^@ } }
+ \__str_encode_native_loop:w
}
}
\group_end:
-\cs_new_protected:Npn \str_declare_eight_bit_encoding:nnn #1#2#3
+\cs_new_protected:Npn \__str_declare_eight_bit_encoding:nnn #1#2#3
{
- \tl_set:Nn \l_str_internal_tl {#1}
- \cs_new_protected_nopar:cpn { str_convert_decode_#1: }
- { \str_convert_decode_eight_bit:n {#1} }
- \cs_new_protected_nopar:cpn { str_convert_encode_#1: }
- { \str_convert_encode_eight_bit:n {#1} }
- \tl_const:cn { c_str_encoding_#1_tl } {#2}
- \tl_const:cn { c_str_encoding_#1_missing_tl } {#3}
+ \tl_set:Nn \l__str_internal_tl {#1}
+ \cs_new_protected_nopar:cpn { __str_convert_decode_#1: }
+ { \__str_convert_decode_eight_bit:n {#1} }
+ \cs_new_protected_nopar:cpn { __str_convert_encode_#1: }
+ { \__str_convert_encode_eight_bit:n {#1} }
+ \tl_const:cn { c__str_encoding_#1_tl } {#2}
+ \tl_const:cn { c__str_encoding_#1_missing_tl } {#3}
}
-\cs_new_protected:Npn \str_convert_decode_eight_bit:n #1
+\cs_new_protected:Npn \__str_convert_decode_eight_bit:n #1
{
\group_begin:
- \int_zero:N \l_str_internal_int
- \exp_last_unbraced:Nx \str_decode_eight_bit_load:nn
- { \tl_use:c { c_str_encoding_#1_tl } }
- { \q_stop \prg_map_break: } { }
- \prg_break_point:n { }
- \exp_last_unbraced:Nx \str_decode_eight_bit_load_missing:n
- { \tl_use:c { c_str_encoding_#1_missing_tl } }
- { \q_stop \prg_map_break: }
- \prg_break_point:n { }
+ \int_zero:N \l__str_internal_int
+ \exp_last_unbraced:Nx \__str_decode_eight_bit_load:nn
+ { \tl_use:c { c__str_encoding_#1_tl } }
+ { \q_stop \__prg_break: } { }
+ \__prg_break_point:
+ \exp_last_unbraced:Nx \__str_decode_eight_bit_load_missing:n
+ { \tl_use:c { c__str_encoding_#1_missing_tl } }
+ { \q_stop \__prg_break: }
+ \__prg_break_point:
\flag_clear:n { str_error }
- \str_convert_gmap:N \str_decode_eight_bit_char:N
- \str_if_flag_error:nnx { str_error } { decode-8-bit } {#1}
+ \__str_convert_gmap:N \__str_decode_eight_bit_char:N
+ \__str_if_flag_error:nnx { str_error } { decode-8-bit } {#1}
\group_end:
}
-\cs_new_protected:Npn \str_decode_eight_bit_load:nn #1#2
+\cs_new_protected:Npn \__str_decode_eight_bit_load:nn #1#2
{
\use_none_delimit_by_q_stop:w #1 \q_stop
- \tex_dimen:D "#1 = \l_str_internal_int sp \scan_stop:
- \tex_skip:D \l_str_internal_int = "#1 sp \scan_stop:
- \tex_toks:D \l_str_internal_int \exp_after:wN { \int_value:w "#2 }
- \tex_advance:D \l_str_internal_int \c_one
- \str_decode_eight_bit_load:nn
+ \tex_dimen:D "#1 = \l__str_internal_int sp \scan_stop:
+ \tex_skip:D \l__str_internal_int = "#1 sp \scan_stop:
+ \tex_toks:D \l__str_internal_int \exp_after:wN { \__int_value:w "#2 }
+ \tex_advance:D \l__str_internal_int \c_one
+ \__str_decode_eight_bit_load:nn
}
-\cs_new_protected:Npn \str_decode_eight_bit_load_missing:n #1
+\cs_new_protected:Npn \__str_decode_eight_bit_load_missing:n #1
{
\use_none_delimit_by_q_stop:w #1 \q_stop
- \tex_dimen:D "#1 = \l_str_internal_int sp \scan_stop:
- \tex_skip:D \l_str_internal_int = "#1 sp \scan_stop:
- \tex_toks:D \l_str_internal_int \exp_after:wN
- { \int_use:N \c_str_replacement_char_int }
- \tex_advance:D \l_str_internal_int \c_one
- \str_decode_eight_bit_load_missing:n
- }
-\cs_new:Npn \str_decode_eight_bit_char:N #1
- {
- #1 \s_tl
- \if_num:w \tex_dimen:D `#1 < \l_str_internal_int
- \if_num:w \tex_skip:D \tex_dimen:D `#1 = `#1 \exp_stop_f:
+ \tex_dimen:D "#1 = \l__str_internal_int sp \scan_stop:
+ \tex_skip:D \l__str_internal_int = "#1 sp \scan_stop:
+ \tex_toks:D \l__str_internal_int \exp_after:wN
+ { \int_use:N \c__str_replacement_char_int }
+ \tex_advance:D \l__str_internal_int \c_one
+ \__str_decode_eight_bit_load_missing:n
+ }
+\cs_new:Npn \__str_decode_eight_bit_char:N #1
+ {
+ #1 \s__tl
+ \if_int_compare:w \tex_dimen:D `#1 < \l__str_internal_int
+ \if_int_compare:w \tex_skip:D \tex_dimen:D `#1 = `#1 \exp_stop_f:
\tex_the:D \tex_toks:D \tex_dimen:D
\fi:
\fi:
- \int_value:w `#1 \s_tl
+ \__int_value:w `#1 \s__tl
}
-\cs_new_protected:Npn \str_convert_encode_eight_bit:n #1
+\cs_new_protected:Npn \__str_convert_encode_eight_bit:n #1
{
\group_begin:
- \int_zero:N \l_str_internal_int
- \exp_last_unbraced:Nx \str_encode_eight_bit_load:nn
- { \tl_use:c { c_str_encoding_#1_tl } }
- { \q_stop \prg_map_break: } { }
- \prg_break_point:n { }
+ \int_zero:N \l__str_internal_int
+ \exp_last_unbraced:Nx \__str_encode_eight_bit_load:nn
+ { \tl_use:c { c__str_encoding_#1_tl } }
+ { \q_stop \__prg_break: } { }
+ \__prg_break_point:
\flag_clear:n { str_error }
- \str_convert_gmap_internal:N \str_encode_eight_bit_char:n
- \str_if_flag_error:nnx { str_error } { encode-8-bit } {#1}
+ \__str_convert_gmap_internal:N \__str_encode_eight_bit_char:n
+ \__str_if_flag_error:nnx { str_error } { encode-8-bit } {#1}
\group_end:
}
-\cs_new_protected:Npn \str_encode_eight_bit_load:nn #1#2
+\cs_new_protected:Npn \__str_encode_eight_bit_load:nn #1#2
{
\use_none_delimit_by_q_stop:w #1 \q_stop
- \tex_dimen:D "#2 = \l_str_internal_int sp \scan_stop:
- \tex_skip:D \l_str_internal_int = "#2 sp \scan_stop:
- \exp_args:NNf \tex_toks:D \l_str_internal_int
- { \str_output_byte:n { "#1 } }
- \tex_advance:D \l_str_internal_int \c_one
- \str_encode_eight_bit_load:nn
+ \tex_dimen:D "#2 = \l__str_internal_int sp \scan_stop:
+ \tex_skip:D \l__str_internal_int = "#2 sp \scan_stop:
+ \exp_args:NNf \tex_toks:D \l__str_internal_int
+ { \__str_output_byte:n { "#1 } }
+ \tex_advance:D \l__str_internal_int \c_one
+ \__str_encode_eight_bit_load:nn
}
-\cs_new:Npn \str_encode_eight_bit_char:n #1
+\cs_new:Npn \__str_encode_eight_bit_char:n #1
{
- \if_num:w #1 > \c_max_register_int
+ \if_int_compare:w #1 > \c_max_register_int
\flag_raise:n { str_error }
\else:
- \if_num:w \tex_dimen:D #1 < \l_str_internal_int
- \if_num:w \tex_skip:D \tex_dimen:D #1 = #1 \exp_stop_f:
+ \if_int_compare:w \tex_dimen:D #1 < \l__str_internal_int
+ \if_int_compare:w \tex_skip:D \tex_dimen:D #1 = #1 \exp_stop_f:
\tex_the:D \tex_toks:D \tex_dimen:D #1 \exp_stop_f:
\exp_after:wN \exp_after:wN \exp_after:wN \use_none:nn
\fi:
\fi:
- \str_encode_eight_bit_char_aux:n {#1}
+ \__str_encode_eight_bit_char_aux:n {#1}
\fi:
}
-\cs_new:Npn \str_encode_eight_bit_char_aux:n #1
+\cs_new:Npn \__str_encode_eight_bit_char_aux:n #1
{
- \if_num:w #1 < \c_two_hundred_fifty_six
- \str_output_byte:n {#1}
+ \if_int_compare:w #1 < \c_two_hundred_fifty_six
+ \__str_output_byte:n {#1}
\else:
\flag_raise:n { str_error }
\fi:
}
-\msg_kernel_new:nnn { str } { unknown-esc }
+\__msg_kernel_new:nnn { str } { unknown-esc }
{ Escaping~scheme~'#1'~(filtered:~'#2')~unknown. }
-\msg_kernel_new:nnn { str } { unknown-enc }
+\__msg_kernel_new:nnn { str } { unknown-enc }
{ Encoding~scheme~'#1'~(filtered:~'#2')~unknown. }
-\msg_kernel_new:nnnn { str } { native-escaping }
+\__msg_kernel_new:nnnn { str } { native-escaping }
{ The~'native'~encoding~scheme~does~not~support~any~escaping. }
{
Since~native~strings~do~not~consist~in~bytes,~
none~of~the~escaping~methods~make~sense.~
The~specified~escaping,~'#1',~will be ignored.
}
-\msg_kernel_new:nnn { str } { file-not-found }
+\__msg_kernel_new:nnn { str } { file-not-found }
{ File~'l3str-#1.def'~not~found. }
\pdftex_if_engine:F
{
- \msg_kernel_new:nnnn { str } { non-byte }
+ \__msg_kernel_new:nnnn { str } { non-byte }
{ String~invalid~in~escaping~'#1':~it~may~only~contain~bytes. }
{
Some~characters~in~the~string~you~asked~to~convert~are~not~
@@ -891,22 +894,22 @@
}
}
}
-\msg_kernel_new:nnnn { str } { decode-8-bit }
+\__msg_kernel_new:nnnn { str } { decode-8-bit }
{ Invalid~string~in~encoding~'#1'. }
{
LaTeX~came~across~a~byte~which~is~not~defined~to~represent~
any~character~in~the~encoding~'#1'.
}
-\msg_kernel_new:nnnn { str } { encode-8-bit }
+\__msg_kernel_new:nnnn { str } { encode-8-bit }
{ Unicode~string~cannot~be~converted~to~encoding~'#1'. }
{
The~encoding~'#1'~only~contains~a~subset~of~all~Unicode~characters.~
LaTeX~was~asked~to~convert~a~string~to~that~encoding,~but~that~
string~contains~a~character~that~'#1'~does~not~support.
}
-\cs_set:Npn \str_length_skip_spaces:N
- { \exp_args:No \str_length_skip_spaces:n }
-\cs_set_eq:NN \str_length_skip_spaces:n \str_length_ignore_spaces:n
+\cs_new_eq:NN \str_length:N \str_count:N
+\cs_new_eq:NN \str_length:n \str_count:n
+\cs_new_eq:NN \str_length_ignore_spaces:n \str_count_ignore_spaces:n
%%
%%
%% End of file `l3str.sty'.
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty
index 545d7ce7069..8b90db9c751 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty
@@ -47,216 +47,216 @@
%% -----------------------------------------------------------------------
\RequirePackage{expl3}
\GetIdInfo$Id: l3tl-analysis.dtx 3039 2011-12-08 09:22:35Z bruno $
- {L3 Experimental Analysis of Token lists}
+ {L3 Experimental token lists analysis}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\RequirePackage{l3str}
-\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_nopar: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
+\__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_nopar: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 \c_zero
- \exp_after:wN \tl_analysis_cs_space_count:w
+ \__int_value:w \__int_eval:w \c_zero
+ \exp_after:wN \__tl_analysis_cs_space_count:w
\token_to_str:N #2
- \fi: \tl_analysis_cs_space_count_end:w ; ~ !
+ \fi: \__tl_analysis_cs_space_count_end:w ; ~ !
}
-\cs_new:Npn \tl_analysis_cs_space_count:w #1 ~
+\cs_new:Npn \__tl_analysis_cs_space_count:w #1 ~
{
\if_false: #1 #1 \fi:
+ \c_one
- \tl_analysis_cs_space_count:w
+ \__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_length_ignore_spaces:n {#1} ; }
-\cs_new_protected:Npn \tl_analysis:n #1
+\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_i:n {#1}
- \tl_analysis_ii:n {#1}
+ \__tl_analysis_setup:n {#1}
+ \__tl_analysis_i:n {#1}
+ \__tl_analysis_ii:n {#1}
\group_align_safe_end:
\group_end:
}
-\cs_new_protected:Npn \tl_analysis_setup:n #1
+\cs_new_protected:Npn \__tl_analysis_setup:n #1
{
\int_set_eq:NN \tex_escapechar:D \c_minus_one
- \exp_after:wN \tl_analysis_disable_loop:N
- \tl_to_str:n {#1} { ~ } { ? ~ \prg_map_break: }
- \prg_break_point:n { }
+ \exp_after:wN \__tl_analysis_disable_loop:N
+ \tl_to_str:n {#1} { ~ } { ? ~ \__prg_break: }
+ \__prg_break_point:
}
\group_begin:
\char_set_catcode_active:N \^^@
- \cs_new_protected:Npn \tl_analysis_disable_loop:N #1
+ \cs_new_protected:Npn \__tl_analysis_disable_loop:N #1
{
\tex_lccode:D \c_zero `#1 ~
\tl_to_lowercase:n { \tex_let:D ^^@ } \c_undefined:D
- \tl_analysis_disable_loop:N
+ \__tl_analysis_disable_loop:N
}
\group_end:
-\cs_new_protected:Npn \tl_analysis_i:n #1
+\cs_new_protected:Npn \__tl_analysis_i: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_i_loop:w #1 }
- \int_decr:N \l_tl_analysis_index_int
- }
-\cs_new_protected_nopar:Npn \tl_analysis_i_loop:w
- { \tex_futurelet:D \l_tl_analysis_token \tl_analysis_i_type:w }
-\cs_new_protected_nopar:Npn \tl_analysis_i_type:w
- {
- \l_tl_analysis_type_int =
- \if_meaning:w \l_tl_analysis_token \c_space_token
+ \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_i_loop:w #1 }
+ \int_decr:N \l__tl_analysis_index_int
+ }
+\cs_new_protected_nopar:Npn \__tl_analysis_i_loop:w
+ { \tex_futurelet:D \l__tl_analysis_token \__tl_analysis_i_type:w }
+\cs_new_protected_nopar:Npn \__tl_analysis_i_type:w
+ {
+ \l__tl_analysis_type_int =
+ \if_meaning:w \l__tl_analysis_token \c_space_token
\c_zero
\else:
- \if_catcode:w \exp_not:N \l_tl_analysis_token \c_group_begin_token
+ \if_catcode:w \exp_not:N \l__tl_analysis_token \c_group_begin_token
\c_one
\else:
- \if_catcode:w \exp_not:N \l_tl_analysis_token \c_group_end_token
+ \if_catcode:w \exp_not:N \l__tl_analysis_token \c_group_end_token
\c_minus_one
\else:
\c_two
\fi:
\fi:
\fi:
- \if_case:w \l_tl_analysis_type_int
- \exp_after:wN \tl_analysis_i_space:w
- \or: \exp_after:wN \tl_analysis_i_bgroup:w
- \or: \exp_after:wN \tl_analysis_i_safe:N
- \else: \exp_after:wN \tl_analysis_i_egroup:w
+ \if_case:w \l__tl_analysis_type_int
+ \exp_after:wN \__tl_analysis_i_space:w
+ \or: \exp_after:wN \__tl_analysis_i_bgroup:w
+ \or: \exp_after:wN \__tl_analysis_i_safe:N
+ \else: \exp_after:wN \__tl_analysis_i_egroup:w
\fi:
}
-\cs_new_protected_nopar:Npn \tl_analysis_i_space:w
+\cs_new_protected_nopar:Npn \__tl_analysis_i_space:w
{
- \tex_afterassignment:D \tl_analysis_i_space_test:w
+ \tex_afterassignment:D \__tl_analysis_i_space_test:w
\exp_after:wN \cs_set_eq:NN
- \exp_after:wN \l_tl_analysis_char_token
+ \exp_after:wN \l__tl_analysis_char_token
\token_to_str:N
}
-\cs_new_protected_nopar:Npn \tl_analysis_i_space_test:w
+\cs_new_protected_nopar:Npn \__tl_analysis_i_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_i_store:
+ \if_meaning:w \l__tl_analysis_char_token \c_space_token
+ \tex_toks:D \l__tl_analysis_index_int { \exp_not:n { ~ } }
+ \__tl_analysis_i_store:
\else:
- \int_incr:N \l_tl_analysis_normal_int
+ \int_incr:N \l__tl_analysis_normal_int
\fi:
- \tl_analysis_i_loop:w
+ \__tl_analysis_i_loop:w
}
\group_begin:
\char_set_catcode_group_begin:N \^^@
\char_set_catcode_group_end:N \^^E
- \cs_new_protected_nopar:Npn \tl_analysis_i_bgroup:w
- { \tl_analysis_i_group:nw { \exp_after:wN ^^@ \if_false: ^^E \fi: } }
+ \cs_new_protected_nopar:Npn \__tl_analysis_i_bgroup:w
+ { \__tl_analysis_i_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_nopar:Npn \tl_analysis_i_egroup:w
- { \tl_analysis_i_group:nw { \if_false: ^^B \fi: ^^@ } }
+ \cs_new_protected_nopar:Npn \__tl_analysis_i_egroup:w
+ { \__tl_analysis_i_group:nw { \if_false: ^^B \fi: ^^@ } }
\group_end:
-\cs_new_protected:Npn \tl_analysis_i_group:nw #1
+\cs_new_protected:Npn \__tl_analysis_i_group:nw #1
{
- \tex_lccode:D \c_zero = \tl_analysis_extract_charcode: \scan_stop:
- \tl_to_lowercase:n { \tex_toks:D \l_tl_analysis_index_int {#1} }
- \if_num:w \tex_lccode:D \c_zero = \tex_escapechar:D
+ \tex_lccode:D \c_zero = \__tl_analysis_extract_charcode: \scan_stop:
+ \tl_to_lowercase:n { \tex_toks:D \l__tl_analysis_index_int {#1} }
+ \if_int_compare:w \tex_lccode:D \c_zero = \tex_escapechar:D
\int_set:Nn \tex_escapechar:D { 139 - \tex_escapechar:D }
\fi:
- \tex_afterassignment:D \tl_analysis_i_group_test:w
+ \tex_afterassignment:D \__tl_analysis_i_group_test:w
\exp_after:wN \cs_set_eq:NN
- \exp_after:wN \l_tl_analysis_char_token
+ \exp_after:wN \l__tl_analysis_char_token
\token_to_str:N
}
-\cs_new_protected_nopar:Npn \tl_analysis_i_group_test:w
+\cs_new_protected_nopar:Npn \__tl_analysis_i_group_test:w
{
- \if_charcode:w \l_tl_analysis_token \l_tl_analysis_char_token
- \tl_analysis_i_store:
+ \if_charcode:w \l__tl_analysis_token \l__tl_analysis_char_token
+ \__tl_analysis_i_store:
\else:
- \int_incr:N \l_tl_analysis_normal_int
+ \int_incr:N \l__tl_analysis_normal_int
\fi:
- \tl_analysis_i_loop:w
+ \__tl_analysis_i_loop:w
}
-\cs_new_protected_nopar:Npn \tl_analysis_i_store:
+\cs_new_protected_nopar:Npn \__tl_analysis_i_store:
{
- \tex_advance:D \l_tl_analysis_nesting_int \l_tl_analysis_type_int
- \if_num:w \tex_lccode:D \c_zero = \c_thirty_two
- \tex_multiply:D \l_tl_analysis_type_int \c_two
+ \tex_advance:D \l__tl_analysis_nesting_int \l__tl_analysis_type_int
+ \if_int_compare:w \tex_lccode:D \c_zero = \c_thirty_two
+ \tex_multiply:D \l__tl_analysis_type_int \c_two
\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_num:w \l_tl_analysis_nesting_int = \c_minus_one
- \cs_set_eq:NN \tl_analysis_i_loop:w \scan_stop:
+ \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 = \c_minus_one
+ \cs_set_eq:NN \__tl_analysis_i_loop:w \scan_stop:
\fi:
}
-\cs_new_protected:Npn \tl_analysis_i_safe:N #1
+\cs_new_protected:Npn \__tl_analysis_i_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
+ \int_incr:N \l__tl_analysis_normal_int
\else:
- \tl_analysis_cs_space_count:NN \tl_analysis_i_cs:ww #1
+ \__tl_analysis_cs_space_count:NN \__tl_analysis_i_cs:ww #1
\fi:
- \tl_analysis_i_loop:w
+ \__tl_analysis_i_loop:w
}
-\cs_new_protected:Npn \tl_analysis_i_cs:ww #1; #2;
+\cs_new_protected:Npn \__tl_analysis_i_cs:ww #1; #2;
{
- \if_num:w #1 > \c_zero
- \tex_skip:D \l_tl_analysis_index_int
- = \int_eval:w \l_tl_analysis_normal_int + \c_one sp \scan_stop:
- \tex_advance:D \l_tl_analysis_index_int #1 \exp_stop_f:
- \l_tl_analysis_normal_int #2 \exp_stop_f:
+ \if_int_compare:w #1 > \c_zero
+ \tex_skip:D \l__tl_analysis_index_int
+ = \__int_eval:w \l__tl_analysis_normal_int + \c_one 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:
+ \tex_advance:D \l__tl_analysis_normal_int #2 \exp_stop_f:
\fi:
}
-\cs_new_protected:Npn \tl_analysis_ii:n #1
+\cs_new_protected:Npn \__tl_analysis_ii:n #1
{
- \tl_gset:Nx \g_tl_analysis_result_tl
+ \tl_gset:Nx \g__tl_analysis_result_tl
{
- \tl_analysis_ii_loop:w 0; #1
- \prg_break_point:n { }
+ \__tl_analysis_ii_loop:w 0; #1
+ \__prg_break_point:
}
}
-\cs_new:Npn \tl_analysis_ii_loop:w #1;
+\cs_new:Npn \__tl_analysis_ii_loop:w #1;
{
- \exp_after:wN \tl_analysis_ii_normals:ww
- \int_value:w \tex_skip:D #1 ; #1 ;
+ \exp_after:wN \__tl_analysis_ii_normals:ww
+ \__int_value:w \tex_skip:D #1 ; #1 ;
}
-\cs_new:Npn \tl_analysis_ii_normals:ww #1;
+\cs_new:Npn \__tl_analysis_ii_normals:ww #1;
{
- \if_num:w #1 = \c_zero
- \tl_analysis_ii_special:w
+ \if_int_compare:w #1 = \c_zero
+ \__tl_analysis_ii_special:w
\fi:
- \tl_analysis_ii_normal:wwN #1;
+ \__tl_analysis_ii_normal:wwN #1;
}
-\cs_new:Npn \tl_analysis_ii_normal:wwN #1; #2; #3
+\cs_new:Npn \__tl_analysis_ii_normal:wwN #1; #2; #3
{
- \exp_not:n { \exp_not:n { #3 } } \s_tl
+ \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_ii_char:Nww
+ \exp_after:wN \__tl_analysis_ii_char:Nww
\else:
- \exp_after:wN \tl_analysis_ii_cs:Nww
+ \exp_after:wN \__tl_analysis_ii_cs:Nww
\fi:
#3 #1; #2;
}
@@ -267,7 +267,7 @@
\char_set_uccode:nn { `? } { `D }
\tl_to_uppercase:n
{
- \cs_new:Npn \tl_analysis_ii_char:Nww #1
+ \cs_new:Npn \__tl_analysis_ii_char:Nww #1
{
\if_meaning:w #1 \c_undefined:D ? \else:
\if_catcode:w #1 \c_catcode_other_token C \else:
@@ -279,40 +279,40 @@
\if_catcode:w #1 \c_space_token A \else:
6
\fi: \fi: \fi: \fi: \fi: \fi: \fi: \fi:
- \int_value:w `#1 \s_tl
- \exp_after:wN \tl_analysis_ii_normals:ww
- \int_use:N \int_eval:w \c_minus_one +
+ \__int_value:w `#1 \s__tl
+ \exp_after:wN \__tl_analysis_ii_normals:ww
+ \int_use:N \__int_eval:w \c_minus_one +
}
}
\group_end:
-\cs_new:Npn \tl_analysis_ii_cs:Nww #1
+\cs_new:Npn \__tl_analysis_ii_cs:Nww #1
{
- 0 -1 \s_tl
- \tl_analysis_cs_space_count:NN \tl_analysis_ii_cs_test:ww #1
+ 0 -1 \s__tl
+ \__tl_analysis_cs_space_count:NN \__tl_analysis_ii_cs_test:ww #1
}
-\cs_new:Npn \tl_analysis_ii_cs_test:ww #1 ; #2 ; #3 ; #4 ;
+\cs_new:Npn \__tl_analysis_ii_cs_test:ww #1 ; #2 ; #3 ; #4 ;
{
- \exp_after:wN \tl_analysis_ii_normals:ww
- \int_use:N \int_eval:w
- \if_num:w #1 = \c_zero
+ \exp_after:wN \__tl_analysis_ii_normals:ww
+ \int_use:N \__int_eval:w
+ \if_int_compare:w #1 = \c_zero
#3
\else:
- \tex_skip:D \int_eval:w #4 + #1 \int_eval_end:
+ \tex_skip:D \__int_eval:w #4 + #1 \__int_eval_end:
\fi:
- #2
\exp_after:wN ;
- \int_use:N \int_eval:w #4 + #1 ;
+ \int_use:N \__int_eval:w #4 + #1 ;
}
\group_begin:
\char_set_catcode_other:N A
- \cs_new:Npn \tl_analysis_ii_special:w
- \fi: \tl_analysis_ii_normal:wwN 0 ; #1 ;
+ \cs_new:Npn \__tl_analysis_ii_special:w
+ \fi: \__tl_analysis_ii_normal:wwN 0 ; #1 ;
{
\fi:
- \if_num:w #1 = \l_tl_analysis_index_int
- \exp_after:wN \prg_map_break:
+ \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
+ \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
@@ -320,131 +320,131 @@
\else: 2
\fi:
\if_int_odd:w \etex_gluestretch:D \tex_skip:D #1 \exp_stop_f:
- \exp_after:wN \tl_analysis_ii_special_char:wN \int_use:N
+ \exp_after:wN \__tl_analysis_ii_special_char:wN \int_use:N
\else:
- \exp_after:wN \tl_analysis_ii_special_space:w \int_use:N
+ \exp_after:wN \__tl_analysis_ii_special_space:w \int_use:N
\fi:
- \int_eval:w \c_one + #1 \exp_after:wN ;
+ \__int_eval:w \c_one + #1 \exp_after:wN ;
\token_to_str:N
}
\group_end:
-\cs_new:Npn \tl_analysis_ii_special_char:wN #1 ; #2
+\cs_new:Npn \__tl_analysis_ii_special_char:wN #1 ; #2
{
- \int_value:w `#2 \s_tl
- \tl_analysis_ii_loop:w #1 ;
+ \__int_value:w `#2 \s__tl
+ \__tl_analysis_ii_loop:w #1 ;
}
-\cs_new:Npn \tl_analysis_ii_special_space:w #1 ; ~
+\cs_new:Npn \__tl_analysis_ii_special_space:w #1 ; ~
{
- 32 \s_tl
- \tl_analysis_ii_loop:w #1 ;
+ 32 \s__tl
+ \__tl_analysis_ii_loop:w #1 ;
}
-\cs_new_protected:Npn \tl_analysis_map_inline:nn #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 }
+ \__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_new_protected:Npn \__tl_analysis_map_inline_aux:Nn #1#2
{
- \cs_gset_protected:Npn #1 ##1 \s_tl ##2 ##3 \s_tl
+ \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 { ? \prg_map_break: } \s_tl
- \prg_break_point:n { \int_gdecr:N \g_prg_map_int }
+ \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
{
- \exp_args:No \tl_analysis:n {#1}
- \msg_aux_show:Nnx #1
+ \exp_args:No \__tl_analysis:n {#1}
+ \__msg_show_variable:Nnn #1
{ tl-analysis }
{
- \exp_after:wN \tl_show_analysis_loop:wNw \g_tl_analysis_result_tl
- \s_tl { ? \prg_map_break: } \s_tl
- \prg_break_point: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_protected:Npn \tl_show_analysis:n #1
{
- \tl_set:Nn \l_tl_analysis_internal_tl {#1}
- \tl_show_analysis:N \l_tl_analysis_internal_tl
+ \tl_set:Nn \l__tl_analysis_internal_tl {#1}
+ \tl_show_analysis:N \l__tl_analysis_internal_tl
}
-\cs_new:Npn \tl_show_analysis_loop:wNw #1 \s_tl #2 #3 \s_tl
+\cs_new:Npn \__tl_analysis_show_loop:wNw #1 \s__tl #2 #3 \s__tl
{
\use_none:n #2
\iow_newline: > \c_space_tl \c_space_tl
- \if_num:w "#2 = \c_zero
- \exp_after:wN \tl_show_analysis_cs:n
+ \if_int_compare:w "#2 = \c_zero
+ \exp_after:wN \__tl_analysis_show_cs:n
\else:
- \if_num:w "#2 = \c_thirteen
+ \if_int_compare:w "#2 = \c_thirteen
\exp_after:wN \exp_after:wN
- \exp_after:wN \tl_show_analysis_active:n
+ \exp_after:wN \__tl_analysis_show_active:n
\else:
\exp_after:wN \exp_after:wN
- \exp_after:wN \tl_show_analysis_normal:n
+ \exp_after:wN \__tl_analysis_show_normal:n
\fi:
\fi:
{#1}
- \tl_show_analysis_loop:wNw
+ \__tl_analysis_show_loop:wNw
}
-\cs_new:Npn \tl_show_analysis_normal:n #1
+\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_show_analysis_value:N #1
+\cs_new:Npn \__tl_analysis_show_value:N #1
{
\token_if_expandable:NF #1
{
- \token_if_chardef:NTF #1 \prg_map_break: { }
- \token_if_mathchardef:NTF #1 \prg_map_break: { }
- \token_if_dim_register:NTF #1 \prg_map_break: { }
- \token_if_int_register:NTF #1 \prg_map_break: { }
- \token_if_skip_register:NTF #1 \prg_map_break: { }
- \token_if_toks_register:NTF #1 \prg_map_break: { }
- \use_none:nnnn
- \prg_break_point:n { }
+ \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 { = \tex_the:D #1 }
}
}
-\cs_new:Npn \tl_show_analysis_cs:n #1
- { \exp_args:No \tl_show_analysis_long:nn {#1} { control~sequence= } }
-\cs_new:Npn \tl_show_analysis_active:n #1
- { \exp_args:No \tl_show_analysis_long:nn {#1} { active~character= } }
-\cs_new:Npn \tl_show_analysis_long:nn #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_show_analysis_long_aux:oofn
+ \__tl_analysis_show_long_aux:oofn
{ \token_to_str:N #1 }
{ \token_to_meaning:N #1 }
- { \tl_show_analysis_value:N #1 }
+ { \__tl_analysis_show_value:N #1 }
}
-\cs_new:Npn \tl_show_analysis_long_aux:nnnn #1#2#3#4
+\cs_new:Npn \__tl_analysis_show_long_aux:nnnn #1#2#3#4
{
\int_compare:nNnTF
- { \str_length:n { #1 ~ ( #4 #2 #3 ) } }
- > { \l_iow_line_length_int - \c_three }
+ { \str_count:n { #1 ~ ( #4 #2 #3 ) } }
+ > { \l_iow_line_count_int - \c_three }
{
- \str_substr:nnn { #1 ~ ( #4 #2 #3 ) } \c_zero
+ \str_substr:nnn { #1 ~ ( #4 #2 #3 ) } \c_one
{
- \l_iow_line_length_int - \c_three
- - \str_length:N \c_tl_show_analysis_etc_str
+ \l_iow_line_count_int - \c_three
+ - \str_count:N \c__tl_analysis_show_etc_str
}
- \c_tl_show_analysis_etc_str
+ \c__tl_analysis_show_etc_str
}
{ #1 ~ ( #4 #2 #3 ) }
}
-\cs_generate_variant:Nn \tl_show_analysis_long_aux:nnnn { oof }
-\tl_const:Nx \c_tl_show_analysis_etc_str % (
+\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 { tl-analysis } { show }
+\__msg_kernel_new:nnn { kernel } { show-tl-analysis }
{
The~token~list~
- \str_if_eq:nnF {#1} { \l_tl_analysis_internal_tl }
+ \str_if_eq:nnF {#1} { \l__tl_analysis_internal_tl }
{ \token_to_str:N #1 ~ }
\tl_if_empty:NTF #1
{ is~empty }
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty
index 415a89f4897..1ad40197bab 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty
@@ -47,74 +47,74 @@
%% -----------------------------------------------------------------------
\RequirePackage{expl3}
\GetIdInfo$Id: l3tl-build.dtx 3039 2011-12-08 09:22:35Z bruno $
- {L3 Experimental Build of Token lists}
+ {L3 Experimental token list construction}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
-\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_nopar:Npn \tl_build_unpack:
+\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_nopar:Npn \__tl_build_unpack:
{
- \tl_put_right:Nx \l_tl_build_result_tl
+ \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:n { }
+ \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 ;
+\cs_new:Npn \__tl_build_unpack_loop:w #1 ;
{
- \if_num:w #1 = \l_tl_build_index_int
- \exp_after:wN \prg_map_break:
+ \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 + \c_one ;
+ \exp_after:wN \__tl_build_unpack_loop:w
+ \int_use:N \__int_eval:w #1 + \c_one ;
}
-\cs_new_protected_nopar:Npn \tl_set_build:Nw
- { \tl_set_build_aux:NNw \tl_set:Nn }
-\cs_new_protected_nopar:Npn \tl_set_build_x:Nw
- { \tl_set_build_aux:NNw \tl_set:Nx }
-\cs_new_protected_nopar:Npn \tl_gset_build:Nw
- { \tl_set_build_aux:NNw \tl_gset:Nn }
-\cs_new_protected_nopar:Npn \tl_gset_build_x:Nw
- { \tl_set_build_aux:NNw \tl_gset:Nx }
-\cs_new_protected:Npn \tl_set_build_aux:NNw #1#2
+\cs_new_protected_nopar:Npn \__tl_build:Nw
+ { \__tl_build_aux:NNw \tl_set:Nn }
+\cs_new_protected_nopar:Npn \__tl_build_x:Nw
+ { \__tl_build_aux:NNw \tl_set:Nx }
+\cs_new_protected_nopar:Npn \__tl_gbuild:Nw
+ { \__tl_build_aux:NNw \tl_gset:Nn }
+\cs_new_protected_nopar: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_nopar:Npn \tl_build_end_assignment:n
+ \cs_set_nopar: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
+ \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_nopar:Npn \tl_build_end:
+\cs_new_protected_nopar:Npn \__tl_build_end:
{
- \tl_build_unpack:
+ \__tl_build_unpack:
\exp_args:No
- \tl_build_end_assignment:n \l_tl_build_result_tl
+ \__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
+\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}
- \tex_advance:D \l_tl_build_index_int \c_one
- \if_num:w \l_tl_build_index_int > \c_max_register_int
- \tl_build_unpack:
- \l_tl_build_index_int \l_tl_build_start_index_int
+ \tex_toks:D \l__tl_build_index_int {#1}
+ \tex_advance:D \l__tl_build_index_int \c_one
+ \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
+\cs_new_protected:Npn \__tl_build_one:o #1
{
- \tex_toks:D \l_tl_build_index_int \exp_after:wN {#1}
- \tex_advance:D \l_tl_build_index_int \c_one
- \if_num:w \l_tl_build_index_int > \c_max_register_int
- \tl_build_unpack:
- \l_tl_build_index_int \l_tl_build_start_index_int
+ \tex_toks:D \l__tl_build_index_int \exp_after:wN {#1}
+ \tex_advance:D \l__tl_build_index_int \c_one
+ \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} } }
+\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 0c88f04de5e..2eeee54d1ab 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/xcoffins/xcoffins.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/xcoffins/xcoffins.sty
@@ -47,25 +47,25 @@
%% -----------------------------------------------------------------------
%%
\RequirePackage{xparse}
-\GetIdInfo$Id: xcoffins.dtx 3483 2012-03-03 18:56:29Z bruno $
+\GetIdInfo$Id: xcoffins.dtx 3876 2012-06-30 15:35:39Z joseph $
{L3 Experimental design-level coffins}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\keys_define:nn { coffin }
{
- coffin1-hpole .tl_set:N = \l_coffin_A_hpole_tl ,
+ coffin1-hpole .tl_set:N = \l__coffin_A_hpole_tl ,
coffin1-hpole .value_required: ,
- coffin1-vpole .tl_set:N = \l_coffin_A_vpole_tl ,
+ coffin1-vpole .tl_set:N = \l__coffin_A_vpole_tl ,
coffin1-vpole .value_required: ,
- coffin2-hpole .tl_set:N = \l_coffin_B_hpole_tl ,
+ coffin2-hpole .tl_set:N = \l__coffin_B_hpole_tl ,
coffin2-hpole .value_required: ,
- coffin2-vpole .tl_set:N = \l_coffin_B_vpole_tl ,
+ coffin2-vpole .tl_set:N = \l__coffin_B_vpole_tl ,
coffin2-vpole .value_required: ,
- grow-bounding-box .bool_set:N = \l_coffin_bound_box_grow_bool ,
+ grow-bounding-box .bool_set:N = \l__coffin_bound_box_grow_bool ,
grow-bounding-box .default:n = true ,
- hoffset .dim_set:N = \l_coffin_hoffset_dim ,
+ hoffset .dim_set:N = \l__coffin_hoffset_dim ,
hoffset .value_required: ,
- voffset .dim_set:N = \l_coffin_voffset_dim ,
+ voffset .dim_set:N = \l__coffin_voffset_dim ,
voffset .value_required:
}
\keys_set:nn { coffin }
@@ -82,10 +82,10 @@
{ \coffin_new:N #1 }
\NewDocumentCommand \BoxToCoffin { m }
{
- \prop_clear_new:c { l_coffin_corners_ \int_value:w #1 _prop }
- \prop_clear_new:c { l_coffin_poles_ \int_value:w #1 _prop }
- \coffin_update_corners:N #1
- \coffin_update_poles:N #1
+ \prop_clear_new:c { l__coffin_corners_ \__int_value:w #1 _prop }
+ \prop_clear_new:c { l__coffin_poles_ \__int_value:w #1 _prop }
+ \__coffin_update_corners:N #1
+ \__coffin_update_poles:N #1
}
\NewDocumentCommand \SetHorizontalCoffin { m +m }
{ \hcoffin_set:Nn #1 {#2} }
@@ -115,22 +115,22 @@
{
\group_begin:
\keys_set:nn { coffin } {#1}
- \tl_set:Nx \l_coffin_tmp_tl
+ \tl_set:Nx \l__coffin_tmp_tl
{
\group_end:
- \bool_if:NTF \l_coffin_bound_box_grow_bool
+ \bool_if:NTF \l__coffin_bound_box_grow_bool
{ \coffin_join:NnnNnnnn }
{ \coffin_attach:NnnNnnnn }
\exp_not:N #3
- { \exp_not:o { \l_coffin_A_hpole_tl } }
- { \exp_not:o { \l_coffin_A_vpole_tl } }
+ { \exp_not:o { \l__coffin_A_hpole_tl } }
+ { \exp_not:o { \l__coffin_A_vpole_tl } }
\exp_not:N #5
- { \exp_not:o { \l_coffin_B_hpole_tl } }
- { \exp_not:o { \l_coffin_B_vpole_tl } }
- { \dim_use:N \l_coffin_hoffset_dim }
- { \dim_use:N \l_coffin_voffset_dim }
+ { \exp_not:o { \l__coffin_B_hpole_tl } }
+ { \exp_not:o { \l__coffin_B_vpole_tl } }
+ { \dim_use:N \l__coffin_hoffset_dim }
+ { \dim_use:N \l__coffin_voffset_dim }
}
- \l_coffin_tmp_tl
+ \l__coffin_tmp_tl
}
}
\NewDocumentCommand \TypesetCoffin
@@ -151,7 +151,7 @@
\NewDocumentCommand \CoffinHeight { m }
{ \coffin_ht:N #1 }
\NewDocumentCommand \CoffinTotalHeight { m }
- { \dim_eval:w \coffin_ht:N #1 + \coffin_dp:N #1 \dim_eval_end: }
+ { \__dim_eval:w \coffin_ht:N #1 + \coffin_dp:N #1 \__dim_eval_end: }
\NewDocumentCommand \CoffinWidth { m }
{ \coffin_wd:N #1 }
\NewDocumentCommand \DisplayCoffinHandles { m m }
diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty
index cb77ed14d8f..dcf3c5871fc 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty
@@ -48,18 +48,15 @@
%% -----------------------------------------------------------------------
%%
\RequirePackage{xparse}
-\GetIdInfo$Id: l3galley.dtx 3325 2012-02-06 22:07:00Z joseph $
+\GetIdInfo$Id: l3galley.dtx 3918 2012-07-05 00:32:37Z bruno $
{L3 Experimental galley code}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
-\package_check_loaded_expl:
-\cs_new_protected_nopar:Npn \galley_leave_vmode:
- { \hbox_unpack:N \c_empty_box }
-\clist_new:N \l_galley_parshape_left_indent_clist
-\clist_new:N \l_galley_parshape_right_indent_clist
-\bool_new:N \l_galley_parshape_multipar_bool
-\bool_new:N \l_galley_parshape_resume_std_bool
-\bool_new:N \l_galley_parshape_fixed_lines_bool
+\clist_new:N \l__galley_parshape_left_indent_clist
+\clist_new:N \l__galley_parshape_right_indent_clist
+\bool_new:N \l__galley_parshape_multipar_bool
+\bool_new:N \l__galley_parshape_resume_std_bool
+\bool_new:N \l__galley_parshape_fixed_lines_bool
\int_new:N \l_galley_parshape_std_lines_int
\cs_new_eq:NN \l_galley_text_width_dim \linewidth
\cs_new_eq:NN \l_galley_total_left_margin_dim \@totalleftmargin
@@ -67,154 +64,154 @@
\int_new:N \l_galley_interpar_penalty_int
\skip_new:N \l_galley_interpar_vspace_skip
\cs_new_eq:NN \l_galley_width_dim \tex_hsize:D
-\bool_new:N \g_galley_begin_level_bool
-\bool_new:N \l_galley_begin_level_bool
+\bool_new:N \g__galley_begin_level_bool
+\bool_new:N \l__galley_begin_level_bool
\bool_new:N \g_galley_omit_next_indent_bool
-\bool_new:N \l_galley_omit_next_indent_bool
-\bool_new:N \g_galley_parshape_set_bool
-\bool_new:N \l_galley_parshape_set_bool
-\bool_new:N \g_galley_nobreak_next_bool
-\bool_new:N \l_galley_nobreak_next_bool
+\bool_new:N \l__galley_omit_next_indent_bool
+\bool_new:N \g__galley_parshape_set_bool
+\bool_new:N \l__galley_parshape_set_bool
+\bool_new:N \g_galley_no_break_next_bool
+\bool_new:N \l__galley_no_break_next_bool
\tl_new:N \g_galley_par_begin_hook_tl
-\tl_new:N \l_galley_par_begin_hook_tl
+\tl_new:N \l__galley_galley_par_begin_hook_tl
\tl_new:N \g_galley_par_end_hook_tl
-\tl_new:N \l_galley_par_end_hook_tl
+\tl_new:N \l__galley_galley_par_end_hook_tl
\tl_new:N \g_galley_par_after_hook_tl
-\tl_new:N \l_galley_par_after_hook_tl
+\tl_new:N \l__galley_par_after_hook_tl
\int_new:N \g_galley_previous_par_lines_int
-\int_new:N \l_galley_previous_par_lines_int
+\int_new:N \l__galley_previous_par_lines_int
\tl_new:N \g_galley_restore_running_tl
-\tl_new:N \l_galley_restore_running_tl
+\tl_new:N \l__galley_restore_running_tl
\tl_new:N \g_galley_whatsit_next_tl
-\tl_new:N \l_galley_whatsit_next_tl
+\tl_new:N \l__galley_whatsit_next_tl
\tl_new:N \g_galley_whatsit_previous_tl
-\tl_new:N \l_galley_whatsit_previous_tl
-\tl_new:N \g_galley_interpar_penalty_user_tl
-\tl_new:N \l_galley_interpar_penalty_user_tl
-\tl_new:N \g_galley_interpar_vspace_user_tl
-\tl_new:N \l_galley_interpar_vspace_user_tl
-\cs_new_protected_nopar:Npn \galley_initialise_variables:
- {
- \bool_gset_true:N \g_galley_begin_level_bool
- \tl_gclear:N \g_galley_interpar_penalty_user_tl
- \tl_gclear:N \g_galley_interpar_vspace_user_tl
+\tl_new:N \l__galley_whatsit_previous_tl
+\tl_new:N \g__galley_interpar_penalty_user_tl
+\tl_new:N \l__galley_interpar_penalty_user_tl
+\tl_new:N \g__galley_interpar_vspace_user_tl
+\tl_new:N \l__galley_interpar_vspace_user_tl
+\cs_new_protected_nopar:Npn \__galley_initialise_variables:
+ {
+ \bool_gset_true:N \g__galley_begin_level_bool
+ \tl_gclear:N \g__galley_interpar_penalty_user_tl
+ \tl_gclear:N \g__galley_interpar_vspace_user_tl
\bool_gset_true:N \g_galley_omit_next_indent_bool
- \bool_gset_false:N \g_galley_nobreak_next_bool
+ \bool_gset_false:N \g_galley_no_break_next_bool
\tl_gclear:N \g_galley_par_begin_hook_tl
\tl_gclear:N \g_galley_par_end_hook_tl
\tl_gclear:N \g_galley_par_after_hook_tl
- \bool_gset_false:N \g_galley_parshape_set_bool
+ \bool_gset_false:N \g__galley_parshape_set_bool
\int_gzero:N \g_galley_previous_par_lines_int
\tl_gclear:N \g_galley_restore_running_tl
\tl_gclear:N \g_galley_whatsit_previous_tl
\tl_gclear:N \g_galley_whatsit_next_tl
}
-\galley_initialise_variables:
-\cs_new_protected_nopar:Npn \galley_initialise_settings:
+\__galley_initialise_variables:
+\cs_new_protected_nopar:Npn \__galley_initialise_settings:
{
\dim_set_eq:NN \l_galley_text_width_dim \l_galley_width_dim
\dim_zero:N \l_galley_total_left_margin_dim
\dim_zero:N \l_galley_total_right_margin_dim
}
-\cs_new_protected_nopar:Npn \galley_save_parameters:
+\cs_new_protected_nopar:Npn \__galley_save_parameters:
{
- \bool_set_eq:NN \l_galley_begin_level_bool
- \g_galley_begin_level_bool
- \tl_set_eq:NN \l_galley_interpar_penalty_user_tl
- \g_galley_interpar_penalty_user_tl
- \tl_set_eq:NN \l_galley_interpar_vspace_user_tl
- \g_galley_interpar_vspace_user_tl
- \bool_set_eq:NN \l_galley_omit_next_indent_bool
+ \bool_set_eq:NN \l__galley_begin_level_bool
+ \g__galley_begin_level_bool
+ \tl_set_eq:NN \l__galley_interpar_penalty_user_tl
+ \g__galley_interpar_penalty_user_tl
+ \tl_set_eq:NN \l__galley_interpar_vspace_user_tl
+ \g__galley_interpar_vspace_user_tl
+ \bool_set_eq:NN \l__galley_omit_next_indent_bool
\g_galley_omit_next_indent_bool
- \bool_set_eq:NN \l_galley_nobreak_next_bool
- \g_galley_nobreak_next_bool
- \tl_set_eq:NN \l_galley_par_begin_hook_tl
+ \bool_set_eq:NN \l__galley_no_break_next_bool
+ \g_galley_no_break_next_bool
+ \tl_set_eq:NN \l__galley_galley_par_begin_hook_tl
\g_galley_par_begin_hook_tl
- \tl_set_eq:NN \l_galley_par_end_hook_tl
+ \tl_set_eq:NN \l__galley_galley_par_end_hook_tl
\g_galley_par_end_hook_tl
- \tl_set_eq:NN \l_galley_par_after_hook_tl
+ \tl_set_eq:NN \l__galley_par_after_hook_tl
\g_galley_par_after_hook_tl
- \bool_set_eq:NN \l_galley_parshape_set_bool
- \g_galley_parshape_set_bool
- \int_set_eq:NN \l_galley_previous_par_lines_int
+ \bool_set_eq:NN \l__galley_parshape_set_bool
+ \g__galley_parshape_set_bool
+ \int_set_eq:NN \l__galley_previous_par_lines_int
\g_galley_previous_par_lines_int
- \tl_set_eq:NN \l_galley_restore_running_tl
+ \tl_set_eq:NN \l__galley_restore_running_tl
\g_galley_restore_running_tl
- \tl_set_eq:NN \l_galley_whatsit_previous_tl
+ \tl_set_eq:NN \l__galley_whatsit_previous_tl
\g_galley_whatsit_previous_tl
- \tl_set_eq:NN \l_galley_whatsit_next_tl
+ \tl_set_eq:NN \l__galley_whatsit_next_tl
\g_galley_whatsit_next_tl
}
-\cs_new_protected_nopar:Npn \galley_restore_parameters:
+\cs_new_protected_nopar:Npn \__galley_restore_parameters:
{
- \bool_gset_eq:NN \g_galley_begin_level_bool
- \l_galley_begin_level_bool
- \tl_gset_eq:NN \g_galley_interpar_penalty_user_tl
- \l_galley_interpar_penalty_user_tl
- \tl_gset_eq:NN \g_galley_interpar_vspace_user_tl
- \l_galley_interpar_vspace_user_tl
+ \bool_gset_eq:NN \g__galley_begin_level_bool
+ \l__galley_begin_level_bool
+ \tl_gset_eq:NN \g__galley_interpar_penalty_user_tl
+ \l__galley_interpar_penalty_user_tl
+ \tl_gset_eq:NN \g__galley_interpar_vspace_user_tl
+ \l__galley_interpar_vspace_user_tl
\bool_gset_eq:NN \g_galley_omit_next_indent_bool
- \l_galley_omit_next_indent_bool
- \bool_gset_eq:NN \g_galley_nobreak_next_bool
- \l_galley_nobreak_next_bool
+ \l__galley_omit_next_indent_bool
+ \bool_gset_eq:NN \g_galley_no_break_next_bool
+ \l__galley_no_break_next_bool
\tl_gset_eq:NN \g_galley_par_begin_hook_tl
- \l_galley_par_begin_hook_tl
+ \l__galley_galley_par_begin_hook_tl
\tl_gset_eq:NN \g_galley_par_end_hook_tl
- \l_galley_par_end_hook_tl
+ \l__galley_galley_par_end_hook_tl
\tl_gset_eq:NN \g_galley_par_after_hook_tl
- \l_galley_par_after_hook_tl
- \bool_gset_eq:NN \g_galley_parshape_set_bool
- \l_galley_parshape_set_bool
+ \l__galley_par_after_hook_tl
+ \bool_gset_eq:NN \g__galley_parshape_set_bool
+ \l__galley_parshape_set_bool
\int_gset_eq:NN \g_galley_previous_par_lines_int
- \l_galley_previous_par_lines_int
+ \l__galley_previous_par_lines_int
\tl_gset_eq:NN \g_galley_restore_running_tl
- \l_galley_restore_running_tl
+ \l__galley_restore_running_tl
\tl_gset_eq:NN \g_galley_whatsit_previous_tl
- \l_galley_whatsit_previous_tl
+ \l__galley_whatsit_previous_tl
\tl_gset_eq:NN \g_galley_whatsit_next_tl
- \l_galley_whatsit_next_tl
+ \l__galley_whatsit_next_tl
}
\cs_new_protected_nopar:Npn \galley_level:
{
- \galley_save_parameters:
+ \__galley_save_parameters:
\group_begin:
- \galley_initialise_variables:
- \galley_initialise_settings:
- \group_insert_after:N \galley_level_end:
+ \__galley_initialise_variables:
+ \__galley_initialise_settings:
+ \group_insert_after:N \__galley_level_end:
}
-\cs_new_protected_nopar:Npn \galley_level_end:
+\cs_new_protected_nopar:Npn \__galley_level_end:
{
\par
- \galley_restore_parameters:
+ \__galley_restore_parameters:
\group_end:
}
-\scan_new:N \s_par_omit
-\cs_new_protected_nopar:Npn \galley_std_par:
+\__scan_new:N \s__par_omit
+\cs_new_protected_nopar:Npn \__galley_std_par:
{
- \s_par_omit
- \exp_after:wN \galley_std_par_aux_i: \tex_romannumeral:D - `0
+ \s__par_omit
+ \exp_after:wN \__galley_std_par_aux_i: \tex_romannumeral:D - `0
}
-\cs_new_protected:Npn \galley_std_par_aux_i:
+\cs_new_protected:Npn \__galley_std_par_aux_i:
{
- \peek_meaning:NTF \s_par_omit
- { \galley_std_par_aux:N }
- { \galley_std_par_aux_ii: }
+ \peek_meaning:NTF \s__par_omit
+ { \__galley_std_par_aux:N }
+ { \__galley_std_par_aux_ii: }
}
-\cs_new_protected:Npn \galley_std_par_aux:N #1
+\cs_new_protected:Npn \__galley_std_par_aux:N #1
{
- \str_if_eq:xxF {#1} { \s_par_omit }
+ \str_if_eq_x:nnF {#1} { \s__par_omit }
{
- \galley_std_par_aux_ii:
+ \__galley_std_par_aux_ii:
#1
}
}
-\cs_new_protected_nopar:Npn \galley_std_par_aux_ii:
+\cs_new_protected_nopar:Npn \__galley_std_par_aux_ii:
{
\mode_if_vertical:TF
{ \tex_par:D }
{
\g_galley_par_end_hook_tl
- \galley_set_measure_and_parshape:
+ \__galley_set_measure_and_parshape:
\group_begin:
\tex_par:D
\group_end:
@@ -224,33 +221,33 @@
\tl_gclear:N \g_galley_par_after_hook_tl
\tex_penalty:D \c_ten_thousand
}
-\cs_new_protected:Npn \galley_end_par:n #1
+\cs_new_protected:Npn \__galley_end_par:n #1
{
- \s_par_omit
- \bool_if:nF \g_galley_begin_level_bool
+ \s__par_omit
+ \bool_if:nF \g__galley_begin_level_bool
{
#1
- \galley_std_par:
+ \__galley_std_par:
}
}
-\cs_set_protected_nopar:Npn \par { \galley_std_par: }
-\tl_set:Nn \@par { \galley_std_par: }
+\cs_set_protected_nopar:Npn \par { \__galley_std_par: }
+\tl_set:Nn \@par { \__galley_std_par: }
\cs_new_protected_nopar:Npn \galley_display_begin:
{
\group_begin:
- \galley_save_parameters:
+ \__galley_save_parameters:
\mode_if_vertical:TF
{
- \galley_display_penalty:N \l_galley_display_begin_par_penalty_tl
- \galley_display_vspace:N \l_galley_display_begin_par_vspace_tl
+ \__galley_display_penalty:N \l_galley_display_begin_par_penalty_tl
+ \__galley_display_vspace:N \l_galley_display_begin_par_vspace_tl
}
{
- \galley_display_penalty:N \l_galley_display_begin_penalty_tl
- \galley_display_vspace:N \l_galley_display_begin_vspace_tl
+ \__galley_display_penalty:N \l_galley_display_begin_penalty_tl
+ \__galley_display_vspace:N \l_galley_display_begin_vspace_tl
}
\par
}
-\cs_new_protected:Npn \galley_display_penalty:N #1
+\cs_new_protected:Npn \__galley_display_penalty:N #1
{
\tl_if_empty:NF #1
{
@@ -262,7 +259,7 @@
\int_gset:Nn \g_galley_penalty_int {#1}
}
}
-\cs_new_protected:Npn \galley_display_vspace:N #1
+\cs_new_protected:Npn \__galley_display_vspace:N #1
{
\tl_if_empty:NF #1
{
@@ -277,34 +274,34 @@
\cs_new_protected_nopar:Npn \galley_display_end:
{
\par
- \galley_restore_parameters:
+ \__galley_restore_parameters:
\group_end:
\group_insert_after:N \group_insert_after:N
- \group_insert_after:N \galley_display_par_setup:
+ \group_insert_after:N \__galley_display_par_setup:
}
-\cs_new_protected_nopar:Npn \galley_display_par_setup:
+\cs_new_protected_nopar:Npn \__galley_display_par_setup:
{
\bool_gset_false:N \g_galley_omit_next_indent_bool
- \cs_set_eq:NN \par \galley_display_par:
+ \cs_set_eq:NN \par \__galley_display_par:
}
-\cs_new_protected_nopar:Npn \galley_display_par:
+\cs_new_protected_nopar:Npn \__galley_display_par:
{
- \cs_set_eq:NN \par \galley_std_par:
+ \cs_set_eq:NN \par \__galley_std_par:
\mode_if_vertical:TF
{
\par
\bool_gset_false:N \g_galley_omit_next_indent_bool
- \galley_display_penalty:N \l_galley_display_end_par_penalty_tl
- \galley_display_vspace:N \l_galley_display_end_par_vspace_tl
+ \__galley_display_penalty:N \l_galley_display_end_par_penalty_tl
+ \__galley_display_vspace:N \l_galley_display_end_par_vspace_tl
}
{
- \galley_set_measure_and_parshape:
+ \__galley_set_measure_and_parshape:
\group_begin:
\tex_par:D
\group_end:
\int_gadd:Nn \g_galley_previous_par_lines_int \tex_prevgraf:D
- \galley_display_penalty:N \l_galley_display_end_penalty_tl
- \galley_display_vspace:N \l_galley_display_end_vspace_tl
+ \__galley_display_penalty:N \l_galley_display_end_penalty_tl
+ \__galley_display_vspace:N \l_galley_display_end_vspace_tl
}
}
\cs_undefine:N \everypar
@@ -313,84 +310,84 @@
{
\tex_everypar:D
{
- \bool_if:NTF \g_galley_begin_level_bool
- { \galley_start_paragraph_first: }
- { \galley_start_paragraph_std: }
+ \bool_if:NTF \g__galley_begin_level_bool
+ { \__galley_start_paragraph_first: }
+ { \__galley_start_paragraph_std: }
\tex_the:D \everypar
}
}
-\box_new:N \g_galley_last_box
-\cs_new_protected_nopar:Npn \galley_start_paragraph_std:
+\box_new:N \g__galley_last_box
+\cs_new_protected_nopar:Npn \__galley_start_paragraph_std:
{
\group_begin:
- \box_gset_to_last:N \g_galley_last_box
+ \box_gset_to_last:N \g__galley_last_box
\tex_par:D
- \galley_insert_vertical_items:
+ \__galley_insert_vertical_items:
\tex_everypar:D { }
\tex_noindent:D
\group_end:
\int_gzero:N \g_galley_previous_par_lines_int
- \galley_insert_horizontal_items:
- \galley_restore_running_parameters:
+ \__galley_insert_horizontal_items:
+ \__galley_restore_running_parameters:
}
-\cs_new_protected_nopar:Npn \galley_start_paragraph_first:
+\cs_new_protected_nopar:Npn \__galley_start_paragraph_first:
{
- \bool_gset_false:N \g_galley_begin_level_bool
+ \bool_gset_false:N \g__galley_begin_level_bool
\mode_if_horizontal:TF
{
\group_begin:
- \box_gset_to_last:N \g_galley_last_box
+ \box_gset_to_last:N \g__galley_last_box
\tex_par:D
- \galley_insert_vspace:
+ \__galley_insert_vspace:
\tex_everypar:D { }
\tex_noindent:D
\group_end:
}
- { \galley_insert_vspace: }
- \galley_insert_horizontal_items:
- \galley_restore_running_parameters:
+ { \__galley_insert_vspace: }
+ \__galley_insert_horizontal_items:
+ \__galley_restore_running_parameters:
}
-\cs_new_protected_nopar:Npn \galley_insert_vertical_items:
+\cs_new_protected_nopar:Npn \__galley_insert_vertical_items:
{
\g_galley_whatsit_previous_tl
\tl_gclear:N \g_galley_whatsit_previous_tl
- \tl_if_empty:NTF \g_galley_interpar_penalty_user_tl
+ \tl_if_empty:NTF \g__galley_interpar_penalty_user_tl
{
- \bool_if:NTF \g_galley_nobreak_next_bool
+ \bool_if:NTF \g_galley_no_break_next_bool
{ \tex_penalty:D \c_ten_thousand }
{ \tex_penalty:D \l_galley_interpar_penalty_int }
}
{
\tex_penalty:D
- \int_eval:w \g_galley_interpar_penalty_user_tl \int_eval_end:
- \tl_gclear:N \g_galley_interpar_penalty_user_tl
+ \__int_eval:w \g__galley_interpar_penalty_user_tl \__int_eval_end:
+ \tl_gclear:N \g__galley_interpar_penalty_user_tl
}
- \bool_gset_false:N \g_galley_nobreak_next_bool
- \galley_insert_vspace:
+ \bool_gset_false:N \g_galley_no_break_next_bool
+ \__galley_insert_vspace:
}
-\cs_new_protected_nopar:Npn \galley_insert_vspace:
+\cs_new_protected_nopar:Npn \__galley_insert_vspace:
{
- \tl_if_empty:NTF \g_galley_interpar_vspace_user_tl
+ \tl_if_empty:NTF \g__galley_interpar_vspace_user_tl
{ \skip_vertical:N \l_galley_interpar_vspace_skip }
{
- \skip_vertical:n { \g_galley_interpar_vspace_user_tl }
- \tl_gclear:N \g_galley_interpar_vspace_user_tl
+ \skip_vertical:n { \g__galley_interpar_vspace_user_tl }
+ \tl_gclear:N \g__galley_interpar_vspace_user_tl
}
}
-\cs_new_protected_nopar:Npn \galley_insert_horizontal_items:
+\cs_new_protected_nopar:Npn \__galley_insert_horizontal_items:
{
\g_galley_whatsit_next_tl
\tl_gclear:N \g_galley_whatsit_next_tl
\bool_if:NF \g_galley_omit_next_indent_bool
{
- \box_if_empty:NF \g_galley_last_box
+ \box_if_empty:NF \g__galley_last_box
{ \hbox_to_wd:nn \l_galley_par_indent_dim { } }
}
\skip_horizontal:N \l_galley_par_begin_skip
\g_galley_par_begin_hook_tl
\bool_gset_false:N \g_galley_omit_next_indent_bool
}
-\cs_new_protected_nopar:Npn \galley_restore_running_parameters:
+\cs_new_protected_nopar:Npn \__galley_restore_running_parameters:
{
\g_galley_restore_running_tl
\tl_gclear:N \g_galley_restore_running_tl
@@ -419,50 +416,50 @@
}
\cs_new_protected:Npn \galley_parshape_fixed_lines:nnn #1#2#3
{
- \bool_gset_true:N \g_galley_parshape_set_bool
- \bool_set_true:N \l_galley_parshape_fixed_lines_bool
+ \bool_gset_true:N \g__galley_parshape_set_bool
+ \bool_set_true:N \l__galley_parshape_fixed_lines_bool
\int_set:Nn \l_galley_parshape_std_lines_int {#1}
- \clist_set:Nn \l_galley_parshape_left_indent_clist {#2}
- \clist_set:Nn \l_galley_parshape_right_indent_clist {#3}
- \bool_set_true:N \l_galley_parshape_resume_std_bool
+ \clist_set:Nn \l__galley_parshape_left_indent_clist {#2}
+ \clist_set:Nn \l__galley_parshape_right_indent_clist {#3}
+ \bool_set_true:N \l__galley_parshape_resume_std_bool
}
\cs_new_protected:Npn \galley_parshape_multi_par:nnnN #1#2#3#4
{
- \bool_gset_true:N \g_galley_parshape_set_bool
- \bool_set_true:N \l_galley_parshape_multipar_bool
- \bool_set_false:N \l_galley_parshape_fixed_lines_bool
+ \bool_gset_true:N \g__galley_parshape_set_bool
+ \bool_set_true:N \l__galley_parshape_multipar_bool
+ \bool_set_false:N \l__galley_parshape_fixed_lines_bool
\int_set:Nn \l_galley_parshape_std_lines_int {#1}
- \clist_set:Nn \l_galley_parshape_left_indent_clist {#2}
- \clist_set:Nn \l_galley_parshape_right_indent_clist {#3}
- \bool_set_eq:NN \l_galley_parshape_resume_std_bool #4
+ \clist_set:Nn \l__galley_parshape_left_indent_clist {#2}
+ \clist_set:Nn \l__galley_parshape_right_indent_clist {#3}
+ \bool_set_eq:NN \l__galley_parshape_resume_std_bool #4
}
\cs_new_protected:Npn \galley_parshape_single_par:nnnN #1#2#3#4
{
- \bool_gset_true:N \g_galley_parshape_set_bool
- \bool_set_false:N \l_galley_parshape_multipar_bool
- \bool_set_false:N \l_galley_parshape_fixed_lines_bool
+ \bool_gset_true:N \g__galley_parshape_set_bool
+ \bool_set_false:N \l__galley_parshape_multipar_bool
+ \bool_set_false:N \l__galley_parshape_fixed_lines_bool
\int_set:Nn \l_galley_parshape_std_lines_int {#1}
- \clist_set:Nn \l_galley_parshape_left_indent_clist {#2}
- \clist_set:Nn \l_galley_parshape_right_indent_clist {#3}
- \bool_set_eq:NN \l_galley_parshape_resume_std_bool #4
+ \clist_set:Nn \l__galley_parshape_left_indent_clist {#2}
+ \clist_set:Nn \l__galley_parshape_right_indent_clist {#3}
+ \bool_set_eq:NN \l__galley_parshape_resume_std_bool #4
}
\cs_generate_variant:Nn \galley_parshape_fixed_lines:nnn { nVV }
\cs_generate_variant:Nn \galley_parshape_multi_par:nnnN { nVV }
\cs_generate_variant:Nn \galley_parshape_single_par:nnnN { nVV }
-\cs_new_protected_nopar:Npn \galley_set_measure_and_parshape:
+\cs_new_protected_nopar:Npn \__galley_set_measure_and_parshape:
{
- \bool_if:NTF \g_galley_parshape_set_bool
+ \bool_if:NTF \g__galley_parshape_set_bool
{
- \bool_if:NTF \l_galley_parshape_fixed_lines_bool
+ \bool_if:NTF \l__galley_parshape_fixed_lines_bool
{
\int_compare:nNnTF \g_galley_previous_par_lines_int > \c_zero
- { \galley_generate_parshape_lines: }
- { \galley_generate_parshape: }
+ { \__galley_generate_parshape_lines: }
+ { \__galley_generate_parshape: }
}
{
- \bool_gset_eq:NN \g_galley_parshape_set_bool
- \l_galley_parshape_multipar_bool
- \galley_generate_parshape:
+ \bool_gset_eq:NN \g__galley_parshape_set_bool
+ \l__galley_parshape_multipar_bool
+ \__galley_generate_parshape:
}
}
{
@@ -473,16 +470,16 @@
\dim_use:N \l_galley_text_width_dim
}
}
-\cs_new_protected_nopar:Npn \galley_generate_parshape:
+\cs_new_protected_nopar:Npn \__galley_generate_parshape:
{
\tex_global:D \tex_parshape:D
- \int_eval:w
+ \__int_eval:w
\l_galley_parshape_std_lines_int +
\int_min:nn
- { \clist_length:N \l_galley_parshape_left_indent_clist }
- { \clist_length:N \l_galley_parshape_right_indent_clist }
- \bool_if:NT \l_galley_parshape_resume_std_bool { + 1 }
- \int_eval_end:
+ { \clist_count:N \l__galley_parshape_left_indent_clist }
+ { \clist_count:N \l__galley_parshape_right_indent_clist }
+ \bool_if:NT \l__galley_parshape_resume_std_bool { + 1 }
+ \__int_eval_end:
\prg_replicate:nn \l_galley_parshape_std_lines_int
{
\dim_use:N \l_galley_total_left_margin_dim
@@ -490,10 +487,10 @@
\dim_use:N \l_galley_text_width_dim
\c_space_tl
}
- \galley_set_parshape_map:oo
- \l_galley_parshape_left_indent_clist
- \l_galley_parshape_right_indent_clist
- \bool_if:NT \l_galley_parshape_resume_std_bool
+ \__galley_set_parshape_map:oo
+ \l__galley_parshape_left_indent_clist
+ \l__galley_parshape_right_indent_clist
+ \bool_if:NT \l__galley_parshape_resume_std_bool
{
\c_space_tl
\dim_use:N \l_galley_total_left_margin_dim
@@ -501,10 +498,10 @@
\dim_use:N \l_galley_text_width_dim
}
}
-\cs_new:Npn \galley_set_parshape_map:nn #1#2
- { \galley_set_parshape_map_aux:nw { } #1 , \q_mark #2 , \q_stop }
-\cs_generate_variant:Nn \galley_set_parshape_map:nn { oo }
-\cs_new:Npn \galley_set_parshape_map_aux:nw #1#2 , #3 \q_mark #4 , #5 \q_stop
+\cs_new:Npn \__galley_set_parshape_map:nn #1#2
+ { \__galley_set_parshape_map_aux:nw { } #1 , \q_mark #2 , \q_stop }
+\cs_generate_variant:Nn \__galley_set_parshape_map:nn { oo }
+\cs_new:Npn \__galley_set_parshape_map_aux:nw #1#2 , #3 \q_mark #4 , #5 \q_stop
{
\bool_if:nTF { \tl_if_empty_p:n {#3} || \tl_if_empty_p:n {#5} }
{
@@ -514,7 +511,7 @@
\dim_eval:n { \l_galley_text_width_dim - ( ( #2 ) + ( #4 ) ) }
}
{
- \galley_set_parshape_map_aux:nw
+ \__galley_set_parshape_map_aux:nw
{
#1
\dim_eval:n { \l_galley_total_left_margin_dim + ( #2 ) }
@@ -525,19 +522,19 @@
#3 \q_mark #5 \q_stop
}
}
-\cs_new_protected_nopar:Npn \galley_generate_parshape_lines:
+\cs_new_protected_nopar:Npn \__galley_generate_parshape_lines:
{
\int_compare:nNnTF \tex_parshape:D > \g_galley_previous_par_lines_int
{
\tex_global:D \tex_parshape:D
- \int_eval:w \tex_parshape:D - \g_galley_previous_par_lines_int
- \int_eval_end:
- \prg_stepwise_function:nnnN
+ \__int_eval:w \tex_parshape:D - \g_galley_previous_par_lines_int
+ \__int_eval_end:
+ \int_step_function:nnnN
{ \g_galley_previous_par_lines_int + \c_one }
- \c_one \tex_parshape:D \galley_generate_parshape_lines_aux:n
+ \c_one \tex_parshape:D \__galley_generate_parshape_lines:n
}
{
- \bool_gset_false:N \g_galley_parshape_set_bool
+ \bool_gset_false:N \g__galley_parshape_set_bool
\tex_global:D \tex_parshape:D
\c_one
\dim_use:N \l_galley_total_left_margin_dim
@@ -545,16 +542,16 @@
\dim_use:N \l_galley_text_width_dim
}
}
-\cs_new:Npn \galley_generate_parshape_lines_aux:n #1
+\cs_new:Npn \__galley_generate_parshape_lines:n #1
{
\etex_parshapeindent:D #1
~
\etex_parshapelength:D #1
}
\cs_new_protected:Npn \galley_set_user_penalty:n #1
- { \tl_gset:Nx \g_galley_interpar_penalty_user_tl { \int_eval:n {#1} } }
+ { \tl_gset:Nx \g__galley_interpar_penalty_user_tl { \int_eval:n {#1} } }
\cs_new_protected:Npn \galley_set_user_vspace:n #1
- { \tl_gset:Nx \g_galley_interpar_vspace_user_tl { \skip_eval:n {#1} } }
+ { \tl_gset:Nx \g__galley_interpar_vspace_user_tl { \skip_eval:n {#1} } }
\dim_set:Nn \parskip \c_zero_dim
\cs_undefine:N \parskip
\skip_new:N \parskip
@@ -591,7 +588,7 @@
\cs_new_protected:Npn \galley_break_line:Nn #1#2
{
\mode_if_vertical:TF
- { \msg_kernel_error:nn { galley } { no-line-to-end } }
+ { \__msg_kernel_error:nn { galley } { no-line-to-end } }
{
\tex_unskip:D
\bool_if:NF #1
@@ -614,7 +611,7 @@
\cs_new_protected:Npn \galley_set_display_widow_penalties:n #1
{
\etex_displaywidowpenalties:D
- \int_eval:w \clist_length:n {#1} + \c_one \int_eval_end:
+ \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end:
\clist_map_function:nN {#1} \galley_set_aux:n
\c_zero
}
@@ -622,7 +619,7 @@
\cs_new_protected:Npn \galley_set_widow_penalties:n #1
{
\etex_widowpenalties:D
- \int_eval:w \clist_length:n {#1} + \c_one \int_eval_end:
+ \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end:
\clist_map_function:nN {#1} \galley_set_aux:n
\c_zero
}
@@ -631,107 +628,105 @@
\cs_new_protected:Npn \galley_set_club_penalties:n #1
{
\clist_set:Nn \l_galley_club_penalties_clist {#1}
- \galley_calc_interline_penalties:
+ \__galley_calc_interline_penalties:
}
\cs_generate_variant:Nn \galley_set_club_penalties:n { V , v }
\cs_new_protected:Npn \galley_set_interline_penalties:n #1
{
\clist_set:Nn \l_galley_line_penalties_clist {#1}
- \galley_calc_interline_penalties:
+ \__galley_calc_interline_penalties:
}
\cs_generate_variant:Nn \galley_set_interline_penalties:n { V , v }
\cs_new_protected:Npn \galley_set_display_club_penalties:n #1
{
\etex_clubpenalties:D
- \int_eval:w \clist_length:n {#1} + \c_one \int_eval_end:
+ \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end:
\clist_map_function:nN {#1} \galley_set_aux:n
\c_zero
- \galley_calc_interline_penalties:
+ \__galley_calc_interline_penalties:
}
\cs_generate_variant:Nn \galley_set_display_club_penalties:n { V , v }
\cs_new_protected:Npn \galley_set_interline_penalty:n #1
{
\int_compare:nNnTF { \etex_interlinepenalties:D \c_zero } = \c_zero
{
- \etex_interlinepenalties:D \c_one \int_eval:w #1 \int_eval_end:
- \galley_calc_interline_penalties:
+ \etex_interlinepenalties:D \c_one \__int_eval:w #1 \__int_eval_end:
+ \__galley_calc_interline_penalties:
}
{
- \cs_set:Npn \galley_set_interline_penalty_aux_ii:n ##1
+ \cs_set:Npn \__galley_set_interline_penalty_ii:n ##1
{
- \int_eval:w
+ \__int_eval:w
\etex_interlinepenalties:D ##1
- \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero
+ #1
- \int_eval_end:
+ \__int_eval_end:
}
- \exp_args:Nf \galley_set_interline_penalty_aux:nn
- { \clist_length:N \l_galley_line_penalties_clist } {#1}
+ \exp_args:Nf \__galley_set_interline_penalty:nn
+ { \clist_count:N \l_galley_line_penalties_clist } {#1}
}
}
-\cs_new_protected:Npn \galley_set_interline_penalty_aux:nn #1#2
+\cs_new_protected:Npn \__galley_set_interline_penalty:nn #1#2
{
\etex_interlinepenalties:D
\etex_interlinepenalties:D \c_zero
- \prg_stepwise_function:nnnN \c_one \c_one {#1}
- \galley_set_interline_penalty_aux_i:n
- \prg_stepwise_function:nnnN { #1 + \c_one } \c_one
+ \int_step_function:nnnN \c_one \c_one {#1}
+ \__galley_set_interline_penalty_i:n
+ \int_step_function:nnnN { #1 + \c_one } \c_one
{ \etex_interlinepenalties:D \c_zero - \c_one }
- \galley_set_interline_penalty_aux_ii:n
- \int_eval:w #2 \int_eval_end:
+ \__galley_set_interline_penalty_ii:n
+ \__int_eval:w #2 \__int_eval_end:
}
-\cs_new:Npn \galley_set_interline_penalty_aux_i:n #1
- { \etex_interlinepenalties:D \int_eval:w #1 \int_eval_end: }
-\cs_new:Npn \galley_set_interline_penalty_aux_ii:n #1 { }
-\cs_new_protected_nopar:Npn \galley_calc_interline_penalties:
+\cs_new:Npn \__galley_set_interline_penalty_i:n #1
+ { \etex_interlinepenalties:D \__int_eval:w #1 \__int_eval_end: }
+\cs_new:Npn \__galley_set_interline_penalty_ii:n #1 { }
+\cs_new_protected_nopar:Npn \__galley_calc_interline_penalties:
{
- \exp_args:Nff \galley_calc_interline_penalties_aux:nn
+ \exp_args:Nff \__galley_calc_interline_penalties:nn
{
\int_eval:n
{
\int_max:nn
{
- \clist_length:N \l_galley_club_penalties_clist
+ \clist_count:N \l_galley_club_penalties_clist
+ \c_one
}
{
\int_max:nn
{
- \clist_length:N \l_galley_line_penalties_clist
+ \clist_count:N \l_galley_line_penalties_clist
+ \c_one
}
{ \etex_clubpenalties:D \c_zero }
}
}
}
- { \clist_length:N \l_galley_line_penalties_clist }
+ { \clist_count:N \l_galley_line_penalties_clist }
}
-\cs_new_protected:Npn \galley_calc_interline_penalties_aux:nn #1#2
+\cs_new_protected:Npn \__galley_calc_interline_penalties:nn #1#2
{
\etex_interlinepenalties:D #1 ~
- \prg_stepwise_function:nnnN \c_one \c_one {#2}
- \galley_calc_interline_penalties_aux_i:n
- \prg_stepwise_function:nnnN { #2 + \c_one } \c_one { #1 - \c_one }
- \galley_calc_interline_penalties_aux_ii:n
+ \int_step_function:nnnN \c_one \c_one {#2}
+ \__galley_calc_interline_penalties_i:n
+ \int_step_function:nnnN { #2 + \c_one } \c_one { #1 - \c_one }
+ \__galley_calc_interline_penalties_ii:n
\etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero
}
-\cs_new:Npn \galley_calc_interline_penalties_aux_i:n #1
+\cs_new:Npn \__galley_calc_interline_penalties_i:n #1
{
- \int_eval:w
- \clist_item:Nn \l_galley_line_penalties_clist { #1 - \c_one }
- + 0 \clist_item:Nn \l_galley_club_penalties_clist
- { #1 - \c_one }
+ \__int_eval:w
+ \clist_item:Nn \l_galley_line_penalties_clist {#1}
+ + 0 \clist_item:Nn \l_galley_club_penalties_clist {#1}
- \etex_clubpenalties:D #1 ~
- \int_eval_end:
+ \__int_eval_end:
}
-\cs_new:Npn \galley_calc_interline_penalties_aux_ii:n #1
+\cs_new:Npn \__galley_calc_interline_penalties_ii:n #1
{
- \int_eval:w
+ \__int_eval:w
\etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero
- + 0 \clist_item:Nn \l_galley_club_penalties_clist
- { #1 - \c_one }
+ + 0 \clist_item:Nn \l_galley_club_penalties_clist {#1}
- \etex_clubpenalties:D #1 ~
- \int_eval_end:
+ \__int_eval_end:
}
\cs_new_protected:Npn \galley_save_club_penalties:N #1
{ \clist_set_eq:NN #1 \l_galley_club_penalties_clist }
@@ -741,38 +736,38 @@
{
\clist_set:Nx #1
{
- \prg_stepwise_function:nnnN \c_one \c_one
+ \int_step_function:nnnN \c_one \c_one
{ \etex_clubpenalties:D \c_zero - \c_one }
\galley_save_display_club_penalties:_aux:n
}
}
\cs_new:Npn \galley_save_display_club_penalties:_aux:n #1
- { \int_use:N \etex_clubpenaltes:D \int_eval:w #1 \int_eval_end: , }
+ { \int_use:N \etex_clubpenaltes:D \__int_eval:w #1 \__int_eval_end: , }
\cs_new_protected:Npn \galley_save_display_widow_penalties:N #1
{
\clist_set:Nx #1
{
- \prg_stepwise_function:nnnN \c_one \c_one
+ \int_step_function:nnnN \c_one \c_one
{ \etex_displaywidowpenalties:D \c_zero - \c_one }
\galley_save_display_widow_penalties:_aux:n
}
}
\cs_new:Npn \galley_save_display_widow_penalties:_aux:n #1
- { \int_use:N \etex_displaywidowpenalties:D \int_eval:w #1 \int_eval_end: , }
+ { \int_use:N \etex_displaywidowpenalties:D \__int_eval:w #1 \__int_eval_end: , }
\cs_new_protected:Npn \galley_save_widow_penalties:N #1
{
\clist_set:Nx #1
{
- \prg_stepwise_function:nnnN \c_one \c_one
+ \int_step_function:nnnN \c_one \c_one
{ \etex_widowpenalties:D \c_zero - \c_one }
\galley_save_widow_penalties:_aux:n
}
}
\cs_new:Npn \galley_save_widow_penalties:_aux:n #1
- { \int_use:N \etex_widowpenalties:D \int_eval:w #1 \int_eval_end: , }
+ { \int_use:N \etex_widowpenalties:D \__int_eval:w #1 \__int_eval_end: , }
\cs_new_protected_nopar:Npn \galley_interline_penalty:
{ \int_use:N \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero }
-\msg_kernel_new:nnn { galley } { no-line-to-end }
+\__msg_kernel_new:nnn { galley } { no-line-to-end }
{ There's~no~line~here~to~end. }
\RenewDocumentCommand \clearpage { }
{
@@ -807,7 +802,7 @@
{ \galley_break_line:Nn #1 {#2} }
\RenewDocumentCommand \newline { }
{ \galley_break_line:Nn \c_true_bool { 0 pt } }
-\cs_set_eq:NN \@@par \galley_std_par:
+\cs_set_eq:NN \__galleypar \__galley_std_par:
\cs_set_protected_nopar:Npn \@afterheading
{
\bool_gset_true:N \g_galley_no_break_next_bool
diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty
index 3e3d251791a..31fe465cef3 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty
@@ -48,13 +48,13 @@
%% -----------------------------------------------------------------------
%%
\RequirePackage{l3names}
-\GetIdInfo$Id: xgalley.dtx 3253 2012-01-28 14:59:55Z joseph $
+\GetIdInfo$Id: xgalley.dtx 3879 2012-07-01 09:17:47Z joseph $
{L3 Experimental galley}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\RequirePackage{xparse,xtemplate,l3galley}
-\clist_new:N \l_galley_tmpa_clist
-\clist_new:N \l_galley_tmpb_clist
+\clist_new:N \l__galley_tmpa_clist
+\clist_new:N \l__galley_tmpb_clist
\DeclareObjectType { measure } { 0 }
\DeclareTemplateInterface { measure } { absolute } { 0 }
{
@@ -66,27 +66,27 @@
left-margin : length = 0 pt ,
right-margin : length = 0 pt
}
-\cs_new_eq:NN \l_galley_left_margin_dim \leftmargin
-\cs_new_eq:NN \l_galley_right_margin_dim \rightmargin
+\cs_new_eq:NN \l__galley_left_margin_dim \leftmargin
+\cs_new_eq:NN \l__galley_right_margin_dim \rightmargin
\DeclareTemplateCode { measure } { absolute } { 0 }
{
- left-margin = \l_galley_left_margin_dim ,
- right-margin = \l_galley_right_margin_dim
+ left-margin = \l__galley_left_margin_dim ,
+ right-margin = \l__galley_right_margin_dim
}
{
\AssignTemplateKeys
- \galley_margins_set_absolute:nn \l_galley_left_margin_dim
- \l_galley_right_margin_dim
+ \galley_margins_set_absolute:nn \l__galley_left_margin_dim
+ \l__galley_right_margin_dim
}
\DeclareTemplateCode { measure } { relative } { 0 }
{
- left-margin = \l_galley_left_margin_dim ,
- right-margin = \l_galley_right_margin_dim
+ left-margin = \l__galley_left_margin_dim ,
+ right-margin = \l__galley_right_margin_dim
}
{
\AssignTemplateKeys
- \galley_margins_set_relative:nn \l_galley_left_margin_dim
- \l_galley_right_margin_dim
+ \galley_margins_set_relative:nn \l__galley_left_margin_dim
+ \l__galley_right_margin_dim
}
\DeclareObjectType { parshape } { 0 }
\DeclareTemplateInterface { parshape } { hang } { 0 }
@@ -103,58 +103,58 @@
}
\DeclareTemplateCode { parshape } { hang } { 0 }
{
- indent = \l_galley_parshape_indent_dim ,
- on-left-side = \l_galley_parshape_on_left_bool ,
- lines = \l_galley_parshape_lines_int
+ indent = \l__galley_parshape_indent_dim ,
+ on-left-side = \l__galley_parshape_on_left_bool ,
+ lines = \l__galley_parshape_lines_int
}
{
\AssignTemplateKeys
- \bool_if:NTF \l_galley_parshape_on_left_bool
+ \bool_if:NTF \l__galley_parshape_on_left_bool
{
\galley_parshape_single_par:nVVN
- \l_galley_parshape_lines_int
- \l_galley_parshape_indent_dim
+ \l__galley_parshape_lines_int
+ \l__galley_parshape_indent_dim
\c_zero_dim
\c_false_bool
}
{
\galley_parshape_single_par:nVVN
- \l_galley_parshape_lines_int
+ \l__galley_parshape_lines_int
\c_zero_dim
- \l_galley_parshape_indent_dim
+ \l__galley_parshape_indent_dim
\c_false_bool
}
}
\DeclareTemplateCode { parshape } { initial } { 0 }
{
- indent = \l_galley_parshape_indent_dim ,
- on-left-side = \l_galley_parshape_on_left_bool ,
- lines = \l_galley_parshape_lines_int
+ indent = \l__galley_parshape_indent_dim ,
+ on-left-side = \l__galley_parshape_on_left_bool ,
+ lines = \l__galley_parshape_lines_int
}
{
\AssignTemplateKeys
- \clist_clear:N \l_galley_tmpa_clist
- \clist_clear:N \l_galley_tmpb_clist
- \prg_replicate:nn { \l_galley_parshape_lines_int }
+ \clist_clear:N \l__galley_tmpa_clist
+ \clist_clear:N \l__galley_tmpb_clist
+ \prg_replicate:nn { \l__galley_parshape_lines_int }
{
- \clist_put_right:Nn \l_galley_tmpa_clist
- { \l_galley_parshape_indent_dim }
- \clist_put_right:Nn \l_galley_tmpb_clist
+ \clist_put_right:Nn \l__galley_tmpa_clist
+ { \l__galley_parshape_indent_dim }
+ \clist_put_right:Nn \l__galley_tmpb_clist
{ \c_zero_dim }
}
- \bool_if:NTF \l_galley_parshape_on_left_bool
+ \bool_if:NTF \l__galley_parshape_on_left_bool
{
\galley_parshape_single_par:nVVN
\c_zero
- \l_galley_tmpa_clist
- \l_galley_tmpb_clist
+ \l__galley_tmpa_clist
+ \l__galley_tmpb_clist
\c_true_bool
}
{
\galley_parshape_single_par:nVVN
\c_zero
- \l_galley_tmpb_clist
- \l_galley_tmpa_clist
+ \l__galley_tmpb_clist
+ \l__galley_tmpa_clist
\c_true_bool
}
}
@@ -207,7 +207,7 @@
}
\UseTemplate { hyphenation } { std } { }
\tex_defaulthyphenchar:D 45 \scan_stop:
-\tl_new:N \l_galley_justification_other_tl
+\tl_new:N \l__galley_justification_other_tl
\DeclareObjectType { justification } { 0 }
\DeclareTemplateInterface { justification } { std } { 0 }
{
@@ -241,7 +241,7 @@
}
{
\AssignTemplateKeys
- \tl_clear:N \l_galley_justification_other_tl
+ \tl_clear:N \l__galley_justification_other_tl
\galley_set_interword_spacing:N \l_galley_fixed_spacing_bool
\bool_if:NTF \l_galley_par_stretch_last_bool
{ \int_set_eq:NN \l_galley_last_line_fit_int \c_one_thousand }
@@ -259,7 +259,7 @@
stretch-last-line = \l_galley_par_stretch_last_bool
}
{
- \tl_put_left:Nx \l_galley_justification_other_tl
+ \tl_put_left:Nx \l__galley_justification_other_tl
{
\skip_set:Nn \exp_not:N \l_galley_par_end_skip
{ \skip_use:N \l_galley_par_end_skip }
@@ -282,7 +282,7 @@
{ \skip_use:N \l_galley_line_right_skip }
}
\tl_gput_right:Nn \g_galley_restore_running_tl
- { \l_galley_justification_other_tl }
+ { \l__galley_justification_other_tl }
\AssignTemplateKeys
\galley_set_interword_spacing:N \l_galley_fixed_spacing_bool
\bool_if:NTF \l_galley_par_stretch_last_bool
@@ -337,16 +337,16 @@
}
\DeclareTemplateCode { justification } { compound } { 0 }
{
- first-paragraph = \galley_justification_first: ,
- other-paragraphs = \galley_justification_other:
+ first-paragraph = \__galley_justification_first: ,
+ other-paragraphs = \__galley_justification_other:
}
{
\AssignTemplateKeys
- \galley_justification_first:
- \tl_set:Nn \l_galley_justification_other_tl
- { \galley_justification_other: }
+ \__galley_justification_first:
+ \tl_set:Nn \l__galley_justification_other_tl
+ { \__galley_justification_other: }
\tl_gput_right:Nn \g_galley_restore_running_tl
- { \l_galley_justification_other_tl }
+ { \l__galley_justification_other_tl }
}
\DeclareObjectType { line-breaking } { 0 }
\DeclareTemplateInterface { line-breaking } { std } { 0 }
@@ -366,15 +366,15 @@
\DeclareTemplateCode{ line-breaking } { std } { 0 }
{
badness = \l_galley_linebreak_badness_int ,
- binop-penalty = \l_galley_binop_penalty_int ,
+ binop-penalty = \l__galley_binop_penalty_int ,
double-hyphen-demerits = \l_galley_double_hyphen_demerits_int ,
emergency-stretch = \l_galley_emergency_stretch_skip ,
final-hyphen-demerits = \l_galley_final_hyphen_demerits_int ,
fuzz = \l_galley_linebreak_fuzz_dim ,
- line-penalty = \l_galley_linebreak_penalty_int ,
+ line-penalty = \l__galley_linebreak_penalty_int ,
mismatch-demerits = \l_galley_mismatch_demerits_int ,
pretolerance = \l_galley_linebreak_pretolerance_int ,
- relation-penalty = \l_galley_relation_penalty_int ,
+ relation-penalty = \l__galley_relation_penalty_int ,
tolerance = \l_galley_linebreak_tolerance_int
}
{ \AssignTemplateKeys }
@@ -397,23 +397,23 @@
\DeclareTemplateCode { paragraph-breaking } { std } { 0 }
{
badness = \l_galley_parbreak_badness_int ,
- broken-penalty = \l_galley_broken_penalty_int ,
- club-penalty = \l_galley_club_penalty_int ,
- display-club-penalty = \l_galley_display_club_penalty_int ,
- display-widow-penalty = \l_galley_display_widow_penalty_int ,
+ broken-penalty = \l__galley_broken_penalty_int ,
+ club-penalty = \l__galley_club_penalty_int ,
+ display-club-penalty = \l__galley_display_club_penalty_int ,
+ display-widow-penalty = \l__galley_display_widow_penalty_int ,
fuzz = \l_galley_parbreak_fuzz_dim ,
- interline-penalty = \l_galley_interline_penalty_int ,
- post-display-penalty = \l_galley_post_display_penalty_int ,
- pre-display-penalty = \l_galley_pre_display_penalty_int ,
- widow-penalty = \l_galley_widow_penalty_int
+ interline-penalty = \l__galley_interline_penalty_int ,
+ post-display-penalty = \l__galley_post_display_penalty_int ,
+ pre-display-penalty = \l__galley_pre_display_penalty_int ,
+ widow-penalty = \l__galley_widow_penalty_int
}
{
\AssignTemplateKeys
- \galley_set_club_penalties:V \l_galley_club_penalty_int
- \galley_set_display_club_penalties:V \l_galley_display_club_penalty_int
- \galley_set_display_widow_penalties:V \l_galley_display_widow_penalty_int
- \galley_set_interline_penalty:n \l_galley_interline_penalty_int
- \galley_set_widow_penalties:V \l_galley_widow_penalty_int
+ \galley_set_club_penalties:V \l__galley_club_penalty_int
+ \galley_set_display_club_penalties:V \l__galley_display_club_penalty_int
+ \galley_set_display_widow_penalties:V \l__galley_display_widow_penalty_int
+ \galley_set_interline_penalty:n \l__galley_interline_penalty_int
+ \galley_set_widow_penalties:V \l__galley_widow_penalty_int
}
\DeclareInstance { paragraph-breaking } { std } { std } { }
\UseInstance { paragraph-breaking } { std }
@@ -444,39 +444,39 @@
}
\DeclareTemplateCode { paragraph-breaking } { single } { 0 }
{
- badness = \l_galley_parbreak_badness_tl ,
- broken-penalty = \l_galley_broken_penalty_tl ,
- club-penalty = \l_galley_club_penalties_tl ,
- display-club-penalty = \l_galley_display_club_penalties_tl ,
- display-widow-penalty = \l_galley_display_widow_penalties_tl ,
- fuzz = \l_galley_parbreak_fuzz_tl ,
- interline-penalty = \l_galley_interline_penalty_tl ,
- post-display-penalty = \l_galley_post_display_penalty_tl ,
- pre-display-penalty = \l_galley_pre_display_penalty_tl ,
- widow-penalty = \l_galley_widow_penalties_tl
+ badness = \l__galley_parbreak_badness_tl ,
+ broken-penalty = \l__galley_broken_penalty_tl ,
+ club-penalty = \l__galley_club_penalties_tl ,
+ display-club-penalty = \l__galley_display_club_penalties_tl ,
+ display-widow-penalty = \l__galley_display_widow_penalties_tl ,
+ fuzz = \l__galley_parbreak_fuzz_tl ,
+ interline-penalty = \l__galley_interline_penalty_tl ,
+ post-display-penalty = \l__galley_post_display_penalty_tl ,
+ pre-display-penalty = \l__galley_pre_display_penalty_tl ,
+ widow-penalty = \l__galley_widow_penalties_tl
}
{
\AssignTemplateKeys
- \tl_if_empty:NF \l_galley_interline_penalty_tl
+ \tl_if_empty:NF \l__galley_interline_penalty_tl
{
\tl_gput_right:Nx \g_galley_par_after_hook_tl
{
- \int_set:Nn \exp_not:N \l_galley_interline_penalty_int
+ \int_set:Nn \exp_not:N \l__galley_interline_penalty_int
{ \galley_interline_penalty: }
}
- \int_set:Nn \l_galley_interline_penalty_int
- { \l_galley_interline_penalty_tl }
+ \int_set:Nn \l__galley_interline_penalty_int
+ { \l__galley_interline_penalty_tl }
}
- \tl_if_empty:NF \l_galley_parbreak_fuzz_tl
+ \tl_if_empty:NF \l__galley_parbreak_fuzz_tl
{
\tl_gput_right:Nx \g_galley_par_after_hook_tl
{
\dim_set:Nn \exp_not:N \l_galley_parbreak_fuzz_dim
{ \dim_use:N \l_galley_parbreak_fuzz_dim }
}
- \dim_set:Nn \l_galley_parbreak_fuzz_dim { \l_galley_parbreak_fuzz_tl }
+ \dim_set:Nn \l_galley_parbreak_fuzz_dim { \l__galley_parbreak_fuzz_tl }
}
- \seq_map_inline:Nn \c_galley_parbreak_single_seq
+ \seq_map_inline:Nn \c__galley_parbreak_single_seq
{
\tl_if_empty:cF { l_galley_ ##1 _tl }
{
@@ -489,30 +489,30 @@
{ \tl_use:c { l_galley_ ##1 _tl } }
}
}
- \seq_map_inline:Nn \c_galley_parbreak_multi_seq
+ \seq_map_inline:Nn \c__galley_parbreak_multi_seq
{
\tl_if_empty:cF { l_galley_ ##1 _tl }
{
- \use:c { galley_save_ ##1 :N } \l_galley_tmpa_clist
+ \use:c { galley_save_ ##1 :N } \l__galley_tmpa_clist
\tl_gput_right:Nx \g_galley_par_after_hook_tl
{
\exp_not:c { galley_set_ ##1 :n }
- { \exp_not:o \l_galley_tmpa_clist }
+ { \exp_not:o \l__galley_tmpa_clist }
}
\use:c { galley_set_ ##1 :v } { l_galley_ ##1 _tl }
}
}
}
-\seq_new:N \c_galley_parbreak_multi_seq
-\seq_gput_right:Nn \c_galley_parbreak_multi_seq { club_penalties }
-\seq_gput_right:Nn \c_galley_parbreak_multi_seq { display_club_penalties }
-\seq_gput_right:Nn \c_galley_parbreak_multi_seq { display_widow_penalties }
-\seq_gput_right:Nn \c_galley_parbreak_multi_seq { widow_penalties }
-\seq_new:N \c_galley_parbreak_single_seq
-\seq_gput_right:Nn \c_galley_parbreak_single_seq { parbreak_badness }
-\seq_gput_right:Nn \c_galley_parbreak_single_seq { broken_penalty }
-\seq_gput_right:Nn \c_galley_parbreak_single_seq { post_display_penalty }
-\seq_gput_right:Nn \c_galley_parbreak_single_seq { pre_display_penalty }
+\seq_new:N \c__galley_parbreak_multi_seq
+\seq_gput_right:Nn \c__galley_parbreak_multi_seq { club_penalties }
+\seq_gput_right:Nn \c__galley_parbreak_multi_seq { display_club_penalties }
+\seq_gput_right:Nn \c__galley_parbreak_multi_seq { display_widow_penalties }
+\seq_gput_right:Nn \c__galley_parbreak_multi_seq { widow_penalties }
+\seq_new:N \c__galley_parbreak_single_seq
+\seq_gput_right:Nn \c__galley_parbreak_single_seq { parbreak_badness }
+\seq_gput_right:Nn \c__galley_parbreak_single_seq { broken_penalty }
+\seq_gput_right:Nn \c__galley_parbreak_single_seq { post_display_penalty }
+\seq_gput_right:Nn \c__galley_parbreak_single_seq { pre_display_penalty }
\DeclareInstance { paragraph-breaking } { single-std } { single } { }
\DeclareInstance { paragraph-breaking } { single-nobreak } { single }
{