diff options
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3tl-analysis.dtx')
-rw-r--r-- | macros/latex/contrib/l3kernel/l3tl-analysis.dtx | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/macros/latex/contrib/l3kernel/l3tl-analysis.dtx b/macros/latex/contrib/l3kernel/l3tl-analysis.dtx index 9cadf04e87..6336b0d076 100644 --- a/macros/latex/contrib/l3kernel/l3tl-analysis.dtx +++ b/macros/latex/contrib/l3kernel/l3tl-analysis.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-10-10} +% \date{Released 2023-10-23} % % \maketitle % @@ -177,9 +177,6 @@ % by avoiding \cs{exp_not:n} for characters other than active and macro % parameters.) % -% ^^A todo: ask LuaTeX list for an \ifx\undefined <active char> -% ^^A which does not add the <active char> in memory. -% % \begin{macrocode} %<*package> % \end{macrocode} @@ -443,6 +440,42 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_analysis_disable_char:N} +% Similar to \cs{@@_analysis_disable:n}, but it receives a normal +% character token, tests if that token is active (by turning it into +% a space: the active space has been undefined at this point), and +% if so, disables it. Even if the character is active and set equal +% to a primitive conditional, nothing blows up. +% Again, in \pTeX{} and \upTeX{} we skip characters beyond $[0,255]$, +% which cannot be active anyways. +% \begin{macrocode} +\group_begin: + \char_set_catcode_active:N \^^@ + \cs_new_protected:Npn \@@_analysis_disable_char:N #1 + { + \tex_lccode:D `#1 = 32 \exp_stop_f: + \tex_lowercase:D { \if_meaning:w #1 } \tex_undefined:D + \tex_let:D #1 \tex_undefined:D + \fi: + } + \bool_lazy_or:nnT + { \sys_if_engine_ptex_p: } + { \sys_if_engine_uptex_p: } + { + \cs_gset_protected:Npn \@@_analysis_disable_char:N #1 + { + \if_int_compare:w 256 > `#1 \exp_stop_f: + \tex_lccode:D `#1 = 32 \exp_stop_f: + \tex_lowercase:D { \if_meaning:w #1 } \tex_undefined:D + \tex_let:D #1 \tex_undefined:D + \fi: + \fi: + } + } +\group_end: +% \end{macrocode} +% \end{macro} +% % \subsection{First pass} % % The goal of this pass is to detect special (non-\texttt{N}-type) tokens, @@ -737,7 +770,7 @@ \exp_after:wN \use_ii:nn \fi: { - \@@_analysis_disable:n { `#1 } + \@@_analysis_disable_char:N #1 \int_incr:N \l_@@_analysis_normal_int } { \@@_analysis_cs_space_count:NN \@@_analysis_a_cs:ww #1 } |