diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx | 112 |
1 files changed, 51 insertions, 61 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx index 19c6466cb82..99b729d8ed5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx @@ -1,13 +1,13 @@ % \iffalse meta-comment % -%% File: l3tl-analysis.dtx Copyright (C) 2011-2012,2015-2017 The LaTeX3 Project% +%% File: l3tl-analysis.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 % license or (at your option) any later version. The latest version % of this license is in the file % -% http://www.latex-project.org/lppl.txt +% https://www.latex-project.org/lppl.txt % % This file is part of the "l3kernel bundle" (The Work in LPPL) % and all files in that bundle must be distributed together. @@ -21,7 +21,7 @@ % for those people who are interested. % %<*driver> -\documentclass[full]{l3doc} +\documentclass[full,kernel]{l3doc} \begin{document} \DocInput{\jobname.dtx} \end{document} @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2017/11/14} +% \date{Released 2017/12/05} % % \maketitle % @@ -247,8 +247,8 @@ % \end{macrocode} % \end{variable} % -% \begin{macro}[int, EXP]{\@@_extract_charcode:} -% \begin{macro}[aux, EXP]{\@@_extract_charcode_aux:w} +% \begin{macro}[EXP]{\@@_extract_charcode:} +% \begin{macro}[EXP]{\@@_extract_charcode_aux:w} % Extracting the character code from the meaning of % \cs{l_@@_token}. This has no error checking, and should % only be assumed to work for begin-group and end-group character @@ -264,9 +264,9 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int, EXP]{\@@_cs_space_count:NN} -% \begin{macro}[aux, EXP]{\@@_cs_space_count:w} -% \begin{macro}[aux, EXP]{\@@_cs_space_count_end:w} +% \begin{macro}[EXP]{\@@_cs_space_count:NN} +% \begin{macro}[EXP]{\@@_cs_space_count:w} +% \begin{macro}[EXP]{\@@_cs_space_count_end:w} % Counts the number of spaces in the string representation of its % second argument, as well as the number of characters following the % last space in that representation, and feeds the two numbers as @@ -346,7 +346,7 @@ % % The second pass is a simple exercise in expandable loops. % -% \begin{macro}[int]{\@@:n} +% \begin{macro}{\@@:n} % Everything is done within a group, and all definitions are % local. We use \cs{group_align_safe_begin/end:} to avoid problems in % case \cs{@@:n} is used within an alignment and its argument @@ -366,7 +366,7 @@ % % \subsection{Disabling active characters} % -% \begin{macro}[aux]{\@@_disable:n} +% \begin{macro}{\@@_disable:n} % Active characters can cause problems later on in the processing, so % we provide a way to disable them, by setting them to % \texttt{undefined}. Since Unicode contains too many characters to @@ -431,7 +431,7 @@ % \cs{str_tail:n} \Arg{token} is non-empty, because the % escape character is printable. % -% \begin{macro}[int]{\@@_a:n} +% \begin{macro}{\@@_a:n} % We read tokens one by one using \tn{futurelet}. % While performing the loop, we keep track of the number of % true begin-group characters minus the number of @@ -451,7 +451,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\@@_a_loop:w} +% \begin{macro}{\@@_a_loop:w} % Read one character and check its type. % \begin{macrocode} \cs_new_protected:Npn \@@_a_loop:w @@ -459,7 +459,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\@@_a_type:w} +% \begin{macro}{\@@_a_type:w} % At this point, \cs{l_@@_token} holds the meaning % of the following token. We store in \cs{l_@@_type_int} % information about the meaning of the token ahead: @@ -503,8 +503,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\@@_a_space:w} -% \begin{macro}[aux]{\@@_a_space_test:w} +% \begin{macro}{\@@_a_space:w} +% \begin{macro}{\@@_a_space_test:w} % In this branch, the following token's meaning is a blank space. % Apply \tn{string} to that token: a true blank space gives a space, a % control sequence gives a result starting with the escape character, @@ -547,8 +547,8 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int]{\@@_a_bgroup:w, \@@_a_egroup:w} -% \begin{macro}[aux] +% \begin{macro}{\@@_a_bgroup:w, \@@_a_egroup:w} +% \begin{macro} % {\@@_a_group:nw, \@@_a_group_aux:w, \@@_a_group_auxii:w, \@@_a_group_test:w} % The token is most likely a true character token with catcode $1$ or % $2$, but it might be a control sequence, or an active character. @@ -610,7 +610,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int]{\@@_a_store:} +% \begin{macro}{\@@_a_store:} % This function is called each time we meet a special token; % at this point, the \tn{toks} register \cs{l_@@_index_int} % holds a token list which expands to the given special token. @@ -657,8 +657,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\@@_a_safe:N} -% \begin{macro}[aux]{\@@_a_cs:ww} +% \begin{macro}{\@@_a_safe:N} +% \begin{macro}{\@@_a_cs:ww} % This should be the simplest case: since the upcoming token is safe, % we can simply grab it in a second pass. If the token is a single % character (including space), the \cs{if_charcode:w} test yields @@ -715,8 +715,8 @@ % All the necessary information is stored in \tn{skip} % and \tn{toks} registers. % -% \begin{macro}[int]{\@@_b:n} -% \begin{macro}[int, EXP]{\@@_b_loop:w} +% \begin{macro}{\@@_b:n} +% \begin{macro}[EXP]{\@@_b_loop:w} % Start the loop with the index $0$. No need for an end-marker: % the loop stops by itself when the last index is read. % We repeatedly oscillate between reading long stretches @@ -739,8 +739,8 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int, EXP]{\@@_b_normals:ww} -% \begin{macro}[aux, EXP]{\@@_b_normal:wwN} +% \begin{macro}[EXP]{\@@_b_normals:ww} +% \begin{macro}[EXP]{\@@_b_normal:wwN} % The first argument is the number of normal tokens which remain % to be read, and the second argument is the index in the array % produced in the first step. @@ -777,7 +777,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int, EXP]{\@@_b_char:Nww} +% \begin{macro}[EXP]{\@@_b_char:Nww} % If the normal token we grab is a character, leave % \meta{catcode} \meta{charcode} followed by \cs{s__tl} % in the input stream, and call \cs{@@_b_normals:ww} @@ -806,8 +806,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int, EXP]{\@@_b_cs:Nww} -% \begin{macro}[aux, EXP]{\@@_b_cs_test:ww} +% \begin{macro}[EXP]{\@@_b_cs:Nww} +% \begin{macro}[EXP]{\@@_b_cs_test:ww} % If the token we grab is a control sequence, leave % |0 -1| (as category code and character code) in the input stream, % followed by \cs{s__tl}, @@ -835,9 +835,9 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int, EXP]{\@@_b_special:w} -% \begin{macro}[aux, EXP]{\@@_b_special_char:wN} -% \begin{macro}[aux, EXP]{\@@_b_special_space:w} +% \begin{macro}[EXP]{\@@_b_special:w} +% \begin{macro}[EXP]{\@@_b_special_char:wN} +% \begin{macro}[EXP]{\@@_b_special_space:w} % Here, |#1| is the current index in the array built in the first pass. % Check now whether we reached the end (we shouldn't keep the trailing % end-group character that marked the end of the token list in the @@ -889,8 +889,8 @@ % % \subsection{Mapping through the analysis} % -% \begin{macro}[int]{\@@_map_inline:nn} -% \begin{macro}[aux]{\@@_map_inline_aux:Nn} +% \begin{macro}{\@@_map_inline:nn} +% \begin{macro}{\@@_map_inline_aux:Nn} % First obtain the analysis of the token list into % \cs{g_@@_result_tl}. To allow nested mappings, increase the % nesting depth \cs{g__prg_map_int} (shared between all modules), then @@ -929,7 +929,6 @@ % \subsection{Showing the results} % % \begin{macro}{\tl_show_analysis:N, \tl_show_analysis:n} -% \begin{macro}[int]{\@@_show:} % Add to \cs{@@:n} a third pass to display tokens to the terminal. % If the token list variable is not defined, throw the same error % as \cs{tl_show:N} by simply calling that function. @@ -939,36 +938,21 @@ \tl_if_exist:NTF #1 { \exp_args:No \@@:n {#1} - \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-tl-analysis } - { \token_to_str:N #1 } { \tl_if_empty:NTF #1 { } { ? } } { } { } - \@@_show: + \msg_show:nnxxxx { LaTeX / kernel } { show-tl-analysis } + { \token_to_str:N #1 } { \@@_show: } { } { } } { \tl_show:N #1 } } \cs_new_protected:Npn \tl_show_analysis:n #1 { \@@:n {#1} - \__msg_show_pre:nnxxxx { LaTeX / kernel } { show-tl-analysis } - { } { \tl_if_empty:nTF {#1} { } { ? } } { } { } - \@@_show: - } -\cs_new_protected:Npn \@@_show: - { - \group_begin: - \exp_args:NNx - \group_end: - \__msg_show_wrap:n - { - \exp_after:wN \@@_show_loop:wNw \g_@@_result_tl - \s__tl { ? \__prg_break: } \s__tl - \__prg_break_point: - } + \msg_show:nnxxxx { LaTeX / kernel } { show-tl-analysis } + { } { \@@_show: } { } { } } % \end{macrocode} % \end{macro} -% \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_show_loop:wNw} +% \begin{macro}[rEXP]{\@@_show:, \@@_show_loop:wNw} % Here, |#1| \texttt{o}- and \texttt{x}-expands to the token; % |#2| is the category code (one uppercase hexadecimal digit), % $0$ for control sequences; @@ -977,10 +961,16 @@ % the meaning may overflow one line, and we want to truncate % it. Those cases are thus separated out. % \begin{macrocode} +\cs_new:Npn \@@_show: + { + \exp_after:wN \@@_show_loop:wNw \g_@@_result_tl + \s__tl { ? \__prg_break: } \s__tl + \__prg_break_point: + } \cs_new:Npn \@@_show_loop:wNw #1 \s__tl #2 #3 \s__tl { \use_none:n #2 - \exp_not:n { \\ > \ \ } + \iow_newline: > \use:nn { ~ } { ~ } \if_int_compare:w "#2 = 0 \exp_stop_f: \exp_after:wN \@@_show_cs:n \else: @@ -998,7 +988,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_show_normal:n} +% \begin{macro}[rEXP]{\@@_show_normal:n} % Non-active characters are a simple matter of printing % the character, and its meaning. Our test suite checks that % begin-group and end-group characters do not mess up @@ -1033,10 +1023,10 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, rEXP]{\@@_show_cs:n} -% \begin{macro}[aux, rEXP]{\@@_show_active:n} -% \begin{macro}[aux, rEXP]{\@@_show_long:nn} -% \begin{macro}[aux, rEXP]{\@@_show_long_aux:nnnn} +% \begin{macro}[rEXP]{\@@_show_cs:n} +% \begin{macro}[rEXP]{\@@_show_active:n} +% \begin{macro}[rEXP]{\@@_show_long:nn} +% \begin{macro}[rEXP]{\@@_show_long_aux:nnnn} % Control sequences and active characters are printed in the same way, % making sure not to go beyond the \cs{l_iow_line_count_int}. In case % of an overflow, we replace the last characters by @@ -1093,7 +1083,7 @@ The~token~list~ \tl_if_empty:nF {#1} { #1 ~ } \tl_if_empty:nTF {#2} { is~empty } - { contains~the~tokens: } + { contains~the~tokens: #2 } } % \end{macrocode} % |