- if (result == CMD_CASCADING_FAILURE &&
- !getl_is_interactive (the_source_stream))
- {
- msg (SE, _("Stopping syntax file processing here to avoid "
- "a cascade of dependent command failures."));
- getl_abort_noninteractive (the_source_stream);
- }
- else if (msg_ui_too_many_errors ())
- getl_abort_noninteractive (the_source_stream);
+ else if (cmd_result_is_failure (result) && lex_token (lexer) != T_STOP)
+ {
+ if (lex_get_error_mode (lexer) == LEX_ERROR_STOP)
+ {
+ msg (MW, _("Error encountered while ERROR=STOP is effective."));
+ lex_discard_noninteractive (lexer);
+ }
+ else if (result == CMD_CASCADING_FAILURE
+ && lex_get_error_mode (lexer) != LEX_ERROR_INTERACTIVE)
+ {
+ msg (SE, _("Stopping syntax file processing here to avoid "
+ "a cascade of dependent command failures."));
+ lex_discard_noninteractive (lexer);
+ }
+ }
+
+ if (msg_ui_too_many_errors ())
+ lex_discard_noninteractive (lexer);