[latex3-commits] [l3svn] r6314 - Detect trailing processor/long without arg (fixes #289)
noreply at latex-project.org
noreply at latex-project.org
Sun Nov 22 23:02:05 CET 2015
Author: bruno
Date: 2015-11-22 23:02:05 +0100 (Sun, 22 Nov 2015)
New Revision: 6314
Modified:
trunk/l3packages/xparse/testfiles/xparse001.lvt
trunk/l3packages/xparse/testfiles/xparse001.tlg
trunk/l3packages/xparse/testfiles/xparse004.lvt
trunk/l3packages/xparse/testfiles/xparse004.tlg
trunk/l3packages/xparse/xparse.dtx
Log:
Detect trailing processor/long without arg (fixes #289)
Modified: trunk/l3packages/xparse/testfiles/xparse001.lvt
===================================================================
--- trunk/l3packages/xparse/testfiles/xparse001.lvt 2015-11-22 17:26:31 UTC (rev 6313)
+++ trunk/l3packages/xparse/testfiles/xparse001.lvt 2015-11-22 22:02:05 UTC (rev 6314)
@@ -1,5 +1,5 @@
%
-% Copyright (C) 2009-2012,2014 LaTeX3 Project
+% Copyright (C) 2009-2012,2014-2015 LaTeX3 Project
%
\documentclass{minimal}
@@ -9,7 +9,7 @@
\begin{document}
\START
-\AUTHOR{Joseph Wright, Frank Mittelbach}
+\AUTHOR{Joseph Wright, Frank Mittelbach, Bruno Le Floch}
\ExplSyntaxOn
\OMIT
Modified: trunk/l3packages/xparse/testfiles/xparse001.tlg
===================================================================
--- trunk/l3packages/xparse/testfiles/xparse001.tlg 2015-11-22 17:26:31 UTC (rev 6313)
+++ trunk/l3packages/xparse/testfiles/xparse001.tlg 2015-11-22 22:02:05 UTC (rev 6314)
@@ -16,7 +16,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
-Author: Joseph Wright, Frank Mittelbach
+Author: Joseph Wright, Frank Mittelbach, Bruno Le Floch
============================================================
TEST 1: Checking for existing definitions
============================================================
Modified: trunk/l3packages/xparse/testfiles/xparse004.lvt
===================================================================
--- trunk/l3packages/xparse/testfiles/xparse004.lvt 2015-11-22 17:26:31 UTC (rev 6313)
+++ trunk/l3packages/xparse/testfiles/xparse004.lvt 2015-11-22 22:02:05 UTC (rev 6314)
@@ -9,7 +9,7 @@
\begin{document}
\START
-\AUTHOR{Joseph Wright}
+\AUTHOR{Joseph Wright, Bruno Le Floch}
\ExplSyntaxOn
\OMIT
@@ -116,15 +116,19 @@
\cs_undefine:N \foo
\TIMO
\DeclareDocumentCommand \foo { d m } { }
- \cs_show:N \foo
+ \cs_log:N \foo
\DeclareDocumentCommand \foo { t } { }
- \cs_show:N \foo
+ \cs_log:N \foo
\DeclareDocumentCommand \foo { r { oh } { no } } { }
- \cs_show:N \foo
+ \cs_log:N \foo
\DeclareDocumentCommand \foo { D { } { } { } } { }
- \cs_show:N \foo
+ \cs_log:N \foo
\DeclareDocumentCommand \foo { D { ~ X ~ } { { Y } } { } } { }
- \cs_show:N \foo
+ \cs_log:N \foo
+ \DeclareDocumentCommand \foo { + >{\ReverseBoolean} } { }
+ \cs_log:N \foo
+ \DeclareExpandableDocumentCommand \foo { + >{\ReverseBoolean} } { }
+ \cs_log:N \foo
}
\TEST { Stripping~braces~in~optional~args }
@@ -196,7 +200,7 @@
\TEST { SplitList }
{
- \DeclareDocumentCommand { \foo } { > { \SplitList {)||(\BOOM\c_false_bool} } m } { \tl_show:n {#1} }
+ \DeclareDocumentCommand { \foo } { > { \SplitList {)||(\BOOM\c_false_bool} } m } { \tl_log:n {#1} }
{ \foo { a ( b } }
}
Modified: trunk/l3packages/xparse/testfiles/xparse004.tlg
===================================================================
--- trunk/l3packages/xparse/testfiles/xparse004.tlg 2015-11-22 17:26:31 UTC (rev 6313)
+++ trunk/l3packages/xparse/testfiles/xparse004.tlg 2015-11-22 22:02:05 UTC (rev 6314)
@@ -16,7 +16,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
-Author: Joseph Wright
+Author: Joseph Wright, Bruno Le Floch
============================================================
TEST 1: Basic definitions r-type arguments
============================================================
@@ -345,8 +345,6 @@
| LaTeX will ignore this entire definition.
|...............................................
> \foo=undefined.
-<recently read> }
-l. ... }
.................................................
. LaTeX info: "xparse/define-command"
.
@@ -372,8 +370,6 @@
| LaTeX will ignore this entire definition.
|...............................................
> \foo=undefined.
-<recently read> }
-l. ... }
.................................................
. LaTeX info: "xparse/define-command"
.
@@ -399,8 +395,6 @@
| LaTeX will ignore this entire definition.
|...............................................
> \foo=undefined.
-<recently read> }
-l. ... }
.................................................
. LaTeX info: "xparse/define-command"
.
@@ -426,8 +420,6 @@
| LaTeX will ignore this entire definition.
|...............................................
> \foo=undefined.
-<recently read> }
-l. ... }
.................................................
. LaTeX info: "xparse/define-command"
.
@@ -453,8 +445,56 @@
| LaTeX will ignore this entire definition.
|...............................................
> \foo=undefined.
-<recently read> }
+.................................................
+. LaTeX info: "xparse/define-command"
+.
+. Defining command \foo with sig. '+>{\ReverseBoolean }' on line ....
+.................................................
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "xparse/bad-arg-spec"
+!
+! Bad argument specification '+>{\ReverseBoolean }'.
+!
+! See the LaTeX3 documentation for further information.
+!
+! For immediate help type H <return>.
+!...............................................
l. ... }
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| This is a coding error.
+|
+| The argument specification provided was not valid: one or more mandatory
+| pieces of information were missing.
+|
+| LaTeX will ignore this entire definition.
+|...............................................
+> \foo=undefined.
+.................................................
+. LaTeX info: "xparse/define-command"
+.
+. Defining command \foo with sig. '+>{\ReverseBoolean }' on line ....
+.................................................
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "xparse/bad-arg-spec"
+!
+! Bad argument specification '+>{\ReverseBoolean }'.
+!
+! See the LaTeX3 documentation for further information.
+!
+! For immediate help type H <return>.
+!...............................................
+l. ... }
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| This is a coding error.
+|
+| The argument specification provided was not valid: one or more mandatory
+| pieces of information were missing.
+|
+| LaTeX will ignore this entire definition.
+|...............................................
+> \foo=undefined.
============================================================
============================================================
TEST 8: Stripping braces in optional args
@@ -963,6 +1003,4 @@
. on line ....
.................................................
> {a(b}.
-<recently read> }
-l. ... }
============================================================
Modified: trunk/l3packages/xparse/xparse.dtx
===================================================================
--- trunk/l3packages/xparse/xparse.dtx 2015-11-22 17:26:31 UTC (rev 6313)
+++ trunk/l3packages/xparse/xparse.dtx 2015-11-22 22:02:05 UTC (rev 6314)
@@ -1114,7 +1114,7 @@
% \begin{macro}{\@@_count_mandatory:n}
% \begin{macro}{\@@_count_mandatory:N}
% \begin{macro}[aux]{\@@_count_mandatory:N}
-% Loop through the signature To count up mandatory arguments before the
+% Loop through the signature to count up mandatory arguments before the
% main parsing run. First, check if the current token is a short-cut for
% another argument type. If it is, expand it and loop again. If not, then
% look for a \enquote{counting} function to check the argument type. No error
@@ -1172,14 +1172,22 @@
% the case, the entire set up is abandoned to avoid any strange internal
% errors. The opportunity is also taken to make sure that where a single
% token is required, one has actually been supplied.
+%
+% The third is that processors and the marker~|+| for long arguments
+% must be followed by arguments. For this, just check that the next
+% token is not \cs{q_recursion_tail}, and remember to leave it after
+% the looping macro.
% \begin{macrocode}
-\cs_new_protected:cpn { @@_count_type_>:w } #1
+\cs_new_protected:cpn { @@_count_type_>:w } #1#2
{
+ \quark_if_recursion_tail_stop_do:nn {#2} { \@@_bad_arg_spec:wn }
+ \@@_count_mandatory:N #2
+ }
+\cs_new_protected:cpn { @@_count_type_+:w } #1
+ {
\quark_if_recursion_tail_stop_do:nn {#1} { \@@_bad_arg_spec:wn }
- \@@_count_mandatory:N
+ \@@_count_mandatory:N #1
}
-\cs_new_protected_nopar:cpn { @@_count_type_+:w }
- { \@@_count_mandatory:N }
\cs_new_protected:Npn \@@_count_type_d:w #1#2
{
\@@_single_token_check:n {#1}
@@ -2534,7 +2542,7 @@
{ \@@_grab_v_aux_loop:NN #1 }
{ \@@_grab_v_aux_abort:n { } }
}
-\cs_new_protected:Npn \@@_grab_v_aux_loop:NN #1 #2
+\cs_new_protected:Npn \@@_grab_v_aux_loop:NN #1#2
{
\@@_grab_v_token_if_char:NTF #2
{
More information about the latex3-commits
mailing list