Fix compiler warning:
[p5sagit/p5-mst-13.2.git] / perly.y
diff --git a/perly.y b/perly.y
index ad15d4b..4e9908e 100644 (file)
--- a/perly.y
+++ b/perly.y
 
 /*
  * 'I see,' laughed Strider.  'I look foul and feel fair.  Is that it?
- * All that is gold does not glitter, not all those who wander are lost.'
+ *  All that is gold does not glitter, not all those who wander are lost.'
  *
+ *     [p.171 of _The Lord of the Rings_, I/x: "Strider"]
+ */
+
+/*
  * This file holds the grammar for the Perl language. If edited, you need
  * to run regen_perly.pl, which re-creates the files perly.h, perly.tab
  * and perly.act which are derived from this.
@@ -69,6 +73,7 @@
 
 %token <opval> WORD METHOD FUNCMETH THING PMFUNC PRIVATEREF
 %token <opval> FUNC0SUB UNIOPSUB LSTOPSUB
+%token <opval> PLUGEXPR PLUGSTMT
 %token <p_tkval> LABEL
 %token <i_tkval> FORMAT SUB ANONSUB PACKAGE USE
 %token <i_tkval> WHILE UNTIL IF UNLESS ELSE ELSIF CONTINUE FOR
@@ -153,7 +158,7 @@ remember:   /* NULL */      /* start a full lexical scope */
        ;
 
 mydefsv:       /* NULL */      /* lexicalize $_ */
-                       { $$ = (I32) allocmy("$_"); }
+                       { $$ = (I32) Perl_allocmy(aTHX_ STR_WITH_LEN("$_"), 0); }
        ;
 
 progstart:
@@ -237,6 +242,8 @@ line        :       label cond
                              }
                          })
                        }
+       |       label PLUGSTMT
+                       { $$ = newSTATEOP(0, PVAL($1), $2); }
        ;
 
 /* An expression which may have a side-effect */
@@ -265,6 +272,8 @@ sideff      :       error
                                        (OP*)NULL, $3, $1, (OP*)NULL);
                          TOKEN_GETMAD($2,((LISTOP*)$$)->op_first->op_sibling,'w');
                        }
+       |       expr WHEN expr
+                       { $$ = newWHENOP($3, scope($1)); }
        ;
 
 /* else and elsif blocks */
@@ -627,14 +636,18 @@ subbody   :       block   { $$ = $1; }
                        }
        ;
 
-package :      PACKAGE WORD ';'
+package :      PACKAGE WORD WORD ';'
                        {
 #ifdef MAD
-                         $$ = package($2);
+                         $$ = package($3);
                          token_getmad($1,$$,'o');
-                         token_getmad($3,$$,';');
+                         if ($2)
+                             package_version($2);
+                         token_getmad($4,$$,';');
 #else
-                         package($2);
+                         package($3);
+                         if ($2)
+                             package_version($2);
                          $$ = (OP*)NULL;
 #endif
                        }
@@ -650,7 +663,7 @@ use :       USE startsub
                          token_getmad($7,$$,';');
                          if (PL_parser->rsfp_filters &&
                                      AvFILLp(PL_parser->rsfp_filters) >= 0)
-                             append_madprops(newMADPROP('!', MAD_PV, "", 0), $$, 0);
+                             append_madprops(newMADPROP('!', MAD_NULL, NULL, 0), $$, 0);
 #else
                          utilize(IVAL($1), $2, $4, $5, $6);
                          $$ = (OP*)NULL;
@@ -1232,7 +1245,9 @@ term      :       termbinop
                        {
                          $$ = newLISTOP(OP_DIE, 0, newOP(OP_PUSHMARK, 0),
                                newSVOP(OP_CONST, 0, newSVpvs("Unimplemented")));
+                         TOKEN_GETMAD($1,$$,'X');
                        }
+       |       PLUGEXPR
        ;
 
 /* "my" declarations, with optional attributes */