[latex3-commits] [l3svn] r6855 - Remove optimization in xparse for all-m commands

noreply at latex-project.org noreply at latex-project.org
Thu Feb 9 04:07:27 CET 2017


Author: bruno
Date: 2017-02-09 04:07:27 +0100 (Thu, 09 Feb 2017)
New Revision: 6855

Modified:
   trunk/l3packages/xparse/testfiles/xparse001.ptex.tlg
   trunk/l3packages/xparse/testfiles/xparse001.tlg
   trunk/l3packages/xparse/testfiles/xparse001.uptex.tlg
   trunk/l3packages/xparse/testfiles/xparse002.luatex.tlg
   trunk/l3packages/xparse/testfiles/xparse002.tlg
   trunk/l3packages/xparse/xparse.dtx
Log:
Remove optimization in xparse for all-m commands

This slows down commands with only m-type arguments but means that
all commands have the same structure, helpful for beamer patching,
for diagnostics, and more directly for simplifying the code now.


Modified: trunk/l3packages/xparse/testfiles/xparse001.ptex.tlg
===================================================================
--- trunk/l3packages/xparse/testfiles/xparse001.ptex.tlg	2017-02-08 23:01:33 UTC (rev 6854)
+++ trunk/l3packages/xparse/testfiles/xparse001.ptex.tlg	2017-02-09 03:07:27 UTC (rev 6855)
@@ -35,10 +35,10 @@
 | You have used \RenewDocumentCommand with a command that was never defined.
 | A new command '\foo' will be created.
 |...............................................
-> \foo=\protected macro:->First definition.
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code {}{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:->First definition.
 <recently read> }
 l. ...}
 ============================================================
@@ -50,10 +50,11 @@
 . 
 . Defining command \foo with sig. 'm' on line ....
 .................................................
-> \foo=\protected macro:#1->(#1).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_1:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1->(#1).
 <recently read> }
 l. ...}
 .................................................
@@ -61,10 +62,11 @@
 . 
 . Redefining command \foo with sig. 'mm' on line ....
 .................................................
-> \foo=\protected macro:#1#2->(#1)(#2).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_2:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1#2->(#1)(#2).
 <recently read> }
 l. ...}
 .................................................
@@ -72,10 +74,11 @@
 . 
 . Redefining command \foo with sig. 'mmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3->(#1)(#2)(#3).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_3:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1#2#3->(#1)(#2)(#3).
 <recently read> }
 l. ...}
 .................................................
@@ -83,10 +86,11 @@
 . 
 . Redefining command \foo with sig. 'mmmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3#4->(#1)(#2)(#3)(#4).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_4:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1#2#3#4->(#1)(#2)(#3)(#4).
 <recently read> }
 l. ...}
 .................................................
@@ -94,10 +98,11 @@
 . 
 . Redefining command \foo with sig. 'mmmmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3#4#5->(#1)(#2)(#3)(#4)(#5).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_5:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1#2#3#4#5->(#1)(#2)(#3)(#4)(#5).
 <recently read> }
 l. ...}
 .................................................
@@ -105,10 +110,11 @@
 . 
 . Redefining command \foo with sig. 'mmmmmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3#4#5#6->(#1)(#2)(#3)(#4)(#5)(#6).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_6:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1#2#3#4#5#6->(#1)(#2)(#3)(#4)(#5)(#6).
 <recently read> }
 l. ...}
 .................................................
@@ -116,10 +122,12 @@
 . 
 . Redefining command \foo with sig. 'mmmmmmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3#4#5#6#7->(#1)(#2)(#3)(#4)(#5)(#6)(#7).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_7:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long
+macro:#1#2#3#4#5#6#7->(#1)(#2)(#3)(#4)(#5)(#6)(#7).
 <recently read> }
 l. ...}
 .................................................
@@ -127,10 +135,12 @@
 . 
 . Redefining command \foo with sig. 'mmmmmmmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3#4#5#6#7#8->(#1)(#2)(#3)(#4)(#5)(#6)(#7)(#8).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_8:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long
+macro:#1#2#3#4#5#6#7#8->(#1)(#2)(#3)(#4)(#5)(#6)(#7)(#8).
 <recently read> }
 l. ...}
 .................................................
