diff options
author | Karl Berry <karl@freefriends.org> | 2018-04-05 21:11:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-04-05 21:11:06 +0000 |
commit | c489c440258c0e764d9a9424d724dd6306c8bd59 (patch) | |
tree | 0c8895cf16449120fc821e3b7a6b770859617f5b /Master/texmf-dist | |
parent | 0a9611e577325328b01e056e4f1a4f9124018446 (diff) |
unravel (5apr18)
git-svn-id: svn://tug.org/texlive/trunk@47308 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/unravel/unravel.pdf | bin | 709793 -> 688977 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/unravel/unravel.dtx | 1147 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/unravel/unravel.sty | 743 |
3 files changed, 1141 insertions, 749 deletions
diff --git a/Master/texmf-dist/doc/latex/unravel/unravel.pdf b/Master/texmf-dist/doc/latex/unravel/unravel.pdf Binary files differindex 3dda4e56617..2fb03b08529 100644 --- a/Master/texmf-dist/doc/latex/unravel/unravel.pdf +++ b/Master/texmf-dist/doc/latex/unravel/unravel.pdf diff --git a/Master/texmf-dist/source/latex/unravel/unravel.dtx b/Master/texmf-dist/source/latex/unravel/unravel.dtx index 328b20512ed..6572f1ed1ea 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 Bruno Le Floch +%% File: unravel.dtx Copyright (C) 2013, 2015, 2018 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.2, last revised 2015/09/30.}} +% file has version number 0.2e, last revised 2018/04/04.}} % \author{Bruno Le Floch} -% \date{2015/09/30} +% \date{2018/04/04} % % \maketitle % \tableofcontents @@ -132,8 +132,8 @@ % % Given all the work that \pkg{unravel} has to do to emulate \TeX{}, it % is not fast on very large pieces of code. For instance, running it on -% |\documentclass{article}| takes about ten minutes on my machine, and -% finishes after slightly more than $20000$ steps. +% |\documentclass{article}| takes about one minute on my machine, and +% finishes after somewhat less than $21000$ steps. % \begin{verbatim} % \RequirePackage{unravel} % \unravel{\documentclass{article}\relax} @@ -148,12 +148,11 @@ % would if your file ended just after |\documentclass{article}|. After % running the above through \pdfTeX{}, one can check that the result is % identical to that without \pkg{unravel}. Note that -% \cs{unravel}|\usepackage{lipsum}\relax|, despite taking as many steps -% to complete, is four times slower, because \tn{newcommand} uses +% \cs{unravel}|{\usepackage{lipsum}\relax}|, despite taking as many steps +% to complete, is much slower, because \tn{newcommand} uses % delimited arguments, which prevent some optimizations that % \pkg{unravel} can otherwise obtain. For comparison, -% |\unravel{\lipsum[1-30]}|, which also takes $20000$ step, takes -% $8$~minutes to complete. +% |\unravel{\lipsum[1-30]}| also takes $20000$ step. % % \subsection{Options} % \label{sec:options} @@ -344,7 +343,7 @@ % \end{macro} % % \begin{macro}[int]{\@@_setup_save:} -% \begin{macro}[aux, EXP]{\@@_setup_save_aux:n} +% \begin{macro}[EXP]{\@@_setup_save_aux:n} % This saves into \cs{l_@@_setup_restore_tl} the current catcodes % (from $0$ to $255$ only), \tn{endlinechar}, \tn{escapechar}, % \tn{newlinechar}. @@ -488,8 +487,8 @@ % \cs{str_range:nnn}. Otherwise loading \pkg{l3str} would give % an error. % \begin{macrocode} -\RequirePackage{expl3,xparse}[2015/09/11] -\RequirePackage{gtl}[2015/09/21] +\RequirePackage{expl3,xparse}[2018/02/21] +\RequirePackage{gtl}[2018/04/04] \csname cs_if_exist:cF\endcsname{str_range:nnn}{\RequirePackage{l3str}} % \end{macrocode} % @@ -507,7 +506,7 @@ {% \csname @@_setup_restore:\endcsname \ProvidesExplPackage - {unravel} {2015/09/30} {0.2} {Watching TeX digest tokens}% + {unravel} {2018/04/04} {0.2e} {Watching TeX digest tokens}% \csname @@_setup_unravel:\endcsname }% % \end{macrocode} @@ -536,10 +535,11 @@ \cs_new_eq:NN \@@_mag: \tex_mag:D \cs_new_eq:NN \@@_nullfont: \tex_nullfont:D \cs_new_eq:NN \@@_the:w \tex_the:D +\cs_new_eq:NN \@@_number:w \tex_number:D % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\c_@@_prompt_ior, \c_@@_noprompt_ior} +% \begin{macro}{\c_@@_prompt_ior, \c_@@_noprompt_ior} % These are not quite primitives, but are very low-level % |ior| streams to prompt the user explicitly or not. % \begin{macrocode} @@ -552,6 +552,7 @@ % % Variants that we need. % \begin{macrocode} +\cs_generate_variant:Nn \seq_push:Nn { Nf } \cs_generate_variant:Nn \str_head:n { f } \cs_generate_variant:Nn \tl_to_str:n { o } \cs_generate_variant:Nn \tl_if_head_eq_meaning:nNT { V } @@ -559,9 +560,8 @@ \cs_generate_variant:Nn \tl_if_in:nnTF { nV } \cs_generate_variant:Nn \tl_if_in:NnTF { No , NV } \cs_generate_variant:Nn \tl_if_single_token:nT { V } -\cs_generate_variant:Nn \tl_gset_rescan:Nnn { Nnx } \cs_generate_variant:Nn \gtl_gput_right:Nn { NV } -\cs_generate_variant:Nn \ior_get_str:NN { Nc } +\cs_generate_variant:Nn \ior_str_get:NN { Nc } \cs_generate_variant:Nn \gtl_if_empty:NTF { c } \cs_generate_variant:Nn \gtl_to_str:N { c } \cs_generate_variant:Nn \gtl_gpop_left:NN { c } @@ -572,17 +572,37 @@ \cs_generate_variant:Nn \gtl_gclear_new:N { c } % \end{macrocode} % +% \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}[aux]{\@@_tmp:w} +% \begin{macro}{\@@_tmp:w} % Temporary function used to define other functions. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_tmp:w { } % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_file_get:nN} -% \begin{macro}[aux]{\@@_file_get_aux:wN} +% \begin{macro}{\@@_file_get:nN} +% \begin{macro}{\@@_file_get_aux:wN} % \begin{macrocode} \cs_set_protected:Npn \@@_tmp:w #1 { @@ -607,7 +627,7 @@ % \end{macro} % % \begin{macro}[int, EXP]{\@@_tl_first_int:N} -% \begin{macro}[aux, EXP]{\@@_tl_first_int_aux:Nn} +% \begin{macro}[EXP]{\@@_tl_first_int_aux:Nn} % Function that finds an explicit number in a token list. This is % used for instance when implementing \tn{read}, to find the stream % \meta{number} within the whole \tn{read} \meta{number} |to| @@ -675,7 +695,7 @@ % \subsubsection{String helpers} % % \begin{macro}[int]{\@@_strip_escape:w} -% \begin{macro}[aux]{\@@_strip_escape_aux:N, \@@_strip_escape_aux:w} +% \begin{macro}{\@@_strip_escape_aux:N, \@@_strip_escape_aux:w} % This is based on the 2013-07-19 (and earlier) version of % \cs{cs_to_str:N}. There are three cases. If the escape character % is printable, the charcode test is false, and @@ -683,8 +703,8 @@ % character is a space, the charcode test is true, and if there is no % escape charcter, the test is unfinished after |\token_to_str:N \ |. % In both of those cases, \cs{@@_strip_escape_aux:w} inserts -% |-\__int_value:w \fi: \c_zero|. If the escape character was a -% space, the test was true, and \cs{__int_value:w} converts +% |-\@@_number:w \fi: \c_zero|. If the escape character was a +% space, the test was true, and \cs{int_value:w} converts % \cs{c_zero} to~|0|, hence the leading roman numeral expansion % removes a space from what follows (it is important that what follows % cannot start with a digit). Otherwise, the test takes~|-| as its @@ -699,17 +719,16 @@ } \cs_new:Npn \@@_strip_escape_aux:N #1 { \c_zero } \cs_new:Npn \@@_strip_escape_aux:w #1#2 - { - \__int_value:w #1 \c_zero } + { - \@@_number:w #1 \c_zero } % \end{macrocode} % \end{macro} % \end{macro} % % ^^A todo: change approach: this abuses future l3obj. % \begin{macro}[int,EXP]{\@@_to_str:n} -% \begin{macro}[aux,EXP] +% \begin{macro}[EXP] % {\@@_to_str_auxi:w, \@@_to_str_auxii:w, \@@_gtl_to_str:n} % Use the type-appropriate conversion to string. -% This unavoidably uses an internal function of \pkg{gtl}. % \begin{macrocode} \cs_new:Npn \@@_to_str:n #1 { @@ -728,14 +747,14 @@ \cs_new:Npn \@@_to_str_auxii:w ##1 #1 ##2 \q_mark ##3 \q_stop { \cs_if_exist_use:cF { @@_ ##2 _to_str:n } { \tl_to_str:n } } } -\exp_args:No \@@_tmp:w { \tl_to_str:n { s__ } } -\cs_new:Npn \@@_gtl_to_str:n #1 { \__gtl_to_str:w #1 } +\exp_args:No \@@_tmp:w { \tl_to_str:n { s _ _ } } +\cs_new:Npn \@@_gtl_to_str:n { \gtl_to_str:n } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}[int]{\@@_str_truncate_left:nn} -% \begin{macro}[aux]{\@@_str_truncate_left_aux:nnn} +% \begin{macro}{\@@_str_truncate_left_aux:nnn} % Truncate the string |#1| to a maximum of |#2| characters. If it is % longer, replace some characters on the left of the string by % |(123~more~chars)~| with the appropriate number instead of~|123|. @@ -760,7 +779,7 @@ % \end{macro} % % \begin{macro}[int]{\@@_str_truncate_right:nn} -% \begin{macro}[aux]{\@@_str_truncate_right_aux:nnn} +% \begin{macro}{\@@_str_truncate_right_aux:nnn} % Truncate the string |#1| to a maximum of |#2| characters. If it is % longer, replace some characters on the right of the string by % |~(123~more~chars)| with the appropriate number instead of~|123|. @@ -827,7 +846,7 @@ % % \begin{macro}[int]{\@@_token_to_char:N} % \begin{macro}[int]{\@@_meaning_to_char:n, \@@_meaning_to_char:o} -% \begin{macro}[aux] +% \begin{macro} % {\@@_meaning_to_char_auxi:w, \@@_meaning_to_char_auxii:w} % From the meaning of a character token (with arbitrary character % code, except active), extract the character itself (with string @@ -943,8 +962,7 @@ { \gtl_if_head_is_N_type:NTF #1 { - \exp_last_unbraced:Nx \@@_token_if_definable:NTF - { \gtl_head:N #1 } + \gtl_head_do:NN #1 \@@_token_if_definable:NTF { \prg_return_true: } { \prg_return_false: } } @@ -957,6 +975,51 @@ % % \subsubsection{Helpers for previous input} % +% \begin{macro}[EXP]{\@@_prev_input_count:, \@@_prev_input_count_aux:n} +% \begin{macrocode} +\cs_new_nopar:Npn \@@_prev_input_count: + { + \int_eval:n + { + 0 + \seq_map_function:NN \g_@@_prev_input_seq + \@@_prev_input_count_aux:n + } + } +\cs_new:Npn \@@_prev_input_count_aux:n #1 + { \tl_if_empty:nF {#1} { + 1 } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro} +% { +% \@@_prev_input_get:N, +% \@@_prev_input_gpush:, +% \@@_prev_input_gpush:N, +% \@@_prev_input_gpop:N, +% \@@_prev_input_gpush_gtl:, +% \@@_prev_input_gpush_gtl:N, +% \@@_prev_input_gpop_gtl:N, +% } +% ^^A todo: doc and add optional sanity checking +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_prev_input_get:N + { \seq_get_right:NN \g_@@_prev_input_seq } +\cs_new_protected_nopar:Npn \@@_prev_input_gpush: + { \seq_gput_right:Nn \g_@@_prev_input_seq { } } +\cs_new_protected_nopar:Npn \@@_prev_input_gpush:N + { \seq_gput_right:NV \g_@@_prev_input_seq } +\cs_new_protected_nopar:Npn \@@_prev_input_gpop:N + { \seq_gpop_right:NN \g_@@_prev_input_seq } +\cs_new_protected_nopar:Npn \@@_prev_input_gpush_gtl: + { \seq_gput_right:NV \g_@@_prev_input_seq \c_empty_gtl } +\cs_new_protected_nopar:Npn \@@_prev_input_gpush_gtl:N + { \seq_gput_right:NV \g_@@_prev_input_seq } +\cs_new_protected_nopar:Npn \@@_prev_input_gpop_gtl:N + { \seq_gpop_right:NN \g_@@_prev_input_seq } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[int] % { % \@@_prev_input_silent:n, @@ -972,17 +1035,21 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_prev_input_silent:n #1 { - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_prev_input_tl + \@@_prev_input_gpop:N \l_@@_prev_input_tl \tl_put_right:Nn \l_@@_prev_input_tl {#1} - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_prev_input_tl + \@@_prev_input_gpush:N \l_@@_prev_input_tl } -\cs_generate_variant:Nn \@@_prev_input_silent:n { V , x } +\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_new_protected:Npn \@@_prev_input:n #1 { \@@_prev_input_silent:n {#1} \@@_print_action:x { \tl_to_str:n {#1} } } -\cs_generate_variant:Nn \@@_prev_input:n { V , x } +\cs_generate_variant:Nn \@@_prev_input:n { V } +\cs_new_protected:Npn \@@_prev_input:x + { \@@_exp_args:Nx \@@_prev_input:n } % \end{macrocode} % \end{macro} % \end{macro} @@ -991,16 +1058,16 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_prev_input_gtl:N #1 { - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_prev_input_gtl + \@@_prev_input_gpop_gtl:N \l_@@_prev_input_gtl \gtl_concat:NNN \l_@@_prev_input_gtl \l_@@_prev_input_gtl #1 - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_prev_input_gtl + \@@_prev_input_gpush_gtl:N \l_@@_prev_input_gtl } % \end{macrocode} % \end{macro} % % \begin{macro}[int]{\@@_prev_input_join_get:nN} -% \begin{macro}[aux]{\@@_join_get_aux:NNN} -% Pops \cs{g_@@_prev_input_seq} twice to get some value in +% \begin{macro}{\@@_join_get_aux:NNN} +% Pops the previous-input sequence twice to get some value in % \cs{l_@@_head_tl} and some sign or decimal number in % \cs{l_@@_tmpa_tl}. Combines them into a value, using % the appropriate evaluation function, determined based @@ -1014,14 +1081,14 @@ { 3 } { \@@_join_get_aux:NNN \muskip_eval:n \etex_muexpr:D } } { - \msg_error:nnn { unravel } { internal } { join-factor } + \@@_error:nnnnn { internal } { join-factor } { } { } { } \@@_join_get_aux:NNN \use:n \prg_do_nothing: } } \cs_new_protected:Npn \@@_join_get_aux:NNN #1#2#3 { - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_prev_input_gpop:N \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_tmpa_tl \tl_set:Nx #3 { #1 { \l_@@_tmpa_tl #2 \l_@@_head_tl } } } % \end{macrocode} @@ -1199,7 +1266,7 @@ % \begin{macrocode} \gtl_new:N \l_@@_head_gtl \tl_new:N \l_@@_head_tl -\token_new:Nn \l_@@_head_token { ? } +\cs_new_eq:NN \l_@@_head_token ? \int_new:N \l_@@_head_cmd_int \int_new:N \l_@@_head_char_int % \end{macrocode} @@ -1227,7 +1294,7 @@ % \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 \cs{g_@@_prev_input_seq} to store that code: rather, +% not use the the previous-input sequence to store that code: rather, % 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 @@ -2132,7 +2199,7 @@ % \cs{l_@@_head_token}. % % \begin{macro}[int]{\@@_get_next:} -% \begin{macro}[aux]{\@@_get_next_aux:w} +% \begin{macro}{\@@_get_next_aux:w} % If the input is empty, forcefully exit. Otherwise, % remove the first token in the input, and store it in % \cs{l_@@_head_gtl}. Set \cs{l_@@_head_token} equal in meaning to @@ -2207,8 +2274,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_set_cmd_aux_meaning:} -% \begin{macro}[aux,EXP]{\@@_set_cmd_aux_meaning:w} +% \begin{macro}{\@@_set_cmd_aux_meaning:} +% \begin{macro}[EXP]{\@@_set_cmd_aux_meaning:w} % Remove the leading escape character (\cs{@@_strip_escape:w} takes % care of special cases there) from the \tn{meaning} of the first % token, then remove anything after the first~|:|, which is present @@ -2238,9 +2305,9 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux] +% \begin{macro} % {\@@_set_cmd_aux_primitive:nTF, \@@_set_cmd_aux_primitive:oTF} -% \begin{macro}[aux]{\@@_set_cmd_aux_primitive:nn} +% \begin{macro}{\@@_set_cmd_aux_primitive:nn} % Test if there is any information about the given (cleaned-up) % \tn{meaning}. If there is, use that as the command and character % integers. @@ -2264,7 +2331,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux]{\@@_set_cmd_aux_macro:} +% \begin{macro}{\@@_set_cmd_aux_macro:} % The token is a macro. There is no need to determine whether the % macro is long/outer. % \begin{macrocode} @@ -2276,7 +2343,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_set_cmd_aux_unknown:} +% \begin{macro}{\@@_set_cmd_aux_unknown:} % Complain about an unknown primitive, and consider it as if it were % \tn{relax}. % \begin{macrocode} @@ -2284,13 +2351,13 @@ { \exp_last_unbraced:NV \@@_set_cmd_aux_primitive:nn \c_@@_tex_relax_tl - \msg_error:nnx { unravel } { unknown-primitive } - { \l_@@_head_meaning_tl } + \@@_error:nxxxx { unknown-primitive } + { \l_@@_head_meaning_tl } { } { } { } } % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_set_cmd_aux_cs:} +% \begin{macro}{\@@_set_cmd_aux_cs:} % If the \tn{meaning} contains \verb*|elect font|, the control % sequence is \tn{nullfont} or similar (note that we do not search for % \verb*|select font|, as the code to trim the escape character from @@ -2313,13 +2380,13 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux] +% \begin{macro} % { % \@@_set_cmd_aux_numeric:, % \@@_set_cmd_aux_numeric:w, % \@@_set_cmd_aux_given:n % } -% \begin{macro}[aux,rEXP]{\@@_set_cmd_aux_numeric:N} +% \begin{macro}[rEXP]{\@@_set_cmd_aux_numeric:N} % Insert \cs{q_mark} before the first non-letter (in fact, anything % less than~|A|) in the \tn{meaning} by looping one character at a % time (skipping spaces, but there should be none). We expect the @@ -2375,8 +2442,8 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux]{\@@_set_cmd_aux_char:} -% \begin{macro}[aux]{\@@_set_cmd_aux_char:w} +% \begin{macro}{\@@_set_cmd_aux_char:} +% \begin{macro}{\@@_set_cmd_aux_char:w} % At this point, the \tn{meaning} token list has been shortened by the % code meant to remove the escape character. We thus set it again to % the \tn{meaning} of the leading token. The command is then the @@ -2393,7 +2460,7 @@ { \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:NNx \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 @@ -2470,8 +2537,9 @@ \gtl_if_head_is_N_type:NT #1 { \tl_set:Nx \l_@@_input_tmpa_tl { \gtl_left_tl:N #1 } - \exp_last_unbraced:Nx \@@_input_split_auxii:N - { \tl_head:N \l_@@_input_tmpa_tl } + \@@_exp_args:NNx \use:nn + \@@_input_split_auxii:N + { \tl_head:N \l_@@_input_tmpa_tl } } } } @@ -2546,7 +2614,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_input_merge:} +% \begin{macro}{\@@_input_merge:} % Merge the top two levels of input. This requires, but does not % check, that \cs{g_@@_input_int} is at least~$2$. % \begin{macrocode} @@ -2564,7 +2632,7 @@ % \end{macro} % % \begin{macro}[int,TF]{\@@_input_gpop_item:N} -% \begin{macro}[aux]{\@@_input_gpop_item_aux:NN} +% \begin{macro}{\@@_input_gpop_item_aux:NN} % If there is no input, we cannot pop an item. Othewise, try to pop % from the top of the input stack. If this succeeds, or if this % failed and the top of stack has extra end-group characters, or if @@ -2656,7 +2724,9 @@ \gtl_gclear_new:c { g_@@_input_ \int_use:N \g_@@_input_int _gtl } \gtl_gset:cn { g_@@_input_ \int_use:N \g_@@_input_int _gtl } } -\cs_generate_variant:Nn \@@_back_input:n { x , V , o } +\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} % @@ -2723,10 +2793,11 @@ % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_insert_group_begin_error: { - \msg_error:nn { unravel } { missing-lbrace } + \tl_set_eq:NN \l_@@_tmpa_tl \l_@@_head_tl \@@_back_input: \gtl_set_eq:NN \l_@@_head_gtl \c_group_begin_gtl \@@_back_input: + \@@_tex_error:nV { missing-lbrace } \l_@@_tmpa_tl \@@_print_action: } % \end{macrocode} @@ -2738,7 +2809,7 @@ { \@@_back_input: \@@_back_input:n { $ } % $ - \msg_error:nn { unravel } { missing-dollar } + \@@_error:nnnnn { missing-dollar } { } { } { } { } \@@_print_action: } % \end{macrocode} @@ -2746,7 +2817,7 @@ % % \subsubsection{Macro calls} % -% \begin{macro}[aux,EXP] +% \begin{macro}[EXP] % { % \@@_macro_prefix:N, % \@@_macro_parameter:N, @@ -2778,7 +2849,7 @@ % % ^^A todo: redoc % \begin{macro}[int]{\@@_macro_call:} -% \begin{macro}[aux] +% \begin{macro} % { % \@@_macro_call_safe:, % \@@_macro_call_quick:, @@ -2826,8 +2897,8 @@ } \cs_new_protected:Npn \@@_macro_call_quick_runaway:Nw #1#2 \q_stop { - \msg_error:nnxx { unravel } { runaway-macro-parameter } - { \tl_to_str:N \l_@@_head_tl } { \tl_to_str:n {#1} } + \@@_error:nxxxx { runaway-macro-parameter } + { \tl_to_str:N \l_@@_head_tl } { \tl_to_str:n {#1} } { } { } } % \end{macrocode} % \end{macro} @@ -2847,7 +2918,7 @@ \bool_if:NT \g_@@_internal_debug_bool { \@@_set_cmd: - \iow_term:x { Exp:~\int_to_arabic:n { \l_@@_head_cmd_int } } + \@@_exp_args:Nx \iow_term:n { Exp:~\int_to_arabic:n { \l_@@_head_cmd_int } } } \token_if_macro:NTF \l_@@_head_token { \@@_macro_call: } @@ -2871,11 +2942,11 @@ { \cs_if_exist_use:cF { @@_expandable_ \int_use:N \l_@@_head_cmd_int : } - { \msg_error:nnx { unravel } { internal } { expandable } } + { \@@_error:nxxxx { internal } { expandable } { } { } { } } } { - \msg_error:nnx { unravel } { unknown-primitive } - { \l_@@_head_meaning_tl } + \@@_error:nxxxx { unknown-primitive } + { \l_@@_head_meaning_tl } { } { } { } \gtl_gput_right:NV \g_@@_output_gtl \l_@@_head_tl \@@_print_action: } @@ -2921,7 +2992,7 @@ % ^^A todo: implement |test_no_ligatures|? % ^^A todo: implement |get_tag_code|? % -% \begin{macro}[aux]{\@@_get_x_non_blank:} +% \begin{macro}{\@@_get_x_non_blank:} % This function does not set the |cmd| and |char| integers. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_get_x_non_blank: @@ -2933,7 +3004,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_get_x_non_relax:} +% \begin{macro}{\@@_get_x_non_relax:} % This function does not set the |cmd| and |char| integers. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_get_x_non_relax: @@ -2949,7 +3020,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_skip_optional_space:} +% \begin{macro}{\@@_skip_optional_space:} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_skip_optional_space: { @@ -2960,11 +3031,11 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_optional_equals:} +% \begin{macro}{\@@_scan_optional_equals:} % See \TeX{}'s |scan_optional_equals|. In all cases we forcefully % insert an equal sign in the output, because this sign is required, % as \cs{@@_scan_something_internal:n} leaves raw numbers in -% \cs{g_@@_prev_input_seq}. +% the previous-input sequence. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_scan_optional_equals: { @@ -2980,21 +3051,25 @@ % \end{macro} % % \begin{macro}[int]{\@@_scan_left_brace:} -% The presence of \tn{relax} is allowed before a begin-group -% character. +% The presence of \tn{relax} is allowed before a begin-group token. +% If there is no begin-group token, insert one, produce an error, and +% scan that begin-group using \cs{@@_get_next:}. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_scan_left_brace: { \@@_get_x_non_relax: \token_if_eq_catcode:NNF \l_@@_head_token \c_group_begin_token - { \@@_insert_group_begin_error: } + { + \@@_insert_group_begin_error: + \@@_get_next: + } } % \end{macrocode} % \end{macro} % % \begin{macro}[int]{\@@_scan_keyword:n} % \begin{macro}[int,TF]{\@@_scan_keyword:n} -% \begin{macro}[aux] +% \begin{macro} % { % \@@_scan_keyword_loop:NNN, % \@@_scan_keyword_test:NNTF, @@ -3019,7 +3094,7 @@ % at the first character only; spaces become an empty string, but this % works out because no keyword contains a space. So, at each % iteration, if the token is the correct non-active character, add it -% to \cs{g_@@_prev_input_seq} (as a generalized token list since +% to the previous-input sequence (as a generalized token list since % keywords may match begin-group or end-group characters), and % otherwise break with \cs{@@_scan_keyword_false:w}, unless we are % still at the beginning of the keyword and the token is a space. @@ -3040,7 +3115,7 @@ \prg_new_protected_conditional:Npnn \@@_scan_keyword:n #1 { T , F , TF } { - \seq_gput_right:NV \g_@@_prev_input_seq \c_empty_gtl + \@@_prev_input_gpush_gtl: \@@_scan_keyword_loop:NNN \c_true_bool #1 \q_recursion_tail \q_recursion_tail \q_recursion_stop } @@ -3049,7 +3124,7 @@ \quark_if_recursion_tail_stop_do:nn {#2} { \@@_scan_keyword_true: } \quark_if_recursion_tail_stop_do:nn {#3} - { \msg_error:nnx { unravel } { internal } { odd-keyword-length } } + { \@@_error:nxxxx { internal } { odd-keyword-length } { } { } { } } \@@_get_x_next: \@@_scan_keyword_test:NNTF #2#3 { @@ -3083,7 +3158,7 @@ } \cs_new_protected_nopar:Npn \@@_scan_keyword_true: { - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_tmpb_gtl + \@@_prev_input_gpop_gtl:N \l_@@_tmpb_gtl \@@_prev_input:x { \gtl_to_str:N \l_@@_tmpb_gtl } \prg_return_true: } @@ -3091,7 +3166,7 @@ #1 \q_recursion_stop { \@@_back_input: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_tmpb_gtl + \@@_prev_input_gpop_gtl:N \l_@@_tmpb_gtl \@@_back_input_gtl:N \l_@@_tmpb_gtl \prg_return_false: } @@ -3100,7 +3175,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_to:} +% \begin{macro}{\@@_scan_to:} % Used when |to| is mandatory: after \tn{read} or \tn{readline} and % after \tn{vsplit}. % \begin{macrocode} @@ -3108,14 +3183,14 @@ { \@@_scan_keyword:nF { tToO } { - \msg_error:nn { unravel } { missing-to } + \@@_error:nnnnn { missing-to } { } { } { } { } \@@_prev_input:n { to } } } % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_font_ident:} +% \begin{macro}{\@@_scan_font_ident:} % Find a font identifier. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_scan_font_ident: @@ -3139,7 +3214,7 @@ } } { - \msg_error:nn { unravel } { missing-font-id } + \@@_error:nnnnn { missing-font-id } { } { } { } { } \@@_back_input: \@@_prev_input:n { \@@_nullfont: } } @@ -3147,7 +3222,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_font_int:} +% \begin{macro}{\@@_scan_font_int:} % Find operands for one of \tn{hyphenchar}'s friends (command code % |assign_font_int=78|). % \begin{macrocode} @@ -3164,7 +3239,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_font_dimen:} +% \begin{macro}{\@@_scan_font_dimen:} % Find operands for \tn{fontdimen}. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_scan_font_dimen: @@ -3175,10 +3250,9 @@ % \end{macrocode} % \end{macro} % -% ^^A todo: redoc % ^^A todo: rename this function because all other scan functions do get_x_next themselves. -% \begin{macro}[aux]{\@@_scan_something_internal:n} -% \begin{macro}[aux]{\@@_scan_something_aux:nwn} +% \begin{macro}{\@@_scan_something_internal:n} +% \begin{macro}{\@@_scan_something_aux:nwn} % Receives an (explicit) \enquote{level} argument: % \begin{itemize} % \item |int_val=0| for integer values; @@ -3186,33 +3260,40 @@ % \item |glue_val=2| for glue specifications; % \item |mu_val=3| for math glue specifications; % \item |ident_val=4| for font identifiers (this never happens); -% \item |tok_val=5| for token lists. +% \item |tok_val=5| for token lists (after |\the| or |\showthe|). % \end{itemize} % Scans something internal, and places its value, converted to the % given level, to the right of the last item of -% \cs{g_@@_prev_input_seq}, then sets \cs{g_@@_val_level_int} to the +% the previous-input sequence, then sets \cs{g_@@_val_level_int} to the % found level (level before conversion, so this may be higher than -% requested). Get in one go the information about what level is +% requested). +% +% From \cs{@@_thing_case:}, get the information about what level is % produced by the given token once it has received all its operands % (head of \cs{l_@@_tmpa_tl}), and about what to do to find those -% operands (tail of \cs{l_@@_tmpa_tl}). If the first token is not -% between |min_internal=68| and |max_internal=89|, this step claims a -% level of~$8$. If the level that will be produced is $4$ or~$5$, but -% the argument~|#1| is not, or if the level is~$8$ (exercise: check -% that the conditional indeed checks for this case, given that \eTeX{} -% rounds ``to nearest, ties away from zero''), then complain. -% Otherwise, fetch arguments if there are any: the scanning is -% performed after placing the current token in a new level of -% |prev_input| and telling the user about it. Once done with this -% step, \cs{l_@@_head_tl} contains the tokens found. Convert them to -% the wanted level with \cs{@@_thing_use_get:nnNN} (at this stage, \TeX{} -% may complain about a missing number or incompatible glue units), and -% place the result in |prev_input|. Finally, tell the user the tokens -% that have been found and their value (and, if there was a single -% token, its meaning). Use |=>| rather than |=| because the value -% displayed is the value used, not the actual value (this matters in -% constructions such as |\parindent=\parskip| where a skip or a dimen -% is downgraded to a dimen or an int). +% operands (tail of \cs{l_@@_tmpa_tl}). If the first token may not +% appear after \tn{the} at all, \cs{@@_thing_case:} gives level~$8$. +% +% If the argument (|#3|~in the auxiliary) is $<4$ but the level that +% will be produced (|#1|~in the auxiliary) is $\geq 4$ (that is, +% $4$, $5$, or $8$) complain about a missing number and insert a +% zero dimension, to get exactly \TeX{}'s error recovery. If the +% level produced is~$8$, complain that |\the| cannot do this. +% +% Otherwise, scan the arguments (in a new input level). If both the +% argument and the level produced are $<4$, then get the value with +% \cs{@@_thing_use_get:nnNN} which downgrades from glue to dimension +% to integer and produces the |incompatible-units| error if needed. +% The only remaining case is that the argument is $5$ (since $4$ is +% never used) and the level produced is that or less: then the value +% found is used with \cs{@@_the:w}. +% +% Finally, tell the user the tokens that have been found (if there +% was a single token, its meaning as well) and their value. Use |=>| +% rather than |=| because the value displayed is the value used, not +% the actual value (this matters in constructions such as +% |\parindent=\parskip| where a skip or a dimen is downgraded to a +% dimen or an int, or when there was an error). % \begin{macrocode} \cs_new_protected:Npn \@@_scan_something_internal:n #1 { @@ -3224,35 +3305,49 @@ } \cs_new_protected:Npn \@@_scan_something_aux:nwn #1#2 \q_stop #3 { - \int_compare:nNnTF - { ( #1 + \c_two ) / \c_four } > { ( #3 + \c_two ) / \c_four } + \int_compare:nT { #3 < 4 <= #1 } { \@@_back_input: - \msg_error:nn { unravel } { missing-something } - \tl_clear:N \l_@@_tmpa_tl + \@@_tex_error:nV { missing-number } \l_@@_head_tl + \@@_thing_use_get:nnNN { 1 } {#3} \c_zero_dim \l_@@_tmpa_tl + \@@_scan_something_internal_auxii:Vn \l_@@_tmpa_tl { 1 } + \@@_break:w } + \int_compare:nNnT {#1} = { 8 } { - \tl_if_empty:nF {#2} - { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl - \@@_print_action: - #2 - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl - } - \@@_thing_use_get:nnNN {#1} {#3} \l_@@_head_tl \l_@@_tmpa_tl + \@@_tex_error:nV { the-cannot } \l_@@_head_tl + \@@_scan_something_internal_auxii:Vn \c_zero { 0 } + \@@_break:w } - \@@_prev_input_silent:V \l_@@_tmpa_tl + \tl_if_empty:nF {#2} + { + \@@_prev_input_gpush:N \l_@@_head_tl + \@@_print_action: + #2 + \@@_prev_input_gpop:N \l_@@_head_tl + } + \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 } } + \@@_scan_something_internal_auxii:Vn \l_@@_tmpa_tl {#1} + \@@_break_point: + \int_compare:nNnT {#3} < { 4 } { \@@_print_action: } + } +\cs_new_protected:Npn \@@_scan_something_internal_auxii:nn #1#2 + { + \@@_prev_input_silent:n {#1} \@@_set_action_text: \@@_set_action_text:x - { \g_@@_action_text_str \use:n { ~ => ~ } \tl_to_str:N \l_@@_tmpa_tl } - \int_compare:nNnF {#3} > { 3 } { \@@_print_action: } - \int_gset:Nn \g_@@_val_level_int {#1} + { \g_@@_action_text_str \use:n { ~ => ~ } \tl_to_str:n {#1} } + \int_gset:Nn \g_@@_val_level_int {#2} } +\cs_generate_variant:Nn \@@_scan_something_internal_auxii:nn { V } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[aux, EXP] +% ^^A todo: \the can be followed by ignore_spaces +% \begin{macro}[EXP] % {\@@_thing_case:, \@@_thing_last_item:, \@@_thing_register:} % This expands to a digit (the level generated by whatever token is % the current |head|), followed by some code to fetch necessary @@ -3290,6 +3385,8 @@ { 87 } { 4 } % set_font { 88 } { 4 } % def_font { 89 } { \@@_thing_register: } % register + {101 } { 4 } % letterspace_font + {102 } { 4 } % pdf_copy_font } { 8 } } @@ -3347,7 +3444,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_toks_register:} +% \begin{macro}{\@@_scan_toks_register:} % A case where getting operands is not completely trivial. % \begin{macrocode} \cs_new_protected:Npn \@@_scan_toks_register: @@ -3358,12 +3455,10 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_thing_use_get:nnNN} -% Given a level found~|#1| and a target level~|#2| (with |#1| in -% $[0,3]$ or |#1| and |#2| in $[4,5]$), turn the token list |#3| into -% the desired level, and store the result in |#4|. This step may -% trigger \TeX{} errors, which should precisely match the expected -% ones. +% \begin{macro}{\@@_thing_use_get:nnNN} +% Given a level found~|#1| and a target level~|#2| (both in $[0,3]$), +% turn the token list |#3| into the desired level or less, and store +% the result in |#4|. % \begin{macrocode} \cs_new_protected:Npn \@@_thing_use_get:nnNN #1#2#3#4 { @@ -3383,27 +3478,23 @@ } } { - \int_compare:nNnTF {#2} = { 3 } + \int_case:nnF {#1} { - \int_case:nnF {#1} - { - { 0 } { \tl_set:Nx #4 { \int_eval:n {#3} } } - { 3 } { \tl_set:Nx #4 { \muskip_eval:n {#3} } } - } - { - \@@_tex_error:nV { incompatible-units } #3 - \tl_set:Nx #4 { \muskip_eval:n { \etex_gluetomu:D #3 } } - } + { 0 } { \tl_set:Nx #4 { \int_eval:n {#3} } } + { 3 } { \tl_set:Nx #4 { \muskip_eval:n {#3} } } + } + { + \@@_tex_error:nV { incompatible-units } #3 + \tl_set:Nx #4 { \muskip_eval:n { \etex_gluetomu:D #3 } } } - { \tl_set:Nx #4 { \@@_the:w #3 } } } } % \end{macrocode} % \end{macro} % % ^^A todo: comment -% \begin{macro}[aux]{\@@_scan_expr:N} -% \begin{macro}[aux]{\@@_scan_expr_aux:NN, \@@_scan_factor:N} +% \begin{macro}{\@@_scan_expr:N} +% \begin{macro}{\@@_scan_expr_aux:NN, \@@_scan_factor:N} % \begin{macrocode} \cs_new_protected:Npn \@@_scan_expr:N #1 { \@@_scan_expr_aux:NN #1 \c_false_bool } @@ -3452,7 +3543,7 @@ { \bool_if:NTF #2 { - \msg_error:nn { unravel } { missing-rparen } + \@@_error:nnnnn { missing-rparen } { } { } { } { } \@@_back_input: \@@_prev_input:V \c_@@_rp_tl } @@ -3478,7 +3569,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_signs:} +% \begin{macro}{\@@_scan_signs:} % Skips blanks, scans signs, and places them to the right of the last % item of \cs{@@_prev_input:n}. % \begin{macrocode} @@ -3501,8 +3592,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_int:} -% \begin{macro}[aux] +% \begin{macro}{\@@_scan_int:} +% \begin{macro} % {\@@_scan_int_char:, \@@_scan_int_lq:, \@@_scan_int_explicit:n} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_scan_int: @@ -3522,16 +3613,16 @@ { \@@_prev_input:V \l_@@_head_tl \@@_get_x_next: - \@@_scan_int_explicit:n { ' } + \@@_scan_int_explicit:Nn \c_false_bool { ' } } \c_@@_dq_tl { \@@_prev_input:V \l_@@_head_tl \@@_get_x_next: - \@@_scan_int_explicit:n { " } + \@@_scan_int_explicit:Nn \c_false_bool { " } } } - { \@@_scan_int_explicit:n { } } + { \@@_scan_int_explicit:Nn \c_false_bool { } } } \cs_new_protected_nopar:Npn \@@_scan_int_lq: { @@ -3548,10 +3639,10 @@ { ` \gtl_to_str:N \l_@@_head_gtl = \l_@@_tmpa_tl } \@@_skip_optional_space: } -\cs_new_protected:Npn \@@_scan_int_explicit:n #1 +\cs_new_protected:Npn \@@_scan_int_explicit:Nn #1#2 { \if_int_compare:w \c_one - < #1 1 \exp_after:wN \exp_not:N \l_@@_head_tl \exp_stop_f: + < #2 1 \exp_after:wN \exp_not:N \l_@@_head_tl \exp_stop_f: \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn @@ -3559,11 +3650,16 @@ { \@@_prev_input:V \l_@@_head_tl \@@_get_x_next: - \@@_scan_int_explicit:n {#1} + \@@_scan_int_explicit:Nn \c_true_bool {#2} } { \token_if_eq_catcode:NNF \l_@@_head_token \c_space_token { \@@_back_input: } + \bool_if:NF #1 + { + \@@_tex_error:nV { missing-number } \l_@@_head_tl + \@@_prev_input:n { 0 } + } } } % \end{macrocode} @@ -3585,12 +3681,12 @@ % \TeX{}'s own |scan_dimen| procedure, in which |mu| is |bool(#1=3)| % and |inf| is |#2|. The third argument of this procedure is omitted % here, as the corresponding shortcut is provided as a separate -% function, \cs{@@_scan_dimen_unit:nN}. +% function, \cs{@@_scan_dim_unit:nN}. % \begin{macrocode} \cs_new_protected:Npn \@@_scan_dimen:nN #1#2 { \@@_scan_signs: - \seq_gput_right:Nn \g_@@_prev_input_seq { } + \@@_prev_input_gpush: \@@_set_cmd: \@@_cmd_if_internal:TF { @@ -3601,7 +3697,7 @@ { \@@_scan_dim_unit:nN {#1} #2 } } { \@@_scan_dimen_char:nN {#1} #2 } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \@@_prev_input_silent:V \l_@@_head_tl } \cs_new_protected:Npn \@@_scan_dimen_char:nN #1#2 @@ -3648,17 +3744,18 @@ \@@_set_cmd: \@@_cmd_if_internal:TF { - \seq_gput_right:Nn \g_@@_prev_input_seq { } + \@@_prev_input_gpush: \@@_scan_something_internal:n {#1} \@@_prev_input_join_get:nN {#1} \l_@@_tmpa_tl - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_prev_input_gpush:N \l_@@_tmpa_tl \@@_break:w } { \@@_back_input: } \int_compare:nNnT {#1} = { 3 } { \@@_scan_keyword:nT { mMuU } { \@@_break:w } - \msg_error:nn { unravel } { missing-mudim } + \@@_tex_error:nV { missing-mu } \l_@@_head_tl + \@@_prev_input:n { mu } \@@_break:w } \@@_scan_keyword:nT { eEmM } { \@@_break:w } @@ -3677,6 +3774,8 @@ \@@_scan_keyword:nT { nNdD } { \@@_break:w } \@@_scan_keyword:nT { nNcC } { \@@_break:w } \@@_scan_keyword:nT { sSpP } { \@@_break:w } + \@@_tex_error:nV { missing-pt } \l_@@_head_tl + \@@_prev_input:n { pt } \@@_break_point: } \cs_new_protected_nopar:Npn \@@_scan_inf_unit_loop: @@ -3713,24 +3812,24 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_scan_glue:n #1 { - \seq_gput_right:Nn \g_@@_prev_input_seq { } + \@@_prev_input_gpush: \@@_scan_signs: - \seq_gput_right:Nn \g_@@_prev_input_seq { } + \@@_prev_input_gpush: \@@_set_cmd: \@@_cmd_if_internal:TF { \@@_scan_something_internal:n {#1} \int_case:nnF \g_@@_val_level_int { - { 0 } { \@@_scan_dimen:nN {#1} \c_false_bool } + { 0 } { \@@_scan_dim_unit:nN {#1} \c_false_bool } { 1 } { } } { \@@_break:w } } { \@@_back_input: \@@_scan_dimen:nN {#1} \c_false_bool } \@@_prev_input_join_get:nN {#1} \l_@@_tmpa_tl - \seq_gput_right:Nn \g_@@_prev_input_seq { } - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_prev_input_gpush: + \@@_prev_input_gpush:N \l_@@_tmpa_tl \@@_scan_keyword:nT { pPlLuUsS } { \@@_scan_dimen:nN {#1} \c_true_bool } \@@_scan_keyword:nT { mMiInNuUsS } @@ -3784,7 +3883,7 @@ { \@@_get_next: } \@@_gtl_if_head_is_definable:NF \l_@@_head_gtl { - \msg_error:nn { unravel } { missing-cs } + \@@_error:nnnnn { missing-cs } { } { } { } { } \@@_back_input: \tl_set:Nn \l_@@_head_tl { \@@_inaccessible:w } } @@ -3795,13 +3894,13 @@ % \end{macro} % % ^^A todo: hash doubling is wrong -% \begin{macro}[aux]{\@@_scan_toks_to_str:} +% \begin{macro}{\@@_scan_toks_to_str:} % \begin{macrocode} \cs_new_protected:Npn \@@_scan_toks_to_str: { - \seq_gput_right:Nn \g_@@_prev_input_seq { } + \@@_prev_input_gpush: \@@_scan_toks:NN \c_false_bool \c_true_bool - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_prev_input_gpop:N \l_@@_tmpa_tl \@@_prev_input_silent:x { { \exp_after:wN \tl_to_str:n \l_@@_tmpa_tl } } } @@ -3809,7 +3908,7 @@ % \end{macro} % % ^^A todo: provide separate functions for defs (avoid hash doubling). -% \begin{macro}[aux]{\@@_scan_toks:NN} +% \begin{macro}{\@@_scan_toks:NN} % \begin{macrocode} \cs_new_protected:Npn \@@_scan_toks:NN #1#2 { @@ -3822,8 +3921,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_param:} -% \begin{macro}[aux]{\@@_scan_param_aux:} +% \begin{macro}{\@@_scan_param:} +% \begin{macro}{\@@_scan_param_aux:} % Collect the parameter text into \cs{l_@@_tmpa_tl}, and when seeing % either a begin-group or an end-group character, put it back into the % input, stop looping, and put what we collected into @@ -3848,14 +3947,14 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_group_n:N} +% \begin{macro}{\@@_scan_group_n:N} % \begin{macrocode} \cs_new_protected:Npn \@@_scan_group_n:N #1 { \@@_back_input: \@@_input_gpop_item:NF \l_@@_head_tl { - \msg_error:nn { unravel } { runaway-text } + \@@_error:nnnnn { runaway-text } { } { } { } { } \@@_exit:w } \tl_set:Nx \l_@@_head_tl { { \exp_not:V \l_@@_head_tl } } @@ -3866,7 +3965,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_group_x:N} +% \begin{macro}{\@@_scan_group_x:N} % \begin{macrocode} \cs_new_protected:Npn \@@_scan_group_x:N #1 { @@ -3879,10 +3978,10 @@ \@@_scan_group_xdef:n { 1 } } { - \seq_gput_right:NV \g_@@_prev_input_seq \c_empty_gtl + \@@_prev_input_gpush_gtl: \@@_prev_input_gtl:N \l_@@_head_gtl \@@_scan_group_x:n { 1 } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_tmpb_gtl + \@@_prev_input_gpop_gtl:N \l_@@_tmpb_gtl \@@_prev_input_silent:x { \gtl_left_tl:N \l_@@_tmpb_gtl } } @@ -3890,7 +3989,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_group_xdef:n} +% \begin{macro}{\@@_scan_group_xdef:n} % \begin{macrocode} \cs_new_protected:Npn \@@_scan_group_xdef:n #1 { @@ -3921,7 +4020,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_group_x:n} +% \begin{macro}{\@@_scan_group_x:n} % \begin{macrocode} \cs_new_protected:Npn \@@_scan_group_x:n #1 { @@ -3942,7 +4041,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_get_token_x:N} +% \begin{macro}{\@@_get_token_x:N} % \begin{macrocode} \cs_new_protected:Npn \@@_get_token_x:N #1 { @@ -3960,7 +4059,7 @@ \@@_prev_input:V \l_@@_head_tl } { - \gtl_set:Nx \l_@@_tmpb_gtl { \l_@@_head_tl } + \@@_exp_args:NNx \gtl_set:Nn \l_@@_tmpb_gtl { \l_@@_head_tl } \@@_prev_input_gtl:N \l_@@_tmpb_gtl \@@_print_action: } @@ -3974,7 +4073,7 @@ % % ^^A todo: catch runaway expand/get_x_next. (get_next too, probably) % -% \begin{macro}[aux]{\@@_scan_alt_rule:} +% \begin{macro}{\@@_scan_alt_rule:} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_scan_alt_rule: { @@ -4001,7 +4100,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_spec:} +% \begin{macro}{\@@_scan_spec:} % Some \TeX{} primitives accept the keywords |to| and |spread|, % followed by a dimension. % \begin{macrocode} @@ -4019,9 +4118,9 @@ % % \subsection{Working with boxes} % -% \begin{macro}[aux]{\@@_do_box:N} +% \begin{macro}{\@@_do_box:N} % When this procedure is called, the last item in -% \cs{g_@@_prev_input_seq} is +% the previous-input sequence is % \begin{itemize} % \item empty if the box is meant to be put in the input stream, % \item \tn{setbox}\meta{int} if it is meant to be stored somewhere, @@ -4059,26 +4158,26 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_do_box_error:} +% \begin{macro}{\@@_do_box_error:} % Put the (non-|make_box|) command back into the input and complain. % Then recover by throwing away the action (last item of -% \cs{g_@@_prev_input_seq}). For some reason (this appears to be what +% the previous-input sequence). For some reason (this appears to be what % \TeX{} does), there is no need to remove the after assignment token % here. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_do_box_error: { \@@_back_input: - \msg_error:nn { unravel } { missing-box } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_error:nnnnn { missing-box } { } { } { } { } + \@@_prev_input_gpop:N \l_@@_head_tl \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } } % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_do_begin_box:N} +% \begin{macro}{\@@_do_begin_box:N} % We have just found a |make_box| command and placed it into the last -% item of \cs{g_@@_prev_input_seq}. If it is ``simple'' +% item of the previous-input sequence. If it is ``simple'' % (\tn{box}\meta{int}, \tn{copy}\meta{int}, \tn{lastbox}, % \tn{vsplit}\meta{int} \texttt{to} \meta{dim}) then we grab its % operands, then call \cs{@@_do_simple_box:N} to finish up. If it is @@ -4105,7 +4204,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_do_simple_box:N} +% \begin{macro}{\@@_do_simple_box:N} % For leaders, we need to fetch a glue. In all cases, retrieve the % box construction (such as |\raise3pt\vsplit7to5em|). Finally, let % \TeX{} run the code and print what we have done. @@ -4116,7 +4215,7 @@ { \bool_if:NTF #1 { \@@_do_leaders_fetch_skip: } { - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \tl_if_head_eq_meaning:VNT \l_@@_head_tl \tex_shipout:D { \@@_prepare_mag: } \tl_use:N \l_@@_head_tl \scan_stop: @@ -4127,7 +4226,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_do_leaders_fetch_skip:} +% \begin{macro}{\@@_do_leaders_fetch_skip:} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_do_leaders_fetch_skip: { @@ -4136,14 +4235,14 @@ \int_compare:nNnTF \l_@@_head_cmd_int = { \@@_tex_use:n { \mode_if_vertical:TF { vskip } { hskip } } } { - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_prev_input_gpop:N \l_@@_tmpa_tl \tl_put_left:NV \l_@@_head_tl \l_@@_tmpa_tl \@@_do_append_glue: } { \@@_back_input: - \msg_error:nn { unravel } { improper-leaders } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_error:nnnnn { improper-leaders } { } { } { } { } + \@@_prev_input_gpop:N \l_@@_head_tl \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } } } @@ -4151,8 +4250,8 @@ % \end{macro} % % ^^A todo: less intrusive hooking into \everyhbox/\everyvbox? -% \begin{macro}[aux]{\@@_do_box_explicit:N} -% At this point, the last item in \cs{g_@@_prev_input_seq} is +% \begin{macro}{\@@_do_box_explicit:N} +% At this point, the last item in the previous-input sequence is % typically |\setbox0\hbox| or |\raise 3pt\hbox|. Scan for keywords % |to| and |spread| and a left brace. Install a hook in % \tn{everyhbox} or \tn{everyvbox} (whichever \TeX{} is going to @@ -4160,7 +4259,7 @@ % the current box into \cs{l_@@_head_tl} in order to print it, then % let \TeX{} perform the box operation (here we need to provide the % begin-group token, as it was scanned but not placed in -% \cs{g_@@_prev_input_seq}). \TeX{} inserts \tn{everyhbox} or +% the previous-input sequence). \TeX{} inserts \tn{everyhbox} or % \tn{everyvbox} just after the begin-group token, and the hook we did % is such that all that material is collected and put into the input % that we will study. @@ -4175,10 +4274,10 @@ { \@@_box_hook:N \tex_everyvbox:D } % ^^A todo: TeX calls |normal_paragraph| here. \@@_scan_spec: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \@@_set_action_text:x { \tl_to_str:N \l_@@_head_tl \iow_char:N \{ } - \seq_push:Nx \l_@@_leaders_box_seq + \seq_push:Nf \l_@@_leaders_box_seq { \bool_if:NTF #1 { \mode_if_vertical:TF { v } { h } } { Z } } \gtl_gput_right:NV \g_@@_output_gtl \l_@@_head_tl \gtl_gconcat:NNN \g_@@_output_gtl @@ -4189,8 +4288,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_box_hook:N} -% \begin{macro}[aux]{\@@_box_hook:w, \@@_box_hook_end:} +% \begin{macro}{\@@_box_hook:N} +% \begin{macro}{\@@_box_hook:w, \@@_box_hook_end:} % Used to capture the contents of an \tn{everyhbox} or similar, % without altering \tn{everyhbox} too much (just add one token at the % start). The various \texttt{o}-expansions remove @@ -4202,7 +4301,7 @@ \str_if_eq_x:nnF { \tl_head:N \l_@@_tmpa_tl } { \exp_not:N \@@_box_hook:w } { - \exp_args:Nx #1 + \@@_exp_args:Nx #1 { \exp_not:n { \@@_box_hook:w \prg_do_nothing: } \exp_not:V #1 @@ -4226,7 +4325,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux]{\@@_do_leaders_rule:} +% \begin{macro}{\@@_do_leaders_rule:} % After finding a |vrule| or |hrule| command and looking for |depth|, % |heigh| and |width| keywords, we are in the same situation as after % finding a box. Fetch the required skip accordingly. @@ -4259,7 +4358,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_char:n, \@@_char:V, \@@_char:x} +% \begin{macro}{\@@_char:n, \@@_char:V, \@@_char:x} % \begin{macrocode} \cs_new_protected:Npn \@@_char:n #1 { @@ -4273,28 +4372,32 @@ \gtl_gput_right:NV \g_@@_output_gtl \l_@@_tmpa_tl \@@_print_action:x { \tl_to_str:N \l_@@_tmpa_tl } } -\cs_generate_variant:Nn \@@_char:n { V , x } +\cs_generate_variant:Nn \@@_char:n { V } +\cs_new_protected:Npn \@@_char:x + { \@@_exp_args:Nx \@@_char:n } % \end{macrocode} % \end{macro} % -% \begin{macro}[aux] +% \begin{macro} % {\@@_char_in_mmode:n, \@@_char_in_mmode:V, \@@_char_in_mmode:x} % \begin{macrocode} \cs_new_protected:Npn \@@_char_in_mmode:n #1 { \int_compare:nNnTF { \tex_mathcode:D #1 } = { "8000 } { % math active - \gtl_set:Nx \l_@@_head_gtl + \@@_exp_args:NNx \gtl_set:Nn \l_@@_head_gtl { \char_generate:nn {#1} { 12 } } \@@_back_input: } { \@@_char:n {#1} } } -\cs_generate_variant:Nn \@@_char_in_mmode:n { V , x } +\cs_generate_variant:Nn \@@_char_in_mmode:n { V } +\cs_new_protected:Npn \@@_char_in_mmode:x + { \@@_exp_args:Nx \@@_char_in_mmode:n } % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_mathchar:n, \@@_mathchar:x} +% \begin{macro}{\@@_mathchar:n, \@@_mathchar:x} % \begin{macrocode} \cs_new_protected:Npn \@@_mathchar:n #1 { @@ -4304,7 +4407,8 @@ \gtl_gput_right:NV \g_@@_output_gtl \l_@@_tmpa_tl \@@_print_action:x { \tl_to_str:N \l_@@_tmpa_tl } } -\cs_generate_variant:Nn \@@_mathchar:n { x } +\cs_new_protected:Npn \@@_mathchar:x + { \@@_exp_args:Nx \@@_mathchar:n } % \end{macrocode} % \end{macro} % @@ -4367,7 +4471,7 @@ % ^^A todo: implement \@@_end_disc_group: % ^^A todo: implement \@@_end_math_choice_group: % -% \begin{macro}[aux]{\@@_handle_right_brace:} +% \begin{macro}{\@@_handle_right_brace:} % When an end-group character is sensed, the result depends on the % current group type. % \begin{macrocode} @@ -4403,7 +4507,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_end_simple_group:} +% \begin{macro}{\@@_end_simple_group:} % This command is used to simply end a group, when there are no % specific operations to perform. % \begin{macrocode} @@ -4415,7 +4519,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_end_box_group:} +% \begin{macro}{\@@_end_box_group:} % The end of an explicit box (generated by \tn{vtop}, \tn{vbox}, or % \tn{hbox}) can either be simple, or can mean that we need to find a % skip for a \tn{leaders}/\tn{cleaders}/\tn{xleaders} construction. @@ -4448,14 +4552,14 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_off_save:} +% \begin{macro}{\@@_off_save:} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_off_save: { \int_compare:nNnTF \@@_currentgrouptype: = { 0 } { % bottom-level - \msg_error:nnx { unravel } { extra-close } - { \token_to_meaning:N \l_@@_head_token } + \@@_error:nxxxx { extra-close } + { \token_to_meaning:N \l_@@_head_token } { } { } { } } { \@@_back_input: @@ -4470,8 +4574,8 @@ } { \gtl_set_eq:NN \l_@@_head_gtl \c_group_end_gtl } \@@_back_input: - \msg_error:nnx { unravel } { off-save } - { \gtl_to_str:N \l_@@_head_gtl } + \@@_error:nxxxx { off-save } + { \gtl_to_str:N \l_@@_head_gtl } { } { } { } } } % \end{macrocode} @@ -4503,7 +4607,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_head_for_vmode:} +% \begin{macro}{\@@_head_for_vmode:} % See \TeX{}'s |head_for_vmode|. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_head_for_vmode: @@ -4512,7 +4616,7 @@ { \token_if_eq_meaning:NNTF \l_@@_head_token \tex_hrule:D { - \msg_error:nn { unravel } { hrule-bad-mode } + \@@_error:nnnnn { hrule-bad-mode } { } { } { } { } \@@_print_action: } { \@@_off_save: } @@ -4527,7 +4631,7 @@ % \end{macro} % % ^^A todo: should push_math be provided? -% \begin{macro}[aux]{\@@_goto_inner_math:} +% \begin{macro}{\@@_goto_inner_math:} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_goto_inner_math: { @@ -4538,7 +4642,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_goto_display_math:} +% \begin{macro}{\@@_goto_display_math:} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_goto_display_math: { @@ -4549,7 +4653,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_after_math:} +% \begin{macro}{\@@_after_math:} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_after_math: { @@ -4567,7 +4671,7 @@ { \@@_back_input: \tl_set:Nn \l_@@_head_tl { $ } % $ - \msg_error:nn { unravel } { missing-dollar } + \@@_error:nnnnn { missing-dollar } { } { } { } { } } \gtl_gput_right:NV \g_@@_output_gtl \l_@@_head_tl \@@_back_input_gtl:N \l_@@_after_group_gtl @@ -4588,10 +4692,10 @@ { \@@_set_action_text: \bool_if:NT \g_@@_internal_debug_bool - { \iow_term:x { Cmd:~\int_to_arabic:n { \l_@@_head_cmd_int } } } + { \@@_exp_args:Nx \iow_term:n { Cmd:~\int_to_arabic:n { \l_@@_head_cmd_int } } } \cs_if_exist_use:cF { @@_cmd_ \int_use:N \l_@@_head_cmd_int : } - { \msg_error:nnx { unravel } { internal } { unknown-command } } + { \@@_error:nxxxx { internal } { unknown-command } { } { } { } } } % \end{macrocode} % \end{macro} @@ -4706,7 +4810,7 @@ { \@@_mode_math:n { \@@_sub_sup: } } \cs_new_protected_nopar:Npn \@@_sub_sup: { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_get_x_non_relax: \@@_set_cmd: @@ -4734,14 +4838,14 @@ { \@@_prev_input:V \l_@@_head_tl \@@_scan_int: } } { - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_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: } { \@@_back_input: \@@_scan_left_brace: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \gtl_gput_right:NV \g_@@_output_gtl \l_@@_head_tl \gtl_gconcat:NNN \g_@@_output_gtl \g_@@_output_gtl \c_group_begin_gtl @@ -4753,7 +4857,7 @@ % % \begin{macrocode} \@@_new_tex_cmd:nn { endv } % 9 - { \msg_error:nn { unravel } { not-implemented } { alignments } } + { \@@_not_implemented:n { alignments } } % \end{macrocode} % % Blank spaces are ignored in vertical and math modes in the same way as @@ -4841,10 +4945,10 @@ { \@@_mode_math:n { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_scan_int: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_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 } } @@ -4887,10 +4991,10 @@ { \@@_mode_non_vertical:n { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_scan_int: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_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 } } @@ -4906,10 +5010,10 @@ { \@@_mode_math:n { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_scan_int: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \@@_mathchar:x { \tl_tail:N \l_@@_head_tl } } } @@ -4918,14 +5022,14 @@ % \begin{macrocode} \@@_new_tex_cmd:nn { mark } % 18 { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \int_compare:nNnF \l_@@_head_char_int = \c_zero { \@@_scan_int: } - \seq_gput_right:Nn \g_@@_prev_input_seq { } + \@@_prev_input_gpush: \@@_scan_toks:NN \c_false_bool \c_true_bool - \seq_gpop_right:Nn \g_@@_prev_input_seq \l_@@_tmpa_tl - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_tmpa_tl + \@@_prev_input_gpop:N \l_@@_head_tl \@@_print_action:x { \tl_to_str:N \l_@@_head_tl \tl_to_str:N \l_@@_tmpa_tl } \tl_put_right:Nx \l_@@_head_tl @@ -4940,28 +5044,28 @@ % Those with operands print first, then scan their operands, then are % sent to \TeX{}. The case of \tn{show} is a bit special, as its % operand is a single token, which cannot easily be put into the -% \cs{g_@@_prev_input_seq} in general. Since no expansion can occur, +% the previous-input sequence in general. Since no expansion can occur, % simply grab the token and show it. % \begin{macrocode} \@@_new_tex_cmd:nn { xray } % 19 { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \int_case:nnF \l_@@_head_char_int { { 0 } { % show \@@_get_next: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_prev_input_gpop:N \l_@@_tmpa_tl \gtl_head_do:NN \l_@@_head_gtl \l_@@_tmpa_tl } { 2 } { % showthe \@@_get_x_next: \@@_scan_something_internal:n { 5 } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl - \exp_args:Nx \etex_showtokens:D - { \tl_tail:N \l_@@_head_tl } + \@@_prev_input_gpop:N \l_@@_head_tl + \@@_exp_args:Nx \use:n + { \etex_showtokens:D { \tl_tail:N \l_@@_head_tl } } } } { % no operand for showlists, showgroups, showifs @@ -4969,7 +5073,7 @@ { \@@_scan_int: } \int_compare:nNnT \l_@@_head_char_int = \c_five % showtokens { \@@_scan_toks:NN \c_false_bool \c_false_bool } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \tl_use:N \l_@@_head_tl \scan_stop: } } @@ -4980,7 +5084,7 @@ % \begin{macrocode} \@@_new_tex_cmd:nn { make_box } % 20 { - \seq_gput_right:Nn \g_@@_prev_input_seq { } + \@@_prev_input_gpush: \@@_back_input: \@@_do_box:N \c_false_bool } @@ -4988,13 +5092,13 @@ % % ^^A todo: implement \@@_forbidden_case: % -% \begin{macro}[aux]{\@@_do_move:} +% \begin{macro}{\@@_do_move:} % Scan a dimension and a box, and perform the shift, printing the % appropriate action. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_do_move: { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_scan_normal_dimen: \@@_do_box:N \c_false_bool @@ -5020,14 +5124,14 @@ } % \end{macrocode} % -% \begin{macro}[aux]{\@@_do_unpackage:} +% \begin{macro}{\@@_do_unpackage:} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_do_unpackage: { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_scan_int: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_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 } } @@ -5063,7 +5167,7 @@ { \l_@@_head_token \@@_print_action: } % \end{macrocode} % -% \begin{macro}[aux]{\@@_do_append_glue:} +% \begin{macro}{\@@_do_append_glue:} % For \tn{hfil}, \tn{hfill}, \tn{hss}, \tn{hfilneg} and their vertical % analogs, simply call the primitive then print the action. For % \tn{hskip}, \tn{vskip} and \tn{mskip}, read a normal glue or a mu @@ -5075,11 +5179,11 @@ \int_compare:nNnTF \l_@@_head_char_int < { 4 } { \tl_use:N \l_@@_head_tl \@@_print_action: } { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \exp_args:Nf \@@_scan_glue:n { \int_eval:n { \l_@@_head_char_int - 2 } } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_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 } } @@ -5107,18 +5211,18 @@ { \@@_mode_math:n { \@@_do_append_glue: } } % \end{macrocode} % -% \begin{macro}[aux]{\@@_do_append_kern:} +% \begin{macro}{\@@_do_append_kern:} % See \cs{@@_do_append_glue:}. This function is used for the % primitives \tn{kern} and \tn{mkern} only. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_do_append_kern: { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \token_if_eq_meaning:NNTF \l_@@_head_token \tex_kern:D { \@@_scan_dimen:nN { 2 } \c_false_bool } { \@@_scan_dimen:nN { 3 } \c_false_bool } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_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 } } @@ -5142,7 +5246,7 @@ % \begin{macrocode} \@@_new_tex_cmd:nn { leader_ship } % 31 { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_do_box:N \c_true_bool } @@ -5173,11 +5277,11 @@ % % \begin{macrocode} \@@_new_tex_cmd:nn { halign } % 32 - { \msg_fatal:nnx { unravel } { not-implemented } { halign } } + { \@@_not_implemented:n { halign } } \@@_new_tex_cmd:nn { valign } % 33 - { \msg_fatal:nnx { unravel } { not-implemented } { valign } } + { \@@_not_implemented:n { valign } } \@@_new_tex_cmd:nn { no_align } % 34 - { \msg_fatal:nnx { unravel } { not-implemented } { noalign } } + { \@@_not_implemented:n { noalign } } % \end{macrocode} % % \begin{macrocode} @@ -5187,10 +5291,10 @@ { \@@_mode_vertical:n { \@@_do_rule: } } \cs_new_protected_nopar:Npn \@@_do_rule: { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_scan_alt_rule: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_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 } } @@ -5212,11 +5316,12 @@ { \token_if_eq_meaning:NNTF \l_@@_head_token \tex_ignorespaces:D { + \@@_print_action: \@@_get_x_non_blank: \@@_set_cmd: \@@_do_step: } - { \msg_error:nn { unravel } { not-implemented } { pdfprimitive } } + { \@@_not_implemented:n { pdfprimitive } } } % \end{macrocode} % @@ -5267,10 +5372,10 @@ % \begin{macrocode} \@@_new_tex_cmd:nn { break_penalty } % 42 { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_scan_int: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_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 } } @@ -5304,11 +5409,11 @@ } % \end{macrocode} % -% \begin{macro}[aux]{\@@_do_accent:} +% \begin{macro}{\@@_do_accent:} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_do_accent: { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_scan_int: \@@_do_assignments: @@ -5332,7 +5437,7 @@ } { \@@_break:w } } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_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 } @@ -5341,17 +5446,17 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_do_math_accent:} +% \begin{macro}{\@@_do_math_accent:} % \TeX{} will complain if \cs{l_@@_head_tl} happens to start with % \tn{accent} (the user used \tn{accent} in math mode). % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_do_math_accent: { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_scan_int: \@@_scan_math: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_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 } @@ -5377,7 +5482,7 @@ % % \begin{macrocode} \@@_new_tex_cmd:nn { discretionary } % 47 - { \msg_error:nnx { unravel } { not-implemented } { discretionary } } + { \@@_not_implemented:n { discretionary } } % \end{macrocode} % % \subsubsection{Maths: from 48 to 56} @@ -5396,47 +5501,47 @@ % % \begin{macrocode} \@@_new_tex_cmd:nn { eq_no } % 48 - { \msg_error:nnx { unravel } { not-implemented } { eqno } } + { \@@_not_implemented:n { eqno } } % \end{macrocode} % % \begin{macrocode} \@@_new_tex_cmd:nn { left_right } % 49 - { \msg_error:nnx { unravel } { not-implemented } { left/right } } + { \@@_not_implemented:n { left/right } } % \end{macrocode} % % \begin{macrocode} \@@_new_tex_cmd:nn { math_comp } % 50 - { \msg_error:nnx { unravel } { not-implemented } { math~comp } } + { \@@_not_implemented:n { math~comp } } % \end{macrocode} % % \begin{macrocode} \@@_new_tex_cmd:nn { limit_switch } % 51 - { \msg_error:nnx { unravel } { not-implemented } { limits } } + { \@@_not_implemented:n { limits } } % \end{macrocode} % % \begin{macrocode} \@@_new_tex_cmd:nn { above } % 52 - { \msg_error:nnx { unravel } { not-implemented } { above } } + { \@@_not_implemented:n { above } } % \end{macrocode} % % \begin{macrocode} \@@_new_tex_cmd:nn { math_style } % 53 - { \msg_error:nnx { unravel } { not-implemented } { math~style } } + { \@@_not_implemented:n { math~style } } % \end{macrocode} % % \begin{macrocode} \@@_new_tex_cmd:nn { math_choice } % 54 - { \msg_error:nnx { unravel } { not-implemented } { math~choice } } + { \@@_not_implemented:n { math~choice } } % \end{macrocode} % % \begin{macrocode} \@@_new_tex_cmd:nn { non_script } % 55 - { \msg_error:nnx { unravel } { not-implemented } { non~script } } + { \@@_not_implemented:n { non~script } } % \end{macrocode} % % \begin{macrocode} \@@_new_tex_cmd:nn { vcenter } % 56 - { \msg_error:nnx { unravel } { not-implemented } { vcenter } } + { \@@_not_implemented:n { vcenter } } % \end{macrocode} % % \subsubsection{From 57 to 70} @@ -5461,9 +5566,9 @@ % \begin{macrocode} \@@_new_tex_cmd:nn { case_shift } % 57 { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_scan_toks:NN \c_false_bool \c_false_bool - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_prev_input_gpop:N \l_@@_tmpa_tl \exp_after:wN \@@_case_shift:Nn \l_@@_tmpa_tl } \cs_new_protected:Npn \@@_case_shift:Nn #1#2 @@ -5477,10 +5582,10 @@ % \begin{macrocode} \@@_new_tex_cmd:nn { message } % 58 { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_scan_toks_to_str: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \tl_use:N \l_@@_head_tl \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } } @@ -5490,10 +5595,10 @@ % \begin{macrocode} \@@_new_tex_cmd:nn { extension } % 59 { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_scan_extension_operands: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_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 } } @@ -5502,7 +5607,7 @@ % \begin{macrocode} \@@_new_tex_cmd:nn { in_stream } % 60 { - \seq_put_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \token_if_eq_meaning:NNTF \l_@@_head_token \tex_openin:D { @@ -5511,7 +5616,7 @@ \@@_scan_file_name: } { \@@_scan_int: } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_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 } } @@ -5536,7 +5641,7 @@ % % \begin{macrocode} \@@_new_tex_cmd:nn { omit } % 63 - { \msg_error:nn { unravel } { not-implemented } { omit } } + { \@@_not_implemented:n { omit } } % \end{macrocode} % % \begin{macrocode} @@ -5560,11 +5665,11 @@ { \@@_mode_math:n { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_scan_int: \@@_scan_math: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_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 } @@ -5572,10 +5677,12 @@ } % \end{macrocode} % -% Let \TeX{} cause the error. % \begin{macrocode} \@@_new_tex_cmd:nn { end_cs_name } % 67 - { \l_@@_head_token \@@_print_action: } + { + \@@_tex_error:nV { extra-endcsname } \l_@@_head_tl + \@@_print_action: + } % \end{macrocode} % % See |the_char| and |other_char|. @@ -5635,7 +5742,7 @@ { \mode_if_horizontal:TF { \@@_scan_int: } - { \msg_error:nn { unravel } { invalid-mode } } + { \@@_error:nnnnn { invalid-mode } { } { } { } { } } } { 6 } % pdfliteral { @@ -5691,7 +5798,7 @@ { 14 } % pdfstartlink { \mode_if_vertical:TF - { \msg_error:nn { unravel } { invalid-mode } } + { \@@_error:nnnnn { invalid-mode } { } { } { } { } } { \@@_scan_rule_attr: \@@_scan_action: @@ -5700,7 +5807,7 @@ { 15 } % pdfendlink { \mode_if_vertical:T - { \msg_error:nn { unravel } { invalid-mode } } + { \@@_error:nnnnn { invalid-mode } { } { } { } { } } } { 16 } % pdfoutline { @@ -5788,7 +5895,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_pdfcolorstack_operands:} +% \begin{macro}{\@@_scan_pdfcolorstack_operands:} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_scan_pdfcolorstack_operands: { @@ -5801,8 +5908,8 @@ { \@@_scan_keyword:nF { cCuUrRrReEnNtT } { - \msg_error:nn { unravel } - { color-stack-action-missing } + \@@_error:nnnnn { color-stack-action-missing } + { } { } { } { } } } } @@ -5811,7 +5918,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_rule_attr:} +% \begin{macro}{\@@_scan_rule_attr:} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_scan_rule_attr: { @@ -5832,7 +5939,7 @@ \@@_scan_keyword:nF { gGoOtToO } { \@@_scan_keyword:nF { tThHrReEaAdD } - { \msg_error:nn { unravel } { action-type-missing } } + { \@@_error:nnnnn { action-type-missing } { } { } { } { } } } } \@@_scan_keyword:nT { fFiIlLeE } @@ -5848,7 +5955,7 @@ { \@@_scan_keyword:nTF { nNuUmM } { \@@_scan_int: } - { \msg_error:nn { unravel } { identifier-type-missing } } + { \@@_error:nnnnn { identifier-type-missing } { } { } { } { } } } } \@@_scan_keyword:nTF { nNeEwWwWiInNdDoOwW } @@ -5861,7 +5968,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_image:} +% \begin{macro}{\@@_scan_image:} % Used by \tn{pdfximage}. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_scan_image: @@ -5912,15 +6019,15 @@ \cs_new_protected_nopar:Npn \@@_scan_immediate_operands_bad: { \@@_back_input: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \@@_print_action:x { \tl_to_str:N \l_@@_head_tl ignored } - \seq_gput_right:Nn \g_@@_prev_input_seq { } + \@@_prev_input_gpush: } % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_scan_pdfdest_operands:} +% \begin{macro}{\@@_scan_pdfdest_operands:} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_scan_pdfdest_operands: { @@ -5929,7 +6036,7 @@ { \@@_scan_keyword:nTF { nNaAmMeE } { \@@_scan_pdf_ext_toks: } - { \msg_error:nn { unravel } { identifier-type-missing } } + { \@@_error:nnnnn { identifier-type-missing } { } { } { } { } } } \@@_scan_keyword:nTF { xXyYzZ } { @@ -5958,10 +6065,8 @@ \@@_scan_keyword:nF { fFiItT } { - \msg_error:nn { unravel } - { - destination-type-missing - } + \@@_error:nnnnn { destination-type-missing } + { } { } { } { } } } } @@ -5986,7 +6091,7 @@ % \begin{macrocode} \cs_set_protected_nopar:Npn \@@_tmp:w { - \seq_gput_right:Nn \g_@@_prev_input_seq { } + \@@_prev_input_gpush: \@@_prefixed_command: } \int_step_inline:nnnn @@ -5998,7 +6103,7 @@ % % \begin{macro}[int]{\@@_prefixed_command:} % Accumulated prefix codes so far are stored as the last item of -% \cs{g_@@_prev_input_seq}. +% the previous-input sequence. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_prefixed_command: { @@ -6011,10 +6116,11 @@ \int_compare:nNnF \l_@@_head_cmd_int > { \@@_tex_use:n { max_non_prefixed_command } } { - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl - \msg_error:nnxx { unravel } { erroneous-prefixes } + \@@_prev_input_gpop:N \l_@@_tmpa_tl + \@@_error:nxxxx { erroneous-prefixes } { \tl_to_str:N \l_@@_tmpa_tl } { \tl_to_str:N l_@@_head_tl } + { } { } \@@_back_input: \@@_omit_after_assignment:w } @@ -6024,7 +6130,7 @@ \cs_if_exist_use:cF { @@_prefixed_ \int_use:N \l_@@_head_cmd_int : } { - \msg_error:nnx { unravel } { internal } { prefixed } + \@@_error:nnnnn { internal } { prefixed } { } { } { } \@@_omit_after_assignment:w } \@@_after_assignment: @@ -6035,8 +6141,8 @@ % range $[71,102]$, with the exception of |prefix=93|, which would have % been collected by the \cs{@@_prefixed_command:} loop. % -% \begin{macro}[aux]{\@@_after_assignment:} -% \begin{macro}[aux]{\@@_omit_after_assignment:w} +% \begin{macro}{\@@_after_assignment:} +% \begin{macro}{\@@_omit_after_assignment:w} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_after_assignment: { @@ -6063,7 +6169,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_assign_token:n #1 { - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl #1 \tl_use:N \l_@@_head_tl \scan_stop: \@@_print_assigned_token: @@ -6075,7 +6181,7 @@ % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_assign_register: { - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \tl_use:N \l_@@_head_tl \scan_stop: \@@_print_assigned_register: } @@ -6088,10 +6194,10 @@ { \tl_if_empty:nF {#1} { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } #1 - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl } \@@_prev_input:V \l_@@_head_tl \tl_set_eq:NN \l_@@_defined_tl \l_@@_head_tl @@ -6102,16 +6208,16 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_assign_toks:} +% \begin{macro}{\@@_assign_toks:} % \begin{macrocode} \@@_prefixed_new:nn { toks_register } % 71 { \int_compare:nNnT \l_@@_head_char_int = \c_zero { % \toks - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_scan_int: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl } \@@_assign_toks: } @@ -6214,7 +6320,7 @@ } \@@_prefixed_new:nn { set_font } % 87 { - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_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: \gtl_gput_right:NV \g_@@_output_gtl \l_@@_head_tl @@ -6249,11 +6355,11 @@ % \begin{macrocode} \@@_prefixed_new:nn { let } % 94 { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \token_if_eq_meaning:NNTF \l_@@_head_token \tex_let:D { % |let| \@@_scan_r_token: - \seq_get_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_prev_input_get:N \l_@@_tmpa_tl \@@_print_action:x { \tl_to_str:N \l_@@_tmpa_tl } \@@_get_next: \bool_while_do:nn @@ -6266,7 +6372,7 @@ } { % |futurelet| \@@_scan_r_token: - \seq_get_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_prev_input_get:N \l_@@_tmpa_tl \@@_print_action:x { \tl_to_str:N \l_@@_tmpa_tl } \@@_get_next: \gtl_set_eq:NN \l_@@_tmpb_gtl \l_@@_head_gtl @@ -6275,10 +6381,10 @@ \gtl_set_eq:NN \l_@@_head_gtl \l_@@_tmpb_gtl \@@_back_input: } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_prev_input_gpop:N \l_@@_tmpa_tl \tl_put_right:Nn \l_@@_tmpa_tl { = ~ \l_@@_head_token } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl - \use:x + \@@_prev_input_gpop:N \l_@@_head_tl + \@@_exp_args:Nx \use:n { \exp_not:V \l_@@_head_tl \tex_let:D \tl_tail:N \l_@@_tmpa_tl @@ -6304,7 +6410,7 @@ } % \end{macrocode} % -% \begin{macro}[aux, EXP]{\@@_read_to_cs_safe:nTF, \@@_read_to_cs_safe:fTF} +% \begin{macro}[EXP]{\@@_read_to_cs_safe:nTF, \@@_read_to_cs_safe:fTF} % After \tn{read} or \tn{readline}, find an int, the mandatory % keyword |to|, and an assignable token. The \tn{read} and % \tn{readline} primitives throw a fatal error in \tn{nonstopmode} @@ -6321,12 +6427,12 @@ \@@_scan_int: \@@_scan_to: \@@_scan_r_token: - \seq_get_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_prev_input_get:N \l_@@_tmpa_tl \@@_read_to_cs_safe:fTF { \@@_tl_first_int:N \l_@@_tmpa_tl } { \@@_assign_token:n { } } { - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \@@_tex_fatal_error:nV { cannot-read } \l_@@_head_tl } } @@ -6357,10 +6463,10 @@ % \begin{macrocode} \@@_prefixed_new:nn { def } % 97 { - \seq_get_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_prev_input_get:N \l_@@_tmpa_tl \tl_set:NV \l_@@_defining_tl \l_@@_tmpa_tl \tl_put_right:NV \l_@@_defining_tl \l_@@_head_tl - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \int_compare:nNnTF \l_@@_head_char_int < \c_two { % def/gdef \@@_scan_r_token: @@ -6372,7 +6478,7 @@ \tl_put_right:NV \l_@@_defining_tl \l_@@_defined_tl \@@_scan_toks:NN \c_true_bool \c_true_bool } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \@@_prev_input:V \l_@@_head_tl \@@_assign_token:n { \tl_set_eq:NN \l_@@_head_tl \l_@@_defining_tl } @@ -6380,7 +6486,7 @@ % \end{macrocode} % % \tn{setbox} is a bit special: directly put it in -% \cs{g_@@_prev_input_seq} with the prefixes; the box code will take +% the previous-input sequence with the prefixes; the box code will take % care of things, and expects a single item containing what it needs to % do. % \begin{macrocode} @@ -6392,8 +6498,8 @@ \bool_if:NTF \g_@@_set_box_allowed_bool { \@@_do_box:N \c_false_bool } { - \msg_error:nn { unravel } { improper-setbox } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_error:nnnnn { improper-setbox } { } { } { } { } + \@@_prev_input_gpop:N \l_@@_tmpa_tl \@@_omit_after_assignment:w } } @@ -6413,7 +6519,7 @@ % \begin{macrocode} \@@_prefixed_new:nn { set_interaction } % 100 { - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_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_action:x { \tl_to_str:N \l_@@_head_tl } @@ -6466,7 +6572,7 @@ { \@@_do_operation:N \c_three } % \end{macrocode} % -% \begin{macro}[aux]{\@@_do_operation:N, \@@_do_operation_fail:w} +% \begin{macro}{\@@_do_operation:N, \@@_do_operation_fail:w} % \begin{macrocode} \cs_new_protected:Npn \@@_do_operation:N #1 { @@ -6501,14 +6607,14 @@ } \cs_new_protected_nopar:Npn \@@_do_operation_fail:w { - \msg_error:nn { unravel } { after-advance } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_error:nnnnn { after-advance } { } { } { } { } + \@@_prev_input_gpop:N \l_@@_tmpa_tl \@@_omit_after_assignment:w } % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_do_register:N, \@@_do_register_aux:Nn} +% \begin{macro}{\@@_do_register:N, \@@_do_register_aux:Nn} % \begin{macrocode} \cs_new_protected:Npn \@@_do_register:N #1 { @@ -6519,10 +6625,10 @@ { \int_compare:nNnTF { \tl_tail:n {#2} } = \c_zero { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_scan_int: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \@@_prev_input_silent:V \l_@@_head_tl } { @@ -6536,7 +6642,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_do_register_set:Nn} +% \begin{macro}{\@@_do_register_set:Nn} % \begin{macrocode} \cs_new_protected:Npn \@@_do_register_set:Nn #1#2 { @@ -6557,7 +6663,7 @@ { 3 } { \@@_scan_normal_glue: } % glue { 4 } { \@@_scan_mu_glue: } % muglue } - { \msg_error:nnx { unravel } { internal } { do-reg=#2 } } + { \@@_error:nxxxx { internal } { do-reg=#2 } { } { } { } } } { \@@_scan_int: } \@@_assign_register: @@ -6576,7 +6682,7 @@ > { \@@_tex_use:n { max_non_prefixed_command } } { \bool_gset_false:N \g_@@_set_box_allowed_bool - \seq_gput_right:Nn \g_@@_prev_input_seq { } + \@@_prev_input_gpush: \@@_prefixed_command: \bool_gset_true:N \g_@@_set_box_allowed_bool \@@_do_assignments: @@ -6628,7 +6734,7 @@ { \tl_use:N \l_@@_head_tl \@@_print_action: } % \end{macrocode} % -% \begin{macro}[aux]{\@@_expandafter:, \@@_unless:, \@@_unless_bad:} +% \begin{macro}{\@@_expandafter:, \@@_unless:, \@@_unless_bad:} % \begin{macrocode} \@@_new_tex_expandable:nn { expand_after } % 104 { @@ -6641,13 +6747,13 @@ \@@_get_next: \gtl_concat:NNN \l_@@_head_gtl \l_@@_tmpb_gtl \l_@@_head_gtl - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_gtl + \@@_prev_input_gpush_gtl:N \l_@@_head_gtl \@@_print_action:x { \gtl_to_str:N \l_@@_head_gtl } \@@_get_next: \@@_token_if_expandable:NTF \l_@@_head_token { \@@_expand: } { \@@_back_input: } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_gtl + \@@_prev_input_gpop:N \l_@@_head_gtl \@@_set_action_text:x { back_input: ~ \gtl_to_str:N \l_@@_head_gtl } \gtl_pop_left:N \l_@@_head_gtl @@ -6672,13 +6778,13 @@ } \cs_new_protected_nopar:Npn \@@_unless_bad: { - \msg_error:nn { unravel } { bad-unless } + \@@_error:nnnnn { bad-unless } { } { } { } { } \@@_back_input: } % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_noexpand:, \@@_pdfprimitive:} +% \begin{macro}{\@@_noexpand:, \@@_pdfprimitive:} % \begin{macrocode} \@@_new_tex_expandable:nn { no_expand } % 105 { @@ -6702,11 +6808,11 @@ } } \cs_new_protected_nopar:Npn \@@_pdfprimitive: - { \msg_error:nnx { unravel } { not-implemented } { pdfprimitive } } + { \@@_not_implemented:n { pdfprimitive } } % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_endinput:, \@@_scantokens:, \@@_input:} +% \begin{macro}{\@@_endinput:, \@@_scantokens:, \@@_input:} % \begin{macrocode} \@@_new_tex_expandable:nn { input } % 106 { @@ -6722,23 +6828,25 @@ } \cs_new_protected_nopar:Npn \@@_endinput: { - \msg_warning:nn { unravel } { endinput-ignored } + \group_begin: + \msg_warning:nn { unravel } { endinput-ignored } + \group_end: \@@_print_action: } \cs_new_protected_nopar:Npn \@@_scantokens: { - \seq_gput_right:Nn \g_@@_prev_input_seq { } + \@@_prev_input_gpush: \@@_scan_toks:NN \c_false_bool \c_false_bool - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_prev_input_gpop:N \l_@@_tmpa_tl \tl_set_rescan:Nno \l_@@_head_tl { } \l_@@_tmpa_tl \@@_back_input:V \l_@@_head_tl \@@_print_action:x { \tl_to_str:N \l_@@_tmpa_tl } } \cs_new_protected_nopar:Npn \@@_input: { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_scan_file_name: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \tl_set:Nx \l_@@_tmpa_tl { \tl_tail:N \l_@@_head_tl } \@@_file_get:nN \l_@@_tmpa_tl \l_@@_tmpa_tl \@@_back_input:V \l_@@_tmpa_tl @@ -6747,26 +6855,26 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_csname_loop:} +% \begin{macro}{\@@_csname_loop:} % \begin{macrocode} \@@_new_tex_expandable:nn { cs_name } % 109 { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_csname_loop: - \@@_prev_input:V \l_@@_head_tl - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_silent:V \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \@@_back_input_tl_o: } \cs_new_protected_nopar:Npn \@@_csname_loop: { \@@_get_x_next: - \token_if_cs:NTF \l_@@_head_token + \@@_gtl_if_head_is_definable:NTF \l_@@_head_gtl { \cs_if_eq:NNF \l_@@_head_token \tex_endcsname:D { - \msg_error:nn { unravel } { missing-endcsname } \@@_back_input: + \@@_tex_error:nV { missing-endcsname } \l_@@_head_tl \tl_set:Nn \l_@@_head_tl { \tex_endcsname:D } } } @@ -6782,7 +6890,7 @@ % \begin{macrocode} \@@_new_tex_expandable:nn { convert } % 110 { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \int_case:nn \l_@@_head_char_int { @@ -6818,7 +6926,7 @@ { 30 } \@@_scan_int: { 31 } \@@_scan_pdfximagebbox: } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \@@_back_input_tl_o: } \cs_new_protected_nopar:Npn \@@_scan_pdfstrcmp: @@ -6853,7 +6961,7 @@ } % \end{macrocode} % -% \begin{macro}[aux]{\@@_get_the:} +% \begin{macro}{\@@_get_the:} % \begin{macrocode} \@@_new_tex_expandable:nn { the } % 111 { @@ -6864,18 +6972,18 @@ } \cs_new_protected_nopar:Npn \@@_get_the: { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \int_if_odd:nTF \l_@@_head_char_int { % \unexpanded, \detokenize \@@_scan_toks:NN \c_false_bool \c_false_bool - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \@@_set_action_text:x { \tl_to_str:N \l_@@_head_tl } } { % \the \@@_get_x_next: \@@_scan_something_internal:n { 5 } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \@@_set_action_text:x { \tl_head:N \l_@@_head_tl @@ -6896,7 +7004,7 @@ % \begin{macrocode} \@@_new_tex_expandable:nn { end_template } % 117 { - \msg_error:nn { unravel } { not-implemented } { end-template } + \@@_not_implemented:n { end-template } { } { } { } \@@_back_input_tl_o: } % \end{macrocode} @@ -6906,7 +7014,7 @@ % % ^^A todo: simply use \cs{@@_input_gpop:N} right away. % \begin{macro}[int]{\@@_pass_text:} -% \begin{macro}[aux]{\@@_pass_text_done:w} +% \begin{macro}{\@@_pass_text_done:w} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_pass_text: { @@ -6938,7 +7046,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux]{\@@_pass_text_nested:} +% \begin{macro}{\@@_pass_text_nested:} % Again, if there is no more input we are in trouble. The % construction otherwise essentially results in % \begin{quote} @@ -6980,11 +7088,11 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_pass_text_empty:} +% \begin{macro}{\@@_pass_text_empty:} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_pass_text_empty: { - \msg_error:nn { unravel } { runaway-if } + \@@_error:nnnnn { runaway-if } { } { } { } { } \@@_exit:w } % \end{macrocode} @@ -7010,7 +7118,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_change_if_limit:nn} +% \begin{macro}{\@@_change_if_limit:nn} % \begin{macrocode} \cs_new_protected:Npn \@@_change_if_limit:nn #1#2 { @@ -7040,7 +7148,7 @@ } % \end{macrocode} % -% \begin{macro}[aux]{\@@_cond_aux:nn} +% \begin{macro}{\@@_cond_aux:nn} % \begin{macrocode} \cs_new_protected:Npn \@@_cond_aux:n #1 { @@ -7051,7 +7159,7 @@ { 21 } { \@@_test_pdfprimitive:n {#1} } % ^^A todo and \unless } { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \int_case:nn \l_@@_head_char_int { @@ -7082,7 +7190,7 @@ { 23 } % ifpdfabsdim { \@@_test_two_vals:N \@@_scan_normal_dimen: } } - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \@@_set_action_text:x { \tl_to_str:N \l_@@_head_tl } \l_@@_head_tl \scan_stop: \exp_after:wN \@@_cond_true:n @@ -7095,7 +7203,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_cond_true:n} +% \begin{macro}{\@@_cond_true:n} % \begin{macrocode} \cs_new_protected:Npn \@@_cond_true:n #1 { @@ -7105,7 +7213,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux] +% \begin{macro} % {\@@_cond_false:n, \@@_cond_false_loop:n, \@@_cond_false_common:} % \begin{macrocode} \cs_new_protected:Npn \@@_cond_false:n #1 @@ -7121,7 +7229,7 @@ { \token_if_eq_meaning:NNT \l_@@_head_token \or: { - \msg_error:nn { unravel } { extra-or } + \@@_error:nnnnn { extra-or } { } { } { } { } \@@_cond_false_loop:n {#1} } } @@ -7140,7 +7248,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_test_two_vals:N} +% \begin{macro}{\@@_test_two_vals:N} % \begin{macrocode} \cs_new_protected:Npn \@@_test_two_vals:N #1 { @@ -7148,7 +7256,7 @@ \@@_get_x_non_blank: \tl_if_in:nVF { < = > } \l_@@_head_tl { - \msg_error:nn { unravel } { missing-equals } + \@@_error:nnnnn { missing-equals } { } { } { } { } \@@_back_input: \tl_set:Nn \l_@@_head_tl { = } } @@ -7160,7 +7268,7 @@ % % ^^A todo: fix interaction with noexpand and active chars % ^^A todo: fix non-brace begin-group and end-group tokens -% \begin{macro}[aux]{\@@_test_two_chars:, \@@_test_two_chars_aux:} +% \begin{macro}{\@@_test_two_chars:, \@@_test_two_chars_aux:} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_test_two_chars: { @@ -7185,16 +7293,16 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_test_ifx:n, \@@_test_ifx_aux:w} +% \begin{macro}{\@@_test_ifx:n, \@@_test_ifx_aux:w} % \begin{macrocode} \cs_new_protected:Npn \@@_test_ifx:n #1 { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \@@_get_next: \gtl_set_eq:NN \l_@@_tmpb_gtl \l_@@_head_gtl \@@_get_next: - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_tmpa_tl + \@@_prev_input_gpop:N \l_@@_tmpa_tl \@@_set_action_text:x { Compare:~ \tl_to_str:N \l_@@_tmpa_tl @@ -7213,19 +7321,19 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_test_case:n, \@@_test_case_aux:nn} +% \begin{macro}{\@@_test_case:n, \@@_test_case_aux:nn} % \begin{macrocode} \cs_new_protected:Npn \@@_test_case:n #1 { - \seq_gput_right:NV \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpush:N \l_@@_head_tl \@@_print_action: \bool_if:NT \g_@@_internal_debug_bool { \iow_term:n { {\ifcase level~#1} } } \@@_scan_int: - \seq_get_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_get:N \l_@@_head_tl \tl_set:Nx \l_@@_head_tl { \tl_tail:N \l_@@_head_tl } % ^^A does text_case_aux use prev_input_seq? \exp_args:No \@@_test_case_aux:nn { \l_@@_head_tl } {#1} - \seq_gpop_right:NN \g_@@_prev_input_seq \l_@@_head_tl + \@@_prev_input_gpop:N \l_@@_head_tl \@@_print_action:x { \tl_to_str:N \l_@@_head_tl } } \cs_new_protected:Npn \@@_test_case_aux:nn #1#2 @@ -7253,7 +7361,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_test_ifdefined:} +% \begin{macro}{\@@_test_ifdefined:} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_test_ifdefined: { @@ -7277,7 +7385,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_test_ifcsname:} +% \begin{macro}{\@@_test_ifcsname:} % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_test_ifcsname: { @@ -7295,10 +7403,10 @@ \int_compare:nNnTF \g_@@_if_limit_int = \c_zero { \int_compare:nNnTF \g_@@_if_depth_int = \c_zero - { \msg_error:nn { unravel } { extra-fi-or-else } } + { \@@_error:nnnnn { extra-fi-or-else } { } { } { } { } } { \@@_insert_relax: } } - { \msg_error:nn { unravel } { extra-fi-or-else } } + { \@@_error:nnnnn { extra-fi-or-else } { } { } { } { } } } { \@@_set_action_text: @@ -7336,10 +7444,36 @@ % Let us start with the procedure which prints to the terminal: this % will help me test the code while I'm writing it. % +% \begin{macro}{\@@_print_normalize_null:} +% \begin{variable}{\l_@@_print_tl} +% Change the null character to an explicit |^||^||@| in \LuaTeX{} to +% avoid a bug whereby a null character ends a string prematurely. +% \begin{macrocode} +\tl_new:N \l_@@_print_tl +\sys_if_engine_luatex:TF + { + \cs_new_protected:Npx \@@_print_normalize_null: + { + \tl_replace_all:Nnn \exp_not:N \l_@@_print_tl + { \char_generate:nn { 0 } { 12 } } + { \tl_to_str:n { ^ ^ @ } } + } + } + { \cs_new_protected:Npn \@@_print_normalize_null: { } } +% \end{macrocode} +% \end{variable} +% \end{macro} +% % \begin{macro}[int]{\@@_print:n, \@@_print:x} % \begin{macrocode} -\cs_new_eq:NN \@@_print:n \iow_term:n -\cs_generate_variant:Nn \@@_print:n { x } +\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 } + } +\cs_new_protected:Npn \@@_print:x + { \@@_exp_args:Nx \@@_print:n } % \end{macrocode} % \end{macro} % @@ -7388,15 +7522,9 @@ \tl_use:N \g_@@_before_print_state_tl \int_compare:nNnT \g_@@_noise_int > \c_zero { - \exp_args:Nx \@@_print_state_output:n - { \gtl_to_str:N \g_@@_output_gtl } - \seq_set_map:NNn \l_@@_tmpa_seq \g_@@_prev_input_seq - { \@@_to_str:n {##1} } - \seq_remove_all:Nn \l_@@_tmpa_seq { } - \exp_args:Nx \@@_print_state_prev:n - { \seq_use:Nn \l_@@_tmpa_seq { \\ } } - \exp_args:Nx \@@_print_state_input:n - { \@@_input_to_str: } + \@@_print_state_output: + \@@_print_state_prev: + \@@_print_state_input: } \group_end: \@@_prompt: @@ -7404,11 +7532,16 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_print_state_output:n} +% \begin{macro}{\@@_print_state_output:, \@@_print_state_output:n} % Unless empty, print |#1| with each line starting with \verb*+<|~+. % The \cs{@@_str_truncate_left:nn} function trims |#1| if needed, to % fit in a maximum of \cs{g_@@_max_output_int} characters. % \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_print_state_output: + { + \@@_exp_args:Nx \@@_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} @@ -7420,19 +7553,36 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_print_state_prev:n} -% Never trim~|#1|. +% \begin{macro}{\@@_print_state_prev:} +% Never trim~|##1|. % \begin{macrocode} -\cs_new_protected:Npn \@@_print_state_prev:n #1 - { \@@_print_message:nn { || ~ } {#1} } +\cs_new_protected_nopar:Npn \@@_print_state_prev: + { + \seq_set_map:NNn \l_@@_tmpa_seq \g_@@_prev_input_seq + { \@@_to_str:n {##1} } + \seq_remove_all:Nn \l_@@_tmpa_seq { } + \seq_if_empty:NTF \l_@@_tmpa_seq + { \@@_print_message:nn { || ~ } { } } + { + \seq_map_inline:Nn \l_@@_tmpa_seq + { + \@@_print_message:nn { || ~ } {##1} + } + } + } % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_print_state_input:n} +% \begin{macro}{\@@_print_state_input:, \@@_print_state_input:n} % Print |#1| with each line starting with \verb*+|>~+. The % \cs{@@_str_truncate_right:nn} function trims |#1| if needed, to fit % in a maximum of \cs{g_@@_max_input_int} characters. % \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_print_state_input: + { + \@@_exp_args:Nx \@@_print_state_input:n + { \@@_input_to_str: } + } \cs_new_protected:Npn \@@_print_state_input:n #1 { \@@_print_message:nn { |> ~ } @@ -7441,7 +7591,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_print_meaning:} +% \begin{macro}{\@@_print_meaning:} % \begin{macrocode} \cs_new_protected:Npn \@@_print_meaning: { @@ -7519,7 +7669,7 @@ \cs_new_protected_nopar:Npn \@@_print_assigned_register: { \@@_after_assignment: % ^^A todo: simplify - \exp_args:Nx \@@_print_action:x + \@@_exp_args:Nx \@@_print_action:x { \exp_not:n { @@ -7590,8 +7740,8 @@ \int_compare:nNnT { \etex_interactionmode:D } = { 3 } { \bool_if:NTF \g_@@_explicit_prompt_bool - { \ior_get_str:Nc \c_@@_prompt_ior } - { \ior_get_str:Nc \c_@@_noprompt_ior } + { \ior_str_get:Nc \c_@@_prompt_ior } + { \ior_str_get:Nc \c_@@_noprompt_ior } { Your~input } \exp_args:Nv \@@_prompt_treat:n { Your~input } } @@ -7600,7 +7750,7 @@ { \tl_if_empty:nF {#1} { - \exp_args:Nx \str_case:nnF { \tl_head:n {#1} } + \@@_exp_args:Nx \str_case:nnF { \tl_head:n {#1} } { { m } { \@@_print_meaning: \@@_prompt_aux: } { q } @@ -7620,8 +7770,11 @@ { \int_gset:Nn \g_@@_noise_int } } { C } { - \tl_gset_rescan:Nnx \g_@@_tmpc_tl - { \ExplSyntaxOn } { \tl_tail:n {#1} } + \@@_exp_args:Nx \use:n + { + \tl_gset_rescan:Nnn \exp_not:N \g_@@_tmpc_tl + { \exp_not:N \ExplSyntaxOn } { \tl_tail:n {#1} } + } \tl_gput_left:Nn \g_@@_tmpc_tl { \tl_gclear:N \g_@@_tmpc_tl } \group_insert_after:N \g_@@_tmpc_tl @@ -7683,8 +7836,8 @@ \tl_gset:Nf \g_@@_before_print_state_tl { \exp_args:NNf \exp_stop_f: \int_compare:nNnTF - { \int_eval:n { \seq_count:N \g_@@_prev_input_seq - #2 } } - #1 { \seq_count:N \g_@@_prev_input_seq } + { \int_eval:n { \@@_prev_input_count: - #2 } } + #1 { \@@_prev_input_count: } { \int_gset:Nn \g_@@_nonstop_int { \int_max:nn { \g_@@_nonstop_int } { 2 } } @@ -7720,6 +7873,33 @@ % % \subsubsection{Errors} % +% \begin{macro}{\@@_not_implemented:n} +% \begin{macrocode} +\cs_new_protected:Npn \@@_not_implemented:n #1 + { \@@_error:nnnnn { not-implemented } {#1} { } { } { } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@@_error:nnnnn, \@@_error:nxxxx} +% 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. +% \begin{macrocode} +\cs_new_protected:Npn \@@_error:nnnnn #1#2#3#4#5 + { + \group_begin: + \msg_error:nnnnnn { unravel } {#1} {#2} {#3} {#4} {#5} + \group_end: + } +\cs_new_protected:Npn \@@_error:nxxxx #1#2#3#4#5 + { + \group_begin: + \msg_error:nnxxxx { unravel } {#1} {#2} {#3} {#4} {#5} + \group_end: + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[int]{\@@_tex_msg_new:nnn} % This stores a \TeX{} error message. % \begin{macrocode} @@ -7737,10 +7917,12 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_tex_error:nn #1#2 { + \group_begin: \msg_error:nnxxx { unravel } { 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} @@ -7753,10 +7935,11 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_tex_fatal_error:nn #1#2 { - \msg_error:nnxxx { unravel } { tex-fatal } + \@@_error:nxxxx { tex-fatal } { \tl_to_str:n {#2} } { \use:c { @@_tex_msg_error_#1: } } { \use:c { @@_tex_msg_help_#1: } } + { } } \cs_generate_variant:Nn \@@_tex_fatal_error:nn { nV } % \end{macrocode} @@ -7868,7 +8051,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_init_key_vars:} +% \begin{macro}{\@@_init_key_vars:} % Give variables that are affected by keys their default values (also % controlled by keys). % \begin{macrocode} @@ -7885,7 +8068,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_init_vars:} +% \begin{macro}{\@@_init_vars:} % Give initial values to variables used during the processing. These % have no reason to be modified by the user: neither directly nor % through keys. @@ -7921,7 +8104,7 @@ % \end{macro} % % ^^A todo: improve error message -% \begin{macro}[aux]{\@@_final_test:, \@@_final_bad:} +% \begin{macro}{\@@_final_test:, \@@_final_bad:} % Make sure that the \cs{unravel} finished correctly. The error % message is a bit primitive. % \begin{macrocode} @@ -7939,8 +8122,8 @@ } \cs_new_protected_nopar:Npn \@@_final_bad: { - \msg_error:nnx { unravel } { internal } - { the-last-unravel-finished-badly } + \@@_error:nnnnn { internal } + { the-last-unravel-finished-badly } { } { } { } } % \end{macrocode} % \end{macro} @@ -7952,8 +8135,6 @@ { Internal~error:~the~primitive~'#1'~is~not~known. } \msg_new:nnn { unravel } { extra-fi-or-else } { Extra~fi,~or,~or~else. } -\msg_new:nnn { unravel } { missing-lbrace } - { Missing~left~brace~inserted. } \msg_new:nnn { unravel } { missing-dollar } { Missing~dollar~inserted. } \msg_new:nnn { unravel } { unknown-expandable } @@ -7962,8 +8143,6 @@ { Missing~font~identifier.~\iow_char:N\\nullfont~inserted. } \msg_new:nnn { unravel } { missing-rparen } { Missing~right~parenthesis~inserted~for~expression. } -\msg_new:nnn { unravel } { missing-mudim } - { Missing~mu~unit. } \msg_new:nnn { unravel } { missing-cs } { Missing~control~sequence.~\iow_char:N\\inaccessible~inserted. } \msg_new:nnn { unravel } { missing-box } @@ -7999,8 +8178,6 @@ } \msg_new:nnn { unravel } { bad-unless } { \iow_char:N\\unless~not~followed~by~conditional. } -\msg_new:nnn { unravel } { missing-endcsname } - { Missing~\iow_char:N\\endcsname~inserted. } \msg_new:nnn { unravel } { runaway-if } { Runaway~\iow_char:N\\if... } \msg_new:nnn { unravel } { runaway-macro-parameter } @@ -8041,11 +8218,11 @@ \@@_tex_msg_new:nnn { incompatible-mag } { Incompatible~magnification~ - ( \int_to_arabic:n { \@@_mag: } ); \\ - \ the~previous~value~will~be~retained + ( \int_to_arabic:n { \@@_mag: } );~ + the~previous~value~will~be~retained } { - I~can~handle~only~one~magnification~ratio~per~job.~So~I've\\ + I~can~handle~only~one~magnification~ratio~per~job.~So~I've~ reverted~to~the~magnification~you~used~earlier~on~this~run. } \@@_tex_msg_new:nnn { illegal-mag } @@ -8054,9 +8231,55 @@ ( \int_to_arabic:n { \@@_mag: } ) } { The~magnification~ratio~must~be~between~1~and~32768. } +\@@_tex_msg_new:nnn { missing-number } + { Missing~number,~treated~as~zero } + { + A~number~should~have~been~here;~I~inserted~`0'.~ + If~you~can't~figure~out~why~I~needed~to~see~a~number,~ + look~up~`weird~error'~in~the~index~to~The~TeXbook. + } +\@@_tex_msg_new:nnn { the-cannot } + { You~can't~use~`\tl_to_str:N\l_@@_head_tl'~after~\iow_char:N\\the } + { I'm~forgetting~what~you~said~and~using~zero~instead. } \@@_tex_msg_new:nnn { incompatible-units } { Incompatible~glue~units } { I'm~going~to~assume~that~1mu=1pt~when~they're~mixed. } +\@@_tex_msg_new:nnn { missing-mu } + { Illegal~unit~of~measure~(mu~inserted) } + { + The~unit~of~measurement~in~math~glue~must~be~mu.~ + To~recover~gracefully~from~this~error,~it's~best~to~ + delete~the~erroneous~units;~e.g.,~type~`2'~to~delete~ + two~letters.~(See~Chapter~27~of~The~TeXbook.) + } +\@@_tex_msg_new:nnn { missing-pt } + { Illegal~unit~of~measure~(pt~inserted) } + { + Dimensions~can~be~in~units~of~em,~ex,~in,~pt,~pc,~ + cm,~mm,~dd,~cc,~nd,~nc,~bp,~or~sp;~but~yours~is~a~new~one!~ + I'll~assume~that~you~meant~to~say~pt,~for~printer's~points.~ + To~recover~gracefully~from~this~error,~it's~best~to~ + delete~the~erroneous~units;~e.g.,~type~`2'~to~delete~ + two~letters.~(See~Chapter~27~of~The~TeXbook.) + } +\@@_tex_msg_new:nnn { missing-lbrace } + { Missing~\iow_char:N\{~inserted } + { + A~left~brace~was~mandatory~here,~so~I've~put~one~in.~ + You~might~want~to~delete~and/or~insert~some~corrections~ + so~that~I~will~find~a~matching~right~brace~soon.~ + (If~you're~confused~by~all~this,~try~typing~`I\iow_char:N\}'~now.) + } +\@@_tex_msg_new:nnn { extra-endcsname } + { Extra~\token_to_str:c{endcsname} } + { I'm~ignoring~this,~since~I~wasn't~doing~a~\token_to_str:c{csname}. } +\@@_tex_msg_new:nnn { missing-endcsname } + { Missing~\token_to_str:c{endcsname}~inserted } + { + The~control~sequence~marked~<to~be~read~again>~should~ + not~appear~between~\token_to_str:c{csname}~and~ + \token_to_str:c{endcsname}. + } % \end{macrocode} % % Fatal \TeX{} error messages. diff --git a/Master/texmf-dist/tex/latex/unravel/unravel.sty b/Master/texmf-dist/tex/latex/unravel/unravel.sty index 9d051e10e64..941ccfb4109 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@gmail.com). %% -%% File: unravel.dtx Copyright (C) 2013, 2015 Bruno Le Floch +%% File: unravel.dtx Copyright (C) 2013, 2015, 2018 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,14 @@ \newlinechar = 10 ~ } \expandafter \endgroup \__unravel_setup_latexe: -\RequirePackage{expl3,xparse}[2015/09/11] -\RequirePackage{gtl}[2015/09/21] +\RequirePackage{expl3,xparse}[2018/02/21] +\RequirePackage{gtl}[2018/04/04] \csname cs_if_exist:cF\endcsname{str_range:nnn}{\RequirePackage{l3str}} \csname use:n\endcsname {% \csname __unravel_setup_restore:\endcsname \ProvidesExplPackage - {unravel} {2015/09/30} {0.2} {Watching TeX digest tokens}% + {unravel} {2018/04/04} {0.2e} {Watching TeX digest tokens}% \csname __unravel_setup_unravel:\endcsname }% \cs_new_eq:NN \__unravel_currentgrouptype: \etex_currentgrouptype:D @@ -165,8 +165,10 @@ \cs_new_eq:NN \__unravel_mag: \tex_mag:D \cs_new_eq:NN \__unravel_nullfont: \tex_nullfont:D \cs_new_eq:NN \__unravel_the:w \tex_the:D +\cs_new_eq:NN \__unravel_number:w \tex_number:D \cs_new_eq:NN \c__unravel_prompt_ior \c_sixteen \cs_new_eq:NN \c__unravel_noprompt_ior \c_minus_one +\cs_generate_variant:Nn \seq_push:Nn { Nf } \cs_generate_variant:Nn \str_head:n { f } \cs_generate_variant:Nn \tl_to_str:n { o } \cs_generate_variant:Nn \tl_if_head_eq_meaning:nNT { V } @@ -174,9 +176,8 @@ \cs_generate_variant:Nn \tl_if_in:nnTF { nV } \cs_generate_variant:Nn \tl_if_in:NnTF { No , NV } \cs_generate_variant:Nn \tl_if_single_token:nT { V } -\cs_generate_variant:Nn \tl_gset_rescan:Nnn { Nnx } \cs_generate_variant:Nn \gtl_gput_right:Nn { NV } -\cs_generate_variant:Nn \ior_get_str:NN { Nc } +\cs_generate_variant:Nn \ior_str_get:NN { Nc } \cs_generate_variant:Nn \gtl_if_empty:NTF { c } \cs_generate_variant:Nn \gtl_to_str:N { c } \cs_generate_variant:Nn \gtl_gpop_left:NN { c } @@ -185,6 +186,17 @@ \cs_generate_variant:Nn \gtl_gconcat:NNN { ccc , cNc } \cs_generate_variant:Nn \gtl_gclear:N { c } \cs_generate_variant:Nn \gtl_gclear_new:N { c } +\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_nopar:Npn \__unravel_tmp:w { } \cs_set_protected:Npn \__unravel_tmp:w #1 { @@ -254,7 +266,7 @@ } \cs_new:Npn \__unravel_strip_escape_aux:N #1 { \c_zero } \cs_new:Npn \__unravel_strip_escape_aux:w #1#2 - { - \__int_value:w #1 \c_zero } + { - \__unravel_number:w #1 \c_zero } \cs_new:Npn \__unravel_to_str:n #1 { \tl_if_head_eq_meaning:nNTF {#1} \scan_stop: @@ -272,8 +284,8 @@ \cs_new:Npn \__unravel_to_str_auxii:w ##1 #1 ##2 \q_mark ##3 \q_stop { \cs_if_exist_use:cF { __unravel_ ##2 _to_str:n } { \tl_to_str:n } } } -\exp_args:No \__unravel_tmp:w { \tl_to_str:n { s__ } } -\cs_new:Npn \__unravel_gtl_to_str:n #1 { \__gtl_to_str:w #1 } +\exp_args:No \__unravel_tmp:w { \tl_to_str:n { s _ _ } } +\cs_new:Npn \__unravel_gtl_to_str:n { \gtl_to_str:n } \cs_new:Npn \__unravel_str_truncate_left:nn #1#2 { \exp_args:Nf \__unravel_str_truncate_left_aux:nnn @@ -379,8 +391,7 @@ { \gtl_if_head_is_N_type:NTF #1 { - \exp_last_unbraced:Nx \__unravel_token_if_definable:NTF - { \gtl_head:N #1 } + \gtl_head_do:NN #1 \__unravel_token_if_definable:NTF { \prg_return_true: } { \prg_return_false: } } @@ -388,24 +399,53 @@ } { \prg_return_false: } } +\cs_new_nopar:Npn \__unravel_prev_input_count: + { + \int_eval:n + { + 0 + \seq_map_function:NN \g__unravel_prev_input_seq + \__unravel_prev_input_count_aux:n + } + } +\cs_new:Npn \__unravel_prev_input_count_aux:n #1 + { \tl_if_empty:nF {#1} { + 1 } } +\cs_new_protected_nopar:Npn \__unravel_prev_input_get:N + { \seq_get_right:NN \g__unravel_prev_input_seq } +\cs_new_protected_nopar:Npn \__unravel_prev_input_gpush: + { \seq_gput_right:Nn \g__unravel_prev_input_seq { } } +\cs_new_protected_nopar:Npn \__unravel_prev_input_gpush:N + { \seq_gput_right:NV \g__unravel_prev_input_seq } +\cs_new_protected_nopar:Npn \__unravel_prev_input_gpop:N + { \seq_gpop_right:NN \g__unravel_prev_input_seq } +\cs_new_protected_nopar:Npn \__unravel_prev_input_gpush_gtl: + { \seq_gput_right:NV \g__unravel_prev_input_seq \c_empty_gtl } +\cs_new_protected_nopar:Npn \__unravel_prev_input_gpush_gtl:N + { \seq_gput_right:NV \g__unravel_prev_input_seq } +\cs_new_protected_nopar:Npn \__unravel_prev_input_gpop_gtl:N + { \seq_gpop_right:NN \g__unravel_prev_input_seq } \cs_new_protected:Npn \__unravel_prev_input_silent:n #1 { - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_prev_input_tl + \__unravel_prev_input_gpop:N \l__unravel_prev_input_tl \tl_put_right:Nn \l__unravel_prev_input_tl {#1} - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_prev_input_tl + \__unravel_prev_input_gpush:N \l__unravel_prev_input_tl } -\cs_generate_variant:Nn \__unravel_prev_input_silent:n { V , x } +\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_new_protected:Npn \__unravel_prev_input:n #1 { \__unravel_prev_input_silent:n {#1} \__unravel_print_action:x { \tl_to_str:n {#1} } } -\cs_generate_variant:Nn \__unravel_prev_input:n { V , x } +\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_new_protected:Npn \__unravel_prev_input_gtl:N #1 { - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_prev_input_gtl + \__unravel_prev_input_gpop_gtl:N \l__unravel_prev_input_gtl \gtl_concat:NNN \l__unravel_prev_input_gtl \l__unravel_prev_input_gtl #1 - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_prev_input_gtl + \__unravel_prev_input_gpush_gtl:N \l__unravel_prev_input_gtl } \cs_new_protected:Npn \__unravel_prev_input_join_get:nN #1 { @@ -415,14 +455,14 @@ { 3 } { \__unravel_join_get_aux:NNN \muskip_eval:n \etex_muexpr:D } } { - \msg_error:nnn { unravel } { internal } { join-factor } + \__unravel_error:nnnnn { internal } { join-factor } { } { } { } \__unravel_join_get_aux:NNN \use:n \prg_do_nothing: } } \cs_new_protected:Npn \__unravel_join_get_aux:NNN #1#2#3 { - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl \tl_set:Nx #3 { #1 { \l__unravel_tmpa_tl #2 \l__unravel_head_tl } } } \tl_new:N \g__unravel_before_print_state_tl @@ -464,7 +504,7 @@ \gtl_new:N \g__unravel_output_gtl \gtl_new:N \l__unravel_head_gtl \tl_new:N \l__unravel_head_tl -\token_new:Nn \l__unravel_head_token { ? } +\cs_new_eq:NN \l__unravel_head_token ? \int_new:N \l__unravel_head_cmd_int \int_new:N \l__unravel_head_char_int \tl_new:N \l__unravel_head_meaning_tl @@ -1273,8 +1313,8 @@ { \exp_last_unbraced:NV \__unravel_set_cmd_aux_primitive:nn \c__unravel_tex_relax_tl - \msg_error:nnx { unravel } { unknown-primitive } - { \l__unravel_head_meaning_tl } + \__unravel_error:nxxxx { unknown-primitive } + { \l__unravel_head_meaning_tl } { } { } { } } \cs_new_protected_nopar:Npn \__unravel_set_cmd_aux_cs: { @@ -1332,7 +1372,7 @@ { \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 - \exp_args:NNx \int_set:Nn \l__unravel_head_char_int + \__unravel_exp_args:NNx \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 @@ -1379,8 +1419,9 @@ \gtl_if_head_is_N_type:NT #1 { \tl_set:Nx \l__unravel_input_tmpa_tl { \gtl_left_tl:N #1 } - \exp_last_unbraced:Nx \__unravel_input_split_auxii:N - { \tl_head:N \l__unravel_input_tmpa_tl } + \__unravel_exp_args:NNx \use:nn + \__unravel_input_split_auxii:N + { \tl_head:N \l__unravel_input_tmpa_tl } } } } @@ -1513,7 +1554,9 @@ \gtl_gclear_new:c { g__unravel_input_ \int_use:N \g__unravel_input_int _gtl } \gtl_gset:cn { g__unravel_input_ \int_use:N \g__unravel_input_int _gtl } } -\cs_generate_variant:Nn \__unravel_back_input:n { x , V , o } +\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 @@ -1544,17 +1587,18 @@ } \cs_new_protected_nopar:Npn \__unravel_insert_group_begin_error: { - \msg_error:nn { unravel } { missing-lbrace } + \tl_set_eq:NN \l__unravel_tmpa_tl \l__unravel_head_tl \__unravel_back_input: \gtl_set_eq:NN \l__unravel_head_gtl \c_group_begin_gtl \__unravel_back_input: + \__unravel_tex_error:nV { missing-lbrace } \l__unravel_tmpa_tl \__unravel_print_action: } \cs_new_protected_nopar:Npn \__unravel_insert_dollar_error: { \__unravel_back_input: \__unravel_back_input:n { $ } % $ - \msg_error:nn { unravel } { missing-dollar } + \__unravel_error:nnnnn { missing-dollar } { } { } { } { } \__unravel_print_action: } \use:x @@ -1612,8 +1656,8 @@ } \cs_new_protected:Npn \__unravel_macro_call_quick_runaway:Nw #1#2 \q_stop { - \msg_error:nnxx { unravel } { runaway-macro-parameter } - { \tl_to_str:N \l__unravel_head_tl } { \tl_to_str:n {#1} } + \__unravel_error:nxxxx { runaway-macro-parameter } + { \tl_to_str:N \l__unravel_head_tl } { \tl_to_str:n {#1} } { } { } } \cs_new_protected_nopar:Npn \__unravel_expand: { @@ -1621,7 +1665,7 @@ \bool_if:NT \g__unravel_internal_debug_bool { \__unravel_set_cmd: - \iow_term:x { Exp:~\int_to_arabic:n { \l__unravel_head_cmd_int } } + \__unravel_exp_args:Nx \iow_term:n { Exp:~\int_to_arabic:n { \l__unravel_head_cmd_int } } } \token_if_macro:NTF \l__unravel_head_token { \__unravel_macro_call: } @@ -1634,11 +1678,11 @@ { \cs_if_exist_use:cF { __unravel_expandable_ \int_use:N \l__unravel_head_cmd_int : } - { \msg_error:nnx { unravel } { internal } { expandable } } + { \__unravel_error:nxxxx { internal } { expandable } { } { } { } } } { - \msg_error:nnx { unravel } { unknown-primitive } - { \l__unravel_head_meaning_tl } + \__unravel_error:nxxxx { unknown-primitive } + { \l__unravel_head_meaning_tl } { } { } { } \gtl_gput_right:NV \g__unravel_output_gtl \l__unravel_head_tl \__unravel_print_action: } @@ -1697,14 +1741,17 @@ { \__unravel_get_x_non_relax: \token_if_eq_catcode:NNF \l__unravel_head_token \c_group_begin_token - { \__unravel_insert_group_begin_error: } + { + \__unravel_insert_group_begin_error: + \__unravel_get_next: + } } \cs_new_protected:Npn \__unravel_scan_keyword:n #1 { \__unravel_scan_keyword:nTF {#1} { } { } } \prg_new_protected_conditional:Npnn \__unravel_scan_keyword:n #1 { T , F , TF } { - \seq_gput_right:NV \g__unravel_prev_input_seq \c_empty_gtl + \__unravel_prev_input_gpush_gtl: \__unravel_scan_keyword_loop:NNN \c_true_bool #1 \q_recursion_tail \q_recursion_tail \q_recursion_stop } @@ -1713,7 +1760,7 @@ \quark_if_recursion_tail_stop_do:nn {#2} { \__unravel_scan_keyword_true: } \quark_if_recursion_tail_stop_do:nn {#3} - { \msg_error:nnx { unravel } { internal } { odd-keyword-length } } + { \__unravel_error:nxxxx { internal } { odd-keyword-length } { } { } { } } \__unravel_get_x_next: \__unravel_scan_keyword_test:NNTF #2#3 { @@ -1747,7 +1794,7 @@ } \cs_new_protected_nopar:Npn \__unravel_scan_keyword_true: { - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_tmpb_gtl + \__unravel_prev_input_gpop_gtl:N \l__unravel_tmpb_gtl \__unravel_prev_input:x { \gtl_to_str:N \l__unravel_tmpb_gtl } \prg_return_true: } @@ -1755,7 +1802,7 @@ #1 \q_recursion_stop { \__unravel_back_input: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_tmpb_gtl + \__unravel_prev_input_gpop_gtl:N \l__unravel_tmpb_gtl \__unravel_back_input_gtl:N \l__unravel_tmpb_gtl \prg_return_false: } @@ -1763,7 +1810,7 @@ { \__unravel_scan_keyword:nF { tToO } { - \msg_error:nn { unravel } { missing-to } + \__unravel_error:nnnnn { missing-to } { } { } { } { } \__unravel_prev_input:n { to } } } @@ -1788,7 +1835,7 @@ } } { - \msg_error:nn { unravel } { missing-font-id } + \__unravel_error:nnnnn { missing-font-id } { } { } { } { } \__unravel_back_input: \__unravel_prev_input:n { \__unravel_nullfont: } } @@ -1818,30 +1865,43 @@ } \cs_new_protected:Npn \__unravel_scan_something_aux:nwn #1#2 \q_stop #3 { - \int_compare:nNnTF - { ( #1 + \c_two ) / \c_four } > { ( #3 + \c_two ) / \c_four } + \int_compare:nT { #3 < 4 <= #1 } { \__unravel_back_input: - \msg_error:nn { unravel } { missing-something } - \tl_clear:N \l__unravel_tmpa_tl + \__unravel_tex_error:nV { missing-number } \l__unravel_head_tl + \__unravel_thing_use_get:nnNN { 1 } {#3} \c_zero_dim \l__unravel_tmpa_tl + \__unravel_scan_something_internal_auxii:Vn \l__unravel_tmpa_tl { 1 } + \__unravel_break:w } + \int_compare:nNnT {#1} = { 8 } { - \tl_if_empty:nF {#2} - { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl - \__unravel_print_action: - #2 - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl - } - \__unravel_thing_use_get:nnNN {#1} {#3} \l__unravel_head_tl \l__unravel_tmpa_tl + \__unravel_tex_error:nV { the-cannot } \l__unravel_head_tl + \__unravel_scan_something_internal_auxii:Vn \c_zero { 0 } + \__unravel_break:w } - \__unravel_prev_input_silent:V \l__unravel_tmpa_tl + \tl_if_empty:nF {#2} + { + \__unravel_prev_input_gpush:N \l__unravel_head_tl + \__unravel_print_action: + #2 + \__unravel_prev_input_gpop:N \l__unravel_head_tl + } + \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 } } + \__unravel_scan_something_internal_auxii:Vn \l__unravel_tmpa_tl {#1} + \__unravel_break_point: + \int_compare:nNnT {#3} < { 4 } { \__unravel_print_action: } + } +\cs_new_protected:Npn \__unravel_scan_something_internal_auxii:nn #1#2 + { + \__unravel_prev_input_silent:n {#1} \__unravel_set_action_text: \__unravel_set_action_text:x - { \g__unravel_action_text_str \use:n { ~ => ~ } \tl_to_str:N \l__unravel_tmpa_tl } - \int_compare:nNnF {#3} > { 3 } { \__unravel_print_action: } - \int_gset:Nn \g__unravel_val_level_int {#1} + { \g__unravel_action_text_str \use:n { ~ => ~ } \tl_to_str:n {#1} } + \int_gset:Nn \g__unravel_val_level_int {#2} } +\cs_generate_variant:Nn \__unravel_scan_something_internal_auxii:nn { V } \cs_new_nopar:Npn \__unravel_thing_case: { \int_case:nnF \l__unravel_head_cmd_int @@ -1868,6 +1928,8 @@ { 87 } { 4 } % set_font { 88 } { 4 } % def_font { 89 } { \__unravel_thing_register: } % register + {101 } { 4 } % letterspace_font + {102 } { 4 } % pdf_copy_font } { 8 } } @@ -1945,19 +2007,15 @@ } } { - \int_compare:nNnTF {#2} = { 3 } + \int_case:nnF {#1} { - \int_case:nnF {#1} - { - { 0 } { \tl_set:Nx #4 { \int_eval:n {#3} } } - { 3 } { \tl_set:Nx #4 { \muskip_eval:n {#3} } } - } - { - \__unravel_tex_error:nV { incompatible-units } #3 - \tl_set:Nx #4 { \muskip_eval:n { \etex_gluetomu:D #3 } } - } + { 0 } { \tl_set:Nx #4 { \int_eval:n {#3} } } + { 3 } { \tl_set:Nx #4 { \muskip_eval:n {#3} } } + } + { + \__unravel_tex_error:nV { incompatible-units } #3 + \tl_set:Nx #4 { \muskip_eval:n { \etex_gluetomu:D #3 } } } - { \tl_set:Nx #4 { \__unravel_the:w #3 } } } } \cs_new_protected:Npn \__unravel_scan_expr:N #1 @@ -2007,7 +2065,7 @@ { \bool_if:NTF #2 { - \msg_error:nn { unravel } { missing-rparen } + \__unravel_error:nnnnn { missing-rparen } { } { } { } { } \__unravel_back_input: \__unravel_prev_input:V \c__unravel_rp_tl } @@ -2062,16 +2120,16 @@ { \__unravel_prev_input:V \l__unravel_head_tl \__unravel_get_x_next: - \__unravel_scan_int_explicit:n { ' } + \__unravel_scan_int_explicit:Nn \c_false_bool { ' } } \c__unravel_dq_tl { \__unravel_prev_input:V \l__unravel_head_tl \__unravel_get_x_next: - \__unravel_scan_int_explicit:n { " } + \__unravel_scan_int_explicit:Nn \c_false_bool { " } } } - { \__unravel_scan_int_explicit:n { } } + { \__unravel_scan_int_explicit:Nn \c_false_bool { } } } \cs_new_protected_nopar:Npn \__unravel_scan_int_lq: { @@ -2088,10 +2146,10 @@ { ` \gtl_to_str:N \l__unravel_head_gtl = \l__unravel_tmpa_tl } \__unravel_skip_optional_space: } -\cs_new_protected:Npn \__unravel_scan_int_explicit:n #1 +\cs_new_protected:Npn \__unravel_scan_int_explicit:Nn #1#2 { \if_int_compare:w \c_one - < #1 1 \exp_after:wN \exp_not:N \l__unravel_head_tl \exp_stop_f: + < #2 1 \exp_after:wN \exp_not:N \l__unravel_head_tl \exp_stop_f: \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn @@ -2099,11 +2157,16 @@ { \__unravel_prev_input:V \l__unravel_head_tl \__unravel_get_x_next: - \__unravel_scan_int_explicit:n {#1} + \__unravel_scan_int_explicit:Nn \c_true_bool {#2} } { \token_if_eq_catcode:NNF \l__unravel_head_token \c_space_token { \__unravel_back_input: } + \bool_if:NF #1 + { + \__unravel_tex_error:nV { missing-number } \l__unravel_head_tl + \__unravel_prev_input:n { 0 } + } } } \cs_new_protected_nopar:Npn \__unravel_scan_normal_dimen: @@ -2111,7 +2174,7 @@ \cs_new_protected:Npn \__unravel_scan_dimen:nN #1#2 { \__unravel_scan_signs: - \seq_gput_right:Nn \g__unravel_prev_input_seq { } + \__unravel_prev_input_gpush: \__unravel_set_cmd: \__unravel_cmd_if_internal:TF { @@ -2122,7 +2185,7 @@ { \__unravel_scan_dim_unit:nN {#1} #2 } } { \__unravel_scan_dimen_char:nN {#1} #2 } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \__unravel_prev_input_silent:V \l__unravel_head_tl } \cs_new_protected:Npn \__unravel_scan_dimen_char:nN #1#2 @@ -2169,17 +2232,18 @@ \__unravel_set_cmd: \__unravel_cmd_if_internal:TF { - \seq_gput_right:Nn \g__unravel_prev_input_seq { } + \__unravel_prev_input_gpush: \__unravel_scan_something_internal:n {#1} \__unravel_prev_input_join_get:nN {#1} \l__unravel_tmpa_tl - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__unravel_prev_input_gpush:N \l__unravel_tmpa_tl \__unravel_break:w } { \__unravel_back_input: } \int_compare:nNnT {#1} = { 3 } { \__unravel_scan_keyword:nT { mMuU } { \__unravel_break:w } - \msg_error:nn { unravel } { missing-mudim } + \__unravel_tex_error:nV { missing-mu } \l__unravel_head_tl + \__unravel_prev_input:n { mu } \__unravel_break:w } \__unravel_scan_keyword:nT { eEmM } { \__unravel_break:w } @@ -2198,6 +2262,8 @@ \__unravel_scan_keyword:nT { nNdD } { \__unravel_break:w } \__unravel_scan_keyword:nT { nNcC } { \__unravel_break:w } \__unravel_scan_keyword:nT { sSpP } { \__unravel_break:w } + \__unravel_tex_error:nV { missing-pt } \l__unravel_head_tl + \__unravel_prev_input:n { pt } \__unravel_break_point: } \cs_new_protected_nopar:Npn \__unravel_scan_inf_unit_loop: @@ -2224,24 +2290,24 @@ { \__unravel_scan_glue:n { 3 } } \cs_new_protected:Npn \__unravel_scan_glue:n #1 { - \seq_gput_right:Nn \g__unravel_prev_input_seq { } + \__unravel_prev_input_gpush: \__unravel_scan_signs: - \seq_gput_right:Nn \g__unravel_prev_input_seq { } + \__unravel_prev_input_gpush: \__unravel_set_cmd: \__unravel_cmd_if_internal:TF { \__unravel_scan_something_internal:n {#1} \int_case:nnF \g__unravel_val_level_int { - { 0 } { \__unravel_scan_dimen:nN {#1} \c_false_bool } + { 0 } { \__unravel_scan_dim_unit:nN {#1} \c_false_bool } { 1 } { } } { \__unravel_break:w } } { \__unravel_back_input: \__unravel_scan_dimen:nN {#1} \c_false_bool } \__unravel_prev_input_join_get:nN {#1} \l__unravel_tmpa_tl - \seq_gput_right:Nn \g__unravel_prev_input_seq { } - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__unravel_prev_input_gpush: + \__unravel_prev_input_gpush:N \l__unravel_tmpa_tl \__unravel_scan_keyword:nT { pPlLuUsS } { \__unravel_scan_dimen:nN {#1} \c_true_bool } \__unravel_scan_keyword:nT { mMiInNuUsS } @@ -2280,7 +2346,7 @@ { \__unravel_get_next: } \__unravel_gtl_if_head_is_definable:NF \l__unravel_head_gtl { - \msg_error:nn { unravel } { missing-cs } + \__unravel_error:nnnnn { missing-cs } { } { } { } { } \__unravel_back_input: \tl_set:Nn \l__unravel_head_tl { \__unravel_inaccessible:w } } @@ -2289,9 +2355,9 @@ } \cs_new_protected:Npn \__unravel_scan_toks_to_str: { - \seq_gput_right:Nn \g__unravel_prev_input_seq { } + \__unravel_prev_input_gpush: \__unravel_scan_toks:NN \c_false_bool \c_true_bool - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl \__unravel_prev_input_silent:x { { \exp_after:wN \tl_to_str:n \l__unravel_tmpa_tl } } } @@ -2323,7 +2389,7 @@ \__unravel_back_input: \__unravel_input_gpop_item:NF \l__unravel_head_tl { - \msg_error:nn { unravel } { runaway-text } + \__unravel_error:nnnnn { runaway-text } { } { } { } { } \__unravel_exit:w } \tl_set:Nx \l__unravel_head_tl { { \exp_not:V \l__unravel_head_tl } } @@ -2342,10 +2408,10 @@ \__unravel_scan_group_xdef:n { 1 } } { - \seq_gput_right:NV \g__unravel_prev_input_seq \c_empty_gtl + \__unravel_prev_input_gpush_gtl: \__unravel_prev_input_gtl:N \l__unravel_head_gtl \__unravel_scan_group_x:n { 1 } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_tmpb_gtl + \__unravel_prev_input_gpop_gtl:N \l__unravel_tmpb_gtl \__unravel_prev_input_silent:x { \gtl_left_tl:N \l__unravel_tmpb_gtl } } @@ -2408,7 +2474,7 @@ \__unravel_prev_input:V \l__unravel_head_tl } { - \gtl_set:Nx \l__unravel_tmpb_gtl { \l__unravel_head_tl } + \__unravel_exp_args:NNx \gtl_set:Nn \l__unravel_tmpb_gtl { \l__unravel_head_tl } \__unravel_prev_input_gtl:N \l__unravel_tmpb_gtl \__unravel_print_action: } @@ -2472,8 +2538,8 @@ \cs_new_protected_nopar:Npn \__unravel_do_box_error: { \__unravel_back_input: - \msg_error:nn { unravel } { missing-box } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__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 } } \cs_new_protected:Npn \__unravel_do_begin_box:N #1 @@ -2498,7 +2564,7 @@ { \bool_if:NTF #1 { \__unravel_do_leaders_fetch_skip: } { - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \tl_if_head_eq_meaning:VNT \l__unravel_head_tl \tex_shipout:D { \__unravel_prepare_mag: } \tl_use:N \l__unravel_head_tl \scan_stop: @@ -2513,14 +2579,14 @@ \int_compare:nNnTF \l__unravel_head_cmd_int = { \__unravel_tex_use:n { \mode_if_vertical:TF { vskip } { hskip } } } { - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl \tl_put_left:NV \l__unravel_head_tl \l__unravel_tmpa_tl \__unravel_do_append_glue: } { \__unravel_back_input: - \msg_error:nn { unravel } { improper-leaders } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__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 } } } @@ -2531,10 +2597,10 @@ { \__unravel_box_hook:N \tex_everyvbox:D } % ^^A todo: TeX calls |normal_paragraph| here. \__unravel_scan_spec: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \__unravel_set_action_text:x { \tl_to_str:N \l__unravel_head_tl \iow_char:N \{ } - \seq_push:Nx \l__unravel_leaders_box_seq + \seq_push:Nf \l__unravel_leaders_box_seq { \bool_if:NTF #1 { \mode_if_vertical:TF { v } { h } } { Z } } \gtl_gput_right:NV \g__unravel_output_gtl \l__unravel_head_tl \gtl_gconcat:NNN \g__unravel_output_gtl @@ -2548,7 +2614,7 @@ \str_if_eq_x:nnF { \tl_head:N \l__unravel_tmpa_tl } { \exp_not:N \__unravel_box_hook:w } { - \exp_args:Nx #1 + \__unravel_exp_args:Nx #1 { \exp_not:n { \__unravel_box_hook:w \prg_do_nothing: } \exp_not:V #1 @@ -2598,18 +2664,22 @@ \gtl_gput_right:NV \g__unravel_output_gtl \l__unravel_tmpa_tl \__unravel_print_action:x { \tl_to_str:N \l__unravel_tmpa_tl } } -\cs_generate_variant:Nn \__unravel_char:n { V , x } +\cs_generate_variant:Nn \__unravel_char:n { V } +\cs_new_protected:Npn \__unravel_char:x + { \__unravel_exp_args:Nx \__unravel_char:n } \cs_new_protected:Npn \__unravel_char_in_mmode:n #1 { \int_compare:nNnTF { \tex_mathcode:D #1 } = { "8000 } { % math active - \gtl_set:Nx \l__unravel_head_gtl + \__unravel_exp_args:NNx \gtl_set:Nn \l__unravel_head_gtl { \char_generate:nn {#1} { 12 } } \__unravel_back_input: } { \__unravel_char:n {#1} } } -\cs_generate_variant:Nn \__unravel_char_in_mmode:n { V , x } +\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_new_protected:Npn \__unravel_mathchar:n #1 { \tex_mathchar:D #1 \scan_stop: @@ -2618,7 +2688,8 @@ \gtl_gput_right:NV \g__unravel_output_gtl \l__unravel_tmpa_tl \__unravel_print_action:x { \tl_to_str:N \l__unravel_tmpa_tl } } -\cs_generate_variant:Nn \__unravel_mathchar:n { x } +\cs_new_protected:Npn \__unravel_mathchar:x + { \__unravel_exp_args:Nx \__unravel_mathchar:n } \cs_new_protected:Npn \__unravel_new_graf:N #1 { \tl_set:NV \l__unravel_tmpa_tl \__unravel_everypar:w @@ -2706,8 +2777,8 @@ { \int_compare:nNnTF \__unravel_currentgrouptype: = { 0 } { % bottom-level - \msg_error:nnx { unravel } { extra-close } - { \token_to_meaning:N \l__unravel_head_token } + \__unravel_error:nxxxx { extra-close } + { \token_to_meaning:N \l__unravel_head_token } { } { } { } } { \__unravel_back_input: @@ -2722,8 +2793,8 @@ } { \gtl_set_eq:NN \l__unravel_head_gtl \c_group_end_gtl } \__unravel_back_input: - \msg_error:nnx { unravel } { off-save } - { \gtl_to_str:N \l__unravel_head_gtl } + \__unravel_error:nxxxx { off-save } + { \gtl_to_str:N \l__unravel_head_gtl } { } { } { } } } \cs_new_protected:Npn \__unravel_mode_math:n #1 @@ -2748,7 +2819,7 @@ { \token_if_eq_meaning:NNTF \l__unravel_head_token \tex_hrule:D { - \msg_error:nn { unravel } { hrule-bad-mode } + \__unravel_error:nnnnn { hrule-bad-mode } { } { } { } { } \__unravel_print_action: } { \__unravel_off_save: } @@ -2787,7 +2858,7 @@ { \__unravel_back_input: \tl_set:Nn \l__unravel_head_tl { $ } % $ - \msg_error:nn { unravel } { missing-dollar } + \__unravel_error:nnnnn { missing-dollar } { } { } { } { } } \gtl_gput_right:NV \g__unravel_output_gtl \l__unravel_head_tl \__unravel_back_input_gtl:N \l__unravel_after_group_gtl @@ -2799,10 +2870,10 @@ { \__unravel_set_action_text: \bool_if:NT \g__unravel_internal_debug_bool - { \iow_term:x { Cmd:~\int_to_arabic:n { \l__unravel_head_cmd_int } } } + { \__unravel_exp_args:Nx \iow_term:n { 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 : } - { \msg_error:nnx { unravel } { internal } { unknown-command } } + { \__unravel_error:nxxxx { internal } { unknown-command } { } { } { } } } \__unravel_new_tex_cmd:nn { relax } % 0 { \__unravel_print_action: } @@ -2857,7 +2928,7 @@ { \__unravel_mode_math:n { \__unravel_sub_sup: } } \cs_new_protected_nopar:Npn \__unravel_sub_sup: { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_get_x_non_relax: \__unravel_set_cmd: @@ -2885,14 +2956,14 @@ { \__unravel_prev_input:V \l__unravel_head_tl \__unravel_scan_int: } } { - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__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_back_input: \__unravel_scan_left_brace: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \gtl_gput_right:NV \g__unravel_output_gtl \l__unravel_head_tl \gtl_gconcat:NNN \g__unravel_output_gtl \g__unravel_output_gtl \c_group_begin_gtl @@ -2901,7 +2972,7 @@ \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } } \__unravel_new_tex_cmd:nn { endv } % 9 - { \msg_error:nn { unravel } { not-implemented } { alignments } } + { \__unravel_not_implemented:n { alignments } } \__unravel_new_tex_cmd:nn { blank_char } % 10 { \mode_if_horizontal:T @@ -2969,10 +3040,10 @@ { \__unravel_mode_math:n { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_scan_int: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__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 } } @@ -2981,10 +3052,10 @@ { \__unravel_mode_non_vertical:n { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_scan_int: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__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 } } @@ -2994,23 +3065,23 @@ { \__unravel_mode_math:n { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_scan_int: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \__unravel_mathchar:x { \tl_tail:N \l__unravel_head_tl } } } \__unravel_new_tex_cmd:nn { mark } % 18 { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \int_compare:nNnF \l__unravel_head_char_int = \c_zero { \__unravel_scan_int: } - \seq_gput_right:Nn \g__unravel_prev_input_seq { } + \__unravel_prev_input_gpush: \__unravel_scan_toks:NN \c_false_bool \c_true_bool - \seq_gpop_right:Nn \g__unravel_prev_input_seq \l__unravel_tmpa_tl - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl \tl_to_str:N \l__unravel_tmpa_tl } \tl_put_right:Nx \l__unravel_head_tl @@ -3019,23 +3090,23 @@ } \__unravel_new_tex_cmd:nn { xray } % 19 { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \int_case:nnF \l__unravel_head_char_int { { 0 } { % show \__unravel_get_next: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl \gtl_head_do:NN \l__unravel_head_gtl \l__unravel_tmpa_tl } { 2 } { % showthe \__unravel_get_x_next: \__unravel_scan_something_internal:n { 5 } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl - \exp_args:Nx \etex_showtokens:D - { \tl_tail:N \l__unravel_head_tl } + \__unravel_prev_input_gpop:N \l__unravel_head_tl + \__unravel_exp_args:Nx \use:n + { \etex_showtokens:D { \tl_tail:N \l__unravel_head_tl } } } } { % no operand for showlists, showgroups, showifs @@ -3043,19 +3114,19 @@ { \__unravel_scan_int: } \int_compare:nNnT \l__unravel_head_char_int = \c_five % showtokens { \__unravel_scan_toks:NN \c_false_bool \c_false_bool } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \tl_use:N \l__unravel_head_tl \scan_stop: } } \__unravel_new_tex_cmd:nn { make_box } % 20 { - \seq_gput_right:Nn \g__unravel_prev_input_seq { } + \__unravel_prev_input_gpush: \__unravel_back_input: \__unravel_do_box:N \c_false_bool } \cs_new_protected_nopar:Npn \__unravel_do_move: { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_scan_normal_dimen: \__unravel_do_box:N \c_false_bool @@ -3072,10 +3143,10 @@ } \cs_new_protected_nopar:Npn \__unravel_do_unpackage: { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_scan_int: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__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 } } @@ -3097,11 +3168,11 @@ \int_compare:nNnTF \l__unravel_head_char_int < { 4 } { \tl_use:N \l__unravel_head_tl \__unravel_print_action: } { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \exp_args:Nf \__unravel_scan_glue:n { \int_eval:n { \l__unravel_head_char_int - 2 } } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__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 } } @@ -3114,12 +3185,12 @@ { \__unravel_mode_math:n { \__unravel_do_append_glue: } } \cs_new_protected_nopar:Npn \__unravel_do_append_kern: { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \token_if_eq_meaning:NNTF \l__unravel_head_token \tex_kern:D { \__unravel_scan_dimen:nN { 2 } \c_false_bool } { \__unravel_scan_dimen:nN { 3 } \c_false_bool } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__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 } } @@ -3129,26 +3200,26 @@ { \__unravel_mode_math:n { \__unravel_do_append_kern: } } \__unravel_new_tex_cmd:nn { leader_ship } % 31 { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_do_box:N \c_true_bool } \__unravel_new_tex_cmd:nn { halign } % 32 - { \msg_fatal:nnx { unravel } { not-implemented } { halign } } + { \__unravel_not_implemented:n { halign } } \__unravel_new_tex_cmd:nn { valign } % 33 - { \msg_fatal:nnx { unravel } { not-implemented } { valign } } + { \__unravel_not_implemented:n { valign } } \__unravel_new_tex_cmd:nn { no_align } % 34 - { \msg_fatal:nnx { unravel } { not-implemented } { noalign } } + { \__unravel_not_implemented:n { noalign } } \__unravel_new_tex_cmd:nn { vrule } % 35 { \__unravel_mode_non_vertical:n { \__unravel_do_rule: } } \__unravel_new_tex_cmd:nn { hrule } % 36 { \__unravel_mode_vertical:n { \__unravel_do_rule: } } \cs_new_protected_nopar:Npn \__unravel_do_rule: { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_scan_alt_rule: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__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 } } @@ -3163,11 +3234,12 @@ { \token_if_eq_meaning:NNTF \l__unravel_head_token \tex_ignorespaces:D { + \__unravel_print_action: \__unravel_get_x_non_blank: \__unravel_set_cmd: \__unravel_do_step: } - { \msg_error:nn { unravel } { not-implemented } { pdfprimitive } } + { \__unravel_not_implemented:n { pdfprimitive } } } \__unravel_new_tex_cmd:nn { after_assignment } % 40 { @@ -3205,10 +3277,10 @@ } \__unravel_new_tex_cmd:nn { break_penalty } % 42 { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_scan_int: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__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 } } @@ -3236,7 +3308,7 @@ } \cs_new_protected_nopar:Npn \__unravel_do_accent: { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_scan_int: \__unravel_do_assignments: @@ -3260,7 +3332,7 @@ } { \__unravel_break:w } } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__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 } @@ -3268,11 +3340,11 @@ } \cs_new_protected_nopar:Npn \__unravel_do_math_accent: { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_scan_int: \__unravel_scan_math: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__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 } @@ -3288,30 +3360,30 @@ \__unravel_new_tex_cmd:nn { math_accent } % 46 { \__unravel_mode_math:n { \__unravel_do_math_accent: } } \__unravel_new_tex_cmd:nn { discretionary } % 47 - { \msg_error:nnx { unravel } { not-implemented } { discretionary } } + { \__unravel_not_implemented:n { discretionary } } \__unravel_new_tex_cmd:nn { eq_no } % 48 - { \msg_error:nnx { unravel } { not-implemented } { eqno } } + { \__unravel_not_implemented:n { eqno } } \__unravel_new_tex_cmd:nn { left_right } % 49 - { \msg_error:nnx { unravel } { not-implemented } { left/right } } + { \__unravel_not_implemented:n { left/right } } \__unravel_new_tex_cmd:nn { math_comp } % 50 - { \msg_error:nnx { unravel } { not-implemented } { math~comp } } + { \__unravel_not_implemented:n { math~comp } } \__unravel_new_tex_cmd:nn { limit_switch } % 51 - { \msg_error:nnx { unravel } { not-implemented } { limits } } + { \__unravel_not_implemented:n { limits } } \__unravel_new_tex_cmd:nn { above } % 52 - { \msg_error:nnx { unravel } { not-implemented } { above } } + { \__unravel_not_implemented:n { above } } \__unravel_new_tex_cmd:nn { math_style } % 53 - { \msg_error:nnx { unravel } { not-implemented } { math~style } } + { \__unravel_not_implemented:n { math~style } } \__unravel_new_tex_cmd:nn { math_choice } % 54 - { \msg_error:nnx { unravel } { not-implemented } { math~choice } } + { \__unravel_not_implemented:n { math~choice } } \__unravel_new_tex_cmd:nn { non_script } % 55 - { \msg_error:nnx { unravel } { not-implemented } { non~script } } + { \__unravel_not_implemented:n { non~script } } \__unravel_new_tex_cmd:nn { vcenter } % 56 - { \msg_error:nnx { unravel } { not-implemented } { vcenter } } + { \__unravel_not_implemented:n { vcenter } } \__unravel_new_tex_cmd:nn { case_shift } % 57 { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_scan_toks:NN \c_false_bool \c_false_bool - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl \exp_after:wN \__unravel_case_shift:Nn \l__unravel_tmpa_tl } \cs_new_protected:Npn \__unravel_case_shift:Nn #1#2 @@ -3322,25 +3394,25 @@ } \__unravel_new_tex_cmd:nn { message } % 58 { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_scan_toks_to_str: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__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_new_tex_cmd:nn { extension } % 59 { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_scan_extension_operands: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__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_new_tex_cmd:nn { in_stream } % 60 { - \seq_put_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \token_if_eq_meaning:NNTF \l__unravel_head_token \tex_openin:D { @@ -3349,7 +3421,7 @@ \__unravel_scan_file_name: } { \__unravel_scan_int: } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__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 } } @@ -3368,7 +3440,7 @@ \__unravel_print_action: } \__unravel_new_tex_cmd:nn { omit } % 63 - { \msg_error:nn { unravel } { not-implemented } { omit } } + { \__unravel_not_implemented:n { omit } } \__unravel_new_tex_cmd:nn { ex_space } % 64 { \__unravel_mode_non_vertical:n @@ -3383,18 +3455,21 @@ { \__unravel_mode_math:n { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_scan_int: \__unravel_scan_math: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__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_new_tex_cmd:nn { end_cs_name } % 67 - { \l__unravel_head_token \__unravel_print_action: } + { + \__unravel_tex_error:nV { extra-endcsname } \l__unravel_head_tl + \__unravel_print_action: + } \__unravel_new_tex_cmd:nn { char_given } % 68 { \__unravel_mode_non_vertical:n @@ -3436,7 +3511,7 @@ { \mode_if_horizontal:TF { \__unravel_scan_int: } - { \msg_error:nn { unravel } { invalid-mode } } + { \__unravel_error:nnnnn { invalid-mode } { } { } { } { } } } { 6 } % pdfliteral { @@ -3492,7 +3567,7 @@ { 14 } % pdfstartlink { \mode_if_vertical:TF - { \msg_error:nn { unravel } { invalid-mode } } + { \__unravel_error:nnnnn { invalid-mode } { } { } { } { } } { \__unravel_scan_rule_attr: \__unravel_scan_action: @@ -3501,7 +3576,7 @@ { 15 } % pdfendlink { \mode_if_vertical:T - { \msg_error:nn { unravel } { invalid-mode } } + { \__unravel_error:nnnnn { invalid-mode } { } { } { } { } } } { 16 } % pdfoutline { @@ -3597,8 +3672,8 @@ { \__unravel_scan_keyword:nF { cCuUrRrReEnNtT } { - \msg_error:nn { unravel } - { color-stack-action-missing } + \__unravel_error:nnnnn { color-stack-action-missing } + { } { } { } { } } } } @@ -3618,7 +3693,7 @@ \__unravel_scan_keyword:nF { gGoOtToO } { \__unravel_scan_keyword:nF { tThHrReEaAdD } - { \msg_error:nn { unravel } { action-type-missing } } + { \__unravel_error:nnnnn { action-type-missing } { } { } { } { } } } } \__unravel_scan_keyword:nT { fFiIlLeE } @@ -3634,7 +3709,7 @@ { \__unravel_scan_keyword:nTF { nNuUmM } { \__unravel_scan_int: } - { \msg_error:nn { unravel } { identifier-type-missing } } + { \__unravel_error:nnnnn { identifier-type-missing } { } { } { } { } } } } \__unravel_scan_keyword:nTF { nNeEwWwWiInNdDoOwW } @@ -3687,9 +3762,9 @@ \cs_new_protected_nopar:Npn \__unravel_scan_immediate_operands_bad: { \__unravel_back_input: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl ignored } - \seq_gput_right:Nn \g__unravel_prev_input_seq { } + \__unravel_prev_input_gpush: } \cs_new_protected_nopar:Npn \__unravel_scan_pdfdest_operands: @@ -3699,7 +3774,7 @@ { \__unravel_scan_keyword:nTF { nNaAmMeE } { \__unravel_scan_pdf_ext_toks: } - { \msg_error:nn { unravel } { identifier-type-missing } } + { \__unravel_error:nnnnn { identifier-type-missing } { } { } { } { } } } \__unravel_scan_keyword:nTF { xXyYzZ } { @@ -3728,10 +3803,8 @@ \__unravel_scan_keyword:nF { fFiItT } { - \msg_error:nn { unravel } - { - destination-type-missing - } + \__unravel_error:nnnnn { destination-type-missing } + { } { } { } { } } } } @@ -3744,7 +3817,7 @@ } \cs_set_protected_nopar:Npn \__unravel_tmp:w { - \seq_gput_right:Nn \g__unravel_prev_input_seq { } + \__unravel_prev_input_gpush: \__unravel_prefixed_command: } \int_step_inline:nnnn @@ -3763,10 +3836,11 @@ \int_compare:nNnF \l__unravel_head_cmd_int > { \__unravel_tex_use:n { max_non_prefixed_command } } { - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl - \msg_error:nnxx { unravel } { erroneous-prefixes } + \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl + \__unravel_error:nxxxx { erroneous-prefixes } { \tl_to_str:N \l__unravel_tmpa_tl } { \tl_to_str:N l__unravel_head_tl } + { } { } \__unravel_back_input: \__unravel_omit_after_assignment:w } @@ -3776,7 +3850,7 @@ \cs_if_exist_use:cF { __unravel_prefixed_ \int_use:N \l__unravel_head_cmd_int : } { - \msg_error:nnx { unravel } { internal } { prefixed } + \__unravel_error:nnnnn { internal } { prefixed } { } { } { } \__unravel_omit_after_assignment:w } \__unravel_after_assignment: @@ -3795,14 +3869,14 @@ } \cs_new_protected:Npn \__unravel_assign_token:n #1 { - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl #1 \tl_use:N \l__unravel_head_tl \scan_stop: \__unravel_print_assigned_token: } \cs_new_protected_nopar:Npn \__unravel_assign_register: { - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \tl_use:N \l__unravel_head_tl \scan_stop: \__unravel_print_assigned_register: } @@ -3810,10 +3884,10 @@ { \tl_if_empty:nF {#1} { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } #1 - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl } \__unravel_prev_input:V \l__unravel_head_tl \tl_set_eq:NN \l__unravel_defined_tl \l__unravel_head_tl @@ -3825,10 +3899,10 @@ { \int_compare:nNnT \l__unravel_head_char_int = \c_zero { % \toks - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_scan_int: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl } \__unravel_assign_toks: } @@ -3921,7 +3995,7 @@ } \__unravel_prefixed_new:nn { set_font } % 87 { - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__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: \gtl_gput_right:NV \g__unravel_output_gtl \l__unravel_head_tl @@ -3948,11 +4022,11 @@ } \__unravel_prefixed_new:nn { let } % 94 { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \token_if_eq_meaning:NNTF \l__unravel_head_token \tex_let:D { % |let| \__unravel_scan_r_token: - \seq_get_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__unravel_prev_input_get:N \l__unravel_tmpa_tl \__unravel_print_action:x { \tl_to_str:N \l__unravel_tmpa_tl } \__unravel_get_next: \bool_while_do:nn @@ -3965,7 +4039,7 @@ } { % |futurelet| \__unravel_scan_r_token: - \seq_get_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__unravel_prev_input_get:N \l__unravel_tmpa_tl \__unravel_print_action:x { \tl_to_str:N \l__unravel_tmpa_tl } \__unravel_get_next: \gtl_set_eq:NN \l__unravel_tmpb_gtl \l__unravel_head_gtl @@ -3974,10 +4048,10 @@ \gtl_set_eq:NN \l__unravel_head_gtl \l__unravel_tmpb_gtl \__unravel_back_input: } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl \tl_put_right:Nn \l__unravel_tmpa_tl { = ~ \l__unravel_head_token } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl - \use:x + \__unravel_prev_input_gpop:N \l__unravel_head_tl + \__unravel_exp_args:Nx \use:n { \exp_not:V \l__unravel_head_tl \tex_let:D \tl_tail:N \l__unravel_tmpa_tl @@ -4004,12 +4078,12 @@ \__unravel_scan_int: \__unravel_scan_to: \__unravel_scan_r_token: - \seq_get_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__unravel_prev_input_get:N \l__unravel_tmpa_tl \__unravel_read_to_cs_safe:fTF { \__unravel_tl_first_int:N \l__unravel_tmpa_tl } { \__unravel_assign_token:n { } } { - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \__unravel_tex_fatal_error:nV { cannot-read } \l__unravel_head_tl } } @@ -4036,10 +4110,10 @@ \cs_generate_variant:Nn \__unravel_read_to_cs_safe:nTF { f } \__unravel_prefixed_new:nn { def } % 97 { - \seq_get_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__unravel_prev_input_get:N \l__unravel_tmpa_tl \tl_set:NV \l__unravel_defining_tl \l__unravel_tmpa_tl \tl_put_right:NV \l__unravel_defining_tl \l__unravel_head_tl - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \int_compare:nNnTF \l__unravel_head_char_int < \c_two { % def/gdef \__unravel_scan_r_token: @@ -4051,7 +4125,7 @@ \tl_put_right:NV \l__unravel_defining_tl \l__unravel_defined_tl \__unravel_scan_toks:NN \c_true_bool \c_true_bool } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \__unravel_prev_input:V \l__unravel_head_tl \__unravel_assign_token:n { \tl_set_eq:NN \l__unravel_head_tl \l__unravel_defining_tl } @@ -4064,8 +4138,8 @@ \bool_if:NTF \g__unravel_set_box_allowed_bool { \__unravel_do_box:N \c_false_bool } { - \msg_error:nn { unravel } { improper-setbox } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__unravel_error:nnnnn { improper-setbox } { } { } { } { } + \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl \__unravel_omit_after_assignment:w } } @@ -4077,7 +4151,7 @@ } \__unravel_prefixed_new:nn { set_interaction } % 100 { - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__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_action:x { \tl_to_str:N \l__unravel_head_tl } @@ -4148,8 +4222,8 @@ } \cs_new_protected_nopar:Npn \__unravel_do_operation_fail:w { - \msg_error:nn { unravel } { after-advance } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__unravel_error:nnnnn { after-advance } { } { } { } { } + \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl \__unravel_omit_after_assignment:w } \cs_new_protected:Npn \__unravel_do_register:N #1 @@ -4161,10 +4235,10 @@ { \int_compare:nNnTF { \tl_tail:n {#2} } = \c_zero { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_scan_int: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \__unravel_prev_input_silent:V \l__unravel_head_tl } { @@ -4194,7 +4268,7 @@ { 3 } { \__unravel_scan_normal_glue: } % glue { 4 } { \__unravel_scan_mu_glue: } % muglue } - { \msg_error:nnx { unravel } { internal } { do-reg=#2 } } + { \__unravel_error:nxxxx { internal } { do-reg=#2 } { } { } { } } } { \__unravel_scan_int: } \__unravel_assign_register: @@ -4208,7 +4282,7 @@ > { \__unravel_tex_use:n { max_non_prefixed_command } } { \bool_gset_false:N \g__unravel_set_box_allowed_bool - \seq_gput_right:Nn \g__unravel_prev_input_seq { } + \__unravel_prev_input_gpush: \__unravel_prefixed_command: \bool_gset_true:N \g__unravel_set_box_allowed_bool \__unravel_do_assignments: @@ -4227,13 +4301,13 @@ \__unravel_get_next: \gtl_concat:NNN \l__unravel_head_gtl \l__unravel_tmpb_gtl \l__unravel_head_gtl - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_gtl + \__unravel_prev_input_gpush_gtl:N \l__unravel_head_gtl \__unravel_print_action:x { \gtl_to_str:N \l__unravel_head_gtl } \__unravel_get_next: \__unravel_token_if_expandable:NTF \l__unravel_head_token { \__unravel_expand: } { \__unravel_back_input: } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_gtl + \__unravel_prev_input_gpop:N \l__unravel_head_gtl \__unravel_set_action_text:x { back_input: ~ \gtl_to_str:N \l__unravel_head_gtl } \gtl_pop_left:N \l__unravel_head_gtl @@ -4258,7 +4332,7 @@ } \cs_new_protected_nopar:Npn \__unravel_unless_bad: { - \msg_error:nn { unravel } { bad-unless } + \__unravel_error:nnnnn { bad-unless } { } { } { } { } \__unravel_back_input: } \__unravel_new_tex_expandable:nn { no_expand } % 105 @@ -4283,7 +4357,7 @@ } } \cs_new_protected_nopar:Npn \__unravel_pdfprimitive: - { \msg_error:nnx { unravel } { not-implemented } { pdfprimitive } } + { \__unravel_not_implemented:n { pdfprimitive } } \__unravel_new_tex_expandable:nn { input } % 106 { \int_case:nnF \l__unravel_head_char_int @@ -4298,23 +4372,25 @@ } \cs_new_protected_nopar:Npn \__unravel_endinput: { - \msg_warning:nn { unravel } { endinput-ignored } + \group_begin: + \msg_warning:nn { unravel } { endinput-ignored } + \group_end: \__unravel_print_action: } \cs_new_protected_nopar:Npn \__unravel_scantokens: { - \seq_gput_right:Nn \g__unravel_prev_input_seq { } + \__unravel_prev_input_gpush: \__unravel_scan_toks:NN \c_false_bool \c_false_bool - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl \tl_set_rescan:Nno \l__unravel_head_tl { } \l__unravel_tmpa_tl \__unravel_back_input:V \l__unravel_head_tl \__unravel_print_action:x { \tl_to_str:N \l__unravel_tmpa_tl } } \cs_new_protected_nopar:Npn \__unravel_input: { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_scan_file_name: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \tl_set:Nx \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 @@ -4322,22 +4398,22 @@ } \__unravel_new_tex_expandable:nn { cs_name } % 109 { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_csname_loop: - \__unravel_prev_input:V \l__unravel_head_tl - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_silent:V \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \__unravel_back_input_tl_o: } \cs_new_protected_nopar:Npn \__unravel_csname_loop: { \__unravel_get_x_next: - \token_if_cs:NTF \l__unravel_head_token + \__unravel_gtl_if_head_is_definable:NTF \l__unravel_head_gtl { \cs_if_eq:NNF \l__unravel_head_token \tex_endcsname:D { - \msg_error:nn { unravel } { missing-endcsname } \__unravel_back_input: + \__unravel_tex_error:nV { missing-endcsname } \l__unravel_head_tl \tl_set:Nn \l__unravel_head_tl { \tex_endcsname:D } } } @@ -4349,7 +4425,7 @@ } \__unravel_new_tex_expandable:nn { convert } % 110 { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \int_case:nn \l__unravel_head_char_int { @@ -4385,7 +4461,7 @@ { 30 } \__unravel_scan_int: { 31 } \__unravel_scan_pdfximagebbox: } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \__unravel_back_input_tl_o: } \cs_new_protected_nopar:Npn \__unravel_scan_pdfstrcmp: @@ -4427,18 +4503,18 @@ } \cs_new_protected_nopar:Npn \__unravel_get_the: { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \int_if_odd:nTF \l__unravel_head_char_int { % \unexpanded, \detokenize \__unravel_scan_toks:NN \c_false_bool \c_false_bool - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \__unravel_set_action_text:x { \tl_to_str:N \l__unravel_head_tl } } { % \the \__unravel_get_x_next: \__unravel_scan_something_internal:n { 5 } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \__unravel_set_action_text:x { \tl_head:N \l__unravel_head_tl @@ -4452,7 +4528,7 @@ { \__unravel_back_input_tl_o: } \__unravel_new_tex_expandable:nn { end_template } % 117 { - \msg_error:nn { unravel } { not-implemented } { end-template } + \__unravel_not_implemented:n { end-template } { } { } { } \__unravel_back_input_tl_o: } \cs_new_protected_nopar:Npn \__unravel_pass_text: @@ -4505,7 +4581,7 @@ } \cs_new_protected_nopar:Npn \__unravel_pass_text_empty: { - \msg_error:nn { unravel } { runaway-if } + \__unravel_error:nnnnn { runaway-if } { } { } { } { } \__unravel_exit:w } \cs_new_protected:Npn \__unravel_cond_push: @@ -4554,7 +4630,7 @@ { 21 } { \__unravel_test_pdfprimitive:n {#1} } % ^^A todo and \unless } { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \int_case:nn \l__unravel_head_char_int { @@ -4585,7 +4661,7 @@ { 23 } % ifpdfabsdim { \__unravel_test_two_vals:N \__unravel_scan_normal_dimen: } } - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \__unravel_set_action_text:x { \tl_to_str:N \l__unravel_head_tl } \l__unravel_head_tl \scan_stop: \exp_after:wN \__unravel_cond_true:n @@ -4613,7 +4689,7 @@ { \token_if_eq_meaning:NNT \l__unravel_head_token \or: { - \msg_error:nn { unravel } { extra-or } + \__unravel_error:nnnnn { extra-or } { } { } { } { } \__unravel_cond_false_loop:n {#1} } } @@ -4635,7 +4711,7 @@ \__unravel_get_x_non_blank: \tl_if_in:nVF { < = > } \l__unravel_head_tl { - \msg_error:nn { unravel } { missing-equals } + \__unravel_error:nnnnn { missing-equals } { } { } { } { } \__unravel_back_input: \tl_set:Nn \l__unravel_head_tl { = } } @@ -4664,12 +4740,12 @@ } \cs_new_protected:Npn \__unravel_test_ifx:n #1 { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \__unravel_get_next: \gtl_set_eq:NN \l__unravel_tmpb_gtl \l__unravel_head_gtl \__unravel_get_next: - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_tmpa_tl + \__unravel_prev_input_gpop:N \l__unravel_tmpa_tl \__unravel_set_action_text:x { Compare:~ \tl_to_str:N \l__unravel_tmpa_tl @@ -4687,15 +4763,15 @@ { \gtl_head_do:NN \l__unravel_head_gtl \l__unravel_tmpa_tl } \cs_new_protected:Npn \__unravel_test_case:n #1 { - \seq_gput_right:NV \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpush:N \l__unravel_head_tl \__unravel_print_action: \bool_if:NT \g__unravel_internal_debug_bool { \iow_term:n { {\ifcase level~#1} } } \__unravel_scan_int: - \seq_get_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_get:N \l__unravel_head_tl \tl_set:Nx \l__unravel_head_tl { \tl_tail:N \l__unravel_head_tl } % ^^A does text_case_aux use prev_input_seq? \exp_args:No \__unravel_test_case_aux:nn { \l__unravel_head_tl } {#1} - \seq_gpop_right:NN \g__unravel_prev_input_seq \l__unravel_head_tl + \__unravel_prev_input_gpop:N \l__unravel_head_tl \__unravel_print_action:x { \tl_to_str:N \l__unravel_head_tl } } \cs_new_protected:Npn \__unravel_test_case_aux:nn #1#2 @@ -4751,10 +4827,10 @@ \int_compare:nNnTF \g__unravel_if_limit_int = \c_zero { \int_compare:nNnTF \g__unravel_if_depth_int = \c_zero - { \msg_error:nn { unravel } { extra-fi-or-else } } + { \__unravel_error:nnnnn { extra-fi-or-else } { } { } { } { } } { \__unravel_insert_relax: } } - { \msg_error:nn { unravel } { extra-fi-or-else } } + { \__unravel_error:nnnnn { extra-fi-or-else } { } { } { } { } } } { \__unravel_set_action_text: @@ -4781,8 +4857,25 @@ \__unravel_fi_or_else_loop: } } -\cs_new_eq:NN \__unravel_print:n \iow_term:n -\cs_generate_variant:Nn \__unravel_print:n { x } +\tl_new:N \l__unravel_print_tl +\sys_if_engine_luatex:TF + { + \cs_new_protected:Npx \__unravel_print_normalize_null: + { + \tl_replace_all:Nnn \exp_not:N \l__unravel_print_tl + { \char_generate:nn { 0 } { 12 } } + { \tl_to_str:n { ^ ^ @ } } + } + } + { \cs_new_protected:Npn \__unravel_print_normalize_null: { } } +\cs_new_protected:Npn \__unravel_print:n #1 + { + \tl_set:Nn \l__unravel_print_tl {#1} + \__unravel_print_normalize_null: + \__unravel_exp_args:Nx \iow_term:n { \l__unravel_print_tl } + } +\cs_new_protected:Npn \__unravel_print:x + { \__unravel_exp_args:Nx \__unravel_print:n } \cs_new_protected:Npn \__unravel_print_message:nn #1 #2 { \iow_wrap:nnnN { #1 #2 } { #1 } { } \__unravel_print:n } \cs_new_protected:Npn \__unravel_set_action_text:x #1 @@ -4808,19 +4901,18 @@ \tl_use:N \g__unravel_before_print_state_tl \int_compare:nNnT \g__unravel_noise_int > \c_zero { - \exp_args:Nx \__unravel_print_state_output:n - { \gtl_to_str:N \g__unravel_output_gtl } - \seq_set_map:NNn \l__unravel_tmpa_seq \g__unravel_prev_input_seq - { \__unravel_to_str:n {##1} } - \seq_remove_all:Nn \l__unravel_tmpa_seq { } - \exp_args:Nx \__unravel_print_state_prev:n - { \seq_use:Nn \l__unravel_tmpa_seq { \\ } } - \exp_args:Nx \__unravel_print_state_input:n - { \__unravel_input_to_str: } + \__unravel_print_state_output: + \__unravel_print_state_prev: + \__unravel_print_state_input: } \group_end: \__unravel_prompt: } +\cs_new_protected_nopar:Npn \__unravel_print_state_output: + { + \__unravel_exp_args:Nx \__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} @@ -4829,8 +4921,25 @@ { \__unravel_str_truncate_left:nn {#1} { \g__unravel_max_output_int } } } } -\cs_new_protected:Npn \__unravel_print_state_prev:n #1 - { \__unravel_print_message:nn { || ~ } {#1} } +\cs_new_protected_nopar:Npn \__unravel_print_state_prev: + { + \seq_set_map:NNn \l__unravel_tmpa_seq \g__unravel_prev_input_seq + { \__unravel_to_str:n {##1} } + \seq_remove_all:Nn \l__unravel_tmpa_seq { } + \seq_if_empty:NTF \l__unravel_tmpa_seq + { \__unravel_print_message:nn { || ~ } { } } + { + \seq_map_inline:Nn \l__unravel_tmpa_seq + { + \__unravel_print_message:nn { || ~ } {##1} + } + } + } +\cs_new_protected_nopar:Npn \__unravel_print_state_input: + { + \__unravel_exp_args:Nx \__unravel_print_state_input:n + { \__unravel_input_to_str: } + } \cs_new_protected:Npn \__unravel_print_state_input:n #1 { \__unravel_print_message:nn { |> ~ } @@ -4892,7 +5001,7 @@ \cs_new_protected_nopar:Npn \__unravel_print_assigned_register: { \__unravel_after_assignment: % ^^A todo: simplify - \exp_args:Nx \__unravel_print_action:x + \__unravel_exp_args:Nx \__unravel_print_action:x { \exp_not:n { @@ -4944,8 +5053,8 @@ \int_compare:nNnT { \etex_interactionmode:D } = { 3 } { \bool_if:NTF \g__unravel_explicit_prompt_bool - { \ior_get_str:Nc \c__unravel_prompt_ior } - { \ior_get_str:Nc \c__unravel_noprompt_ior } + { \ior_str_get:Nc \c__unravel_prompt_ior } + { \ior_str_get:Nc \c__unravel_noprompt_ior } { Your~input } \exp_args:Nv \__unravel_prompt_treat:n { Your~input } } @@ -4954,7 +5063,7 @@ { \tl_if_empty:nF {#1} { - \exp_args:Nx \str_case:nnF { \tl_head:n {#1} } + \__unravel_exp_args:Nx \str_case:nnF { \tl_head:n {#1} } { { m } { \__unravel_print_meaning: \__unravel_prompt_aux: } { q } @@ -4974,8 +5083,11 @@ { \int_gset:Nn \g__unravel_noise_int } } { C } { - \tl_gset_rescan:Nnx \g__unravel_tmpc_tl - { \ExplSyntaxOn } { \tl_tail:n {#1} } + \__unravel_exp_args:Nx \use:n + { + \tl_gset_rescan:Nnn \exp_not:N \g__unravel_tmpc_tl + { \exp_not:N \ExplSyntaxOn } { \tl_tail:n {#1} } + } \tl_gput_left:Nn \g__unravel_tmpc_tl { \tl_gclear:N \g__unravel_tmpc_tl } \group_insert_after:N \g__unravel_tmpc_tl @@ -5037,8 +5149,8 @@ \tl_gset:Nf \g__unravel_before_print_state_tl { \exp_args:NNf \exp_stop_f: \int_compare:nNnTF - { \int_eval:n { \seq_count:N \g__unravel_prev_input_seq - #2 } } - #1 { \seq_count:N \g__unravel_prev_input_seq } + { \int_eval:n { \__unravel_prev_input_count: - #2 } } + #1 { \__unravel_prev_input_count: } { \int_gset:Nn \g__unravel_nonstop_int { \int_max:nn { \g__unravel_nonstop_int } { 2 } } @@ -5067,6 +5179,20 @@ } \cs_new:Npn \__unravel_prompt_all_aux:N #1 { \exp_not:n { \int_gset:Nn #1 } { \int_use:N #1 } } +\cs_new_protected:Npn \__unravel_not_implemented:n #1 + { \__unravel_error:nnnnn { not-implemented } {#1} { } { } { } } +\cs_new_protected:Npn \__unravel_error:nnnnn #1#2#3#4#5 + { + \group_begin: + \msg_error:nnnnnn { unravel } {#1} {#2} {#3} {#4} {#5} + \group_end: + } +\cs_new_protected:Npn \__unravel_error:nxxxx #1#2#3#4#5 + { + \group_begin: + \msg_error:nnxxxx { unravel } {#1} {#2} {#3} {#4} {#5} + \group_end: + } \cs_new_protected:Npn \__unravel_tex_msg_new:nnn #1#2#3 { \cs_new_nopar:cpn { __unravel_tex_msg_error_#1: } {#2} @@ -5074,18 +5200,21 @@ } \cs_new_protected:Npn \__unravel_tex_error:nn #1#2 { + \group_begin: \msg_error:nnxxx { unravel } { 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 { - \msg_error:nnxxx { unravel } { tex-fatal } + \__unravel_error:nxxxx { tex-fatal } { \tl_to_str:n {#2} } { \use:c { __unravel_tex_msg_error_#1: } } { \use:c { __unravel_tex_msg_help_#1: } } + { } } \cs_generate_variant:Nn \__unravel_tex_fatal_error:nn { nV } \keys_define:nn { unravel/defaults } @@ -5189,15 +5318,13 @@ } \cs_new_protected_nopar:Npn \__unravel_final_bad: { - \msg_error:nnx { unravel } { internal } - { the-last-unravel-finished-badly } + \__unravel_error:nnnnn { internal } + { the-last-unravel-finished-badly } { } { } { } } \msg_new:nnn { unravel } { unknown-primitive } { Internal~error:~the~primitive~'#1'~is~not~known. } \msg_new:nnn { unravel } { extra-fi-or-else } { Extra~fi,~or,~or~else. } -\msg_new:nnn { unravel } { missing-lbrace } - { Missing~left~brace~inserted. } \msg_new:nnn { unravel } { missing-dollar } { Missing~dollar~inserted. } \msg_new:nnn { unravel } { unknown-expandable } @@ -5206,8 +5333,6 @@ { Missing~font~identifier.~\iow_char:N\\nullfont~inserted. } \msg_new:nnn { unravel } { missing-rparen } { Missing~right~parenthesis~inserted~for~expression. } -\msg_new:nnn { unravel } { missing-mudim } - { Missing~mu~unit. } \msg_new:nnn { unravel } { missing-cs } { Missing~control~sequence.~\iow_char:N\\inaccessible~inserted. } \msg_new:nnn { unravel } { missing-box } @@ -5243,8 +5368,6 @@ } \msg_new:nnn { unravel } { bad-unless } { \iow_char:N\\unless~not~followed~by~conditional. } -\msg_new:nnn { unravel } { missing-endcsname } - { Missing~\iow_char:N\\endcsname~inserted. } \msg_new:nnn { unravel } { runaway-if } { Runaway~\iow_char:N\\if... } \msg_new:nnn { unravel } { runaway-macro-parameter } @@ -5281,11 +5404,11 @@ \__unravel_tex_msg_new:nnn { incompatible-mag } { Incompatible~magnification~ - ( \int_to_arabic:n { \__unravel_mag: } ); \\ - \ the~previous~value~will~be~retained + ( \int_to_arabic:n { \__unravel_mag: } );~ + the~previous~value~will~be~retained } { - I~can~handle~only~one~magnification~ratio~per~job.~So~I've\\ + I~can~handle~only~one~magnification~ratio~per~job.~So~I've~ reverted~to~the~magnification~you~used~earlier~on~this~run. } \__unravel_tex_msg_new:nnn { illegal-mag } @@ -5294,9 +5417,55 @@ ( \int_to_arabic:n { \__unravel_mag: } ) } { The~magnification~ratio~must~be~between~1~and~32768. } +\__unravel_tex_msg_new:nnn { missing-number } + { Missing~number,~treated~as~zero } + { + A~number~should~have~been~here;~I~inserted~`0'.~ + If~you~can't~figure~out~why~I~needed~to~see~a~number,~ + look~up~`weird~error'~in~the~index~to~The~TeXbook. + } +\__unravel_tex_msg_new:nnn { the-cannot } + { You~can't~use~`\tl_to_str:N\l__unravel_head_tl'~after~\iow_char:N\\the } + { I'm~forgetting~what~you~said~and~using~zero~instead. } \__unravel_tex_msg_new:nnn { incompatible-units } { Incompatible~glue~units } { I'm~going~to~assume~that~1mu=1pt~when~they're~mixed. } +\__unravel_tex_msg_new:nnn { missing-mu } + { Illegal~unit~of~measure~(mu~inserted) } + { + The~unit~of~measurement~in~math~glue~must~be~mu.~ + To~recover~gracefully~from~this~error,~it's~best~to~ + delete~the~erroneous~units;~e.g.,~type~`2'~to~delete~ + two~letters.~(See~Chapter~27~of~The~TeXbook.) + } +\__unravel_tex_msg_new:nnn { missing-pt } + { Illegal~unit~of~measure~(pt~inserted) } + { + Dimensions~can~be~in~units~of~em,~ex,~in,~pt,~pc,~ + cm,~mm,~dd,~cc,~nd,~nc,~bp,~or~sp;~but~yours~is~a~new~one!~ + I'll~assume~that~you~meant~to~say~pt,~for~printer's~points.~ + To~recover~gracefully~from~this~error,~it's~best~to~ + delete~the~erroneous~units;~e.g.,~type~`2'~to~delete~ + two~letters.~(See~Chapter~27~of~The~TeXbook.) + } +\__unravel_tex_msg_new:nnn { missing-lbrace } + { Missing~\iow_char:N\{~inserted } + { + A~left~brace~was~mandatory~here,~so~I've~put~one~in.~ + You~might~want~to~delete~and/or~insert~some~corrections~ + so~that~I~will~find~a~matching~right~brace~soon.~ + (If~you're~confused~by~all~this,~try~typing~`I\iow_char:N\}'~now.) + } +\__unravel_tex_msg_new:nnn { extra-endcsname } + { Extra~\token_to_str:c{endcsname} } + { I'm~ignoring~this,~since~I~wasn't~doing~a~\token_to_str:c{csname}. } +\__unravel_tex_msg_new:nnn { missing-endcsname } + { Missing~\token_to_str:c{endcsname}~inserted } + { + The~control~sequence~marked~<to~be~read~again>~should~ + not~appear~between~\token_to_str:c{csname}~and~ + \token_to_str:c{endcsname}. + } \__unravel_tex_msg_new:nnn { cannot-read } { ***~(cannot~\iow_char:N\\read~from~terminal~in~nonstop~modes) } { } |