[latex3-commits] [git/LaTeX3-latex3-latex3] master: faster tl_if_single:n (1560d03e0)
Bruno Le Floch
blflatex at gmail.com
Tue Oct 27 09:11:58 CET 2020
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/1560d03e05f6eb6f238468cc074d7419602effa7
>---------------------------------------------------------------
commit 1560d03e05f6eb6f238468cc074d7419602effa7
Author: Jonathan Spratte <jspratte at yahoo.de>
Date: Sat Aug 8 00:05:25 2020 +0200
faster tl_if_single:n
>---------------------------------------------------------------
1560d03e05f6eb6f238468cc074d7419602effa7
l3kernel/l3tl.dtx | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/l3kernel/l3tl.dtx b/l3kernel/l3tl.dtx
index a44d692e3..92362c4d6 100644
--- a/l3kernel/l3tl.dtx
+++ b/l3kernel/l3tl.dtx
@@ -2272,26 +2272,26 @@
% \begin{macro}[EXP,pTF]{\tl_if_single:n}
% \begin{macro}[EXP,pTF]{\@@_if_single:n}
% This test is similar to \cs{tl_if_empty:nTF}. Expanding
-% \cs{use_none:nn} |#1| |??| once yields an empty result if |#1| is
+% \cs{use_none:n} |#1| |?| once yields an empty result if |#1| is
% blank, a single~|?| if |#1| has a single item, and otherwise yields
-% some tokens ending with |??|. Then, \cs{tl_to_str:n} makes sure
+% some tokens ending with |?|. Then, \cs{__kernel_tl_to_str:w} makes sure
% there are no odd category codes. An earlier version would compare
% the result to a single~|?| using string comparison, but the Lua call
% is slow in \LuaTeX{}. Instead, \cs{@@_if_single:nnw} picks the
% second token in front of it. If |#1| is empty, this token is
-% the trailing~|?| and the catcode test yields \texttt{false}. If
-% |#1| has a single item, the token is~|^| and the catcode test
+% the trailing~|?| and the |\if:w| test yields \texttt{false}. If
+% |#1| has a single item, the token is~|\scan_stop:| and the |\if:w| test
% yields \texttt{true}. Otherwise, it is one of the characters
-% resulting from \cs{tl_to_str:n}, and the catcode test yields
-% \texttt{false}. Note that \cs{if_catcode:w} and
+% resulting from \cs{tl_to_str:n}, and the |\if:w| test yields
+% \texttt{false}. Note that \cs{if:w} and
% \cs{__kernel_tl_to_str:w} are primitives that take care of
% expansion.
% \begin{macrocode}
\prg_new_conditional:Npnn \tl_if_single:n #1 { p , T , F , TF }
{
- \if_catcode:w ^ \exp_after:wN \@@_if_single:nnw
+ \if:w \scan_stop: \exp_after:wN \@@_if_single:nnw
\__kernel_tl_to_str:w
- \exp_after:wN { \use_none:nn #1 ?? } ^ ? \s_@@_stop
+ \exp_after:wN { \use_none:n #1 ? } \scan_stop: ? \s_@@_stop
\prg_return_true:
\else:
\prg_return_false:
More information about the latex3-commits
mailing list.