diff options
author | LAUN Wolfgang <wolfgang.laun@alcatel.at> | 2004-01-02 12:31:46 +0100 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2004-01-04 19:34:36 +0000 |
commit | c5ee2135734475fb187b41accfd390dc0b6d8a97 (patch) | |
tree | b07b0fad38c2202d15ab33253fb4ee699f48f2b6 /toke.c | |
parent | 03c66f4a2f49e8e24be1c3e4545382440119e976 (diff) | |
download | perl-c5ee2135734475fb187b41accfd390dc0b6d8a97.tar.gz |
Re: [perl #24774] eval + format - \n = pp_ctl.c assertion
Message-ID: <DF27CDCBD2581D4B88431901094E4B4D02B0C4B3@attmsx1>
eval of of a truncated format should fail
p4raw-id: //depot/perl@22055
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -2427,8 +2427,12 @@ Perl_yylex(pTHX) if (!PL_rsfp) { PL_last_uni = 0; PL_last_lop = 0; - if (PL_lex_brackets) - yyerror("Missing right curly or square bracket"); + if (PL_lex_brackets) { + if (PL_lex_formbrack) + yyerror("Format not terminated"); + else + yyerror("Missing right curly or square bracket"); + } DEBUG_T( { PerlIO_printf(Perl_debug_log, "### Tokener got EOF\n"); } ); @@ -7603,6 +7607,7 @@ S_scan_formline(pTHX_ register char *s) register char *t; SV *stuff = newSVpvn("",0); bool needargs = FALSE; + bool eofmt = FALSE; while (!needargs) { if (*s == '.' || *s == /*{*/'}') { @@ -7612,8 +7617,10 @@ S_scan_formline(pTHX_ register char *s) #else for (t = s+1;SPACE_OR_TAB(*t) || *t == '\r'; t++) ; #endif - if (*t == '\n' || t == PL_bufend) + if (*t == '\n' || t == PL_bufend) { + eofmt = TRUE; break; + } } if (PL_in_eval && !PL_rsfp) { eol = strchr(s,'\n'); @@ -7653,7 +7660,6 @@ S_scan_formline(pTHX_ register char *s) PL_last_lop = PL_last_uni = Nullch; if (!s) { s = PL_bufptr; - yyerror("Format not terminated"); break; } } @@ -7682,7 +7688,8 @@ S_scan_formline(pTHX_ register char *s) } else { SvREFCNT_dec(stuff); - PL_lex_formbrack = 0; + if (eofmt) + PL_lex_formbrack = 0; PL_bufptr = s; } return s; |