summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorStephen McCamant <smcc@mit.edu>1999-07-25 09:02:25 -0500
committerGurusamy Sarathy <gsar@cpan.org>1999-07-26 17:54:47 +0000
commit376b8730a7ebcc490d9c507f4b5ab0008ce577da (patch)
tree87551e39681e2eb1ae07a1f8af9e6bd21994b758 /toke.c
parent46cdf67852a338ad603a15c6495b703db1703e00 (diff)
downloadperl-376b8730a7ebcc490d9c507f4b5ab0008ce577da.tar.gz
a more correct fix for change#2744
Message-ID: <14235.24385.671437.246345@alias-2.pr.mcs.net> Subject: [PATCH _57] Re: toke.c questions p4raw-link: @2744 on //depot/perl: d194fe61f689c3f3b6f024f88d67f0262ed84a53 p4raw-id: //depot/perl@3781
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/toke.c b/toke.c
index e5dcd330ba..3dbdf8371d 100644
--- a/toke.c
+++ b/toke.c
@@ -155,6 +155,7 @@ S_no_op(pTHX_ char *what, char *s)
char *oldbp = PL_bufptr;
bool is_first = (PL_oldbufptr == PL_linestart);
+ assert(s >= oldbp);
PL_bufptr = s;
yywarn(Perl_form(aTHX_ "%s found where operator expected", what));
if (is_first)
@@ -165,10 +166,7 @@ S_no_op(pTHX_ char *what, char *s)
if (t < PL_bufptr && isSPACE(*t))
Perl_warn(aTHX_ "\t(Do you need to predeclare %.*s?)\n",
t - PL_oldoldbufptr, PL_oldoldbufptr);
-
}
- else if (s <= oldbp)
- Perl_warn(aTHX_ "\t(Missing operator before end of line?)\n");
else
Perl_warn(aTHX_ "\t(Missing operator before %.*s?)\n", s - oldbp, oldbp);
PL_bufptr = oldbp;
@@ -2656,11 +2654,11 @@ Perl_yylex(pTHX)
}
if (s[1] == '#' && (isIDFIRST_lazy(s+2) || strchr("{$:+-", s[2]))) {
- if (PL_expect == XOPERATOR)
- no_op("Array length", PL_bufptr);
PL_tokenbuf[0] = '@';
- s = scan_ident(s + 1, PL_bufend, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1,
- FALSE);
+ s = scan_ident(s + 1, PL_bufend, PL_tokenbuf + 1,
+ sizeof PL_tokenbuf - 1, FALSE);
+ if (PL_expect == XOPERATOR)
+ no_op("Array length", s);
if (!PL_tokenbuf[1])
PREREF(DOLSHARP);
PL_expect = XOPERATOR;
@@ -2668,10 +2666,11 @@ Perl_yylex(pTHX)
TOKEN(DOLSHARP);
}
- if (PL_expect == XOPERATOR)
- no_op("Scalar", PL_bufptr);
PL_tokenbuf[0] = '$';
- s = scan_ident(s, PL_bufend, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, FALSE);
+ s = scan_ident(s, PL_bufend, PL_tokenbuf + 1,
+ sizeof PL_tokenbuf - 1, FALSE);
+ if (PL_expect == XOPERATOR)
+ no_op("Scalar", s);
if (!PL_tokenbuf[1]) {
if (s == PL_bufend)
yyerror("Final $ should be \\$ or $name");