[latex3-commits] [l3svn] 02/02: Properly fix expandable d-type grabbing

noreply at latex-project.org noreply at latex-project.org
Tue Nov 10 10:41:22 CET 2015


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

joseph pushed a commit to branch master
in repository l3svn.

commit ec207aa4c1a1f4fdef6f0f9aa51ba1aa7085fdf0
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Nov 10 09:20:04 2015 +0000

    Properly fix expandable d-type grabbing
    
    The earlier (removed) code is needed but needs some fixes.
    Here a set of tests are also added such that all of the
    tricky cases get checked.
---
 l3packages/xparse/testfiles/xparse002.luatex.tlg |   32 ++++++++++++++++
 l3packages/xparse/testfiles/xparse002.lvt        |   43 +++++++++++++++++++++-
 l3packages/xparse/testfiles/xparse002.tlg        |   32 ++++++++++++++++
 l3packages/xparse/xparse.dtx                     |   24 ++++++++----
 4 files changed, 122 insertions(+), 9 deletions(-)

diff --git a/l3packages/xparse/testfiles/xparse002.luatex.tlg b/l3packages/xparse/testfiles/xparse002.luatex.tlg
index f8b3b27..3807ba7 100644
--- a/l3packages/xparse/testfiles/xparse002.luatex.tlg
+++ b/l3packages/xparse/testfiles/xparse002.luatex.tlg
@@ -460,3 +460,35 @@ TEST 12: Fully expandable long functions
 (-NoValue-)(b)(\par )(d)
 (\par )(\par )(\par )(\par )
 ============================================================
+============================================================
+TEST 13: More tricky expandable tests
+============================================================
+()(b)
+()(b)
+( )(b)
+( )(b)
+(a)(b)
+( a)(b)
+(a )(b)
+({}{})(b)
+({a}{a})(b)
+( {})(b)
+({} )(b)
+({}[])(b)
+([])(b)
+([{}])(b)
+([{a}])(b)
+([][])(b)
+({}[][])(b)
+()(b)
+()(b)
+( )(b)
+( )(b)
+(a)(b)
+( a)(b)
+(a )(b)
+({}{})(b)
+({a}{a})(b)
+( {})(b)
+({} )(b)
+============================================================
diff --git a/l3packages/xparse/testfiles/xparse002.lvt b/l3packages/xparse/testfiles/xparse002.lvt
index 7e161ed..9fd56dc 100644
--- a/l3packages/xparse/testfiles/xparse002.lvt
+++ b/l3packages/xparse/testfiles/xparse002.lvt
@@ -1,5 +1,5 @@
 %
-% Copyright (C) 2009-2012,2014 LaTeX3 Project
+% Copyright (C) 2009-2012,2014,2015 LaTeX3 Project
 %
 
 \documentclass{minimal}
@@ -237,5 +237,46 @@
   \TYPE { \foo          {b}     [ \par ] {d}      }
   \TYPE { \foo [ \par ] { \par} [ \par ] { \par } }
 }