@@ -138,11 +148,12 @@
 . 
 . Redefining command \foo with sig. 'mmmmmmmmm' on line ....
 .................................................
-> \foo=\protected
-macro:#1#2#3#4#5#6#7#8#9->(#1)(#2)(#3)(#4)(#5)(#6)(#7)(#8)(#9).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_9:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long
+macro:#1#2#3#4#5#6#7#8#9->(#1)(#2)(#3)(#4)(#5)(#6)(#7)(#8)(#9).
 <recently read> }
 l. ...}
 ============================================================
@@ -158,7 +169,7 @@
 !
 ! LaTeX error: "kernel/bad-number-of-arguments"
 ! 
-! Function '\foo' cannot be defined with 10 arguments.
+! Function '\foo code' cannot be defined with 10 arguments.
 ! 
 ! See the LaTeX3 documentation for further information.
 ! 
@@ -168,13 +179,14 @@
 |'''''''''''''''''''''''''''''''''''''''''''''''
 | This is a coding error.
 | 
-| LaTeX has been asked to define a function '\foo' with 10 arguments. TeX
+| LaTeX has been asked to define a function '\foo code' with 10 arguments. TeX
 | allows between 0 and 9 arguments for a single function.
 |...............................................
-> \foo=undefined.
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_10:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\relax.
 <recently read> }
 l. ...}
 ============================================================
@@ -638,10 +650,11 @@
 . 
 . Defining command \foo with sig. 'm' on line ....
 .................................................
-> \foo=macro:#1->(#1).
+> \foo=macro:->\__xparse_expandable_grab_m:w \__xparse_grab_expandable_end:wN
+\foo code \q__xparse \foo  .
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\long macro:#1->(#1).
 <recently read> }
 l. ...}
 .................................................
@@ -649,10 +662,11 @@
 . 
 . Redefining command \foo with sig. '+m' on line ....
 .................................................
-> \foo=\long macro:#1->(#1).
+> \foo=macro:->\__xparse_expandable_grab_m:w \__xparse_grab_expandable_end:wN
+\foo code \q__xparse \foo  .
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\long macro:#1->(#1).
 <recently read> }
 l. ...}
 .................................................
@@ -660,10 +674,12 @@
 . 
 . Redefining command \foo with sig. 'mmm' on line ....
 .................................................
-> \foo=macro:#1#2#3->(#1)(#2)(#3).
+> \foo=macro:->\__xparse_expandable_grab_m:w \__xparse_expandable_grab_m:w
+\__xparse_expandable_grab_m:w \__xparse_grab_expandable_end:wN \foo code
+\q__xparse \foo  .
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\long macro:#1#2#3->(#1)(#2)(#3).
 <recently read> }
 l. ...}
 .................................................
@@ -792,10 +808,12 @@
 | The arguments for an expandable command must either all be short or all be
 | long. You have tried to mix the two types.
 |...............................................
-> \foo=\long macro:#1#2#3->(#1)(#2)(#3).
+> \foo=macro:->\__xparse_expandable_grab_m:w \__xparse_expandable_grab_m:w
+\__xparse_expandable_grab_m:w \__xparse_grab_expandable_end:wN \foo code
+\q__xparse \foo  .
 <recently read> }
 l. ...}
-> \foo code=\long macro:#1#2->(#1).
+> \foo code=\long macro:#1#2#3->(#1)(#2)(#3).
 <recently read> }
 l. ...}
 .................................................

Modified: trunk/l3packages/xparse/testfiles/xparse001.tlg
===================================================================
--- trunk/l3packages/xparse/testfiles/xparse001.tlg	2017-02-08 23:01:33 UTC (rev 6854)
+++ trunk/l3packages/xparse/testfiles/xparse001.tlg	2017-02-09 03:07:27 UTC (rev 6855)
@@ -35,10 +35,10 @@
 | You have used \RenewDocumentCommand with a command that was never defined.
 | A new command '\foo' will be created.
 |...............................................
-> \foo=\protected macro:->First definition.
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code {}{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:->First definition.
 <recently read> }
 l. ...}
 ============================================================
@@ -50,10 +50,11 @@
 . 
 . Defining command \foo with sig. 'm' on line ....
 .................................................
-> \foo=\protected macro:#1->(#1).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_1:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1->(#1).
 <recently read> }
 l. ...}
 .................................................
@@ -61,10 +62,11 @@
 . 
 . Redefining command \foo with sig. 'mm' on line ....
 .................................................
-> \foo=\protected macro:#1#2->(#1)(#2).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_2:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1#2->(#1)(#2).
 <recently read> }
 l. ...}
 .................................................
@@ -72,10 +74,11 @@
 . 
 . Redefining command \foo with sig. 'mmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3->(#1)(#2)(#3).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_3:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1#2#3->(#1)(#2)(#3).
 <recently read> }
 l. ...}
 .................................................
@@ -83,10 +86,11 @@
 . 
 . Redefining command \foo with sig. 'mmmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3#4->(#1)(#2)(#3)(#4).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_4:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1#2#3#4->(#1)(#2)(#3)(#4).
 <recently read> }
 l. ...}
 .................................................
@@ -94,10 +98,11 @@
 . 
 . Redefining command \foo with sig. 'mmmmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3#4#5->(#1)(#2)(#3)(#4)(#5).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_5:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1#2#3#4#5->(#1)(#2)(#3)(#4)(#5).
 <recently read> }
 l. ...}
 .................................................
@@ -105,10 +110,11 @@
 . 
 . Redefining command \foo with sig. 'mmmmmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3#4#5#6->(#1)(#2)(#3)(#4)(#5)(#6).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_6:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1#2#3#4#5#6->(#1)(#2)(#3)(#4)(#5)(#6).
 <recently read> }
 l. ...}
 .................................................
@@ -116,10 +122,12 @@
 . 
 . Redefining command \foo with sig. 'mmmmmmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3#4#5#6#7->(#1)(#2)(#3)(#4)(#5)(#6)(#7).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_7:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long
+macro:#1#2#3#4#5#6#7->(#1)(#2)(#3)(#4)(#5)(#6)(#7).
 <recently read> }
 l. ...}
 .................................................
@@ -127,10 +135,12 @@
 . 
 . Redefining command \foo with sig. 'mmmmmmmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3#4#5#6#7#8->(#1)(#2)(#3)(#4)(#5)(#6)(#7)(#8).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_8:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long
+macro:#1#2#3#4#5#6#7#8->(#1)(#2)(#3)(#4)(#5)(#6)(#7)(#8).
 <recently read> }
 l. ...}
 .................................................
@@ -138,11 +148,12 @@
 . 
 . Redefining command \foo with sig. 'mmmmmmmmm' on line ....
 .................................................
-> \foo=\protected
-macro:#1#2#3#4#5#6#7#8#9->(#1)(#2)(#3)(#4)(#5)(#6)(#7)(#8)(#9).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_9:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long
+macro:#1#2#3#4#5#6#7#8#9->(#1)(#2)(#3)(#4)(#5)(#6)(#7)(#8)(#9).
 <recently read> }
 l. ...}
 ============================================================
@@ -158,7 +169,7 @@
 !
 ! LaTeX error: "kernel/bad-number-of-arguments"
 ! 
-! Function '\foo' cannot be defined with 10 arguments.
+! Function '\foo code' cannot be defined with 10 arguments.
 ! 
 ! See the LaTeX3 documentation for further information.
 ! 
@@ -168,13 +179,14 @@
 |'''''''''''''''''''''''''''''''''''''''''''''''
 | This is a coding error.
 | 
