summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx39
1 files changed, 33 insertions, 6 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx
index 1936b34f888..5fe3aaac4d9 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: l3fp-parse.dtx Copyright (C) 2011-2016 The LaTeX3 Project
+%% File: l3fp-parse.dtx Copyright (C) 2011-2017 The LaTeX3 Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -22,7 +22,7 @@
%
%<*driver>
\documentclass[full]{l3doc}
-\GetIdInfo$Id: l3fp-parse.dtx 6805 2016-12-28 22:15:52Z joseph $
+\GetIdInfo$Id: l3fp-parse.dtx 6877 2017-02-10 03:59:09Z bruno $
{L3 Floating-point expression parsing}
\begin{document}
\DocInput{\jobname.dtx}
@@ -836,11 +836,14 @@
% \@@_parse_one_register_auxii:wwwNw,
% \@@_parse_one_register_int:www,
% \@@_parse_one_register_mu:www,
-% \@@_parse_one_register_dim:ww
+% \@@_parse_one_register_dim:ww,
+% \@@_parse_one_register_wd:w,
+% \@@_parse_one_register_wd:Nw,
% }
% This is called whenever~|#2| is a control sequence other than
-% \cs{scan_stop:} in meaning. We assume that it is a register, but
-% carefully unpacking it with \cs{tex_the:D} within braces. First, we
+% \cs{scan_stop:} in meaning. We special-case \tn{wd}, \tn{ht}, \tn{dp}
+% (see later) and otherwise assume that it is a register, but
+% carefully unpack it with \cs{tex_the:D} within braces. First, we
% find the exponent following~|#2|. Then we unpack~|#2| with
% \cs{tex_the:D}, and the \texttt{auxii} auxiliary distinguishes
% integer registers from dimensions/skips from muskips, according to
@@ -859,6 +862,9 @@
\exp_after:wN \@@_parse_infix_after_operand:NwN
\exp_after:wN #1
\exp:w \exp_end_continue_f:w
+ \if_meaning:w \box_wd:N #2 \@@_parse_one_register_wd:w \fi:
+ \if_meaning:w \box_ht:N #2 \@@_parse_one_register_wd:w \fi:
+ \if_meaning:w \box_dp:N #2 \@@_parse_one_register_wd:w \fi:
\exp_after:wN \@@_parse_one_register_aux:Nw
\exp_after:wN #2
\__int_value:w
@@ -896,6 +902,27 @@
\__int_value:w \__dim_eval:w #1 pt ;
}
% \end{macrocode}
+% The \tn{wd}, \tn{dp}, \tn{ht} primitives expect an integer argument.
+% We abuse the exponent parser to find the integer argument: simply
+% include the exponent marker~|e|. Once that \enquote{exponent} is
+% found, use \cs{tex_the:D} to find the box dimension and then copy
+% what we did for dimensions.
+% \begin{macrocode}
+\cs_new:Npn \@@_parse_one_register_wd:w
+ #1#2 \exp_after:wN #3#4 \@@_parse_expand:w
+ {
+ #1
+ \exp_after:wN \@@_parse_one_register_wd:Nw
+ #4 \@@_parse_expand:w e
+ }
+\cs_new:Npn \@@_parse_one_register_wd:Nw #1#2 ;
+ {
+ \exp_after:wN \@@_from_dim_test:ww
+ \exp_after:wN 0 \exp_after:wN ,
+ \__int_value:w \__dim_eval:w
+ \exp_after:wN \use:n \exp_after:wN { \tex_the:D #1 #2 } ;
+ }
+% \end{macrocode}
% \end{macro}
%
% \begin{macro}[aux, EXP]{\@@_parse_one_digit:NN}
@@ -1584,7 +1611,7 @@
% \begin{macro}[aux, rEXP]
% {\@@_parse_exponent:N, \@@_parse_exponent_aux:N}
% This function should be called within an \cs{__int_value:w}
-% expansion (or within an integer expression. It leaves digits of the
+% expansion (or within an integer expression). It leaves digits of the
% exponent behind it in the input stream, and terminates the expansion
% with a semicolon. If there is no~|e|, leave an exponent of~$0$. If
% there is an~|e|, expand the next token to run some tests on it. The