[latex3-commits] [l3svn] r6772 - Only allow the last argument to be empty in l3fp (fixes #320)
noreply at latex-project.org
noreply at latex-project.org
Sat Dec 3 04:46:42 CET 2016
Author: bruno
Date: 2016-12-03 04:46:41 +0100 (Sat, 03 Dec 2016)
New Revision: 6772
Modified:
trunk/l3kernel/l3fp-parse.dtx
trunk/l3kernel/testfiles/m3expl001.luatex.tlg
trunk/l3kernel/testfiles/m3expl001.ptex.tlg
trunk/l3kernel/testfiles/m3expl001.tlg
trunk/l3kernel/testfiles/m3expl001.uptex.tlg
trunk/l3kernel/testfiles/m3expl001.xetex.tlg
trunk/l3kernel/testfiles/m3expl003.luatex.tlg
trunk/l3kernel/testfiles/m3expl003.ptex.tlg
trunk/l3kernel/testfiles/m3expl003.tlg
trunk/l3kernel/testfiles/m3expl003.uptex.tlg
trunk/l3kernel/testfiles/m3expl003.xetex.tlg
trunk/l3kernel/testfiles/m3fp-parse002.tlg
trunk/l3kernel/testfiles/m3fp-rand001.ptex.tlg
trunk/l3kernel/testfiles/m3fp-rand001.tlg
trunk/l3kernel/testfiles/m3fp-rand001.uptex.tlg
trunk/l3kernel/testfiles/m3fp-rand001.xetex.tlg
trunk/l3kernel/testfiles/m3fp-round002.lvt
trunk/l3kernel/testfiles/m3fp-round002.tlg
Log:
Only allow the last argument to be empty in l3fp (fixes #320)
The culprit was commit r6750: to allow rand() I had made
multi-argument functions in l3fp allow (and ignore) empty
argument. Now only the last argument can be empty.
Modified: trunk/l3kernel/l3fp-parse.dtx
===================================================================
--- trunk/l3kernel/l3fp-parse.dtx 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/l3fp-parse.dtx 2016-12-03 03:46:41 UTC (rev 6772)
@@ -1827,28 +1827,12 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux, EXP, verb]{\@@_parse_prefix_,:Nw}
% \begin{macro}[aux, EXP]{\@@_parse_prefix_):Nw}
-% The right parenthesis and the comma can appear as unary prefixes
-% when an argument of a multi-argument function is missing (for
-% instance the first and last ones in |max(,1,2,)| or in |rand()|).
-% In single-argument functions (precedence~$0$ rather than~$1$) forbid
-% this.
+% The right parenthesis can appear as unary prefixes when arguments of
+% a multi-argument function end with a comma, or when there is no
+% argument, as in |max(1,2,)| or in |rand()|. In single-argument
+% functions (precedence~$0$ rather than~$1$) forbid this.
% \begin{macrocode}
-\cs_new:cpn { @@_parse_prefix_,:Nw } #1
- {
- \if_int_compare:w #1 = \c_one
- \exp_after:wN \@@_parse_one:Nw
- \exp_after:wN #1
- \else:
- \__msg_kernel_expandable_error:nnn
- { kernel } { fp-missing-number } { , }
- \exp_after:wN \c_nan_fp \exp:w \exp_end_continue_f:w
- \exp_after:wN \@@_parse_infix:NN
- \exp_after:wN #1
- \exp_after:wN ,
- \fi:
- }
\cs_new:cpn { @@_parse_prefix_):Nw } #1
{
\if_int_compare:w #1 = \c_one
@@ -1861,7 +1845,6 @@
}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
% \subsubsection{Constants}
%
Modified: trunk/l3kernel/testfiles/m3expl001.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.luatex.tlg 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3expl001.luatex.tlg 2016-12-03 03:46:41 UTC (rev 6772)
@@ -3581,7 +3581,6 @@
Defining \__fp_parse_prefix_.:Nw on line ...
Defining \__fp_parse_prefix_(:Nw on line ...
Defining \__fp_parse_lparen_after:NwN on line ...
-Defining \__fp_parse_prefix_,:Nw on line ...
Defining \__fp_parse_prefix_):Nw on line ...
Defining \__fp_parse_word_inf:N on line ...
Defining \__fp_parse_word_nan:N on line ...
Modified: trunk/l3kernel/testfiles/m3expl001.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.ptex.tlg 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3expl001.ptex.tlg 2016-12-03 03:46:41 UTC (rev 6772)
@@ -3572,7 +3572,6 @@
Defining \__fp_parse_prefix_.:Nw on line ...
Defining \__fp_parse_prefix_(:Nw on line ...
Defining \__fp_parse_lparen_after:NwN on line ...
-Defining \__fp_parse_prefix_,:Nw on line ...
Defining \__fp_parse_prefix_):Nw on line ...
Defining \__fp_parse_word_inf:N on line ...
Defining \__fp_parse_word_nan:N on line ...
Modified: trunk/l3kernel/testfiles/m3expl001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.tlg 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3expl001.tlg 2016-12-03 03:46:41 UTC (rev 6772)
@@ -3572,7 +3572,6 @@
Defining \__fp_parse_prefix_.:Nw on line ...
Defining \__fp_parse_prefix_(:Nw on line ...
Defining \__fp_parse_lparen_after:NwN on line ...
-Defining \__fp_parse_prefix_,:Nw on line ...
Defining \__fp_parse_prefix_):Nw on line ...
Defining \__fp_parse_word_inf:N on line ...
Defining \__fp_parse_word_nan:N on line ...
Modified: trunk/l3kernel/testfiles/m3expl001.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.uptex.tlg 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3expl001.uptex.tlg 2016-12-03 03:46:41 UTC (rev 6772)
@@ -3572,7 +3572,6 @@
Defining \__fp_parse_prefix_.:Nw on line ...
Defining \__fp_parse_prefix_(:Nw on line ...
Defining \__fp_parse_lparen_after:NwN on line ...
-Defining \__fp_parse_prefix_,:Nw on line ...
Defining \__fp_parse_prefix_):Nw on line ...
Defining \__fp_parse_word_inf:N on line ...
Defining \__fp_parse_word_nan:N on line ...
Modified: trunk/l3kernel/testfiles/m3expl001.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.xetex.tlg 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3expl001.xetex.tlg 2016-12-03 03:46:41 UTC (rev 6772)
@@ -3579,7 +3579,6 @@
Defining \__fp_parse_prefix_.:Nw on line ...
Defining \__fp_parse_prefix_(:Nw on line ...
Defining \__fp_parse_lparen_after:NwN on line ...
-Defining \__fp_parse_prefix_,:Nw on line ...
Defining \__fp_parse_prefix_):Nw on line ...
Defining \__fp_parse_word_inf:N on line ...
Defining \__fp_parse_word_nan:N on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.luatex.tlg 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3expl003.luatex.tlg 2016-12-03 03:46:41 UTC (rev 6772)
@@ -3582,7 +3582,6 @@
Defining \__fp_parse_prefix_.:Nw on line ...
Defining \__fp_parse_prefix_(:Nw on line ...
Defining \__fp_parse_lparen_after:NwN on line ...
-Defining \__fp_parse_prefix_,:Nw on line ...
Defining \__fp_parse_prefix_):Nw on line ...
Defining \__fp_parse_word_inf:N on line ...
Defining \__fp_parse_word_nan:N on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.ptex.tlg 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3expl003.ptex.tlg 2016-12-03 03:46:41 UTC (rev 6772)
@@ -3573,7 +3573,6 @@
Defining \__fp_parse_prefix_.:Nw on line ...
Defining \__fp_parse_prefix_(:Nw on line ...
Defining \__fp_parse_lparen_after:NwN on line ...
-Defining \__fp_parse_prefix_,:Nw on line ...
Defining \__fp_parse_prefix_):Nw on line ...
Defining \__fp_parse_word_inf:N on line ...
Defining \__fp_parse_word_nan:N on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.tlg 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3expl003.tlg 2016-12-03 03:46:41 UTC (rev 6772)
@@ -3573,7 +3573,6 @@
Defining \__fp_parse_prefix_.:Nw on line ...
Defining \__fp_parse_prefix_(:Nw on line ...
Defining \__fp_parse_lparen_after:NwN on line ...
-Defining \__fp_parse_prefix_,:Nw on line ...
Defining \__fp_parse_prefix_):Nw on line ...
Defining \__fp_parse_word_inf:N on line ...
Defining \__fp_parse_word_nan:N on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.uptex.tlg 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3expl003.uptex.tlg 2016-12-03 03:46:41 UTC (rev 6772)
@@ -3573,7 +3573,6 @@
Defining \__fp_parse_prefix_.:Nw on line ...
Defining \__fp_parse_prefix_(:Nw on line ...
Defining \__fp_parse_lparen_after:NwN on line ...
-Defining \__fp_parse_prefix_,:Nw on line ...
Defining \__fp_parse_prefix_):Nw on line ...
Defining \__fp_parse_word_inf:N on line ...
Defining \__fp_parse_word_nan:N on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.xetex.tlg 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3expl003.xetex.tlg 2016-12-03 03:46:41 UTC (rev 6772)
@@ -3580,7 +3580,6 @@
Defining \__fp_parse_prefix_.:Nw on line ...
Defining \__fp_parse_prefix_(:Nw on line ...
Defining \__fp_parse_lparen_after:NwN on line ...
-Defining \__fp_parse_prefix_,:Nw on line ...
Defining \__fp_parse_prefix_):Nw on line ...
Defining \__fp_parse_word_inf:N on line ...
Defining \__fp_parse_word_nan:N on line ...
Modified: trunk/l3kernel/testfiles/m3fp-parse002.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3fp-parse002.tlg 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3fp-parse002.tlg 2016-12-03 03:46:41 UTC (rev 6772)
@@ -150,9 +150,36 @@
TEST 7: Extra or missing arguments
============================================================
> min()=inf.
-> max(, \c_space_tl ,,)=-inf.
! Undefined control sequence.
<argument> \LaTeX3 error:
+ Missing number before ','.
+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.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Missing number before ','.
+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.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Missing number before ','.
+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.
+> max(, \c_space_tl ,,)=nan.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
Unexpected comma: extra arguments ignored.
l. ... }
The control sequence at the end of the top line
Modified: trunk/l3kernel/testfiles/m3fp-rand001.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3fp-rand001.ptex.tlg 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3fp-rand001.ptex.tlg 2016-12-03 03:46:41 UTC (rev 6772)
@@ -70,7 +70,7 @@
============================================================
! Undefined control sequence.
<argument> \LaTeX3 error:
- Random numbers unavailable
+ Missing number before ','.
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -97,6 +97,15 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
+ rand() expects between 0 and 0 arguments.
+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.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
randint() expects between 1 and 2 arguments.
l. ... }
The control sequence at the end of the top line
Modified: trunk/l3kernel/testfiles/m3fp-rand001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3fp-rand001.tlg 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3fp-rand001.tlg 2016-12-03 03:46:41 UTC (rev 6772)
@@ -44,6 +44,15 @@
============================================================
! Undefined control sequence.
<argument> \LaTeX3 error:
+ Missing number before ','.
+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.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
rand() expects between 0 and 0 arguments.
l. ... }
The control sequence at the end of the top line
@@ -62,6 +71,15 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
+ rand() expects between 0 and 0 arguments.
+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.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
randint() expects between 1 and 2 arguments.
l. ... }
The control sequence at the end of the top line
@@ -150,10 +168,10 @@
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.
-0.5455874475799493
nan
nan
nan
+nan
1
nan
nan
Modified: trunk/l3kernel/testfiles/m3fp-rand001.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3fp-rand001.uptex.tlg 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3fp-rand001.uptex.tlg 2016-12-03 03:46:41 UTC (rev 6772)
@@ -70,7 +70,7 @@
============================================================
! Undefined control sequence.
<argument> \LaTeX3 error:
- Random numbers unavailable
+ Missing number before ','.
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -97,6 +97,15 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
+ rand() expects between 0 and 0 arguments.
+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.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
randint() expects between 1 and 2 arguments.
l. ... }
The control sequence at the end of the top line
Modified: trunk/l3kernel/testfiles/m3fp-rand001.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3fp-rand001.xetex.tlg 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3fp-rand001.xetex.tlg 2016-12-03 03:46:41 UTC (rev 6772)
@@ -70,7 +70,7 @@
============================================================
! Undefined control sequence.
<argument> \LaTeX3 error:
- Random numbers unavailable
+ Missing number before ','.
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
@@ -97,6 +97,15 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
+ rand() expects between 0 and 0 arguments.
+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.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
randint() expects between 1 and 2 arguments.
l. ... }
The control sequence at the end of the top line
Modified: trunk/l3kernel/testfiles/m3fp-round002.lvt
===================================================================
--- trunk/l3kernel/testfiles/m3fp-round002.lvt 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3fp-round002.lvt 2016-12-03 03:46:41 UTC (rev 6772)
@@ -25,18 +25,22 @@
\fp_to_tl:n { round(1, -inf) } \NEWLINE
\fp_to_tl:n { round(1, 1e999) } \NEWLINE
\fp_to_tl:n { round(1, -1e999) } \NEWLINE
+ \fp_to_tl:n { round(,4) } \NEWLINE
\fp_to_tl:n { trunc() } \NEWLINE
\fp_to_tl:n { trunc(0.1) } \NEWLINE
\fp_to_tl:n { trunc(0.1, 1.2) } \NEWLINE
\fp_to_tl:n { trunc(1, 2, 3) } \NEWLINE
+ \fp_to_tl:n { trunc(,4) } \NEWLINE
\fp_to_tl:n { ceil() } \NEWLINE
\fp_to_tl:n { ceil(0.1) } \NEWLINE
\fp_to_tl:n { ceil(0.1, 1.2) } \NEWLINE
\fp_to_tl:n { ceil(1, 2, 3) } \NEWLINE
+ \fp_to_tl:n { ceil(,4) } \NEWLINE
\fp_to_tl:n { floor() } \NEWLINE
\fp_to_tl:n { floor(0.1) } \NEWLINE
\fp_to_tl:n { floor(0.1, 1.2) } \NEWLINE
\fp_to_tl:n { floor(1, 2, 3) } \NEWLINE
+ \fp_to_tl:n { floor(,4) } \NEWLINE
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Modified: trunk/l3kernel/testfiles/m3fp-round002.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3fp-round002.tlg 2016-11-28 15:13:25 UTC (rev 6771)
+++ trunk/l3kernel/testfiles/m3fp-round002.tlg 2016-12-03 03:46:41 UTC (rev 6772)
@@ -51,6 +51,15 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
+ Missing number before ','.
+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.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
trunc() expects between 1 and 2 arguments.
l. ... }
The control sequence at the end of the top line
@@ -78,6 +87,15 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
+ Missing number before ','.
+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.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
ceil() expects between 1 and 2 arguments.
l. ... }
The control sequence at the end of the top line
@@ -105,6 +123,15 @@
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
+ Missing number before ','.
+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.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
floor() expects between 1 and 2 arguments.
l. ... }
The control sequence at the end of the top line
@@ -130,6 +157,15 @@
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.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Missing number before ','.
+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.
nan
0
nan
@@ -141,17 +177,21 @@
1
0
nan
+nan
0
nan
nan
nan
+nan
1
nan
nan
nan
+nan
0
nan
nan
+nan
============================================================
============================================================
TEST 2: Rounding with third argument
More information about the latex3-commits
mailing list