pthread_condattr_init in thread.h for OLD_PTHREADS_API.
[p5sagit/p5-mst-13.2.git] / perly.y
diff --git a/perly.y b/perly.y
index 608f9e0..5996527 100644 (file)
--- a/perly.y
+++ b/perly.y
@@ -1,6 +1,6 @@
 /*    perly.y
  *
- *    Copyright (c) 1991-1994, Larry Wall
+ *    Copyright (c) 1991-1997, Larry Wall
  *
  *    You may distribute under the terms of either the GNU General Public
  *    License or the Artistic License, as specified in the README file.
@@ -9,7 +9,7 @@
 
 /*
  * 'I see,' laughed Strider.  'I look foul and feel fair.  Is that it?
- * All that is gold does not glitter, not all those that wander are lost.'
+ * All that is gold does not glitter, not all those who wander are lost.'
  */
 
 %{
@@ -208,8 +208,8 @@ loop        :       label WHILE '(' remember mtexpr ')' mblock cont
                        /* basically fake up an initialize-while lineseq */
                        { copline = $2;
                            $$ = block_end($4,
-                                  append_elem(OP_LINESEQ, scalar($5),
-                                    newSTATEOP(0, $1,
+                                  newSTATEOP(0, $1,
+                                    append_elem(OP_LINESEQ, scalar($5),
                                       newWHILEOP(0, 1, (LOOP*)Nullop,
                                                  scalar($7),
                                                  $11, scalar($9))))); }
@@ -277,19 +277,20 @@ subrout   :       SUB startsub subname proto subbody
        ;
 
 startsub:      /* NULL */      /* start a regular subroutine scope */
-                       { $$ = start_subparse(0); }
+                       { $$ = start_subparse(FALSE, 0); }
        ;
 
 startanonsub:  /* NULL */      /* start an anonymous subroutine scope */
-                       { $$ = start_subparse(CVf_ANON); }
+                       { $$ = start_subparse(FALSE, CVf_ANON); }
        ;
 
 startformsub:  /* NULL */      /* start a format subroutine scope */
-                       { $$ = start_subparse(CVf_FORMAT); }
+                       { $$ = start_subparse(TRUE, 0); }
        ;
 
-subname        :       WORD    { char *name = SvPVx(((SVOP*)$1)->op_sv, na);
-                         if (strEQ(name, "BEGIN") || strEQ(name, "END"))
+subname        :       WORD    { char *name = SvPV(((SVOP*)$1)->op_sv, na);
+                         if (strEQ(name, "BEGIN") || strEQ(name, "END")
+                             || strEQ(name, "INIT"))
                              CvUNIQUE_on(compcv);
                          $$ = $1; }
        ;
@@ -529,6 +530,13 @@ term       :       term ASSIGNOP term
                            prepend_elem(OP_LIST,
                                $4,
                                scalar(newCVREF(0,scalar($2))))); dep();}
+       |       term ARROW '(' ')'      %prec '('
+                       { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
+                                  newCVREF(0, scalar($1))); }
+       |       term ARROW '(' expr ')' %prec '('
+                       { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
+                                  append_elem(OP_LIST, $4,
+                                      newCVREF(0, scalar($1)))); }
        |       LOOPEX
                        { $$ = newOP($1, OPf_SPECIAL);
                            hints |= HINT_BLOCK_SCOPE; }