From e3f894dc0a4c1e91c73ea157cd0f9e2627203941 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 5 Jan 2024 21:43:07 +0000 Subject: unravel (5jan24) git-svn-id: svn://tug.org/texlive/trunk@69308 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/unravel/README.md | 3 - Master/texmf-dist/doc/latex/unravel/unravel.pdf | Bin 880287 -> 908970 bytes Master/texmf-dist/source/latex/unravel/unravel.dtx | 749 ++++++++++++--------- Master/texmf-dist/tex/latex/unravel/unravel.sty | 624 +++++++++-------- 4 files changed, 785 insertions(+), 591 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/unravel/README.md b/Master/texmf-dist/doc/latex/unravel/README.md index 97a261e8ae0..d9e74f09ed3 100644 --- a/Master/texmf-dist/doc/latex/unravel/README.md +++ b/Master/texmf-dist/doc/latex/unravel/README.md @@ -26,9 +26,6 @@ step by step. Some parts of TeX are not covered. In particular, category codes are fixed for the whole argument of `\unravel` when it is read. -This package requires up-to-date versions of the `l3kernel`, -`l3packages` and `l3experimental` bundles. - The package is extracted by running `pdflatex unravel.ins`. For the documentation, run `pdflatex unravel.dtx` twice. diff --git a/Master/texmf-dist/doc/latex/unravel/unravel.pdf b/Master/texmf-dist/doc/latex/unravel/unravel.pdf index e21bda64efb..8dadcfd811e 100644 Binary files a/Master/texmf-dist/doc/latex/unravel/unravel.pdf and b/Master/texmf-dist/doc/latex/unravel/unravel.pdf differ diff --git a/Master/texmf-dist/source/latex/unravel/unravel.dtx b/Master/texmf-dist/source/latex/unravel/unravel.dtx index d69e7a2552e..b603c256c81 100644 --- a/Master/texmf-dist/source/latex/unravel/unravel.dtx +++ b/Master/texmf-dist/source/latex/unravel/unravel.dtx @@ -1,5 +1,5 @@ % \iffalse -%% File: unravel.dtx Copyright (C) 2013, 2015, 2018-2019, 2021 Bruno Le Floch +%% File: unravel.dtx Copyright (C) 2013, 2015, 2018-2019, 2021, 2024 Bruno Le Floch %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -23,9 +23,9 @@ % % \title{The \textsf{unravel} package: \\ % watching TeX digest tokens\thanks{This -% file has version number 0.3a, last revised 2021/05/11.}} +% file has version number 0.3c, last revised 2024/01/05.}} % \author{Bruno Le Floch} -% \date{2021/05/11} +% \date{2024/01/05} % % \maketitle % \tableofcontents @@ -208,9 +208,18 @@ % \end{function} % % \begin{function}{online} -% Integer option determining where to write the output: terminal and -% log if the option is positive, log only if the option is zero, -% neither if the option is negative. +% Integer option (default~$1$) determining where to write the output: +% terminal and log if the option is positive, log only if the option +% is zero, neither if the option is negative. +% \end{function} +% +% \begin{function}{output-file} +% Name of a file where the output is written instead of the log file. +% Setting this option also sets \texttt{online} to zero. If +% \texttt{online} is further modified to be positive then the output +% is written to the terminal as well (hence inevitably to the log +% file), while if it is made negative then the output is written +% nowhere. % \end{function} % % \begin{function}{prompt-input} @@ -530,14 +539,9 @@ \expandafter \endgroup \@@_setup_latexe: % \end{macrocode} % -% Load a few dependencies: \pkg{expl3}, \pkg{xparse}, \pkg{gtl}. -% Load \pkg{l3str} if \pkg{expl3} is too old and does not define -% \cs{str_range:nnn}. Otherwise loading \pkg{l3str} would give -% an error. +% Load the \pkg{gtl} dependency. % \begin{macrocode} -\RequirePackage{expl3,xparse}[2021/01/01] -\RequirePackage{gtl}[2018/12/28] -\csname cs_if_exist:cF\endcsname{str_range:nnn}{\RequirePackage{l3str}} +\RequirePackage{gtl}[2024/01/04] % \end{macrocode} % % Before loading \pkg{unravel}, restore catcodes, so that the implicit @@ -554,7 +558,7 @@ {% \csname @@_setup_restore:\endcsname \ProvidesExplPackage - {unravel} {2021/05/11} {0.3a} {Watching TeX digest tokens}% + {unravel} {2024/01/05} {0.3c} {Watching TeX digest tokens}% \csname @@_setup_unravel:\endcsname }% % \end{macrocode} @@ -661,26 +665,6 @@ % \end{macrocode} % \end{macro} % -% \begin{variable}{\l_@@_exp_tl} -% \begin{macro}{\@@_exp_args:Nx, \@@_exp_args:NNx} -% Low-level because \cs{exp_args:Nx} redefines an internal -% \pkg{l3expan} variable which may be appearing in code that we debug. -% \begin{macrocode} -\tl_new:N \l_@@_exp_tl -\cs_new_protected:Npn \@@_exp_args:Nx #1#2 - { - \cs_set_nopar:Npx \l_@@_exp_tl { \exp_not:N #1 {#2} } - \l_@@_exp_tl - } -\cs_new_protected:Npn \@@_exp_args:NNx #1#2#3 - { - \cs_set_nopar:Npx \l_@@_exp_tl { \exp_not:N #1 \exp_not:N #2 {#3} } - \l_@@_exp_tl - } -% \end{macrocode} -% \end{macro} -% \end{variable} -% % \subsubsection{Miscellanous helpers} % % \begin{macro}{\@@_tmp:w} @@ -706,7 +690,7 @@ \cs_new_protected:Npn \@@_file_get_aux:wN ##1 #1 ##2 { \group_end: - \tl_set:Nx ##2 + \tl_set:Ne ##2 { \exp_not:o {##1} \exp_not:V \@@_everyeof:w } } } @@ -771,7 +755,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_prompt_input:Nn #1#2 { - \clist_gset:Nx #1 + \clist_gset:Ne #1 { \@@_prompt_input:w \prg_do_nothing: #2 , \q_@@_recursion_tail , } } \cs_new:Npn \@@_prompt_input:w #1 , @@ -941,7 +925,7 @@ { \group_begin: \char_set_active_eq:nN {#1} \scan_stop: - \use:x + \use:e { \group_end: \exp_not:n {#2} { \char_generate:nn {#1} { 13 } } @@ -1023,7 +1007,7 @@ { TF } { \group_begin: - \@@_exp_args:Nx \char_set_lccode:nn + \exp_args:Ne \char_set_lccode:nn { ` \exp_args:No \str_head:n { \token_to_str:N #1 } } { ` Z } \tex_lowercase:D { \tl_if_eq:nnTF {#1} } { Z } @@ -1055,7 +1039,7 @@ { \group_begin: \@@_set_escapechar:n { 92 } - \tl_set:Nx \l_@@_tmpa_tl + \tl_set:Ne \l_@@_tmpa_tl { \exp_args:No \str_tail:n { \token_to_str:N #1 } } \tl_if_empty:NTF \l_@@_tmpa_tl { @@ -1141,7 +1125,7 @@ \cs_new_protected:Npn \@@_prev_input_gpush_gtl:N { \@@_prev_input_gpush_aux:NN G } \cs_new_protected:Npn \@@_prev_input_gpush_aux:NN #1#2 - { \seq_gput_right:Nx \g_@@_prev_input_seq { #1 { \exp_not:o {#2} } } } + { \seq_gput_right:Ne \g_@@_prev_input_seq { #1 { \exp_not:o {#2} } } } % \end{macrocode} % \end{macro} % @@ -1172,7 +1156,7 @@ { \token_if_eq_meaning:NNTF #1#3 { \tl_set:Nn } - { \msg_error:nnnnnn { unravel } { prev-input } {#1} {#3} } + { \@@_error:nnnnn { prev-input } {#1} {#3} } #2 } % \end{macrocode} @@ -1183,13 +1167,13 @@ % { % \@@_prev_input_silent:n, % \@@_prev_input_silent:V, -% \@@_prev_input_silent:x +% \@@_prev_input_silent:e % } % \begin{macro} % { % \@@_prev_input:n, % \@@_prev_input:V, -% \@@_prev_input:x +% \@@_prev_input:e % } % \begin{macrocode} \cs_new_protected:Npn \@@_prev_input_silent:n #1 @@ -1198,17 +1182,13 @@ \tl_put_right:Nn \l_@@_prev_input_tl {#1} \@@_prev_input_gpush:N \l_@@_prev_input_tl } -\cs_generate_variant:Nn \@@_prev_input_silent:n { V } -\cs_new_protected:Npn \@@_prev_input_silent:x - { \@@_exp_args:Nx \@@_prev_input_silent:n } +\cs_generate_variant:Nn \@@_prev_input_silent:n { V , e } \cs_new_protected:Npn \@@_prev_input:n #1 { \@@_prev_input_silent:n {#1} - \@@_print_action:x { \tl_to_str:n {#1} } + \@@_print_action:e { \tl_to_str:n {#1} } } -\cs_generate_variant:Nn \@@_prev_input:n { V } -\cs_new_protected:Npn \@@_prev_input:x - { \@@_exp_args:Nx \@@_prev_input:n } +\cs_generate_variant:Nn \@@_prev_input:n { V , e } % \end{macrocode} % \end{macro} % \end{macro} @@ -1248,7 +1228,7 @@ { \@@_prev_input_gpop:N \l_@@_head_tl \@@_prev_input_gpop:N \l_@@_tmpa_tl - \tl_set:Nx #4 { #1 { \l_@@_tmpa_tl #2 \l_@@_head_tl #3 } } + \tl_set:Ne #4 { #1 { \l_@@_tmpa_tl #2 \l_@@_head_tl #3 } } } % \end{macrocode} % \end{macro} @@ -1258,6 +1238,19 @@ % % \subsubsection{User interaction} % +% \begin{variable}{\g_@@_iow, \g_@@_current_output_file_tl} +% The stream is used to implement the \texttt{output-file} option. At +% any given time it points to the file named +% \cs{g_@@_current_output_file_tl}, unless that is empty, in which +% case the stream is closed. The idea is that we do not want to close +% the file in between different \cs{unravel} calls since file writing +% is not additive in \TeX{}. +% \begin{macrocode} +\iow_new:N \g_@@_iow +\tl_new:N \g_@@_current_output_file_tl +% \end{macrocode} +% \end{variable} +% % \begin{variable}{\g_@@_before_print_state_tl, \g_@@_before_prompt_tl} % Code to run before printing the state or before the prompt. % \begin{macrocode} @@ -1279,12 +1272,21 @@ % \end{macrocode} % \end{variable} % +% \begin{variable}{\g_@@_current_online_int} +% Temporary value replacing \cs{g_@@_online_int} and that can be set +% through the prompt. +% \begin{macrocode} +\int_new:N \g_@@_current_online_int +% \end{macrocode} +% \end{variable} +% % \begin{variable} % { % \g_@@_default_explicit_prompt_bool , \g_@@_explicit_prompt_bool , % \g_@@_default_internal_debug_bool , \g_@@_internal_debug_bool , % \g_@@_default_number_steps_bool , \g_@@_number_steps_bool , % \g_@@_default_online_int , \g_@@_online_int , +% \g_@@_default_output_file_tl , \g_@@_output_file_tl , % \g_@@_default_prompt_input_clist , \g_@@_prompt_input_clist , % \g_@@_default_trace_assigns_bool , \g_@@_trace_assigns_bool , % \g_@@_default_trace_expansion_bool , \g_@@_trace_expansion_bool , @@ -1301,6 +1303,7 @@ \bool_new:N \g_@@_default_internal_debug_bool \bool_new:N \g_@@_default_number_steps_bool \int_new:N \g_@@_default_online_int +\tl_new:N \g_@@_default_output_file_tl \clist_new:N \g_@@_default_prompt_input_clist \bool_new:N \g_@@_default_trace_assigns_bool \bool_new:N \g_@@_default_trace_expansion_bool @@ -1316,6 +1319,7 @@ \bool_new:N \g_@@_internal_debug_bool \bool_new:N \g_@@_number_steps_bool \int_new:N \g_@@_online_int +\tl_new:N \g_@@_output_file_tl \clist_new:N \g_@@_prompt_input_clist \bool_new:N \g_@@_trace_assigns_bool \bool_new:N \g_@@_trace_expansion_bool @@ -1333,7 +1337,7 @@ % % \begin{variable}{\g_@@_action_text_str} % Text describing the action, displayed at each step. This should -% only be altered through \cs{@@_set_action_text:x}, which sets the +% only be altered through \cs{@@_set_action_text:e}, which sets the % escape character as appropriate before converting the argument to a % string. % \begin{macrocode} @@ -1478,12 +1482,13 @@ % \begin{variable}{\l_@@_defined_tl, \l_@@_defining_tl} % The token that is defined by the prefixed command (such as % \tn{chardef} or \tn{futurelet}), and the code to define it. We do -% not use the the previous-input sequence to store that code: rather, +% not use the the previous-input sequence to store that code because % this sequence contains a string representation of the code, which is -% not suitable for the definition. This is safe, as definitions -% cannot be nested. This is needed for expanding assignments, as -% expansion should be shown to the user, but then later should not be -% performed again when defining. +% not suitable for the definition. Using a single variable here is +% safe, as definitions cannot be nested. This is needed for expanding +% assignments, as expansion should be shown to the user, but then +% later should not be performed again when defining. It is also +% helpful in tracking some register assignments. % \begin{macrocode} \tl_new:N \l_@@_defined_tl \tl_new:N \l_@@_defining_tl @@ -1531,8 +1536,8 @@ % Used to determine if a macro has simple parameters or not. % \begin{macrocode} \group_begin: - \cs_set:Npx \@@_tmp:w #1 { \c_hash_str #1 } - \tl_const:Nx \c_@@_parameters_tl + \cs_set_nopar:Npe \@@_tmp:w #1 { \c_hash_str #1 } + \tl_const:Ne \c_@@_parameters_tl { ^ \tl_map_function:nN { 123456789 } \@@_tmp:w } \group_end: % \end{macrocode} @@ -1612,7 +1617,7 @@ \tl_const:Nn \c_@@_over_tl { / } \tl_const:Nn \c_@@_lq_tl { ` } \tl_const:Nn \c_@@_rq_tl { ' } -\tl_const:Nn \c_@@_dq_tl { " } +\tl_const:Nn \c_@@_dq_tl { " } %" \tl_const:Nn \c_@@_lp_tl { ( } \tl_const:Nn \c_@@_rp_tl { ) } \tl_const:Nn \c_@@_eq_tl { = } @@ -1624,7 +1629,7 @@ % \begin{variable}{\c_@@_frozen_relax_gtl} % \TeX{}'s |frozen_relax|, inserted by \cs{@@_insert_relax:}. % \begin{macrocode} -\gtl_const:Nx \c_@@_frozen_relax_gtl { \if_int_compare:w 0 = 0 \fi: } +\gtl_const:Ne \c_@@_frozen_relax_gtl { \if_int_compare:w 0 = 0 \fi: } % \end{macrocode} % \end{variable} % @@ -1686,7 +1691,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_tex_primitive:nnn #1#2#3 { - \tl_const:cx { c_@@_tex_#1_tl } + \tl_const:ce { c_@@_tex_#1_tl } { { \@@_tex_use:n {#2} } {#3} } } \cs_new_protected:Npn \@@_tex_primitive_pdf:nnn #1#2#3 @@ -2426,7 +2431,7 @@ \@@_tex_primitive:nnn { expanded } { convert } { 34 } \sys_if_engine_luatex:T { \@@_tex_primitive:nnn { luaescapestring } { convert } { 35 } } -\sys_if_engine_xetex:T +\bool_if:nT { \sys_if_engine_xetex_p: || \sys_if_engine_ptex_p: || \sys_if_engine_uptex_p: } { \@@_tex_primitive:nnn { Ucharcat } { convert } { 40 } } @@ -2483,7 +2488,7 @@ \gtl_head_do:NN \l_@@_head_gtl \@@_get_next_aux:w \gtl_if_tl:NTF \l_@@_head_gtl { - \tl_set:Nx \l_@@_head_tl + \tl_set:Ne \l_@@_head_tl { \gtl_head:N \l_@@_head_gtl } \token_if_eq_meaning:NNT \l_@@_head_token \@@_special_relax: @@ -2522,7 +2527,7 @@ \tl_if_eq:onTF { \l_@@_head_tl } { \@@_unravel_marker: } { \@@_get_next_marker: } { - \@@_exp_args:NNx \use:nn \@@_notexpanded_test:w + \exp_args:NNe \use:nn \@@_notexpanded_test:w { \scan_stop: \exp_after:wN \cs_to_str:N \l_@@_head_tl Z } \q_mark \@@_notexpanded_expand:n #1 Z \q_mark \use_none:n @@ -2533,12 +2538,12 @@ ##1 #1 ##2 Z \q_mark ##3##4 \q_stop { ##3 {##2} } } -\exp_args:Nx \@@_tmp:w { \scan_stop: \tl_to_str:n { notexpanded: } } +\exp_args:Ne \@@_tmp:w { \scan_stop: \tl_to_str:n { notexpanded: } } \group_begin: \char_set_catcode_active:n { 0 } \cs_new_protected:Npn \@@_notexpanded_expand:n #1 { - \@@_exp_args:Nx \tl_if_empty:nTF { \str_tail:n {#1} } + \exp_args:Ne \tl_if_empty:nTF { \str_tail:n {#1} } { \group_begin: \char_set_lccode:nn { 0 } { `#1 } @@ -2571,14 +2576,14 @@ { \@@_get_next: \tl_if_eq:onTF \l_@@_head_tl { \@@:nn } - { \@@_error:nxxxx { nested-unravel } { } { } { } { } } - { \@@_error:nxxxx { internal } { marker~unknown } { } { } { } } + { \@@_error:neeee { nested-unravel } { } { } { } { } } + { \@@_error:neeee { internal } { marker~unknown } { } { } { } } \@@_input_gpop_item:NF \l_@@_argi_tl - { \@@_error:nxxxx { internal } { marker~1 } { } { } { } } + { \@@_error:neeee { internal } { marker~1 } { } { } { } } \@@_input_gpop_item:NF \l_@@_argii_tl - { \@@_error:nxxxx { internal } { marker~2 } { } { } { } } + { \@@_error:neeee { internal } { marker~2 } { } { } { } } \exp_args:Nno \keys_set:nn { unravel } \l_@@_argi_tl - \@@_exp_args:Nx \@@_back_input:n + \exp_args:Ne \@@_back_input:n { \exp_not:N \exp_not:n { \exp_not:o \l_@@_argii_tl } } \@@_get_next: } @@ -2641,22 +2646,22 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_set_cmd_aux_meaning: { - \tl_set:Nx \l_@@_head_meaning_tl + \tl_set:Ne \l_@@_head_meaning_tl { \exp_after:wN \@@_strip_escape:w \token_to_meaning:N \l_@@_head_token \tl_to_str:n { : } } - \tl_set:Nx \l_@@_head_meaning_tl + \tl_set:Ne \l_@@_head_meaning_tl { \exp_after:wN \@@_set_cmd_aux_meaning:w \l_@@_head_meaning_tl \q_stop } } -\use:x +\use:e { \cs_new:Npn \exp_not:N \@@_set_cmd_aux_meaning:w - ##1 \token_to_str:N : ##2 \exp_not:N \q_stop {##1} + #1 \token_to_str:N : #2 \exp_not:N \q_stop {#1} } % \end{macrocode} % \end{macro} @@ -2714,7 +2719,7 @@ { \tl_to_str:n { xpandable~luacall } } { } { - \@@_error:nxxxx { unknown-primitive } + \@@_error:neeee { unknown-primitive } { \l_@@_head_meaning_tl } { } { } { } } } @@ -2724,7 +2729,7 @@ { \exp_last_unbraced:NV \@@_set_cmd_aux_primitive:nn \c_@@_tex_relax_tl - \@@_error:nxxxx { unknown-primitive } + \@@_error:neeee { unknown-primitive } { \l_@@_head_meaning_tl } { } { } { } } } @@ -2777,7 +2782,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_set_cmd_aux_numeric: { - \tl_set:Nx \l_@@_tmpa_tl + \tl_set:Ne \l_@@_tmpa_tl { \exp_after:wN \@@_set_cmd_aux_numeric:N \l_@@_head_meaning_tl + 0 @@ -2831,13 +2836,13 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_set_cmd_aux_char: { - \tl_set:Nx \l_@@_head_meaning_tl + \tl_set:Ne \l_@@_head_meaning_tl { \token_to_meaning:N \l_@@_head_token } \token_if_eq_catcode:NNT \l_@@_head_token \c_catcode_other_token { \tl_set:Nn \l_@@_head_meaning_tl { other~ } } \exp_after:wN \@@_set_cmd_aux_char:w \l_@@_head_meaning_tl \q_stop - \@@_exp_args:NNx \int_set:Nn \l_@@_head_char_int + \exp_args:NNe \int_set:Nn \l_@@_head_char_int { ` \@@_token_to_char:N \l_@@_head_token } } \cs_new_protected:Npn \@@_set_cmd_aux_char:w #1 ~ #2 \q_stop @@ -2897,7 +2902,7 @@ % \begin{macro}{\@@_input_split:} % If the input is completely flat, and is a token list starting with % an |N|-type token, try to unflatten it by splitting at each -% occurence of that first character +% occurence of that first token. % \begin{macrocode} \cs_new_protected:Npn \@@_input_split: { @@ -2913,8 +2918,8 @@ { \gtl_if_head_is_N_type:NT #1 { - \tl_set:Nx \l_@@_input_tmpa_tl { \gtl_left_tl:N #1 } - \@@_exp_args:NNx \use:nn + \tl_set:Ne \l_@@_input_tmpa_tl { \gtl_left_tl:N #1 } + \exp_args:NNe \use:nn \@@_input_split_auxii:N { \tl_head:N \l_@@_input_tmpa_tl } } @@ -2987,7 +2992,7 @@ { \int_compare:nNnF {#1} = 0 { - \tl_set:Nx \l_@@_input_get_left_tl + \tl_set:Ne \l_@@_input_get_left_tl { \gtl_left_tl:c { g_@@_input_#1_gtl } } \tl_concat:NNN #2 #2 \l_@@_input_get_left_tl \gtl_if_tl:cT { g_@@_input_#1_gtl } @@ -3095,7 +3100,7 @@ { \gtl_if_tl:NTF #1 { - \tl_put_right:Nx #2 { \gtl_left_tl:N #1 } + \tl_put_right:Ne #2 { \gtl_left_tl:N #1 } \gtl_gclear:N #1 \int_gdecr:N \g_@@_input_int \@@_input_gpop_tl_aux:N #2 @@ -3105,7 +3110,7 @@ { \int_compare:nNnTF { \gtl_extra_end:N #1 } > 0 } { \use_i:nn } { - \tl_put_right:Nx #2 { \gtl_left_tl:N #1 } + \tl_put_right:Ne #2 { \gtl_left_tl:N #1 } \gtl_gpop_left_tl:N #1 } { @@ -3117,7 +3122,26 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_back_input:n, \@@_back_input:x} +% \begin{macro}[TF]{\@@_input_if_head_is_group_begin:} +% Call \cs{@@_input_if_empty:TF} to remove empty levels from the input +% stack, then check if the left-most non-empty level starts with an +% explicit begin-group character token. +% \begin{macrocode} +\prg_new_protected_conditional:Npnn \@@_input_if_head_is_group_begin: { T , F , TF } + { + \@@_input_if_empty:TF + { \prg_return_false: } + { + \exp_args:Nc \gtl_if_head_is_group_begin:NTF + { g_@@_input_ \int_use:N \g_@@_input_int _gtl } + { \prg_return_true: } + { \prg_return_false: } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_back_input:n, \@@_back_input:V, \@@_back_input:o} % Insert a token list back into the input. Use \cs{gtl_gclear_new:c} % to define the gtl variable if necessary: this happens whenever a % new largest value of \cs{g_@@_input_int} is reached. @@ -3129,8 +3153,6 @@ \gtl_gset:cn { g_@@_input_ \int_use:N \g_@@_input_int _gtl } } \cs_generate_variant:Nn \@@_back_input:n { V , o } -\cs_new_protected:Npn \@@_back_input:x - { \@@_exp_args:Nx \@@_back_input:n } % \end{macrocode} % \end{macro} % @@ -3140,7 +3162,7 @@ \cs_new_protected:Npn \@@_back_input_gtl:N #1 { \gtl_if_tl:NTF #1 - { \@@_back_input:x { \gtl_left_tl:N #1 } } + { \exp_args:Ne \@@_back_input:n { \gtl_left_tl:N #1 } } { \gtl_gconcat:cNc { g_@@_input_ \int_use:N \g_@@_input_int _gtl } @@ -3166,10 +3188,10 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_back_input_tl_o: { - \tl_set:Nx \l_@@_tmpa_tl + \tl_set:Ne \l_@@_tmpa_tl { \exp_args:NV \exp_not:o \l_@@_head_tl } \@@_back_input:V \l_@@_tmpa_tl - \@@_print_expansion:x + \@@_print_expansion:e { \tl_to_str:N \l_@@_head_tl = \tl_to_str:N \l_@@_tmpa_tl } } % \end{macrocode} @@ -3228,7 +3250,7 @@ % \@@_macro_replacement:N % } % \begin{macrocode} -\use:x +\use:e { \exp_not:n { \cs_new:Npn \@@_macro_split_do:NN #1 } { @@ -3258,20 +3280,22 @@ % \@@_macro_call_safe:, % \@@_macro_call_quick:, % \@@_macro_call_quick_loop:NNN, +% \@@_macro_call_quick_loop:NN, % \@@_macro_call_quick_runaway:Nw, % } % Macros are simply expanded once. We cannot determine precisely % which tokens a macro will need for its parameters, but we know that % it must form a balanced token list. Thus we can be safe by % extracting the longest balanced prefix in the input and working with -% that. +% that. We need to check if the argument was braced, to improve the +% error recovery for a non-\tn{long} macro receiving \tn{par}. % \begin{macrocode} \cs_new_protected:Npn \@@_macro_call: { \bool_if:NTF \g_@@_speedup_macros_bool { - \tl_set:Nx \l_@@_tmpa_tl - {^ \exp_after:wN \@@_macro_parameter:N \l_@@_head_tl } + \tl_set:Ne \l_@@_tmpa_tl + { ^ \exp_after:wN \@@_macro_parameter:N \l_@@_head_tl } \@@_tl_if_in:ooTF \c_@@_parameters_tl \l_@@_tmpa_tl { \@@_macro_call_quick: } { \@@_macro_call_safe: } } @@ -3292,16 +3316,23 @@ \cs_new_protected:Npn \@@_macro_call_quick_loop:NNN #1#2#3 { \use_none:n #2 + \@@_input_if_head_is_group_begin:TF + { \@@_macro_call_quick_loop:NN \prg_do_nothing: } + { \@@_macro_call_quick_loop:NN \use:n } + #3 + } +\cs_new_protected:Npn \@@_macro_call_quick_loop:NN #1#2 + { \@@_input_gpop_item:NF \l_@@_tmpa_tl - { \@@_macro_call_quick_runaway:Nw #3 } - \tl_put_right:Nx \l_@@_head_tl - { { \exp_not:V \l_@@_tmpa_tl } } + { \@@_macro_call_quick_runaway:Nw #2 } + \tl_put_right:Ne \l_@@_head_tl + { #1 { \exp_not:V \l_@@_tmpa_tl } } \@@_macro_call_quick_loop:NNN - #3 + #2 } \cs_new_protected:Npn \@@_macro_call_quick_runaway:Nw #1#2 \q_stop { - \@@_error:nxxxx { runaway-macro-parameter } + \@@_error:neeee { runaway-macro-parameter } { \tl_to_str:N \l_@@_head_tl } { \tl_to_str:n {#1} } { } { } } % \end{macrocode} @@ -3337,7 +3368,7 @@ \bool_if:NT \g_@@_internal_debug_bool { \@@_set_cmd: - \@@_exp_args:Nx \iow_term:n { Exp:~\int_to_arabic:n { \l_@@_head_cmd_int } } + \exp_args:Ne \iow_term:n { Exp:~\int_to_arabic:n { \l_@@_head_cmd_int } } } \token_if_macro:NTF \l_@@_head_token { \@@_macro_call: } @@ -3362,7 +3393,7 @@ { \cs_if_exist_use:cF { @@_expandable_ \int_use:N \l_@@_head_cmd_int : } - { \@@_error:nxxxx { internal } { expandable } { } { } { } } + { \@@_error:neeee { internal } { expandable } { } { } { } } } { \@@_set_cmd_aux_unknown: @@ -3570,7 +3601,7 @@ \quark_if_recursion_tail_stop_do:nn {#2} { \@@_scan_keyword_true: } \quark_if_recursion_tail_stop_do:nn {#3} - { \@@_error:nxxxx { internal } { odd-keyword-length } { } { } { } } + { \@@_error:neeee { internal } { odd-keyword-length } { } { } { } } \@@_get_x_next: \@@_scan_keyword_test:NNTF #2#3 { @@ -3605,7 +3636,7 @@ \cs_new_protected:Npn \@@_scan_keyword_true: { \@@_prev_input_gpop_gtl:N \l_@@_tmpb_gtl - \@@_prev_input:x { \gtl_to_str:N \l_@@_tmpb_gtl } + \@@_prev_input:e { \gtl_to_str:N \l_@@_tmpb_gtl } \prg_return_true: } \cs_new_protected:Npn \@@_scan_keyword_false:w @@ -3773,7 +3804,7 @@ } \int_compare:nNnTF {#3} < { 4 } { \@@_thing_use_get:nnNN {#1} {#3} \l_@@_head_tl \l_@@_tmpa_tl } - { \tl_set:Nx \l_@@_tmpa_tl { \@@_the:w \l_@@_head_tl } } + { \tl_set:Ne \l_@@_tmpa_tl { \@@_the:w \l_@@_head_tl } } \@@_rescan_something_internal_auxii:Vn \l_@@_tmpa_tl {#1} \@@_break_point: \int_compare:nNnT {#3} < { 4 } { \@@_print_action: } @@ -3782,7 +3813,7 @@ { \@@_prev_input_silent:n {#1} \@@_set_action_text: - \@@_set_action_text:x + \@@_set_action_text:e { \g_@@_action_text_str \use:n { ~ => ~ } \tl_to_str:n {#1} } \int_gset:Nn \g_@@_val_level_int {#2} } @@ -3796,8 +3827,9 @@ % This expands to a digit (the level generated by whatever token is % the current |head|), followed by some code to fetch necessary % operands. In most cases, this can be done by simply looking at the -% |cmd| integer, but for |last_item|, |set_aux| and |register|, the level of the -% token depends on the |char| integer. When the token is not allowed +% |cmd| integer, but for |last_item|, |set_aux|, |set_shape| and +% |register|, the level of the token, or what has to be scanned, +% depends on the |char| integer. When the token is not allowed % after \tn{the} (or at any other position where % \cs{@@_rescan_something_internal:n} is called), the resulting level % is~$8$, large enough so that the main function knows it is @@ -3823,7 +3855,7 @@ { 81 } { 1 } % set_page_dimen { 82 } { 0 } % set_page_int { 83 } { 1 \@@_scan_int: } % set_box_dimen - { 84 } { 0 \@@_scan_int: } % set_shape + { 84 } { \@@_thing_set_shape: } % set_shape { 85 } { 0 \@@_scan_int: } % def_code { 86 } { 4 \@@_scan_int: } % def_family { 87 } { 4 } % set_font @@ -3836,6 +3868,8 @@ } \cs_new:Npn \@@_thing_set_aux: { \int_compare:nNnTF \l_@@_head_char_int = { 1 } { 1 } { 0 } } +\cs_new:Npn \@@_thing_set_shape: + { \int_compare:nNnTF \l_@@_head_char_int = 0 { 0 } { 0 \@@_scan_int: } } \cs_new:Npn \@@_thing_last_item: { \int_compare:nNnTF \l_@@_head_char_int < { 26 } @@ -3910,7 +3944,7 @@ { \int_compare:nNnT {#1} = { 3 } { \@@_tex_error:nV { incompatible-units } #3 } - \tl_set:Nx #4 + \tl_set:Ne #4 { \int_case:nn { \int_min:nn {#1} {#2} } { @@ -3924,12 +3958,12 @@ { \int_case:nnF {#1} { - { 0 } { \tl_set:Nx #4 { \int_eval:n {#3} } } - { 3 } { \tl_set:Nx #4 { \muskip_eval:n {#3} } } + { 0 } { \tl_set:Ne #4 { \int_eval:n {#3} } } + { 3 } { \tl_set:Ne #4 { \muskip_eval:n {#3} } } } { \@@_tex_error:nV { incompatible-units } #3 - \tl_set:Nx #4 { \muskip_eval:n { \tex_gluetomu:D #3 } } + \tl_set:Ne #4 { \muskip_eval:n { \tex_gluetomu:D #3 } } } } } @@ -3950,7 +3984,7 @@ \cs_new_protected:Npn \@@_scan_expr_op:NN #1#2 { \@@_get_x_non_blank: - \tl_case:NnF \l_@@_head_tl + \token_case_meaning:NnF \l_@@_head_tl { \c_@@_plus_tl { @@ -4049,7 +4083,7 @@ } \cs_new_protected:Npn \@@_scan_int_char: { - \tl_case:NnF \l_@@_head_tl + \token_case_meaning:NnF \l_@@_head_tl { \c_@@_lq_tl { \@@_scan_int_lq: } \c_@@_rq_tl @@ -4062,7 +4096,7 @@ { \@@_prev_input:V \l_@@_head_tl \@@_get_x_next: - \@@_scan_int_explicit:Nn \c_false_bool { " } + \@@_scan_int_explicit:Nn \c_false_bool { " } % " } } { \@@_scan_int_explicit:Nn \c_false_bool { } } @@ -4072,13 +4106,13 @@ \@@_get_next: \@@_gtl_if_head_is_definable:NF \l_@@_head_gtl { - \tl_set:Nx \l_@@_head_tl + \tl_set:Ne \l_@@_head_tl { \@@_token_to_char:N \l_@@_head_token } } - \tl_set:Nx \l_@@_tmpa_tl + \tl_set:Ne \l_@@_tmpa_tl { \int_eval:n { \exp_after:wN ` \l_@@_head_tl } } \@@_prev_input_silent:V \l_@@_tmpa_tl - \@@_print_action:x + \@@_print_action:e { ` \gtl_to_str:N \l_@@_head_gtl = \l_@@_tmpa_tl } \@@_skip_optional_space: } @@ -4314,7 +4348,7 @@ \@@_gtl_if_head_is_definable:NTF \l_@@_head_gtl { \@@_back_input: } { - \tl_set:Nx \l_@@_tmpa_tl + \tl_set:Ne \l_@@_tmpa_tl { \@@_token_to_char:N \l_@@_head_token } \tl_if_eq:NNT \l_@@_tmpa_tl \c_@@_dq_tl { @@ -4363,7 +4397,7 @@ \@@_prev_input_gpush: \@@_scan_toks:NN \c_false_bool \c_true_bool \@@_prev_input_gpop:N \l_@@_tmpa_tl - \@@_prev_input_silent:x + \@@_prev_input_silent:e { { \exp_after:wN \tl_to_str:n \l_@@_tmpa_tl } } } % \end{macrocode} @@ -4376,7 +4410,7 @@ \@@_prev_input_gpush: \@@_scan_toks:NN \c_false_bool \c_true_bool \@@_prev_input_gpop:N \l_@@_tmpa_tl - \@@_prev_input_silent:x + \@@_prev_input_silent:e { { \exp_not:N \exp_not:n \exp_not:V \l_@@_tmpa_tl } } } % \end{macrocode} @@ -4440,7 +4474,7 @@ \@@_error:nnnnn { runaway-text } { } { } { } { } \@@_exit_hard:w } - \tl_set:Nx \l_@@_head_tl { { \exp_not:V \l_@@_head_tl } } + \tl_set:Ne \l_@@_head_tl { { \exp_not:V \l_@@_head_tl } } \bool_if:NT #1 { \tl_put_right:NV \l_@@_defining_tl \l_@@_head_tl } \@@_prev_input_silent:V \l_@@_head_tl @@ -4467,7 +4501,7 @@ \@@_prev_input_gtl:N \l_@@_head_gtl \@@_scan_group_x:n { 1 } \@@_prev_input_gpop_gtl:N \l_@@_tmpb_gtl - \@@_prev_input_silent:x + \@@_prev_input_silent:e { \gtl_left_tl:N \l_@@_tmpb_gtl } } } @@ -4498,7 +4532,7 @@ } { \@@_prev_input_silent:V \l_@@_head_tl - \tl_put_right:Nx \l_@@_defining_tl + \tl_put_right:Ne \l_@@_defining_tl { \exp_not:N \exp_not:N \exp_not:V \l_@@_head_tl } \@@_scan_group_xdef:n {#1} } @@ -4625,7 +4659,7 @@ \@@_back_input: \@@_error:nnnnn { missing-box } { } { } { } { } \@@_prev_input_gpop:N \l_@@_head_tl - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } } % \end{macrocode} % \end{macro} @@ -4675,7 +4709,7 @@ { \@@_prepare_mag: } \tl_use:N \l_@@_head_tl \scan_stop: \gtl_gput_right:NV \g_@@_output_gtl \l_@@_head_tl - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } } } % \end{macrocode} @@ -4698,7 +4732,7 @@ \@@_back_input: \@@_error:nnnnn { improper-leaders } { } { } { } { } \@@_prev_input_gpop:N \l_@@_head_tl - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } } } % \end{macrocode} @@ -4729,7 +4763,7 @@ { \@@_box_hook:N \tex_everyvbox:D } \@@_scan_spec: \@@_prev_input_gpop:N \l_@@_head_tl - \@@_set_action_text:x + \@@_set_action_text:e { \tl_to_str:N \l_@@_head_tl \iow_char:N \{ } \seq_push:Nf \l_@@_leaders_box_seq { \bool_if:NTF #1 { \mode_if_vertical:TF { v } { h } } { Z } } @@ -4755,7 +4789,7 @@ \str_if_eq:eeF { \tl_head:N \l_@@_tmpa_tl } { \exp_not:N \@@_box_hook:w } { - \@@_exp_args:Nx #1 + \exp_args:Ne #1 { \exp_not:n { \@@_box_hook:w \prg_do_nothing: } \exp_not:V #1 @@ -4768,7 +4802,7 @@ \gtl_clear:N \l_@@_after_group_gtl \@@_print_action: \@@_back_input:o {##1} - \@@_set_action_text:x + \@@_set_action_text:e { \token_to_meaning:N #1 = \tl_to_str:o {##1} } \tl_if_empty:oF {##1} { \@@_print_action: } } @@ -4812,33 +4846,31 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_char:n, \@@_char:V, \@@_char:x} +% \begin{macro}{\@@_char:n, \@@_char:V, \@@_char:e} % \begin{macrocode} \cs_new_protected:Npn \@@_char:n #1 { \tex_char:D #1 \scan_stop: \@@_charcode_if_safe:nTF {#1} { - \tl_set:Nx \l_@@_tmpa_tl { \char_generate:nn {#1} { 12 } } + \tl_set:Ne \l_@@_tmpa_tl { \char_generate:nn {#1} { 12 } } \gtl_gput_right:NV \g_@@_output_gtl \l_@@_tmpa_tl - \@@_print_action:x { \tl_to_str:N \l_@@_tmpa_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_tmpa_tl } } { - \tl_set:Nx \l_@@_tmpa_tl + \tl_set:Ne \l_@@_tmpa_tl { \exp_not:N \char \int_eval:n {#1} ~ } \gtl_gput_right:NV \g_@@_output_gtl \l_@@_tmpa_tl - \@@_print_action:x + \@@_print_action:e { " \char_generate:nn {#1} { 12 } " = \tl_to_str:N \l_@@_tmpa_tl } } } -\cs_generate_variant:Nn \@@_char:n { V } -\cs_new_protected:Npn \@@_char:x - { \@@_exp_args:Nx \@@_char:n } +\cs_generate_variant:Nn \@@_char:n { V , e } % \end{macrocode} % \end{macro} % % \begin{macro} -% {\@@_char_in_mmode:n, \@@_char_in_mmode:V, \@@_char_in_mmode:x} +% {\@@_char_in_mmode:n, \@@_char_in_mmode:V, \@@_char_in_mmode:e} % \begin{macrocode} \cs_new_protected:Npn \@@_char_in_mmode:n #1 { @@ -4847,30 +4879,27 @@ { % math active \@@_active_do:nn {#1} { \gtl_set:Nn \l_@@_head_gtl } \@@_back_input: - \@@_print_action:x + \@@_print_action:e { \char_generate:nn {#1} { 12 } ~ active } } { \@@_char:n {#1} } } -\cs_generate_variant:Nn \@@_char_in_mmode:n { V } -\cs_new_protected:Npn \@@_char_in_mmode:x - { \@@_exp_args:Nx \@@_char_in_mmode:n } +\cs_generate_variant:Nn \@@_char_in_mmode:n { V , e } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_mathchar:n, \@@_mathchar:x} +% \begin{macro}{\@@_mathchar:n, \@@_mathchar:e} % ^^A todo: \omathchar support % \begin{macrocode} \cs_new_protected:Npn \@@_mathchar:n #1 { \tex_mathchar:D #1 \scan_stop: - \tl_set:Nx \l_@@_tmpa_tl - { \exp_not:N \mathchar " \int_to_hex:n {#1} ~ } + \tl_set:Ne \l_@@_tmpa_tl + { \exp_not:N \mathchar " \int_to_hex:n {#1} ~ } % " \gtl_gput_right:NV \g_@@_output_gtl \l_@@_tmpa_tl - \@@_print_action:x { \tl_to_str:N \l_@@_tmpa_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_tmpa_tl } } -\cs_new_protected:Npn \@@_mathchar:x - { \@@_exp_args:Nx \@@_mathchar:n } +\cs_generate_variant:Nn \@@_mathchar:n { e } % \end{macrocode} % \end{macro} % @@ -4888,7 +4917,7 @@ \bool_if:NTF #1 { \tex_indent:D } { \tex_noindent:D } \exp_args:NV \@@_everypar:w \l_@@_tmpa_tl \@@_back_input:V \l_@@_tmpa_tl - \@@_print_action:x + \@@_print_action:e { \g_@@_action_text_str \c_space_tl : ~ \token_to_str:N \everypar = { \tl_to_str:N \l_@@_tmpa_tl } @@ -4912,7 +4941,7 @@ { \tex_par:D \gtl_gput_right:Nn \g_@@_output_gtl { \par } - \@@_print_action:x { Paragraph~end. } + \@@_print_action:e { Paragraph~end. } } % \end{macrocode} % \end{macro} @@ -5062,7 +5091,7 @@ { \@@_back_input_gtl:N \l_@@_after_group_gtl \c_group_end_token - \@@_print_action:x + \@@_print_action:e { \token_to_str:N #2 \prg_replicate:nn { #1 + 1 } { {...} } } } { \exp_args:NV \@@_end_choice_group:nN \l_@@_choice_int #2 } @@ -5077,7 +5106,7 @@ \use:n \c_group_begin_token \int_set:Nn \l_@@_choice_int { #1 + 1 } \gtl_clear:N \l_@@_after_group_gtl - \@@_print_action:x + \@@_print_action:e { \token_to_str:N #2 \prg_replicate:nn {#1} { { ... } } @@ -5093,7 +5122,7 @@ { \int_compare:nNnTF \@@_currentgrouptype: = { 0 } { % bottom-level - \@@_error:nxxxx { extra-close } + \@@_error:neeee { extra-close } { \token_to_meaning:N \l_@@_head_token } { } { } { } } { @@ -5109,7 +5138,7 @@ } { \gtl_set_eq:NN \l_@@_head_gtl \c_group_end_gtl } \@@_back_input: - \@@_error:nxxxx { off-save } + \@@_error:neeee { off-save } { \gtl_to_str:N \l_@@_head_gtl } { } { } { } } } @@ -5267,7 +5296,7 @@ { \exp_after:wN \@@_token_if_expandable:NTF \l_@@_head_tl { - \@@_set_action_text:x + \@@_set_action_text:e { \iow_char:N \\notexpanded: \g_@@_action_text_str } } { } @@ -5392,7 +5421,7 @@ \g_@@_output_gtl \c_group_begin_gtl \tl_use:N \l_@@_head_tl \c_group_begin_token } - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } } % \end{macrocode} % @@ -5427,7 +5456,7 @@ { \@@_mode_non_vertical:n { - \tl_set:Nx \l_@@_tmpa_tl + \tl_set:Ne \l_@@_tmpa_tl { ` \@@_token_to_char:N \l_@@_head_token } \mode_if_math:TF { \@@_char_in_mmode:V \l_@@_tmpa_tl } @@ -5475,7 +5504,7 @@ \tex_penalty:D - '10000000000 ~ } \@@_build_page: - \@@_print_action:x { End~everything! } + \@@_print_action:e { End~everything! } } { \@@_print_outcome: @@ -5496,7 +5525,7 @@ \@@_scan_int: \@@_prev_input_gpop:N \l_@@_head_tl \tl_use:N \l_@@_head_tl \scan_stop: - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } } } % \end{macrocode} @@ -5542,8 +5571,8 @@ \@@_scan_int: \@@_prev_input_gpop:N \l_@@_head_tl \mode_if_math:TF - { \@@_char_in_mmode:x { \tl_tail:N \l_@@_head_tl } } - { \@@_char:x { \tl_tail:N \l_@@_head_tl } } + { \@@_char_in_mmode:e { \tl_tail:N \l_@@_head_tl } } + { \@@_char:e { \tl_tail:N \l_@@_head_tl } } } } % \end{macrocode} @@ -5560,7 +5589,7 @@ \@@_print_action: \@@_scan_int: \@@_prev_input_gpop:N \l_@@_head_tl - \@@_mathchar:x { \tl_tail:N \l_@@_head_tl } + \@@_mathchar:e { \tl_tail:N \l_@@_head_tl } } } % \end{macrocode} @@ -5576,9 +5605,9 @@ \@@_scan_toks:NN \c_false_bool \c_true_bool \@@_prev_input_gpop:N \l_@@_tmpa_tl \@@_prev_input_gpop:N \l_@@_head_tl - \@@_print_action:x + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl \tl_to_str:N \l_@@_tmpa_tl } - \tl_put_right:Nx \l_@@_head_tl + \tl_put_right:Ne \l_@@_head_tl { { \exp_not:N \exp_not:n \exp_not:V \l_@@_tmpa_tl } } \tl_use:N \l_@@_head_tl } @@ -5616,7 +5645,7 @@ \@@_get_x_next: \@@_rescan_something_internal:n { 5 } \@@_prev_input_gpop:N \l_@@_head_tl - \@@_exp_args:Nx \use:n + \exp_args:Ne \use:n % better display than \use:e { \tex_showtokens:D { \tl_tail:N \l_@@_head_tl } } } } @@ -5683,7 +5712,7 @@ \@@_scan_int: \@@_prev_input_gpop:N \l_@@_head_tl \tl_use:N \l_@@_head_tl \scan_stop: - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } } % \end{macrocode} % \end{macro} @@ -5735,7 +5764,7 @@ { \int_eval:n { \l_@@_head_char_int - 2 } } \@@_prev_input_gpop:N \l_@@_head_tl \tl_use:N \l_@@_head_tl \scan_stop: - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } } } % \end{macrocode} @@ -5774,7 +5803,7 @@ { \@@_scan_dimen:nN { 3 } \c_false_bool } \@@_prev_input_gpop:N \l_@@_head_tl \tl_use:N \l_@@_head_tl \scan_stop: - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } } % \end{macrocode} % \end{macro} @@ -5846,7 +5875,7 @@ \@@_scan_alt_rule: \@@_prev_input_gpop:N \l_@@_head_tl \tl_use:N \l_@@_head_tl \scan_stop: - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } } % \end{macrocode} % @@ -5877,7 +5906,7 @@ \gtl_gconcat:NNN \g_@@_output_gtl \g_@@_output_gtl \c_group_begin_gtl \tl_use:N \l_@@_head_tl \c_group_begin_token - \@@_print_action:x + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl \iow_char:N \{ } } % \end{macrocode} @@ -5902,7 +5931,7 @@ \tl_set_eq:NN \l_@@_tmpa_tl \l_@@_head_tl \@@_get_next: \gtl_gset_eq:NN \g_@@_after_assignment_gtl \l_@@_head_gtl - \@@_print_action:x + \@@_print_action:e { Afterassignment:~\tl_to_str:N \l_@@_tmpa_tl \gtl_to_str:N \l_@@_head_gtl @@ -5920,7 +5949,7 @@ \@@_get_next: \int_compare:nNnTF \@@_currentgrouptype: = 0 { - \@@_print_action:x + \@@_print_action:e { Aftergroup~(level~0~=>~dropped):~ \tl_to_str:N \l_@@_tmpa_tl @@ -5930,7 +5959,7 @@ { \gtl_concat:NNN \l_@@_after_group_gtl \l_@@_after_group_gtl \l_@@_head_gtl - \@@_print_action:x + \@@_print_action:e { Aftergroup:~\tl_to_str:N \l_@@_tmpa_tl \gtl_to_str:N \l_@@_head_gtl @@ -5948,7 +5977,7 @@ \@@_scan_int: \@@_prev_input_gpop:N \l_@@_head_tl \tl_use:N \l_@@_head_tl \scan_stop: - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } } % \end{macrocode} % @@ -6011,7 +6040,7 @@ \@@_prev_input_gpop:N \l_@@_head_tl \gtl_gput_right:NV \g_@@_output_gtl \l_@@_head_tl \tl_use:N \l_@@_head_tl \scan_stop: - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } \@@_break_point: } % \end{macrocode} @@ -6109,7 +6138,7 @@ { \gtl_gput_right:NV \g_@@_output_gtl \l_@@_head_tl \tl_use:N \l_@@_head_tl \scan_stop: - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } } { \int_case:nnF \tex_currentgrouptype:D @@ -6124,7 +6153,7 @@ \gtl_clear:N \l_@@_after_group_gtl } { \tl_use:N \l_@@_head_tl \scan_stop: } - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } } { 15 } { % todo: this is a TeX error @@ -6200,7 +6229,7 @@ \tl_use:N \l_@@_head_tl \c_group_begin_token \gtl_clear:N \l_@@_after_group_gtl \int_set:Nn \l_@@_choice_int { 1 } - \@@_print_action:x + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl \iow_char:N \{ } } % \end{macrocode} @@ -6245,7 +6274,7 @@ \cs_new_protected:Npn \@@_case_shift:Nn #1#2 { #1 { \@@_back_input:n {#2} } - \@@_print_action:x + \@@_print_action:e { \token_to_meaning:N #1 ~ \tl_to_str:n { {#2} } } } % \end{macrocode} @@ -6258,7 +6287,7 @@ \@@_scan_toks_to_str: \@@_prev_input_gpop:N \l_@@_head_tl \tl_use:N \l_@@_head_tl - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } } % \end{macrocode} % @@ -6271,7 +6300,7 @@ \@@_scan_extension_operands: \@@_prev_input_gpop:N \l_@@_head_tl \tl_use:N \l_@@_head_tl \scan_stop: - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } } % \end{macrocode} % @@ -6289,7 +6318,7 @@ { \@@_scan_int: } \@@_prev_input_gpop:N \l_@@_head_tl \tl_use:N \l_@@_head_tl \scan_stop: - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } } % \end{macrocode} % @@ -6362,7 +6391,7 @@ \@@_new_tex_cmd:nn { math_given } % 69 { \@@_mode_math:n - { \@@_mathchar:x { \int_use:N \l_@@_head_char_int } } + { \@@_mathchar:e { \int_use:N \l_@@_head_char_int } } } % \end{macrocode} % @@ -6683,7 +6712,7 @@ { \@@_back_input: \@@_prev_input_gpop:N \l_@@_head_tl - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl ignored } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl ignored } \@@_prev_input_gpush: } @@ -6780,7 +6809,7 @@ > { \@@_tex_use:n { max_non_prefixed_command } } { \@@_prev_input_gpop:N \l_@@_tmpa_tl - \@@_error:nxxxx { erroneous-prefixes } + \@@_error:neeee { erroneous-prefixes } { \tl_to_str:N \l_@@_tmpa_tl } { \tl_to_str:N l_@@_head_tl } { } { } @@ -6859,7 +6888,7 @@ \tl_if_empty:nF {#1} { \@@_prev_input_gpush:N \l_@@_head_tl - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } #1 \@@_prev_input_gpop:N \l_@@_head_tl } @@ -6955,20 +6984,37 @@ } % \end{macrocode} % +% This is a variant of \cs{@@_assign_value:nn}, with a bit more complication +% because the syntax of \tn{parshape} and of \eTeX{} primitives such as +% \tn{interlinepenalties} is a bit different. % \begin{macrocode} \@@_prefixed_new:nn { set_shape } % 84 { - \@@_assign_value:nn { \@@_scan_int: } + \@@_prev_input:V \l_@@_head_tl + \tl_set_eq:NN \l_@@_defined_tl \l_@@_head_tl + \tl_if_head_eq_meaning:VNTF \l_@@_defined_tl \tex_parshape:D { - \prg_replicate:nn - { - \tl_if_head_eq_meaning:VNT - \l_@@_defined_tl \tex_parshape:D { 2 * } - \tl_tail:N \l_@@_defined_tl - } - { \@@_scan_int: } + \@@_set_shape:NN 2 \@@_scan_normal_dimen: + \@@_print_assigned_parshape: + } + { + \@@_set_shape:NN 1 \@@_scan_int: + \@@_print_assigned_set_shape: } } +\cs_new_protected:Npn \@@_set_shape:NN #1#2 + { + \@@_scan_optional_equals: + \@@_prev_input_gpush: + \@@_scan_int: + \@@_prev_input_gpop:N \l_@@_tmpa_tl + \@@_prev_input_silent:V \l_@@_tmpa_tl + \prg_replicate:nn + { \int_max:nn { 0 } { #1 * \l_@@_tmpa_tl } } + { \@@_prev_input_silent:n { ~ } #2 } + \@@_prev_input_gpop:N \l_@@_tmpa_tl + \tl_use:N \l_@@_tmpa_tl \scan_stop: + } % \end{macrocode} % % \begin{macrocode} @@ -6993,9 +7039,9 @@ \@@_prefixed_new:nn { def_font } % 88 { \@@_prev_input_silent:V \l_@@_head_tl - \@@_set_action_text:x { \tl_to_str:N \l_@@_head_tl } + \@@_set_action_text:e { \tl_to_str:N \l_@@_head_tl } \@@_scan_r_token: - \@@_print_action:x + \@@_print_action:e { \g_@@_action_text_str \tl_to_str:N \l_@@_defined_tl } \@@_scan_optional_equals: \@@_scan_file_name: @@ -7024,7 +7070,7 @@ { % |let| \@@_scan_r_token: \@@_prev_input_get:N \l_@@_tmpa_tl - \@@_print_action:x { \tl_to_str:N \l_@@_tmpa_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_tmpa_tl } \@@_get_next: \bool_while_do:nn { \token_if_eq_catcode_p:NN \l_@@_head_token \c_space_token } @@ -7037,7 +7083,7 @@ { % |futurelet| \@@_scan_r_token: \@@_prev_input_get:N \l_@@_tmpa_tl - \@@_print_action:x { \tl_to_str:N \l_@@_tmpa_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_tmpa_tl } \@@_get_next: \gtl_set_eq:NN \l_@@_tmpb_gtl \l_@@_head_gtl \@@_get_next: @@ -7048,7 +7094,7 @@ \@@_prev_input_gpop:N \l_@@_tmpa_tl \tl_put_right:Nn \l_@@_tmpa_tl { = ~ \l_@@_head_token } \@@_prev_input_gpop:N \l_@@_head_tl - \@@_exp_args:Nx \use:n + \use:e { \exp_not:V \l_@@_head_tl \tex_let:D \tl_tail:N \l_@@_tmpa_tl @@ -7061,10 +7107,10 @@ \@@_prefixed_new:nn { shorthand_def } % 95 { \@@_prev_input_silent:V \l_@@_head_tl - \tl_set:Nx \l_@@_prev_action_tl + \tl_set:Ne \l_@@_prev_action_tl { \tl_to_str:N \l_@@_head_tl } \@@_scan_r_token: - \@@_print_action:x + \@@_print_action:e { \l_@@_prev_action_tl \tl_to_str:N \l_@@_defined_tl } \exp_after:wN \cs_set_eq:NN \l_@@_defined_tl \scan_stop: \@@_just_print_assigned_token: @@ -7087,7 +7133,7 @@ \@@_prefixed_new:nn { read_to_cs } % 96 { \@@_prev_input_silent:V \l_@@_head_tl - \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_action:e { \tl_to_str:N \l_@@_head_tl } \@@_scan_int: \@@_scan_to: \@@_scan_r_token: @@ -7186,7 +7232,7 @@ \@@_prev_input_gpop:N \l_@@_tmpa_tl \tl_put_left:NV \l_@@_head_tl \l_@@_tmpa_tl \tl_use:N \l_@@_head_tl \scan_stop: - \@@_print_assignment:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_assignment:e { \tl_to_str:N \l_@@_head_tl } } % \end{macrocode} % @@ -7194,9 +7240,9 @@ \@@_prefixed_new:nn { letterspace_font } % 101 { \@@_prev_input_silent:V \l_@@_head_tl - \@@_set_action_text:x { \tl_to_str:N \l_@@_head_tl } + \@@_set_action_text:e { \tl_to_str:N \l_@@_head_tl } \@@_scan_r_token: - \@@_print_action:x + \@@_print_action:e { \g_@@_action_text_str \tl_to_str:N \l_@@_defined_tl } \exp_after:wN \cs_set_eq:NN \l_@@_defined_tl \@@_nullfont: \@@_just_print_assigned_token: @@ -7211,9 +7257,9 @@ \@@_prefixed_new:nn { pdf_copy_font } % 102 { \@@_prev_input_silent:V \l_@@_head_tl - \@@_set_action_text:x { \tl_to_str:N \l_@@_head_tl } + \@@_set_action_text:e { \tl_to_str:N \l_@@_head_tl } \@@_scan_r_token: - \@@_print_action:x + \@@_print_action:e { \g_@@_action_text_str \tl_to_str:N \l_@@_defined_tl } \exp_after:wN \cs_set_eq:NN \l_@@_defined_tl \@@_nullfont: \@@_just_print_assigned_token: @@ -7327,7 +7373,7 @@ { 3 } { \@@_scan_normal_glue: } % glue { 4 } { \@@_scan_mu_glue: } % muglue } - { \@@_error:nxxxx { internal } { do-reg=#2 } { } { } { } } + { \@@_error:neeee { internal } { do-reg=#2 } { } { } { } } } { \@@_scan_int: } \@@_assign_register: @@ -7384,7 +7430,7 @@ % \tn{pdffiledump}, \tn{pdfmatch}, \tn{pdflastmatch}, % \tn{pdfuniformdeviate}, \tn{pdfnormaldeviate}, \tn{pdfinsertht}, % \tn{pdfximagebbox}, \tn{jobname}, \tn{expanded}, and in -% \LuaTeX{} \tn{directlua}, \tn{luaescapestring}, and in \XeTeX{} \tn{Ucharcat}. +% \LuaTeX{} \tn{directlua}, \tn{luaescapestring}, and in \XeTeX{}/(u)p\TeX{} \tn{Ucharcat}. % \item |the=111| for \tn{the}, \tn{unexpanded}, and \tn{detokenize}. % \item |top_bot_mark=112| \tn{topmark}, \tn{firstmark}, \tn{botmark}, % \tn{splitfirstmark}, \tn{splitbotmark}, \tn{topmarks}, @@ -7414,13 +7460,13 @@ \gtl_concat:NNN \l_@@_head_gtl \l_@@_tmpb_gtl \l_@@_head_gtl \@@_prev_input_gpush_gtl:N \l_@@_head_gtl - \@@_print_expansion:x { \gtl_to_str:N \l_@@_head_gtl } + \@@_print_expansion:e { \gtl_to_str:N \l_@@_head_gtl } \@@_get_next: \@@_token_if_expandable:NTF \l_@@_head_token { \@@_expand_do:N \prg_do_nothing: } { \@@_back_input: } \@@_prev_input_gpop_gtl:N \l_@@_head_gtl - \@@_set_action_text:x + \@@_set_action_text:e { back_input: ~ \gtl_to_str:N \l_@@_head_gtl } \gtl_pop_left:N \l_@@_head_gtl \@@_back_input: @@ -7428,6 +7474,7 @@ } \cs_new_protected:Npn \@@_unless: { + \gtl_set_eq:NN \l_@@_tmpb_gtl \l_@@_head_gtl \@@_get_token: \int_compare:nNnTF \l_@@_head_cmd_int = { \@@_tex_use:n { if_test } } @@ -7435,8 +7482,8 @@ \token_if_eq_meaning:NNTF \l_@@_head_token \tex_ifcase:D { \@@_unless_bad: } { - \tl_put_left:Nn \l_@@_head_tl { \reverse_if:N } - % \int_add:Nn \l_@@_head_char_int { 32 } + \tl_put_left:Ne \l_@@_head_tl + { \gtl_head_do:NN \l_@@_tmpb_gtl \exp_not:N } \@@_expand_nonmacro: } } @@ -7546,19 +7593,21 @@ \@@_prev_input_gpush: \@@_scan_toks:NN \c_false_bool \c_false_bool \@@_prev_input_gpop:N \l_@@_tmpa_tl - \tl_set_rescan:Nno \l_@@_head_tl { } \l_@@_tmpa_tl + \exp_last_unbraced:NNNo \tl_set_rescan:Nnn + \l_@@_head_tl \prg_do_nothing: \l_@@_tmpa_tl + \@@_back_input:V \@@_everyeof:w \@@_back_input:V \l_@@_head_tl - \@@_print_expansion:x { \tl_to_str:N \l_@@_tmpa_tl } + \@@_print_expansion:e { \tl_to_str:N \l_@@_tmpa_tl } } \cs_new_protected:Npn \@@_input: { \@@_prev_input_gpush:N \l_@@_head_tl \@@_scan_file_name: \@@_prev_input_gpop:N \l_@@_head_tl - \tl_set:Nx \l_@@_tmpa_tl { \tl_tail:N \l_@@_head_tl } + \tl_set:Ne \l_@@_tmpa_tl { \tl_tail:N \l_@@_head_tl } \@@_file_get:nN \l_@@_tmpa_tl \l_@@_tmpa_tl \@@_back_input:V \l_@@_tmpa_tl - \@@_print_expansion:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_expansion:e { \tl_to_str:N \l_@@_head_tl } } % \end{macrocode} % \end{macro} @@ -7579,7 +7628,7 @@ } { \@@_back_input:V \g_@@_lastnamedcs_tl - \@@_print_expansion:x + \@@_print_expansion:e { \tl_to_str:N \l_@@_head_tl = \tl_to_str:N \g_@@_lastnamedcs_tl } } } @@ -7596,7 +7645,7 @@ } } { - \@@_prev_input_silent:x + \@@_prev_input_silent:e { \@@_token_to_char:N \l_@@_head_token } \@@_csname_loop: } @@ -7606,9 +7655,11 @@ \group_begin: \@@_prev_input_get:N \l_@@_head_tl \tl_gset:No \g_@@_lastnamedcs_tl - { \cs:w \exp_after:wN \use_none:n \l_@@_head_tl } + { \cs:w \exp_after:wN \@@_get_lastnamedcs_check:N \l_@@_head_tl } \group_end: } +\cs_new:Npn \@@_get_lastnamedcs_check:N #1 + { \if_meaning:w \reverse_if:N #1 \use_i:nn \fi: } % \end{macrocode} % \end{macro} % @@ -7667,7 +7718,7 @@ { \@@_get_next: \tl_if_empty:NTF \l_@@_head_tl - { \@@_prev_input:x { \gtl_to_str:N \l_@@_head_gtl } } + { \@@_prev_input:e { \gtl_to_str:N \l_@@_head_gtl } } { \@@_prev_input:V \l_@@_head_tl } } \cs_new_protected:Npn \@@_convert_meaning:w @@ -7680,11 +7731,11 @@ \@@_prev_input_gpop:N \l_@@_prev_input_tl \exp_args:NNV \gtl_put_left:Nn \l_@@_tmpb_gtl \l_@@_prev_input_tl \@@_prev_input_gpush_gtl:N \l_@@_tmpb_gtl - \@@_print_action:x { \gtl_to_str:N \l_@@_tmpb_gtl } + \@@_print_action:e { \gtl_to_str:N \l_@@_tmpb_gtl } \@@_prev_input_gpop_gtl:N \l_@@_tmpb_gtl - \tl_set:Nx \l_@@_tmpa_tl { \gtl_head_do:NN \l_@@_head_gtl \tex_meaning:D } + \tl_set:Ne \l_@@_tmpa_tl { \gtl_head_do:NN \l_@@_head_gtl \tex_meaning:D } \@@_back_input:V \l_@@_tmpa_tl - \@@_print_expansion:x + \@@_print_expansion:e { \gtl_to_str:N \l_@@_tmpb_gtl = \tl_to_str:N \l_@@_tmpa_tl } } { @@ -7754,34 +7805,34 @@ { % \unexpanded, \detokenize \@@_scan_toks:NN \c_false_bool \c_false_bool \@@_prev_input_gpop:N \l_@@_head_tl - \@@_set_action_text:x { \tl_to_str:N \l_@@_head_tl } + \@@_set_action_text:e { \tl_to_str:N \l_@@_head_tl } } { % \the \@@_get_x_next: \@@_rescan_something_internal:n { 5 } \@@_prev_input_gpop:N \l_@@_head_tl - \@@_set_action_text:x + \@@_set_action_text:e { \tl_head:N \l_@@_head_tl => \tl_tail:N \l_@@_head_tl } - \tl_set:Nx \l_@@_head_tl + \tl_set:Ne \l_@@_head_tl { \exp_not:N \exp_not:n { \tl_tail:N \l_@@_head_tl } } } \cs_if_eq:NNTF #1 \@@_get_token_xdef: { \tl_put_right:NV \l_@@_defining_tl \l_@@_head_tl - \@@_prev_input_silent:x { \l_@@_head_tl } + \@@_prev_input_silent:e { \l_@@_head_tl } \@@_print_action: } { \cs_if_eq:NNTF #1 \@@_get_token_x: { - \@@_exp_args:NNx \gtl_set:Nn \l_@@_tmpb_gtl { \l_@@_head_tl } + \exp_args:NNe \gtl_set:Nn \l_@@_tmpb_gtl { \l_@@_head_tl } \@@_prev_input_gtl:N \l_@@_tmpb_gtl } { - \tl_set:Nx \l_@@_tmpa_tl { \exp_args:NV \exp_not:o \l_@@_head_tl } + \tl_set:Ne \l_@@_tmpa_tl { \exp_args:NV \exp_not:o \l_@@_head_tl } \@@_back_input:V \l_@@_tmpa_tl } \@@_print_expansion: @@ -7894,7 +7945,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_cond_push: { - \tl_gput_left:Nx \g_@@_if_limit_tl + \tl_gput_left:Ne \g_@@_if_limit_tl { { \int_use:N \g_@@_if_limit_int } } \int_gincr:N \g_@@_if_depth_int \int_gzero:N \g_@@_if_limit_int @@ -7904,7 +7955,7 @@ \fi: \int_gset:Nn \g_@@_if_limit_int { \tl_head:N \g_@@_if_limit_tl } - \tl_gset:Nx \g_@@_if_limit_tl + \tl_gset:Ne \g_@@_if_limit_tl { \tl_tail:N \g_@@_if_limit_tl } \int_gdecr:N \g_@@_if_depth_int } @@ -7921,12 +7972,12 @@ \tl_clear:N \l_@@_tmpa_tl \prg_replicate:nn { \g_@@_if_depth_int - #2 - 1 } { - \tl_put_right:Nx \l_@@_tmpa_tl + \tl_put_right:Ne \l_@@_tmpa_tl { { \tl_head:N \g_@@_if_limit_tl } } - \tl_gset:Nx \g_@@_if_limit_tl + \tl_gset:Ne \g_@@_if_limit_tl { \tl_tail:N \g_@@_if_limit_tl } } - \tl_gset:Nx \g_@@_if_limit_tl + \tl_gset:Ne \g_@@_if_limit_tl { \l_@@_tmpa_tl {#1} \tl_tail:N \g_@@_if_limit_tl } } } @@ -7980,7 +8031,7 @@ { 24 } { \@@_scan_font_ident: } % ifjfont, iftfont } \@@_prev_input_gpop:N \l_@@_head_tl - \@@_set_action_text:x { \tl_to_str:N \l_@@_head_tl } + \@@_set_action_text:e { \tl_to_str:N \l_@@_head_tl } \l_@@_head_tl \scan_stop: \@@_cond_true:NNNn \else: @@ -7997,7 +8048,7 @@ \cs_new_protected:Npn \@@_cond_true:NNNn #1#2#3#4 { \@@_change_if_limit:nn { 3 } {#4} % wait for else/fi - \@@_print_expansion:x { \g_@@_action_text_str = true } + \@@_print_expansion:e { \g_@@_action_text_str = true } } % \end{macrocode} % \end{macro} @@ -8009,7 +8060,7 @@ { \@@_cond_false_loop:n {#2} \@@_cond_false_common: - \@@_print_expansion:x + \@@_print_expansion:e { \g_@@_action_text_str = false ~ => ~ skip ~ to ~ \tl_to_str:N \l_@@_head_tl @@ -8069,7 +8120,7 @@ \@@_test_two_chars_get:n {#1} \@@_test_two_chars_get:n {#1} \@@_prev_input_gpop_gtl:N \l_@@_head_gtl - \@@_set_action_text:x { \gtl_to_str:N \l_@@_head_gtl } + \@@_set_action_text:e { \gtl_to_str:N \l_@@_head_gtl } \gtl_pop_left_item:NNTF \l_@@_head_gtl \l_@@_head_tl { } { } \exp_args:No \tl_if_head_eq_meaning:nNT \l_@@_head_tl \reverse_if:N { @@ -8091,14 +8142,14 @@ \int_compare:nNnT {#1} = 0 { \gtl_if_head_is_N_type:NF \l_@@_head_gtl - { \gtl_set:Nx \l_@@_head_gtl { \gtl_to_str:N \l_@@_head_gtl } } + { \gtl_set:Ne \l_@@_head_gtl { \gtl_to_str:N \l_@@_head_gtl } } } \@@_prev_input_gtl:N \l_@@_head_gtl - \@@_print_action:x { \gtl_to_str:N \l_@@_head_gtl } + \@@_print_action:e { \gtl_to_str:N \l_@@_head_gtl } } \cs_new_protected:Npn \@@_test_two_chars_gtl:N #1 { - \tl_put_right:Nx \l_@@_head_tl + \tl_put_right:Ne \l_@@_head_tl { \gtl_if_head_is_group_begin:NTF #1 { \c_group_begin_token } { @@ -8136,7 +8187,7 @@ \cs_set_eq:NN \l_@@_tmpb_token \l_@@_head_token \@@_get_next: \@@_prev_input_gpop:N \l_@@_tmpa_tl - \@@_set_action_text:x + \@@_set_action_text:e { Compare:~ \tl_to_str:N \l_@@_tmpa_tl \@@_test_ifx_str:NN \l_@@_tmpb_token \l_@@_tmpb_gtl @@ -8184,7 +8235,7 @@ \bool_if:NT \g_@@_internal_debug_bool { \iow_term:n { {\ifcase level~#1} } } \@@_scan_int: \@@_prev_input_get:N \l_@@_head_tl - \tl_set:Nx \l_@@_head_tl { \tl_tail:N \l_@@_head_tl } + \tl_set:Ne \l_@@_head_tl { \tl_tail:N \l_@@_head_tl } % ^^A does text_case_aux use prev_input_seq? \int_compare:nNnF { \l_@@_head_tl } = 0 { @@ -8194,7 +8245,7 @@ } \exp_args:No \@@_test_case_aux:nn { \l_@@_head_tl } {#1} \@@_prev_input_gpop:N \l_@@_head_tl - \@@_print_expansion:x { \tl_to_str:N \l_@@_head_tl } + \@@_print_expansion:e { \tl_to_str:N \l_@@_head_tl } } \cs_new_protected:Npn \@@_test_case_aux:nn #1#2 { @@ -8243,12 +8294,12 @@ { \@@_pass_text_empty: } { \@@_input_gpop:N \l_@@_tmpb_gtl - \@@_set_action_text:x + \@@_set_action_text:e { Conditional:~ \tl_to_str:N \l_@@_head_tl \gtl_to_str:N \l_@@_tmpb_gtl } - \@@_prev_input:x + \@@_prev_input:e { \gtl_if_tl:NTF \l_@@_tmpb_gtl { \gtl_head:N \l_@@_tmpb_gtl } @@ -8288,7 +8339,7 @@ \int_compare:nNnF \l_@@_head_char_int = 2 { \@@_fi_or_else_loop: - \@@_set_action_text:x + \@@_set_action_text:e { \g_@@_action_text_str \c_space_tl => ~ skip ~ to ~ \tl_to_str:N \l_@@_head_tl @@ -8326,7 +8377,7 @@ \tl_new:N \l_@@_print_tl \sys_if_engine_luatex:TF { - \cs_new_protected:Npx \@@_print_normalize_null: + \cs_new_protected:Npe \@@_print_normalize_null: { \tl_replace_all:Nnn \exp_not:N \l_@@_print_tl { \char_generate:nn { 0 } { 12 } } @@ -8338,21 +8389,40 @@ % \end{variable} % \end{macro} % -% \begin{macro}{\@@_print:n, \@@_print:x, \@@_log:n} +% \begin{macro}{\@@_print:n, \@@_print:e, \@@_log:n} % \begin{macrocode} \cs_new_protected:Npn \@@_print:n #1 { \tl_set:Nn \l_@@_print_tl {#1} \@@_print_normalize_null: - \@@_exp_args:Nx \iow_term:n { \l_@@_print_tl } + \iow_term:e { \l_@@_print_tl } + \tl_if_empty:NF \g_@@_output_file_tl + { \iow_now:Ne \g_@@_iow { \l_@@_print_tl } } } -\cs_new_protected:Npn \@@_print:x - { \@@_exp_args:Nx \@@_print:n } +\cs_generate_variant:Nn \@@_print:n { e } \cs_new_protected:Npn \@@_log:n #1 { \tl_set:Nn \l_@@_print_tl {#1} \@@_print_normalize_null: - \@@_exp_args:Nx \iow_log:n { \l_@@_print_tl } + \tl_if_empty:NTF \g_@@_output_file_tl + { \iow_log:e { \l_@@_print_tl } } + { \iow_now:Ne \g_@@_iow { \l_@@_print_tl } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_print_step:n} +% Steps are printed or not according to the option value, unaffected +% by a prompt such as |s10|. +% \begin{macrocode} +\cs_new_protected:Npn \@@_print_step:n #1 + { + \int_compare:nNnF \g_@@_online_int < 0 + { + \int_compare:nNnTF \g_@@_online_int = 0 + { \@@_log:n {#1} } + { \@@_print:n {#1} } + } } % \end{macrocode} % \end{macro} @@ -8361,13 +8431,14 @@ % The message to be printed should come already detokenized, as~|#2|. % It will be wrapped to 80 characters per line, with~|#1| before each % line. The message is properly suppressed (or sent only to the log) -% according to \cs{g_@@_online_int}. +% according to \cs{g_@@_current_online_int} so as to be sensitive to +% the prompt. % \begin{macrocode} \cs_new_protected:Npn \@@_print_message:nn #1 #2 { - \int_compare:nNnF \g_@@_online_int < 0 + \int_compare:nNnF \g_@@_current_online_int < 0 { - \int_compare:nNnTF \g_@@_online_int = 0 + \int_compare:nNnTF \g_@@_current_online_int = 0 { \iow_wrap:nnnN { #1 #2 } { #1 } { } \@@_log:n } { \iow_wrap:nnnN { #1 #2 } { #1 } { } \@@_print:n } } @@ -8375,13 +8446,13 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_set_action_text:x} +% \begin{macro}{\@@_set_action_text:e} % \begin{macrocode} -\cs_new_protected:Npn \@@_set_action_text:x #1 +\cs_new_protected:Npn \@@_set_action_text:e #1 { \group_begin: \@@_set_escapechar:n { 92 } - \str_gset:Nx \g_@@_action_text_str {#1} + \str_gset:Ne \g_@@_action_text_str {#1} \group_end: } % \end{macrocode} @@ -8391,7 +8462,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_set_action_text: { - \@@_set_action_text:x + \@@_set_action_text:e { \tl_to_str:N \l_@@_head_tl \tl_if_single_token:VT \l_@@_head_tl @@ -8408,7 +8479,7 @@ \group_begin: \@@_set_escapechar:n { 92 } \tl_use:N \g_@@_before_print_state_tl - \int_compare:nNnT \g_@@_online_int > 0 + \int_compare:nNnF \g_@@_current_online_int < 0 { \@@_print_state_output: \@@_print_state_prev: @@ -8426,14 +8497,14 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_print_state_output: { - \@@_exp_args:Nx \@@_print_state_output:n + \exp_args:Ne \@@_print_state_output:n { \gtl_to_str:N \g_@@_output_gtl } } \cs_new_protected:Npn \@@_print_state_output:n #1 { \tl_if_empty:nF {#1} { - \@@_print_message:nn { <| ~ } + \@@_print_message:nn { <| ~ } % | { \@@_str_truncate_left:nn {#1} { \g_@@_max_output_int } } } } @@ -8445,7 +8516,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_print_state_prev: { - \seq_set_map_x:NNn \l_@@_tmpa_seq \g_@@_prev_input_seq + \seq_set_map_e:NNn \l_@@_tmpa_seq \g_@@_prev_input_seq { \@@_to_str:Nn ##1 } \seq_remove_all:Nn \l_@@_tmpa_seq { } \seq_if_empty:NTF \l_@@_tmpa_seq @@ -8467,12 +8538,12 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_print_state_input: { - \@@_exp_args:Nx \@@_print_state_input:n + \exp_args:Ne \@@_print_state_input:n { \@@_input_to_str: } } \cs_new_protected:Npn \@@_print_state_input:n #1 { - \@@_print_message:nn { |> ~ } + \@@_print_message:nn { |> ~ } % | { \@@_str_truncate_right:nn {#1} { \g_@@_max_input_int } } } % \end{macrocode} @@ -8496,29 +8567,29 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_print_action:, \@@_print_action:x, \@@_print_assignment:, \@@_print_assignment:x, \@@_print_expansion:, \@@_print_expansion:x, \@@_print_action_aux:N} +% \begin{macro}{\@@_print_action:, \@@_print_action:e, \@@_print_assignment:, \@@_print_assignment:e, \@@_print_expansion:, \@@_print_expansion:e, \@@_print_action_aux:N} % Some of these commands are currently synonyms but we may decide to % make some options act differently on them. % \begin{macrocode} \cs_new_protected:Npn \@@_print_action: { \@@_print_action_aux:N \g_@@_trace_other_bool } -\cs_new_protected:Npn \@@_print_action:x #1 +\cs_new_protected:Npn \@@_print_action:e #1 { - \@@_set_action_text:x {#1} + \@@_set_action_text:e {#1} \@@_print_action: } \cs_new_protected:Npn \@@_print_assignment: { \@@_print_action_aux:N \g_@@_trace_assigns_bool } -\cs_new_protected:Npn \@@_print_assignment:x #1 +\cs_new_protected:Npn \@@_print_assignment:e #1 { - \@@_set_action_text:x {#1} + \@@_set_action_text:e {#1} \@@_print_assignment: } \cs_new_protected:Npn \@@_print_expansion: { \@@_print_action_aux:N \g_@@_trace_expansion_bool } -\cs_new_protected:Npn \@@_print_expansion:x #1 +\cs_new_protected:Npn \@@_print_expansion:e #1 { - \@@_set_action_text:x {#1} + \@@_set_action_text:e {#1} \@@_print_expansion: } \cs_new_protected:Npn \@@_print_action_aux:N #1 @@ -8527,7 +8598,7 @@ \int_gincr:N \g_@@_step_int \bool_if:NT #1 { - \@@_print:x + \exp_args:Ne \@@_print_step:n { [===== \bool_if:NT \g_@@_number_steps_bool @@ -8549,11 +8620,12 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_just_print_assigned_token:, \@@_print_assigned_token:, \@@_print_assigned_register:} +% \begin{macro}{\@@_just_print_assigned_token:, \@@_print_assigned_token:, \@@_print_assigned_register:, \@@_print_assigned_parshape:, \@@_print_assigned_set_shape:} +% \begin{macro}[EXP]{\@@_print_assigned_set_shape_aux:n} % \begin{macrocode} \cs_new_protected:Npn \@@_just_print_assigned_token: { - \@@_print_assignment:x + \@@_print_assignment:e { Set~ \exp_after:wN \token_to_str:N \l_@@_defined_tl = \exp_after:wN \token_to_meaning:N \l_@@_defined_tl @@ -8565,23 +8637,52 @@ \@@_just_print_assigned_token: \@@_omit_after_assignment:w } +\cs_new:Npn \@@_print_assigned_aux_name: + { + Set~ \exp_after:wN \token_to_str:N \l_@@_defined_tl + \tl_if_single:NT \l_@@_defined_tl + { ( \exp_after:wN \token_to_meaning:N \l_@@_defined_tl ) } + } \cs_new_protected:Npn \@@_print_assigned_register: { \@@_after_assignment: - \@@_exp_args:Nx \@@_print_assignment:x + \exp_args:Ne \@@_print_assignment:e % needed to stringify a \toks { - \exp_not:n - { - Set~ \exp_after:wN \token_to_str:N \l_@@_defined_tl - \tl_if_single:NT \l_@@_defined_tl - { ( \exp_after:wN \token_to_meaning:N \l_@@_defined_tl ) } - } + \exp_not:N \@@_print_assigned_aux_name: = \exp_not:N \tl_to_str:n { \@@_the:w \l_@@_defined_tl } } \@@_omit_after_assignment:w } +\cs_new_protected:Npn \@@_print_assigned_parshape: + { + \@@_after_assignment: + \tl_set:Nn \l_@@_tmpa_tl { \tex_parshapedimen:D } + \@@_print_assignment:e + { + \@@_print_assigned_aux_name: = \@@_the:w \l_@@_defined_tl + \int_step_function:nN { 2 * \l_@@_defined_tl } + \@@_print_assigned_set_shape_aux:n + } + \@@_omit_after_assignment:w + } +\cs_new_protected:Npn \@@_print_assigned_set_shape: + { + \@@_after_assignment: + \tl_set_eq:NN \l_@@_tmpa_tl \l_@@_defined_tl + \@@_print_assignment:e + { + \@@_print_assigned_aux_name: + = \@@_the:w \l_@@_defined_tl 0 \exp_stop_f: + \int_step_function:nN { \l_@@_defined_tl 0 } + \@@_print_assigned_set_shape_aux:n + } + \@@_omit_after_assignment:w + } +\cs_new:Npn \@@_print_assigned_set_shape_aux:n #1 + { ~ \@@_the:w \l_@@_tmpa_tl #1 \exp_stop_f: } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\@@_print_welcome:} % Welcome message. @@ -8659,7 +8760,7 @@ \clist_gpop:NN \g_@@_prompt_input_clist \l_@@_tmpa_tl \group_begin: \@@_set_escapechar:n { 92 } - \@@_print:x + \@@_print:e { \bool_if:NT \g_@@_explicit_prompt_bool { Your~input= } \tl_to_str:N \l_@@_tmpa_tl @@ -8672,12 +8773,12 @@ { \tl_if_empty:nF {#1} { - \@@_exp_args:Nx \str_case:nnF { \tl_head:n {#1} } + \str_case:enF { \tl_head:n {#1} } { { m } { \@@_print_meaning: \@@_prompt_aux: } { q } { - \int_gset:Nn \g_@@_online_int { -1 } + \int_gset:Nn \g_@@_current_online_int { -1 } \int_gzero:N \g_@@_nonstop_int } { x } @@ -8693,10 +8794,10 @@ { s } { \@@_prompt_scan_int:nn {#1} \@@_prompt_silent_steps:n } { o } { \@@_prompt_scan_int:nn {#1} - { \int_gset:Nn \g_@@_online_int } } + { \int_gset:Nn \g_@@_current_online_int } } { C } { - \@@_exp_args:Nx \use:n + \use:e { \tl_gset_rescan:Nnn \exp_not:N \g_@@_tmpc_tl { \exp_not:N \ExplSyntaxOn } { \tl_tail:n {#1} } @@ -8706,7 +8807,8 @@ \group_insert_after:N \g_@@_tmpc_tl \group_insert_after:N \@@_prompt: } - { | } { \@@_prompt_scan_int:nn {#1} + { | } % | + { \@@_prompt_scan_int:nn {#1} \@@_prompt_vert:n } { u } { \@@_prompt_until:n {#1} } { a } { \@@_prompt_all: } @@ -8744,10 +8846,10 @@ { \int_compare:nNnF {#1} < 0 { - \int_gset:Nn \g_@@_online_int { -1 } + \int_gset:Nn \g_@@_current_online_int { -1 } \tl_gset:Nn \g_@@_before_prompt_tl { - \int_gset:Nn \g_@@_online_int { 1 } + \int_gset_eq:NN \g_@@_current_online_int \g_@@_online_int \tl_gclear:N \g_@@_before_prompt_tl } \int_gset:Nn \g_@@_nonstop_int {#1} @@ -8761,7 +8863,7 @@ } \cs_new_protected:Npn \@@_prompt_vert:Nn #1#2 { - \int_gset:Nn \g_@@_online_int { -1 } + \int_gset:Nn \g_@@_current_online_int { -1 } \tl_gset:Nf \g_@@_before_print_state_tl { \exp_args:NNf \exp_stop_f: \int_compare:nNnTF @@ -8772,14 +8874,14 @@ { \int_max:nn { \g_@@_nonstop_int } { 2 } } } { - \int_gset:Nn \g_@@_online_int { 1 } + \int_gset_eq:NN \g_@@_current_online_int \g_@@_online_int \tl_gclear:N \g_@@_before_print_state_tl } } } \cs_new_protected:Npn \@@_prompt_all: { - \tl_gset:Nx \g_@@_tmpc_tl + \tl_gset:Ne \g_@@_tmpc_tl { \exp_not:n { @@ -8808,12 +8910,12 @@ \tl_new:N \g_@@_until_tl \cs_new_protected:Npn \@@_prompt_until:n #1 { - \tl_gset:Nx \g_@@_until_tl { \tl_tail:n {#1} } - \int_gset:Nn \g_@@_online_int { -1 } + \tl_gset:Ne \g_@@_until_tl { \tl_tail:n {#1} } + \int_gset:Nn \g_@@_current_online_int { -1 } \tl_gset:Nn \g_@@_before_print_state_tl { \@@_input_get_left:N \l_@@_tmpa_tl - \@@_exp_args:Nx \use:n + \use:e { \exp_not:N \tl_if_in:nnTF { \exp_not:N \@@:nn \tl_to_str:N \l_@@_tmpa_tl } @@ -8821,7 +8923,7 @@ } { \int_gzero:N \g_@@_nonstop_int - \int_gset:Nn \g_@@_online_int { 1 } + \int_gset_eq:NN \g_@@_current_online_int \g_@@_online_int \tl_gclear:N \g_@@_before_print_state_tl } { @@ -8843,7 +8945,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_error:nnnnn, \@@_error:nxxxx} +% \begin{macro}{\@@_error:nnnnn, \@@_error:neeee} % Errors within a group to make sure that none of the \pkg{l3msg} % variables (or others) that may be currently in use in the code being % debugged are modified. @@ -8854,10 +8956,10 @@ \msg_error:nnnnnn { unravel } {#1} {#2} {#3} {#4} {#5} \group_end: } -\cs_new_protected:Npn \@@_error:nxxxx #1#2#3#4#5 +\cs_new_protected:Npn \@@_error:neeee #1#2#3#4#5 { \group_begin: - \msg_error:nnxxxx { unravel } {#1} {#2} {#3} {#4} {#5} + \msg_error:nneeee { unravel } {#1} {#2} {#3} {#4} {#5} \group_end: } % \end{macrocode} @@ -8880,12 +8982,11 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_tex_error:nn #1#2 { - \group_begin: - \msg_error:nnxxx { unravel } { tex-error } + \@@_error:neeee { tex-error } { \tl_to_str:n {#2} } { \use:c { @@_tex_msg_error_#1: } } { \use:c { @@_tex_msg_help_#1: } } - \group_end: + { } } \cs_generate_variant:Nn \@@_tex_error:nn { nV } % \end{macrocode} @@ -8898,7 +8999,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_tex_fatal_error:nn #1#2 { - \@@_error:nxxxx { tex-fatal } + \@@_error:neeee { tex-fatal } { \tl_to_str:n {#2} } { \use:c { @@_tex_msg_error_#1: } } { \use:c { @@_tex_msg_help_#1: } } @@ -8925,6 +9026,10 @@ max-input .int_gset:N = \g_@@_default_max_input_int , number-steps .bool_gset:N = \g_@@_default_number_steps_bool , online .int_gset:N = \g_@@_default_online_int , + output-file .code:n = { + \int_gzero:N \g_@@_default_online_int + \tl_gset:Nn \g_@@_default_output_file_tl {#1} + } , prompt-input .code:n = \@@_prompt_input:Nn \g_@@_default_prompt_input_clist {#1} , trace-assigns .bool_gset:N = \g_@@_default_trace_assigns_bool , @@ -8941,6 +9046,10 @@ max-input .int_gset:N = \g_@@_max_input_int , number-steps .bool_gset:N = \g_@@_number_steps_bool , online .int_gset:N = \g_@@_online_int , + output-file .code:n = { + \int_gzero:N \g_@@_online_int + \tl_gset:Nn \g_@@_output_file_tl {#1} + } , prompt-input .code:n = \@@_prompt_input:Nn \g_@@_prompt_input_clist {#1} , trace-assigns .bool_gset:N = \g_@@_trace_assigns_bool , @@ -9040,7 +9149,7 @@ \cs_new_protected:Npn \unravel_get:nnN #1#2#3 { \unravel:nn {#1} {#2} - \tl_set:Nx #3 { \gtl_left_tl:N \g_@@_output_gtl } + \tl_set:Ne #3 { \gtl_left_tl:N \g_@@_output_gtl } } % \end{macrocode} % \end{macro} @@ -9056,6 +9165,7 @@ \bool_gset_eq:NN \g_@@_internal_debug_bool \g_@@_default_internal_debug_bool \bool_gset_eq:NN \g_@@_number_steps_bool \g_@@_default_number_steps_bool \int_gset_eq:NN \g_@@_online_int \g_@@_default_online_int + \tl_gset_eq:NN \g_@@_output_file_tl \g_@@_default_output_file_tl \clist_gset_eq:NN \g_@@_prompt_input_clist \g_@@_default_prompt_input_clist \bool_gset_eq:NN \g_@@_trace_assigns_bool \g_@@_default_trace_assigns_bool \bool_gset_eq:NN \g_@@_trace_expansion_bool \g_@@_default_trace_expansion_bool @@ -9065,6 +9175,8 @@ \int_gset_eq:NN \g_@@_max_output_int \g_@@_default_max_output_int \int_gset_eq:NN \g_@@_max_input_int \g_@@_default_max_input_int \int_gzero:N \g_@@_nonstop_int + \tl_gclear:N \g_@@_before_print_state_tl + \tl_gclear:N \g_@@_before_prompt_tl } % \end{macrocode} % \end{macro} @@ -9076,6 +9188,13 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_init_vars: { + \int_gset_eq:NN \g_@@_current_online_int \g_@@_online_int + \tl_if_eq:NNF \g_@@_output_file_tl \g_@@_current_output_file_tl + { + \iow_close:N \g_@@_iow + \iow_open:Nn \g_@@_iow \g_@@_output_file_tl + \tl_gset_eq:NN \g_@@_current_output_file_tl \g_@@_output_file_tl + } \seq_gclear:N \g_@@_prev_input_seq \gtl_gclear:N \g_@@_output_gtl \int_gzero:N \g_@@_step_int @@ -9125,10 +9244,10 @@ { \@@_set_action_text: \bool_if:NT \g_@@_internal_debug_bool - { \@@_exp_args:Nx \iow_term:n { Cmd:~\int_to_arabic:n { \l_@@_head_cmd_int } } } + { \iow_term:e { Cmd:~\int_to_arabic:n { \l_@@_head_cmd_int } } } \cs_if_exist_use:cF { @@_cmd_ \int_use:N \l_@@_head_cmd_int : } - { \@@_error:nxxxx { internal } { unknown-command } { } { } { } } + { \@@_error:neeee { internal } { unknown-command } { } { } { } } } % \end{macrocode} % \end{macro} @@ -9161,12 +9280,12 @@ \cs_new_protected:Npn \@@_final_conditionals: { \group_begin: - \msg_warning:nnx { unravel } { dangling-conditionals } + \msg_warning:nne { unravel } { dangling-conditionals } { \tl_count:N \g_@@_if_limit_tl } \group_end: \tl_greverse:N \g_@@_if_limit_tl \tl_gput_right:NV \g_@@_if_limit_tl \g_@@_if_limit_int - \tl_gset:Nx \g_@@_if_limit_tl { \tl_tail:N \g_@@_if_limit_tl } % remove the {0} + \tl_gset:Ne \g_@@_if_limit_tl { \tl_tail:N \g_@@_if_limit_tl } % remove the {0} \prg_replicate:nn { \tl_count:N \g_@@_if_limit_tl } { \fi: } \tl_map_function:NN \g_@@_if_limit_tl \@@_final_cond_aux:n } diff --git a/Master/texmf-dist/tex/latex/unravel/unravel.sty b/Master/texmf-dist/tex/latex/unravel/unravel.sty index 97037b2a7f0..d2492423e0b 100644 --- a/Master/texmf-dist/tex/latex/unravel/unravel.sty +++ b/Master/texmf-dist/tex/latex/unravel/unravel.sty @@ -11,7 +11,7 @@ %% Communicate any suggestions for changing this package %% to Bruno Le Floch (blflatex+unravel@gmail.com). %% -%% File: unravel.dtx Copyright (C) 2013, 2015, 2018-2019, 2021 Bruno Le Floch +%% File: unravel.dtx Copyright (C) 2013, 2015, 2018-2019, 2021, 2024 Bruno Le Floch %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -146,14 +146,12 @@ \newlinechar = 10 ~ } \expandafter \endgroup \__unravel_setup_latexe: -\RequirePackage{expl3,xparse}[2021/01/01] -\RequirePackage{gtl}[2018/12/28] -\csname cs_if_exist:cF\endcsname{str_range:nnn}{\RequirePackage{l3str}} +\RequirePackage{gtl}[2024/01/04] \csname use:n\endcsname {% \csname __unravel_setup_restore:\endcsname \ProvidesExplPackage - {unravel} {2021/05/11} {0.3a} {Watching TeX digest tokens}% + {unravel} {2024/01/05} {0.3c} {Watching TeX digest tokens}% \csname __unravel_setup_unravel:\endcsname }% \cs_gset:Npn \group_align_safe_begin: @@ -199,17 +197,6 @@ \exp_args:Noo \tl_if_in:nnTF {#1} {#2} { \group_end: #3 } { \group_end: #4 } } -\tl_new:N \l__unravel_exp_tl -\cs_new_protected:Npn \__unravel_exp_args:Nx #1#2 - { - \cs_set_nopar:Npx \l__unravel_exp_tl { \exp_not:N #1 {#2} } - \l__unravel_exp_tl - } -\cs_new_protected:Npn \__unravel_exp_args:NNx #1#2#3 - { - \cs_set_nopar:Npx \l__unravel_exp_tl { \exp_not:N #1 \exp_not:N #2 {#3} } - \l__unravel_exp_tl - } \cs_new_protected:Npn \__unravel_tmp:w { } \cs_set_protected:Npn \__unravel_tmp:w #1 { @@ -224,7 +211,7 @@ \cs_new_protected:Npn \__unravel_file_get_aux:wN ##1 #1 ##2 { \group_end: - \tl_set:Nx ##2 + \tl_set:Ne ##2 { \exp_not:o {##1} \exp_not:V \__unravel_everyeof:w } } } @@ -257,7 +244,7 @@ \cs_new:Npn \__unravel_use_ii_i:nn #1#2 { #2 #1 } \cs_new_protected:Npn \__unravel_prompt_input:Nn #1#2 { - \clist_gset:Nx #1 + \clist_gset:Ne #1 { \__unravel_prompt_input:w \prg_do_nothing: #2 , \q__unravel_recursion_tail , } } \cs_new:Npn \__unravel_prompt_input:w #1 , @@ -342,7 +329,7 @@ { \group_begin: \char_set_active_eq:nN {#1} \scan_stop: - \use:x + \use:e { \group_end: \exp_not:n {#2} { \char_generate:nn {#1} { 13 } } @@ -387,7 +374,7 @@ { TF } { \group_begin: - \__unravel_exp_args:Nx \char_set_lccode:nn + \exp_args:Ne \char_set_lccode:nn { ` \exp_args:No \str_head:n { \token_to_str:N #1 } } { ` Z } \tex_lowercase:D { \tl_if_eq:nnTF {#1} } { Z } @@ -402,7 +389,7 @@ { \group_begin: \__unravel_set_escapechar:n { 92 } - \tl_set:Nx \l__unravel_tmpa_tl + \tl_set:Ne \l__unravel_tmpa_tl { \exp_args:No \str_tail:n { \token_to_str:N #1 } } \tl_if_empty:NTF \l__unravel_tmpa_tl { @@ -457,7 +444,7 @@ \cs_new_protected:Npn \__unravel_prev_input_gpush_gtl:N { \__unravel_prev_input_gpush_aux:NN G } \cs_new_protected:Npn \__unravel_prev_input_gpush_aux:NN #1#2 - { \seq_gput_right:Nx \g__unravel_prev_input_seq { #1 { \exp_not:o {#2} } } } + { \seq_gput_right:Ne \g__unravel_prev_input_seq { #1 { \exp_not:o {#2} } } } \tl_new:N \l__unravel_prev_aux_tl \cs_new_protected:Npn \__unravel_prev_input_get:N { \__unravel_prev_input_aux:NNN \seq_get_right:NN T } @@ -475,7 +462,7 @@ { \token_if_eq_meaning:NNTF #1#3 { \tl_set:Nn } - { \msg_error:nnnnnn { unravel } { prev-input } {#1} {#3} } + { \__unravel_error:nnnnn { prev-input } {#1} {#3} } #2 } \cs_new_protected:Npn \__unravel_prev_input_silent:n #1 @@ -484,17 +471,13 @@ \tl_put_right:Nn \l__unravel_prev_input_tl {#1} \__unravel_prev_input_gpush:N \l__unravel_prev_input_tl } -\cs_generate_variant:Nn \__unravel_prev_input_silent:n { V } -\cs_new_protected:Npn \__unravel_prev_input_silent:x - { \__unravel_exp_args:Nx \__unravel_prev_input_silent:n } +\cs_generate_variant:Nn \__unravel_prev_input_silent:n { V , e } \cs_new_protected:Npn \__unravel_prev_input:n #1 { \__unravel_prev_input_silent:n {#1} - \__unravel_print_action:x { \tl_to_str:n {#1} } + \__unravel_print_action:e { \tl_to_str:n {#1} } } -\cs_generate_variant:Nn \__unravel_prev_input:n { V } -\cs_new_protected:Npn \__unravel_prev_input:x - { \__unravel_exp_args:Nx \__unravel_prev_input:n } +\cs_generate_variant:Nn \__unravel_prev_input:n { V , e } \cs_new_protected:Npn \__unravel_prev_input_gtl:N #1 { \__unravel_prev_input_gpop_gtl:N \l__unravel_prev_input_gtl @@ -517,16 +500,20 @@ { \__unravel_prev_input_gpop:N \l__unravel_head_tl \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl - \tl_set:Nx #4 { #1 { \l__unravel_tmpa_tl #2 \l__unravel_head_tl #3 } } + \tl_set:Ne #4 { #1 { \l__unravel_tmpa_tl #2 \l__unravel_head_tl #3 } } } +\iow_new:N \g__unravel_iow +\tl_new:N \g__unravel_current_output_file_tl \tl_new:N \g__unravel_before_print_state_tl \tl_new:N \g__unravel_before_prompt_tl \int_new:N \l__unravel_prompt_tmpa_int \int_new:N \g__unravel_nonstop_int +\int_new:N \g__unravel_current_online_int \bool_new:N \g__unravel_default_explicit_prompt_bool \bool_new:N \g__unravel_default_internal_debug_bool \bool_new:N \g__unravel_default_number_steps_bool \int_new:N \g__unravel_default_online_int +\tl_new:N \g__unravel_default_output_file_tl \clist_new:N \g__unravel_default_prompt_input_clist \bool_new:N \g__unravel_default_trace_assigns_bool \bool_new:N \g__unravel_default_trace_expansion_bool @@ -542,6 +529,7 @@ \bool_new:N \g__unravel_internal_debug_bool \bool_new:N \g__unravel_number_steps_bool \int_new:N \g__unravel_online_int +\tl_new:N \g__unravel_output_file_tl \clist_new:N \g__unravel_prompt_input_clist \bool_new:N \g__unravel_trace_assigns_bool \bool_new:N \g__unravel_trace_expansion_bool @@ -591,8 +579,8 @@ \bool_new:N \g__unravel_name_in_progress_bool \gtl_new:N \l__unravel_after_group_gtl \group_begin: - \cs_set:Npx \__unravel_tmp:w #1 { \c_hash_str #1 } - \tl_const:Nx \c__unravel_parameters_tl + \cs_set_nopar:Npe \__unravel_tmp:w #1 { \c_hash_str #1 } + \tl_const:Ne \c__unravel_parameters_tl { ^ \tl_map_function:nN { 123456789 } \__unravel_tmp:w } \group_end: \int_new:N \g__unravel_val_level_int @@ -609,13 +597,13 @@ \tl_const:Nn \c__unravel_over_tl { / } \tl_const:Nn \c__unravel_lq_tl { ` } \tl_const:Nn \c__unravel_rq_tl { ' } -\tl_const:Nn \c__unravel_dq_tl { " } +\tl_const:Nn \c__unravel_dq_tl { " } %" \tl_const:Nn \c__unravel_lp_tl { ( } \tl_const:Nn \c__unravel_rp_tl { ) } \tl_const:Nn \c__unravel_eq_tl { = } \tl_const:Nn \c__unravel_comma_tl { , } \tl_const:Nn \c__unravel_point_tl { . } -\gtl_const:Nx \c__unravel_frozen_relax_gtl { \if_int_compare:w 0 = 0 \fi: } +\gtl_const:Ne \c__unravel_frozen_relax_gtl { \if_int_compare:w 0 = 0 \fi: } \int_new:N \g__unravel_mag_set_int \cs_new_protected:Npn \__unravel_prepare_mag: { @@ -639,7 +627,7 @@ \cs_new:Npn \__unravel_tex_use:n #1 { \int_use:c { c__unravel_tex_#1_int } } \cs_new_protected:Npn \__unravel_tex_primitive:nnn #1#2#3 { - \tl_const:cx { c__unravel_tex_#1_tl } + \tl_const:ce { c__unravel_tex_#1_tl } { { \__unravel_tex_use:n {#2} } {#3} } } \cs_new_protected:Npn \__unravel_tex_primitive_pdf:nnn #1#2#3 @@ -1342,7 +1330,7 @@ \__unravel_tex_primitive:nnn { expanded } { convert } { 34 } \sys_if_engine_luatex:T { \__unravel_tex_primitive:nnn { luaescapestring } { convert } { 35 } } -\sys_if_engine_xetex:T +\bool_if:nT { \sys_if_engine_xetex_p: || \sys_if_engine_ptex_p: || \sys_if_engine_uptex_p: } { \__unravel_tex_primitive:nnn { Ucharcat } { convert } { 40 } } @@ -1371,7 +1359,7 @@ \gtl_head_do:NN \l__unravel_head_gtl \__unravel_get_next_aux:w \gtl_if_tl:NTF \l__unravel_head_gtl { - \tl_set:Nx \l__unravel_head_tl + \tl_set:Ne \l__unravel_head_tl { \gtl_head:N \l__unravel_head_gtl } \token_if_eq_meaning:NNT \l__unravel_head_token \__unravel_special_relax: @@ -1388,7 +1376,7 @@ \tl_if_eq:onTF { \l__unravel_head_tl } { \__unravel_unravel_marker: } { \__unravel_get_next_marker: } { - \__unravel_exp_args:NNx \use:nn \__unravel_notexpanded_test:w + \exp_args:NNe \use:nn \__unravel_notexpanded_test:w { \scan_stop: \exp_after:wN \cs_to_str:N \l__unravel_head_tl Z } \q_mark \__unravel_notexpanded_expand:n #1 Z \q_mark \use_none:n @@ -1399,12 +1387,12 @@ ##1 #1 ##2 Z \q_mark ##3##4 \q_stop { ##3 {##2} } } -\exp_args:Nx \__unravel_tmp:w { \scan_stop: \tl_to_str:n { notexpanded: } } +\exp_args:Ne \__unravel_tmp:w { \scan_stop: \tl_to_str:n { notexpanded: } } \group_begin: \char_set_catcode_active:n { 0 } \cs_new_protected:Npn \__unravel_notexpanded_expand:n #1 { - \__unravel_exp_args:Nx \tl_if_empty:nTF { \str_tail:n {#1} } + \exp_args:Ne \tl_if_empty:nTF { \str_tail:n {#1} } { \group_begin: \char_set_lccode:nn { 0 } { `#1 } @@ -1430,14 +1418,14 @@ { \__unravel_get_next: \tl_if_eq:onTF \l__unravel_head_tl { \__unravel:nn } - { \__unravel_error:nxxxx { nested-unravel } { } { } { } { } } - { \__unravel_error:nxxxx { internal } { marker~unknown } { } { } { } } + { \__unravel_error:neeee { nested-unravel } { } { } { } { } } + { \__unravel_error:neeee { internal } { marker~unknown } { } { } { } } \__unravel_input_gpop_item:NF \l__unravel_argi_tl - { \__unravel_error:nxxxx { internal } { marker~1 } { } { } { } } + { \__unravel_error:neeee { internal } { marker~1 } { } { } { } } \__unravel_input_gpop_item:NF \l__unravel_argii_tl - { \__unravel_error:nxxxx { internal } { marker~2 } { } { } { } } + { \__unravel_error:neeee { internal } { marker~2 } { } { } { } } \exp_args:Nno \keys_set:nn { unravel } \l__unravel_argi_tl - \__unravel_exp_args:Nx \__unravel_back_input:n + \exp_args:Ne \__unravel_back_input:n { \exp_not:N \exp_not:n { \exp_not:o \l__unravel_argii_tl } } \__unravel_get_next: } @@ -1467,22 +1455,22 @@ } \cs_new_protected:Npn \__unravel_set_cmd_aux_meaning: { - \tl_set:Nx \l__unravel_head_meaning_tl + \tl_set:Ne \l__unravel_head_meaning_tl { \exp_after:wN \__unravel_strip_escape:w \token_to_meaning:N \l__unravel_head_token \tl_to_str:n { : } } - \tl_set:Nx \l__unravel_head_meaning_tl + \tl_set:Ne \l__unravel_head_meaning_tl { \exp_after:wN \__unravel_set_cmd_aux_meaning:w \l__unravel_head_meaning_tl \q_stop } } -\use:x +\use:e { \cs_new:Npn \exp_not:N \__unravel_set_cmd_aux_meaning:w - ##1 \token_to_str:N : ##2 \exp_not:N \q_stop {##1} + #1 \token_to_str:N : #2 \exp_not:N \q_stop {#1} } \cs_new_protected:Npn \__unravel_set_cmd_aux_primitive:nTF #1#2 { @@ -1514,7 +1502,7 @@ { \tl_to_str:n { xpandable~luacall } } { } { - \__unravel_error:nxxxx { unknown-primitive } + \__unravel_error:neeee { unknown-primitive } { \l__unravel_head_meaning_tl } { } { } { } } } @@ -1524,7 +1512,7 @@ { \exp_last_unbraced:NV \__unravel_set_cmd_aux_primitive:nn \c__unravel_tex_relax_tl - \__unravel_error:nxxxx { unknown-primitive } + \__unravel_error:neeee { unknown-primitive } { \l__unravel_head_meaning_tl } { } { } { } } } @@ -1540,7 +1528,7 @@ } \cs_new_protected:Npn \__unravel_set_cmd_aux_numeric: { - \tl_set:Nx \l__unravel_tmpa_tl + \tl_set:Ne \l__unravel_tmpa_tl { \exp_after:wN \__unravel_set_cmd_aux_numeric:N \l__unravel_head_meaning_tl + 0 @@ -1580,13 +1568,13 @@ } \cs_new_protected:Npn \__unravel_set_cmd_aux_char: { - \tl_set:Nx \l__unravel_head_meaning_tl + \tl_set:Ne \l__unravel_head_meaning_tl { \token_to_meaning:N \l__unravel_head_token } \token_if_eq_catcode:NNT \l__unravel_head_token \c_catcode_other_token { \tl_set:Nn \l__unravel_head_meaning_tl { other~ } } \exp_after:wN \__unravel_set_cmd_aux_char:w \l__unravel_head_meaning_tl \q_stop - \__unravel_exp_args:NNx \int_set:Nn \l__unravel_head_char_int + \exp_args:NNe \int_set:Nn \l__unravel_head_char_int { ` \__unravel_token_to_char:N \l__unravel_head_token } } \cs_new_protected:Npn \__unravel_set_cmd_aux_char:w #1 ~ #2 \q_stop @@ -1632,8 +1620,8 @@ { \gtl_if_head_is_N_type:NT #1 { - \tl_set:Nx \l__unravel_input_tmpa_tl { \gtl_left_tl:N #1 } - \__unravel_exp_args:NNx \use:nn + \tl_set:Ne \l__unravel_input_tmpa_tl { \gtl_left_tl:N #1 } + \exp_args:NNe \use:nn \__unravel_input_split_auxii:N { \tl_head:N \l__unravel_input_tmpa_tl } } @@ -1689,7 +1677,7 @@ { \int_compare:nNnF {#1} = 0 { - \tl_set:Nx \l__unravel_input_get_left_tl + \tl_set:Ne \l__unravel_input_get_left_tl { \gtl_left_tl:c { g__unravel_input_#1_gtl } } \tl_concat:NNN #2 #2 \l__unravel_input_get_left_tl \gtl_if_tl:cT { g__unravel_input_#1_gtl } @@ -1763,7 +1751,7 @@ { \gtl_if_tl:NTF #1 { - \tl_put_right:Nx #2 { \gtl_left_tl:N #1 } + \tl_put_right:Ne #2 { \gtl_left_tl:N #1 } \gtl_gclear:N #1 \int_gdecr:N \g__unravel_input_int \__unravel_input_gpop_tl_aux:N #2 @@ -1773,7 +1761,7 @@ { \int_compare:nNnTF { \gtl_extra_end:N #1 } > 0 } { \use_i:nn } { - \tl_put_right:Nx #2 { \gtl_left_tl:N #1 } + \tl_put_right:Ne #2 { \gtl_left_tl:N #1 } \gtl_gpop_left_tl:N #1 } { @@ -1782,6 +1770,17 @@ } } } +\prg_new_protected_conditional:Npnn \__unravel_input_if_head_is_group_begin: { T , F , TF } + { + \__unravel_input_if_empty:TF + { \prg_return_false: } + { + \exp_args:Nc \gtl_if_head_is_group_begin:NTF + { g__unravel_input_ \int_use:N \g__unravel_input_int _gtl } + { \prg_return_true: } + { \prg_return_false: } + } + } \cs_new_protected:Npn \__unravel_back_input:n { \int_gincr:N \g__unravel_input_int @@ -1789,12 +1788,10 @@ \gtl_gset:cn { g__unravel_input_ \int_use:N \g__unravel_input_int _gtl } } \cs_generate_variant:Nn \__unravel_back_input:n { V , o } -\cs_new_protected:Npn \__unravel_back_input:x - { \__unravel_exp_args:Nx \__unravel_back_input:n } \cs_new_protected:Npn \__unravel_back_input_gtl:N #1 { \gtl_if_tl:NTF #1 - { \__unravel_back_input:x { \gtl_left_tl:N #1 } } + { \exp_args:Ne \__unravel_back_input:n { \gtl_left_tl:N #1 } } { \gtl_gconcat:cNc { g__unravel_input_ \int_use:N \g__unravel_input_int _gtl } @@ -1806,10 +1803,10 @@ { \__unravel_back_input_gtl:N \l__unravel_head_gtl } \cs_new_protected:Npn \__unravel_back_input_tl_o: { - \tl_set:Nx \l__unravel_tmpa_tl + \tl_set:Ne \l__unravel_tmpa_tl { \exp_args:NV \exp_not:o \l__unravel_head_tl } \__unravel_back_input:V \l__unravel_tmpa_tl - \__unravel_print_expansion:x + \__unravel_print_expansion:e { \tl_to_str:N \l__unravel_head_tl = \tl_to_str:N \l__unravel_tmpa_tl } } \cs_new_protected:Npn \__unravel_insert_relax: @@ -1835,7 +1832,7 @@ \__unravel_error:nnnnn { missing-dollar } { } { } { } { } \__unravel_print_action: } -\use:x +\use:e { \exp_not:n { \cs_new:Npn \__unravel_macro_split_do:NN #1 } { @@ -1859,8 +1856,8 @@ { \bool_if:NTF \g__unravel_speedup_macros_bool { - \tl_set:Nx \l__unravel_tmpa_tl - {^ \exp_after:wN \__unravel_macro_parameter:N \l__unravel_head_tl } + \tl_set:Ne \l__unravel_tmpa_tl + { ^ \exp_after:wN \__unravel_macro_parameter:N \l__unravel_head_tl } \__unravel_tl_if_in:ooTF \c__unravel_parameters_tl \l__unravel_tmpa_tl { \__unravel_macro_call_quick: } { \__unravel_macro_call_safe: } } @@ -1881,16 +1878,23 @@ \cs_new_protected:Npn \__unravel_macro_call_quick_loop:NNN #1#2#3 { \use_none:n #2 + \__unravel_input_if_head_is_group_begin:TF + { \__unravel_macro_call_quick_loop:NN \prg_do_nothing: } + { \__unravel_macro_call_quick_loop:NN \use:n } + #3 + } +\cs_new_protected:Npn \__unravel_macro_call_quick_loop:NN #1#2 + { \__unravel_input_gpop_item:NF \l__unravel_tmpa_tl - { \__unravel_macro_call_quick_runaway:Nw #3 } - \tl_put_right:Nx \l__unravel_head_tl - { { \exp_not:V \l__unravel_tmpa_tl } } + { \__unravel_macro_call_quick_runaway:Nw #2 } + \tl_put_right:Ne \l__unravel_head_tl + { #1 { \exp_not:V \l__unravel_tmpa_tl } } \__unravel_macro_call_quick_loop:NNN - #3 + #2 } \cs_new_protected:Npn \__unravel_macro_call_quick_runaway:Nw #1#2 \q_stop { - \__unravel_error:nxxxx { runaway-macro-parameter } + \__unravel_error:neeee { runaway-macro-parameter } { \tl_to_str:N \l__unravel_head_tl } { \tl_to_str:n {#1} } { } { } } \cs_new_protected:Npn \__unravel_expand_do:N @@ -1899,7 +1903,7 @@ \bool_if:NT \g__unravel_internal_debug_bool { \__unravel_set_cmd: - \__unravel_exp_args:Nx \iow_term:n { Exp:~\int_to_arabic:n { \l__unravel_head_cmd_int } } + \exp_args:Ne \iow_term:n { Exp:~\int_to_arabic:n { \l__unravel_head_cmd_int } } } \token_if_macro:NTF \l__unravel_head_token { \__unravel_macro_call: } @@ -1912,7 +1916,7 @@ { \cs_if_exist_use:cF { __unravel_expandable_ \int_use:N \l__unravel_head_cmd_int : } - { \__unravel_error:nxxxx { internal } { expandable } { } { } { } } + { \__unravel_error:neeee { internal } { expandable } { } { } { } } } { \__unravel_set_cmd_aux_unknown: @@ -2005,7 +2009,7 @@ \quark_if_recursion_tail_stop_do:nn {#2} { \__unravel_scan_keyword_true: } \quark_if_recursion_tail_stop_do:nn {#3} - { \__unravel_error:nxxxx { internal } { odd-keyword-length } { } { } { } } + { \__unravel_error:neeee { internal } { odd-keyword-length } { } { } { } } \__unravel_get_x_next: \__unravel_scan_keyword_test:NNTF #2#3 { @@ -2040,7 +2044,7 @@ \cs_new_protected:Npn \__unravel_scan_keyword_true: { \__unravel_prev_input_gpop_gtl:N \l__unravel_tmpb_gtl - \__unravel_prev_input:x { \gtl_to_str:N \l__unravel_tmpb_gtl } + \__unravel_prev_input:e { \gtl_to_str:N \l__unravel_tmpb_gtl } \prg_return_true: } \cs_new_protected:Npn \__unravel_scan_keyword_false:w @@ -2133,7 +2137,7 @@ } \int_compare:nNnTF {#3} < { 4 } { \__unravel_thing_use_get:nnNN {#1} {#3} \l__unravel_head_tl \l__unravel_tmpa_tl } - { \tl_set:Nx \l__unravel_tmpa_tl { \__unravel_the:w \l__unravel_head_tl } } + { \tl_set:Ne \l__unravel_tmpa_tl { \__unravel_the:w \l__unravel_head_tl } } \__unravel_rescan_something_internal_auxii:Vn \l__unravel_tmpa_tl {#1} \__unravel_break_point: \int_compare:nNnT {#3} < { 4 } { \__unravel_print_action: } @@ -2142,7 +2146,7 @@ { \__unravel_prev_input_silent:n {#1} \__unravel_set_action_text: - \__unravel_set_action_text:x + \__unravel_set_action_text:e { \g__unravel_action_text_str \use:n { ~ => ~ } \tl_to_str:n {#1} } \int_gset:Nn \g__unravel_val_level_int {#2} } @@ -2167,7 +2171,7 @@ { 81 } { 1 } % set_page_dimen { 82 } { 0 } % set_page_int { 83 } { 1 \__unravel_scan_int: } % set_box_dimen - { 84 } { 0 \__unravel_scan_int: } % set_shape + { 84 } { \__unravel_thing_set_shape: } % set_shape { 85 } { 0 \__unravel_scan_int: } % def_code { 86 } { 4 \__unravel_scan_int: } % def_family { 87 } { 4 } % set_font @@ -2180,6 +2184,8 @@ } \cs_new:Npn \__unravel_thing_set_aux: { \int_compare:nNnTF \l__unravel_head_char_int = { 1 } { 1 } { 0 } } +\cs_new:Npn \__unravel_thing_set_shape: + { \int_compare:nNnTF \l__unravel_head_char_int = 0 { 0 } { 0 \__unravel_scan_int: } } \cs_new:Npn \__unravel_thing_last_item: { \int_compare:nNnTF \l__unravel_head_char_int < { 26 } @@ -2240,7 +2246,7 @@ { \int_compare:nNnT {#1} = { 3 } { \__unravel_tex_error:nV { incompatible-units } #3 } - \tl_set:Nx #4 + \tl_set:Ne #4 { \int_case:nn { \int_min:nn {#1} {#2} } { @@ -2254,12 +2260,12 @@ { \int_case:nnF {#1} { - { 0 } { \tl_set:Nx #4 { \int_eval:n {#3} } } - { 3 } { \tl_set:Nx #4 { \muskip_eval:n {#3} } } + { 0 } { \tl_set:Ne #4 { \int_eval:n {#3} } } + { 3 } { \tl_set:Ne #4 { \muskip_eval:n {#3} } } } { \__unravel_tex_error:nV { incompatible-units } #3 - \tl_set:Nx #4 { \muskip_eval:n { \tex_gluetomu:D #3 } } + \tl_set:Ne #4 { \muskip_eval:n { \tex_gluetomu:D #3 } } } } } @@ -2274,7 +2280,7 @@ \cs_new_protected:Npn \__unravel_scan_expr_op:NN #1#2 { \__unravel_get_x_non_blank: - \tl_case:NnF \l__unravel_head_tl + \token_case_meaning:NnF \l__unravel_head_tl { \c__unravel_plus_tl { @@ -2358,7 +2364,7 @@ } \cs_new_protected:Npn \__unravel_scan_int_char: { - \tl_case:NnF \l__unravel_head_tl + \token_case_meaning:NnF \l__unravel_head_tl { \c__unravel_lq_tl { \__unravel_scan_int_lq: } \c__unravel_rq_tl @@ -2371,7 +2377,7 @@ { \__unravel_prev_input:V \l__unravel_head_tl \__unravel_get_x_next: - \__unravel_scan_int_explicit:Nn \c_false_bool { " } + \__unravel_scan_int_explicit:Nn \c_false_bool { " } % " } } { \__unravel_scan_int_explicit:Nn \c_false_bool { } } @@ -2381,13 +2387,13 @@ \__unravel_get_next: \__unravel_gtl_if_head_is_definable:NF \l__unravel_head_gtl { - \tl_set:Nx \l__unravel_head_tl + \tl_set:Ne \l__unravel_head_tl { \__unravel_token_to_char:N \l__unravel_head_token } } - \tl_set:Nx \l__unravel_tmpa_tl + \tl_set:Ne \l__unravel_tmpa_tl { \int_eval:n { \exp_after:wN ` \l__unravel_head_tl } } \__unravel_prev_input_silent:V \l__unravel_tmpa_tl - \__unravel_print_action:x + \__unravel_print_action:e { ` \gtl_to_str:N \l__unravel_head_gtl = \l__unravel_tmpa_tl } \__unravel_skip_optional_space: } @@ -2585,7 +2591,7 @@ \__unravel_gtl_if_head_is_definable:NTF \l__unravel_head_gtl { \__unravel_back_input: } { - \tl_set:Nx \l__unravel_tmpa_tl + \tl_set:Ne \l__unravel_tmpa_tl { \__unravel_token_to_char:N \l__unravel_head_token } \tl_if_eq:NNT \l__unravel_tmpa_tl \c__unravel_dq_tl { @@ -2621,7 +2627,7 @@ \__unravel_prev_input_gpush: \__unravel_scan_toks:NN \c_false_bool \c_true_bool \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl - \__unravel_prev_input_silent:x + \__unravel_prev_input_silent:e { { \exp_after:wN \tl_to_str:n \l__unravel_tmpa_tl } } } \cs_new_protected:Npn \__unravel_scan_pdf_ext_toks: @@ -2629,7 +2635,7 @@ \__unravel_prev_input_gpush: \__unravel_scan_toks:NN \c_false_bool \c_true_bool \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl - \__unravel_prev_input_silent:x + \__unravel_prev_input_silent:e { { \exp_not:N \exp_not:n \exp_not:V \l__unravel_tmpa_tl } } } \cs_new_protected:Npn \__unravel_scan_toks:NN #1#2 @@ -2664,7 +2670,7 @@ \__unravel_error:nnnnn { runaway-text } { } { } { } { } \__unravel_exit_hard:w } - \tl_set:Nx \l__unravel_head_tl { { \exp_not:V \l__unravel_head_tl } } + \tl_set:Ne \l__unravel_head_tl { { \exp_not:V \l__unravel_head_tl } } \bool_if:NT #1 { \tl_put_right:NV \l__unravel_defining_tl \l__unravel_head_tl } \__unravel_prev_input_silent:V \l__unravel_head_tl @@ -2684,7 +2690,7 @@ \__unravel_prev_input_gtl:N \l__unravel_head_gtl \__unravel_scan_group_x:n { 1 } \__unravel_prev_input_gpop_gtl:N \l__unravel_tmpb_gtl - \__unravel_prev_input_silent:x + \__unravel_prev_input_silent:e { \gtl_left_tl:N \l__unravel_tmpb_gtl } } } @@ -2708,7 +2714,7 @@ } { \__unravel_prev_input_silent:V \l__unravel_head_tl - \tl_put_right:Nx \l__unravel_defining_tl + \tl_put_right:Ne \l__unravel_defining_tl { \exp_not:N \exp_not:N \exp_not:V \l__unravel_head_tl } \__unravel_scan_group_xdef:n {#1} } @@ -2787,7 +2793,7 @@ \__unravel_back_input: \__unravel_error:nnnnn { missing-box } { } { } { } { } \__unravel_prev_input_gpop:N \l__unravel_head_tl - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } } \cs_new_protected:Npn \__unravel_do_begin_box:N #1 { @@ -2816,7 +2822,7 @@ { \__unravel_prepare_mag: } \tl_use:N \l__unravel_head_tl \scan_stop: \gtl_gput_right:NV \g__unravel_output_gtl \l__unravel_head_tl - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } } } \cs_new_protected:Npn \__unravel_do_leaders_fetch_skip: @@ -2834,7 +2840,7 @@ \__unravel_back_input: \__unravel_error:nnnnn { improper-leaders } { } { } { } { } \__unravel_prev_input_gpop:N \l__unravel_head_tl - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } } } \cs_new_protected:Npn \__unravel_do_box_explicit:N #1 @@ -2844,7 +2850,7 @@ { \__unravel_box_hook:N \tex_everyvbox:D } \__unravel_scan_spec: \__unravel_prev_input_gpop:N \l__unravel_head_tl - \__unravel_set_action_text:x + \__unravel_set_action_text:e { \tl_to_str:N \l__unravel_head_tl \iow_char:N \{ } \seq_push:Nf \l__unravel_leaders_box_seq { \bool_if:NTF #1 { \mode_if_vertical:TF { v } { h } } { Z } } @@ -2860,7 +2866,7 @@ \str_if_eq:eeF { \tl_head:N \l__unravel_tmpa_tl } { \exp_not:N \__unravel_box_hook:w } { - \__unravel_exp_args:Nx #1 + \exp_args:Ne #1 { \exp_not:n { \__unravel_box_hook:w \prg_do_nothing: } \exp_not:V #1 @@ -2873,7 +2879,7 @@ \gtl_clear:N \l__unravel_after_group_gtl \__unravel_print_action: \__unravel_back_input:o {##1} - \__unravel_set_action_text:x + \__unravel_set_action_text:e { \token_to_meaning:N #1 = \tl_to_str:o {##1} } \tl_if_empty:oF {##1} { \__unravel_print_action: } } @@ -2903,21 +2909,19 @@ \tex_char:D #1 \scan_stop: \__unravel_charcode_if_safe:nTF {#1} { - \tl_set:Nx \l__unravel_tmpa_tl { \char_generate:nn {#1} { 12 } } + \tl_set:Ne \l__unravel_tmpa_tl { \char_generate:nn {#1} { 12 } } \gtl_gput_right:NV \g__unravel_output_gtl \l__unravel_tmpa_tl - \__unravel_print_action:x { \tl_to_str:N \l__unravel_tmpa_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_tmpa_tl } } { - \tl_set:Nx \l__unravel_tmpa_tl + \tl_set:Ne \l__unravel_tmpa_tl { \exp_not:N \char \int_eval:n {#1} ~ } \gtl_gput_right:NV \g__unravel_output_gtl \l__unravel_tmpa_tl - \__unravel_print_action:x + \__unravel_print_action:e { " \char_generate:nn {#1} { 12 } " = \tl_to_str:N \l__unravel_tmpa_tl } } } -\cs_generate_variant:Nn \__unravel_char:n { V } -\cs_new_protected:Npn \__unravel_char:x - { \__unravel_exp_args:Nx \__unravel_char:n } +\cs_generate_variant:Nn \__unravel_char:n { V , e } \cs_new_protected:Npn \__unravel_char_in_mmode:n #1 { \int_compare:nNnTF { \tex_mathcode:D #1 } @@ -2925,24 +2929,21 @@ { % math active \__unravel_active_do:nn {#1} { \gtl_set:Nn \l__unravel_head_gtl } \__unravel_back_input: - \__unravel_print_action:x + \__unravel_print_action:e { \char_generate:nn {#1} { 12 } ~ active } } { \__unravel_char:n {#1} } } -\cs_generate_variant:Nn \__unravel_char_in_mmode:n { V } -\cs_new_protected:Npn \__unravel_char_in_mmode:x - { \__unravel_exp_args:Nx \__unravel_char_in_mmode:n } +\cs_generate_variant:Nn \__unravel_char_in_mmode:n { V , e } \cs_new_protected:Npn \__unravel_mathchar:n #1 { \tex_mathchar:D #1 \scan_stop: - \tl_set:Nx \l__unravel_tmpa_tl - { \exp_not:N \mathchar " \int_to_hex:n {#1} ~ } + \tl_set:Ne \l__unravel_tmpa_tl + { \exp_not:N \mathchar " \int_to_hex:n {#1} ~ } % " \gtl_gput_right:NV \g__unravel_output_gtl \l__unravel_tmpa_tl - \__unravel_print_action:x { \tl_to_str:N \l__unravel_tmpa_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_tmpa_tl } } -\cs_new_protected:Npn \__unravel_mathchar:x - { \__unravel_exp_args:Nx \__unravel_mathchar:n } +\cs_generate_variant:Nn \__unravel_mathchar:n { e } \cs_new_protected:Npn \__unravel_new_graf:N #1 { \tl_set:NV \l__unravel_tmpa_tl \__unravel_everypar:w @@ -2950,7 +2951,7 @@ \bool_if:NTF #1 { \tex_indent:D } { \tex_noindent:D } \exp_args:NV \__unravel_everypar:w \l__unravel_tmpa_tl \__unravel_back_input:V \l__unravel_tmpa_tl - \__unravel_print_action:x + \__unravel_print_action:e { \g__unravel_action_text_str \c_space_tl : ~ \token_to_str:N \everypar = { \tl_to_str:N \l__unravel_tmpa_tl } @@ -2962,7 +2963,7 @@ { \tex_par:D \gtl_gput_right:Nn \g__unravel_output_gtl { \par } - \__unravel_print_action:x { Paragraph~end. } + \__unravel_print_action:e { Paragraph~end. } } \cs_new_protected:Npn \__unravel_build_page: { @@ -3053,7 +3054,7 @@ { \__unravel_back_input_gtl:N \l__unravel_after_group_gtl \c_group_end_token - \__unravel_print_action:x + \__unravel_print_action:e { \token_to_str:N #2 \prg_replicate:nn { #1 + 1 } { {...} } } } { \exp_args:NV \__unravel_end_choice_group:nN \l__unravel_choice_int #2 } @@ -3068,7 +3069,7 @@ \use:n \c_group_begin_token \int_set:Nn \l__unravel_choice_int { #1 + 1 } \gtl_clear:N \l__unravel_after_group_gtl - \__unravel_print_action:x + \__unravel_print_action:e { \token_to_str:N #2 \prg_replicate:nn {#1} { { ... } } @@ -3079,7 +3080,7 @@ { \int_compare:nNnTF \__unravel_currentgrouptype: = { 0 } { % bottom-level - \__unravel_error:nxxxx { extra-close } + \__unravel_error:neeee { extra-close } { \token_to_meaning:N \l__unravel_head_token } { } { } { } } { @@ -3095,7 +3096,7 @@ } { \gtl_set_eq:NN \l__unravel_head_gtl \c_group_end_gtl } \__unravel_back_input: - \__unravel_error:nxxxx { off-save } + \__unravel_error:neeee { off-save } { \gtl_to_str:N \l__unravel_head_gtl } { } { } { } } } @@ -3178,7 +3179,7 @@ { \exp_after:wN \__unravel_token_if_expandable:NTF \l__unravel_head_tl { - \__unravel_set_action_text:x + \__unravel_set_action_text:e { \iow_char:N \\notexpanded: \g__unravel_action_text_str } } { } @@ -3281,7 +3282,7 @@ \g__unravel_output_gtl \c_group_begin_gtl \tl_use:N \l__unravel_head_tl \c_group_begin_token } - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } } \__unravel_new_tex_cmd:nn { endv } % 9 { @@ -3303,7 +3304,7 @@ { \__unravel_mode_non_vertical:n { - \tl_set:Nx \l__unravel_tmpa_tl + \tl_set:Ne \l__unravel_tmpa_tl { ` \__unravel_token_to_char:N \l__unravel_head_token } \mode_if_math:TF { \__unravel_char_in_mmode:V \l__unravel_tmpa_tl } @@ -3344,7 +3345,7 @@ \tex_penalty:D - '10000000000 ~ } \__unravel_build_page: - \__unravel_print_action:x { End~everything! } + \__unravel_print_action:e { End~everything! } } { \__unravel_print_outcome: @@ -3362,7 +3363,7 @@ \__unravel_scan_int: \__unravel_prev_input_gpop:N \l__unravel_head_tl \tl_use:N \l__unravel_head_tl \scan_stop: - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } } } \__unravel_new_tex_cmd:nn { char_num } % 16 @@ -3374,8 +3375,8 @@ \__unravel_scan_int: \__unravel_prev_input_gpop:N \l__unravel_head_tl \mode_if_math:TF - { \__unravel_char_in_mmode:x { \tl_tail:N \l__unravel_head_tl } } - { \__unravel_char:x { \tl_tail:N \l__unravel_head_tl } } + { \__unravel_char_in_mmode:e { \tl_tail:N \l__unravel_head_tl } } + { \__unravel_char:e { \tl_tail:N \l__unravel_head_tl } } } } \__unravel_new_tex_cmd:nn { math_char_num } % 17 @@ -3386,7 +3387,7 @@ \__unravel_print_action: \__unravel_scan_int: \__unravel_prev_input_gpop:N \l__unravel_head_tl - \__unravel_mathchar:x { \tl_tail:N \l__unravel_head_tl } + \__unravel_mathchar:e { \tl_tail:N \l__unravel_head_tl } } } \__unravel_new_tex_cmd:nn { mark } % 18 @@ -3399,9 +3400,9 @@ \__unravel_scan_toks:NN \c_false_bool \c_true_bool \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl \__unravel_prev_input_gpop:N \l__unravel_head_tl - \__unravel_print_action:x + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl \tl_to_str:N \l__unravel_tmpa_tl } - \tl_put_right:Nx \l__unravel_head_tl + \tl_put_right:Ne \l__unravel_head_tl { { \exp_not:N \exp_not:n \exp_not:V \l__unravel_tmpa_tl } } \tl_use:N \l__unravel_head_tl } @@ -3428,7 +3429,7 @@ \__unravel_get_x_next: \__unravel_rescan_something_internal:n { 5 } \__unravel_prev_input_gpop:N \l__unravel_head_tl - \__unravel_exp_args:Nx \use:n + \exp_args:Ne \use:n % better display than \use:e { \tex_showtokens:D { \tl_tail:N \l__unravel_head_tl } } } } @@ -3471,7 +3472,7 @@ \__unravel_scan_int: \__unravel_prev_input_gpop:N \l__unravel_head_tl \tl_use:N \l__unravel_head_tl \scan_stop: - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } } \__unravel_new_tex_cmd:nn { un_hbox } % 23 { \__unravel_mode_non_vertical:n { \__unravel_do_unpackage: } } @@ -3497,7 +3498,7 @@ { \int_eval:n { \l__unravel_head_char_int - 2 } } \__unravel_prev_input_gpop:N \l__unravel_head_tl \tl_use:N \l__unravel_head_tl \scan_stop: - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } } } \__unravel_new_tex_cmd:nn { hskip } % 26 @@ -3515,7 +3516,7 @@ { \__unravel_scan_dimen:nN { 3 } \c_false_bool } \__unravel_prev_input_gpop:N \l__unravel_head_tl \tl_use:N \l__unravel_head_tl \scan_stop: - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } } \__unravel_new_tex_cmd:nn { kern } % 29 { \__unravel_do_append_kern: } @@ -3546,7 +3547,7 @@ \__unravel_scan_alt_rule: \__unravel_prev_input_gpop:N \l__unravel_head_tl \tl_use:N \l__unravel_head_tl \scan_stop: - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } } \__unravel_new_tex_cmd:nn { insert } % 37 { @@ -3574,7 +3575,7 @@ \gtl_gconcat:NNN \g__unravel_output_gtl \g__unravel_output_gtl \c_group_begin_gtl \tl_use:N \l__unravel_head_tl \c_group_begin_token - \__unravel_print_action:x + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl \iow_char:N \{ } } \__unravel_new_tex_cmd:nn { ignore_spaces } % 39 @@ -3593,7 +3594,7 @@ \tl_set_eq:NN \l__unravel_tmpa_tl \l__unravel_head_tl \__unravel_get_next: \gtl_gset_eq:NN \g__unravel_after_assignment_gtl \l__unravel_head_gtl - \__unravel_print_action:x + \__unravel_print_action:e { Afterassignment:~\tl_to_str:N \l__unravel_tmpa_tl \gtl_to_str:N \l__unravel_head_gtl @@ -3605,7 +3606,7 @@ \__unravel_get_next: \int_compare:nNnTF \__unravel_currentgrouptype: = 0 { - \__unravel_print_action:x + \__unravel_print_action:e { Aftergroup~(level~0~=>~dropped):~ \tl_to_str:N \l__unravel_tmpa_tl @@ -3615,7 +3616,7 @@ { \gtl_concat:NNN \l__unravel_after_group_gtl \l__unravel_after_group_gtl \l__unravel_head_gtl - \__unravel_print_action:x + \__unravel_print_action:e { Aftergroup:~\tl_to_str:N \l__unravel_tmpa_tl \gtl_to_str:N \l__unravel_head_gtl @@ -3629,7 +3630,7 @@ \__unravel_scan_int: \__unravel_prev_input_gpop:N \l__unravel_head_tl \tl_use:N \l__unravel_head_tl \scan_stop: - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } } \__unravel_new_tex_cmd:nn { start_par } % 43 { @@ -3682,7 +3683,7 @@ \__unravel_prev_input_gpop:N \l__unravel_head_tl \gtl_gput_right:NV \g__unravel_output_gtl \l__unravel_head_tl \tl_use:N \l__unravel_head_tl \scan_stop: - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } \__unravel_break_point: } \cs_new_protected:Npn \__unravel_do_math_accent: @@ -3743,7 +3744,7 @@ { \gtl_gput_right:NV \g__unravel_output_gtl \l__unravel_head_tl \tl_use:N \l__unravel_head_tl \scan_stop: - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } } { \int_case:nnF \tex_currentgrouptype:D @@ -3758,7 +3759,7 @@ \gtl_clear:N \l__unravel_after_group_gtl } { \tl_use:N \l__unravel_head_tl \scan_stop: } - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } } { 15 } { % todo: this is a TeX error @@ -3819,7 +3820,7 @@ \tl_use:N \l__unravel_head_tl \c_group_begin_token \gtl_clear:N \l__unravel_after_group_gtl \int_set:Nn \l__unravel_choice_int { 1 } - \__unravel_print_action:x + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl \iow_char:N \{ } } \__unravel_new_tex_cmd:nn { non_script } % 55 @@ -3836,7 +3837,7 @@ \cs_new_protected:Npn \__unravel_case_shift:Nn #1#2 { #1 { \__unravel_back_input:n {#2} } - \__unravel_print_action:x + \__unravel_print_action:e { \token_to_meaning:N #1 ~ \tl_to_str:n { {#2} } } } \__unravel_new_tex_cmd:nn { message } % 58 @@ -3846,7 +3847,7 @@ \__unravel_scan_toks_to_str: \__unravel_prev_input_gpop:N \l__unravel_head_tl \tl_use:N \l__unravel_head_tl - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } } \__unravel_new_tex_cmd:nn { extension } % 59 { @@ -3855,7 +3856,7 @@ \__unravel_scan_extension_operands: \__unravel_prev_input_gpop:N \l__unravel_head_tl \tl_use:N \l__unravel_head_tl \scan_stop: - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } } \__unravel_new_tex_cmd:nn { in_stream } % 60 { @@ -3870,7 +3871,7 @@ { \__unravel_scan_int: } \__unravel_prev_input_gpop:N \l__unravel_head_tl \tl_use:N \l__unravel_head_tl \scan_stop: - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } } \__unravel_new_tex_cmd:nn { begin_group } % 61 { @@ -3917,7 +3918,7 @@ \__unravel_new_tex_cmd:nn { math_given } % 69 { \__unravel_mode_math:n - { \__unravel_mathchar:x { \int_use:N \l__unravel_head_char_int } } + { \__unravel_mathchar:e { \int_use:N \l__unravel_head_char_int } } } \__unravel_new_tex_cmd:nn { last_item } % 70 { \__unravel_forbidden_case: } @@ -4202,7 +4203,7 @@ { \__unravel_back_input: \__unravel_prev_input_gpop:N \l__unravel_head_tl - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl ignored } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl ignored } \__unravel_prev_input_gpush: } @@ -4276,7 +4277,7 @@ > { \__unravel_tex_use:n { max_non_prefixed_command } } { \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl - \__unravel_error:nxxxx { erroneous-prefixes } + \__unravel_error:neeee { erroneous-prefixes } { \tl_to_str:N \l__unravel_tmpa_tl } { \tl_to_str:N l__unravel_head_tl } { } { } @@ -4324,7 +4325,7 @@ \tl_if_empty:nF {#1} { \__unravel_prev_input_gpush:N \l__unravel_head_tl - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } #1 \__unravel_prev_input_gpop:N \l__unravel_head_tl } @@ -4411,16 +4412,30 @@ } \__unravel_prefixed_new:nn { set_shape } % 84 { - \__unravel_assign_value:nn { \__unravel_scan_int: } + \__unravel_prev_input:V \l__unravel_head_tl + \tl_set_eq:NN \l__unravel_defined_tl \l__unravel_head_tl + \tl_if_head_eq_meaning:VNTF \l__unravel_defined_tl \tex_parshape:D { - \prg_replicate:nn - { - \tl_if_head_eq_meaning:VNT - \l__unravel_defined_tl \tex_parshape:D { 2 * } - \tl_tail:N \l__unravel_defined_tl - } - { \__unravel_scan_int: } + \__unravel_set_shape:NN 2 \__unravel_scan_normal_dimen: + \__unravel_print_assigned_parshape: } + { + \__unravel_set_shape:NN 1 \__unravel_scan_int: + \__unravel_print_assigned_set_shape: + } + } +\cs_new_protected:Npn \__unravel_set_shape:NN #1#2 + { + \__unravel_scan_optional_equals: + \__unravel_prev_input_gpush: + \__unravel_scan_int: + \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl + \__unravel_prev_input_silent:V \l__unravel_tmpa_tl + \prg_replicate:nn + { \int_max:nn { 0 } { #1 * \l__unravel_tmpa_tl } } + { \__unravel_prev_input_silent:n { ~ } #2 } + \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl + \tl_use:N \l__unravel_tmpa_tl \scan_stop: } \__unravel_prefixed_new:nn { def_code } % 85 { @@ -4443,9 +4458,9 @@ \__unravel_prefixed_new:nn { def_font } % 88 { \__unravel_prev_input_silent:V \l__unravel_head_tl - \__unravel_set_action_text:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_set_action_text:e { \tl_to_str:N \l__unravel_head_tl } \__unravel_scan_r_token: - \__unravel_print_action:x + \__unravel_print_action:e { \g__unravel_action_text_str \tl_to_str:N \l__unravel_defined_tl } \__unravel_scan_optional_equals: \__unravel_scan_file_name: @@ -4466,7 +4481,7 @@ { % |let| \__unravel_scan_r_token: \__unravel_prev_input_get:N \l__unravel_tmpa_tl - \__unravel_print_action:x { \tl_to_str:N \l__unravel_tmpa_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_tmpa_tl } \__unravel_get_next: \bool_while_do:nn { \token_if_eq_catcode_p:NN \l__unravel_head_token \c_space_token } @@ -4479,7 +4494,7 @@ { % |futurelet| \__unravel_scan_r_token: \__unravel_prev_input_get:N \l__unravel_tmpa_tl - \__unravel_print_action:x { \tl_to_str:N \l__unravel_tmpa_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_tmpa_tl } \__unravel_get_next: \gtl_set_eq:NN \l__unravel_tmpb_gtl \l__unravel_head_gtl \__unravel_get_next: @@ -4490,7 +4505,7 @@ \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl \tl_put_right:Nn \l__unravel_tmpa_tl { = ~ \l__unravel_head_token } \__unravel_prev_input_gpop:N \l__unravel_head_tl - \__unravel_exp_args:Nx \use:n + \use:e { \exp_not:V \l__unravel_head_tl \tex_let:D \tl_tail:N \l__unravel_tmpa_tl @@ -4500,10 +4515,10 @@ \__unravel_prefixed_new:nn { shorthand_def } % 95 { \__unravel_prev_input_silent:V \l__unravel_head_tl - \tl_set:Nx \l__unravel_prev_action_tl + \tl_set:Ne \l__unravel_prev_action_tl { \tl_to_str:N \l__unravel_head_tl } \__unravel_scan_r_token: - \__unravel_print_action:x + \__unravel_print_action:e { \l__unravel_prev_action_tl \tl_to_str:N \l__unravel_defined_tl } \exp_after:wN \cs_set_eq:NN \l__unravel_defined_tl \scan_stop: \__unravel_just_print_assigned_token: @@ -4514,7 +4529,7 @@ \__unravel_prefixed_new:nn { read_to_cs } % 96 { \__unravel_prev_input_silent:V \l__unravel_head_tl - \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_action:e { \tl_to_str:N \l__unravel_head_tl } \__unravel_scan_int: \__unravel_scan_to: \__unravel_scan_r_token: @@ -4594,14 +4609,14 @@ \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl \tl_put_left:NV \l__unravel_head_tl \l__unravel_tmpa_tl \tl_use:N \l__unravel_head_tl \scan_stop: - \__unravel_print_assignment:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_assignment:e { \tl_to_str:N \l__unravel_head_tl } } \__unravel_prefixed_new:nn { letterspace_font } % 101 { \__unravel_prev_input_silent:V \l__unravel_head_tl - \__unravel_set_action_text:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_set_action_text:e { \tl_to_str:N \l__unravel_head_tl } \__unravel_scan_r_token: - \__unravel_print_action:x + \__unravel_print_action:e { \g__unravel_action_text_str \tl_to_str:N \l__unravel_defined_tl } \exp_after:wN \cs_set_eq:NN \l__unravel_defined_tl \__unravel_nullfont: \__unravel_just_print_assigned_token: @@ -4613,9 +4628,9 @@ \__unravel_prefixed_new:nn { pdf_copy_font } % 102 { \__unravel_prev_input_silent:V \l__unravel_head_tl - \__unravel_set_action_text:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_set_action_text:e { \tl_to_str:N \l__unravel_head_tl } \__unravel_scan_r_token: - \__unravel_print_action:x + \__unravel_print_action:e { \g__unravel_action_text_str \tl_to_str:N \l__unravel_defined_tl } \exp_after:wN \cs_set_eq:NN \l__unravel_defined_tl \__unravel_nullfont: \__unravel_just_print_assigned_token: @@ -4710,7 +4725,7 @@ { 3 } { \__unravel_scan_normal_glue: } % glue { 4 } { \__unravel_scan_mu_glue: } % muglue } - { \__unravel_error:nxxxx { internal } { do-reg=#2 } { } { } { } } + { \__unravel_error:neeee { internal } { do-reg=#2 } { } { } { } } } { \__unravel_scan_int: } \__unravel_assign_register: @@ -4744,13 +4759,13 @@ \gtl_concat:NNN \l__unravel_head_gtl \l__unravel_tmpb_gtl \l__unravel_head_gtl \__unravel_prev_input_gpush_gtl:N \l__unravel_head_gtl - \__unravel_print_expansion:x { \gtl_to_str:N \l__unravel_head_gtl } + \__unravel_print_expansion:e { \gtl_to_str:N \l__unravel_head_gtl } \__unravel_get_next: \__unravel_token_if_expandable:NTF \l__unravel_head_token { \__unravel_expand_do:N \prg_do_nothing: } { \__unravel_back_input: } \__unravel_prev_input_gpop_gtl:N \l__unravel_head_gtl - \__unravel_set_action_text:x + \__unravel_set_action_text:e { back_input: ~ \gtl_to_str:N \l__unravel_head_gtl } \gtl_pop_left:N \l__unravel_head_gtl \__unravel_back_input: @@ -4758,6 +4773,7 @@ } \cs_new_protected:Npn \__unravel_unless: { + \gtl_set_eq:NN \l__unravel_tmpb_gtl \l__unravel_head_gtl \__unravel_get_token: \int_compare:nNnTF \l__unravel_head_cmd_int = { \__unravel_tex_use:n { if_test } } @@ -4765,8 +4781,8 @@ \token_if_eq_meaning:NNTF \l__unravel_head_token \tex_ifcase:D { \__unravel_unless_bad: } { - \tl_put_left:Nn \l__unravel_head_tl { \reverse_if:N } - % \int_add:Nn \l__unravel_head_char_int { 32 } + \tl_put_left:Ne \l__unravel_head_tl + { \gtl_head_do:NN \l__unravel_tmpb_gtl \exp_not:N } \__unravel_expand_nonmacro: } } @@ -4843,19 +4859,21 @@ \__unravel_prev_input_gpush: \__unravel_scan_toks:NN \c_false_bool \c_false_bool \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl - \tl_set_rescan:Nno \l__unravel_head_tl { } \l__unravel_tmpa_tl + \exp_last_unbraced:NNNo \tl_set_rescan:Nnn + \l__unravel_head_tl \prg_do_nothing: \l__unravel_tmpa_tl + \__unravel_back_input:V \__unravel_everyeof:w \__unravel_back_input:V \l__unravel_head_tl - \__unravel_print_expansion:x { \tl_to_str:N \l__unravel_tmpa_tl } + \__unravel_print_expansion:e { \tl_to_str:N \l__unravel_tmpa_tl } } \cs_new_protected:Npn \__unravel_input: { \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_scan_file_name: \__unravel_prev_input_gpop:N \l__unravel_head_tl - \tl_set:Nx \l__unravel_tmpa_tl { \tl_tail:N \l__unravel_head_tl } + \tl_set:Ne \l__unravel_tmpa_tl { \tl_tail:N \l__unravel_head_tl } \__unravel_file_get:nN \l__unravel_tmpa_tl \l__unravel_tmpa_tl \__unravel_back_input:V \l__unravel_tmpa_tl - \__unravel_print_expansion:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_expansion:e { \tl_to_str:N \l__unravel_head_tl } } \__unravel_new_tex_expandable:nn { cs_name } % 109 { @@ -4871,7 +4889,7 @@ } { \__unravel_back_input:V \g__unravel_lastnamedcs_tl - \__unravel_print_expansion:x + \__unravel_print_expansion:e { \tl_to_str:N \l__unravel_head_tl = \tl_to_str:N \g__unravel_lastnamedcs_tl } } } @@ -4888,7 +4906,7 @@ } } { - \__unravel_prev_input_silent:x + \__unravel_prev_input_silent:e { \__unravel_token_to_char:N \l__unravel_head_token } \__unravel_csname_loop: } @@ -4898,9 +4916,11 @@ \group_begin: \__unravel_prev_input_get:N \l__unravel_head_tl \tl_gset:No \g__unravel_lastnamedcs_tl - { \cs:w \exp_after:wN \use_none:n \l__unravel_head_tl } + { \cs:w \exp_after:wN \__unravel_get_lastnamedcs_check:N \l__unravel_head_tl } \group_end: } +\cs_new:Npn \__unravel_get_lastnamedcs_check:N #1 + { \if_meaning:w \reverse_if:N #1 \use_i:nn \fi: } \__unravel_new_tex_expandable:nn { convert } % 110 { \__unravel_prev_input_gpush:N \l__unravel_head_tl @@ -4955,7 +4975,7 @@ { \__unravel_get_next: \tl_if_empty:NTF \l__unravel_head_tl - { \__unravel_prev_input:x { \gtl_to_str:N \l__unravel_head_gtl } } + { \__unravel_prev_input:e { \gtl_to_str:N \l__unravel_head_gtl } } { \__unravel_prev_input:V \l__unravel_head_tl } } \cs_new_protected:Npn \__unravel_convert_meaning:w @@ -4968,11 +4988,11 @@ \__unravel_prev_input_gpop:N \l__unravel_prev_input_tl \exp_args:NNV \gtl_put_left:Nn \l__unravel_tmpb_gtl \l__unravel_prev_input_tl \__unravel_prev_input_gpush_gtl:N \l__unravel_tmpb_gtl - \__unravel_print_action:x { \gtl_to_str:N \l__unravel_tmpb_gtl } + \__unravel_print_action:e { \gtl_to_str:N \l__unravel_tmpb_gtl } \__unravel_prev_input_gpop_gtl:N \l__unravel_tmpb_gtl - \tl_set:Nx \l__unravel_tmpa_tl { \gtl_head_do:NN \l__unravel_head_gtl \tex_meaning:D } + \tl_set:Ne \l__unravel_tmpa_tl { \gtl_head_do:NN \l__unravel_head_gtl \tex_meaning:D } \__unravel_back_input:V \l__unravel_tmpa_tl - \__unravel_print_expansion:x + \__unravel_print_expansion:e { \gtl_to_str:N \l__unravel_tmpb_gtl = \tl_to_str:N \l__unravel_tmpa_tl } } { @@ -5035,34 +5055,34 @@ { % \unexpanded, \detokenize \__unravel_scan_toks:NN \c_false_bool \c_false_bool \__unravel_prev_input_gpop:N \l__unravel_head_tl - \__unravel_set_action_text:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_set_action_text:e { \tl_to_str:N \l__unravel_head_tl } } { % \the \__unravel_get_x_next: \__unravel_rescan_something_internal:n { 5 } \__unravel_prev_input_gpop:N \l__unravel_head_tl - \__unravel_set_action_text:x + \__unravel_set_action_text:e { \tl_head:N \l__unravel_head_tl => \tl_tail:N \l__unravel_head_tl } - \tl_set:Nx \l__unravel_head_tl + \tl_set:Ne \l__unravel_head_tl { \exp_not:N \exp_not:n { \tl_tail:N \l__unravel_head_tl } } } \cs_if_eq:NNTF #1 \__unravel_get_token_xdef: { \tl_put_right:NV \l__unravel_defining_tl \l__unravel_head_tl - \__unravel_prev_input_silent:x { \l__unravel_head_tl } + \__unravel_prev_input_silent:e { \l__unravel_head_tl } \__unravel_print_action: } { \cs_if_eq:NNTF #1 \__unravel_get_token_x: { - \__unravel_exp_args:NNx \gtl_set:Nn \l__unravel_tmpb_gtl { \l__unravel_head_tl } + \exp_args:NNe \gtl_set:Nn \l__unravel_tmpb_gtl { \l__unravel_head_tl } \__unravel_prev_input_gtl:N \l__unravel_tmpb_gtl } { - \tl_set:Nx \l__unravel_tmpa_tl { \exp_args:NV \exp_not:o \l__unravel_head_tl } + \tl_set:Ne \l__unravel_tmpa_tl { \exp_args:NV \exp_not:o \l__unravel_head_tl } \__unravel_back_input:V \l__unravel_tmpa_tl } \__unravel_print_expansion: @@ -5128,7 +5148,7 @@ } \cs_new_protected:Npn \__unravel_cond_push: { - \tl_gput_left:Nx \g__unravel_if_limit_tl + \tl_gput_left:Ne \g__unravel_if_limit_tl { { \int_use:N \g__unravel_if_limit_int } } \int_gincr:N \g__unravel_if_depth_int \int_gzero:N \g__unravel_if_limit_int @@ -5138,7 +5158,7 @@ \fi: \int_gset:Nn \g__unravel_if_limit_int { \tl_head:N \g__unravel_if_limit_tl } - \tl_gset:Nx \g__unravel_if_limit_tl + \tl_gset:Ne \g__unravel_if_limit_tl { \tl_tail:N \g__unravel_if_limit_tl } \int_gdecr:N \g__unravel_if_depth_int } @@ -5150,12 +5170,12 @@ \tl_clear:N \l__unravel_tmpa_tl \prg_replicate:nn { \g__unravel_if_depth_int - #2 - 1 } { - \tl_put_right:Nx \l__unravel_tmpa_tl + \tl_put_right:Ne \l__unravel_tmpa_tl { { \tl_head:N \g__unravel_if_limit_tl } } - \tl_gset:Nx \g__unravel_if_limit_tl + \tl_gset:Ne \g__unravel_if_limit_tl { \tl_tail:N \g__unravel_if_limit_tl } } - \tl_gset:Nx \g__unravel_if_limit_tl + \tl_gset:Ne \g__unravel_if_limit_tl { \l__unravel_tmpa_tl {#1} \tl_tail:N \g__unravel_if_limit_tl } } } @@ -5201,7 +5221,7 @@ { 24 } { \__unravel_scan_font_ident: } % ifjfont, iftfont } \__unravel_prev_input_gpop:N \l__unravel_head_tl - \__unravel_set_action_text:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_set_action_text:e { \tl_to_str:N \l__unravel_head_tl } \l__unravel_head_tl \scan_stop: \__unravel_cond_true:NNNn \else: @@ -5213,13 +5233,13 @@ \cs_new_protected:Npn \__unravel_cond_true:NNNn #1#2#3#4 { \__unravel_change_if_limit:nn { 3 } {#4} % wait for else/fi - \__unravel_print_expansion:x { \g__unravel_action_text_str = true } + \__unravel_print_expansion:e { \g__unravel_action_text_str = true } } \cs_new_protected:Npn \__unravel_cond_false:Nn #1#2 { \__unravel_cond_false_loop:n {#2} \__unravel_cond_false_common: - \__unravel_print_expansion:x + \__unravel_print_expansion:e { \g__unravel_action_text_str = false ~ => ~ skip ~ to ~ \tl_to_str:N \l__unravel_head_tl @@ -5269,7 +5289,7 @@ \__unravel_test_two_chars_get:n {#1} \__unravel_test_two_chars_get:n {#1} \__unravel_prev_input_gpop_gtl:N \l__unravel_head_gtl - \__unravel_set_action_text:x { \gtl_to_str:N \l__unravel_head_gtl } + \__unravel_set_action_text:e { \gtl_to_str:N \l__unravel_head_gtl } \gtl_pop_left_item:NNTF \l__unravel_head_gtl \l__unravel_head_tl { } { } \exp_args:No \tl_if_head_eq_meaning:nNT \l__unravel_head_tl \reverse_if:N { @@ -5291,14 +5311,14 @@ \int_compare:nNnT {#1} = 0 { \gtl_if_head_is_N_type:NF \l__unravel_head_gtl - { \gtl_set:Nx \l__unravel_head_gtl { \gtl_to_str:N \l__unravel_head_gtl } } + { \gtl_set:Ne \l__unravel_head_gtl { \gtl_to_str:N \l__unravel_head_gtl } } } \__unravel_prev_input_gtl:N \l__unravel_head_gtl - \__unravel_print_action:x { \gtl_to_str:N \l__unravel_head_gtl } + \__unravel_print_action:e { \gtl_to_str:N \l__unravel_head_gtl } } \cs_new_protected:Npn \__unravel_test_two_chars_gtl:N #1 { - \tl_put_right:Nx \l__unravel_head_tl + \tl_put_right:Ne \l__unravel_head_tl { \gtl_if_head_is_group_begin:NTF #1 { \c_group_begin_token } { @@ -5319,7 +5339,7 @@ \cs_set_eq:NN \l__unravel_tmpb_token \l__unravel_head_token \__unravel_get_next: \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl - \__unravel_set_action_text:x + \__unravel_set_action_text:e { Compare:~ \tl_to_str:N \l__unravel_tmpa_tl \__unravel_test_ifx_str:NN \l__unravel_tmpb_token \l__unravel_tmpb_gtl @@ -5361,7 +5381,7 @@ \bool_if:NT \g__unravel_internal_debug_bool { \iow_term:n { {\ifcase level~#1} } } \__unravel_scan_int: \__unravel_prev_input_get:N \l__unravel_head_tl - \tl_set:Nx \l__unravel_head_tl { \tl_tail:N \l__unravel_head_tl } + \tl_set:Ne \l__unravel_head_tl { \tl_tail:N \l__unravel_head_tl } % ^^A does text_case_aux use prev_input_seq? \int_compare:nNnF { \l__unravel_head_tl } = 0 { @@ -5371,7 +5391,7 @@ } \exp_args:No \__unravel_test_case_aux:nn { \l__unravel_head_tl } {#1} \__unravel_prev_input_gpop:N \l__unravel_head_tl - \__unravel_print_expansion:x { \tl_to_str:N \l__unravel_head_tl } + \__unravel_print_expansion:e { \tl_to_str:N \l__unravel_head_tl } } \cs_new_protected:Npn \__unravel_test_case_aux:nn #1#2 { @@ -5405,12 +5425,12 @@ { \__unravel_pass_text_empty: } { \__unravel_input_gpop:N \l__unravel_tmpb_gtl - \__unravel_set_action_text:x + \__unravel_set_action_text:e { Conditional:~ \tl_to_str:N \l__unravel_head_tl \gtl_to_str:N \l__unravel_tmpb_gtl } - \__unravel_prev_input:x + \__unravel_prev_input:e { \gtl_if_tl:NTF \l__unravel_tmpb_gtl { \gtl_head:N \l__unravel_tmpb_gtl } @@ -5441,7 +5461,7 @@ \int_compare:nNnF \l__unravel_head_char_int = 2 { \__unravel_fi_or_else_loop: - \__unravel_set_action_text:x + \__unravel_set_action_text:e { \g__unravel_action_text_str \c_space_tl => ~ skip ~ to ~ \tl_to_str:N \l__unravel_head_tl @@ -5463,7 +5483,7 @@ \tl_new:N \l__unravel_print_tl \sys_if_engine_luatex:TF { - \cs_new_protected:Npx \__unravel_print_normalize_null: + \cs_new_protected:Npe \__unravel_print_normalize_null: { \tl_replace_all:Nnn \exp_not:N \l__unravel_print_tl { \char_generate:nn { 0 } { 12 } } @@ -5475,35 +5495,47 @@ { \tl_set:Nn \l__unravel_print_tl {#1} \__unravel_print_normalize_null: - \__unravel_exp_args:Nx \iow_term:n { \l__unravel_print_tl } + \iow_term:e { \l__unravel_print_tl } + \tl_if_empty:NF \g__unravel_output_file_tl + { \iow_now:Ne \g__unravel_iow { \l__unravel_print_tl } } } -\cs_new_protected:Npn \__unravel_print:x - { \__unravel_exp_args:Nx \__unravel_print:n } +\cs_generate_variant:Nn \__unravel_print:n { e } \cs_new_protected:Npn \__unravel_log:n #1 { \tl_set:Nn \l__unravel_print_tl {#1} \__unravel_print_normalize_null: - \__unravel_exp_args:Nx \iow_log:n { \l__unravel_print_tl } + \tl_if_empty:NTF \g__unravel_output_file_tl + { \iow_log:e { \l__unravel_print_tl } } + { \iow_now:Ne \g__unravel_iow { \l__unravel_print_tl } } } -\cs_new_protected:Npn \__unravel_print_message:nn #1 #2 +\cs_new_protected:Npn \__unravel_print_step:n #1 { \int_compare:nNnF \g__unravel_online_int < 0 { \int_compare:nNnTF \g__unravel_online_int = 0 + { \__unravel_log:n {#1} } + { \__unravel_print:n {#1} } + } + } +\cs_new_protected:Npn \__unravel_print_message:nn #1 #2 + { + \int_compare:nNnF \g__unravel_current_online_int < 0 + { + \int_compare:nNnTF \g__unravel_current_online_int = 0 { \iow_wrap:nnnN { #1 #2 } { #1 } { } \__unravel_log:n } { \iow_wrap:nnnN { #1 #2 } { #1 } { } \__unravel_print:n } } } -\cs_new_protected:Npn \__unravel_set_action_text:x #1 +\cs_new_protected:Npn \__unravel_set_action_text:e #1 { \group_begin: \__unravel_set_escapechar:n { 92 } - \str_gset:Nx \g__unravel_action_text_str {#1} + \str_gset:Ne \g__unravel_action_text_str {#1} \group_end: } \cs_new_protected:Npn \__unravel_set_action_text: { - \__unravel_set_action_text:x + \__unravel_set_action_text:e { \tl_to_str:N \l__unravel_head_tl \tl_if_single_token:VT \l__unravel_head_tl @@ -5515,7 +5547,7 @@ \group_begin: \__unravel_set_escapechar:n { 92 } \tl_use:N \g__unravel_before_print_state_tl - \int_compare:nNnT \g__unravel_online_int > 0 + \int_compare:nNnF \g__unravel_current_online_int < 0 { \__unravel_print_state_output: \__unravel_print_state_prev: @@ -5525,20 +5557,20 @@ } \cs_new_protected:Npn \__unravel_print_state_output: { - \__unravel_exp_args:Nx \__unravel_print_state_output:n + \exp_args:Ne \__unravel_print_state_output:n { \gtl_to_str:N \g__unravel_output_gtl } } \cs_new_protected:Npn \__unravel_print_state_output:n #1 { \tl_if_empty:nF {#1} { - \__unravel_print_message:nn { <| ~ } + \__unravel_print_message:nn { <| ~ } % | { \__unravel_str_truncate_left:nn {#1} { \g__unravel_max_output_int } } } } \cs_new_protected:Npn \__unravel_print_state_prev: { - \seq_set_map_x:NNn \l__unravel_tmpa_seq \g__unravel_prev_input_seq + \seq_set_map_e:NNn \l__unravel_tmpa_seq \g__unravel_prev_input_seq { \__unravel_to_str:Nn ##1 } \seq_remove_all:Nn \l__unravel_tmpa_seq { } \seq_if_empty:NTF \l__unravel_tmpa_seq @@ -5552,12 +5584,12 @@ } \cs_new_protected:Npn \__unravel_print_state_input: { - \__unravel_exp_args:Nx \__unravel_print_state_input:n + \exp_args:Ne \__unravel_print_state_input:n { \__unravel_input_to_str: } } \cs_new_protected:Npn \__unravel_print_state_input:n #1 { - \__unravel_print_message:nn { |> ~ } + \__unravel_print_message:nn { |> ~ } % | { \__unravel_str_truncate_right:nn {#1} { \g__unravel_max_input_int } } } \cs_new_protected:Npn \__unravel_print_meaning: @@ -5575,23 +5607,23 @@ } \cs_new_protected:Npn \__unravel_print_action: { \__unravel_print_action_aux:N \g__unravel_trace_other_bool } -\cs_new_protected:Npn \__unravel_print_action:x #1 +\cs_new_protected:Npn \__unravel_print_action:e #1 { - \__unravel_set_action_text:x {#1} + \__unravel_set_action_text:e {#1} \__unravel_print_action: } \cs_new_protected:Npn \__unravel_print_assignment: { \__unravel_print_action_aux:N \g__unravel_trace_assigns_bool } -\cs_new_protected:Npn \__unravel_print_assignment:x #1 +\cs_new_protected:Npn \__unravel_print_assignment:e #1 { - \__unravel_set_action_text:x {#1} + \__unravel_set_action_text:e {#1} \__unravel_print_assignment: } \cs_new_protected:Npn \__unravel_print_expansion: { \__unravel_print_action_aux:N \g__unravel_trace_expansion_bool } -\cs_new_protected:Npn \__unravel_print_expansion:x #1 +\cs_new_protected:Npn \__unravel_print_expansion:e #1 { - \__unravel_set_action_text:x {#1} + \__unravel_set_action_text:e {#1} \__unravel_print_expansion: } \cs_new_protected:Npn \__unravel_print_action_aux:N #1 @@ -5600,7 +5632,7 @@ \int_gincr:N \g__unravel_step_int \bool_if:NT #1 { - \__unravel_print:x + \exp_args:Ne \__unravel_print_step:n { [===== \bool_if:NT \g__unravel_number_steps_bool @@ -5621,7 +5653,7 @@ } \cs_new_protected:Npn \__unravel_just_print_assigned_token: { - \__unravel_print_assignment:x + \__unravel_print_assignment:e { Set~ \exp_after:wN \token_to_str:N \l__unravel_defined_tl = \exp_after:wN \token_to_meaning:N \l__unravel_defined_tl @@ -5633,21 +5665,49 @@ \__unravel_just_print_assigned_token: \__unravel_omit_after_assignment:w } +\cs_new:Npn \__unravel_print_assigned_aux_name: + { + Set~ \exp_after:wN \token_to_str:N \l__unravel_defined_tl + \tl_if_single:NT \l__unravel_defined_tl + { ( \exp_after:wN \token_to_meaning:N \l__unravel_defined_tl ) } + } \cs_new_protected:Npn \__unravel_print_assigned_register: { \__unravel_after_assignment: - \__unravel_exp_args:Nx \__unravel_print_assignment:x + \exp_args:Ne \__unravel_print_assignment:e % needed to stringify a \toks { - \exp_not:n - { - Set~ \exp_after:wN \token_to_str:N \l__unravel_defined_tl - \tl_if_single:NT \l__unravel_defined_tl - { ( \exp_after:wN \token_to_meaning:N \l__unravel_defined_tl ) } - } + \exp_not:N \__unravel_print_assigned_aux_name: = \exp_not:N \tl_to_str:n { \__unravel_the:w \l__unravel_defined_tl } } \__unravel_omit_after_assignment:w } +\cs_new_protected:Npn \__unravel_print_assigned_parshape: + { + \__unravel_after_assignment: + \tl_set:Nn \l__unravel_tmpa_tl { \tex_parshapedimen:D } + \__unravel_print_assignment:e + { + \__unravel_print_assigned_aux_name: = \__unravel_the:w \l__unravel_defined_tl + \int_step_function:nN { 2 * \l__unravel_defined_tl } + \__unravel_print_assigned_set_shape_aux:n + } + \__unravel_omit_after_assignment:w + } +\cs_new_protected:Npn \__unravel_print_assigned_set_shape: + { + \__unravel_after_assignment: + \tl_set_eq:NN \l__unravel_tmpa_tl \l__unravel_defined_tl + \__unravel_print_assignment:e + { + \__unravel_print_assigned_aux_name: + = \__unravel_the:w \l__unravel_defined_tl 0 \exp_stop_f: + \int_step_function:nN { \l__unravel_defined_tl 0 } + \__unravel_print_assigned_set_shape_aux:n + } + \__unravel_omit_after_assignment:w + } +\cs_new:Npn \__unravel_print_assigned_set_shape_aux:n #1 + { ~ \__unravel_the:w \l__unravel_tmpa_tl #1 \exp_stop_f: } \cs_new_protected:Npn \__unravel_print_welcome: { \__unravel_print_message:nn { } @@ -5703,7 +5763,7 @@ \clist_gpop:NN \g__unravel_prompt_input_clist \l__unravel_tmpa_tl \group_begin: \__unravel_set_escapechar:n { 92 } - \__unravel_print:x + \__unravel_print:e { \bool_if:NT \g__unravel_explicit_prompt_bool { Your~input= } \tl_to_str:N \l__unravel_tmpa_tl @@ -5716,12 +5776,12 @@ { \tl_if_empty:nF {#1} { - \__unravel_exp_args:Nx \str_case:nnF { \tl_head:n {#1} } + \str_case:enF { \tl_head:n {#1} } { { m } { \__unravel_print_meaning: \__unravel_prompt_aux: } { q } { - \int_gset:Nn \g__unravel_online_int { -1 } + \int_gset:Nn \g__unravel_current_online_int { -1 } \int_gzero:N \g__unravel_nonstop_int } { x } @@ -5737,10 +5797,10 @@ { s } { \__unravel_prompt_scan_int:nn {#1} \__unravel_prompt_silent_steps:n } { o } { \__unravel_prompt_scan_int:nn {#1} - { \int_gset:Nn \g__unravel_online_int } } + { \int_gset:Nn \g__unravel_current_online_int } } { C } { - \__unravel_exp_args:Nx \use:n + \use:e { \tl_gset_rescan:Nnn \exp_not:N \g__unravel_tmpc_tl { \exp_not:N \ExplSyntaxOn } { \tl_tail:n {#1} } @@ -5750,7 +5810,8 @@ \group_insert_after:N \g__unravel_tmpc_tl \group_insert_after:N \__unravel_prompt: } - { | } { \__unravel_prompt_scan_int:nn {#1} + { | } % | + { \__unravel_prompt_scan_int:nn {#1} \__unravel_prompt_vert:n } { u } { \__unravel_prompt_until:n {#1} } { a } { \__unravel_prompt_all: } @@ -5788,10 +5849,10 @@ { \int_compare:nNnF {#1} < 0 { - \int_gset:Nn \g__unravel_online_int { -1 } + \int_gset:Nn \g__unravel_current_online_int { -1 } \tl_gset:Nn \g__unravel_before_prompt_tl { - \int_gset:Nn \g__unravel_online_int { 1 } + \int_gset_eq:NN \g__unravel_current_online_int \g__unravel_online_int \tl_gclear:N \g__unravel_before_prompt_tl } \int_gset:Nn \g__unravel_nonstop_int {#1} @@ -5805,7 +5866,7 @@ } \cs_new_protected:Npn \__unravel_prompt_vert:Nn #1#2 { - \int_gset:Nn \g__unravel_online_int { -1 } + \int_gset:Nn \g__unravel_current_online_int { -1 } \tl_gset:Nf \g__unravel_before_print_state_tl { \exp_args:NNf \exp_stop_f: \int_compare:nNnTF @@ -5816,14 +5877,14 @@ { \int_max:nn { \g__unravel_nonstop_int } { 2 } } } { - \int_gset:Nn \g__unravel_online_int { 1 } + \int_gset_eq:NN \g__unravel_current_online_int \g__unravel_online_int \tl_gclear:N \g__unravel_before_print_state_tl } } } \cs_new_protected:Npn \__unravel_prompt_all: { - \tl_gset:Nx \g__unravel_tmpc_tl + \tl_gset:Ne \g__unravel_tmpc_tl { \exp_not:n { @@ -5844,12 +5905,12 @@ \tl_new:N \g__unravel_until_tl \cs_new_protected:Npn \__unravel_prompt_until:n #1 { - \tl_gset:Nx \g__unravel_until_tl { \tl_tail:n {#1} } - \int_gset:Nn \g__unravel_online_int { -1 } + \tl_gset:Ne \g__unravel_until_tl { \tl_tail:n {#1} } + \int_gset:Nn \g__unravel_current_online_int { -1 } \tl_gset:Nn \g__unravel_before_print_state_tl { \__unravel_input_get_left:N \l__unravel_tmpa_tl - \__unravel_exp_args:Nx \use:n + \use:e { \exp_not:N \tl_if_in:nnTF { \exp_not:N \__unravel:nn \tl_to_str:N \l__unravel_tmpa_tl } @@ -5857,7 +5918,7 @@ } { \int_gzero:N \g__unravel_nonstop_int - \int_gset:Nn \g__unravel_online_int { 1 } + \int_gset_eq:NN \g__unravel_current_online_int \g__unravel_online_int \tl_gclear:N \g__unravel_before_print_state_tl } { @@ -5874,10 +5935,10 @@ \msg_error:nnnnnn { unravel } {#1} {#2} {#3} {#4} {#5} \group_end: } -\cs_new_protected:Npn \__unravel_error:nxxxx #1#2#3#4#5 +\cs_new_protected:Npn \__unravel_error:neeee #1#2#3#4#5 { \group_begin: - \msg_error:nnxxxx { unravel } {#1} {#2} {#3} {#4} {#5} + \msg_error:nneeee { unravel } {#1} {#2} {#3} {#4} {#5} \group_end: } \cs_new_protected:Npn \__unravel_tex_msg_new:nnn #1#2#3 @@ -5887,17 +5948,16 @@ } \cs_new_protected:Npn \__unravel_tex_error:nn #1#2 { - \group_begin: - \msg_error:nnxxx { unravel } { tex-error } + \__unravel_error:neeee { tex-error } { \tl_to_str:n {#2} } { \use:c { __unravel_tex_msg_error_#1: } } { \use:c { __unravel_tex_msg_help_#1: } } - \group_end: + { } } \cs_generate_variant:Nn \__unravel_tex_error:nn { nV } \cs_new_protected:Npn \__unravel_tex_fatal_error:nn #1#2 { - \__unravel_error:nxxxx { tex-fatal } + \__unravel_error:neeee { tex-fatal } { \tl_to_str:n {#2} } { \use:c { __unravel_tex_msg_error_#1: } } { \use:c { __unravel_tex_msg_help_#1: } } @@ -5913,6 +5973,10 @@ max-input .int_gset:N = \g__unravel_default_max_input_int , number-steps .bool_gset:N = \g__unravel_default_number_steps_bool , online .int_gset:N = \g__unravel_default_online_int , + output-file .code:n = { + \int_gzero:N \g__unravel_default_online_int + \tl_gset:Nn \g__unravel_default_output_file_tl {#1} + } , prompt-input .code:n = \__unravel_prompt_input:Nn \g__unravel_default_prompt_input_clist {#1} , trace-assigns .bool_gset:N = \g__unravel_default_trace_assigns_bool , @@ -5929,6 +5993,10 @@ max-input .int_gset:N = \g__unravel_max_input_int , number-steps .bool_gset:N = \g__unravel_number_steps_bool , online .int_gset:N = \g__unravel_online_int , + output-file .code:n = { + \int_gzero:N \g__unravel_online_int + \tl_gset:Nn \g__unravel_output_file_tl {#1} + } , prompt-input .code:n = \__unravel_prompt_input:Nn \g__unravel_prompt_input_clist {#1} , trace-assigns .bool_gset:N = \g__unravel_trace_assigns_bool , @@ -5987,7 +6055,7 @@ \cs_new_protected:Npn \unravel_get:nnN #1#2#3 { \unravel:nn {#1} {#2} - \tl_set:Nx #3 { \gtl_left_tl:N \g__unravel_output_gtl } + \tl_set:Ne #3 { \gtl_left_tl:N \g__unravel_output_gtl } } \cs_new_protected:Npn \__unravel_init_key_vars: { @@ -5996,6 +6064,7 @@ \bool_gset_eq:NN \g__unravel_internal_debug_bool \g__unravel_default_internal_debug_bool \bool_gset_eq:NN \g__unravel_number_steps_bool \g__unravel_default_number_steps_bool \int_gset_eq:NN \g__unravel_online_int \g__unravel_default_online_int + \tl_gset_eq:NN \g__unravel_output_file_tl \g__unravel_default_output_file_tl \clist_gset_eq:NN \g__unravel_prompt_input_clist \g__unravel_default_prompt_input_clist \bool_gset_eq:NN \g__unravel_trace_assigns_bool \g__unravel_default_trace_assigns_bool \bool_gset_eq:NN \g__unravel_trace_expansion_bool \g__unravel_default_trace_expansion_bool @@ -6005,9 +6074,18 @@ \int_gset_eq:NN \g__unravel_max_output_int \g__unravel_default_max_output_int \int_gset_eq:NN \g__unravel_max_input_int \g__unravel_default_max_input_int \int_gzero:N \g__unravel_nonstop_int + \tl_gclear:N \g__unravel_before_print_state_tl + \tl_gclear:N \g__unravel_before_prompt_tl } \cs_new_protected:Npn \__unravel_init_vars: { + \int_gset_eq:NN \g__unravel_current_online_int \g__unravel_online_int + \tl_if_eq:NNF \g__unravel_output_file_tl \g__unravel_current_output_file_tl + { + \iow_close:N \g__unravel_iow + \iow_open:Nn \g__unravel_iow \g__unravel_output_file_tl + \tl_gset_eq:NN \g__unravel_current_output_file_tl \g__unravel_output_file_tl + } \seq_gclear:N \g__unravel_prev_input_seq \gtl_gclear:N \g__unravel_output_gtl \int_gzero:N \g__unravel_step_int @@ -6037,10 +6115,10 @@ { \__unravel_set_action_text: \bool_if:NT \g__unravel_internal_debug_bool - { \__unravel_exp_args:Nx \iow_term:n { Cmd:~\int_to_arabic:n { \l__unravel_head_cmd_int } } } + { \iow_term:e { Cmd:~\int_to_arabic:n { \l__unravel_head_cmd_int } } } \cs_if_exist_use:cF { __unravel_cmd_ \int_use:N \l__unravel_head_cmd_int : } - { \__unravel_error:nxxxx { internal } { unknown-command } { } { } { } } + { \__unravel_error:neeee { internal } { unknown-command } { } { } { } } } \cs_new_protected:Npn \__unravel_final_test: { @@ -6065,12 +6143,12 @@ \cs_new_protected:Npn \__unravel_final_conditionals: { \group_begin: - \msg_warning:nnx { unravel } { dangling-conditionals } + \msg_warning:nne { unravel } { dangling-conditionals } { \tl_count:N \g__unravel_if_limit_tl } \group_end: \tl_greverse:N \g__unravel_if_limit_tl \tl_gput_right:NV \g__unravel_if_limit_tl \g__unravel_if_limit_int - \tl_gset:Nx \g__unravel_if_limit_tl { \tl_tail:N \g__unravel_if_limit_tl } % remove the {0} + \tl_gset:Ne \g__unravel_if_limit_tl { \tl_tail:N \g__unravel_if_limit_tl } % remove the {0} \prg_replicate:nn { \tl_count:N \g__unravel_if_limit_tl } { \fi: } \tl_map_function:NN \g__unravel_if_limit_tl \__unravel_final_cond_aux:n } -- cgit v1.2.3