From: Stephen McCamant Date: Sun, 25 Jul 1999 14:02:25 +0000 (-0500) Subject: a more correct fix for change#2744 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=376b8730a7ebcc490d9c507f4b5ab0008ce577da;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/toke.c b/toke.c index e5dcd33..3dbdf83 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");