diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/unravel/unravel.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/unravel/unravel.sty | 743 |
1 files changed, 456 insertions, 287 deletions
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) } { } |