summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2014-05-07 09:33:03 +1000
committerKarl Williamson <khw@cpan.org>2014-05-12 13:07:04 -0600
commit9612f77d752993595fcf7e3ddafaad50d535f00a (patch)
tree0a123fa839ba18814eec9f2df4b8dea319b21456 /toke.c
parentd3f8a934ef964c0f488e9c692275435d8ea2e291 (diff)
downloadperl-9612f77d752993595fcf7e3ddafaad50d535f00a.tar.gz
ensure qw//, q'' and '' report line on a missing terminator
scan_str() only sets PL_multi_end on success, but the qw, q amd '' cases were calling the COPLINE_SET_FROM_MULTI_END; macro before reporting failure, overwriting the line used for reporting errors. For the simplest case, as in the ticket and the tests, PL_multi_end is zero, so the error is reported without a line number.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/toke.c b/toke.c
index 3d992f6471..ea88183201 100644
--- a/toke.c
+++ b/toke.c
@@ -6848,6 +6848,8 @@ Perl_yylex(pTHX)
case '\'':
s = scan_str(s,!!PL_madskills,FALSE,FALSE,FALSE,NULL);
+ if (!s)
+ missingterm(NULL);
COPLINE_SET_FROM_MULTI_END;
DEBUG_T( { printbuf("### Saw string before %s\n", s); } );
if (PL_expect == XOPERATOR) {
@@ -6857,8 +6859,6 @@ Perl_yylex(pTHX)
else
no_op("String",s);
}
- if (!s)
- missingterm(NULL);
pl_yylval.ival = OP_CONST;
TERM(sublex_start());
@@ -8385,9 +8385,9 @@ Perl_yylex(pTHX)
case KEY_q:
s = scan_str(s,!!PL_madskills,FALSE,FALSE,FALSE,NULL);
- COPLINE_SET_FROM_MULTI_END;
if (!s)
missingterm(NULL);
+ COPLINE_SET_FROM_MULTI_END;
pl_yylval.ival = OP_CONST;
TERM(sublex_start());
@@ -8397,9 +8397,9 @@ Perl_yylex(pTHX)
case KEY_qw: {
OP *words = NULL;
s = scan_str(s,!!PL_madskills,FALSE,FALSE,FALSE,NULL);
- COPLINE_SET_FROM_MULTI_END;
if (!s)
missingterm(NULL);
+ COPLINE_SET_FROM_MULTI_END;
PL_expect = XOPERATOR;
if (SvCUR(PL_lex_stuff)) {
int warned_comma = !ckWARN(WARN_QW);