This makes it easier to write tests that cause a lot of cascading failures.
lex_discard_noninteractive (struct lexer *lexer)
{
struct lex_source *src = lex_source__ (lexer);
-
if (src != NULL)
{
+ if (src->reader->error == LEX_ERROR_IGNORE)
+ return;
+
lex_stage_clear (&src->pp);
lex_stage_clear (&src->merge);
lex_source_clear_parse (src);
LEX_ERROR_TERMINAL, /* Discard input line and continue reading. */
LEX_ERROR_CONTINUE, /* Continue to next command, except for
cascading failures. */
- LEX_ERROR_STOP /* Stop processing. */
+ LEX_ERROR_IGNORE, /* Continue, even for cascading failures. */
+ LEX_ERROR_STOP, /* Stop processing. */
};
/* Reads a single syntax file as a stream of bytes encoded in UTF-8.
{
lex_match (lexer, T_EQUALS);
if (lex_match_id (lexer, "CONTINUE"))
- {
- error_mode = LEX_ERROR_CONTINUE;
- }
+ error_mode = LEX_ERROR_CONTINUE;
else if (lex_match_id (lexer, "STOP"))
- {
- error_mode = LEX_ERROR_STOP;
- }
+ error_mode = LEX_ERROR_STOP;
+ else if (settings_get_testing_mode ()
+ && lex_match_id (lexer, "IGNORE"))
+ error_mode = LEX_ERROR_IGNORE;
else
{
lex_error_expecting (lexer, "CONTINUE", "STOP");
break;
else if (cmd_result_is_failure (result) && lex_token (lexer) != T_STOP)
{
- if (lex_get_error_mode (lexer) == LEX_ERROR_STOP)
+ switch (lex_get_error_mode (lexer))
{
+ case 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_TERMINAL)
- {
- msg (SE, _("Stopping syntax file processing here to avoid "
- "a cascade of dependent command failures."));
- lex_discard_noninteractive (lexer);
+ break;
+
+ case LEX_ERROR_CONTINUE:
+ if (result == CMD_CASCADING_FAILURE)
+ {
+ msg (SE, _("Stopping syntax file processing here to avoid "
+ "a cascade of dependent command failures."));
+ lex_discard_noninteractive (lexer);
+ }
+ break;
+
+ case LEX_ERROR_TERMINAL:
+ case LEX_ERROR_IGNORE:
+ break;
}
}