| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
%% File: l3text-map.dtx |
| 4 |
% |
| 5 |
% Copyright (C) 2022-2026 The LaTeX Project |
| 6 |
% |
| 7 |
% It may be distributed and/or modified under the conditions of the |
| 8 |
% LaTeX Project Public License (LPPL), either version 1.3c of this |
| 9 |
% license or (at your option) any later version. The latest version |
| 10 |
% of this license is in the file |
| 11 |
% |
| 12 |
% https://www.latex-project.org/lppl.txt |
| 13 |
% |
| 14 |
% This file is part of the "l3kernel bundle" (The Work in LPPL) |
| 15 |
% and all files in that bundle must be distributed together. |
| 16 |
% |
| 17 |
% ----------------------------------------------------------------------- |
| 18 |
% |
| 19 |
% The development version of the bundle can be found at |
| 20 |
% |
| 21 |
% https://github.com/latex3/latex3 |
| 22 |
% |
| 23 |
% for those people who are interested. |
| 24 |
% |
| 25 |
%<*driver> |
| 26 |
\documentclass[full,kernel]{l3doc} |
| 27 |
\begin{document} |
| 28 |
\DocInput{\jobname.dtx} |
| 29 |
\end{document} |
| 30 |
%</driver> |
| 31 |
% \fi |
| 32 |
% |
| 33 |
% \title{^^A |
| 34 |
% The \pkg{l3text-map} module\\ Text processing (mapping)^^A |
| 35 |
% } |
| 36 |
% |
| 37 |
% \author{^^A |
| 38 |
% The \LaTeX{} Project\thanks |
| 39 |
% {^^A |
| 40 |
% E-mail: |
| 41 |
% \href{mailto:[email protected]} |
| 42 |
% {[email protected]}^^A |
| 43 |
% }^^A |
| 44 |
% } |
| 45 |
% |
| 46 |
% \date{Released 2026-05-15} |
| 47 |
% |
| 48 |
% \maketitle |
| 49 |
% |
| 50 |
% \begin{documentation} |
| 51 |
% |
| 52 |
% \end{documentation} |
| 53 |
% |
| 54 |
% \begin{implementation} |
| 55 |
% |
| 56 |
% \section{\pkg{l3text-map} implementation} |
| 57 |
% |
| 58 |
% \begin{macrocode} |
| 59 |
%<*code> |
| 60 |
% \end{macrocode} |
| 61 |
% |
| 62 |
% \begin{macrocode} |
| 63 |
%<@@=text> |
| 64 |
% \end{macrocode} |
| 65 |
% |
| 66 |
% \subsection{Mapping to text} |
| 67 |
% |
| 68 |
% \subsubsection{Common code} |
| 69 |
% |
| 70 |
% \begin{macro}[rEXP]{\@@_map_tokens:nnn, \@@_map_tokens:enn} |
| 71 |
% \begin{macro}[rEXP]{\@@_map_loop:nnnw} |
| 72 |
% \begin{macro}[rEXP]{\@@_map_group:nnnn} |
| 73 |
% \begin{macro}[rEXP]{\@@_map_space:nnnw} |
| 74 |
% \begin{macro}[rEXP]{\@@_map_N_type:nnnN} |
| 75 |
% \begin{macro}[rEXP]{\@@_map_math_search:nnnnN} |
| 76 |
% \begin{macro}[rEXP]{\@@_map_math_search:nnnNNN} |
| 77 |
% \begin{macro}[rEXP]{\@@_map_math_loop:nnnNw} |
| 78 |
% \begin{macro}[rEXP]{\@@_map_math_N_type:nnnNN} |
| 79 |
% \begin{macro}[rEXP]{\@@_map_math_group:nnnNn} |
| 80 |
% \begin{macro}[rEXP]{\@@_map_math_space:nnnNw} |
| 81 |
% \begin{macro}[rEXP]{\@@_map_cs_check:nnnN} |
| 82 |
% \begin{macro}[rEXP]{\@@_map_active_check:nnnn} |
| 83 |
% \begin{macro}[rEXP]{\@@_map_codepoint:nnnn} |
| 84 |
% \begin{macro}[rEXP]{\@@_map_CR:nnnw} |
| 85 |
% \begin{macro}[rEXP]{\@@_map_CR:nnnN} |
| 86 |
% \begin{macro}[rEXP]{\@@_map_class:nnnn} |
| 87 |
% \begin{macro}[rEXP]{\@@_map_class:nnnnn} |
| 88 |
% \begin{macro}[rEXP]{\@@_map_lookahead:nnnnnw} |
| 89 |
% \begin{macro}[rEXP]{\@@_map_lookahead:nnnnnN} |
| 90 |
% \begin{macro}[TF,rEXP]{\@@_map_if_ignorable:n} |
| 91 |
% \begin{macro}[rEXP]{\@@_map_output:nn} |
| 92 |
% \begin{macro}[EXP]{\text_map_break:} |
| 93 |
% \begin{macro}[EXP]{\text_map_break:n} |
| 94 |
% Mapping to text all works the same way: using standard \enquote{action} |
| 95 |
% loop on expanded text. There are different ways to determine the boundary |
| 96 |
% conditions for breaking: to avoid duplication, the common ideas are covered |
| 97 |
% here with the specifics split out. In all cases, anything which is not a |
| 98 |
% character token is treated as a boundary. |
| 99 |
% \begin{macrocode} |
| 100 |
\cs_new:Npn \@@_map_tokens:nnn #1#2#3 |
| 101 |
{ |
| 102 |
\@@_map_loop:nnnw {#3} {#2} { } #1 |
| 103 |
\q_@@_recursion_tail \q_@@_recursion_stop |
| 104 |
\prg_break_point:Nn \text_map_break: { } |
| 105 |
} |
| 106 |
\cs_generate_variant:Nn \@@_map_tokens:nnn { e } |
| 107 |
\cs_new:Npn \@@_map_loop:nnnw #1#2#3#4 \q_@@_recursion_stop |
| 108 |
{ |
| 109 |
\tl_if_head_is_N_type:nTF {#4} |
| 110 |
{ \@@_map_N_type:nnnN } |
| 111 |
{ |
| 112 |
\tl_if_head_is_group:nTF {#4} |
| 113 |
{ \@@_map_group:nnnn } |
| 114 |
{ \@@_map_space:nnnw } |
| 115 |
} |
| 116 |
{#1} {#2} {#3} #4 \q_@@_recursion_stop |
| 117 |
} |
| 118 |
\cs_new:Npn \@@_map_group:nnnn #1#2#3#4 |
| 119 |
{ |
| 120 |
\@@_map_output:nn {#1} {#3} |
| 121 |
\@@_map_output:nn {#1} { {#4} } |
| 122 |
\@@_map_loop:nnnw {#1} {#2} { } |
| 123 |
} |
| 124 |
\use:e |
| 125 |
{ \cs_new:Npn \exp_not:N \@@_map_space:nnnw #1#2#3 \c_space_tl } |
| 126 |
{ |
| 127 |
\@@_map_output:nn {#1} {#3} |
| 128 |
#1 { ~ } |
| 129 |
\@@_map_loop:nnnw {#1} {#2} { } |
| 130 |
} |
| 131 |
\cs_new:Npn \@@_map_N_type:nnnN #1#2#3#4 |
| 132 |
{ |
| 133 |
\@@_if_q_recursion_tail_stop_do:Nn #4 |
| 134 |
{ |
| 135 |
\@@_map_output:nn {#1} {#3} |
| 136 |
\text_map_break: |
| 137 |
} |
| 138 |
\exp_args:NV \@@_map_math_search:nnnnN |
| 139 |
\l_text_math_delims_tl {#1} {#2} {#3} #4 |
| 140 |
} |
| 141 |
% \end{macrocode} |
| 142 |
% We need to exclude math mode here as quite apart from the conceptual |
| 143 |
% questions, it could contain implicit tokens. Those would cause all sorts |
| 144 |
% of issues, so are best just skipped over here. |
| 145 |
% \begin{macrocode} |
| 146 |
\cs_new:Npn \@@_map_math_search:nnnnN #1#2#3#4#5 |
| 147 |
{ |
| 148 |
\@@_map_math_search:nnnNNN {#2} {#3} {#4} #5 #1 |
| 149 |
\q_@@_recursion_tail \q_@@_recursion_tail |
| 150 |
\q_@@_recursion_stop |
| 151 |
} |
| 152 |
\cs_new:Npn \@@_map_math_search:nnnNNN #1#2#3#4#5#6 |
| 153 |
{ |
| 154 |
\@@_if_q_recursion_tail_stop_do:Nn #5 |
| 155 |
{ \@@_map_cs_check:nnnN {#1} {#2} {#3} #4 } |
| 156 |
\token_if_eq_meaning:NNTF #4 #5 |
| 157 |
{ |
| 158 |
\@@_use_i_delimit_by_q_recursion_stop:nw |
| 159 |
{ |
| 160 |
\@@_map_output:nn {#1} {#3} |
| 161 |
\@@_map_math_loop:nnnNw {#1} {#2} {#4} #6 |
| 162 |
} |
| 163 |
} |
| 164 |
{ \@@_map_math_search:nnnNNN {#1} {#2} {#3} #4 } |
| 165 |
} |
| 166 |
\cs_new:Npn \@@_map_math_loop:nnnNw #1#2#3#4#5 \q_@@_recursion_stop |
| 167 |
{ |
| 168 |
\tl_if_head_is_N_type:nTF {#5} |
| 169 |
{ \@@_map_math_N_type:nnnNN } |
| 170 |
{ |
| 171 |
\tl_if_head_is_group:nTF {#5} |
| 172 |
{ \@@_map_math_group:nnnNn } |
| 173 |
{ \@@_map_math_space:nnnNw } |
| 174 |
} |
| 175 |
{#1} {#2} {#3} #4 #5 \q_@@_recursion_stop |
| 176 |
} |
| 177 |
\cs_new:Npn \@@_map_math_N_type:nnnNN #1#2#3#4#5 |
| 178 |
{ |
| 179 |
\@@_if_q_recursion_tail_stop_do:Nn #5 |
| 180 |
{ |
| 181 |
\@@_map_output:nn {#1} {#3} |
| 182 |
\text_map_break: |
| 183 |
} |
| 184 |
\token_if_eq_meaning:NNTF #5 #4 |
| 185 |
{ |
| 186 |
\@@_map_output:nn {#1} { #3 #4 } |
| 187 |
\@@_map_loop:nnnw {#1} {#2} { } |
| 188 |
} |
| 189 |
{ \@@_map_math_loop:nnnNw {#1} {#2} { #3 #5 } #4 } |
| 190 |
} |
| 191 |
\cs_new:Npn \@@_map_math_group:nnnNn #1#2#3#4#5 |
| 192 |
{ \@@_map_math_loop:nnnNw {#1} {#2} { #3 {#5} } #4 } |
| 193 |
\use:e |
| 194 |
{ |
| 195 |
\cs_new:Npn \exp_not:N \@@_map_math_space:nnnNw #1#2#3#4 |
| 196 |
\c_space_tl |
| 197 |
} |
| 198 |
{ \@@_map_math_loop:nnnNw {#1} {#2} { #3 ~ } #4 } |
| 199 |
\cs_new:Npn \@@_map_cs_check:nnnN #1#2#3#4 |
| 200 |
{ |
| 201 |
\token_if_cs:NTF #4 |
| 202 |
{ |
| 203 |
\@@_map_output:nn {#1} {#3} |
| 204 |
#1 {#4} |
| 205 |
\@@_map_loop:nnnw {#1} {#2} { } |
| 206 |
} |
| 207 |
{ |
| 208 |
\@@_codepoint_process:nN |
| 209 |
{ \@@_map_active_check:nnnn {#1} {#2} {#3} } #4 |
| 210 |
} |
| 211 |
} |
| 212 |
\cs_new:Npn \@@_map_active_check:nnnn #1#2#3#4 |
| 213 |
{ |
| 214 |
\bool_lazy_and:nnTF |
| 215 |
{ \tl_if_single_token_p:n {#4} } |
| 216 |
{ \token_if_active_p:N #4 } |
| 217 |
{ |
| 218 |
\@@_map_output:nn {#1} {#3} |
| 219 |
#1 {#4} |
| 220 |
\@@_map_loop:nnnw {#1} {#2} { } |
| 221 |
} |
| 222 |
{ \@@_map_codepoint:nnnn {#1} {#2} {#3} {#4} } |
| 223 |
} |
| 224 |
% \end{macrocode} |
| 225 |
% We pull out a few special cases here. Carriage returns case needs a bit of |
| 226 |
% context handling so has an auxiliary. Codepoint U+200D is the zero-width |
| 227 |
% joiner, which has no context to concern us: just don't break. (These special |
| 228 |
% cases apply to all forms of text mapping.) |
| 229 |
% \begin{macrocode} |
| 230 |
\cs_new:Npn \@@_map_codepoint:nnnn #1#2#3#4 |
| 231 |
{ |
| 232 |
\@@_codepoint_compare:nNnTF {#4} = { "000D } |
| 233 |
{ |
| 234 |
\@@_map_output:nn {#1} {#3} |
| 235 |
\@@_map_CR:nnnw {#1} {#2} {#4} |
| 236 |
} |
| 237 |
{ |
| 238 |
\@@_codepoint_compare:nNnTF {#4} = { "200D } |
| 239 |
{ \@@_map_loop:nnnw {#1} {#2} {#3#4} } |
| 240 |
{ \@@_map_class:nnnn {#1} {#2} {#3} {#4} } |
| 241 |
} |
| 242 |
} |
| 243 |
% \end{macrocode} |
| 244 |
% A carriage return is a boundary unless it is immediately followed by |
| 245 |
% a line feed, in which case that pair is a boundary. |
| 246 |
% \begin{macrocode} |
| 247 |
\cs_new:Npn \@@_map_CR:nnnw #1#2#3#4 \q_@@_recursion_stop |
| 248 |
{ |
| 249 |
\tl_if_head_is_N_type:nTF {#4} |
| 250 |
{ \@@_map_CR:nnnN {#1} {#2} {#3} } |
| 251 |
{ |
| 252 |
#1 {#3} |
| 253 |
\@@_map_loop:nnnw {#1} {#2} { } |
| 254 |
} |
| 255 |
#4 \q_@@_recursion_stop |
| 256 |
} |
| 257 |
\cs_new:Npn \@@_map_CR:nnnN #1#2#3#4 |
| 258 |
{ |
| 259 |
\@@_if_q_recursion_tail_stop_do:Nn #4 |
| 260 |
{ |
| 261 |
#1 {#3} |
| 262 |
\text_map_break: |
| 263 |
} |
| 264 |
\bool_lazy_and:nnTF |
| 265 |
{ ! \token_if_cs_p:N #4 } |
| 266 |
{ \int_compare_p:nNn { `#4 } = { "000A } } |
| 267 |
{ |
| 268 |
\@@_map_output:nn {#1} {#3#4} |
| 269 |
\@@_map_loop:nnnw {#1} {#2} { } |
| 270 |
} |
| 271 |
{ \@@_map_loop:nnnw {#1} {#2} { } #3 } |
| 272 |
} |
| 273 |
% \end{macrocode} |
| 274 |
% There are various classes of character, and we deal with them all in |
| 275 |
% the same general way. We need to example the relevant list of codepoints: |
| 276 |
% if we get a hit, then we do whatever the relevant action is. To keep names |
| 277 |
% short and to allow code sharing, we have two ways of naming the functions: |
| 278 |
% most class names are unique, so it's only where we see the same name used |
| 279 |
% in both break classes that we need more control. |
| 280 |
% \begin{macrocode} |
| 281 |
\cs_new:Npn \@@_map_class:nnnn #1#2#3#4 |
| 282 |
{ |
| 283 |
\exp_args:Nnnne \@@_map_class:nnnnn {#1} {#2} {#3} {#4} |
| 284 |
{ |
| 285 |
\use:c { __kernel_codepoint_to_ #2 _class:n } |
| 286 |
{ \@@_codepoint_from_chars:Nw #4 } |
| 287 |
} |
| 288 |
} |
| 289 |
\cs_new:Npn \@@_map_class:nnnnn #1#2#3#4#5 |
| 290 |
{ |
| 291 |
\cs_if_exist_use:cF { @@_map_ #5 :nnnn } |
| 292 |
{ \@@_map_Other:nnnn } |
| 293 |
{#1} {#2} {#3} {#4} |
| 294 |
} |
| 295 |
% \end{macrocode} |
| 296 |
% A generic loop-ahead setup: we need to handle both the previously collected |
| 297 |
% tokens and any \enquote{conditional} ones. The latter occur when looking |
| 298 |
% ahead for word-breaking: these \emph{may} be combined with the collected |
| 299 |
% tokens, but if we hit the end-of-loop, need to be output separately. |
| 300 |
% \begin{macrocode} |
| 301 |
\cs_new:Npn \@@_map_lookahead:nnnnnw #1#2#3#4#5#6 \q_@@_recursion_stop |
| 302 |
{ |
| 303 |
\tl_if_head_is_N_type:nTF {#6} |
| 304 |
{ \@@_map_lookahead:nnnnnN {#1} {#2} {#3} {#4} {#5} } |
| 305 |
{ \@@_map_loop:nnnw {#1} {#2} {#3} #4 } |
| 306 |
#6 \q_@@_recursion_stop |
| 307 |
} |
| 308 |
\cs_new:Npn \@@_map_lookahead:nnnnnN #1#2#3#4#5#6 |
| 309 |
{ |
| 310 |
\@@_if_q_recursion_tail_stop_do:Nn #6 |
| 311 |
{ |
| 312 |
#1 {#3} |
| 313 |
\tl_if_blank:nF {#4} { #1 {#4} } |
| 314 |
} |
| 315 |
\token_if_cs:NTF #6 |
| 316 |
{ |
| 317 |
#1 {#3} |
| 318 |
\@@_map_loop:nnnw {#1} {#2} { } #4 |
| 319 |
} |
| 320 |
{ \@@_codepoint_process:nN { #5 {#1} {#2} {#3} {#4} } } |
| 321 |
#6 |
| 322 |
} |
| 323 |
% \end{macrocode} |
| 324 |
% To deal with \enquote{ignored} characters for word break mapping: needed |
| 325 |
% for generic |Regional_Indicator| function, so set up here. |
| 326 |
% \begin{macrocode} |
| 327 |
\prg_new_conditional:Npnn \@@_map_if_ignorable:n #1 { TF } |
| 328 |
{ |
| 329 |
\str_case:nnTF {#1} |
| 330 |
{ |
| 331 |
{ Extend } { } |
| 332 |
{ Format } { } |
| 333 |
{ ZWJ } { } |
| 334 |
} |
| 335 |
\prg_return_true: |
| 336 |
\prg_return_false: |
| 337 |
} |
| 338 |
% \end{macrocode} |
| 339 |
% For the end of the process. |
| 340 |
% \begin{macrocode} |
| 341 |
\cs_new:Npn \@@_map_output:nn #1#2 |
| 342 |
{ \tl_if_blank:nF {#2} { #1 {#2} } } |
| 343 |
\cs_new:Npn \text_map_break: |
| 344 |
{ \prg_map_break:Nn \text_map_break: { } } |
| 345 |
\cs_new:Npn \text_map_break:n |
| 346 |
{ \prg_map_break:Nn \text_map_break: } |
| 347 |
% \end{macrocode} |
| 348 |
% \end{macro} |
| 349 |
% \end{macro} |
| 350 |
% \end{macro} |
| 351 |
% \end{macro} |
| 352 |
% \end{macro} |
| 353 |
% \end{macro} |
| 354 |
% \end{macro} |
| 355 |
% \end{macro} |
| 356 |
% \end{macro} |
| 357 |
% \end{macro} |
| 358 |
% \end{macro} |
| 359 |
% \end{macro} |
| 360 |
% \end{macro} |
| 361 |
% \end{macro} |
| 362 |
% \end{macro} |
| 363 |
% \end{macro} |
| 364 |
% \end{macro} |
| 365 |
% \end{macro} |
| 366 |
% \end{macro} |
| 367 |
% \end{macro} |
| 368 |
% \end{macro} |
| 369 |
% \end{macro} |
| 370 |
% \end{macro} |
| 371 |
% \end{macro} |
| 372 |
% |
| 373 |
% \begin{macro}[rEXP] |
| 374 |
% { |
| 375 |
% \@@_map_Control:nnnn , |
| 376 |
% \@@_map_Newline:nnnn , |
| 377 |
% \@@_map_Extend:nnnn , |
| 378 |
% \@@_map_Format:nnnn , |
| 379 |
% \@@_map_SpacingMark:nnnn , |
| 380 |
% \@@_map_Other:nnnn , |
| 381 |
% \@@_map_Regional_Indicator:nnnn |
| 382 |
% } |
| 383 |
% \begin{macro}[EXP]{\@@_map_Regional_Indicator_aux:nnnnn} |
| 384 |
% A small number of classes appear in both forms of breaking and have the |
| 385 |
% same behavior. For |Control| and |Newline|, we set up here as they are the |
| 386 |
% same outcome. We have the same story for |Format|, which is functionally |
| 387 |
% the same as |Newline|. |
| 388 |
% \begin{macrocode} |
| 389 |
\cs_new:Npn \@@_map_Control:nnnn #1#2#3#4 |
| 390 |
{ |
| 391 |
\@@_map_output:nn {#1} {#3} |
| 392 |
\@@_map_output:nn {#1} {#4} |
| 393 |
\@@_map_loop:nnnw {#1} {#2} { } |
| 394 |
} |
| 395 |
\cs_new_eq:NN \@@_map_Newline:nnnn \@@_map_Control:nnnn |
| 396 |
\cs_new:Npn \@@_map_Extend:nnnn #1#2#3#4 |
| 397 |
{ \@@_map_loop:nnnw {#1} {#2} {#3#4} } |
| 398 |
\cs_new_eq:NN \@@_map_Format:nnnn \@@_map_Extend:nnnn |
| 399 |
\cs_new_eq:NN \@@_map_SpacingMark:nnnn \@@_map_Extend:nnnn |
| 400 |
\cs_new:Npn \@@_map_Other:nnnn #1#2#3#4 |
| 401 |
{ |
| 402 |
\@@_map_output:nn {#1} {#3} |
| 403 |
\@@_map_loop:nnnw {#1} {#2} {#4} |
| 404 |
} |
| 405 |
% \end{macrocode} |
| 406 |
% The Regional Indicator rule means looking ahead and dealing with the |
| 407 |
% case where there are two in a row. So we use a look ahead to pick them |
| 408 |
% off. As there is only one range the values are hard-coded. For |
| 409 |
% word breaking, we also need to allow for the various extenders. |
| 410 |
% \begin{macrocode} |
| 411 |
\cs_new:Npn \@@_map_Regional_Indicator:nnnn #1#2#3#4 |
| 412 |
{ |
| 413 |
\@@_map_output:nn {#1} {#3} |
| 414 |
\@@_map_lookahead:nnnnnw {#1} {#2} {#4} { } |
| 415 |
\@@_map_Regional_Indicator_aux:nnnnn |
| 416 |
} |
| 417 |
\cs_new:Npn \@@_map_Regional_Indicator_aux:nnnnn #1#2#3#4#5 |
| 418 |
{ |
| 419 |
\bool_lazy_or:nnTF |
| 420 |
{ \@@_codepoint_compare_p:nNn {#5} < { "1F1E6 } } |
| 421 |
{ \@@_codepoint_compare_p:nNn {#5} > { "1F1FF } } |
| 422 |
{ |
| 423 |
\str_if_eq:nnTF {#2} { wordbreak } |
| 424 |
{ |
| 425 |
\exp_args:Ne \@@_map_if_ignorable:nTF |
| 426 |
{ |
| 427 |
\__kernel_codepoint_to_grapheme_class:n |
| 428 |
{ \@@_codepoint_from_chars:Nw #5 } |
| 429 |
} |
| 430 |
{ |
| 431 |
\@@_map_lookahead:nnnnnw {#1} {#2} {#3#5} { } |
| 432 |
\@@_map_Regional_Indicator_aux:nnnnn |
| 433 |
} |
| 434 |
{ \@@_map_loop:nnnw {#1} {#2} {#3} #5 } |
| 435 |
} |
| 436 |
{ \@@_map_loop:nnnw {#1} {#2} {#3} #5 } |
| 437 |
} |
| 438 |
{ \@@_map_loop:nnnw {#1} {#2} {#3#5} } |
| 439 |
} |
| 440 |
% \end{macrocode} |
| 441 |
% \end{macro} |
| 442 |
% \end{macro} |
| 443 |
% |
| 444 |
% \subsection{Grapheme mapping} |
| 445 |
% |
| 446 |
% \begin{macro}[rEXP]{\text_map_function:nN} |
| 447 |
% \begin{macro}[rEXP]{\text_map_tokens:nn} |
| 448 |
% \begin{macro}[rEXP]{\@@_map_Prepend:nnnn} |
| 449 |
% \begin{macro}[rEXP]{\@@_map_Prepend_aux:nnnnn} |
| 450 |
% \begin{macro}[rEXP]{\@@_map_Prepend:nnn} |
| 451 |
% \begin{macro}[rEXP] |
| 452 |
% { |
| 453 |
% \@@_map_L:nnnn , |
| 454 |
% \@@_map_LV:nnnn , |
| 455 |
% \@@_map_V:nnnn , |
| 456 |
% \@@_map_LVT:nnnn , |
| 457 |
% \@@_map_T:nnnn |
| 458 |
% } |
| 459 |
% \begin{macro}[rEXP]{\@@_map_hangul:nnnw} |
| 460 |
% \begin{macro}[rEXP]{\@@_map_hangul:nnnN} |
| 461 |
% \begin{macro}[rEXP]{\@@_map_hangul:nnnn} |
| 462 |
% \begin{macro}[rEXP]{\@@_map_hangul_aux:nnnnw} |
| 463 |
% \begin{macro}[rEXP]{\@@_map_hangul:nnnnw} |
| 464 |
% \begin{macro}[rEXP]{\@@_map_hangul_next:nnnnn} |
| 465 |
% \begin{macro}[rEXP]{\@@_map_hangul_end:nw} |
| 466 |
% \begin{macro}[rEXP] |
| 467 |
% { |
| 468 |
% \@@_map_hangul_L:nnn , |
| 469 |
% \@@_map_hangul_LV:nnn , |
| 470 |
% \@@_map_hangul_V:nnn , |
| 471 |
% \@@_map_hangul_LVT:nnn , |
| 472 |
% \@@_map_hangul_T:nnn |
| 473 |
% } |
| 474 |
% The standard lead-off for an action loop. |
| 475 |
% \begin{macrocode} |
| 476 |
\cs_new:Npn \text_map_function:nN #1#2 |
| 477 |
{ |
| 478 |
\@@_map_tokens:enn { \text_expand:n {#1} } |
| 479 |
{ grapheme } {#2} |
| 480 |
} |
| 481 |
\cs_new:Npn \text_map_tokens:nn #1#2 |
| 482 |
{ |
| 483 |
\@@_map_tokens:enn { \text_expand:n {#1} } |
| 484 |
{ grapheme } {#2} |
| 485 |
} |
| 486 |
% \end{macrocode} |
| 487 |
% Outputting anything earlier, the combine with what follows. The only |
| 488 |
% exclusions are control characters. |
| 489 |
% \begin{macrocode} |
| 490 |
\cs_new:Npn \@@_map_Prepend:nnnn #1#2#3#4 |
| 491 |
{ |
| 492 |
\@@_map_output:nn {#1} {#3} |
| 493 |
\@@_map_lookahead:nnnnnw {#1} { grapheme } {#4} { } |
| 494 |
\@@_map_Prepend_aux:nnnnn |
| 495 |
} |
| 496 |
\cs_new:Npn \@@_map_Prepend_aux:nnnnn #1#2#3#4#5 |
| 497 |
{ |
| 498 |
\bool_lazy_or:nnTF |
| 499 |
{ \@@_codepoint_compare_p:nNn {#5} = { "000A } } |
| 500 |
{ \@@_codepoint_compare_p:nNn {#5} = { "000D } } |
| 501 |
{ |
| 502 |
#1 {#3} |
| 503 |
\@@_map_loop:nnnw {#1} { grapheme } {#5} |
| 504 |
} |
| 505 |
{ \@@_map_Prepend:nnn {#1} {#3} {#5} } |
| 506 |
} |
| 507 |
\cs_new:Npn \@@_map_Prepend:nnn #1#2#3 |
| 508 |
{ |
| 509 |
\str_if_eq:eeTF |
| 510 |
{ Control } |
| 511 |
{ |
| 512 |
\__kernel_codepoint_to_grapheme_class:n |
| 513 |
{ \@@_codepoint_from_chars:Nw #3 } |
| 514 |
} |
| 515 |
{ \@@_map_loop:nnnw {#1} { grapheme } {#2} #3 } |
| 516 |
{ \@@_map_loop:nnnw {#1} { grapheme } {#2#3} } |
| 517 |
} |
| 518 |
% \end{macrocode} |
| 519 |
% Hangul needs additional treatment. First we have to deal with |
| 520 |
% the start-of-Hangul position: output what we had up to now, then |
| 521 |
% move the specialist handler. The idea here is to pick off the |
| 522 |
% different codepoint types one at a time, tracking what else can be |
| 523 |
% considered at each stage until we hit the end of the viable types. |
| 524 |
% Other than that, we just keep building up the Hangul codepoints |
| 525 |
% using a dedicated version of the loop from above. |
| 526 |
% \begin{macrocode} |
| 527 |
\cs_new:Npn \@@_map_L:nnnn #1#2#3#4 |
| 528 |
{ |
| 529 |
\@@_map_output:nn {#1} {#3} |
| 530 |
\@@_map_hangul:nnnw |
| 531 |
{#1} {#4} { L ; V ; LV ; LVT } |
| 532 |
} |
| 533 |
\cs_new:Npn \@@_map_LV:nnnn #1#2#3#4 |
| 534 |
{ |
| 535 |
\@@_map_output:nn {#1} {#3} |
| 536 |
\@@_map_hangul:nnnw |
| 537 |
{#1} {#4} { V ; T } |
| 538 |
} |
| 539 |
\cs_new_eq:NN \@@_map_V:nnnn \@@_map_LV:nnnn |
| 540 |
\cs_new:Npn \@@_map_LVT:nnnn #1#2#3#4 |
| 541 |
{ |
| 542 |
\@@_map_output:nn {#1} {#3} |
| 543 |
\@@_map_hangul:nnnw |
| 544 |
{#1} {#4} { T } |
| 545 |
} |
| 546 |
\cs_new_eq:NN \@@_map_T:nnnn \@@_map_LVT:nnnn |
| 547 |
\cs_new:Npn \@@_map_hangul:nnnw #1#2#3#4 \q_@@_recursion_stop |
| 548 |
{ |
| 549 |
\tl_if_head_is_N_type:nTF {#4} |
| 550 |
{ \@@_map_hangul:nnnN {#1} {#2} {#3} } |
| 551 |
{ |
| 552 |
#1 {#2} |
| 553 |
\@@_map_loop:nnnw {#1} { grapheme } { } |
| 554 |
} |
| 555 |
#4 \q_@@_recursion_stop |
| 556 |
} |
| 557 |
\cs_new:Npn \@@_map_hangul:nnnN #1#2#3#4 |
| 558 |
{ |
| 559 |
\@@_if_q_recursion_tail_stop_do:Nn #4 |
| 560 |
{ |
| 561 |
#1 {#2} |
| 562 |
\text_map_break: |
| 563 |
} |
| 564 |
\token_if_cs:NTF #4 |
| 565 |
{ |
| 566 |
#1 {#2} |
| 567 |
\@@_map_loop:nnnw {#1} { grapheme } { } |
| 568 |
} |
| 569 |
{ |
| 570 |
\@@_codepoint_process:nN |
| 571 |
{ \@@_map_hangul:nnnn {#1} {#2} {#3} } #4 |
| 572 |
} |
| 573 |
} |
| 574 |
\exp_args_generate:n { Nnne } |
| 575 |
\cs_new:Npn \@@_map_hangul:nnnn #1#2#3#4 |
| 576 |
{ |
| 577 |
\exp_args:NNnne \@@_map_hangul_aux:nnnnw {#1} {#2} {#4} |
| 578 |
{ |
| 579 |
\__kernel_codepoint_to_grapheme_class:n |
| 580 |
{ \@@_codepoint_from_chars:Nw #4 } |
| 581 |
} |
| 582 |
#3 ; \q_recursion_tail ; \q_recursion_stop |
| 583 |
} |
| 584 |
\cs_new:Npn \@@_map_hangul_aux:nnnnw #1#2#3#4#5 ; |
| 585 |
{ |
| 586 |
\quark_if_recursion_tail_stop_do:nn {#5} |
| 587 |
{ \@@_map_loop:nnnw {#1} { grapheme } {#2} #3 } |
| 588 |
\@@_map_hangul:nnnnnw {#1} {#2} {#3} {#4} {#5} |
| 589 |
} |
| 590 |
\cs_generate_variant:Nn \@@_map_hangul_aux:nnnnw { nnne } |
| 591 |
\cs_new:Npn \@@_map_hangul:nnnnnw #1#2#3#4#5#6 \q_recursion_stop |
| 592 |
{ |
| 593 |
\str_if_eq:nnTF {#4} {#5} |
| 594 |
{ \use:c { @@_map_hangul_ #5 :nnn } {#1} {#2} {#3} } |
| 595 |
{ \@@_map_hangul_next:nnnnn {#1} {#2} {#3} {#4} {#6} } |
| 596 |
} |
| 597 |
\cs_new:Npn \@@_map_hangul_next:nnnnn #1#2#3#4#5 |
| 598 |
{ \@@_map_hangul_aux:nnnnw {#1} {#2} {#3} {#4} #5 \q_recursion_stop } |
| 599 |
\cs_new:Npn \@@_map_hangul_end:nw #1#2 \q_@@_recursion_stop {#1} |
| 600 |
\cs_new:Npn \@@_map_hangul_L:nnn #1#2#3 |
| 601 |
{ |
| 602 |
\@@_map_hangul:nnnw |
| 603 |
{#1} {#2#3} { L V { LV } { LVT } } |
| 604 |
} |
| 605 |
\cs_new:Npn \@@_map_hangul_LV:nnn #1#2#3 |
| 606 |
{ |
| 607 |
\@@_map_hangul:nnnw |
| 608 |
{#1} {#2#3} { VT } |
| 609 |
} |
| 610 |
\cs_new_eq:NN \@@_map_hangul_V:nnn \@@_map_hangul_LV:nnn |
| 611 |
\cs_new:Npn \@@_map_hangul_LVT:nnn #1#2#3 |
| 612 |
{ |
| 613 |
\@@_map_hangul:nnnw |
| 614 |
{#1} {#2#3} { T } |
| 615 |
} |
| 616 |
\cs_new_eq:NN \@@_map_hangul_T:nnn \@@_map_hangul_LVT:nnn |
| 617 |
% \end{macrocode} |
| 618 |
% \end{macro} |
| 619 |
% \end{macro} |
| 620 |
% \end{macro} |
| 621 |
% \end{macro} |
| 622 |
% \end{macro} |
| 623 |
% \end{macro} |
| 624 |
% \end{macro} |
| 625 |
% \end{macro} |
| 626 |
% \end{macro} |
| 627 |
% \end{macro} |
| 628 |
% \end{macro} |
| 629 |
% \end{macro} |
| 630 |
% \end{macro} |
| 631 |
% \end{macro} |
| 632 |
% |
| 633 |
% \subsection{Word break mapping} |
| 634 |
% |
| 635 |
% \begin{macro}[rEXP]{\text_map_function:nN} |
| 636 |
% \begin{macro}[rEXP]{\text_map_tokens:nn} |
| 637 |
% \begin{macro}[rEXP]{\@@_map_collect:nnnnn} |
| 638 |
% \begin{macro}[rEXP]{\@@_map_collect_auxi:nnnnnnnn} |
| 639 |
% \begin{macro}[rEXP]{\@@_map_collect_auxii:nnnnnnn} |
| 640 |
% \begin{macro}[rEXP]{\@@_map_collect_auxiii:n} |
| 641 |
% \begin{macro}[rEXP]{\@@_map_collect_auxiv:nnnnnnn} |
| 642 |
% \begin{macro}[rEXP]{\@@_map_collect_auxv:nnnnnnn} |
| 643 |
% \begin{macro}[rEXP] |
| 644 |
% { |
| 645 |
% \@@_map_ALetter:nnnn , |
| 646 |
% \@@_map_Hebrew_Letter:nnnn , |
| 647 |
% \@@_map_Katakana:nnnn , |
| 648 |
% \@@_map_Numeric:nnnn , |
| 649 |
% \@@_map_WSegSpace:nnnn , |
| 650 |
% \@@_map_ExtendNumLet:nnnn |
| 651 |
% } |
| 652 |
% \begin{macro}[rEXP]{\@@_map_ExtendNumLet_auxi::nnnnn} |
| 653 |
% \begin{macro}[rEXP]{\@@_map_ExtendNumLet_auxii:nnnn} |
| 654 |
% The standard lead-off for an action loop. |
| 655 |
% \begin{macrocode} |
| 656 |
\cs_new:Npn \text_words_map_function:nN #1#2 |
| 657 |
{ |
| 658 |
\@@_map_tokens:enn { \text_expand:n {#1} } |
| 659 |
{ wordbreak } {#2} |
| 660 |
} |
| 661 |
\cs_new:Npn \text_words_map_tokens:nn #1#2 |
| 662 |
{ |
| 663 |
\@@_map_tokens:enn { \text_expand:n {#1} } |
| 664 |
{ wordbreak } {#2} |
| 665 |
} |
| 666 |
% \end{macrocode} |
| 667 |
% The main rule for word breaking is that characters bind to following |
| 668 |
% ones, potentially either allowing for \emph{or} totally ignoring |
| 669 |
% intervening ones. For each class, we are passed a list of classes that |
| 670 |
% bind and ones that we should allow in between. In all cases, the classes |
| 671 |
% |Extend|, |Format| and |ZWJ| need to be entirely ignored: they are hard |
| 672 |
% coded and handled separately from the in-between ones. Notice that we use |
| 673 |
% \cs{str_case:nnTF} to make our boolean here: that way, all that needs to be |
| 674 |
% passed internally are lists of classes. |
| 675 |
% \begin{macrocode} |
| 676 |
\cs_new:Npn \@@_map_collect:nnnnn #1#2#3#4#5 |
| 677 |
{ |
| 678 |
\@@_map_lookahead:nnnnnw {#1} { wordbreak } {#2} { } |
| 679 |
{ \@@_map_collect_auxi:nnnnnnnn {#3} {#4} {#5} } |
| 680 |
} |
| 681 |
\cs_new:Npn \@@_map_collect_auxi:nnnnnnnn #1#2#3#4#5#6#7#8 |
| 682 |
{ |
| 683 |
\exp_args:Ne \@@_map_collect_auxii:nnnnnnn |
| 684 |
{ |
| 685 |
\__kernel_codepoint_to_wordbreak_class:n |
| 686 |
{ \@@_codepoint_from_chars:Nw #8 } |
| 687 |
} |
| 688 |
{#4} {#6} {#1} {#2} {#3} {#8} |
| 689 |
} |
| 690 |
% \end{macrocode} |
| 691 |
% We now need to deal with the three possible positive outcomes of examining |
| 692 |
% the next character. The first is that we have found one of the binding |
| 693 |
% characters that ends the current cycle: we then pass on to the appropriate |
| 694 |
% function. Second, we have the ignored characters: if we find these, we |
| 695 |
% loop back around. Finally, we look at the \enquote{in-between} characters: |
| 696 |
% if one is found, we need a further look ahead to reach a decision. Rather |
| 697 |
% than have extra complexity in the setup, we have a hard-coded skipping of |
| 698 |
% |ExtendNumLet| for |WSegSpace| (as |ExtendNumLet| only applies to |
| 699 |
% |ALetter|, |Hebrew_Letter|, |Numeric| and |Katakana|). |
| 700 |
% \begin{macrocode} |
| 701 |
\cs_new:Npn \@@_map_collect_auxii:nnnnnnn #1#2#3#4#5#6#7 |
| 702 |
{ |
| 703 |
\str_case:neTF {#1} |
| 704 |
{ |
| 705 |
\tl_map_function:eN |
| 706 |
{ |
| 707 |
#4 |
| 708 |
\str_if_eq:nnF {#4} { { WSegSpace } } { { ExtendNumLet } } |
| 709 |
} |
| 710 |
\@@_map_collect_auxiii:n |
| 711 |
} |
| 712 |
{ |
| 713 |
\cs_if_exist_use:cF { @@_map_ #1 :nnnn } |
| 714 |
{ \@@_map_Other:nnnn } |
| 715 |
{#2} { wordbreak } { } {#3#7} |
| 716 |
} |
| 717 |
{ |
| 718 |
\@@_map_if_ignorable:nTF {#1} |
| 719 |
{ \@@_map_collect:nnnnn {#2} {#3#7} {#4} {#5} {#6} } |
| 720 |
{ |
| 721 |
\str_case:neTF {#1} |
| 722 |
{ \tl_map_function:nN {#5} \@@_map_collect_auxiii:n } |
| 723 |
{ |
| 724 |
\@@_map_lookahead:nnnnnw {#2} { wordbreak } {#3} {#7} |
| 725 |
{ \@@_map_collect_auxiv:nnnnnnn {#5} {#6} } |
| 726 |
} |
| 727 |
{ |
| 728 |
\@@_map_output:nn {#2} {#3} |
| 729 |
\@@_map_loop:nnnw {#2} { wordbreak } { } #7 |
| 730 |
} |
| 731 |
} |
| 732 |
} |
| 733 |
} |
| 734 |
\cs_new:Npn \@@_map_collect_auxiii:n #1 |
| 735 |
{ \exp_not:n { {#1} { } } } |
| 736 |
% \end{macrocode} |
| 737 |
% We are now have a character which \emph{may} bind to the previous one if |
| 738 |
% the next character is of the correct class also. So we carry forward the |
| 739 |
% collected material and the conditional character, then look ahead again. |
| 740 |
% If successful, combine together and move on using the new class, otherwise |
| 741 |
% output and restart where we were. |
| 742 |
% \begin{macrocode} |
| 743 |
\cs_new:Npn \@@_map_collect_auxiv:nnnnnnn #1#2#3#4#5#6#7 |
| 744 |
{ |
| 745 |
\exp_args:Ne \@@_map_collect_auxv:nnnnnnn |
| 746 |
{ |
| 747 |
\__kernel_codepoint_to_wordbreak_class:n |
| 748 |
{ \@@_codepoint_from_chars:Nw #7 } |
| 749 |
} |
| 750 |
{#3} {#5} {#6} {#1} {#2} {#7} |
| 751 |
} |
| 752 |
\cs_new:Npn \@@_map_collect_auxv:nnnnnnn #1#2#3#4#5#6#7 |
| 753 |
{ |
| 754 |
\str_case:neTF {#1} |
| 755 |
{ \tl_map_function:nN {#6} \@@_map_collect_auxiii:n } |
| 756 |
{ \use:c { @@_map_ #1 :nnnn } {#2} { wordbreak } { } {#3#4#7} } |
| 757 |
{ |
| 758 |
\@@_map_if_ignorable:nTF {#1} |
| 759 |
{ |
| 760 |
\@@_map_lookahead:nnnnnw {#2} { wordbreak } {#3} {#4#7} |
| 761 |
{ \@@_map_collect_auxiv:nnnnnnn {#5} {#6} } |
| 762 |
} |
| 763 |
{ |
| 764 |
\@@_map_output:nn {#2} {#3} |
| 765 |
\@@_map_loop:nnnw {#2} { wordbreak } { } #4#7 |
| 766 |
} |
| 767 |
} |
| 768 |
} |
| 769 |
% \end{macrocode} |
| 770 |
% Use the generic collector. |
| 771 |
% \begin{macrocode} |
| 772 |
\cs_new:Npn \@@_map_ALetter:nnnn #1#2#3#4 |
| 773 |
{ |
| 774 |
\@@_map_output:nn {#1} {#3} |
| 775 |
\@@_map_collect:nnnnn {#1} {#4} |
| 776 |
{ { ALetter } { Hebrew_Letter } { Numeric } } |
| 777 |
{ { MidLetter } { MidNumLet } { Single_Quote } } |
| 778 |
{ { ALetter } { Hebrew_Letter } } |
| 779 |
} |
| 780 |
\cs_new:Npn \@@_map_Hebrew_Letter:nnnn #1#2#3#4 |
| 781 |
{ |
| 782 |
\@@_map_output:nn {#1} {#3} |
| 783 |
\@@_map_collect:nnnnn {#1} {#4} |
| 784 |
{ { ALetter } { Hebrew_Letter } { Numeric } { Single_Quote } } |
| 785 |
{ { MidLetter } { MidNumLet } { Double_Quote } } |
| 786 |
{ { Hebrew_Letter } } |
| 787 |
} |
| 788 |
\cs_new:Npn \@@_map_Katakana:nnnn #1#2#3#4 |
| 789 |
{ |
| 790 |
\@@_map_output:nn {#1} {#3} |
| 791 |
\@@_map_collect:nnnnn {#1} {#4} { { Katakana } } { } { } |
| 792 |
} |
| 793 |
\cs_new:Npn \@@_map_Numeric:nnnn #1#2#3#4 |
| 794 |
{ |
| 795 |
\@@_map_output:nn {#1} {#3} |
| 796 |
\@@_map_collect:nnnnn {#1} {#4} |
| 797 |
{ { ALetter } { Hebrew_Letter } { Numeric } } |
| 798 |
{ { MidNum } { MidNumLet } { Single_Quote } } |
| 799 |
{ { Numeric } } |
| 800 |
} |
| 801 |
\cs_new:Npn \@@_map_WSegSpace:nnnn #1#2#3#4 |
| 802 |
{ |
| 803 |
\@@_map_output:nn {#1} {#3} |
| 804 |
\@@_map_collect:nnnnn {#1} {#4} { { WSegSpace } } { } { } |
| 805 |
} |
| 806 |
% \end{macrocode} |
| 807 |
% We should only get here in the case we have a \enquote{dangling} extender. |
| 808 |
% If so, look ahead for characters to bind to, then for the set of three |
| 809 |
% that we need to skip over. |
| 810 |
% \begin{macrocode} |
| 811 |
\cs_new:Npn \@@_map_ExtendNumLet:nnnn #1#2#3#4 |
| 812 |
{ |
| 813 |
\@@_map_output:nn {#1} {#3} |
| 814 |
\@@_map_lookahead:nnnnnw {#1} { wordbreak } {#4} { } |
| 815 |
\@@_map_ExtendNumLet_auxi:nnnnn |
| 816 |
} |
| 817 |
\cs_new:Npn \@@_map_ExtendNumLet_auxi:nnnnn #1#2#3#4#5 |
| 818 |
{ |
| 819 |
\exp_args:Ne \@@_map_ExtendNumLet_auxii:nnnn |
| 820 |
{ |
| 821 |
\__kernel_codepoint_to_wordbreak_class:n |
| 822 |
{ \@@_codepoint_from_chars:Nw #5 } |
| 823 |
} |
| 824 |
{#1} {#3} {#5} |
| 825 |
} |
| 826 |
\cs_new:Npn \@@_map_ExtendNumLet_auxii:nnnn #1#2#3#4 |
| 827 |
{ |
| 828 |
\str_case:nnTF {#1} |
| 829 |
{ |
| 830 |
{ ALetter } { } |
| 831 |
{ Hebrew_Letter } { } |
| 832 |
{ Numeric } { } |
| 833 |
{ Katakana } { } |
| 834 |
{ ExtendNumLet } { } |
| 835 |
} |
| 836 |
{ |
| 837 |
\cs_if_exist_use:cF { @@_map_ #1 :nnnn } |
| 838 |
{ \@@_map_Other:nnnn } |
| 839 |
{#2} { wordbreak } { } {#3#4} |
| 840 |
} |
| 841 |
{ |
| 842 |
\@@_map_if_ignorable:nTF {#1} |
| 843 |
{ |
| 844 |
\@@_map_lookahead:nnnnnw {#2} { wordbreak } {#3#4} { } |
| 845 |
\@@_map_ExtendNumLet_auxi:nnnnn |
| 846 |
} |
| 847 |
{ |
| 848 |
\@@_map_output:nn {#2} {#3} |
| 849 |
\@@_map_loop:nnnw {#2} { wordbreak } { } #4 |
| 850 |
} |
| 851 |
} |
| 852 |
} |
| 853 |
% \end{macrocode} |
| 854 |
% \end{macro} |
| 855 |
% \end{macro} |
| 856 |
% \end{macro} |
| 857 |
% \end{macro} |
| 858 |
% \end{macro} |
| 859 |
% \end{macro} |
| 860 |
% \end{macro} |
| 861 |
% \end{macro} |
| 862 |
% \end{macro} |
| 863 |
% \end{macro} |
| 864 |
% \end{macro} |
| 865 |
% |
| 866 |
% \subsection{Inline mappings} |
| 867 |
% |
| 868 |
% \begin{macro}{\text_map_inline:nn, \text_words_map_inline:nn} |
| 869 |
% The standard non-expandable inline version. |
| 870 |
% \begin{macrocode} |
| 871 |
\cs_new_protected:Npn \text_map_inline:nn #1#2 |
| 872 |
{ |
| 873 |
\int_gincr:N \g__kernel_prg_map_int |
| 874 |
\cs_gset_protected:cpn |
| 875 |
{ @@_map_ \int_use:N \g__kernel_prg_map_int :w } ##1 {#2} |
| 876 |
\exp_args:Nnc \text_map_function:nN {#1} |
| 877 |
{ @@_map_ \int_use:N \g__kernel_prg_map_int :w } |
| 878 |
\prg_break_point:Nn \text_map_break: |
| 879 |
{ \int_gdecr:N \g__kernel_prg_map_int } |
| 880 |
} |
| 881 |
\cs_new_protected:Npn \text_words_map_inline:nn #1#2 |
| 882 |
{ |
| 883 |
\int_gincr:N \g__kernel_prg_map_int |
| 884 |
\cs_gset_protected:cpn |
| 885 |
{ @@_map_ \int_use:N \g__kernel_prg_map_int :w } ##1 {#2} |
| 886 |
\exp_args:Nnc \text_words_map_function:nN {#1} |
| 887 |
{ @@_map_ \int_use:N \g__kernel_prg_map_int :w } |
| 888 |
\prg_break_point:Nn \text_map_break: |
| 889 |
{ \int_gdecr:N \g__kernel_prg_map_int } |
| 890 |
} |
| 891 |
% \end{macrocode} |
| 892 |
% \end{macro} |
| 893 |
% |
| 894 |
% \begin{macrocode} |
| 895 |
%</code> |
| 896 |
% \end{macrocode} |
| 897 |
% |
| 898 |
% \end{implementation} |
| 899 |
% |
| 900 |
% \PrintIndex |