diff options
author | Yves Orton <demerphq@gmail.com> | 2022-09-26 16:44:44 +0200 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2023-02-20 11:34:22 +0800 |
commit | 248b96b9665b816ea8d1c3415b674dabccf7190b (patch) | |
tree | 0396746d950c1122ba37856ef6bd77c23f1f61c1 /toke.c | |
parent | 21938ae5a278f0b48443561333c47714921e7566 (diff) | |
download | perl-248b96b9665b816ea8d1c3415b674dabccf7190b.tar.gz |
pp_ctl.c - Consistently exit after 10 errors
Currently we only check the error count when we report an error via
yyerror(), even though we say we will stop processing after 10 errors.
Errors reported directly to qerror() bypass the check.
This fixes this so that we check the number of errors reported in
qerror() itself. We also change qerror() so that qerror(NULL) triggers
the exception, this way we can move the logic out of yyerror and into
qerror().
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 27 |
1 files changed, 4 insertions, 23 deletions
@@ -12929,30 +12929,11 @@ Perl_yyerror_pvn(pTHX_ const char *const s, STRLEN len, U32 flags) qerror(msg); } } - if ( s == NULL || - PL_error_count >= PERL_STOP_PARSING_AFTER_N_ERRORS - ) { - const char * const name = OutCopFILE(PL_curcop); - SV * errsv = NULL; - U8 raw_error_count = PERL_PARSE_ERROR_COUNT(PL_error_count); - - if (PL_in_eval) { - errsv = ERRSV; - } + /* if there was no message then this is a yyquit(), which is actualy handled + * by qerror() with a NULL argument */ + if (s == NULL) + qerror(NULL); - if (s == NULL) { - abort_execution(errsv, name); - } - else - if (raw_error_count >= PERL_STOP_PARSING_AFTER_N_ERRORS) { - if (errsv) { - Perl_croak(aTHX_ "%" SVf "%s has too many errors.\n", - SVfARG(errsv), name); - } else { - Perl_croak(aTHX_ "%s has too many errors.\n", name); - } - } - } PL_in_my = 0; PL_in_my_stash = NULL; return 0; |