diff options
author | Luigi Scarso <luigi.scarso@gmail.com> | 2019-10-13 17:09:41 +0000 |
---|---|---|
committer | Luigi Scarso <luigi.scarso@gmail.com> | 2019-10-13 17:09:41 +0000 |
commit | 378030dd89abc0f2b0d9902dd343d1f2108a202f (patch) | |
tree | 65db6ed6a3bd3124cbb14b3634c3aae2401e5cd2 /Build/source/texk/web2c/luatexdir/tex/maincontrol.c | |
parent | df16ddc90a200f2c3a5f5724c8ad376a3258c298 (diff) |
sync with upstream luatex rev. 7197
git-svn-id: svn://tug.org/texlive/trunk@52360 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/tex/maincontrol.c')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/tex/maincontrol.c | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/Build/source/texk/web2c/luatexdir/tex/maincontrol.c b/Build/source/texk/web2c/luatexdir/tex/maincontrol.c index ef5fb64d601..f68f9e7ad76 100644 --- a/Build/source/texk/web2c/luatexdir/tex/maincontrol.c +++ b/Build/source/texk/web2c/luatexdir/tex/maincontrol.c @@ -991,6 +991,7 @@ static void init_main_control (void) { /* any_mode(lua_expandable_call_cmd, run_lua_call); */ /* no! outside jump table anyway, handled in expand() */ any_mode(node_cmd, run_node); + any_mode(combine_toks_cmd, combine_the_toks); } /*tex @@ -1041,8 +1042,6 @@ We assume a trailing relax: |{...}\relax|, so we don't need a |back_input()| her */ -/*int local_level = 0; */ - extern void local_control_message(const char *s) { tprint("local control level "); @@ -1052,11 +1051,29 @@ extern void local_control_message(const char *s) tprint_nl(""); } +/*tex Note for me (HH): in luametatex I have the option to use the save stack which for + some experiments seems to work better. But I'll probably not go forward with + some intended extension anyway (too messy), so we're currently in sync. + Instead there are now two optional parameters in |runtoks|, plus a |quittoks| + companion. I also added some more tracing as well as a warning when we jump + out of control too often. +*/ + void local_control(void) { + /*tex Wrr to saving the state local_control is like some of the conv_toks which + is not entirely correct but good enough for now. Future extensions might + demand another solution. + */ + int save_scanner_status = scanner_status; + halfword save_def_ref = def_ref; + halfword save_warning_index = warning_index; int ll = local_level; main_control_state = goto_next; local_level += 1; + if (tracing_nesting_par > 2) { + local_control_message("entering local control"); + } while (1) { if (main_control_state == goto_skip_token) { main_control_state = goto_next; @@ -1075,22 +1092,32 @@ void local_control(void) if (local_level <= ll) { main_control_state = goto_next; if (tracing_nesting_par > 2) { - local_control_message("leaving due to level change"); + local_control_message("leaving local control due to level change"); } - return ; + break; } else if (main_control_state == goto_return) { if (tracing_nesting_par > 2) { - local_control_message("leaving due to triggering"); + local_control_message("leaving local control due to triggering"); } - return; + break; } } - return; + /*tex From the perspective of ending and changing the level this is the + wrong spot, as it should be done in |end_local_control| in which case + we should use the save stack. Maybe some day. + */ + scanner_status = save_scanner_status; + def_ref = save_def_ref; + warning_index = save_warning_index; } void end_local_control(void ) { - local_level -= 1; + if (local_level > 0) { + local_level -= 1; + } else { + local_control_message("redundant end local control"); + } } /*tex |