-| LaTeX has been asked to define a function '\foo' with 10 arguments. TeX
+| LaTeX has been asked to define a function '\foo code' with 10 arguments. TeX
 | allows between 0 and 9 arguments for a single function.
 |...............................................
-> \foo=undefined.
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_10:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\relax.
 <recently read> }
 l. ...}
 ============================================================
@@ -638,10 +650,11 @@
 . 
 . Defining command \foo with sig. 'm' on line ....
 .................................................
-> \foo=macro:#1->(#1).
+> \foo=macro:->\__xparse_expandable_grab_m:w \__xparse_grab_expandable_end:wN
+\foo code \q__xparse \foo  .
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\long macro:#1->(#1).
 <recently read> }
 l. ...}
 .................................................
@@ -649,10 +662,11 @@
 . 
 . Redefining command \foo with sig. '+m' on line ....
 .................................................
-> \foo=\long macro:#1->(#1).
+> \foo=macro:->\__xparse_expandable_grab_m:w \__xparse_grab_expandable_end:wN
+\foo code \q__xparse \foo  .
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\long macro:#1->(#1).
 <recently read> }
 l. ...}
 .................................................
@@ -660,10 +674,12 @@
 . 
 . Redefining command \foo with sig. 'mmm' on line ....
 .................................................
