[latex3-commits] [git/LaTeX3-latex3-latex3] master: Avoid spurious typeset output in peek_analysis functions (89b8c34b1)

Bruno Le Floch blflatex at gmail.com
Sun Dec 6 08:58:43 CET 2020


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/89b8c34b11c68765df0051bc1b8c13363ad7c76b

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

commit 89b8c34b11c68765df0051bc1b8c13363ad7c76b
Author: Bruno Le Floch <blflatex at gmail.com>
Date:   Sun Dec 6 08:58:43 2020 +0100

    Avoid spurious typeset output in peek_analysis functions
    
    To test this I moved some tests to a new test file, hence the several
    changed test files.


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

89b8c34b11c68765df0051bc1b8c13363ad7c76b
 l3kernel/CHANGELOG.md                  |  3 +++
 l3kernel/l3tl-analysis.dtx             | 12 ++++-----
 l3kernel/testfiles/m3peek002.lvt       | 17 -------------
 l3kernel/testfiles/m3peek002.ptex.tlg  | 14 -----------
 l3kernel/testfiles/m3peek002.tlg       | 14 -----------
 l3kernel/testfiles/m3peek002.uptex.tlg | 14 -----------
 l3kernel/testfiles/m3peek003.lvt       | 45 ++++++++++++++++++++++++++++++++++
 l3kernel/testfiles/m3peek003.tlg       | 19 ++++++++++++++
 8 files changed, 73 insertions(+), 65 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index d86ecb7d1..d3a850dda 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -7,6 +7,9 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Fixed
+- `\peek_analysis_map_inline:n` with spaces and braces
+
 ## [2020-12-05]
 
 ### Fixed
diff --git a/l3kernel/l3tl-analysis.dtx b/l3kernel/l3tl-analysis.dtx
index ccc017bc3..fc1640000 100644
--- a/l3kernel/l3tl-analysis.dtx
+++ b/l3kernel/l3tl-analysis.dtx
@@ -1208,15 +1208,15 @@
 \cs_new_protected:Npn \@@_peek_analysis_test:
   {
     \if_int_odd:w
-      \if_catcode:w \exp_not:N \l_peek_token {   1 \exp_stop_f: \fi:
-      \if_catcode:w \exp_not:N \l_peek_token }   1 \exp_stop_f: \fi:
-      \if_meaning:w \l_peek_token \c_space_token 1 \exp_stop_f: \fi:
-      0 \exp_stop_f:
-      \exp_after:wN \@@_peek_analysis_special:
-    \else:
+      \if_catcode:w \exp_not:N \l_peek_token {   0 \exp_stop_f: \fi:
+      \if_catcode:w \exp_not:N \l_peek_token }   0 \exp_stop_f: \fi:
+      \if_meaning:w \l_peek_token \c_space_token 0 \exp_stop_f: \fi:
+      1 \exp_stop_f:
       \exp_after:wN \exp_after:wN
       \exp_after:wN \@@_peek_analysis_normal:N
       \exp_after:wN \exp_not:N
+    \else:
+      \exp_after:wN \@@_peek_analysis_special:
     \fi:
   }
 %    \end{macrocode}
diff --git a/l3kernel/testfiles/m3peek002.lvt b/l3kernel/testfiles/m3peek002.lvt
index 681e00644..16fa222d1 100644
--- a/l3kernel/testfiles/m3peek002.lvt
+++ b/l3kernel/testfiles/m3peek002.lvt
@@ -275,21 +275,4 @@
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-\begingroup
-\catcode`\X=13
-\def X{XXX}
-\TEST { Peek~analysis~map~inline }
-  {
-    \peek_analysis_map_inline:n
-      {
-        \int_compare:nNnT {#2} = { `Z } { \peek_analysis_map_break:n { \TYPE } }
-        \TYPE { \tl_to_str:n { #1 , #2 , #3 } }
-      }
-    a { ~ { } \c_group_begin_token \c_space_token } X
-    Z { TRUE }
-  }
-\endgroup
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
 \END
diff --git a/l3kernel/testfiles/m3peek002.ptex.tlg b/l3kernel/testfiles/m3peek002.ptex.tlg
index 114d8daee..48aaab89f 100644
--- a/l3kernel/testfiles/m3peek002.ptex.tlg
+++ b/l3kernel/testfiles/m3peek002.ptex.tlg
@@ -224,17 +224,3 @@ TRUE
 FALSE
 |\l_test_token |
 ============================================================
