This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Distinguish C- and perly- literals - PERLY_PAREN_OPEN
authorBranislav ZahradnĂ­k <barney@cpan.org>
Fri, 11 Dec 2020 16:19:16 +0000 (17:19 +0100)
committerKarl Williamson <khw@cpan.org>
Sun, 27 Dec 2020 16:46:09 +0000 (09:46 -0700)
perly.act
perly.h
perly.tab
perly.y
toke.c

index c0dfdfc..0b4ef65 100644 (file)
--- a/perly.act
+++ b/perly.act
@@ -2130,6 +2130,6 @@ case 2:
     
 
 /* Generated from:
- * cdd9001d6b66b4ea7b642553e0efe64c82100abee9dfc3bb31d25c3d622e14ff perly.y
+ * 8e3bd7759e3e39aabe8c75614ea5d1a9188a7196abaee7d2164e9b3b14fb38d6 perly.y
  * acf1cbfd2545faeaaa58b1cf0cf9d7f98b5be0752eb7a54528ef904a9e2e1ca7 regen_perly.pl
  * ex: set ro: */
diff --git a/perly.h b/perly.h
index 4f6273d..8d33ddb 100644 (file)
--- a/perly.h
+++ b/perly.h
@@ -159,7 +159,8 @@ extern int yydebug;
     POSTINC = 358,
     POSTDEC = 359,
     POSTJOIN = 360,
-    ARROW = 361
+    ARROW = 361,
+    PERLY_PAREN_OPEN = 362
   };
 #endif
 
@@ -211,6 +212,6 @@ int yyparse (void);
 
 
 /* Generated from:
- * cdd9001d6b66b4ea7b642553e0efe64c82100abee9dfc3bb31d25c3d622e14ff perly.y
+ * 8e3bd7759e3e39aabe8c75614ea5d1a9188a7196abaee7d2164e9b3b14fb38d6 perly.y
  * acf1cbfd2545faeaaa58b1cf0cf9d7f98b5be0752eb7a54528ef904a9e2e1ca7 regen_perly.pl
  * ex: set ro: */
index e2acb0a..0585d58 100644 (file)
--- a/perly.tab
+++ b/perly.tab
@@ -18,7 +18,7 @@
 #define YYNSTATES  573
 
 #define YYUNDEFTOK  2
-#define YYMAXUTOK   361
+#define YYMAXUTOK   362
 
 
 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
@@ -34,7 +34,7 @@ static const yytype_int8 yytranslate[] =
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,   109,     2,     2,     2,
-     108,   107,   110,     2,     2,     2,     2,   111,     2,     2,
+       2,   107,   110,     2,     2,     2,     2,   111,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -66,7 +66,7 @@ static const yytype_int8 yytranslate[] =
       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
       95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
-     105,   106
+     105,   106,   108
 };
 
 #if YYDEBUG
@@ -129,11 +129,11 @@ static const char *const yytname[] =
   "OROR", "DORDOR", "ANDAND", "BITOROP", "BITANDOP", "CHEQOP", "NCEQOP",
   "CHRELOP", "NCRELOP", "SHIFTOP", "MATCHOP", "PERLY_EXCLAMATION_MARK",
   "PERLY_TILDE", "UMINUS", "REFGEN", "POWOP", "PREINC", "PREDEC",
-  "POSTINC", "POSTDEC", "POSTJOIN", "ARROW", "')'", "'('", "'$'", "'*'",
-  "'/'", "$accept", "grammar", "@1", "@2", "@3", "@4", "@5", "@6", "@7",
-  "block", "formblock", "remember", "mblock", "mremember", "stmtseq",
-  "formstmtseq", "fullstmt", "labfullstmt", "barestmt", "$@8", "$@9",
-  "$@10", "$@11", "$@12", "@13", "$@14", "formline", "formarg",
+  "POSTINC", "POSTDEC", "POSTJOIN", "ARROW", "')'", "PERLY_PAREN_OPEN",
+  "'$'", "'*'", "'/'", "$accept", "grammar", "@1", "@2", "@3", "@4", "@5",
+  "@6", "@7", "block", "formblock", "remember", "mblock", "mremember",
+  "stmtseq", "formstmtseq", "fullstmt", "labfullstmt", "barestmt", "$@8",
+  "$@9", "$@10", "$@11", "$@12", "@13", "$@14", "formline", "formarg",
   "condition", "sideff", "else", "cont", "mintro", "nexpr", "texpr",
   "iexpr", "mexpr", "mnexpr", "formname", "startsub", "startanonsub",
   "startformsub", "subname", "proto", "subattrlist", "myattrlist",
