[latex3-commits] [l3svn] r5885 - Replaced \tex_romannumeral:D ... \c_zero with \exp:w ... \exp_end
noreply at latex-project.org
noreply at latex-project.org
Mon Aug 24 15:29:15 CEST 2015
Author: mittelba
Date: 2015-08-24 15:29:14 +0200 (Mon, 24 Aug 2015)
New Revision: 5885
Modified:
trunk/l3kernel/l3basics.dtx
trunk/l3kernel/l3candidates.dtx
trunk/l3kernel/l3expan.dtx
trunk/l3kernel/l3fp-aux.dtx
trunk/l3kernel/l3fp-convert.dtx
trunk/l3kernel/l3fp-expo.dtx
trunk/l3kernel/l3fp-extended.dtx
trunk/l3kernel/l3fp-logic.dtx
trunk/l3kernel/l3fp-parse.dtx
trunk/l3kernel/l3fp-round.dtx
trunk/l3kernel/l3fp-trig.dtx
trunk/l3kernel/l3int.dtx
trunk/l3kernel/l3msg.dtx
trunk/l3kernel/l3prg.dtx
trunk/l3kernel/l3skip.dtx
trunk/l3kernel/l3str.dtx
trunk/l3kernel/l3tl.dtx
trunk/l3kernel/l3token.dtx
trunk/l3kernel/testfiles/m3basics002.tlg
trunk/l3kernel/testfiles/m3expan002.tlg
trunk/l3kernel/testfiles/m3expl001.luatex.tlg
trunk/l3kernel/testfiles/m3expl001.tlg
trunk/l3kernel/testfiles/m3expl001.xetex.tlg
trunk/l3kernel/testfiles/m3expl003.luatex.tlg
trunk/l3kernel/testfiles/m3expl003.tlg
trunk/l3kernel/testfiles/m3expl003.xetex.tlg
Log:
Replaced \tex_romannumeral:D ... \c_zero with \exp:w ... \exp_end
Replaced \tex_romannumeral:D ... -`0 with \exp:w ... \ex_continue_f:w
Replaced \__int_to_roman:w where it was there only for expansion purposes
Have not tried to do all of that in the fp code (probably several \c_zero's need to be changed there but I'll thought I better leave this to somebody understanding this code by heart :-)
May have missed one or the other ... so a second sweep is advisable
Modified: trunk/l3kernel/l3basics.dtx
===================================================================
--- trunk/l3kernel/l3basics.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3basics.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -1378,15 +1378,19 @@
% \end{macro}
%
% \begin{macro}[EXP]{\exp_after:wN, \exp_not:N, \exp_not:n}
-% The three |\exp_| functions are used in the \textsf{l3expan} module
+% The five |\exp_| functions are used in the \textsf{l3expan} module
% where they are described.
% \begin{macrocode}
\tex_let:D \exp_after:wN \tex_expandafter:D
\tex_let:D \exp_not:N \tex_noexpand:D
\tex_let:D \exp_not:n \etex_unexpanded:D
+\tex_let:D \exp:w \tex_romannumeral:D
+\tex_chardef:D \exp_end: = 0 ~
% \end{macrocode}
% \end{macro}
%
+
+
% \begin{macro}[EXP]{\token_to_meaning:N, \cs_meaning:N}
% Examining a control sequence or token.
% \begin{macrocode}
@@ -1716,18 +1720,18 @@
% interface.
%
% \begin{macro}[EXP]{\prg_return_true:, \prg_return_false:}
-% The idea here is that \cs{__int_to_roman:w} will expand fully any
+% The idea here is that \cs{exp:w} will expand fully any
% \cs{else:} and the \cs{fi:} that are waiting to be discarded,
-% before reaching the \cs{c_zero} which will leave the expansion null.
+% before reaching the \cs{exp_end:} which will leave the expansion null.
% The code can then leave either the first or second argument in the
% input stream. This means that all of the branching code has to contain
% at least two tokens: see how the logical tests are actually implemented
% to see this.
% \begin{macrocode}
\cs_set_nopar:Npn \prg_return_true:
- { \exp_after:wN \use_i:nn \__int_to_roman:w }
+ { \exp_after:wN \use_i:nn \exp:w }
\cs_set_nopar:Npn \prg_return_false:
- { \exp_after:wN \use_ii:nn \__int_to_roman:w}
+ { \exp_after:wN \use_ii:nn \exp:w}
% \end{macrocode}
% An extended state space could be implemented by including a more
% elaborate function in place of \cs{use_i:nn}/\cs{use_ii:nn}. Provided
@@ -1894,7 +1898,7 @@
% following arguments: 1: \texttt{set} or \texttt{new}, 2: empty or
% \texttt{\_protected}, 3: function name 4: signature, 5: parameter
% text (or empty), 6: replacement. Remember that the logic-returning
-% functions expect two arguments to be present after \cs{c_zero}:
+% functions expect two arguments to be present after \cs{exp_end:}:
% notice the construction of the different variants relies on this,
% and that the |TF| variant will be slightly faster than the |T|
% version. The |p| form is only valid for expandable tests, we check
@@ -1910,7 +1914,7 @@
\fi:
{
\exp_args:cc { cs_ #2 #3 :Npn } { #4 _p: #5 } #6
- { #7 \c_zero \c_true_bool \c_false_bool }
+ { #7 \exp_end: \c_true_bool \c_false_bool }
}
{
\__msg_kernel_error:nnx { kernel } { protected-predicate }
@@ -1921,19 +1925,19 @@
#1 \q_stop #2#3#4#5#6#7
{
\exp_args:cc { cs_ #2 #3 :Npn } { #4 : #5 T } #6
- { #7 \c_zero \use:n \use_none:n }
+ { #7 \exp_end: \use:n \use_none:n }
}
\cs_set_protected:Npn \__prg_generate_F_form:wnnnnnn
#1 \q_stop #2#3#4#5#6#7
{
\exp_args:cc { cs_ #2 #3 :Npn } { #4 : #5 F } #6
- { #7 \c_zero { } }
+ { #7 \exp_end: { } }
}
\cs_set_protected:Npn \__prg_generate_TF_form:wnnnnnn
#1 \q_stop #2#3#4#5#6#7
{
\exp_args:cc { cs_ #2 #3 :Npn } { #4 : #5 TF } #6
- { #7 \c_zero }
+ { #7 \exp_end: }
}
% \end{macrocode}
% \end{macro}
@@ -2088,33 +2092,38 @@
% The character codes are different, thus the \cs{if:w} test is false,
% and \TeX{} reads \cs{__cs_to_str:N} after turning the following
% control sequence into a string; this auxiliary removes the escape
-% character, and stops the expansion of the initial \cs{__int_to_roman:w}.
+% character, and stops the expansion of the initial \cs{exp:w}.
% The second case is that the escape character is not printable. Then
% the \cs{if:w} test is unfinished after reading a the space from
% \verb*|\token_to_str:N \ |, and the auxiliary \cs{__cs_to_str:w}
% is expanded, feeding |-| as a second character for the test;
% the test is false, and \TeX{} skips to \cs{fi:}, then performs
-% \cs{token_to_str:N}, and stops the \cs{__int_to_roman:w} with \cs{c_zero}.
+% \cs{token_to_str:N}, and stops the \cs{exp:w} with \cs{exp_end:}.
% The last case is that the escape character is itself a space. In this
% case, the \cs{if:w} test is true, and the auxiliary \cs{__cs_to_str:w}
-% comes into play, inserting |-\__int_value:w|, which expands \cs{c_zero}
-% to the character |0|. The initial \cs{__int_to_roman:w} then sees
+% comes into play, inserting |-\__int_value:w|, which expands \cs{exp_end:}
+% to the character |0|. The initial \cs{exp:w} then sees
% |0|, which is not a terminated number, followed by the escape character,
-% a space, which is removed, terminating the argument of
-% \cs{__int_to_roman:w}.
+% a space, which is removed, terminating the expansion of
+% \cs{exp:w}.
% In all three cases, \cs{cs_to_str:N} takes two expansion steps
-% to be fully expanded.
+% to be fully expanded.\footnote{Frank: fix documentation}
% \begin{macrocode}
\cs_set_nopar:Npn \cs_to_str:N
{
- \__int_to_roman:w
+ \exp:w
\if:w \token_to_str:N \ \__cs_to_str:w \fi:
\exp_after:wN \__cs_to_str:N \token_to_str:N
}
-\cs_set:Npn \__cs_to_str:N #1 { \c_zero }
+\cs_set:Npn \__cs_to_str:N #1 { \exp_end: }
\cs_set:Npn \__cs_to_str:w #1 \__cs_to_str:N
- { - \__int_value:w \fi: \exp_after:wN \c_zero }
+ { \exp_continue_f:w \exp_after:wN \use_none:nn \fi: \exp_after:wN \exp_end: }
% \end{macrocode}
+% A slightly more compact coding would be using the fact that we
+% know how \cs{exp_end:} is implemented.
+% \begin{macrocode}
+% { - \__int_value:w \fi: \exp_after:wN \exp_end: }
+% \end{macrocode}
% \end{macro}
% \end{macro}
%
Modified: trunk/l3kernel/l3candidates.dtx
===================================================================
--- trunk/l3kernel/l3candidates.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3candidates.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -2748,7 +2748,7 @@
{
\tl_if_empty:nTF {#1}
{ \prg_return_false: }
- { \@@_if_empty_return:o { \tex_romannumeral:D -`0 #1 } }
+ { \@@_if_empty_return:o { \exp:w \exp_continue_f:w #1 } }
}
}
% \end{macrocode}
@@ -2762,7 +2762,7 @@
{
\etex_unexpanded:D \exp_after:wN
{
- \tex_romannumeral:D
+ \exp:w
\@@_act:NNNnn
\@@_reverse_normal:nN
\@@_reverse_group:nn
@@ -2799,8 +2799,9 @@
% \@@_act_count_group:nn, \@@_act_count_space:n}
% The token count is computed through an \cs{int_eval:n} construction.
% Each \texttt{1+} is output to the \emph{left}, into the integer
-% expression, and the sum is ended by the \cs{c_zero} inserted by
-% \cs{@@_act_end:wn}. Somewhat a hack.
+% expression, and the sum is ended by the \cs{exp_end:} inserted by
+% \cs{@@_act_end:wn} (which is technically implemented as \cs{c_zero}).
+% Somewhat a hack!
% \begin{macrocode}
\cs_new:Npn \tl_count_tokens:n #1
{
@@ -2853,14 +2854,14 @@
% tests, and converted if necessary to upper/lowercase,
% before being output. For a group, we must perform the
% conversion within the group (the \cs{exp_after:wN} trigger
-% \tn{romannumeral}, which expands fully to give the
+% \cs{exp:w}, which expands fully to give the
% converted group), then output.
% \begin{macrocode}
\cs_new:Npn \tl_expandable_uppercase:n #1
{
\etex_unexpanded:D \exp_after:wN
{
- \tex_romannumeral:D
+ \exp:w
\@@_act_case_aux:nn { \c_@@_act_uppercase_tl } {#1}
}
}
@@ -2868,7 +2869,7 @@
{
\etex_unexpanded:D \exp_after:wN
{
- \tex_romannumeral:D
+ \exp:w
\@@_act_case_aux:nn { \c_@@_act_lowercase_tl } {#1}
}
}
@@ -2893,7 +2894,7 @@
\exp_after:wN \@@_act_output:n \exp_after:wN
{
\exp_after:wN
- { \tex_romannumeral:D \@@_act_case_aux:nn {#1} {#2} }
+ { \exp:w \@@_act_case_aux:nn {#1} {#2} }
}
}
% \end{macrocode}
@@ -3058,7 +3059,7 @@
{
\etex_unexpanded:D \exp_after:wN
{
- \tex_romannumeral:D
+ \exp:w
\@@_change_case_aux:nnn {#1} {#2} {#3}
}
}
@@ -3087,7 +3088,7 @@
% up for \texttt{f}-type expandability has two requirements: a marker
% token after the main loop (see above) and a mechanism to \enquote{load}
% and finalise the result. That is handled in the code below, which includes
-% the necessary material to end the \tn{romannumeral} expansion.
+% the necessary material to end the \cs{exp:w} expansion.
% \begin{macrocode}
\cs_new:Npn \@@_change_case_output:nwn #1#2 \@@_change_case_result:n #3
{ #2 \@@_change_case_result:n { #3 #1 } }
@@ -3095,7 +3096,7 @@
\cs_new:Npn \@@_change_case_end:wn #1 \@@_change_case_result:n #2
{
\group_align_safe_end:
- \c_zero
+ \exp_end:
#2
}
% \end{macrocode}
@@ -3114,7 +3115,7 @@
{
\exp_after:wN
{
- \tex_romannumeral:D
+ \exp:w
\@@_change_case_aux:nnn {#3} {#4} {#1}
}
}
@@ -3780,7 +3781,7 @@
{
\etex_unexpanded:D \exp_after:wN
{
- \tex_romannumeral:D
+ \exp:w
\@@_mixed_case_aux:nn {#1} {#2}
}
}
@@ -3808,7 +3809,7 @@
{
\exp_after:wN
{
- \tex_romannumeral:D
+ \exp:w
\@@_mixed_case_aux:nn {#3} {#1}
}
}
Modified: trunk/l3kernel/l3expan.dtx
===================================================================
--- trunk/l3kernel/l3expan.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3expan.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -528,6 +528,7 @@
% \end{texnote}
% \end{function}
%
+%
% \section{Preventing expansion}
%
% Despite the fact that the following functions are all about preventing
@@ -619,6 +620,114 @@
% form, but when typeset it produces the underlying space (\verb*| |).
% \end{function}
%
+%
+% \section{Controlled expansion}
+%
+% The \pkg{expl3} language makes all efforts to hide the complexity of
+% \TeX{} expansion from the programmer by providing concepts that
+% evaluate/expand arguments of functions prior to calling the ``base''
+% functions. Thus, instead of using many \tn{expandafter} calls and
+% other trickery it is usually a matter of chosing the right variant
+% of a function to achieve a desired result.
+%
+% Of course, deep down \TeX{} is using expansion as always and there
+% are cases where a programmer needs to control that expansion
+% directly; typical situations are basic data manipulation tools. This
+% section documents the functions for that level. You will find these
+% commands used throughout the kernel code, but we hope that outside
+% the kernel there will be little need to resort to them. Instead the
+% argument manipulation methods document above should usually be sufficient.
+%
+% While \cs{exp_after:wN} expands one token (out of order) it is
+% sometimes necessary to expand several tokens in one go. The next set
+% of commands provide this functionality. Be aware that it is
+% absolutely required that the programmer has full control over the
+% tokens to be expanded, i.e., it is not possible to use these
+% functions to expand unknown input as part of
+% \meta{expandable-tokens} as that will break badly if unexpandable
+% tokens are encountered in that place!
+%
+% \begin{function}[added=2015-08-23,EXP]
+% {
+% \exp:w ,
+% \exp_end:
+% }
+% \begin{syntax}
+% \cs{exp:w} \meta{expandable-tokens} \cs{exp_end:} \\
+% \end{syntax}
+% Expands \meta{expandable-tokens} until reaching \cs{exp_end:} at
+% which point expansion stops.
+% If any token in \meta{expandable-tokens} or any token generated by
+% expanding the tokens therein is not expandable the expansion will end
+% prematurely and as a result \cs{exp_end:} will be misinterpreted
+% later on.\footnotemark
+%
+% In typical use cases the \cs{exp_end:} will be hidden somewhere
+% in the replacement text of \meta{expandable-tokens} rather than
+% being on the same expansion level than \cs{exp:w}, e.g., you may
+% see code such as
+%\begin{verbatim}
+% \exp:w \@@_case:NnTF #1 {#2} { } { }
+%\end{verbatim}
+% where somewhere during the expansion of |\@@_case:NnTF| the
+% \cs{exp_end:} gets generated.
+% \end{function}
+% \footnotetext{Due to the implementation you might get the character
+% in position 0 in the current font (typically ``\texttt`'')
+% in the output without any error message!}
+%
+% \begin{function}[added=2015-08-23,EXP]
+% {
+% \exp:w ,
+% \exp_continue_f:w
+% }
+% \begin{syntax}
+% \cs{exp:w} \meta{expandable-tokens} \cs{exp_continue_f:w} \meta{further-tokens}
+% \end{syntax}
+% Expands \meta{expandable-tokens} until reaching \cs{exp_continue_f:} at
+% which point expansion continues as an f-type expansion expanding
+% \meta{futher-tokens} until an unexpandable token is encountered (or
+% the f-type expansion is explicitly terminated by
+% \cs{exp_stop_f:}). As with all f-type expansions a space ending
+% the expansion will get removed.
+%
+% If any token in \meta{expandable-tokens} or any token generated by
+% expanding the tokens therein is not expandable the expansion will end
+% prematurely and as a result \cs{exp_continue_f:w} will be misinterpreted
+% later on.\footnotemark
+%
+%
+% In typical use cases \meta{expandable-tokens} is empty,
+% e.g., you will see code such as
+%\begin{verbatim}
+% \exp_after:wN { \exp:w \exp_continue_f:w #2 }
+%\end{verbatim}
+% where the \cs{exp_after:wN} triggers an f-expansion of the tokens
+% in |#2|. For technical reasons this has to happen using two tokens
+% (if they would be hidden inside another command \cs{exp_after:wN}
+% would only expand the command but not trigger any additional
+% f-expansion).
+%
+% You might wonder why there are two different approaches available,
+% after all the effect of
+% \begin{quote}
+% \cs{exp:w} \meta{expandable-tokens} \cs{exp_end:}
+% \end{quote}
+% can be alternatively achieved through an f-type expansion by using
+% \cs{exp_stop_f:}, i.e.
+% \begin{quote}
+% \cs{exp:w} \cs{exp_continue_f:w} \meta{expandable-tokens} \cs{exp_stop_f:}
+% \end{quote}
+% The reason is simply that the first approach is slightly more
+% performant (one less token to parse and less expansion internally)
+% so in places where such performance really matters and where we
+% want to explicitly stop the expansion at a defined point the first
+% form is preferable.
+% \end{function}
+% \footnotetext{In this particular case you may get a character into
+% the output as well as an error message.}
+%
+%
% \section{Internal functions and variables}
%
% \begin{variable}{\l__exp_internal_tl}
@@ -760,18 +869,17 @@
% \begin{macro}[int, EXP]{\::f}
% \begin{macro}{\exp_stop_f:}
% This function is used to expand a token list until the first
-% unexpandable token is found. The underlying \tn{romannumeral} |-`0|
-% expands everything in its way to find something terminating the
-% number and thereby expands the function in front of it. This
+% unexpandable token is found. This is achieved through \cs{exp:w}
+% \cs{exp_continue_f:w} that
+% expands everything in its way following it. This
% scanning procedure is terminated once the expansion hits
% something non-expandable or a space. We introduce \cs{exp_stop_f:}
-% to mark such an end of expansion marker; in case the scanner hits
-% a number, this number also terminates the scanning and is left
-% untouched. In the example shown earlier the scanning was stopped
+% to mark such an end of expansion marker.
+% In the example shown earlier the scanning was stopped
% once \TeX{} had fully expanded |\cs_set_eq:Nc \aaa { b \l_tmpa_tl b }|
% into |\cs_set_eq:NN \aaa = \blurb| which then turned out to contain
% the non-expandable token \cs{cs_set_eq:NN}. Since the expansion of
-% \tn{romannumeral} |-`0| is \meta{null}, we wind up with a fully
+% \cs{exp:w} \cs{exp_continue_f:w} is \meta{null}, we wind up with a fully
% expanded list, only \TeX{} has not tried to execute any of the
% non-expandable tokens. This is what differentiates this function
% from the |x| argument type.
@@ -779,7 +887,7 @@
\cs_new:Npn \::f #1 \::: #2#3
{
\exp_after:wN \@@_arg_next:nnn
- \exp_after:wN { \tex_romannumeral:D -`0 #3 }
+ \exp_after:wN { \exp:w \exp_continue_f:w #3 }
{#1} {#2}
}
\use:nn { \cs_new_eq:NN \exp_stop_f: } { ~ }
@@ -804,20 +912,20 @@
% |tl|, |clist|, |int|, |skip|, |dim| and |muskip|. The |V| version
% expects a single token whereas |v| like |c| creates a csname from
% its argument given in braces and then evaluates it as if it was a
-% |V|. The primitive \tn{romannumeral} sets off an expansion
+% |V|. The \cs{exp:w} sets off an expansion
% similar to an |f| type expansion, which we will terminate using
-% \cs{c_zero}. The argument is returned in braces.
+% \cs{exp_end:}. The argument is returned in braces.
% \begin{macrocode}
\cs_new:Npn \::V #1 \::: #2#3
{
\exp_after:wN \@@_arg_next:nnn
- \exp_after:wN { \tex_romannumeral:D \@@_eval_register:N #3 }
+ \exp_after:wN { \exp:w \@@_eval_register:N #3 }
{#1} {#2}
}
\cs_new:Npn \::v # 1\::: #2#3
{
\exp_after:wN \@@_arg_next:nnn
- \exp_after:wN { \tex_romannumeral:D \@@_eval_register:c {#3} }
+ \exp_after:wN { \exp:w \@@_eval_register:c {#3} }
{#1} {#2}
}
% \end{macrocode}
@@ -858,19 +966,20 @@
\fi:
% \end{macrocode}
% The next bit requires some explanation. The function must be
-% initiated by the primitive \tn{romannumeral} and we want to
-% terminate this expansion chain by inserting the \cs{c_zero} integer
-% constant. However, we have to expand the register |#1| before we do
+% initiated by \cs{exp:w} and we want to
+% terminate this expansion chain by inserting the \cs{exp_end:}
+% token.
+% However, we have to expand the register |#1| before we do
% that. If it is a \TeX{} register, we need to execute the sequence
-% |\exp_after:wN \c_zero \tex_the:D #1| and if it is a macro we
-% need to execute |\exp_after:wN \c_zero #1|. We therefore issue
+% |\exp_after:wN \exp_end: \tex_the:D #1| and if it is a macro we
+% need to execute |\exp_after:wN \exp_end: #1|. We therefore issue
% the longer of the two sequences and if the register is a macro, we
% remove the \cs{tex_the:D}.
% \begin{macrocode}
\else:
\exp_after:wN \use_i_ii:nnn
\fi:
- \exp_after:wN \c_zero \tex_the:D #1
+ \exp_after:wN \exp_end: \tex_the:D #1
}
\cs_new:Npn \@@_eval_register:c #1
{ \exp_after:wN \@@_eval_register:N \cs:w #1 \cs_end: }
@@ -889,7 +998,7 @@
\fi:
\fi:
\__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#2}
- \c_zero
+ \exp_end:
}
% \end{macrocode}
% \end{macro}
@@ -942,16 +1051,16 @@
% \begin{macro}[EXP]{\exp_args:Nf, \exp_args:NV, \exp_args:Nv}
% \begin{macrocode}
\cs_new:Npn \exp_args:Nf #1#2
- { \exp_after:wN #1 \exp_after:wN { \tex_romannumeral:D -`0 #2 } }
+ { \exp_after:wN #1 \exp_after:wN { \exp:w \exp_continue_f:w #2 } }
\cs_new:Npn \exp_args:Nv #1#2
{
\exp_after:wN #1 \exp_after:wN
- { \tex_romannumeral:D \@@_eval_register:c {#2} }
+ { \exp:w \@@_eval_register:c {#2} }
}
\cs_new:Npn \exp_args:NV #1#2
{
\exp_after:wN #1 \exp_after:wN
- { \tex_romannumeral:D \@@_eval_register:N #2 }
+ { \exp:w \@@_eval_register:N #2 }
}
% \end{macrocode}
% \end{macro}
@@ -971,19 +1080,19 @@
{
\exp_after:wN #1
\exp_after:wN #2
- \exp_after:wN { \tex_romannumeral:D -`0 #3 }
+ \exp_after:wN { \exp:w \exp_continue_f:w #3 }
}
\cs_new:Npn \exp_args:NNv #1#2#3
{
\exp_after:wN #1
\exp_after:wN #2
- \exp_after:wN { \tex_romannumeral:D \@@_eval_register:c {#3} }
+ \exp_after:wN { \exp:w \@@_eval_register:c {#3} }
}
\cs_new:Npn \exp_args:NNV #1#2#3
{
\exp_after:wN #1
\exp_after:wN #2
- \exp_after:wN { \tex_romannumeral:D \@@_eval_register:N #3 }
+ \exp_after:wN { \exp:w \@@_eval_register:N #3 }
}
\cs_new:Npn \exp_args:Nco #1#2#3
{
@@ -995,14 +1104,14 @@
{
\exp_after:wN #1
\cs:w #2 \exp_after:wN \cs_end:
- \exp_after:wN { \tex_romannumeral:D -`0 #3 }
+ \exp_after:wN { \exp:w \exp_continue_f:w #3 }
}
\cs_new:Npn \exp_args:NVV #1#2#3
{
\exp_after:wN #1
- \exp_after:wN { \tex_romannumeral:D \exp_after:wN
+ \exp_after:wN { \exp:w \exp_after:wN
\@@_eval_register:N \exp_after:wN #2 \exp_after:wN }
- \exp_after:wN { \tex_romannumeral:D \@@_eval_register:N #3 }
+ \exp_after:wN { \exp:w \@@_eval_register:N #3 }
}
% \end{macrocode}
% \end{macro}
@@ -1019,7 +1128,7 @@
\exp_after:wN #1
\exp_after:wN #2
\exp_after:wN #3
- \exp_after:wN { \tex_romannumeral:D \@@_eval_register:N #4 }
+ \exp_after:wN { \exp:w \@@_eval_register:N #4 }
}
\cs_new:Npn \exp_args:NcNc #1#2#3#4
{
@@ -1135,19 +1244,19 @@
\cs_new:Npn \::f_unbraced \::: #1#2
{
\exp_after:wN \@@_arg_last_unbraced:nn
- \exp_after:wN { \tex_romannumeral:D -`0 #2 } {#1}
+ \exp_after:wN { \exp:w \exp_continue_f:w #2 } {#1}
}
\cs_new:Npn \::o_unbraced \::: #1#2
{ \exp_after:wN \@@_arg_last_unbraced:nn \exp_after:wN {#2} {#1} }
\cs_new:Npn \::V_unbraced \::: #1#2
{
\exp_after:wN \@@_arg_last_unbraced:nn
- \exp_after:wN { \tex_romannumeral:D \@@_eval_register:N #2 } {#1}
+ \exp_after:wN { \exp:w \@@_eval_register:N #2 } {#1}
}
\cs_new:Npn \::v_unbraced \::: #1#2
{
\exp_after:wN \@@_arg_last_unbraced:nn
- \exp_after:wN { \tex_romannumeral:D \@@_eval_register:c {#2} } {#1}
+ \exp_after:wN { \exp:w \@@_eval_register:c {#2} } {#1}
}
\cs_new_protected:Npn \::x_unbraced \::: #1#2
{
@@ -1181,25 +1290,25 @@
% general system is in place.
% \begin{macrocode}
\cs_new:Npn \exp_last_unbraced:NV #1#2
- { \exp_after:wN #1 \tex_romannumeral:D \@@_eval_register:N #2 }
+ { \exp_after:wN #1 \exp:w \@@_eval_register:N #2 }
\cs_new:Npn \exp_last_unbraced:Nv #1#2
- { \exp_after:wN #1 \tex_romannumeral:D \@@_eval_register:c {#2} }
+ { \exp_after:wN #1 \exp:w \@@_eval_register:c {#2} }
\cs_new:Npn \exp_last_unbraced:No #1#2 { \exp_after:wN #1 #2 }
\cs_new:Npn \exp_last_unbraced:Nf #1#2
- { \exp_after:wN #1 \tex_romannumeral:D -`0 #2 }
+ { \exp_after:wN #1 \exp:w \exp_continue_f:w #2 }
\cs_new:Npn \exp_last_unbraced:Nco #1#2#3
{ \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: #3 }
\cs_new:Npn \exp_last_unbraced:NcV #1#2#3
{
\exp_after:wN #1
\cs:w #2 \exp_after:wN \cs_end:
- \tex_romannumeral:D \@@_eval_register:N #3
+ \exp:w \@@_eval_register:N #3
}
\cs_new:Npn \exp_last_unbraced:NNV #1#2#3
{
\exp_after:wN #1
\exp_after:wN #2
- \tex_romannumeral:D \@@_eval_register:N #3
+ \exp:w \@@_eval_register:N #3
}
\cs_new:Npn \exp_last_unbraced:NNo #1#2#3
{ \exp_after:wN #1 \exp_after:wN #2 #3 }
@@ -1208,7 +1317,7 @@
\exp_after:wN #1
\exp_after:wN #2
\exp_after:wN #3
- \tex_romannumeral:D \@@_eval_register:N #4
+ \exp:w \@@_eval_register:N #4
}
\cs_new:Npn \exp_last_unbraced:NNNo #1#2#3#4
{ \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 #4 }
@@ -1263,16 +1372,16 @@
\cs_new:Npn \exp_not:o #1 { \etex_unexpanded:D \exp_after:wN {#1} }
\cs_new:Npn \exp_not:c #1 { \exp_after:wN \exp_not:N \cs:w #1 \cs_end: }
\cs_new:Npn \exp_not:f #1
- { \etex_unexpanded:D \exp_after:wN { \tex_romannumeral:D -`0 #1 } }
+ { \etex_unexpanded:D \exp_after:wN { \exp:w \exp_continue_f:w #1 } }
\cs_new:Npn \exp_not:V #1
{
\etex_unexpanded:D \exp_after:wN
- { \tex_romannumeral:D \@@_eval_register:N #1 }
+ { \exp:w \@@_eval_register:N #1 }
}
\cs_new:Npn \exp_not:v #1
{
\etex_unexpanded:D \exp_after:wN
- { \tex_romannumeral:D \@@_eval_register:c {#1} }
+ { \exp:w \@@_eval_register:c {#1} }
}
% \end{macrocode}
% \end{macro}
@@ -1281,6 +1390,65 @@
% \end{macro}
% \end{macro}
%
+% \subsection{Controlled expansion}
+%
+% \begin{macro}{\exp:w}
+% \begin{macro}{\exp_end:}
+% \begin{macro}{\exp_continue_f:w}
+%
+% To trigger a sequence of ``arbitrary'' many expansions we need a
+% method to invoke \TeX's expansion mechanism in such a way that a)
+% we are able to stop it in a controlled manner and b) that the
+% result of what triggered the expansion in the first place is
+% null, i.e., that we do not get any unwanted side effects. There
+% aren't that many possibilities in \TeX{}; in fact the one
+% explained below might well be the only one (as normally the
+% result of expansion is not null).
+%
+% The trick here is to make use of the fact that
+% \cs{tex_romannumeral:D} expands the tokens following it when
+% looking for a number and that its expansion is null if that
+% number turns out to be zero or negative. So we use that to start
+% the expansion sequence.
+% \begin{macrocode}
+%\cs_new_eq:NN \exp:w \tex_romannumeral:D
+% \end{macrocode}
+% So to stop the expansion sequence in a controlled way all we need
+% to provide is \cs{c_zero} as part of expanded tokens. As this is
+% an integer constant it will immediately stop
+% \cs{tex_romannumerl:D}'s search for a number.
+% \begin{macrocode}
+%\cs_new_eq:NN \exp_end: \c_zero
+% \end{macrocode}
+% (Note that according to our specification all tokens we expand
+% initiated by \cs{exp:w} are supposed to be expandable (as well as
+% their replacement text in the expansion) so we will not encounter
+% a ``number'' that actually result in a roman numeral being
+% generated. Or if we do then the programmer made a mistake.)
+%
+% If on the other hand we want to stop the initial expansion
+% sequence but continue with an f-type expansion we provide the
+% alphabetic constant |`^^@| that also represents |0| but this time
+% \TeX's syntax for a \meta{number} will continue searching for an
+% optional space (and it will continue expansion doing that) ---
+% see \TeX{}book page~269 for details.
+% \begin{macrocode}
+\tex_catcode:D `\^^@=13
+\cs_new_protected:Npn \exp_continue_f:w {`^^@}
+% \end{macrocode}
+% If the above definition ever appears outside its proper context
+% the active character |^^@| will be executed so we turn this into an
+% error.\footnote{Need to get a real error message.}
+% \begin{macrocode}
+\cs_new:Npn ^^@{\expansionERROR}
+\tex_catcode:D `\^^@=15
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
% \subsection{Defining function variants}
%
% \begin{macrocode}
Modified: trunk/l3kernel/l3fp-aux.dtx
===================================================================
--- trunk/l3kernel/l3fp-aux.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3fp-aux.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -465,7 +465,7 @@
\else:
\exp_after:wN \@@_exp_after_special:nNNw
\fi:
- { \tex_romannumeral:D -`0 #1 }
+ { \exp:w \exp_continue_f:w #1 }
#2
}
% \end{macrocode}
@@ -1056,7 +1056,7 @@
}
\cs_new:Npn \@@_expand_loop:nwnN #1#2 \s_@@_mark #3 #4
{
- \exp_after:wN #4 \tex_romannumeral:D -`0
+ \exp_after:wN #4 \exp:w \exp_continue_f:w
#2
\s_@@_mark { #3 #1 } #4
}
Modified: trunk/l3kernel/l3fp-convert.dtx
===================================================================
--- trunk/l3kernel/l3fp-convert.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3fp-convert.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -116,7 +116,7 @@
\cs_new_nopar:Npn \fp_to_scientific:n
{
\exp_after:wN \@@_to_scientific_dispatch:w
- \tex_romannumeral:D -`0 \@@_parse:n
+ \exp:w \exp_continue_f:w \@@_parse:n
}
% \end{macrocode}
% \end{macro}
@@ -149,7 +149,7 @@
\group_end:
\cs_new:Npn \@@_to_scientific_dispatch:w \s_@@ \@@_chk:w #1#2
{
- \if_meaning:w 2 #2 \exp_after:wN - \tex_romannumeral:D -`0 \fi:
+ \if_meaning:w 2 #2 \exp_after:wN - \exp:w \exp_continue_f:w \fi:
\if_case:w #1 \exp_stop_f:
\@@_case_return:nw { 0 }
\or: \exp_after:wN \@@_to_scientific_normal:wnnnnn
@@ -206,7 +206,7 @@
\cs_new_nopar:Npn \fp_to_decimal:n
{
\exp_after:wN \@@_to_decimal_dispatch:w
- \tex_romannumeral:D -`0 \@@_parse:n
+ \exp:w \exp_continue_f:w \@@_parse:n
}
% \end{macrocode}
% \end{macro}
@@ -234,7 +234,7 @@
% \begin{macrocode}
\cs_new:Npn \@@_to_decimal_dispatch:w \s_@@ \@@_chk:w #1#2
{
- \if_meaning:w 2 #2 \exp_after:wN - \tex_romannumeral:D -`0 \fi:
+ \if_meaning:w 2 #2 \exp_after:wN - \exp:w \exp_continue_f:w \fi:
\if_case:w #1 \exp_stop_f:
\@@_case_return:nw { 0 }
\or: \exp_after:wN \@@_to_decimal_normal:wnnnnn
@@ -279,7 +279,7 @@
\exp_after:wN \@@_trim_zeros:w
\exp_after:wN 0
\exp_after:wN .
- \tex_romannumeral:D -`0 \prg_replicate:nn { - #2 } { 0 }
+ \exp:w \exp_continue_f:w \prg_replicate:nn { - #2 } { 0 }
#3#4#5#6 ;
}
}
@@ -307,7 +307,7 @@
\cs_new_nopar:Npn \fp_to_tl:n
{
\exp_after:wN \@@_to_tl_dispatch:w
- \tex_romannumeral:D -`0 \@@_parse:n
+ \exp:w \exp_continue_f:w \@@_parse:n
}
% \end{macrocode}
% \end{macro}
@@ -321,7 +321,7 @@
% \begin{macrocode}
\cs_new:Npn \@@_to_tl_dispatch:w \s_@@ \@@_chk:w #1#2
{
- \if_meaning:w 2 #2 \exp_after:wN - \tex_romannumeral:D -`0 \fi:
+ \if_meaning:w 2 #2 \exp_after:wN - \exp:w \exp_continue_f:w \fi:
\if_case:w #1 \exp_stop_f:
\@@_case_return:nw { 0 }
\or: \exp_after:wN \@@_to_tl_normal:nnnnn
@@ -377,7 +377,7 @@
\cs_new_nopar:Npn \fp_to_int:n
{
\exp_after:wN \@@_to_int_dispatch:w
- \tex_romannumeral:D -`0 \@@_parse:n
+ \exp:w \exp_continue_f:w \@@_parse:n
}
% \end{macrocode}
% \end{macro}
@@ -390,7 +390,7 @@
% \begin{macrocode}
\cs_new:Npn \@@_to_int_dispatch:w #1;
{
- \exp_after:wN \@@_to_decimal_dispatch:w \tex_romannumeral:D -`0
+ \exp_after:wN \@@_to_decimal_dispatch:w \exp:w \exp_continue_f:w
\@@_round:Nwn \@@_round_to_nearest:NNN #1; { 0 }
}
% \end{macrocode}
@@ -527,7 +527,8 @@
{
\exp_not:N \exp_after:wN ,
\exp_not:N \exp_after:wN \c_space_tl
- \exp_not:N \tex_romannumeral:D -`0
+ \exp_not:N \exp:w
+ \exp_not:N \exp_continue_f:w
\exp_not:N \@@_to_tl_dispatch:w #1 #2 ;
}
\exp_not:N \@@_array_to_clist_loop:Nw
Modified: trunk/l3kernel/l3fp-expo.dtx
===================================================================
--- trunk/l3kernel/l3fp-expo.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3fp-expo.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -654,11 +654,11 @@
\exp_after:wN \@@_add_big_i_o:wNww
\int_use:N \__int_eval:w \c_one - #4 ;
0 {1000}{0000}{0000}{0000} ; #5;
- \tex_romannumeral:D
+ \exp:w
\else:
\if_int_compare:w #4 > \c_five % cf \c_@@_max_exponent_int
\exp_after:wN \@@_exp_overflow:
- \tex_romannumeral:D
+ \exp:w
\else:
\if_int_compare:w #4 < \c_zero
\exp_after:wN \use_i:nn
@@ -677,7 +677,7 @@
#5
{#4}
#1 #2 0
- \tex_romannumeral:D
+ \exp:w
\fi:
\fi:
\exp_after:wN \c_zero
@@ -927,7 +927,7 @@
\@@_case_return_o:Nw \c_nan_fp
\else:
\exp_after:wN \@@_pow_neg:www
- \tex_romannumeral:D -`0 \exp_after:wN \use:nn
+ \exp:w \exp_continue_f:w \exp_after:wN \use:nn
\fi:
{
\if_meaning:w 1 #1
@@ -1169,7 +1169,7 @@
\or:
\if_int_compare:w \__int_eval:w #1 / \c_two = \c_one
\@@_invalid_operation_o:Nww ^ #3; #4;
- \tex_romannumeral:D -`0
+ \exp:w \exp_continue_f:w
\exp_after:wN \exp_after:wN
\exp_after:wN \@@_use_none_until_s:w
\fi:
Modified: trunk/l3kernel/l3fp-extended.dtx
===================================================================
--- trunk/l3kernel/l3fp-extended.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3fp-extended.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -652,7 +652,7 @@
{
\exp_after:wN \@@_ep_to_fixed_auxi:www
\int_use:N \__int_eval:w 1 0000 0000 + #2 \exp_after:wN ;
- \tex_romannumeral:D -`0
+ \exp:w \exp_continue_f:w
\prg_replicate:nn { \c_four - \int_max:nn {#1} { -32 } } { 0 } ;
}
\cs_new:Npn \@@_ep_to_fixed_auxi:www 1#1; #2; #3#4#5#6#7;
Modified: trunk/l3kernel/l3fp-logic.dtx
===================================================================
--- trunk/l3kernel/l3fp-logic.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3fp-logic.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -109,7 +109,7 @@
\prg_new_conditional:Npnn \fp_compare:n #1 { p , T , F , TF }
{
\exp_after:wN \@@_compare_return:w
- \tex_romannumeral:D -`0 \@@_parse:n {#1}
+ \exp:w \exp_continue_f:w \@@_parse:n {#1}
}
\cs_new:Npn \@@_compare_return:w \s_@@ \@@_chk:w #1#2;
{
@@ -134,7 +134,7 @@
{
\if_int_compare:w
\exp_after:wN \@@_compare_aux:wn
- \tex_romannumeral:D -`0 \@@_parse:n {#1} {#3}
+ \exp:w \exp_continue_f:w \@@_parse:n {#1} {#3}
= \__int_eval:w `#2 - `= \__int_eval_end:
\prg_return_true:
\else:
@@ -144,7 +144,7 @@
\cs_new:Npn \@@_compare_aux:wn #1; #2
{
\exp_after:wN \@@_compare_back:ww
- \tex_romannumeral:D -`0 \@@_parse:n {#2} #1;
+ \exp:w \exp_continue_f:w \@@_parse:n {#2} #1;
}
% \end{macrocode}
% \end{macro}
@@ -473,10 +473,10 @@
\s_@@ \@@_chk:w { \@@_ternary_loop_break:w } ;
\@@_ternary_break_point:n { \exp_after:wN \@@_ternary_auxi:NwwN }
\exp_after:wN #1
- \tex_romannumeral:D -`0
+ \exp:w \exp_continue_f:w
\@@_exp_after_array_f:w #3 \s_@@_stop
\exp_after:wN @
- \tex_romannumeral:D
+ \exp:w
\@@_parse_operand:Nw \c_two
\@@_parse_expand:w
\else:
@@ -484,7 +484,7 @@
{ kernel } { fp-missing } { : } { ~for~?: }
\exp_after:wN \@@_parse_continue:NwN
\exp_after:wN #1
- \tex_romannumeral:D -`0
+ \exp:w \exp_continue_f:w
\@@_exp_after_array_f:w #3 \s_@@_stop
\exp_after:wN #4
\exp_after:wN #1
@@ -508,7 +508,7 @@
{
\exp_after:wN \@@_parse_continue:NwN
\exp_after:wN #1
- \tex_romannumeral:D -`0
+ \exp:w \exp_continue_f:w
\@@_exp_after_array_f:w #2 \s_@@_stop
#4 #1
}
@@ -516,7 +516,7 @@
{
\exp_after:wN \@@_parse_continue:NwN
\exp_after:wN #1
- \tex_romannumeral:D -`0
+ \exp:w \exp_continue_f:w
\@@_exp_after_array_f:w #3 \s_@@_stop
#4 #1
}
Modified: trunk/l3kernel/l3fp-parse.dtx
===================================================================
--- trunk/l3kernel/l3fp-parse.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3fp-parse.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -163,23 +163,23 @@
% \begin{quote}\ttfamily
% \cs{exp_after:wN} |\add:ww|
% \cs{__int_value:w} 12345 \cs{exp_after:wN} ; \newline
-% \cs{tex_romannumeral:D} |\operand:w| \meta{stuff}
+% \cs{exp:w} |\operand:w| \meta{stuff}
% \end{quote}
% One step of expansion expands \cs{exp_after:wN}, which triggers the
% primitive \cs{__int_value:w}, which reads the five digits we have
% already found, |12345|. This integer is unfinished, causing the
% second \cs{exp_after:wN} to expand, and to trigger the construction
-% \cs{tex_romannumeral:D}, which expands |\operand:w|, defined to read
+% \cs{exp:w}, which expands |\operand:w|, defined to read
% what follows and make a number out of it, then leave \cs{c_zero}, the
% number, and a semicolon in the input stream. Once |\operand:w| is
% done expanding, we obtain essentially
% \begin{quote}\ttfamily
% \cs{exp_after:wN} |\add:ww| \cs{__int_value:w} 12345 ; \newline
-% \cs{tex_romannumeral:D} \cs{c_zero} 333444 ;
+% \cs{exp:w} \cs{c_zero} 333444 ;
% \end{quote}
% where in fact \cs{exp_after:wN} has already been expanded,
% \cs{__int_value:w} has already seen |12345|, and
-% \cs{tex_romannumeral:D} is still looking for a number. It finds
+% \cs{exp:w} is still looking for a number. It finds
% \cs{c_zero}, hence expands to nothing. Now, \cs{__int_value:w} sees
% the \texttt{;}, which cannot be part of a number. The expansion
% stops, and we are left with
@@ -311,7 +311,7 @@
% \begin{quote}
% \cs{exp_after:wN} \cs{@@_parse_continue:NwN} \newline
% \cs{exp_after:wN} \meta{precedence} \newline
-% \cs{tex_romannumeral:D} |-`0| \newline
+% \cs{exp:w} \cs{exp_continue_f:w} \newline
% ~~\cs{@@_parse_one:Nw} \meta{precedence}
% \end{quote}
% This expands \cs{@@_parse_one:Nw} \meta{precedence} completely, which
@@ -354,9 +354,9 @@
% \begin{quote}
% \cs{exp_after:wN} \cs{@@_parse_continue:NwN} \newline
% \cs{exp_after:wN} \meta{precedence} \newline
-% \cs{tex_romannumeral:D} |-`0| \newline
+% \cs{exp:w} \cs{exp_continue_f:w} \newline
% |\__fp_|\meta{operator}|_o:ww| \meta{number} \meta{number_2} \newline
-% \cs{tex_romannumeral:D} |-`0| \newline
+% \cs{exp:w} \cs{exp_continue_f:w} \newline
% |\__fp_parse_infix_|\meta{operator_2}|:N| \meta{precedence}
% \end{quote}
% where |\__fp_|\meta{operator}|_o:ww| computes \meta{number}
@@ -545,7 +545,7 @@
%
% \begin{macro}[rEXP, aux]{\@@_parse_operand:Nw}
% \begin{syntax}
-% \cs{tex_romannumeral:D} \cs{@@_parse_operand:Nw} \meta{precedence} \cs{@@_parse_expand:w}
+% \cs{exp:w} \cs{@@_parse_operand:Nw} \meta{precedence} \cs{@@_parse_expand:w}
% \end{syntax}
% Reads the \enquote{\ttfamily\ldots{}}, performing every computation
% with a precedence higher than \meta{precedence}, then expands to
@@ -597,14 +597,14 @@
%
% \begin{macro}[aux, rEXP]{\@@_parse_expand:w}
% \begin{syntax}
-% \cs{tex_romannumeral:D} \cs{@@_parse_expand:w} \meta{tokens}
+% \cs{exp:w} \cs{@@_parse_expand:w} \meta{tokens}
% \end{syntax}
-% This function must always come within a \tn{romannumeral} expansion.
+% This function must always come within a \cs{exp:w} expansion.
% The \meta{tokens} should be the part of the expression that we have
% not yet read. This requires in particular closing all conditionals
% properly before expanding.
% \begin{macrocode}
-\cs_new:Npn \@@_parse_expand:w #1 { -`0 #1 }
+\cs_new:Npn \@@_parse_expand:w #1 { \exp_continue_f:w #1 }
% \end{macrocode}
% \end{macro}
%
@@ -677,7 +677,7 @@
\cs_new:cpn { @@_parse_digits_ #1 :N } ##1
{
\if_int_compare:w \c_nine < 1 \token_to_str:N ##1 \exp_stop_f:
- \token_to_str:N ##1 \exp_after:wN #2 \tex_romannumeral:D
+ \token_to_str:N ##1 \exp_after:wN #2 \exp:w
\else:
\@@_parse_return_semicolon:w #3 ##1
\fi:
@@ -772,19 +772,19 @@
\cs:w @@_exp_after \@@_type_from_scan:N #2 _f:nw \cs_end:
{
\exp_after:wN \@@_parse_infix:NN
- \exp_after:wN #1 \tex_romannumeral:D \@@_parse_expand:w
+ \exp_after:wN #1 \exp:w \@@_parse_expand:w
}
#2
}
\cs_new:Npn \@@_exp_after_mark_f:nw #1
{
\__msg_kernel_expandable_error:nn { kernel } { fp-early-end }
- \exp_after:wN \c_nan_fp \tex_romannumeral:D -`0 #1
+ \exp_after:wN \c_nan_fp \exp:w \exp_continue_f:w #1
}
\cs_new:cpn { @@_exp_after_?_f:nw } #1#2
{
\__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#2}
- \exp_after:wN \c_nan_fp \tex_romannumeral:D -`0 #1
+ \exp_after:wN \c_nan_fp \exp:w \exp_continue_f:w #1
}
%<*package>
\group_begin:
@@ -793,7 +793,7 @@
{
\cs_gset:cpn { @@_exp_after_?_f:nw } #1#2
{
- \exp_after:wN \c_nan_fp \tex_romannumeral:D -`0 #1
+ \exp_after:wN \c_nan_fp \exp:w \exp_continue_f:w #1
\str_if_eq:nnTF {#2} { \protect }
{
\cs_if_eq:NNTF #2 \@unexpandable at protect { \use_i:nn } { \use:n }
@@ -836,12 +836,12 @@
{
\exp_after:wN \@@_parse_infix_after_operand:NwN
\exp_after:wN #1
- \tex_romannumeral:D -`0
+ \exp:w \exp_continue_f:w
\exp_after:wN \@@_parse_one_register_aux:Nw
\exp_after:wN #2
\__int_value:w
\exp_after:wN \@@_parse_exponent:N
- \tex_romannumeral:D \@@_parse_expand:w
+ \exp:w \@@_parse_expand:w
}
\group_begin:
\char_set_catcode_other:N \P
@@ -890,7 +890,7 @@
{
\exp_after:wN \@@_parse_infix_after_operand:NwN
\exp_after:wN #1
- \tex_romannumeral:D -`0
+ \exp:w \exp_continue_f:w
\exp_after:wN \@@_sanitize:wN
\int_use:N \__int_eval:w \c_zero \@@_parse_trim_zeros:N
}
@@ -913,8 +913,8 @@
\exp_after:wN \@@_parse_word:Nw
\exp_after:wN #1
\exp_after:wN #2
- \tex_romannumeral:D \exp_after:wN \@@_parse_letters:N
- \tex_romannumeral:D
+ \exp:w \exp_after:wN \@@_parse_letters:N
+ \exp:w
\else:
\exp_after:wN \@@_parse_prefix:NNN
\exp_after:wN #1
@@ -923,7 +923,7 @@
@@_parse_prefix_ \token_to_str:N #2 :Nw
\exp_after:wN
\cs_end:
- \tex_romannumeral:D
+ \exp:w
\fi:
\@@_parse_expand:w
}
@@ -947,14 +947,14 @@
{
\__msg_kernel_expandable_error:nnn
{ kernel } { unknown-fp-word } {#2}
- \exp_after:wN \c_nan_fp \tex_romannumeral:D -`0
+ \exp_after:wN \c_nan_fp \exp:w \exp_continue_f:w
\@@_parse_infix:NN
}
#1
}
\cs_new:Npn \@@_parse_letters:N #1
{
- -`0
+ \exp_continue_f:w
\if_int_compare:w
\if_catcode:w \scan_stop: \exp_not:N #1
\c_zero
@@ -965,8 +965,8 @@
\fi:
= \c_three
\exp_after:wN #1
- \tex_romannumeral:D \exp_after:wN \@@_parse_letters:N
- \tex_romannumeral:D
+ \exp:w \exp_after:wN \@@_parse_letters:N
+ \exp:w
\else:
\@@_parse_return_semicolon:w #1
\fi:
@@ -1002,7 +1002,7 @@
{
\__msg_kernel_expandable_error:nnn
{ kernel } { fp-missing-number } {#1}
- \exp_after:wN \c_nan_fp \tex_romannumeral:D -`0
+ \exp_after:wN \c_nan_fp \exp:w \exp_continue_f:w
\@@_parse_infix:NN #3 #1
}
{
@@ -1037,11 +1037,11 @@
{
\if:w 0 \exp_not:N #1
\exp_after:wN \@@_parse_trim_zeros:N
- \tex_romannumeral:D
+ \exp:w
\else:
\if:w . \exp_not:N #1
\exp_after:wN \@@_parse_strim_zeros:N
- \tex_romannumeral:D
+ \exp:w
\else:
\@@_parse_trim_end:w #1
\fi:
@@ -1076,7 +1076,7 @@
{
\if:w 0 \exp_not:N #1
- \c_one
- \exp_after:wN \@@_parse_strim_zeros:N \tex_romannumeral:D
+ \exp_after:wN \@@_parse_strim_zeros:N \exp:w
\else:
\@@_parse_strim_end:w #1
\fi:
@@ -1131,7 +1131,7 @@
\exp_after:wN \@@_parse_small_leading:wwNN
\__int_value:w 1
\exp_after:wN \@@_parse_digits_vii:N
- \tex_romannumeral:D \@@_parse_expand:w
+ \exp:w \@@_parse_expand:w
}
% \end{macrocode}
% \end{macro}
@@ -1161,7 +1161,7 @@
\exp_after:wN \@@_parse_small_trailing:wwNN
\__int_value:w 1
\exp_after:wN \@@_parse_digits_vi:N
- \tex_romannumeral:D
+ \exp:w
\else:
0000 0000 \@@_parse_exponent:Nw #4
\fi:
@@ -1189,7 +1189,7 @@
\token_to_str:N #4
\exp_after:wN \@@_parse_small_round:NN
\exp_after:wN #4
- \tex_romannumeral:D
+ \exp:w
\else:
0 \@@_parse_exponent:Nw #4
\fi:
@@ -1255,7 +1255,7 @@
\exp_after:wN \@@_parse_large_leading:wwNN
\__int_value:w 1 \token_to_str:N #1
\exp_after:wN \@@_parse_digits_vii:N
- \tex_romannumeral:D \@@_parse_expand:w
+ \exp:w \@@_parse_expand:w
}
% \end{macrocode}
% \end{macro}
@@ -1284,7 +1284,7 @@
\exp_after:wN \@@_parse_large_trailing:wwNN
\__int_value:w 1 \token_to_str:N #4
\exp_after:wN \@@_parse_digits_vi:N
- \tex_romannumeral:D
+ \exp:w
\else:
\if:w . \exp_not:N #4
\exp_after:wN \@@_parse_small_leading:wwNN
@@ -1294,7 +1294,7 @@
\__int_to_roman:w #3
:N \exp_after:wN
\cs_end:
- \tex_romannumeral:D
+ \exp:w
\else:
#2
\exp_after:wN \@@_parse_pack_trailing:NNNNNNww
@@ -1334,7 +1334,7 @@
\int_use:N \__int_eval:w 1 #1 \token_to_str:N #4
\exp_after:wN \@@_parse_large_round:NN
\exp_after:wN #4
- \tex_romannumeral:D
+ \exp:w
\else:
\exp_after:wN \@@_parse_pack_trailing:NNNNNNww
\int_use:N \__int_eval:w \c_seven - #3 \exp_stop_f:
@@ -1347,7 +1347,7 @@
\__int_to_roman:w #3
:N \exp_after:wN
\cs_end:
- \tex_romannumeral:D
+ \exp:w
\else:
#2 0 \@@_parse_exponent:Nw #4
\fi:
@@ -1375,10 +1375,10 @@
+ \c_one
\if:w 0 \token_to_str:N #1
\exp_after:wN \@@_parse_round_loop:N
- \tex_romannumeral:D
+ \exp:w
\else:
\exp_after:wN \@@_parse_round_up:N
- \tex_romannumeral:D
+ \exp:w
\fi:
\else:
\@@_parse_return_semicolon:w \c_zero #1
@@ -1390,7 +1390,7 @@
\if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f:
+ \c_one
\exp_after:wN \@@_parse_round_up:N
- \tex_romannumeral:D
+ \exp:w
\else:
\@@_parse_return_semicolon:w \c_one #1
\fi:
@@ -1441,7 +1441,7 @@
\exp_after:wN \@@_parse_round_after:wN
\int_use:N \__int_eval:w \c_zero * \__int_eval:w \c_zero
\exp_after:wN \@@_parse_round_loop:N
- \tex_romannumeral:D
+ \exp:w
\else:
\@@_parse_exponent:Nw #2
\fi:
@@ -1493,7 +1493,7 @@
\if:w . \exp_not:N #2
\exp_after:wN \@@_parse_small_round:NN
\exp_after:wN #1
- \tex_romannumeral:D
+ \exp:w
\else:
\@@_parse_exponent:Nw #2
\fi:
@@ -1507,7 +1507,7 @@
\if:w . \exp_not:N #3
+ \c_zero * \__int_eval:w \c_zero
\exp_after:wN \@@_parse_round_loop:N
- \tex_romannumeral:D \exp_after:wN \@@_parse_expand:w
+ \exp:w \exp_after:wN \@@_parse_expand:w
\else:
\exp_after:wN ;
\exp_after:wN \c_zero
@@ -1576,7 +1576,7 @@
{
\if:w e \exp_not:N #1
\exp_after:wN \@@_parse_exponent_aux:N
- \tex_romannumeral:D
+ \exp:w
\else:
0 \@@_parse_return_semicolon:w #1
\fi:
@@ -1602,7 +1602,7 @@
{
\if:w + \if:w - \exp_not:N #1 + \fi: \token_to_str:N #1
\exp_after:wN \@@_parse_exponent_sign:N
- \tex_romannumeral:D \exp_after:wN \@@_parse_expand:w
+ \exp:w \exp_after:wN \@@_parse_expand:w
\else:
\exp_after:wN \@@_parse_exponent_body:N
\exp_after:wN #1
@@ -1620,13 +1620,13 @@
\if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f:
\token_to_str:N #1
\exp_after:wN \@@_parse_exponent_digits:N
- \tex_romannumeral:D
+ \exp:w
\else:
\@@_parse_exponent_keep:NTF #1
{ \@@_parse_return_semicolon:w #1 }
{
\exp_after:wN ;
- \tex_romannumeral:D
+ \exp:w
}
\fi:
\@@_parse_expand:w
@@ -1647,7 +1647,7 @@
\if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f:
\token_to_str:N #1
\exp_after:wN \@@_parse_exponent_digits:N
- \tex_romannumeral:D
+ \exp:w
\else:
\@@_parse_return_semicolon:w #1
\fi:
@@ -1725,12 +1725,12 @@
% after the calculation, |#4| is the operand, and |#5| is a
% |\__fp_parse_infix_...:N| function. We feed the data~|#2|, and the
% argument~|#4|, to the function~|#3|, which expands
-% \cs{tex_romannumeral:D} thus the \texttt{infix} function~|#5|.
+% \cs{exp:w} thus the \texttt{infix} function~|#5|.
% \begin{macrocode}
\cs_new:Npn \@@_parse_apply_unary:NNNwN #1#2#3#4@#5
{
#3 #2 #4 @
- \tex_romannumeral:D -`0 #5 #1
+ \exp:w \exp_continue_f:w #5 #1
}
% \end{macrocode}
% \end{macro}
@@ -1750,7 +1750,7 @@
\exp_after:wN ##1
\exp_after:wN #4
\exp_after:wN #3
- \tex_romannumeral:D
+ \exp:w
\if_int_compare:w #2 < ##1
\@@_parse_operand:Nw ##1
\else:
@@ -1776,7 +1776,7 @@
{
\exp_after:wN \@@_parse_infix_after_operand:NwN
\exp_after:wN #1
- \tex_romannumeral:D -`0
+ \exp:w \exp_continue_f:w
\exp_after:wN \@@_sanitize:wN
\int_use:N \__int_eval:w \c_zero \@@_parse_strim_zeros:N
}
@@ -1802,7 +1802,7 @@
{
\exp_after:wN \@@_parse_lparen_after:NwN
\exp_after:wN #1
- \tex_romannumeral:D
+ \exp:w
\if_int_compare:w #1 = \c_sixteen
\@@_parse_operand:Nw \c_one
\else:
@@ -1817,7 +1817,7 @@
\@@_exp_after_array_f:w #2 \s_@@_stop
\exp_after:wN \@@_parse_infix:NN
\exp_after:wN #1
- \tex_romannumeral:D \@@_parse_expand:w
+ \exp:w \@@_parse_expand:w
}
{
\__msg_kernel_expandable_error:nnn
@@ -1844,7 +1844,7 @@
\cs_set_protected:Npn \@@_tmp:w #1 #2
{
\cs_new_nopar:cpn { @@_parse_word_#1:N }
- { \exp_after:wN #2 \tex_romannumeral:D -`0 \@@_parse_infix:NN }
+ { \exp_after:wN #2 \exp:w \exp_continue_f:w \@@_parse_infix:NN }
}
\@@_tmp:w { inf } \c_inf_fp
\@@_tmp:w { nan } \c_nan_fp
@@ -1899,7 +1899,7 @@
\exp_after:wN \@@_from_dim_test:ww
\exp_after:wN 0 \exp_after:wN ,
\__int_value:w \__dim_eval:w 1 #1 \exp_after:wN ;
- \tex_romannumeral:D -`0 \@@_parse_infix:NN
+ \exp:w \exp_continue_f:w \@@_parse_infix:NN
}
}
% \end{macrocode}
@@ -1923,7 +1923,7 @@
\exp_after:wN #3
\exp_after:wN #2
\cs:w @@_#1_o:w \exp_after:wN \cs_end:
- \tex_romannumeral:D
+ \exp:w
\@@_parse_operand:Nw \c_fifteen \@@_parse_expand:w
}
\cs_new:Npn \@@_parse_function:NNN #1#2#3
@@ -1932,7 +1932,7 @@
\exp_after:wN #3
\exp_after:wN #2
\exp_after:wN #1
- \tex_romannumeral:D
+ \exp:w
\@@_parse_operand:Nw \c_sixteen \@@_parse_expand:w
}
% \end{macrocode}
@@ -2065,7 +2065,7 @@
%
% \begin{macro}[int, EXP]{\@@_parse:n}
% \begin{macro}[aux, EXP]{\@@_parse_after:ww}
-% Start a \tn{romannumeral} expansion so that \cs{@@_parse:n} expands
+% Start an \cs{exp:w} expansion so that \cs{@@_parse:n} expands
% in two steps. The \cs{@@_parse_operand:Nw} function will perform
% computations until reaching an operation with precedence
% \cs{c_minus_one} or less, namely, the end of the expression. The
@@ -2073,13 +2073,13 @@
% parsed version of an infix operator, and \cs{@@_parse_infix_end:N}
% has infinitely negative precedence. Finally, clean up a
% (well-defined) set of extra tokens and stop the initial expansion
-% with \cs{c_zero}.
+% with \cs{exp_end:}.
% \begin{macrocode}
\cs_new:Npn \@@_parse:n #1
{
- \tex_romannumeral:D
+ \exp:w
\exp_after:wN \@@_parse_after:ww
- \tex_romannumeral:D
+ \exp:w
\@@_parse_operand:Nw \c_minus_one
\@@_parse_expand:w #1
\s_@@_mark \@@_parse_infix_end:N
@@ -2087,7 +2087,7 @@
}
\cs_new:Npn \@@_parse_after:ww
#1@ \@@_parse_infix_end:N \s_@@_stop
- { \c_zero #1 }
+ { \exp_end: #1 }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -2097,18 +2097,18 @@
% The \cs{@@_parse_operand}
% This is just a shorthand which sets up both \cs{@@_parse_continue}
% and \cs{@@_parse_one} with the same precedence. Note the
-% trailing \cs{tex_romannumeral:D}. This function should be
+% trailing \cs{exp:w}. This function should be
% used with much care.
% \begin{macrocode}
\cs_new:Npn \@@_parse_operand:Nw #1
{
- -`0
+ \exp_continue_f:w
\exp_after:wN \@@_parse_continue:NwN
\exp_after:wN #1
- \tex_romannumeral:D -`0
+ \exp:w \exp_continue_f:w
\exp_after:wN \@@_parse_one:Nw
\exp_after:wN #1
- \tex_romannumeral:D
+ \exp:w
}
\cs_new:Npn \@@_parse_continue:NwN #1 #2 @ #3 { #3 #1 #2 @ }
% \end{macrocode}
@@ -2124,8 +2124,8 @@
{
\exp_after:wN \@@_parse_continue:NwN
\exp_after:wN #1
- \tex_romannumeral:D -`0 \cs:w @@_#3_o:ww \cs_end: #2 #4
- \tex_romannumeral:D -`0 #5 #1
+ \exp:w \exp_continue_f:w \cs:w @@_#3_o:ww \cs_end: #2 #4
+ \exp:w \exp_continue_f:w #5 #1
}
% \end{macrocode}
% \end{macro}
@@ -2183,7 +2183,7 @@
\else:
\exp_after:wN #1
\exp_after:wN #2
- \tex_romannumeral:D \exp_after:wN \@@_parse_expand:w
+ \exp:w \exp_after:wN \@@_parse_expand:w
\fi:
}
\group_end:
@@ -2224,7 +2224,7 @@
\__msg_kernel_expandable_error:nnn { kernel } { fp-extra } { ) }
\exp_after:wN \@@_parse_infix:NN
\exp_after:wN #1
- \tex_romannumeral:D \exp_after:wN \@@_parse_expand:w
+ \exp:w \exp_after:wN \@@_parse_expand:w
\else:
\exp_after:wN @
\exp_after:wN \use_none:n
@@ -2248,10 +2248,10 @@
\else:
\if_int_compare:w #1 = \c_one
\exp_after:wN \@@_parse_infix_comma:w
- \tex_romannumeral:D
+ \exp:w
\else:
\exp_after:wN \@@_parse_infix_comma_gobble:w
- \tex_romannumeral:D
+ \exp:w
\fi:
\@@_parse_operand:Nw \c_one
\exp_after:wN \@@_parse_expand:w
@@ -2305,7 +2305,7 @@
\exp_after:wN @
\exp_after:wN \@@_parse_apply_binary:NwNwN
\exp_after:wN #2
- \tex_romannumeral:D
+ \exp:w
\@@_parse_operand:Nw #4
\exp_after:wN \@@_parse_expand:w
\else:
@@ -2354,7 +2354,7 @@
\if_int_compare:w #1 < \c_ten
\exp_after:wN @
\exp_after:wN \@@_parse_apply_juxtapose:NwwN
- \tex_romannumeral:D
+ \exp:w
\@@_parse_operand:Nw \c_ten
\exp_after:wN \@@_parse_expand:w
\else:
@@ -2409,7 +2409,7 @@
\if:w | \exp_not:N #2
\exp_after:wN \@@_parse_infix_|:N
\exp_after:wN #1
- \tex_romannumeral:D \exp_after:wN \@@_parse_expand:w
+ \exp:w \exp_after:wN \@@_parse_expand:w
\else:
\exp_after:wN \@@_parse_infix_or:N
\exp_after:wN #1
@@ -2421,7 +2421,7 @@
\if:w & \exp_not:N #2
\exp_after:wN \@@_parse_infix_&:N
\exp_after:wN #1
- \tex_romannumeral:D \exp_after:wN \@@_parse_expand:w
+ \exp:w \exp_after:wN \@@_parse_expand:w
\else:
\exp_after:wN \@@_parse_infix_and:N
\exp_after:wN #1
@@ -2444,7 +2444,7 @@
\if_int_compare:w #1 < \c_three
\exp_after:wN @
\exp_after:wN \@@_ternary:NwwN
- \tex_romannumeral:D
+ \exp:w
\@@_parse_operand:Nw \c_three
\exp_after:wN \@@_parse_expand:w
\else:
@@ -2460,7 +2460,7 @@
{ kernel } { fp-missing } { ? } { ~for~?: }
\exp_after:wN @
\exp_after:wN \@@_ternary_auxii:NwwN
- \tex_romannumeral:D
+ \exp:w
\@@_parse_operand:Nw \c_two
\exp_after:wN \@@_parse_expand:w
\else:
@@ -2555,7 +2555,7 @@
\exp_after:wN #3
\exp_after:wN #4
\exp_after:wN #5
- \tex_romannumeral:D \exp_after:wN \@@_parse_expand:w
+ \exp:w \exp_after:wN \@@_parse_expand:w
}
\cs_new:Npn \@@_parse_compare_end:NNNNw #1#2#3#4#5 \fi:
{
@@ -2567,7 +2567,7 @@
\exp_after:wN #2
\exp_after:wN #3
\exp_after:wN #4
- \tex_romannumeral:D
+ \exp:w
\@@_parse_operand:Nw \c_seven \@@_parse_expand:w #5
}
\cs_new:Npn \@@_parse_apply_compare:NwNNNNNwN
@@ -2595,15 +2595,15 @@
\exp_after:wN \@@_parse_continue_compare:NNwNN
\exp_after:wN #1
\exp_after:wN #2
- \tex_romannumeral:D -`0
+ \exp:w \exp_continue_f:w
\@@_exp_after_o:w #3;
- \tex_romannumeral:D -`0
+ \exp:w \exp_continue_f:w
\else:
\exp_after:wN \@@_parse_continue:NwN
\exp_after:wN #2
- \tex_romannumeral:D -`0
+ \exp:w \exp_continue_f:w
\exp_after:wN #1
- \tex_romannumeral:D -`0
+ \exp:w \exp_continue_f:w
\fi:
#4 #2
}
@@ -2624,7 +2624,7 @@
{
\exp_after:wN \@@_function_apply:nw
\exp_after:wN #1
- \tex_romannumeral:D
+ \exp:w
\@@_parse_operand:Nw \c_sixteen \@@_parse_expand:w
}
% \end{macrocode}
@@ -2660,7 +2660,7 @@
\exp_after:wN #2
\__int_value:w #3 \exp_after:wN ; \exp_after:wN
}
- \tex_romannumeral:D
+ \exp:w
\@@_parse_operand:Nw \c_sixteen \@@_parse_expand:w
}
\cs_new:Npn #2 #4 {#5}
Modified: trunk/l3kernel/l3fp-round.dtx
===================================================================
--- trunk/l3kernel/l3fp-round.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3fp-round.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -169,7 +169,7 @@
% or up towards $+\infty$.
% \begin{macrocode}
\cs_new:Npn \@@_round_return_one:
- { \exp_after:wN \c_one \tex_romannumeral:D }
+ { \exp_after:wN \c_one \exp:w }
\cs_new:Npn \@@_round_to_ninf:NNN #1 #2 #3
{
\if_meaning:w 2 #1
@@ -361,11 +361,11 @@
{
\if_case:w
\__int_eval:w \@@_array_count:n {#2} - \c_one \__int_eval_end:
- \@@_round:Nwn #1 #2 {0} \tex_romannumeral:D
- \or: \@@_round:Nww #1 #2 \tex_romannumeral:D
- \else: \@@_round:Nwww #1 #2 @ \tex_romannumeral:D
+ \@@_round:Nwn #1 #2 {0} \exp:w
+ \or: \@@_round:Nww #1 #2 \exp:w
+ \else: \@@_round:Nwww #1 #2 @ \exp:w
\fi:
- -`0
+ \exp_continue_f:w
}
% \end{macrocode}
% \end{macro}
@@ -494,7 +494,7 @@
}
\cs_new:Npn \@@_round_normal_end:wwNnn #1;#2;#3#4#5
{
- \exp_after:wN \@@_exp_after_o:w \tex_romannumeral:D -`0
+ \exp_after:wN \@@_exp_after_o:w \exp:w \exp_continue_f:w
\@@_sanitize:Nw #3 #4 ; #1 ;
}
\cs_new:Npn \@@_round_special:NwwNnn #1#2;#3;#4#5#6
@@ -512,7 +512,7 @@
}
\cs_new:Npn \@@_round_special_aux:Nw #1#2;
{
- \exp_after:wN \@@_exp_after_o:w \tex_romannumeral:D -`0
+ \exp_after:wN \@@_exp_after_o:w \exp:w \exp_continue_f:w
\@@_sanitize:Nw #1#2; {1000}{0000}{0000}{0000};
}
% \end{macrocode}
Modified: trunk/l3kernel/l3fp-trig.dtx
===================================================================
--- trunk/l3kernel/l3fp-trig.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3fp-trig.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -403,7 +403,7 @@
\exp_after:wN \@@_pack_twice_four:wNNNNNNNN
\exp_after:wN \@@_trigd_large_auxi:nnnnwNNNN
\exp_after:wN ;
- \tex_romannumeral:D -`0
+ \exp:w \exp_continue_f:w
\prg_replicate:nn { \int_max:nn { 22 - #1 } { 0 } } { 0 }
#2#3#4#5#6#7 0000 0000 0000 !
}
@@ -1068,12 +1068,12 @@
\if_case:w
\__int_eval:w \@@_array_count:n {#5} - \c_one \__int_eval_end:
\exp_after:wN #1 \exp_after:wN #4 \c_one_fp #5
- \tex_romannumeral:D
- \or: #2 #4 #5 \tex_romannumeral:D
+ \exp:w
+ \or: #2 #4 #5 \exp:w
\else:
\__msg_kernel_expandable_error:nnnnn
{ kernel } { fp-num-args } { #3() } { 1 } { 2 }
- \exp_after:wN \c_nan_fp \tex_romannumeral:D
+ \exp_after:wN \c_nan_fp \exp:w
\fi:
\exp_after:wN \c_zero
}
Modified: trunk/l3kernel/l3int.dtx
===================================================================
--- trunk/l3kernel/l3int.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3int.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -1547,22 +1547,22 @@
% \begin{macrocode}
\cs_new:Npn \int_case:nnTF #1
{
- \tex_romannumeral:D
+ \exp:w
\exp_args:Nf \@@_case:nnTF { \int_eval:n {#1} }
}
\cs_new:Npn \int_case:nnT #1#2#3
{
- \tex_romannumeral:D
+ \exp:w
\exp_args:Nf \@@_case:nnTF { \int_eval:n {#1} } {#2} {#3} { }
}
\cs_new:Npn \int_case:nnF #1#2
{
- \tex_romannumeral:D
+ \exp:w
\exp_args:Nf \@@_case:nnTF { \int_eval:n {#1} } {#2} { }
}
\cs_new:Npn \int_case:nn #1#2
{
- \tex_romannumeral:D
+ \exp:w
\exp_args:Nf \@@_case:nnTF { \int_eval:n {#1} } {#2} { } { }
}
\cs_new:Npn \@@_case:nnTF #1#2#3#4
Modified: trunk/l3kernel/l3msg.dtx
===================================================================
--- trunk/l3kernel/l3msg.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3msg.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -2003,9 +2003,9 @@
% is an extra subtlety: if the user inserts tokens for error recovery,
% they should be kept. Thus we also use an odd space character
% (with category code $7$) and keep tokens until that space character,
-% dropping everything else until \cs{q_stop}. The \cs{c_zero} prevents
+% dropping everything else until \cs{q_stop}. The \cs{exp_end:} prevents
% losing braces around the user-inserted text if any, and stops the
-% expansion of \tn{romannumeral}.
+% expansion of \cs{exp:w}.
% \begin{macrocode}
\group_begin:
\char_set_catcode_math_superscript:N \^
@@ -2019,11 +2019,11 @@
{
\exp_not:n
{
- \tex_romannumeral:D
+ \exp:w
\exp_after:wN \exp_after:wN
\exp_after:wN \@@_expandable_error:w
\exp_after:wN \exp_after:wN
- \exp_after:wN \c_zero
+ \exp_after:wN \exp_end:
}
\exp_not:N \use:n { \exp_not:c { LaTeX3~error: } ^ #1 } ^
}
Modified: trunk/l3kernel/l3prg.dtx
===================================================================
--- trunk/l3kernel/l3prg.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3prg.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -1392,7 +1392,7 @@
% to avoid the last function to insert say, $100$ copies of the original
% argument just to gobble them again we define separate functions to
% be inserted first. These functions also close the expansion of
-% \cs{__int_to_roman:w}, which ensures that \cs{prg_replicate:nn} only
+% \cs{exp:w}, which ensures that \cs{prg_replicate:nn} only
% requires two steps of expansion.
%
% This function has one flaw though: Since it constantly passes down
@@ -1402,14 +1402,14 @@
% necessary, it is possible to write \cs{prg_replicate:nn} |{1000}|
% |{| \cs{prg_replicate:nn} |{1000}| \Arg{code}~|}|. An
% alternative approach is to create a string of |m|'s with
-% \cs{__int_to_roman:w} which can be done with just four macros but that
+% \cs{exp:w} which can be done with just four macros but that
% method has its own problems since it can exhaust the string
% pool. Also, it is considerably slower than what we use here so the
% few extra csnames are well spent I would say.
% \begin{macrocode}
\cs_new:Npn \prg_replicate:nn #1
{
- \__int_to_roman:w
+ \exp:w
\exp_after:wN \@@_replicate_first:N
\__int_value:w \__int_eval:w #1 \__int_eval_end:
\cs_end:
@@ -1449,19 +1449,19 @@
% \begin{macrocode}
\cs_new:cpn { @@_replicate_first_-:n } #1
{
- \c_zero
+ \exp_end:
\__msg_kernel_expandable_error:nn { kernel } { negative-replication }
}
-\cs_new:cpn { @@_replicate_first_0:n } #1 { \c_zero }
-\cs_new:cpn { @@_replicate_first_1:n } #1 { \c_zero #1 }
-\cs_new:cpn { @@_replicate_first_2:n } #1 { \c_zero #1#1 }
-\cs_new:cpn { @@_replicate_first_3:n } #1 { \c_zero #1#1#1 }
-\cs_new:cpn { @@_replicate_first_4:n } #1 { \c_zero #1#1#1#1 }
-\cs_new:cpn { @@_replicate_first_5:n } #1 { \c_zero #1#1#1#1#1 }
-\cs_new:cpn { @@_replicate_first_6:n } #1 { \c_zero #1#1#1#1#1#1 }
-\cs_new:cpn { @@_replicate_first_7:n } #1 { \c_zero #1#1#1#1#1#1#1 }
-\cs_new:cpn { @@_replicate_first_8:n } #1 { \c_zero #1#1#1#1#1#1#1#1 }
-\cs_new:cpn { @@_replicate_first_9:n } #1 { \c_zero #1#1#1#1#1#1#1#1#1 }
+\cs_new:cpn { @@_replicate_first_0:n } #1 { \exp_end: }
+\cs_new:cpn { @@_replicate_first_1:n } #1 { \exp_end: #1 }
+\cs_new:cpn { @@_replicate_first_2:n } #1 { \exp_end: #1#1 }
+\cs_new:cpn { @@_replicate_first_3:n } #1 { \exp_end: #1#1#1 }
+\cs_new:cpn { @@_replicate_first_4:n } #1 { \exp_end: #1#1#1#1 }
+\cs_new:cpn { @@_replicate_first_5:n } #1 { \exp_end: #1#1#1#1#1 }
+\cs_new:cpn { @@_replicate_first_6:n } #1 { \exp_end: #1#1#1#1#1#1 }
+\cs_new:cpn { @@_replicate_first_7:n } #1 { \exp_end: #1#1#1#1#1#1#1 }
+\cs_new:cpn { @@_replicate_first_8:n } #1 { \exp_end: #1#1#1#1#1#1#1#1 }
+\cs_new:cpn { @@_replicate_first_9:n } #1 { \exp_end: #1#1#1#1#1#1#1#1#1 }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1476,7 +1476,7 @@
% For testing vertical mode. Strikes me here on the bus with David,
% that as long as we are just talking about returning true and
% false states, we can just use the primitive conditionals for this
-% and gobbling the \cs{c_zero} in the input stream. However this
+% and gobbling the \cs{exp_end:} in the input stream. However this
% requires knowledge of the implementation so we keep things nice
% and clean and use the return statements.
% \begin{macrocode}
Modified: trunk/l3kernel/l3skip.dtx
===================================================================
--- trunk/l3kernel/l3skip.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3skip.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -1234,7 +1234,7 @@
}
\cs_new:Npn \@@_compare:w #1 \__prg_compare_error:
{
- \exp_after:wN \if_false: \tex_romannumeral:D -`0
+ \exp_after:wN \if_false: \exp:w \exp_continue_f:w
\@@_compare:wNN #1 ? { = \@@_compare_end:w \else: } \q_stop
}
\exp_args:Nno \use:nn
@@ -1278,22 +1278,22 @@
% \begin{macrocode}
\cs_new:Npn \dim_case:nnTF #1
{
- \tex_romannumeral:D
+ \exp:w
\exp_args:Nf \@@_case:nnTF { \dim_eval:n {#1} }
}
\cs_new:Npn \dim_case:nnT #1#2#3
{
- \tex_romannumeral:D
+ \exp:w
\exp_args:Nf \@@_case:nnTF { \dim_eval:n {#1} } {#2} {#3} { }
}
\cs_new:Npn \dim_case:nnF #1#2
{
- \tex_romannumeral:D
+ \exp:w
\exp_args:Nf \@@_case:nnTF { \dim_eval:n {#1} } {#2} { }
}
\cs_new:Npn \dim_case:nn #1#2
{
- \tex_romannumeral:D
+ \exp:w
\exp_args:Nf \@@_case:nnTF { \dim_eval:n {#1} } {#2} { } { }
}
\cs_new:Npn \@@_case:nnTF #1#2#3#4
Modified: trunk/l3kernel/l3str.dtx
===================================================================
--- trunk/l3kernel/l3str.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3str.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -485,22 +485,22 @@
% \begin{macrocode}
\cs_new:Npn \str_case:nn #1#2
{
- \tex_romannumeral:D
+ \exp:w
\@@_case:nnTF {#1} {#2} { } { }
}
\cs_new:Npn \str_case:nnT #1#2#3
{
- \tex_romannumeral:D
+ \exp:w
\@@_case:nnTF {#1} {#2} {#3} { }
}
\cs_new:Npn \str_case:nnF #1#2
{
- \tex_romannumeral:D
+ \exp:w
\@@_case:nnTF {#1} {#2} { }
}
\cs_new:Npn \str_case:nnTF #1#2
{
- \tex_romannumeral:D
+ \exp:w
\@@_case:nnTF {#1} {#2}
}
\cs_new:Npn \@@_case:nnTF #1#2#3#4
@@ -517,22 +517,22 @@
}
\cs_new:Npn \str_case_x:nn #1#2
{
- \tex_romannumeral:D
+ \exp:w
\@@_case_x:nnTF {#1} {#2} { } { }
}
\cs_new:Npn \str_case_x:nnT #1#2#3
{
- \tex_romannumeral:D
+ \exp:w
\@@_case_x:nnTF {#1} {#2} {#3} { }
}
\cs_new:Npn \str_case_x:nnF #1#2
{
- \tex_romannumeral:D
+ \exp:w
\@@_case_x:nnTF {#1} {#2} { }
}
\cs_new:Npn \str_case_x:nnTF #1#2
{
- \tex_romannumeral:D
+ \exp:w
\@@_case_x:nnTF {#1} {#2}
}
\cs_new:Npn \@@_case_x:nnTF #1#2#3#4
@@ -629,4 +629,4 @@
%
% \end{implementation}
%
-% \PrintIndex
\ No newline at end of file
+% \PrintIndex
Modified: trunk/l3kernel/l3tl.dtx
===================================================================
--- trunk/l3kernel/l3tl.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3tl.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -2166,22 +2166,22 @@
% \begin{macrocode}
\cs_new:Npn \tl_case:Nn #1#2
{
- \tex_romannumeral:D
+ \exp:w
\@@_case:NnTF #1 {#2} { } { }
}
\cs_new:Npn \tl_case:NnT #1#2#3
{
- \tex_romannumeral:D
+ \exp:w
\@@_case:NnTF #1 {#2} {#3} { }
}
\cs_new:Npn \tl_case:NnF #1#2#3
{
- \tex_romannumeral:D
+ \exp:w
\@@_case:NnTF #1 {#2} { } {#3}
}
\cs_new:Npn \tl_case:NnTF #1#2
{
- \tex_romannumeral:D
+ \exp:w
\@@_case:NnTF #1 {#2}
}
\cs_new:Npn \@@_case:NnTF #1#2#3#4
@@ -2506,7 +2506,7 @@
% \begin{macro}[EXP,aux]{\@@_act_space:wwnNNN}
% \begin{macro}[EXP,aux]{\@@_act_end:w}
% To help control the expansion, \cs{@@_act:NNNnn} should always
-% be proceeded by \tn{romannumeral} and ends by producing \cs{c_zero}
+% be proceeded by \cs{exp:w} and ends by producing \cs{exp_end:}
% once the result has been obtained. Then loop over tokens,
% groups, and spaces in |#5|. The marker \cs{q_@@_act_mark}
% is used both to avoid losing outer braces and to detect the
@@ -2524,8 +2524,8 @@
% In the loop, we check how the token list begins and act
% accordingly. In the \enquote{normal} case, we may have
% reached \cs{q_@@_act_mark}, the end of the list. Then
-% leave \cs{c_zero} and the result in the input stream,
-% to terminate the expansion of \tn{romannumeral}.
+% leave \cs{exp_end:} and the result in the input stream,
+% to terminate the expansion of \cs{exp:w}.
% Otherwise, apply the relevant function to the
% \enquote{arguments}, |#3|
% and to the head of the token list. Then repeat the loop.
@@ -2554,7 +2554,7 @@
{#3} #4
}
\cs_new:Npn \@@_act_end:wn #1 \@@_act_result:n #2
- { \group_align_safe_end: \c_zero #2 }
+ { \group_align_safe_end: \exp_end: #2 }
\cs_new:Npn \@@_act_group:nwnNNN #1 #2 \q_@@_act_stop #3#4#5
{
#5 {#3} {#1}
@@ -2602,7 +2602,7 @@
{
\etex_unexpanded:D \exp_after:wN
{
- \tex_romannumeral:D
+ \exp:w
\@@_act:NNNnn
\@@_reverse_normal:nN
\@@_reverse_group_preserve:nn
@@ -2907,20 +2907,20 @@
% |\if_false: { \fi: ... }| construction) both to hide potential
% alignment tab characters from \TeX{} in a table, and to allow for
% removing what remains of the token list after its first space. The
-% \cs{tex_romannumeral:D} and \cs{c_zero} ensure that the result of a
+% \cs{exp:w} and \cs{exp_end:} ensure that the result of a
% single step of expansion directly yields a balanced token list (no
% trailing closing brace).
% \begin{macrocode}
\prg_new_conditional:Npnn \tl_if_head_is_space:n #1 { p , T , F , TF }
{
- \tex_romannumeral:D \if_false: { \fi:
+ \exp:w \if_false: { \fi:
\@@_if_head_is_space:w ? #1 ? ~ }
}
\cs_new:Npn \@@_if_head_is_space:w #1 ~
{
\tl_if_empty:oTF { \use_none:n #1 }
- { \exp_after:wN \c_zero \exp_after:wN \prg_return_true: }
- { \exp_after:wN \c_zero \exp_after:wN \prg_return_false: }
+ { \exp_after:wN \exp_end: \exp_after:wN \prg_return_true: }
+ { \exp_after:wN \exp_end: \exp_after:wN \prg_return_false: }
\exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi:
}
% \end{macrocode}
Modified: trunk/l3kernel/l3token.dtx
===================================================================
--- trunk/l3kernel/l3token.dtx 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/l3token.dtx 2015-08-24 13:29:14 UTC (rev 5885)
@@ -2247,14 +2247,14 @@
% \cs{token_if_eq_meaning:NNTF} because \cs{l_peek_token} may be an
% outer macro (coming from non-\LaTeX3 packages). Spaces are removed
% using a side-effect of \texttt{f}-expansion:
-% |\tex_romannumeral:D -`0| removes one space.
+% |\exp:w \exp_continue_f:w| removes one space.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \@@_ignore_spaces_execute_branches:
{
\if_meaning:w \l_peek_token \c_space_token
\exp_after:wN \peek_after:Nw
\exp_after:wN \@@_ignore_spaces_execute_branches:
- \tex_romannumeral:D -`0
+ \exp:w \exp_continue_f:w
\else:
\exp_after:wN \@@_execute_branches:
\fi:
Modified: trunk/l3kernel/testfiles/m3basics002.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3basics002.tlg 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/testfiles/m3basics002.tlg 2015-08-24 13:29:14 UTC (rev 5885)
@@ -149,15 +149,16 @@
Defining \foo:nnnF on line ...
Defining \foo:nnnTF on line ...
> \foo:nnnT=\protected\long macro:#1#2#3->\tl_show:n {#1#2#3}\prg_return_true:
-\c_zero \use:n \use_none:n .
+\exp_end: \use:n \use_none:n .
> \foo:nnnF=\protected\long macro:#1#2#3->\tl_show:n {#1#2#3}\prg_return_true:
-\c_zero {}.
+\exp_end: {}.
> \foo:nnnTF=\protected\long macro:#1#2#3->\tl_show:n
-{#1#2#3}\prg_return_true: \c_zero .
+{#1#2#3}\prg_return_true: \exp_end: .
Defining \bar:nnnT on line ...
Defining \bar:nnnF on line ...
-> \bar:nnnT=\long macro:#1#2#3->\prg_return_true: \c_zero \use:n \use_none:n .
-> \bar:nnnF=\long macro:#1#2#3->\prg_return_true: \c_zero {}.
+> \bar:nnnT=\long macro:#1#2#3->\prg_return_true: \exp_end: \use:n \use_none:n
+.
+> \bar:nnnF=\long macro:#1#2#3->\prg_return_true: \exp_end: {}.
Defining \bar:nTF on line ...
============================================================
============================================================
@@ -237,7 +238,7 @@
|...............................................
Defining \baz:nTF on line ...
> \baz_p:n=\relax.
-> \baz:nTF=\protected\long macro:#1->\prg_return_true: \c_zero .
+> \baz:nTF=\protected\long macro:#1->\prg_return_true: \exp_end: .
============================================================
============================================================
TEST 8: prg_set_eq_conditional:NNn
Modified: trunk/l3kernel/testfiles/m3expan002.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expan002.tlg 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/testfiles/m3expan002.tlg 2015-08-24 13:29:14 UTC (rev 5885)
@@ -137,7 +137,7 @@
\protected macro:->\::N \::p \::o \::x \:::
Defining \foo_bar:wF on line ...
undefined
-\long macro:#1;->\prg_return_true: \c_zero {}
+\long macro:#1;->\prg_return_true: \exp_end: {}
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! LaTeX error: "kernel/invalid-variant"
Modified: trunk/l3kernel/testfiles/m3expl001.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.luatex.tlg 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/testfiles/m3expl001.luatex.tlg 2015-08-24 13:29:14 UTC (rev 5885)
@@ -242,6 +242,8 @@
Defining \exp_not:f on line ...
Defining \exp_not:V on line ...
Defining \exp_not:v on line ...
+Defining \exp_continue_f:w on line ...
+Defining
Defining \cs_generate_variant:Nn on line ...
Defining \__cs_generate_variant:N on line ...
Defining \__cs_generate_variant:ww on line ...
Modified: trunk/l3kernel/testfiles/m3expl001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.tlg 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/testfiles/m3expl001.tlg 2015-08-24 13:29:14 UTC (rev 5885)
@@ -242,6 +242,8 @@
Defining \exp_not:f on line ...
Defining \exp_not:V on line ...
Defining \exp_not:v on line ...
+Defining \exp_continue_f:w on line ...
+Defining ^^@ on line ...
Defining \cs_generate_variant:Nn on line ...
Defining \__cs_generate_variant:N on line ...
Defining \__cs_generate_variant:ww on line ...
Modified: trunk/l3kernel/testfiles/m3expl001.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.xetex.tlg 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/testfiles/m3expl001.xetex.tlg 2015-08-24 13:29:14 UTC (rev 5885)
@@ -242,6 +242,8 @@
Defining \exp_not:f on line ...
Defining \exp_not:V on line ...
Defining \exp_not:v on line ...
+Defining \exp_continue_f:w on line ...
+Defining ^^@ on line ...
Defining \cs_generate_variant:Nn on line ...
Defining \__cs_generate_variant:N on line ...
Defining \__cs_generate_variant:ww on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.luatex.tlg 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/testfiles/m3expl003.luatex.tlg 2015-08-24 13:29:14 UTC (rev 5885)
@@ -242,6 +242,8 @@
Defining \exp_not:f on line ...
Defining \exp_not:V on line ...
Defining \exp_not:v on line ...
+Defining \exp_continue_f:w on line ...
+Defining
Defining \cs_generate_variant:Nn on line ...
Defining \__cs_generate_variant:N on line ...
Defining \__cs_generate_variant:ww on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.tlg 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/testfiles/m3expl003.tlg 2015-08-24 13:29:14 UTC (rev 5885)
@@ -242,6 +242,8 @@
Defining \exp_not:f on line ...
Defining \exp_not:V on line ...
Defining \exp_not:v on line ...
+Defining \exp_continue_f:w on line ...
+Defining ^^@ on line ...
Defining \cs_generate_variant:Nn on line ...
Defining \__cs_generate_variant:N on line ...
Defining \__cs_generate_variant:ww on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.xetex.tlg 2015-08-23 13:50:58 UTC (rev 5884)
+++ trunk/l3kernel/testfiles/m3expl003.xetex.tlg 2015-08-24 13:29:14 UTC (rev 5885)
@@ -242,6 +242,8 @@
Defining \exp_not:f on line ...
Defining \exp_not:V on line ...
Defining \exp_not:v on line ...
+Defining \exp_continue_f:w on line ...
+Defining ^^@ on line ...
Defining \cs_generate_variant:Nn on line ...
Defining \__cs_generate_variant:N on line ...
Defining \__cs_generate_variant:ww on line ...
More information about the latex3-commits
mailing list