[latex3-commits] [l3svn] r6910 - Commands with only m/u/l type arguments can be grabbed expandably

noreply at latex-project.org noreply at latex-project.org
Mon Feb 13 16:15:32 CET 2017


Author: bruno
Date: 2017-02-13 16:15:32 +0100 (Mon, 13 Feb 2017)
New Revision: 6910

Modified:
   trunk/l3packages/xparse/testfiles/xparse001.lvt
   trunk/l3packages/xparse/testfiles/xparse001.ptex.tlg
   trunk/l3packages/xparse/testfiles/xparse001.tlg
   trunk/l3packages/xparse/testfiles/xparse001.uptex.tlg
   trunk/l3packages/xparse/xparse.dtx
Log:
Commands with only m/u/l type arguments can be grabbed expandably

Instead of special-casing m/u/l type arguments, treat all
argument types that can be safely grabbed expandably the same:
commands with only m/u/l arguments will now work inside csnames


Modified: trunk/l3packages/xparse/testfiles/xparse001.lvt
===================================================================
--- trunk/l3packages/xparse/testfiles/xparse001.lvt	2017-02-13 15:06:36 UTC (rev 6909)
+++ trunk/l3packages/xparse/testfiles/xparse001.lvt	2017-02-13 15:15:32 UTC (rev 6910)
@@ -358,6 +358,8 @@
     \TYPE { \exp_not:c { test- \foo { abc } { def } } }
     \DeclareDocumentCommand { \foo } { u. } { test-#1 }
     \TYPE { \exp_not:c { test- \foo abc . } }
+    \DeclareDocumentCommand { \foo } { l } { #1 . }
+    \TYPE { \exp_not:c { test- \foo abc { def } } }
     \DeclareDocumentCommand { \foo } { D... } { test-#1 }
     \TYPE { \exp_not:c { test- \foo .... } }
   }

Modified: trunk/l3packages/xparse/testfiles/xparse001.ptex.tlg
===================================================================
--- trunk/l3packages/xparse/testfiles/xparse001.ptex.tlg	2017-02-13 15:06:36 UTC (rev 6909)
+++ trunk/l3packages/xparse/testfiles/xparse001.ptex.tlg	2017-02-13 15:15:32 UTC (rev 6910)
@@ -465,8 +465,9 @@
 . 
 . Defining command \foo with sig. 'lm' on line ....
 .................................................
-> \foo=\protected macro:->\__xparse_start:nNNnnn {lm}\foo  \foo code
-{\__xparse_grab_l:w \__xparse_grab_m_1:w }{}{}.
+> \foo=\protected macro:->\__xparse_start_expandable:nNNNn {lm}\foo  \foo code
+\foo defaults {\__xparse_expandable_grab_u:w \foo (arg 1)
+\__xparse_expandable_grab_m:w }.
 <recently read> }
 l. ...}
 > \foo code=\protected\long macro:#1#2->(#1)(#2).
@@ -477,8 +478,9 @@
 . 
 . Redefining command \foo with sig. 'mlm' on line ....
 .................................................
-> \foo=\protected macro:->\__xparse_start:nNNnnn {mlm}\foo  \foo code
-{\__xparse_grab_m_1:w \__xparse_grab_l:w \__xparse_grab_m_1:w }{}{}.
+> \foo=\protected macro:->\__xparse_start_expandable:nNNNn {mlm}\foo  \foo
+code \foo defaults {\__xparse_expandable_grab_m:w
+\__xparse_expandable_grab_u:w \foo (arg 2) \__xparse_expandable_grab_m:w }.
 <recently read> }
 l. ...}
 > \foo code=\protected\long macro:#1#2#3->(#1)(#2)(#3).
@@ -489,8 +491,9 @@
 . 
 . Redefining command \foo with sig. 'u{end}u{stop!}' on line ....
 .................................................
