[latex3-commits] [l3svn] 02/03: Protect catcode-4 tokens during \char_generate:nn

noreply at latex-project.org noreply at latex-project.org
Sun Apr 3 14:27:31 CEST 2016


This is an automated email from the git hooks/post-receive script.

joseph pushed a commit to branch master
in repository l3svn.

commit dc7cac7664d66a58bebd05417e5cb00aa9e33a52
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sun Apr 3 12:29:18 2016 +0100

    Protect catcode-4 tokens during \char_generate:nn
---
 l3kernel/l3token.dtx                    |   15 ++++++++++++++-
 l3kernel/testfiles/m3char001.luatex.tlg |    4 ++++
 l3kernel/testfiles/m3char001.lvt        |    8 +++++++-
 l3kernel/testfiles/m3char001.tlg        |    4 ++++
 l3kernel/testfiles/m3char001.xetex.tlg  |    4 ++++
 5 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/l3kernel/l3token.dtx b/l3kernel/l3token.dtx
index 01e9e2a..b7094e2 100644
--- a/l3kernel/l3token.dtx
+++ b/l3kernel/l3token.dtx
@@ -1411,8 +1411,21 @@
       \tl_set:Nx \l_@@_tmp_tl { \l_@@_tmp_tl }
       \char_set_catcode_math_toggle:n { 0 }
       \tl_put_right:Nn \l_@@_tmp_tl { \or: ^^@ }
+%    \end{macrocode}
+%   As \TeX{} will be very unhappy if if finds an alignment character inside
+%   a primitive \tn{halign} even when skipping false branches, some precautions
+%   are required. \TeX{} will be happy if the token is hidden inside
+%   \tn{unexpanded} (which needs to be the primitive). The expansion chain here
+%   is required so that the conditional gets cleaned up correctly (other code
+%   assumes there is exactly one token to skip during the clean-up).
+%    \begin{macrocode}
       \char_set_catcode_alignment:n { 0 }
-      \tl_put_right:Nn \l_@@_tmp_tl { \or: ^^@ }
+      \tl_put_right:Nn \l_@@_tmp_tl
+        {
+          \or:
+            \etex_unexpanded:D \exp_after:wN
+              { \exp_after:wN ^^@ \exp_after:wN }
+        }
       \tl_put_right:Nn \l_@@_tmp_tl { \or: }
       \char_set_catcode_parameter:n { 0 }
       \tl_put_right:Nn \l_@@_tmp_tl { \or: ^^@ }
diff --git a/l3kernel/testfiles/m3char001.luatex.tlg b/l3kernel/testfiles/m3char001.luatex.tlg
index b4fc43f..8e492d9 100644
--- a/l3kernel/testfiles/m3char001.luatex.tlg
+++ b/l3kernel/testfiles/m3char001.luatex.tlg
@@ -472,3 +472,7 @@ l. ...  }
 \l_tmpa_tl ->Ӓ
 l. ...  }
 ============================================================
+============================================================
+TEST 6: Use inside \halign 
+============================================================
+============================================================
diff --git a/l3kernel/testfiles/m3char001.lvt b/l3kernel/testfiles/m3char001.lvt
index f1ce2f9..6bf41d2 100644
--- a/l3kernel/testfiles/m3char001.lvt
+++ b/l3kernel/testfiles/m3char001.lvt
@@ -1,5 +1,5 @@
 %
-% Copyright (C) 2015 The LaTeX Project
+% Copyright (C) 2015,2016 The LaTeX Project
 %
 \documentclass{minimal}
 \input{regression-test}
@@ -125,4 +125,10 @@
     \test:nn { 1234 } { 12 }
   }
 
+\TEST { Use~inside~\halign }
+  {
+    \tex_halign:D
+      { # \tex_cr:D A \char_generate:nn { `A } { 12 } \tex_cr:D }
+  }
+
 \END
diff --git a/l3kernel/testfiles/m3char001.tlg b/l3kernel/testfiles/m3char001.tlg
index 6ed6a26..c494ea9 100644
--- a/l3kernel/testfiles/m3char001.tlg
+++ b/l3kernel/testfiles/m3char001.tlg
@@ -507,3 +507,7 @@ l. ...  }
                                                   {1234}{12}
 l. ...  }
 ============================================================
+============================================================
+TEST 6: Use inside \halign 
+============================================================
+============================================================
diff --git a/l3kernel/testfiles/m3char001.xetex.tlg b/l3kernel/testfiles/m3char001.xetex.tlg
index b04c4e2..7129e2e 100644
--- a/l3kernel/testfiles/m3char001.xetex.tlg
+++ b/l3kernel/testfiles/m3char001.xetex.tlg
@@ -472,3 +472,7 @@ l. ...  }
 \l_tmpa_tl ->Ӓ
 l. ...  }
 ============================================================
+============================================================
+TEST 6: Use inside \halign 
+============================================================
+============================================================

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the latex3-commits mailing list