[latex3-commits] [latex3/latex3] gh890: Apply suggestions from code review (be6416377)
github at latex-project.org
github at latex-project.org
Wed Nov 27 16:57:00 CET 2024
Repository : https://github.com/latex3/latex3
On branch : gh890
Link : https://github.com/latex3/latex3/commit/be64163776a24631a6288baf6681aaef3389a489
>---------------------------------------------------------------
commit be64163776a24631a6288baf6681aaef3389a489
Author: Joseph Wright <joseph at texdev.net>
Date: Wed Nov 27 15:57:00 2024 +0000
Apply suggestions from code review
Co-authored-by: Yukai Chou <muzimuzhi at gmail.com>
>---------------------------------------------------------------
be64163776a24631a6288baf6681aaef3389a489
l3kernel/l3seq.dtx | 21 +++++++++++----------
l3kernel/l3tl.dtx | 12 ++++++------
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/l3kernel/l3seq.dtx b/l3kernel/l3seq.dtx
index 45ae5be6e..ccff2eab3 100644
--- a/l3kernel/l3seq.dtx
+++ b/l3kernel/l3seq.dtx
@@ -200,11 +200,11 @@
% \cs{seq_set_regex_extract:Nnn} \meta{seq~var} \Arg{regex} \Arg{token list}
% \cs{seq_set_regex_extract:NNn} \meta{seq~var} \meta{regex~var} \Arg{token list}
% \end{syntax}
-% Finds the first match of the \meta{regular expression} in the
-% \meta{token list}. If it exists, the match is stored as the first
-% item of the \meta{seq~var}, and further items are the contents of
-% capturing groups, in the order of their opening parenthesis. If
-% there is no match, the \meta{seq~var} is cleared.
+% Finds all matches of the \meta{regular expression} in the
+% \meta{token list}, and stores all the submatch information in a
+% single sequence (concatenating the results of multiple
+% \cs{regex_extract_once:nnN} calls). If there is no match, the
+% \meta{seq~var} is cleared.
% See \pkg{l3regex} chapter for more details of the \meta{regex}
% format.
% \end{function}
@@ -218,12 +218,12 @@
% }
% \begin{syntax}
% \cs{seq_set_regex_split:Nnn} \meta{seq~var} \Arg{regex} \Arg{token list}
-% \cs{seq_set_regex_split:NNn} \meta{seq~var} \Arg{regex~var} \Arg{token list}
+% \cs{seq_set_regex_split:NNn} \meta{seq~var} \meta{regex~var} \Arg{token list}
% \end{syntax}
% Splits the \meta{token list} into a sequence of parts, delimited by
% matches of the \meta{regular expression}. If the \meta{regular expression}
% has capturing groups, then the token lists that they match are stored as
-% items of the sequence as well. The assignment to \meta{seq~var} is local.
+% items of the sequence as well.
% If no match is found the resulting \meta{seq~var} has the
% \meta{token list} as its sole item. If the \meta{regular expression}
% matches the empty token list, then the \meta{token list} is split
@@ -1482,7 +1482,7 @@
% }
% \begin{macrocode}
\cs_new_protected:Npn \seq_set_regex_extract:Nnn #1#2#3
- { \regex_extract_all:nnN {#3} {#2} #1 }
+ { \regex_extract_all:nnN {#2} {#3} #1 }
\cs_generate_variant:Nn \seq_set_regex_extract:Nnn { c }
\cs_new_protected:Npn \seq_gset_regex_extract:Nnn #1#2#3
{
@@ -1494,7 +1494,7 @@
}
\cs_generate_variant:Nn \seq_gset_regex_extract:Nnn { c }
\cs_new_protected:Npn \seq_set_regex_extract:NNn #1#2#3
- { \regex_extract_all:NnN {#3} {#2} #1 }
+ { \regex_extract_all:NnN #2 {#3} #1 }
\cs_generate_variant:Nn \seq_set_regex_extract:NNn { c }
\cs_new_protected:Npn \seq_gset_regex_extract:NNn #1#2#3
{
@@ -1504,6 +1504,7 @@
\seq_gset_eq:NN #1 \l_@@_internal_a_tl
\group_end:
}
+\cs_generate_variant:Nn \seq_gset_regex_extract:NNn { c }
\cs_new_protected:Npn \seq_set_regex_split:Nnn #1#2#3
{ \regex_split:nnN {#3} {#2} #1 }
\cs_generate_variant:Nn \seq_set_regex_split:Nnn { c }
@@ -1517,7 +1518,7 @@
}
\cs_generate_variant:Nn \seq_gset_regex_split:Nnn { c }
\cs_new_protected:Npn \seq_set_regex_split:NNn #1#2#3
- { \regex_split:NnN {#3} {#2} #1 }
+ { \regex_split:NnN #2 {#3} #1 }
\cs_generate_variant:Nn \seq_set_regex_split:NNn { c }
\cs_new_protected:Npn \seq_gset_regex_split:NNn #1#2#3
{
diff --git a/l3kernel/l3tl.dtx b/l3kernel/l3tl.dtx
index 8ab073ca6..80a80f7ce 100644
--- a/l3kernel/l3tl.dtx
+++ b/l3kernel/l3tl.dtx
@@ -383,7 +383,7 @@
% }
% \begin{syntax}
% \cs{tl_if_regex_match:nnTF} \Arg{token list} \Arg{regex} \Arg{true code} \Arg{false code}
-% \cs{tl_if_regex_match:nNTF} \Arg{token list} \Arg{regex~var} \Arg{true code} \Arg{false code}
+% \cs{tl_if_regex_match:nNTF} \Arg{token list} \meta{regex~var} \Arg{true code} \Arg{false code}
% \end{syntax}
% Tests whether the \meta{regular expression} matches any part
% of the \meta{token list}. For instance,
@@ -1187,7 +1187,7 @@
% }
% \begin{syntax}
% \cs{tl_regex_replace_once:Nnn} \meta{tl~var} \Arg{regex} \Arg{replacement}
-% \cs{tl_regex_replace_once:NNn} \meta{tl~var} \Arg{regex~var} \Arg{replacement}
+% \cs{tl_regex_replace_once:NNn} \meta{tl~var} \meta{regex~var} \Arg{replacement}
% \end{syntax}
% Searches for the \meta{regular expression} in the contents of the
% \meta{tl~var} and replaces the first match with the
@@ -1207,7 +1207,7 @@
% }
% \begin{syntax}
% \cs{tl_regex_replace_all:Nnn} \meta{tl~var} \Arg{regex} \Arg{replacement}
-% \cs{tl_regex_replace_all:NNn} \meta{tl~var} \Arg{regex~var} \Arg{replacement}
+% \cs{tl_regex_replace_all:NNn} \meta{tl~var} \meta{regex~var} \Arg{replacement}
% \end{syntax}
% Replaces all occurrences of the \meta{regular expression} in the
% contents of the \meta{tl~var}
@@ -2328,13 +2328,13 @@
{ \regex_replace_once:nnN {#2} {#3} #1 }
\cs_generate_variant:Nn \tl_regex_replace_once:Nnn { c }
\cs_new_protected:Npn \tl_regex_replace_once:NNn #1#2#3
- { \regex_replace_once:NnN {#2} {#3} #1 }
+ { \regex_replace_once:NnN #2 {#3} #1 }
\cs_generate_variant:Nn \tl_regex_replace_once:NNn { c }
\cs_new_protected:Npn \tl_regex_replace_all:Nnn #1#2#3
{ \regex_replace_all:nnN {#2} {#3} #1 }
\cs_generate_variant:Nn \tl_regex_replace_all:Nnn { c }
\cs_new_protected:Npn \tl_regex_replace_all:NNn #1#2#3
- { \regex_replace_all:NnN {#2} {#3} #1 }
+ { \regex_replace_all:NnN #2 {#3} #1 }
\cs_generate_variant:Nn \tl_regex_replace_all:NNn { c }
\group_begin:
\cs_set_protected:Npn \@@_tmp:w #1#2#3
@@ -2738,7 +2738,7 @@
{ V } { TF , T , F }
\prg_new_protected_conditional:Npnn \tl_if_regex_match:nN #1#2 { TF , T , F }
{
- \regex_match:nNTF {#2} {#1}
+ \regex_match:nNTF {#2} #1
\prg_return_true: \prg_return_false:
}
\prg_generate_conditional_variant:Nnn \tl_if_regex_match:nN
More information about the latex3-commits
mailing list.