-> \foo=\protected macro:->\__xparse_start:nNNnnn {u{end}u{stop!}}\foo  \foo
-code {\__xparse_grab_u:w {end}\__xparse_grab_u:w {stop!}}{}{}.
+> \foo=\protected macro:->\__xparse_start_expandable:nNNNn
+{u{end}u{stop!}}\foo  \foo code \foo defaults {\__xparse_expandable_grab_u:w
+\foo (arg 1) \__xparse_expandable_grab_u:w \foo (arg 2) }.
 <recently read> }
 l. ...}
 > \foo code=\protected\long macro:#1#2->(#1)(#2).
@@ -501,8 +504,10 @@
 . 
 . Redefining command \foo with sig. 'lll' on line ....
 .................................................
-> \foo=\protected macro:->\__xparse_start:nNNnnn {lll}\foo  \foo code
-{\__xparse_grab_l:w \__xparse_grab_l:w \__xparse_grab_l:w }{}{}.
+> \foo=\protected macro:->\__xparse_start_expandable:nNNNn {lll}\foo  \foo
+code \foo defaults {\__xparse_expandable_grab_u:w \foo (arg 1)
+\__xparse_expandable_grab_u:w \foo (arg 2) \__xparse_expandable_grab_u:w \foo
+(arg 3) }.
 <recently read> }
 l. ...}
 > \foo code=\protected\long macro:#1#2#3->(#1)(#2)(#3).
@@ -1200,16 +1205,16 @@
 . 
 . Redefining command \foo with sig. 'u.' on line ....
 .................................................
-! Missing \endcsname inserted.
-<to be read again> 
-                   \xparse function is not expandable 
-l. ...  }
-The control sequence marked <to be read again> should
-not appear between \csname and \endcsname.
-\test- \xparse function is not expandable \__xparse_start_aux:nNNnnn {u.}\foo code {\__xparse_grab_u:w {.}}{}{}abc.\cs_end: 
+\test-test-abc 
 .................................................
 . LaTeX info: "xparse/redefine-command"
 . 
+. Redefining command \foo with sig. 'l' on line ....
+.................................................
+\test-abc.{def} 
+.................................................
+. LaTeX info: "xparse/redefine-command"
+. 
 . Redefining command \foo with sig. 'D...' on line ....
 .................................................
 ! Missing \endcsname inserted.

Modified: trunk/l3packages/xparse/testfiles/xparse001.tlg
===================================================================
--- trunk/l3packages/xparse/testfiles/xparse001.tlg	2017-02-13 15:06:36 UTC (rev 6909)
+++ trunk/l3packages/xparse/testfiles/xparse001.tlg	2017-02-13 15:15:32 UTC (rev 6910)
@@ -465,8 +465,9 @@
 . 
 . Defining command \foo with sig. 'lm' on line ....
 .................................................
-> \foo=\protected macro:->\__xparse_start:nNNnnn {lm}\foo  \foo code
-{\__xparse_grab_l:w \__xparse_grab_m_1:w }{}{}.
+> \foo=\protected macro:->\__xparse_start_expandable:nNNNn {lm}\foo  \foo code
+\foo defaults {\__xparse_expandable_grab_u:w \foo (arg 1)
+\__xparse_expandable_grab_m:w }.
 <recently read> }
 l. ...}
 > \foo code=\protected\long macro:#1#2->(#1)(#2).
@@ -477,8 +478,9 @@
 . 
 . Redefining command \foo with sig. 'mlm' on line ....
 .................................................
-> \foo=\protected macro:->\__xparse_start:nNNnnn {mlm}\foo  \foo code
-{\__xparse_grab_m_1:w \__xparse_grab_l:w \__xparse_grab_m_1:w }{}{}.
+> \foo=\protected macro:->\__xparse_start_expandable:nNNNn {mlm}\foo  \foo
+code \foo defaults {\__xparse_expandable_grab_m:w
+\__xparse_expandable_grab_u:w \foo (arg 2) \__xparse_expandable_grab_m:w }.
 <recently read> }
 l. ...}
 > \foo code=\protected\long macro:#1#2#3->(#1)(#2)(#3).
@@ -489,8 +491,9 @@
 . 
 . Redefining command \foo with sig. 'u{end}u{stop!}' on line ....
 .................................................