-> \foo=macro:#1#2#3->(#1)(#2)(#3).
+> \foo=macro:->\__xparse_expandable_grab_m:w \__xparse_expandable_grab_m:w
+\__xparse_expandable_grab_m:w \__xparse_grab_expandable_end:wN \foo code
+\q__xparse \foo  .
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\long macro:#1#2#3->(#1)(#2)(#3).
 <recently read> }
 l. ...}
 .................................................
@@ -792,10 +808,12 @@
 | The arguments for an expandable command must either all be short or all be
 | long. You have tried to mix the two types.
 |...............................................
-> \foo=\long macro:#1#2#3->(#1)(#2)(#3).
+> \foo=macro:->\__xparse_expandable_grab_m:w \__xparse_expandable_grab_m:w
+\__xparse_expandable_grab_m:w \__xparse_grab_expandable_end:wN \foo code
+\q__xparse \foo  .
 <recently read> }
 l. ...}
-> \foo code=\long macro:#1#2->(#1).
+> \foo code=\long macro:#1#2#3->(#1)(#2)(#3).
 <recently read> }
 l. ...}
 .................................................

Modified: trunk/l3packages/xparse/testfiles/xparse001.uptex.tlg
===================================================================
--- trunk/l3packages/xparse/testfiles/xparse001.uptex.tlg	2017-02-08 23:01:33 UTC (rev 6854)
+++ trunk/l3packages/xparse/testfiles/xparse001.uptex.tlg	2017-02-09 03:07:27 UTC (rev 6855)
@@ -35,10 +35,10 @@
 | You have used \RenewDocumentCommand with a command that was never defined.
 | A new command '\foo' will be created.
 |...............................................
-> \foo=\protected macro:->First definition.
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code {}{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:->First definition.
 <recently read> }
 l. ...}
 ============================================================
@@ -50,10 +50,11 @@
 . 
 . Defining command \foo with sig. 'm' on line ....
 .................................................
-> \foo=\protected macro:#1->(#1).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_1:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1->(#1).
 <recently read> }
 l. ...}
 .................................................
@@ -61,10 +62,11 @@
 . 
 . Redefining command \foo with sig. 'mm' on line ....
 .................................................
-> \foo=\protected macro:#1#2->(#1)(#2).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_2:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1#2->(#1)(#2).
 <recently read> }
 l. ...}
 .................................................
@@ -72,10 +74,11 @@
 . 
 . Redefining command \foo with sig. 'mmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3->(#1)(#2)(#3).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_3:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1#2#3->(#1)(#2)(#3).
 <recently read> }
 l. ...}
 .................................................
@@ -83,10 +86,11 @@
 . 
 . Redefining command \foo with sig. 'mmmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3#4->(#1)(#2)(#3)(#4).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_4:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1#2#3#4->(#1)(#2)(#3)(#4).
 <recently read> }
 l. ...}
 .................................................
@@ -94,10 +98,11 @@
 . 
 . Redefining command \foo with sig. 'mmmmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3#4#5->(#1)(#2)(#3)(#4)(#5).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_5:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1#2#3#4#5->(#1)(#2)(#3)(#4)(#5).
 <recently read> }
 l. ...}
 .................................................
@@ -105,10 +110,11 @@
 . 
 . Redefining command \foo with sig. 'mmmmmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3#4#5#6->(#1)(#2)(#3)(#4)(#5)(#6).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_6:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long macro:#1#2#3#4#5#6->(#1)(#2)(#3)(#4)(#5)(#6).
 <recently read> }
 l. ...}
 .................................................
