[latex3-commits] [l3svn] r6309 - Fix bug: r-type args were inconsistently optional/mandatory
noreply at latex-project.org
noreply at latex-project.org
Sun Nov 22 17:56:15 CET 2015
Author: bruno
Date: 2015-11-22 17:56:15 +0100 (Sun, 22 Nov 2015)
New Revision: 6309
Modified:
trunk/l3packages/xparse/testfiles/xparse001.tlg
trunk/l3packages/xparse/xparse.dtx
Log:
Fix bug: r-type args were inconsistently optional/mandatory
This commit fixes the bug mentionned in my last commit. It
has the side-effect of making a trailing r-type argument allowed.
One could argue that if an r-type arg is missing xparse would
wrongly have braced the next token. But since a missing r-type
arg is an error, I think it's ok to have further problems.
Modified: trunk/l3packages/xparse/testfiles/xparse001.tlg
===================================================================
--- trunk/l3packages/xparse/testfiles/xparse001.tlg 2015-11-22 16:46:25 UTC (rev 6308)
+++ trunk/l3packages/xparse/testfiles/xparse001.tlg 2015-11-22 16:56:15 UTC (rev 6309)
@@ -922,6 +922,23 @@
.
. Redefining command \foo with sig. 'r()o' on line ....
.................................................
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "xparse/expandable-ending-optional"
+!
+! Argument specification for expandable command ends with optional argument.
+!
+! See the LaTeX3 documentation for further information.
+!
+! For immediate help type H <return>.
+!...............................................
+l. ...}
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| This is a coding error.
+|
+| Expandable commands must have a final mandatory argument (or no arguments at
+| all). You cannot have a terminal optional argument with expandable commands.
+|...............................................
> \foo=macro:->\__xparse_expandable_grab_R:w \foo (arg 1)
(){-NoValue-}\__xparse_expandable_grab_D:w \foo (arg 2)
[]{-NoValue-}\__xparse_grab_expandable_end:wN \foo code \q__xparse \foo .
Modified: trunk/l3packages/xparse/xparse.dtx
===================================================================
--- trunk/l3packages/xparse/xparse.dtx 2015-11-22 16:46:25 UTC (rev 6308)
+++ trunk/l3packages/xparse/xparse.dtx 2015-11-22 16:56:15 UTC (rev 6309)
@@ -1791,11 +1791,11 @@
{
\tl_if_eq:nnTF {#1} {#2}
{
- \@@_add_expandable_grabber_optional:n { R_alt }
+ \@@_add_expandable_grabber_mandatory:n { R_alt }
\@@_add_expandable_type_D_aux:Nn #1
}
{
- \@@_add_expandable_grabber_optional:n { R }
+ \@@_add_expandable_grabber_mandatory:n { R }
\@@_add_expandable_type_D_aux:NNn #1#2
}
}
More information about the latex3-commits
mailing list