-============================================================
-TEST 10: Peek analysis map inline
-============================================================
-\exp_not:n {a},97,B
-\exp_after:wN {\if_false: }\fi: ,123,1
- ,32,A
-\exp_after:wN {\if_false: }\fi: ,123,1
-\if_false: {\fi: },125,2
-\exp_not:n {\c_group_begin_token },-1,0
-\exp_not:n {\c_space_token },-1,0
-\if_false: {\fi: },125,2
-\exp_not:N X,88,D
-TRUE
-============================================================
diff --git a/l3kernel/testfiles/m3peek002.tlg b/l3kernel/testfiles/m3peek002.tlg
index 1689f18c9..a553260a8 100644
--- a/l3kernel/testfiles/m3peek002.tlg
+++ b/l3kernel/testfiles/m3peek002.tlg
@@ -224,17 +224,3 @@ TRUE
 FALSE
 |\l_test_token |
 ============================================================
-============================================================
-TEST 10: Peek analysis map inline
-============================================================
-\exp_not:n {a},97,B
-\exp_after:wN {\if_false: }\fi: ,123,1
- ,32,A
-\exp_after:wN {\if_false: }\fi: ,123,1
-\if_false: {\fi: },125,2
-\exp_not:n {\c_group_begin_token },-1,0
-\exp_not:n {\c_space_token },-1,0
-\if_false: {\fi: },125,2
-\exp_not:N X,88,D
-TRUE
-============================================================
diff --git a/l3kernel/testfiles/m3peek002.uptex.tlg b/l3kernel/testfiles/m3peek002.uptex.tlg
index 114d8daee..48aaab89f 100644
--- a/l3kernel/testfiles/m3peek002.uptex.tlg
+++ b/l3kernel/testfiles/m3peek002.uptex.tlg
@@ -224,17 +224,3 @@ TRUE
 FALSE
 |\l_test_token |
 ============================================================
-============================================================
-TEST 10: Peek analysis map inline
-============================================================
-\exp_not:n {a},97,B
-\exp_after:wN {\if_false: }\fi: ,123,1
- ,32,A
-\exp_after:wN {\if_false: }\fi: ,123,1
-\if_false: {\fi: },125,2
-\exp_not:n {\c_group_begin_token },-1,0
-\exp_not:n {\c_space_token },-1,0
-\if_false: {\fi: },125,2
-\exp_not:N X,88,D
-TRUE
-============================================================
diff --git a/l3kernel/testfiles/m3peek003.lvt b/l3kernel/testfiles/m3peek003.lvt
new file mode 100644
index 000000000..f8234150f
--- /dev/null
+++ b/l3kernel/testfiles/m3peek003.lvt
@@ -0,0 +1,45 @@
+%
+% Copyright (C) 2020 The LaTeX Project
+%
+
+\documentclass{minimal}
+\input{regression-test}
+
+\RequirePackage[enable-debug]{expl3}
+\ExplSyntaxOn
+\debug_on:n { check-declarations , deprecation , log-functions }
+\ExplSyntaxOff
+
+
+% \begin{document}
+\START
+\AUTHOR{Bruno Le Floch}
+\ExplSyntaxOn
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\begingroup
+\catcode`\X=13
+\def X{XXX}
+\TEST { Peek~analysis~map~inline }
+  {
+    \peek_analysis_map_inline:n
+      {
+        \int_compare:nNnT {#2} = { `Z } { \peek_analysis_map_break:n { \TYPE } }
+        \TYPE { \tl_to_str:n { #1 , #2 , #3 } }
+      }
+    a { ~ { } \c_group_begin_token \c_space_token } X
+    Z { TRUE }
+  }
+\endgroup
+
+% Original report from E.G.
+\cs_new_eq:NN \prro \peek_regex_replace_once:nn
+\ExplSyntaxOff
+\prro{abc}{\c{TRUE}}abc
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\END
diff --git a/l3kernel/testfiles/m3peek003.tlg b/l3kernel/testfiles/m3peek003.tlg
new file mode 100644
index 000000000..c51252dc9
--- /dev/null
+++ b/l3kernel/testfiles/m3peek003.tlg
@@ -0,0 +1,19 @@
+This is a generated file for the LaTeX (2e + expl3) validation system.
+Don't change this file in any respect.
+Author: Bruno Le Floch
+============================================================
+TEST 1: Peek analysis map inline
+============================================================
+\exp_not:n {a},97,B
+\exp_after:wN {\if_false: }\fi: ,123,1
+ ,32,A
+\exp_after:wN {\if_false: }\fi: ,123,1
+\if_false: {\fi: },125,2
+\exp_not:n {\c_group_begin_token },-1,0
+\exp_not:n {\c_space_token },-1,0
+\if_false: {\fi: },125,2
+\exp_not:N X,88,D
+TRUE
+============================================================
+Defining \prro on line ...
+TRUE





More information about the latex3-commits mailing list.