This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c: Touch PL_expect less for implicit [.,] in quotes
authorFather Chrysostomos <sprout@cpan.org>
Fri, 22 Aug 2014 12:45:27 +0000 (05:45 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 25 Aug 2014 02:02:57 +0000 (19:02 -0700)
When emitting implicit commas and cats, there is no need to set
PL_expect at the same time, since these code paths have already set
it to the correct value.  Also, the two instances of Aop would check
the current parse position for an ‘=’ to make an assignment operator.
But that could never happen in these two code paths, so the check
was a waste.

toke.c

diff --git a/toke.c b/toke.c
index a7ba403..f3a493c 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -4390,7 +4390,7 @@ Perl_yylex(pTHX)
                PL_lex_starts = 0;
                /* commas only at base level: /$a\Ub$c/ => ($a,uc(b.$c)) */
                if (PL_lex_casemods == 1 && PL_lex_inpat)
-                   OPERATOR(',');
+                   TOKEN(',');
                else
                    AopNOASSIGN(OP_CONCAT);
            }
@@ -4437,9 +4437,9 @@ Perl_yylex(pTHX)
            s = PL_bufptr;
            /* commas only at base level: /$a\Ub$c/ => ($a,uc(b.$c)) */
            if (!PL_lex_casemods && PL_lex_inpat)
-               OPERATOR(',');
+               TOKEN(',');
            else
-               Aop(OP_CONCAT);
+               AopNOASSIGN(OP_CONCAT);
        }
        return yylex();
 
@@ -4527,9 +4527,9 @@ Perl_yylex(pTHX)
            if (PL_lex_starts++) {
                /* commas only at base level: /$a\Ub$c/ => ($a,uc(b.$c)) */
                if (!PL_lex_casemods && PL_lex_inpat)
-                   OPERATOR(',');
+                   TOKEN(',');
                else
-                   Aop(OP_CONCAT);
+                   AopNOASSIGN(OP_CONCAT);
            }
            else {
                PL_bufptr = s;