[latex3-commits] [latex3/latex3] main: Correct a rare branch of \peek_analysis_map_inline:n (fixes #1461) (4f42b38ac)

github at latex-project.org github at latex-project.org
Sun Feb 18 13:16:44 CET 2024


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/4f42b38ac2bd9fa1f5f527bb4ebfe41279580973

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

commit 4f42b38ac2bd9fa1f5f527bb4ebfe41279580973
Author: Bruno Le Floch <blflatex at gmail.com>
Date:   Sun Feb 18 13:16:44 2024 +0100

    Correct a rare branch of \peek_analysis_map_inline:n (fixes #1461)
    
    One-line fix for a 16 month old bug.  It only happened when the empty control
    sequence \csname\endcsname or an active backslash was set to a begin-group,
    end-group or (32,10) space token, or when an active character was set to such
    a token with the same character code.


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

4f42b38ac2bd9fa1f5f527bb4ebfe41279580973
 l3kernel/l3tl-analysis.dtx       |  2 +-
 l3kernel/testfiles/m3peek003.lvt | 25 +++++++++++++++++++++++++
 l3kernel/testfiles/m3peek003.tlg | 10 ++++++++++
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/l3kernel/l3tl-analysis.dtx b/l3kernel/l3tl-analysis.dtx
index c8d720206..7044022b4 100644
--- a/l3kernel/l3tl-analysis.dtx
+++ b/l3kernel/l3tl-analysis.dtx
@@ -1467,7 +1467,7 @@
 \cs_new_protected:Npn \@@_peek_analysis_retest:
   {
     \if_meaning:w \l_@@_analysis_token \scan_stop:
-      \exp_after:wN \@@_peek_analysis_normal:N
+      \exp_after:wN \@@_peek_analysis_nonexp:N
     \else:
       \exp_after:wN \@@_peek_analysis_str:
     \fi:
diff --git a/l3kernel/testfiles/m3peek003.lvt b/l3kernel/testfiles/m3peek003.lvt
index ea91bc70e..177d118f7 100644
--- a/l3kernel/testfiles/m3peek003.lvt
+++ b/l3kernel/testfiles/m3peek003.lvt
@@ -79,6 +79,31 @@
 \cs_set_protected:Npn \test_end:w #1 . { \tl_show:n {#1} }
 \test: * ~ \scan_stop: .
 
+
+\TEST { Testing~a~very~rare~branch:~github-1461 }
+  {
+    \cs_set_eq:cN { } \c_group_end_token
+    \char_set_active_eq:NN \\ \c_group_end_token
+    \char_set_active_eq:NN \{ \c_group_begin_token
+    \char_set_active_eq:NN \} \c_group_end_token
+    \char_set_active_eq:NN \  \c_space_token
+    \exp_args:Nne \use:nn
+      {
+        \peek_analysis_map_inline:n
+          {
+            \TYPE { \tl_to_str:n {#1} , #2 , #3 }
+            \int_compare:nNnT {#2} = { `X } { \peek_analysis_map_break: }
+          }
+      } {
+        \exp_not:c { }
+        \char_generate:nn { `\\ } { 13 }
+        \char_generate:nn { `\{ } { 13 }
+        \char_generate:nn { `\  } { 13 }
+        \char_generate:nn { `\} } { 13 }
+        X
+      }
+  }
+
 % Original report from E.G.
 \cs_new_eq:NN \prro \peek_regex_replace_once:nn
 \ExplSyntaxOff
diff --git a/l3kernel/testfiles/m3peek003.tlg b/l3kernel/testfiles/m3peek003.tlg
index 5a5082995..55e55c4be 100644
--- a/l3kernel/testfiles/m3peek003.tlg
+++ b/l3kernel/testfiles/m3peek003.tlg
@@ -28,5 +28,15 @@ TRUE
 > \scan_stop: .
 <recently read> }
 l. ...\test: * ~ \scan_stop: .
+============================================================
+TEST 2: Testing a very rare branch: github-1461
+============================================================
+\exp_not:n {\csname\endcsname},-1,0
+\exp_not:n {\},92,D
+\exp_not:n {{},123,D
+\exp_not:n { },32,D
+\exp_not:n {}},125,D
+X,88,B
+============================================================
 Defining \prro on line ...
 TRUE





More information about the latex3-commits mailing list.