@@ -116,10 +122,12 @@
 . 
 . Redefining command \foo with sig. 'mmmmmmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3#4#5#6#7->(#1)(#2)(#3)(#4)(#5)(#6)(#7).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_7:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long
+macro:#1#2#3#4#5#6#7->(#1)(#2)(#3)(#4)(#5)(#6)(#7).
 <recently read> }
 l. ...}
 .................................................
@@ -127,10 +135,12 @@
 . 
 . Redefining command \foo with sig. 'mmmmmmmm' on line ....
 .................................................
-> \foo=\protected macro:#1#2#3#4#5#6#7#8->(#1)(#2)(#3)(#4)(#5)(#6)(#7)(#8).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_8:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long
+macro:#1#2#3#4#5#6#7#8->(#1)(#2)(#3)(#4)(#5)(#6)(#7)(#8).
 <recently read> }
 l. ...}
 .................................................
@@ -138,11 +148,12 @@
 . 
 . Redefining command \foo with sig. 'mmmmmmmmm' on line ....
 .................................................
-> \foo=\protected
-macro:#1#2#3#4#5#6#7#8#9->(#1)(#2)(#3)(#4)(#5)(#6)(#7)(#8)(#9).
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_9:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\protected\long
+macro:#1#2#3#4#5#6#7#8#9->(#1)(#2)(#3)(#4)(#5)(#6)(#7)(#8)(#9).
 <recently read> }
 l. ...}
 ============================================================
@@ -158,7 +169,7 @@
 !
 ! LaTeX error: "kernel/bad-number-of-arguments"
 ! 
-! Function '\foo' cannot be defined with 10 arguments.
+! Function '\foo code' cannot be defined with 10 arguments.
 ! 
 ! See the LaTeX3 documentation for further information.
 ! 
