Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime: small refactoring in parsing.js #1677

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions runtime/parsing.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ function caml_parse_engine(tables, env, cmd, arg) {
var state = env[env_state];
var errflag = env[env_errflag];

exit: for (;;) {
next: switch (cmd) {
the_loop: for (;;) {
smorimoto marked this conversation as resolved.
Show resolved Hide resolved
switch (cmd) {
case 0: //START:
state = 0;
errflag = 0;
Expand All @@ -147,7 +147,7 @@ function caml_parse_engine(tables, env, cmd, arg) {
break;
}
res = READ_TOKEN;
break exit;
break the_loop;
smorimoto marked this conversation as resolved.
Show resolved Hide resolved
/* The ML code calls the lexer and updates */
/* symb_start and symb_end */
case 1: //TOKEN_READ:
Expand Down Expand Up @@ -187,7 +187,7 @@ function caml_parse_engine(tables, env, cmd, arg) {
}
if (errflag <= 0) {
res = CALL_ERROR_FUNCTION;
break exit;
break the_loop;
}
// Fall through
/* The ML code calls the error function */
Expand All @@ -206,7 +206,7 @@ function caml_parse_engine(tables, env, cmd, arg) {
) {
if (caml_parser_trace) log("Recovering in state " + state1);
cmd = shift_recover;
break next;
continue the_loop;
smorimoto marked this conversation as resolved.
Show resolved Hide resolved
} else {
if (caml_parser_trace) log("Discarding state " + state1);
if (sp <= env[env_stackbase]) {
Expand Down Expand Up @@ -237,7 +237,7 @@ function caml_parse_engine(tables, env, cmd, arg) {
sp++;
if (sp >= env[env_stacksize]) {
res = GROW_STACKS_1;
break exit;
break the_loop;
}
// Fall through
/* The ML code resizes the stacks */
Expand Down Expand Up @@ -270,13 +270,13 @@ function caml_parse_engine(tables, env, cmd, arg) {
else state = tables.dgoto[m];
if (sp >= env[env_stacksize]) {
res = GROW_STACKS_2;
break exit;
break the_loop;
}
// Fall through
/* The ML code resizes the stacks */
case 3: //STACKS_GROWN_2:
res = COMPUTE_SEMANTIC_ACTION;
break exit;
break the_loop;
/* The ML code calls the semantic action */
case 4: //SEMANTIC_ACTION_COMPUTED:
env[env_s_stack][sp + 1] = state;
Expand Down
Loading