[latex3-commits] [git/LaTeX3-latex3-latex3] master: Add new public \tl_analysis_map_inline:nn (4ac171b)
Joseph Wright
joseph.wright at morningstar2.co.uk
Mon Apr 9 15:48:08 CEST 2018
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/4ac171b1f7cb0a9e0f843941c95784d0d7e0e3b0
>---------------------------------------------------------------
commit 4ac171b1f7cb0a9e0f843941c95784d0d7e0e3b0
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Mon Apr 9 12:40:48 2018 +0100
Add new public \tl_analysis_map_inline:nn
The name here may need adjustment: the "show" function is
\tl_show_analysis:n. Presumably one of them is the wrong way around ....
On the *returned* data, I've made the swap suggested by Bruno and have
charcode/catcode as for \char_generate:nn.
>---------------------------------------------------------------
4ac171b1f7cb0a9e0f843941c95784d0d7e0e3b0
l3kernel/l3regex.dtx | 10 +++---
l3kernel/l3tl-analysis.dtx | 58 +++++++++++++++++--------------
l3kernel/testfiles/m3expl001.luatex.tlg | 3 +-
l3kernel/testfiles/m3expl001.ptex.tlg | 3 +-
l3kernel/testfiles/m3expl001.tlg | 3 +-
l3kernel/testfiles/m3expl001.uptex.tlg | 3 +-
l3kernel/testfiles/m3expl001.xetex.tlg | 3 +-
l3kernel/testfiles/m3expl003.luatex.tlg | 3 +-
l3kernel/testfiles/m3expl003.ptex.tlg | 3 +-
l3kernel/testfiles/m3expl003.tlg | 3 +-
l3kernel/testfiles/m3expl003.uptex.tlg | 3 +-
l3kernel/testfiles/m3expl003.xetex.tlg | 3 +-
12 files changed, 56 insertions(+), 42 deletions(-)
diff --git a/l3kernel/l3regex.dtx b/l3kernel/l3regex.dtx
index 7d54a52..7b3627a 100644
--- a/l3kernel/l3regex.dtx
+++ b/l3kernel/l3regex.dtx
@@ -3362,16 +3362,16 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_compile_u_not_cs:
{
- \exp_args:No \__tl_analysis_map_inline:nn { \l_@@_internal_a_tl }
+ \tl_analysis_map_inline:on { \l_@@_internal_a_tl }
{
\tl_build_put_right:Nx \l_@@_build_tl
{
\@@_class:NnnnN \c_true_bool
{
- \if_int_compare:w "##2 = 0 \exp_stop_f:
+ \if_int_compare:w "##3 = 0 \exp_stop_f:
\@@_item_exact_cs:n { \exp_after:wN \cs_to_str:N ##1 }
\else:
- \@@_item_exact:nn { \int_value:w "##2 } { ##3 }
+ \@@_item_exact:nn { \int_value:w "##3 } { ##2 }
\fi:
}
{ 1 } { 0 } \c_false_bool
@@ -4579,8 +4579,8 @@
\int_set:Nn \l_@@_curr_pos_int { 2 * \l_@@_max_state_int }
\@@_query_set:nnn { } { -1 } { -2 }
\int_set_eq:NN \l_@@_min_pos_int \l_@@_curr_pos_int
- \__tl_analysis_map_inline:nn {#1}
- { \@@_query_set:nnn {##1} {"##2} {##3} }
+ \tl_analysis_map_inline:nn {#1}
+ { \@@_query_set:nnn {##1} {"##3} {##2} }
\int_set_eq:NN \l_@@_max_pos_int \l_@@_curr_pos_int
\@@_query_set:nnn { } { -1 } { -2 }
\@@_match_init:
diff --git a/l3kernel/l3tl-analysis.dtx b/l3kernel/l3tl-analysis.dtx
index 0ddcf9d..5a3ff1b 100644
--- a/l3kernel/l3tl-analysis.dtx
+++ b/l3kernel/l3tl-analysis.dtx
@@ -65,26 +65,10 @@
% characters, and the value of registers.
% \end{function}
%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3tl-analysis} implementation}
-%
-% \begin{macrocode}
-%<@@=tl>
-% \end{macrocode}
-%
-% \subsection{Internal functions}
-%
-% \begin{variable}{\s_@@}
-% The format used to store token lists internally uses the scan mark
-% \cs{s_@@} as a delimiter.
-% \end{variable}
-%
-% \begin{function}{\@@_analysis_map_inline:nn}
+% \begin{function}[added = 2018-04-09]
+% {\tl_analysis_map_inline:nn, \tl_analysis_map_inline:on}
% \begin{syntax}
-% \cs{@@_analysis_map_inline:nn} \Arg{token list} \Arg{inline function}
+% \cs{tl_analysis_map_inline:nn} \Arg{token list} \Arg{inline function}
% \end{syntax}
% Applies the \meta{inline function} to each individual \meta{token}
% in the \meta{token list}. The \meta{inline function} receives three
@@ -93,20 +77,33 @@
% \item \meta{tokens}, which both \texttt{o}-expand and
% \texttt{x}-expand to the \meta{token}. The detailed form of
% \meta{token} may change in later releases.
+% \item \meta{char code}, a decimal representation of the character
+% code of the token, $-1$ if it is a control sequence (with
+% \meta{catcode} $0$).
% \item \meta{catcode}, a capital hexadecimal digit which denotes
% the category code of the \meta{token} (0: control sequence, 1:
% begin-group, 2: end-group, 3: math shift, 4: alignment tab, 6:
% parameter, 7: superscript, 8: subscript, A: space, B: letter,
% C:other, D:active).
-% \item \meta{char code}, a decimal representation of the character
-% code of the token, $-1$ if it is a control sequence (with
-% \meta{catcode} $0$).
% \end{itemize}
% \end{function}
%
-% For optimizations in \pkg{l3regex} (when matching control sequences),
-% it may be useful to provide a \cs{@@_analysis_from_str_map_inline:nn}
-% function, perhaps named \cs{__str_analysis_map_inline:nn}.
+% \end{documentation}
+%
+% \begin{implementation}
+%
+% \section{\pkg{l3tl-analysis} implementation}
+%
+% \begin{macrocode}
+%<@@=tl>
+% \end{macrocode}
+%
+% \subsection{Internal functions}
+%
+% \begin{variable}{\s_@@}
+% The format used to store token lists internally uses the scan mark
+% \cs{s_@@} as a delimiter.
+% \end{variable}
%
% \subsection{Internal format}
%
@@ -881,8 +878,9 @@
%
% \subsection{Mapping through the analysis}
%
-% \begin{macro}{\@@_analysis_map_inline:nn}
+% \begin{macro}{\tl_analysis_map_inline:nn, \tl_analysis_map_inline:on}
% \begin{macro}{\@@_analysis_map_inline_aux:Nn}
+% \begin{macro}{\@@_analysis_map_inline_aux:nnn}
% First obtain the analysis of the token list into
% \cs{g_@@_analysis_result_tl}. To allow nested mappings, increase the
% nesting depth \cs{g__kernel_prg_map_int} (shared between all modules), then
@@ -894,18 +892,23 @@
% |#2|, and loops by calling itself. When the loop ends, remember to
% decrease the nesting depth.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_analysis_map_inline:nn #1
+\cs_new_protected:Npn \tl_analysis_map_inline:nn #1
{
\@@_analysis:n {#1}
\int_gincr:N \g__kernel_prg_map_int
\exp_args:Nc \@@_analysis_map_inline_aux:Nn
{ @@_analysis_map_inline_ \int_use:N \g__kernel_prg_map_int :wNw }
}
+\cs_generate_variant:Nn \tl_analysis_map_inline:nn { o }
\cs_new_protected:Npn \@@_analysis_map_inline_aux:Nn #1#2
{
\cs_gset_protected:Npn #1 ##1 \s_@@ ##2 ##3 \s_@@
{
\use_none:n ##2
+ \@@_analysis_map_inline_aux:nnn {##1} {##3} {##2}
+ }
+ \cs_gset_protected:Npn \@@_analysis_map_inline_aux:nnn ##1##2##3
+ {
#2
#1
}
@@ -917,6 +920,7 @@
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \subsection{Showing the results}
%
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index 982279f..406a541 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -4316,7 +4316,8 @@ Defining \__tl_analysis_b_cs_test:ww on line ...
Defining \__tl_analysis_b_special:w on line ...
Defining \__tl_analysis_b_special_char:wN on line ...
Defining \__tl_analysis_b_special_space:w on line ...
-Defining \__tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:on on line ...
Defining \__tl_analysis_map_inline_aux:Nn on line ...
Defining \tl_show_analysis:N on line ...
Defining \tl_show_analysis:n on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index d5f031f..deb15d0 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -4570,7 +4570,8 @@ Defining \__tl_analysis_b_cs_test:ww on line ...
Defining \__tl_analysis_b_special:w on line ...
Defining \__tl_analysis_b_special_char:wN on line ...
Defining \__tl_analysis_b_special_space:w on line ...
-Defining \__tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:on on line ...
Defining \__tl_analysis_map_inline_aux:Nn on line ...
Defining \tl_show_analysis:N on line ...
Defining \tl_show_analysis:n on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index 2ecc4ce..e74f2a1 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -4570,7 +4570,8 @@ Defining \__tl_analysis_b_cs_test:ww on line ...
Defining \__tl_analysis_b_special:w on line ...
Defining \__tl_analysis_b_special_char:wN on line ...
Defining \__tl_analysis_b_special_space:w on line ...
-Defining \__tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:on on line ...
Defining \__tl_analysis_map_inline_aux:Nn on line ...
Defining \tl_show_analysis:N on line ...
Defining \tl_show_analysis:n on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 33f3474..9997dde 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -4570,7 +4570,8 @@ Defining \__tl_analysis_b_cs_test:ww on line ...
Defining \__tl_analysis_b_special:w on line ...
Defining \__tl_analysis_b_special_char:wN on line ...
Defining \__tl_analysis_b_special_space:w on line ...
-Defining \__tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:on on line ...
Defining \__tl_analysis_map_inline_aux:Nn on line ...
Defining \tl_show_analysis:N on line ...
Defining \tl_show_analysis:n on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index d9ea317..df30b74 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -4289,7 +4289,8 @@ Defining \__tl_analysis_b_cs_test:ww on line ...
Defining \__tl_analysis_b_special:w on line ...
Defining \__tl_analysis_b_special_char:wN on line ...
Defining \__tl_analysis_b_special_space:w on line ...
-Defining \__tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:on on line ...
Defining \__tl_analysis_map_inline_aux:Nn on line ...
Defining \tl_show_analysis:N on line ...
Defining \tl_show_analysis:n on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 982279f..406a541 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -4316,7 +4316,8 @@ Defining \__tl_analysis_b_cs_test:ww on line ...
Defining \__tl_analysis_b_special:w on line ...
Defining \__tl_analysis_b_special_char:wN on line ...
Defining \__tl_analysis_b_special_space:w on line ...
-Defining \__tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:on on line ...
Defining \__tl_analysis_map_inline_aux:Nn on line ...
Defining \tl_show_analysis:N on line ...
Defining \tl_show_analysis:n on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index d5f031f..deb15d0 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -4570,7 +4570,8 @@ Defining \__tl_analysis_b_cs_test:ww on line ...
Defining \__tl_analysis_b_special:w on line ...
Defining \__tl_analysis_b_special_char:wN on line ...
Defining \__tl_analysis_b_special_space:w on line ...
-Defining \__tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:on on line ...
Defining \__tl_analysis_map_inline_aux:Nn on line ...
Defining \tl_show_analysis:N on line ...
Defining \tl_show_analysis:n on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index 2ecc4ce..e74f2a1 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -4570,7 +4570,8 @@ Defining \__tl_analysis_b_cs_test:ww on line ...
Defining \__tl_analysis_b_special:w on line ...
Defining \__tl_analysis_b_special_char:wN on line ...
Defining \__tl_analysis_b_special_space:w on line ...
-Defining \__tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:on on line ...
Defining \__tl_analysis_map_inline_aux:Nn on line ...
Defining \tl_show_analysis:N on line ...
Defining \tl_show_analysis:n on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index 33f3474..9997dde 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -4570,7 +4570,8 @@ Defining \__tl_analysis_b_cs_test:ww on line ...
Defining \__tl_analysis_b_special:w on line ...
Defining \__tl_analysis_b_special_char:wN on line ...
Defining \__tl_analysis_b_special_space:w on line ...
-Defining \__tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:on on line ...
Defining \__tl_analysis_map_inline_aux:Nn on line ...
Defining \tl_show_analysis:N on line ...
Defining \tl_show_analysis:n on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index d9ea317..df30b74 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -4289,7 +4289,8 @@ Defining \__tl_analysis_b_cs_test:ww on line ...
Defining \__tl_analysis_b_special:w on line ...
Defining \__tl_analysis_b_special_char:wN on line ...
Defining \__tl_analysis_b_special_space:w on line ...
-Defining \__tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:nn on line ...
+Defining \tl_analysis_map_inline:on on line ...
Defining \__tl_analysis_map_inline_aux:Nn on line ...
Defining \tl_show_analysis:N on line ...
Defining \tl_show_analysis:n on line ...
More information about the latex3-commits
mailing list