@@ -164,7 +164,7 @@ static const yytype_int16 yytoknum[] =
      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
      345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
-     355,   356,   357,   358,   359,   360,   361,    41,    40,    36,
+     355,   356,   357,   358,   359,   360,   361,    41,   362,    36,
       42,    47
 };
 # endif
@@ -1132,11 +1132,11 @@ static const toketypes yy_type_tab[] =
   toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
   toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
   toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
-  toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
+  toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
   toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
-  toketype_opval, toketype_opval, toketype_ival, toketype_opval, toketype_ival, toketype_opval,
-  toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_ival, toketype_ival,
-  toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_opval, toketype_opval,
+  toketype_ival, toketype_ival, toketype_opval, toketype_opval, toketype_ival, toketype_opval, toketype_ival,
+  toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_ival,
+  toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_opval, toketype_opval,
   toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_ival, toketype_opval, toketype_opval,
   toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_ival, toketype_ival,
   toketype_ival, toketype_opval, toketype_opval, toketype_opval, toketype_opval,
@@ -1152,6 +1152,6 @@ static const toketypes yy_type_tab[] =
 };
 
 /* Generated from:
- * cdd9001d6b66b4ea7b642553e0efe64c82100abee9dfc3bb31d25c3d622e14ff perly.y
+ * 8e3bd7759e3e39aabe8c75614ea5d1a9188a7196abaee7d2164e9b3b14fb38d6 perly.y
  * acf1cbfd2545faeaaa58b1cf0cf9d7f98b5be0752eb7a54528ef904a9e2e1ca7 regen_perly.pl
  * ex: set ro: */
diff --git a/perly.y b/perly.y
index 7d83819..5fa7f9f 100644 (file)
--- a/perly.y
+++ b/perly.y
 %nonassoc <ival> PREINC PREDEC POSTINC POSTDEC POSTJOIN
 %left <ival> ARROW
 %nonassoc <ival> ')'
-%left <ival> '('
+%left <ival> PERLY_PAREN_OPEN
 %left PERLY_BRACKET_OPEN PERLY_BRACE_OPEN
 
 %% /* RULES */
@@ -361,42 +361,42 @@ barestmt: PLUGSTMT
                          parser->parsed_sub = 1;
                          $$ = NULL;
                        }
-       |       IF '(' remember mexpr ')' mblock else
+       |       IF PERLY_PAREN_OPEN remember mexpr ')' mblock else
                        {
                          $$ = block_end($remember,
                              newCONDOP(0, $mexpr, op_scope($mblock), $else));
                          parser->copline = (line_t)$IF;
                        }
-       |       UNLESS '(' remember mexpr ')' mblock else
+       |       UNLESS PERLY_PAREN_OPEN remember mexpr ')' mblock else
                        {
                          $$ = block_end($remember,
                               newCONDOP(0, $mexpr, $else, op_scope($mblock)));
                          parser->copline = (line_t)$UNLESS;
                        }
-       |       GIVEN '(' remember mexpr ')' mblock
+       |       GIVEN PERLY_PAREN_OPEN remember mexpr ')' mblock
                        {
                          $$ = block_end($remember, newGIVENOP($mexpr, op_scope($mblock), 0));
                          parser->copline = (line_t)$GIVEN;
                        }
-       |       WHEN '(' remember mexpr ')' mblock
+       |       WHEN PERLY_PAREN_OPEN remember mexpr ')' mblock
                        { $$ = block_end($remember, newWHENOP($mexpr, op_scope($mblock))); }
        |       DEFAULT block
                        { $$ = newWHENOP(0, op_scope($block)); }