@@ -168,13 +179,14 @@
 |'''''''''''''''''''''''''''''''''''''''''''''''
 | This is a coding error.
 | 
-| LaTeX has been asked to define a function '\foo' with 10 arguments. TeX
+| LaTeX has been asked to define a function '\foo code' with 10 arguments. TeX
 | allows between 0 and 9 arguments for a single function.
 |...............................................
-> \foo=undefined.
+> \foo=\protected macro:->\__xparse_start_cmd:NNnnn \foo  \foo code
+{\__xparse_grab_m_10:w }{}{}.
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\relax.
 <recently read> }
 l. ...}
 ============================================================
@@ -638,10 +650,11 @@
 . 
 . Defining command \foo with sig. 'm' on line ....
 .................................................
-> \foo=macro:#1->(#1).
+> \foo=macro:->\__xparse_expandable_grab_m:w \__xparse_grab_expandable_end:wN
+\foo code \q__xparse \foo  .
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\long macro:#1->(#1).
 <recently read> }
 l. ...}
 .................................................
@@ -649,10 +662,11 @@
 . 
 . Redefining command \foo with sig. '+m' on line ....
 .................................................
-> \foo=\long macro:#1->(#1).
+> \foo=macro:->\__xparse_expandable_grab_m:w \__xparse_grab_expandable_end:wN
+\foo code \q__xparse \foo  .
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\long macro:#1->(#1).
 <recently read> }
 l. ...}
 .................................................
@@ -660,10 +674,12 @@
 . 
 . Redefining command \foo with sig. 'mmm' on line ....
 .................................................
-> \foo=macro:#1#2#3->(#1)(#2)(#3).
+> \foo=macro:->\__xparse_expandable_grab_m:w \__xparse_expandable_grab_m:w
+\__xparse_expandable_grab_m:w \__xparse_grab_expandable_end:wN \foo code
+\q__xparse \foo  .
 <recently read> }
 l. ...}
-> \foo code=undefined.
+> \foo code=\long macro:#1#2#3->(#1)(#2)(#3).
 <recently read> }
 l. ...}
 .................................................
@@ -792,10 +808,12 @@
 | The arguments for an expandable command must either all be short or all be
 | long. You have tried to mix the two types.
 |...............................................
-> \foo=\long macro:#1#2#3->(#1)(#2)(#3).
+> \foo=macro:->\__xparse_expandable_grab_m:w \__xparse_expandable_grab_m:w
+\__xparse_expandable_grab_m:w \__xparse_grab_expandable_end:wN \foo code
+\q__xparse \foo  .
 <recently read> }
 l. ...}
-> \foo code=\long macro:#1#2->(#1).
+> \foo code=\long macro:#1#2#3->(#1)(#2)(#3).
 <recently read> }
 l. ...}
 .................................................

Modified: trunk/l3packages/xparse/testfiles/xparse002.luatex.tlg
===================================================================
--- trunk/l3packages/xparse/testfiles/xparse002.luatex.tlg	2017-02-08 23:01:33 UTC (rev 6854)
+++ trunk/l3packages/xparse/testfiles/xparse002.luatex.tlg	2017-02-09 03:07:27 UTC (rev 6855)
@@ -93,7 +93,7 @@
 . Defining command \foo with sig. 'mmm' on line ....
 .................................................
 Runaway argument?
-! Paragraph ended before \foo was complete.
+! Paragraph ended before \foo  was complete.
 <to be read again> 
 \par 
 l. ...}

Modified: trunk/l3packages/xparse/testfiles/xparse002.tlg
===================================================================
--- trunk/l3packages/xparse/testfiles/xparse002.tlg	2017-02-08 23:01:33 UTC (rev 6854)
+++ trunk/l3packages/xparse/testfiles/xparse002.tlg	2017-02-09 03:07:27 UTC (rev 6855)
@@ -93,7 +93,7 @@
 . Defining command \foo with sig. 'mmm' on line ....
 .................................................
 Runaway argument?
-! Paragraph ended before \foo was complete.
+! Paragraph ended before \foo  was complete.
 <to be read again> 
                    \par 
 l. ...}

Modified: trunk/l3packages/xparse/xparse.dtx
===================================================================
--- trunk/l3packages/xparse/xparse.dtx	2017-02-08 23:01:33 UTC (rev 6854)
+++ trunk/l3packages/xparse/xparse.dtx	2017-02-09 03:07:27 UTC (rev 6855)
@@ -1026,13 +1026,7 @@
     \tl_set:Nx \l_@@_function_tl { \cs_to_str:N #1 }
     \@@_normalize_arg_spec:n {#2}
     \exp_args:No \@@_prepare_signature:n \l_@@_arg_spec_tl
-    \int_compare:nNnTF \l_@@_current_arg_int = \l_@@_m_args_int
-      {
-        \bool_if:NTF \l_@@_environment_bool
-          { \@@_declare_cmd_mixed:Nn #1 {#3} }
-          { \@@_declare_cmd_all_m:Nn #1 {#3} }
-      }
-      { \@@_declare_cmd_mixed:Nn #1 {#3} }
+    \@@_declare_cmd_code:Nn #1 {#3}
     \@@_break_point:n {#2}
   }
 \cs_generate_variant:Nn \@@_declare_cmd_internal:Nnn { cnx }
@@ -1048,44 +1042,25 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\@@_declare_cmd_all_m:Nn, \@@_declare_cmd_mixed:Nn}
+% \begin{macro}{\@@_declare_cmd_code:Nn}
 % \begin{macro}[aux]
-%   {\@@_declare_cmd_mixed_aux:Nn, \@@_declare_cmd_mixed_expandable:Nn}
-%   When all of the arguments to grab are simple \texttt{m}-type, a short
-%   cut can be taken to provide only a single function. In the case of
-%   expandable commands, this can also happen for \texttt{+m} (as all arguments
-%   in this case must be long).
+%   {\@@_declare_cmd_code_aux:Nn, \@@_declare_cmd_code_expandable:Nn}
+%   The appropriate auxiliary is called.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_declare_cmd_all_m:Nn #1#2
+\cs_new_protected:Npn \@@_declare_cmd_code:Nn
   {
-    \cs_generate_from_arg_count:Ncnn #1
-      {
-        cs_set
-        \bool_if:NF \l_@@_expandable_bool { _protected }
-        \bool_if:NF \l_@@_all_long_bool { _nopar }
-        :Npn
-      }
-      \l_@@_current_arg_int {#2}
-  }
-%    \end{macrocode}
-%   In the case of mixed arguments, any remaining \texttt{m}-type ones are
-%   first added to the signature, then the appropriate auxiliary is called.
-%    \begin{macrocode}
-\cs_new_protected:Npn \@@_declare_cmd_mixed:Nn
-  {
     \bool_if:NTF \l_@@_expandable_bool
-      { \@@_declare_cmd_mixed_expandable:Nn }
-      { \@@_declare_cmd_mixed_aux:Nn }
+      { \@@_declare_cmd_code_expandable:Nn }
+      { \@@_declare_cmd_code_aux:Nn }
    }
 %    \end{macrocode}
-%   Standard functions with mixed argument specifications call
+%   Standard functions call
 %   \cs{@@_start_cmd:NNnnn}, which receives an auxiliary used for
 %   grabbing arguments, an auxiliary containing the code, and then the
 %   signature, default arguments, and processors.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_declare_cmd_mixed_aux:Nn #1#2
+\cs_new_protected:Npn \@@_declare_cmd_code_aux:Nn #1#2
   {
-    \@@_flush_m_args:
     \cs_generate_from_arg_count:cNnn
       { \l_@@_function_tl \c_space_tl code }
       \cs_set_protected:Npn \l_@@_current_arg_int {#2}
@@ -1105,7 +1080,7 @@
           }
       }
   }
-\cs_new_protected:Npn \@@_declare_cmd_mixed_expandable:Nn #1#2
+\cs_new_protected:Npn \@@_declare_cmd_code_expandable:Nn #1#2
   {
     \cs_generate_from_arg_count:cNnn
       { \l_@@_function_tl \c_space_tl code }
@@ -1635,6 +1610,7 @@
     \bool_set_false:N \l_@@_process_some_bool
     \tl_clear:N \l_@@_signature_tl
     \@@_prepare_signature:N #1 \q_recursion_tail \q_recursion_stop
+    \bool_if:NF \l_@@_expandable_bool { \@@_flush_m_args: }
   }
 %    \end{macrocode}
 %  The main looping function does not take an argument, but carries out the
@@ -1949,8 +1925,8 @@
 %
 % \subsection{Setting up expandable types}
 %
-% The approach here is not dissimilar to that for standard types, although
-% types which are not supported in expandable functions give an error. There is
+% The approach here is not dissimilar to that for standard types, but fewer types
+% are supported. There is
 % also a need to define the per-function auxiliaries: this is done here, while
 % the general grabbers are dealt with later.
 %
@@ -2477,11 +2453,12 @@
 % \begin{macro}{\@@_grab_m_6:w}
 % \begin{macro}{\@@_grab_m_7:w}
 % \begin{macro}{\@@_grab_m_8:w}
+% \begin{macro}{\@@_grab_m_9:w}
 % \begin{macro}[aux]{\@@_grab_m_aux:Nnnnnnnnn}
-%   Grabbing 1--8 mandatory arguments. We don't need to worry about
-%   nine arguments as this is only possible if everything is
-%   mandatory. Each function has an auxiliary so that \cs{par} tokens
-%   from other arguments still work.
+%   Grabbing 1--8 mandatory arguments is done by giving 8--1 known
+%   arguments to a 9-argument function that stores them in
+%   \cs{l_@@_args_tl}.  For simplicity, grabbing 9 mandatory arguments
+%   is done by grabbing 5 then 4 arguments.
 %    \begin{macrocode}
 \cs_new_protected_nopar:Npn \@@_grab_m_aux:Nnnnnnnnn #1#2#3#4#5#6#7#8#9
   {
@@ -2537,6 +2514,11 @@
     \exp_after:wN \cs_set_eq:NN \l_@@_fn_tl \@@_grab_m_aux:Nnnnnnnnn
     \l_@@_fn_tl \prg_do_nothing:
   }
+\cs_new_protected:cpx { @@_grab_m_9:w }
+  {
+    \exp_not:c { @@_grab_m_5:w }
+    \exp_not:c { @@_grab_m_4:w }
+  }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -2547,6 +2529,7 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\@@_grab_R:w, \@@_grab_R_long:w}
 % \begin{macro}[aux]{\@@_grab_R_aux:NNnN}



More information about the latex3-commits mailing list