Recover from errors even inside REPT/FOR loops (#1683)

This commit is contained in:
Rangi
2025-05-04 17:51:53 -04:00
committed by GitHub
parent e1ae92709c
commit e95ac6fb06
6 changed files with 12 additions and 10 deletions

View File

@@ -392,17 +392,13 @@ void fstk_RunFor(
context.forName = symName;
}
void fstk_StopRept() {
contextStack.top().nbReptIters = 0; // Prevent more iterations
}
bool fstk_Break() {
if (contextStack.top().fileInfo->type != NODE_REPT) {
error("BREAK can only be used inside a REPT/FOR block\n");
return false;
}
fstk_StopRept();
contextStack.top().nbReptIters = 0; // Prevent more iterations
return true;
}

View File

@@ -425,7 +425,6 @@ lines:
lexer_SetMode(LEXER_NORMAL);
lexer_ToggleStringExpansion(true);
} endofline {
fstk_StopRept();
yyerrok;
}
;