[latex3-commits] [l3svn] r6305 - Correct \SplitList bug: simply avoid boolean expression

noreply at latex-project.org noreply at latex-project.org
Sun Nov 22 16:56:10 CET 2015


Author: bruno
Date: 2015-11-22 16:56:10 +0100 (Sun, 22 Nov 2015)
New Revision: 6305

Modified:
   trunk/l3packages/xparse/testfiles/xparse004.tlg
   trunk/l3packages/xparse/xparse.dtx
Log:
Correct \SplitList bug: simply avoid boolean expression

Testing whether an argument has a single token, then using
that argument without braces in the same boolean expression
is unsafe and breaks when the argument actually contains
some syntax characters of boolean expressions.  The bug is
solved here by avoiding boolean expressions altogether, since
that doesn't make the code longer.


Modified: trunk/l3packages/xparse/testfiles/xparse004.tlg
===================================================================
--- trunk/l3packages/xparse/testfiles/xparse004.tlg	2015-11-22 15:53:24 UTC (rev 6304)
+++ trunk/l3packages/xparse/testfiles/xparse004.tlg	2015-11-22 15:56:10 UTC (rev 6305)
@@ -962,14 +962,6 @@
 . Defining command \foo with sig. '>{\SplitList {)||(\BOOM \c_false_bool }}m'
 . on line ....
 .................................................
-! Undefined control sequence.
-<argument> \BOOM 
-l. ...  }
-The control sequence at the end of the top line
-of your error message was never \def'ed. If you have
-misspelled it (e.g., `\hobx'), type `I' and the correct
-spelling (e.g., `I\hbox'). Otherwise just continue,
-and I'll forget about whatever was undefined.
 > {a(b}.
 <recently read> }
 l. ...  }

Modified: trunk/l3packages/xparse/xparse.dtx
===================================================================
--- trunk/l3packages/xparse/xparse.dtx	2015-11-22 15:53:24 UTC (rev 6304)
+++ trunk/l3packages/xparse/xparse.dtx	2015-11-22 15:56:10 UTC (rev 6305)
@@ -3070,14 +3070,14 @@
 \tl_new:N \l_@@_split_list_tl
 \cs_new_protected:Npn \@@_split_list:nn #1#2
   {
-    \bool_if:nTF
+    \tl_if_single:nTF {#1}
       {
-          \tl_if_single_p:n {#1} &&
-        ! ( \token_if_cs_p:N #1 )
+        \token_if_cs:NTF #1
+          { \@@_split_list_multi:nn {#1} {#2} }
+          { \@@_split_list_single:Nn #1 {#2} }
       }
-      { \@@_split_list_single:Nn #1 {#2} }
       { \@@_split_list_multi:nn {#1} {#2} }
-    }
+  }
 \cs_set_protected:Npn \@@_split_list_multi:nn #1#2
   {
     \seq_set_split:Nnn \l_@@_split_list_seq {#1} {#2}



More information about the latex3-commits mailing list