-> \foo=\protected macro:->\__xparse_start:nNNnnn {u{end}u{stop!}}\foo  \foo
-code {\__xparse_grab_u:w {end}\__xparse_grab_u:w {stop!}}{}{}.
+> \foo=\protected macro:->\__xparse_start_expandable:nNNNn
+{u{end}u{stop!}}\foo  \foo code \foo defaults {\__xparse_expandable_grab_u:w
+\foo (arg 1) \__xparse_expandable_grab_u:w \foo (arg 2) }.
 <recently read> }
 l. ...}
 > \foo code=\protected\long macro:#1#2->(#1)(#2).
@@ -501,8 +504,10 @@
 . 
 . Redefining command \foo with sig. 'lll' on line ....
 .................................................
-> \foo=\protected macro:->\__xparse_start:nNNnnn {lll}\foo  \foo code
-{\__xparse_grab_l:w \__xparse_grab_l:w \__xparse_grab_l:w }{}{}.
+> \foo=\protected macro:->\__xparse_start_expandable:nNNNn {lll}\foo  \foo
+code \foo defaults {\__xparse_expandable_grab_u:w \foo (arg 1)
+\__xparse_expandable_grab_u:w \foo (arg 2) \__xparse_expandable_grab_u:w \foo
+(arg 3) }.
 <recently read> }
 l. ...}
 > \foo code=\protected\long macro:#1#2#3->(#1)(#2)(#3).
@@ -1196,16 +1201,16 @@
 . 
 . Redefining command \foo with sig. 'u.' on line ....
 .................................................
-! Missing \endcsname inserted.
-<to be read again> 
-                   \xparse function is not expandable 
-l. ...  }
-The control sequence marked <to be read again> should
-not appear between \csname and \endcsname.
-\test- \xparse function is not expandable \__xparse_start_aux:nNNnnn {u.}\foo code {\__xparse_grab_u:w {.}}{}{}abc.\cs_end: 
+\test-test-abc 
 .................................................
 . LaTeX info: "xparse/redefine-command"
 . 
+. Redefining command \foo with sig. 'l' on line ....
+.................................................
+\test-abc.{def} 
+.................................................
+. LaTeX info: "xparse/redefine-command"
+. 
 . Redefining command \foo with sig. 'D...' on line ....
 .................................................
 ! Missing \endcsname inserted.

Modified: trunk/l3packages/xparse/testfiles/xparse001.uptex.tlg
===================================================================
--- trunk/l3packages/xparse/testfiles/xparse001.uptex.tlg	2017-02-13 15:06:36 UTC (rev 6909)
+++ trunk/l3packages/xparse/testfiles/xparse001.uptex.tlg	2017-02-13 15:15:32 UTC (rev 6910)
@@ -465,8 +465,9 @@
 . 
 . Defining command \foo with sig. 'lm' on line ....
 .................................................
-> \foo=\protected macro:->\__xparse_start:nNNnnn {lm}\foo  \foo code
-{\__xparse_grab_l:w \__xparse_grab_m_1:w }{}{}.
+> \foo=\protected macro:->\__xparse_start_expandable:nNNNn {lm}\foo  \foo code
+\foo defaults {\__xparse_expandable_grab_u:w \foo (arg 1)
+\__xparse_expandable_grab_m:w }.
 <recently read> }
 l. ...}
 > \foo code=\protected\long macro:#1#2->(#1)(#2).
@@ -477,8 +478,9 @@
 . 
 . Redefining command \foo with sig. 'mlm' on line ....
 .................................................
-> \foo=\protected macro:->\__xparse_start:nNNnnn {mlm}\foo  \foo code
-{\__xparse_grab_m_1:w \__xparse_grab_l:w \__xparse_grab_m_1:w }{}{}.
+> \foo=\protected macro:->\__xparse_start_expandable:nNNNn {mlm}\foo  \foo
+code \foo defaults {\__xparse_expandable_grab_m:w
+\__xparse_expandable_grab_u:w \foo (arg 2) \__xparse_expandable_grab_m:w }.
 <recently read> }
 l. ...}
 > \foo code=\protected\long macro:#1#2#3->(#1)(#2)(#3).
