[latex3-commits] [git/LaTeX3-latex3-latex3] peek-regex: In l3regex keep track of the current token as \l_@@_curr_token_tl (97eaad93f)

Joseph Wright joseph.wright at morningstar2.co.uk
Thu Dec 3 16:03:05 CET 2020


Repository : https://github.com/latex3/latex3
On branch  : peek-regex
Link       : https://github.com/latex3/latex3/commit/97eaad93fc53efcd756c8b0a04aaebb06e1185bd

>---------------------------------------------------------------

commit 97eaad93fc53efcd756c8b0a04aaebb06e1185bd
Author: Bruno Le Floch <blflatex at gmail.com>
Date:   Fri Jul 17 12:42:00 2020 +0200

    In l3regex keep track of the current token as \l_@@_curr_token_tl


>---------------------------------------------------------------

97eaad93fc53efcd756c8b0a04aaebb06e1185bd
 l3kernel/l3regex.dtx | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/l3kernel/l3regex.dtx b/l3kernel/l3regex.dtx
index cd233ca6c..e4b152953 100644
--- a/l3kernel/l3regex.dtx
+++ b/l3kernel/l3regex.dtx
@@ -1002,7 +1002,7 @@
 \cs_new:Npn \@@_curr_cs_to_str:
   {
     \exp_after:wN \exp_after:wN \exp_after:wN \cs_to_str:N
-    \tex_the:D \tex_toks:D \l_@@_curr_pos_int
+    \l_@@_curr_token_tl
   }
 %    \end{macrocode}
 % \end{macro}
@@ -3794,6 +3794,7 @@
 %     \meta{key} is |<| or |>| for the beginning or end of group
 %     numbered \meta{group}.  This causes the current position in the
 %     query to be stored as the \meta{key} submatch boundary.
+%   \item One of these actions, within a conditional.
 % \end{itemize}
 %
 % We strive to preserve the following properties while building.
@@ -4501,11 +4502,13 @@
 %   {
 %     \l_@@_curr_char_int,
 %     \l_@@_curr_catcode_int,
+%     \l_@@_curr_token_tl,
 %     \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;
+%   position and a token list expanding to that token; the character
+%   code of the token at the previous position;
 %   and the character code of the result of changing the case of the
 %   current token (|A-Z|$\leftrightarrow$|a-z|). This last integer is
 %   only computed when necessary, and is otherwise \cs{c_max_int}.  The
@@ -4514,6 +4517,7 @@
 %    \begin{macrocode}
 \int_new:N \l_@@_curr_char_int
 \int_new:N \l_@@_curr_catcode_int
+\tl_new:N \l_@@_curr_token_tl
 \int_new:N \l_@@_last_char_int
 \int_new:N \l_@@_case_changed_char_int
 %    \end{macrocode}
@@ -4859,12 +4863,18 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_query_get:
   {
-    \l_@@_curr_char_int
-      = \__kernel_intarray_item:Nn \g_@@_charcode_intarray
-          { \l_@@_curr_pos_int } \scan_stop:
-    \l_@@_curr_catcode_int
-      = \__kernel_intarray_item:Nn \g_@@_catcode_intarray
-          { \l_@@_curr_pos_int } \scan_stop:
+    \int_set:Nn \l_@@_curr_char_int
+      {
+        \__kernel_intarray_item:Nn \g_@@_charcode_intarray
+          { \l_@@_curr_pos_int }
+      }
+    \int_set:Nn \l_@@_curr_catcode_int
+      {
+        \__kernel_intarray_item:Nn \g_@@_catcode_intarray
+          { \l_@@_curr_pos_int }
+      }
+    \tl_set:Nx \l_@@_curr_token_tl
+      { \tex_the:D \tex_toks:D \l_@@_curr_pos_int }
   }
 %    \end{macrocode}
 % \end{macro}





More information about the latex3-commits mailing list.