In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/ad1ecdf760483d2f4d0b46880d0941a4b6dc716d?hp=91d140d32797985c6160836671a1db4ae003e563>
- Log ----------------------------------------------------------------- commit ad1ecdf760483d2f4d0b46880d0941a4b6dc716d Author: Tony Cook <t...@develop-help.com> Date: Tue Aug 28 15:02:32 2018 +1000 simplify the error reporting from the #125351 fix commit 817480137a8b1165315f21d14b8968862101c3a2 Author: Tony Cook <t...@develop-help.com> Date: Tue Aug 28 14:11:10 2018 +1000 (perl #132158) abort compilation if we see an error compiling a form ----------------------------------------------------------------------- Summary of changes: t/lib/croak/toke | 9 +++++++++ toke.c | 19 ++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/t/lib/croak/toke b/t/lib/croak/toke index 59c377ba6b..21851229fe 100644 --- a/t/lib/croak/toke +++ b/t/lib/croak/toke @@ -493,3 +493,12 @@ sub t1 {} sub t2 (} EXPECT Prototype not terminated at - line 2. +######## +# NAME [perl #132158] format with syntax errors +format= +@ +=h +=cut +EXPECT +syntax error at - line 4, next token ??? +Execution of - aborted due to compilation errors. diff --git a/toke.c b/toke.c index 844de04a23..de4ab2e652 100644 --- a/toke.c +++ b/toke.c @@ -2575,16 +2575,8 @@ S_sublex_done(pTHX) const line_t l = CopLINE(PL_curcop); LEAVE; if (PL_parser->sub_error_count != PL_error_count) { - const char * const name = OutCopFILE(PL_curcop); if (PL_parser->sub_no_recover) { - const char * msg = ""; - if (PL_in_eval) { - SV *errsv = ERRSV; - if (SvCUR(ERRSV)) { - msg = Perl_form(aTHX_ "%" SVf, SVfARG(errsv)); - } - } - abort_execution(msg, name); + yyquit(); NOT_REACHED; } } @@ -5099,6 +5091,14 @@ Perl_yylex(pTHX) return yylex(); case LEX_FORMLINE: + if (PL_parser->sub_error_count != PL_error_count) { + /* There was an error parsing a formline, which tends to + mess up the parser. + Unlike interpolated sub-parsing, we can't treat any of + these as recoverable, so no need to check sub_no_recover. + */ + yyquit(); + } assert(PL_lex_formbrack); s = scan_formline(PL_bufptr); if (!PL_lex_formbrack) @@ -6518,6 +6518,7 @@ Perl_yylex(pTHX) SAVEI32(PL_lex_formbrack); PL_parser->form_lex_state = PL_lex_state; PL_lex_formbrack = PL_lex_brackets + 1; + PL_parser->sub_error_count = PL_error_count; goto leftbracket; } } -- Perl5 Master Repository