@@ -489,8 +491,9 @@
 . 
 . Redefining command \foo with sig. 'u{end}u{stop!}' on line ....
 .................................................
-> \foo=\protected macro:->\__xparse_start:nNNnnn {u{end}u{stop!}}\foo  \foo
-code {\__xparse_grab_u:w {end}\__xparse_grab_u:w {stop!}}{}{}.
+> \foo=\protected macro:->\__xparse_start_expandable:nNNNn
+{u{end}u{stop!}}\foo  \foo code \foo defaults {\__xparse_expandable_grab_u:w
+\foo (arg 1) \__xparse_expandable_grab_u:w \foo (arg 2) }.
 <recently read> }
 l. ...}
 > \foo code=\protected\long macro:#1#2->(#1)(#2).
@@ -501,8 +504,10 @@
 . 
 . Redefining command \foo with sig. 'lll' on line ....
 .................................................
-> \foo=\protected macro:->\__xparse_start:nNNnnn {lll}\foo  \foo code
-{\__xparse_grab_l:w \__xparse_grab_l:w \__xparse_grab_l:w }{}{}.
+> \foo=\protected macro:->\__xparse_start_expandable:nNNNn {lll}\foo  \foo
+code \foo defaults {\__xparse_expandable_grab_u:w \foo (arg 1)
+\__xparse_expandable_grab_u:w \foo (arg 2) \__xparse_expandable_grab_u:w \foo
+(arg 3) }.
 <recently read> }
 l. ...}
 > \foo code=\protected\long macro:#1#2#3->(#1)(#2)(#3).
@@ -1200,16 +1205,16 @@
 . 
 . Redefining command \foo with sig. 'u.' on line ....
 .................................................
-! Missing \endcsname inserted.
-<to be read again> 
-                   \xparse function is not expandable 
-l. ...  }
-The control sequence marked <to be read again> should
-not appear between \csname and \endcsname.
-\test- \xparse function is not expandable \__xparse_start_aux:nNNnnn {u.}\foo code {\__xparse_grab_u:w {.}}{}{}abc.\cs_end: 
+\test-test-abc 
 .................................................
 . LaTeX info: "xparse/redefine-command"
 . 
+. Redefining command \foo with sig. 'l' on line ....
+.................................................
+\test-abc.{def} 
+.................................................
+. LaTeX info: "xparse/redefine-command"
+. 
 . Redefining command \foo with sig. 'D...' on line ....
 .................................................
 ! Missing \endcsname inserted.

Modified: trunk/l3packages/xparse/xparse.dtx
===================================================================
--- trunk/l3packages/xparse/xparse.dtx	2017-02-13 15:06:36 UTC (rev 6909)
+++ trunk/l3packages/xparse/xparse.dtx	2017-02-13 15:15:32 UTC (rev 6910)
@@ -1523,6 +1523,10 @@
 % mandatory argument with the same delimiter, as otherwise the optional
 % argument could never be omitted.
 %
+% The fifth is to keep track in \cs{l_@@_simple_args_bool} of whether
+% all arguments are \texttt{m}/\texttt{l}/\texttt{u} type, in which case
+% they can be grabbed expandably.
+%
 % The last is to count mandatory arguments.
 %
 % \begin{macro}{\@@_normalize_arg_spec:n}
@@ -1753,7 +1757,6 @@
     \tl_put_right:Nn \l_@@_arg_spec_tl { l }
     \int_incr:N \l_@@_mandatory_args_int
     \tl_clear:N \l_@@_last_delimiters_tl
-    \bool_set_false:N \l_@@_simple_args_bool
     \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_m:w
@@ -1783,7 +1786,6 @@
     \tl_put_right:Nn \l_@@_arg_spec_tl { u {#1} }
     \int_incr:N \l_@@_mandatory_args_int
     \tl_clear:N \l_@@_last_delimiters_tl
-    \bool_set_false:N \l_@@_simple_args_bool
     \@@_normalize_arg_spec_loop:n
   }
 \cs_new_protected:Npn \@@_normalize_type_v:w



More information about the latex3-commits mailing list