-       |       WHILE '(' remember texpr ')' mintro mblock cont
+       |       WHILE PERLY_PAREN_OPEN remember texpr ')' mintro mblock cont
                        {
                          $$ = block_end($remember,
                                  newWHILEOP(0, 1, NULL,
                                      $texpr, $mblock, $cont, $mintro));
                          parser->copline = (line_t)$WHILE;
                        }
-       |       UNTIL '(' remember iexpr ')' mintro mblock cont
+       |       UNTIL PERLY_PAREN_OPEN remember iexpr ')' mintro mblock cont
                        {
                          $$ = block_end($remember,
                                  newWHILEOP(0, 1, NULL,
                                      $iexpr, $mblock, $cont, $mintro));
                          parser->copline = (line_t)$UNTIL;
                        }
-       |       FOR '(' remember mnexpr[init_mnexpr] PERLY_SEMICOLON
+       |       FOR PERLY_PAREN_OPEN remember mnexpr[init_mnexpr] PERLY_SEMICOLON
                        { parser->expect = XTERM; }
                texpr PERLY_SEMICOLON
                        { parser->expect = XTERM; }
@@ -416,12 +416,12 @@ barestmt: PLUGSTMT
                          $$ = block_end($remember, forop);
                          parser->copline = (line_t)$FOR;
                        }
-       |       FOR MY remember my_scalar '(' mexpr ')' mblock cont
+       |       FOR MY remember my_scalar PERLY_PAREN_OPEN mexpr ')' mblock cont
                        {
                          $$ = block_end($remember, newFOROP(0, $my_scalar, $mexpr, $mblock, $cont));
                          parser->copline = (line_t)$FOR;
                        }
-       |       FOR scalar '(' remember mexpr ')' mblock cont
+       |       FOR scalar PERLY_PAREN_OPEN remember mexpr ')' mblock cont
                        {
                          $$ = block_end($remember, newFOROP(0,
                                      op_lvalue($scalar, OP_ENTERLOOP), $mexpr, $mblock, $cont));
@@ -429,7 +429,7 @@ barestmt:   PLUGSTMT
                        }
        |       FOR my_refgen remember my_var
                        { parser->in_my = 0; $<opval>$ = my($my_var); }[variable]
-               '(' mexpr ')' mblock cont
+               PERLY_PAREN_OPEN mexpr ')' mblock cont
                        {
                          $$ = block_end(
                                $remember,
@@ -442,7 +442,7 @@ barestmt:   PLUGSTMT
                          );
                          parser->copline = (line_t)$FOR;
                        }
