In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/310a0d0a370ea21c004bfea4bbdd2cf15da94547?hp=be59b6aaf8e201fef17a0706e99f6a47556ed1ac>

- Log -----------------------------------------------------------------
commit 310a0d0a370ea21c004bfea4bbdd2cf15da94547
Author: David Mitchell <[email protected]>
Date:   Sat Apr 25 17:07:03 2015 +0100

    [perl #123737] Fix assertion failure with 0$#{
    
    This is a follow-up to FC's 488bc579589, which stopped assertion
    failures on parsing 0${. A similar code path still failed with
    0$#{.
    
    The fix is similar to the previous fix, although I suspect a more general
    fix is needed - perhaps moving the fixes into S_no_op() - but not this
    close to the 5.22 release.
-----------------------------------------------------------------------

Summary of changes:
 t/lib/croak/toke |  9 +++++++++
 toke.c           | 10 ++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/t/lib/croak/toke b/t/lib/croak/toke
index a5e02af..a061ac8 100644
--- a/t/lib/croak/toke
+++ b/t/lib/croak/toke
@@ -28,6 +28,15 @@ syntax error at - line 1, near "0$"
 Missing right curly or square bracket at - line 1, at end of line
 Execution of - aborted due to compilation errors.
 ########
+# NAME (Missing operator before $#{?) [perl #123737]
+0$#{
+EXPECT
+Array length found where operator expected at - line 1, near "0$#{"
+       (Missing operator before $#{?)
+syntax error at - line 1, near "0$#"
+Missing right curly or square bracket at - line 1, at end of line
+Execution of - aborted due to compilation errors.
+########
 # NAME Unterminated here-doc in string eval
 eval "<<foo"; die $@
 EXPECT
diff --git a/toke.c b/toke.c
index 294cb8f..4962521 100644
--- a/toke.c
+++ b/toke.c
@@ -6011,8 +6011,14 @@ Perl_yylex(pTHX)
            PL_tokenbuf[0] = '@';
            s = scan_ident(s + 1, PL_tokenbuf + 1,
                           sizeof PL_tokenbuf - 1, FALSE);
-           if (PL_expect == XOPERATOR)
-               no_op("Array length", s);
+            if (PL_expect == XOPERATOR) {
+                d = s;
+                if (PL_bufptr > s) {
+                    d = PL_bufptr-1;
+                    PL_bufptr = PL_oldbufptr;
+                }
+               no_op("Array length", d);
+            }
            if (!PL_tokenbuf[1])
                PREREF(DOLSHARP);
            PL_expect = XOPERATOR;

--
Perl5 Master Repository

Reply via email to