[latex3-commits] [latex3/latex3] main: Add possible forms of a fp variable (d5c4dfe60)
github at latex-project.org
github at latex-project.org
Sun Oct 29 11:39:17 CET 2023
Repository : https://github.com/latex3/latex3
On branch : main
Link : https://github.com/latex3/latex3/commit/d5c4dfe60fe0e9fa5c2607e66669719585dab0d9
>---------------------------------------------------------------
commit d5c4dfe60fe0e9fa5c2607e66669719585dab0d9
Author: Yukai Chou <muzimuzhi at gmail.com>
Date: Sat Oct 28 10:31:56 2023 +0800
Add possible forms of a fp variable
>---------------------------------------------------------------
d5c4dfe60fe0e9fa5c2607e66669719585dab0d9
l3kernel/l3fp-assign.dtx | 31 ++++++++++++++++++++++++++-----
l3kernel/testfiles/m3show003.tlg | 4 +++-
2 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/l3kernel/l3fp-assign.dtx b/l3kernel/l3fp-assign.dtx
index bcb691730..7764a2706 100644
--- a/l3kernel/l3fp-assign.dtx
+++ b/l3kernel/l3fp-assign.dtx
@@ -183,14 +183,33 @@
%
% \begin{macro}[EXP]
% {
-% \@@_show_validate:n,
+% \@@_show_validate:n, \@@_show_validate_aux:n, \@@_show_validate:nn,
+% }
+% \begin{macro}[EXP]
+% {
% \@@_show_validate:w,
% \@@_tuple_show_validate:w,
% \@@_symbolic_show_validate:w
% }
% To support symbolic expression, validation has to be done recursively.
+% Two |\@@_show_validate:nn| wrappers are used to distinguish between
+% initial and recursive calls, in which the former provides a demo of
+% possible forms a |fp| variable would have.
% \begin{macrocode}
\cs_new:Npn \@@_show_validate:n #1
+ {
+ \@@_show_validate:nn { #1 }
+ {
+ \s_@@ \@@_chk:w ??? ;~ or \iow_newline:
+ \s_@@_tuple \_@@_tuple_chk:w ? ;~ or \iow_newline:
+ \s_@@_symbolic \@@_symbolic_chk:w ? , ? ;
+ }
+ }
+\cs_new:Npn \@@_show_validate_aux:n #1
+ {
+ \@@_show_validate:nn { #1 } { }
+ }
+\cs_new:Npn \@@_show_validate:nn #1#2
{
\tl_if_empty:nF { #1 }
{
@@ -212,6 +231,7 @@
\s_@@_symbolic \@@_symbolic_chk:w ? , ?? ; \s_@@_stop
}
}
+ { #2 }
}
}
\cs_new:Npn \@@_show_validate:w
@@ -222,14 +242,14 @@
\token_if_eq_meaning:NNTF #2 1
{ \s_@@ \@@_chk:w #2 #3 { #4 } #5 ; }
{ \s_@@ \@@_chk:w #2 #3 #4 #5 ; }
- \@@_show_validate:n { #6 }
+ \@@_show_validate_aux:n { #6 }
}
}
\cs_new:Npn \@@_tuple_show_validate:w
#1 \s_@@_tuple \_@@_tuple_chk:w #2#3 ; #4 \s_@@_stop
{
\str_if_eq:nnF { #2 } {?}
- { \s_@@_tuple \@@_tuple_chk:w { \@@_show_validate:n { #2 } } ; }
+ { \s_@@_tuple \@@_tuple_chk:w { \@@_show_validate_aux:n { #2 } } ; }
}
\cs_new:Npn \@@_symbolic_show_validate:w
#1 \s_@@_symbolic \@@_symbolic_chk:w #2 , #3#4 ; #5 \s_@@_stop
@@ -237,12 +257,13 @@
\str_if_eq:nnF { #2 } {?}
{
\s_@@_symbolic \@@_symbolic_chk:w \exp_not:n { #2 } ,
- { \@@_show_validate:n { #3 } };
- \@@_show_validate:n { #5 }
+ { \@@_show_validate_aux:n { #3 } };
+ \@@_show_validate_aux:n { #5 }
}
}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\fp_show:n, \fp_log:n}
% Use general tools.
diff --git a/l3kernel/testfiles/m3show003.tlg b/l3kernel/testfiles/m3show003.tlg
index a07b038e7..29c77d4a1 100644
--- a/l3kernel/testfiles/m3show003.tlg
+++ b/l3kernel/testfiles/m3show003.tlg
@@ -299,7 +299,9 @@ This is a coding error.
The variable '\l_tmpa_tl' with value
a,
should be a fp variable, but it does not have the correct internal structure:
- \s__fp \__fp_chk:w ???;
+ \s__fp \__fp_chk:w ???; or
+ \s__fp_tuple \__fp_tuple_chk:w ?; or
+ \s__fp_symbolic \__fp_symbolic_chk:w ?,?;
! LaTeX Error: Variable '\l_tmpa_tl' is not a valid fp.
For immediate help type H <return>.
...
More information about the latex3-commits
mailing list.