-       |       FOR REFGEN refgen_topic '(' remember mexpr ')' mblock cont
+       |       FOR REFGEN refgen_topic PERLY_PAREN_OPEN remember mexpr ')' mblock cont
                        {
                          $$ = block_end($remember, newFOROP(
                                0, op_lvalue(newUNOP(OP_REFGEN, 0,
@@ -450,7 +450,7 @@ barestmt:   PLUGSTMT
                                             OP_ENTERLOOP), $mexpr, $mblock, $cont));
                          parser->copline = (line_t)$FOR;
                        }
-       |       FOR '(' remember mexpr ')' mblock cont
+       |       FOR PERLY_PAREN_OPEN remember mexpr ')' mblock cont
                        {
                          $$ = block_end($remember,
                                  newFOROP(0, NULL, $mexpr, $mblock, $cont));
@@ -548,7 +548,7 @@ else        :       /* NULL */
                          ($mblock)->op_flags |= OPf_PARENS;
                          $$ = op_scope($mblock);
                        }
-       |       ELSIF '(' mexpr ')' mblock else[else.recurse]
+       |       ELSIF PERLY_PAREN_OPEN mexpr ')' mblock else[else.recurse]
                        { parser->copline = (line_t)$ELSIF;
                            $$ = newCONDOP(0,
                                newSTATEOP(OPf_SPECIAL,NULL,$mexpr),
@@ -790,7 +790,7 @@ optsubsignature:    /* NULL */
                        { $$ = $subsignature; }
 
 /* Subroutine signature */
-subsignature:  '(' subsigguts ')'
+subsignature:  PERLY_PAREN_OPEN subsigguts ')'
                        { $$ = $subsigguts; }
 
 subsigguts:
@@ -919,11 +919,11 @@ listop    :       LSTOP indirob listexpr /* map {...} @args or print $fh @args */
                        { $$ = op_convert_list($LSTOP, OPf_STACKED,
                                op_prepend_elem(OP_LIST, newGVREF($LSTOP,$indirob), $listexpr) );
                        }
-       |       FUNC '(' indirob expr ')'      /* print ($fh @args */
+       |       FUNC PERLY_PAREN_OPEN indirob expr ')'      /* print ($fh @args */
                        { $$ = op_convert_list($FUNC, OPf_STACKED,
                                op_prepend_elem(OP_LIST, newGVREF($FUNC,$indirob), $expr) );
                        }
-       |       term ARROW method '(' optexpr ')' /* $foo->bar(list) */
+       |       term ARROW method PERLY_PAREN_OPEN optexpr ')' /* $foo->bar(list) */
                        { $$ = op_convert_list(OP_ENTERSUB, OPf_STACKED,
                                op_append_elem(OP_LIST,
                                    op_prepend_elem(OP_LIST, scalar($term), $optexpr),
@@ -940,7 +940,7 @@ listop      :       LSTOP indirob listexpr /* map {...} @args or print $fh @args */
                                    op_prepend_elem(OP_LIST, $indirob, $optlistexpr),
                                    newMETHOP(OP_METHOD, 0, $METHOD)));
                        }
-       |       FUNCMETH indirob '(' optexpr ')'    /* method $object (@args) */
+       |       FUNCMETH indirob PERLY_PAREN_OPEN optexpr ')'    /* method $object (@args) */
                        { $$ = op_convert_list(OP_ENTERSUB, OPf_STACKED,
                                op_append_elem(OP_LIST,
                                    op_prepend_elem(OP_LIST, $indirob, $optexpr),
@@ -948,7 +948,7 @@ listop      :       LSTOP indirob listexpr /* map {...} @args or print $fh @args */
                        }
        |       LSTOP optlistexpr                    /* print @args */
                        { $$ = op_convert_list($LSTOP, 0, $optlistexpr); }
-       |       FUNC '(' optexpr ')'                 /* print (@args) */
+       |       FUNC PERLY_PAREN_OPEN optexpr ')'                 /* print (@args) */
                        { $$ = op_convert_list($FUNC, 0, $optexpr); }
        |       FUNC SUBLEXSTART optexpr SUBLEXEND          /* uc($arg) from "\U..." */
                        { $$ = op_convert_list($FUNC, 0, $optexpr); }
@@ -996,13 +996,13 @@ subscripted:    gelem PERLY_BRACE_OPEN expr PERLY_SEMICOLON PERLY_BRACE_CLOSE
                        { $$ = newBINOP(OP_HELEM, 0,
                                        ref(newHVREF($hash_reference),OP_RV2HV),
                                        jmaybe($expr)); }
-       |       term[code_reference] ARROW '(' ')'          /* $subref->() */
+       |       term[code_reference] ARROW PERLY_PAREN_OPEN ')'          /* $subref->() */
                        { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
                                   newCVREF(0, scalar($code_reference)));
                          if (parser->expect == XBLOCK)
                              parser->expect = XOPERATOR;
                        }
-       |       term[code_reference] ARROW '(' expr ')'     /* $subref->(@args) */
+       |       term[code_reference] ARROW PERLY_PAREN_OPEN expr ')'     /* $subref->(@args) */
                        { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
                                   op_append_elem(OP_LIST, $expr,
                                       newCVREF(0, scalar($code_reference))));
@@ -1010,24 +1010,24 @@ subscripted:    gelem PERLY_BRACE_OPEN expr PERLY_SEMICOLON PERLY_BRACE_CLOSE
                              parser->expect = XOPERATOR;
                        }
 
-       |       subscripted[code_reference] '(' expr ')'   /* $foo->{bar}->(@args) */
+       |       subscripted[code_reference] PERLY_PAREN_OPEN expr ')'   /* $foo->{bar}->(@args) */
                        { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
                                   op_append_elem(OP_LIST, $expr,
                                               newCVREF(0, scalar($code_reference))));
                          if (parser->expect == XBLOCK)
                              parser->expect = XOPERATOR;
                        }
-       |       subscripted[code_reference] '(' ')'        /* $foo->{bar}->() */
+       |       subscripted[code_reference] PERLY_PAREN_OPEN ')'        /* $foo->{bar}->() */
                        { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
                                   newCVREF(0, scalar($code_reference)));
                          if (parser->expect == XBLOCK)
                              parser->expect = XOPERATOR;
                        }
-       |       '(' expr[list] ')' PERLY_BRACKET_OPEN expr[slice] PERLY_BRACKET_CLOSE            /* list slice */
+       |       PERLY_PAREN_OPEN expr[list] ')' PERLY_BRACKET_OPEN expr[slice] PERLY_BRACKET_CLOSE            /* list slice */
                        { $$ = newSLICEOP(0, $slice, $list); }
        |       QWLIST PERLY_BRACKET_OPEN expr PERLY_BRACKET_CLOSE            /* list literal slice */
                        { $$ = newSLICEOP(0, $expr, $QWLIST); }
-       |       '(' ')' PERLY_BRACKET_OPEN expr PERLY_BRACKET_CLOSE                 /* empty list slice! */
+       |       PERLY_PAREN_OPEN ')' PERLY_BRACKET_OPEN expr PERLY_BRACKET_CLOSE                 /* empty list slice! */
                        { $$ = newSLICEOP(0, $expr, NULL); }
     ;
 
@@ -1138,14 +1138,14 @@ anonymous:      PERLY_BRACKET_OPEN expr PERLY_BRACKET_CLOSE
                        { $$ = newANONLIST($expr); }
        |       PERLY_BRACKET_OPEN PERLY_BRACKET_CLOSE
                        { $$ = newANONLIST(NULL);}
-       |       HASHBRACK expr PERLY_SEMICOLON PERLY_BRACE_CLOSE        %prec '(' /* { foo => "Bar" } */
+       |       HASHBRACK expr PERLY_SEMICOLON PERLY_BRACE_CLOSE        %prec PERLY_PAREN_OPEN /* { foo => "Bar" } */
                        { $$ = newANONHASH($expr); }
-       |       HASHBRACK PERLY_SEMICOLON PERLY_BRACE_CLOSE     %prec '(' /* { } (PERLY_SEMICOLON by tokener) */
+       |       HASHBRACK PERLY_SEMICOLON PERLY_BRACE_CLOSE     %prec PERLY_PAREN_OPEN /* { } (PERLY_SEMICOLON by tokener) */
                        { $$ = newANONHASH(NULL); }
-       |       ANONSUB     startanonsub proto subattrlist subbody    %prec '('
+       |       ANONSUB     startanonsub proto subattrlist subbody    %prec PERLY_PAREN_OPEN
                        { SvREFCNT_inc_simple_void(PL_compcv);
                          $$ = newANONATTRSUB($startanonsub, $proto, $subattrlist, $subbody); }
-       |       ANON_SIGSUB startanonsub subattrlist sigsubbody %prec '('
+       |       ANON_SIGSUB startanonsub subattrlist sigsubbody %prec PERLY_PAREN_OPEN
                        { SvREFCNT_inc_simple_void(PL_compcv);
                          $$ = newANONATTRSUB($startanonsub, NULL, $subattrlist, $sigsubbody); }
     ;
@@ -1153,7 +1153,7 @@ anonymous:        PERLY_BRACKET_OPEN expr PERLY_BRACKET_CLOSE
 /* Things called with "do" */
 termdo :       DO term %prec UNIOP                     /* do $filename */
                        { $$ = dofile($term, $DO);}
-       |       DO block        %prec '('               /* do { code */
+       |       DO block        %prec PERLY_PAREN_OPEN               /* do { code */
                        { $$ = newUNOP(OP_NULL, OPf_SPECIAL, op_scope($block));}
         ;
 
@@ -1171,21 +1171,21 @@ term[product]   :       termbinop
                        { $$ = $myattrterm; }
        |       LOCAL term[operand]     %prec UNIOP
                        { $$ = localize($operand,0); }
-       |       '(' expr ')'
+       |       PERLY_PAREN_OPEN expr ')'
                        { $$ = sawparens($expr); }
        |       QWLIST
                        { $$ = $QWLIST; }
-       |       '(' ')'
+       |       PERLY_PAREN_OPEN ')'
                        { $$ = sawparens(newNULLLIST()); }
-       |       scalar  %prec '('
+       |       scalar  %prec PERLY_PAREN_OPEN
                        { $$ = $scalar; }
-       |       star    %prec '('
+       |       star    %prec PERLY_PAREN_OPEN
                        { $$ = $star; }
-       |       hsh     %prec '('
+       |       hsh     %prec PERLY_PAREN_OPEN
                        { $$ = $hsh; }
-       |       ary     %prec '('
+       |       ary     %prec PERLY_PAREN_OPEN
                        { $$ = $ary; }
-       |       arylen  %prec '('                    /* $#x, $#{ something } */
+       |       arylen  %prec PERLY_PAREN_OPEN                    /* $#x, $#{ something } */
                        { $$ = newUNOP(OP_AV2ARYLEN, 0, ref($arylen, OP_AV2ARYLEN));}
        |       subscripted
                        { $$ = $subscripted; }
@@ -1229,14 +1229,14 @@ term[product]   :       termbinop
                              $$->op_private |=
                                  $kvslice->op_private & OPpSLICEWARNING;
                        }
