diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx | 119 |
1 files changed, 59 insertions, 60 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx index f83cd642d62..cd0bf745c9d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -181,11 +181,10 @@ % be values of registers. Assume that one number, say, $12345$, has % already been found, and that we want to parse the next number. The % current status of the code may look as follows. -% \begin{quote}\ttfamily -% \cs{exp_after:wN} |\add:ww| -% \cs{__int_value:w} 12345 \cs{exp_after:wN} ; \newline +% \begin{syntax} +% \cs{exp_after:wN} |\add:ww| \cs{__int_value:w} 12345 \cs{exp_after:wN} ; % \cs{exp:w} |\operand:w| \meta{stuff} -% \end{quote} +% \end{syntax} % 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 @@ -194,19 +193,19 @@ % what follows and make a number out of it, then leave \cs{exp_end:}, 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 +% \begin{syntax} +% \cs{exp_after:wN} |\add:ww| \cs{__int_value:w} 12345 ; % \cs{exp:w} \cs{exp_end:} 333444 ; -% \end{quote} +% \end{syntax} % where in fact \cs{exp_after:wN} has already been expanded, % \cs{__int_value:w} has already seen |12345|, and % \cs{exp:w} is still looking for a number. It finds % \cs{exp_end:}, 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 -% \begin{quote}\ttfamily +% \begin{syntax} % |\add:ww| 12345 ; 333444 ; -% \end{quote} +% \end{syntax} % which can safely perform the addition by grabbing two arguments % delimited by~|;|. % @@ -290,10 +289,10 @@ % of this function is that it reads one \meta{number}, performing no % computation, and finds the following binary \meta{operator}. Then it % expands to -% \begin{quote} -% \meta{number} \newline -% ~~|\__fp_parse_infix_|\meta{operator}|:N| \meta{precedence} -% \end{quote} +% \begin{syntax} +% \meta{number} +% | \__fp_parse_infix_|\meta{operator}|:N| \meta{precedence} +% \end{syntax} % expanding the \texttt{infix} auxiliary before leaving the above in the % input stream. % @@ -310,17 +309,17 @@ % auxiliary for the following \meta{operator}, to know whether to % perform the computation of the \meta{operator}. If it should not be % performed, the \texttt{infix} auxiliary expands to -% \begin{quote} +% \begin{syntax} % |@| \cs{use_none:n} |\__fp_parse_infix_|\meta{operator}|:N| -% \end{quote} +% \end{syntax} % and otherwise it calls \cs{@@_parse_operand:Nw} with the precedence of % the \meta{operator} to find its second operand \meta{number_2} and the % next \meta{operator_2}, and expands to -% \begin{quote} -% |@| \cs{@@_parse_apply_binary:NwNwN} \newline -% ~~~~\meta{operator} \meta{number_2} \newline +% \begin{syntax} +% |@| \cs{@@_parse_apply_binary:NwNwN} +% ~~~~\meta{operator} \meta{number_2} % |@| |\__fp_parse_infix_|\meta{operator_2}|:N| -% \end{quote} +% \end{syntax} % The \texttt{infix} function is responsible for comparing precedences, % but cannot directly call the computation functions, because the first % operand \meta{number} is before the \texttt{infix} function in the @@ -329,57 +328,57 @@ % % A definition of \cs{@@_parse_operand:Nw} \meta{precedence} with some % of the expansion control removed is -% \begin{quote} -% \cs{exp_after:wN} \cs{@@_parse_continue:NwN} \newline -% \cs{exp_after:wN} \meta{precedence} \newline -% \cs{exp:w} \cs{exp_end_continue_f:w} \newline +% \begin{syntax} +% \cs{exp_after:wN} \cs{@@_parse_continue:NwN} +% \cs{exp_after:wN} \meta{precedence} +% \cs{exp:w} \cs{exp_end_continue_f:w} % ~~\cs{@@_parse_one:Nw} \meta{precedence} -% \end{quote} +% \end{syntax} % This expands \cs{@@_parse_one:Nw} \meta{precedence} completely, which % finds a number, wraps the next \meta{operator} into an \texttt{infix} % function, feeds this function the \meta{precedence}, and expands it, % yielding either -% \begin{quote} -% \cs{@@_parse_continue:NwN} \meta{precedence} \newline -% \meta{number} |@| \newline +% \begin{syntax} +% \cs{@@_parse_continue:NwN} \meta{precedence} +% \meta{number} |@| % \cs{use_none:n} |\__fp_parse_infix_|\meta{operator}|:N| -% \end{quote} +% \end{syntax} % or -% \begin{quote} -% \cs{@@_parse_continue:NwN} \meta{precedence} \newline -% \meta{number} |@| \newline -% \cs{@@_parse_apply_binary:NwNwN} \newline -% ~~\meta{operator} \meta{number_2} \newline +% \begin{syntax} +% \cs{@@_parse_continue:NwN} \meta{precedence} +% \meta{number} |@| +% \cs{@@_parse_apply_binary:NwNwN} +% ~~\meta{operator} \meta{number_2} % |@| |\__fp_parse_infix_|\meta{operator_2}|:N| -% \end{quote} +% \end{syntax} % The definition of \cs{@@_parse_continue:NwN} is then very simple: -% \begin{verbatim} -% \cs_new:Npn \__fp_parse_continue:NwN #1#2@#3 { #3 #1 #2 @ } -% \end{verbatim} +% \begin{syntax} +% |\cs_new:Npn \__fp_parse_continue:NwN #1#2@#3 { #3 #1 #2 @ }| +% \end{syntax} % In the first case, |#3|~is \cs{use_none:n}, yielding -% \begin{quote} -% \cs{use_none:n} \meta{precedence} \meta{number} |@| \newline +% \begin{syntax} +% \cs{use_none:n} \meta{precedence} \meta{number} |@| % |\__fp_parse_infix_|\meta{operator}|:N| -% \end{quote} +% \end{syntax} % then \meta{number} |@| |\__fp_parse_infix_|\meta{operator}|:N|. In % the second case, |#3|~is \cs{@@_parse_apply_binary:NwNwN}, whose role % is to compute \meta{number} \meta{operator} \meta{number_2} and to % prepare for the next comparison of precedences: first we get -% \begin{quote} -% \cs{@@_parse_apply_binary:NwNwN} \newline -% ~~\meta{precedence} \meta{number} |@| \newline -% ~~\meta{operator} \meta{number_2} \newline +% \begin{syntax} +% \cs{@@_parse_apply_binary:NwNwN} +% ~~\meta{precedence} \meta{number} |@| +% ~~\meta{operator} \meta{number_2} % |@| |\__fp_parse_infix_|\meta{operator_2}|:N| -% \end{quote} +% \end{syntax} % then -% \begin{quote} -% \cs{exp_after:wN} \cs{@@_parse_continue:NwN} \newline -% \cs{exp_after:wN} \meta{precedence} \newline -% \cs{exp:w} \cs{exp_end_continue_f:w} \newline -% |\__fp_|\meta{operator}|_o:ww| \meta{number} \meta{number_2} \newline -% \cs{exp:w} \cs{exp_end_continue_f:w} \newline +% \begin{syntax} +% \cs{exp_after:wN} \cs{@@_parse_continue:NwN} +% \cs{exp_after:wN} \meta{precedence} +% \cs{exp:w} \cs{exp_end_continue_f:w} +% |\__fp_|\meta{operator}|_o:ww| \meta{number} \meta{number_2} +% \cs{exp:w} \cs{exp_end_continue_f:w} % |\__fp_parse_infix_|\meta{operator_2}|:N| \meta{precedence} -% \end{quote} +% \end{syntax} % where |\__fp_|\meta{operator}|_o:ww| computes \meta{number} % \meta{operator} \meta{number_2} and expands after the result, thus % triggers the comparison of the precedence of the \meta{operator_2} and @@ -679,9 +678,9 @@ % functions read tokens one by one, and output digits into the input % stream, until meeting a non-digit, or up to a number of digits equal % to their index. The full expansion is -% \begin{quote} +% \begin{syntax} % \meta{digits} |;| \meta{filling 0} |;| \meta{length} -% \end{quote} +% \end{syntax} % where \meta{filling 0} is a string of zeros such that \meta{digits} % \meta{filling 0} has the length given by the index of the function, % and \meta{length} is the number of zeros in the \meta{filling 0} @@ -1574,11 +1573,11 @@ % % Expansion is a little bit tricky here, in part because we accept input % where multiplication is implicit. -% \begin{verbatim} -% \@@_parse:n { 3.2 erf(0.1) } -% \@@_parse:n { 3.2 e\l_my_int } -% \@@_parse:n { 3.2 \c_pi_fp } -% \end{verbatim} +% \begin{syntax} +% \cs{@@_parse:n} |{ 3.2 erf(0.1) }| +% \cs{@@_parse:n} |{ 3.2 e\l_my_int }| +% \cs{@@_parse:n} |{ 3.2 \c_pi_fp }| +% \end{syntax} % The first case indicates that just looking one character ahead for an % \enquote{\texttt{e}} is not enough, since we would mistake the % function \texttt{erf} for an exponent of \enquote{\texttt{rf}}. An |