diff options
author | Stephen McCamant <smcc@mit.edu> | 1999-07-25 09:02:25 -0500 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-07-26 17:54:47 +0000 |
commit | 376b8730a7ebcc490d9c507f4b5ab0008ce577da (patch) | |
tree | 87551e39681e2eb1ae07a1f8af9e6bd21994b758 /toke.c | |
parent | 46cdf67852a338ad603a15c6495b703db1703e00 (diff) | |
download | perl-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.c | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -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"); |