-       |       THING   %prec '('
+       |       THING   %prec PERLY_PAREN_OPEN
                        { $$ = $THING; }
        |       amper                                /* &foo; */
                        { $$ = newUNOP(OP_ENTERSUB, 0, scalar($amper)); }
-       |       amper '(' ')'                 /* &foo() or foo() */
+       |       amper PERLY_PAREN_OPEN ')'                 /* &foo() or foo() */
                        { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar($amper));
                        }
-       |       amper '(' expr ')'          /* &foo(@args) or foo(@args) */
+       |       amper PERLY_PAREN_OPEN expr ')'          /* &foo(@args) or foo(@args) */
                        {
                          $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
                                op_append_elem(OP_LIST, $expr, scalar($amper)));
@@ -1254,7 +1254,7 @@ term[product]     :       termbinop
        |       term[operand] ARROW PERLY_AMPERSAND '*'
                        { $$ = newUNOP(OP_ENTERSUB, 0,
                                       scalar(newCVREF($PERLY_AMPERSAND,$operand))); }
-       |       term[operand] ARROW '*' '*'     %prec '('
+       |       term[operand] ARROW '*' '*'     %prec PERLY_PAREN_OPEN
                        { $$ = newGVREF(0,$operand); }
        |       LOOPEX  /* loop exiting command (goto, last, dump, etc) */
                        { $$ = newOP($LOOPEX, OPf_SPECIAL);
@@ -1280,19 +1280,19 @@ term[product]   :       termbinop
                            op_append_elem(OP_LIST, $operand, scalar($UNIOPSUB))); }
        |       FUNC0                                /* Nullary operator */
                        { $$ = newOP($FUNC0, 0); }
