summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>1999-01-21 12:08:01 +0000
committerJarkko Hietaniemi <jhi@iki.fi>1999-01-21 16:12:38 +0000
commite9fa98b27b08c227248dead8a754ba7c9269fec0 (patch)
treef6e2517d6cebffbb38021264726abffac9f4d061 /toke.c
parenta10dc3f494965a782b5e7eb467cb480dd665411d (diff)
downloadperl-e9fa98b27b08c227248dead8a754ba7c9269fec0.tar.gz
Re: [PATCH 5.005_54] Evalled substitution parsing
To: perl5-porters@perl.org Message-Id: <199901211208.MAA01228@crypt.compulink.co.uk> p4raw-id: //depot/cfgperl@2670
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/toke.c b/toke.c
index fca117b047..de6bfda949 100644
--- a/toke.c
+++ b/toke.c
@@ -822,10 +822,15 @@ sublex_done(void)
if (SvCOMPILED(PL_lex_repl)) {
PL_lex_state = LEX_INTERPNORMAL;
PL_lex_starts++;
+ /* we don't clear PL_lex_repl here, so that we can check later
+ whether this is an evalled subst; that means we rely on the
+ logic to ensure sublex_done() is called again only via the
+ branch (in yylex()) that clears PL_lex_repl, else we'll loop */
}
- else
+ else {
PL_lex_state = LEX_INTERPCONCAT;
- PL_lex_repl = Nullsv;
+ PL_lex_repl = Nullsv;
+ }
return ',';
}
else {
@@ -1845,6 +1850,11 @@ int yylex(PERL_YYLEX_PARAM_DECL)
PL_lex_state = LEX_INTERPCONCAT;
return ')';
}
+ if (PL_lex_inwhat == OP_SUBST && PL_lex_repl && SvCOMPILED(PL_lex_repl)) {
+ if (PL_bufptr != PL_bufend)
+ croak("Bad evalled substitution pattern");
+ PL_lex_repl = Nullsv;
+ }
/* FALLTHROUGH */
case LEX_INTERPCONCAT:
#ifdef DEBUGGING