+
+\TEST { More~tricky~expandable~tests }
+  {
+    \OMIT
+    \DeclareExpandableDocumentCommand \foo { d [ ] m }
+       { (#1) (#2) }
+    \TIMO
+    \TYPE { \foo [ ] { b } }
+    \TYPE { \foo [ { } ] { b } }
+    \TYPE { \foo [ ~ ] { b } }
+    \TYPE { \foo [ { ~ } ] { b } }
+    \TYPE { \foo [ { a } ] { b } }
+    \TYPE { \foo [ { ~ a } ] { b } }
+    \TYPE { \foo [ { a ~ } ] { b } }
+    \TYPE { \foo [ { } { } ] { b } }
+    \TYPE { \foo [ { a } { a } ] { b } }
+    \TYPE { \foo [ ~ { } ] { b } }
+    \TYPE { \foo [ { } ~ ] { b } }
+    \TYPE { \foo [ { } [ ] ] { b } }
+    \TYPE { \foo [ [ ] ] { b } }
+    \TYPE { \foo [ [ { } ] ] { b } }
+    \TYPE { \foo [ [ { a } ] ] { b } }
+    \TYPE { \foo [ [ ] [ ] ] { b } }
+    \TYPE { \foo [ { } [ ] [ ] ] { b } }
+    \OMIT
+    \DeclareExpandableDocumentCommand \foo { d | | m }
+       { (#1) (#2) }
+    \TIMO
+    \TYPE { \foo | | { b } }
+    \TYPE { \foo | { } | { b } }
+    \TYPE { \foo | ~ | { b } }
+    \TYPE { \foo | { ~ } | { b } }
+    \TYPE { \foo | { a } | { b } }
+    \TYPE { \foo | { ~ a } | { b } }
+    \TYPE { \foo | { a ~ } | { b } }
+    \TYPE { \foo | { } { } | { b } }
+    \TYPE { \foo | { a } { a } | { b } }
+    \TYPE { \foo | ~ { } | { b } }
+    \TYPE { \foo | { } ~ | { b } }
+  }
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \END
diff --git a/l3packages/xparse/testfiles/xparse002.tlg b/l3packages/xparse/testfiles/xparse002.tlg
index 91dc5df..c56e452 100644
--- a/l3packages/xparse/testfiles/xparse002.tlg
+++ b/l3packages/xparse/testfiles/xparse002.tlg
@@ -460,3 +460,35 @@ TEST 12: Fully expandable long functions
 (-NoValue-)(b)(\par )(d)
 (\par )(\par )(\par )(\par )
 ============================================================
+============================================================
+TEST 13: More tricky expandable tests
+============================================================
+()(b)
+()(b)
+( )(b)
+( )(b)
+(a)(b)
+( a)(b)
+(a )(b)
+({}{})(b)
+({a}{a})(b)
+( {})(b)
+({} )(b)
+({}[])(b)
+([])(b)
+([{}])(b)
+([{a}])(b)
+([][])(b)
+({}[][])(b)
+()(b)
+()(b)
+( )(b)
+( )(b)
+(a)(b)
+( a)(b)
+(a )(b)
+({}{})(b)
+({a}{a})(b)
+( {})(b)
+({} )(b)
+============================================================
diff --git a/l3packages/xparse/xparse.dtx b/l3packages/xparse/xparse.dtx
index a38f3ba..981c552 100644
--- a/l3packages/xparse/xparse.dtx
+++ b/l3packages/xparse/xparse.dtx
@@ -2832,11 +2832,15 @@
     \exp_args:No \tl_if_empty:oTF
       { #3 { \use_none:nnn } #2 \q_@@ #5 #4 \q_@@ #5 }
       {
-        \str_if_eq_x:nnTF
-          { \exp_not:o { \use_none:nn #1#2 } }
-          { { \exp_not:o { \use_iii:nnnn #1#2 \q_nil } } }
-          { \@@_put_arg_expandable:ow { \use_iii:nnn #1#2 } }
+        \tl_if_blank:oTF { \use_none:nn #1#2 }
           { \@@_put_arg_expandable:ow { \use_none:nn #1#2 } }
+          {
+            \str_if_eq_x:nnTF
+              { \exp_not:o { \use_none:nn #1#2 } }
+              { { \exp_not:o { \use_iii:nnnn #1#2 \q_nil } } }
+              { \@@_put_arg_expandable:ow { \use_iii:nnn #1#2 } }
+              { \@@_put_arg_expandable:ow { \use_none:nn #1#2 } }
+          }
             #6 \q_@@ #7
       }
       {
@@ -2875,11 +2879,15 @@
   }
 \cs_new:Npn \@@_expandable_grab_D_alt:Nwn #1#2 \q_@@ #3
   {
-    \str_if_eq_x:nnTF
-      { \exp_not:o { \use_none:n #3 } }
-      { { \exp_not:o { \use_ii:nnn #3 ? \q_nil } } }
-      { \@@_put_arg_expandable:ow { \use_ii:nn #3 } }
+    \tl_if_blank:oTF { \use_none:n #3 }
       { \@@_put_arg_expandable:ow { \use_none:n #3 } }
+      {
+        \str_if_eq_x:nnTF
+          { \exp_not:o { \use_none:n #3 } }
+          { { \exp_not:o { \use_ii:nnn #3 \q_nil } } }
+          { \@@_put_arg_expandable:ow { \use_ii:nn #3 } }
+          { \@@_put_arg_expandable:ow { \use_none:n #3 } }
+      }
         #2 \q_@@ #1
   }
 %    \end{macrocode}

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


More information about the latex3-commits mailing list