HV *in_my_stash; /* declared class of this "my" declaration */
PerlIO *rsfp; /* current source file pointer */
AV *rsfp_filters; /* holds chain of active source filters */
+ U8 form_lex_state; /* remember lex_state when parsing fmt */
#ifdef PERL_MAD
SV *endwhite;
# Checks if the parser behaves correctly in edge cases
# (including weird syntax errors)
-print "1..137\n";
+print "1..138\n";
sub failed {
my ($got, $expected, $name) = @_;
is $::{iwa}, undef, 'non-empty sub decl ignored after compilation error';
is *BEGIN{CODE}, undef, 'BEGIN leaves no stub after compilation error';
+$test = $test + 1;
+"ok $test - format inside re-eval" =~ /(?{
+ format =
+@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+$_
+.
+write
+}).*/;
+
# Add new tests HERE (above this line)
# bug #74022: Loop on characters in \p{OtherIDContinue}
return yylex();
case LEX_FORMLINE:
- PL_lex_state = LEX_NORMAL;
+ PL_lex_state = PL_parser->form_lex_state;
s = scan_formline(PL_bufptr);
if (!PL_lex_formbrack)
{
CURMAD('_', PL_thiswhite);
}
force_next(formbrack ? '.' : '}');
+ if (formbrack) LEAVE;
#ifdef PERL_MAD
if (!PL_thistoken)
PL_thistoken = newSVpvs("");
s--;
PL_expect = XBLOCK;
formbrack = TRUE;
+ ENTER;
+ SAVEI8(PL_parser->form_lex_state);
+ PL_parser->form_lex_state = PL_lex_state;
goto leftbracket;
}
}
break;
}
}
- if (PL_in_eval && !PL_rsfp && !PL_parser->filtered) {
- eol = (char *) memchr(s,'\n',PL_bufend-s);
- if (!eol++)
+ eol = (char *) memchr(s,'\n',PL_bufend-s);
+ if (!eol++)
eol = PL_bufend;
- }
- else
- eol = PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
if (*s != '#') {
for (t = s; t < eol; t++) {
if (*t == '~' && t[1] == '~' && SvCUR(stuff)) {
break;
}
s = (char*)eol;
- if (PL_rsfp || PL_parser->filtered) {
+ if ((PL_rsfp || PL_parser->filtered)
+ && PL_parser->form_lex_state == LEX_NORMAL) {
bool got_some;
#ifdef PERL_MAD
if (PL_madskills) {
if (SvCUR(stuff)) {
PL_expect = XTERM;
if (needargs) {
- PL_lex_state = LEX_NORMAL;
+ PL_lex_state = PL_parser->form_lex_state;
start_force(PL_curforce);
NEXTVAL_NEXTTOKE.ival = 0;
force_next(',');