-       |       FUNC0 '(' ')'
+       |       FUNC0 PERLY_PAREN_OPEN ')'
                        { $$ = newOP($FUNC0, 0);}
        |       FUNC0OP       /* Same as above, but op created in toke.c */
                        { $$ = $FUNC0OP; }
-       |       FUNC0OP '(' ')'
+       |       FUNC0OP PERLY_PAREN_OPEN ')'
                        { $$ = $FUNC0OP; }
        |       FUNC0SUB                             /* Sub treated as nullop */
                        { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar($FUNC0SUB)); }
-       |       FUNC1 '(' ')'                        /* not () */
+       |       FUNC1 PERLY_PAREN_OPEN ')'                        /* not () */
                        { $$ = ($FUNC1 == OP_NOT)
                           ? newUNOP($FUNC1, 0, newSVOP(OP_CONST, 0, newSViv(0)))
                           : newOP($FUNC1, OPf_SPECIAL); }
-       |       FUNC1 '(' expr ')'                   /* not($foo) */
+       |       FUNC1 PERLY_PAREN_OPEN expr ')'                   /* not($foo) */
                        { $$ = newUNOP($FUNC1, 0, $expr); }
        |       PMFUNC /* m//, s///, qr//, tr/// */
                        {
@@ -1322,16 +1322,16 @@ myattrterm:     MY myterm myattrlist
        ;
 
 /* Things that can be "my"'d */
-myterm :       '(' expr ')'
+myterm :       PERLY_PAREN_OPEN expr ')'
                        { $$ = sawparens($expr); }
-       |       '(' ')'
+       |       PERLY_PAREN_OPEN ')'
                        { $$ = sawparens(newNULLLIST()); }
 
-       |       scalar  %prec '('
+       |       scalar  %prec PERLY_PAREN_OPEN
                        { $$ = $scalar; }
-       |       hsh     %prec '('
+       |       hsh     %prec PERLY_PAREN_OPEN
                        { $$ = $hsh; }
-       |       ary     %prec '('
+       |       ary     %prec PERLY_PAREN_OPEN
                        { $$ = $ary; }
        ;
 
diff --git a/toke.c b/toke.c
index 26f763f..4fcc45a 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -397,6 +397,7 @@ static struct debug_tokens {
     DEBUG_TOKEN (IVAL, PERLY_EQUAL_SIGN),
     DEBUG_TOKEN (IVAL, PERLY_EXCLAMATION_MARK),
     DEBUG_TOKEN (IVAL, PERLY_MINUS),
+    DEBUG_TOKEN (IVAL, PERLY_PAREN_OPEN),
     DEBUG_TOKEN (IVAL, PERLY_PERCENT_SIGN),
     DEBUG_TOKEN (IVAL, PERLY_PLUS),
     DEBUG_TOKEN (IVAL, PERLY_QUESTION_MARK),
@@ -2087,7 +2088,7 @@ Perl_yyunlex(pTHX)
                PL_lex_allbrackets--;
                PL_lex_brackets--;
                yyc |= (3<<24) | (PL_lex_brackstack[PL_lex_brackets] << 16);
-           } else if (yyc == '('/*)*/) {
+           } else if (yyc == PERLY_PAREN_OPEN) {
                PL_lex_allbrackets--;
                yyc |= (2<<24);
            }
@@ -5396,7 +5397,7 @@ yyl_interpcasemod(pTHX_ char *s)
             PL_lex_casestack[PL_lex_casemods] = '\0';
             PL_lex_state = LEX_INTERPCONCAT;
             NEXTVAL_NEXTTOKE.ival = 0;
-            force_next((2<<24)|'(');
+            force_next((2<<24)|PERLY_PAREN_OPEN);
             if (*s == 'l')
                 NEXTVAL_NEXTTOKE.ival = OP_LCFIRST;
             else if (*s == 'u')
@@ -6516,7 +6517,7 @@ yyl_leftparen(pTHX_ char *s)
         PL_expect = XTERM;
     s = skipspace(s);
     PL_lex_allbrackets++;
-    TOKEN('(');
+    TOKEN(PERLY_PAREN_OPEN);
 }
 
 static int
@@ -9291,7 +9292,7 @@ Perl_yylex(pTHX)
            NEXTVAL_NEXTTOKE.ival = 0;
            force_next('$');
            NEXTVAL_NEXTTOKE.ival = 0;
-           force_next((2<<24)|'(');
+           force_next((2<<24)|PERLY_PAREN_OPEN);
            NEXTVAL_NEXTTOKE.ival = OP_JOIN;    /* emulate join($", ...) */
            force_next(FUNC);
        }