/* perly.y
*
- * Copyright (c) 1991-2001, Larry Wall
+ * Copyright (c) 1991-2002, 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.
YYSTYPE oldyylval;
};
-static void yydestruct(pTHXo_ void *ptr);
+static void yydestruct(pTHX_ void *ptr);
%}
%token COLONATTR
%type <ival> prog decl format startsub startanonsub startformsub
-%type <ival> remember mremember '&'
+%type <ival> progstart remember mremember '&'
%type <opval> block mblock lineseq line loop cond else
%type <opval> expr term subscripted scalar ary hsh arylen star amper sideff
%type <opval> argexpr nexpr texpr iexpr mexpr mnexpr mtexpr miexpr
%% /* RULES */
/* The whole program */
-prog : /* NULL */
- {
-#if defined(YYDEBUG) && defined(DEBUGGING)
- yydebug = (DEBUG_p_TEST);
-#endif
- PL_expect = XSTATE; $$ = block_start(TRUE);
- }
+prog : progstart
/*CONTINUED*/ lineseq
- { newPROG(block_end($1,$2)); }
+ { $$ = $1; newPROG(block_end($1,$2)); }
;
/* An ordinary block */
{ $$ = block_start(TRUE); }
;
+progstart:
+ {
+#if defined(YYDEBUG) && defined(DEBUGGING)
+ yydebug = (DEBUG_p_TEST);
+#endif
+ PL_expect = XSTATE; $$ = block_start(TRUE);
+ }
+ ;
+
+
mblock : '{' mremember lineseq '}'
{ if (PL_copline > (line_t)$1)
PL_copline = $1;
{ $$ = convert($1, 0, $2); }
| FUNC '(' listexprcom ')' /* print (@args) */
{ $$ = convert($1, 0, $3); }
- | LSTOPSUB startanonsub block /* map { foo } ... */
+ | LSTOPSUB startanonsub block /* map { foo } ... */
{ $3 = newANONATTRSUB($2, 0, Nullop, $3); }
listexpr %prec LSTOP /* ... @bar */
{ $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
| '[' ']'
{ $$ = newANONLIST(Nullop); }
| HASHBRACK expr ';' '}' %prec '(' /* { foo => "Bar" } */
- { $$ = newANONHASH($2); }
+ { $$ = newANONHASH($2); }
| HASHBRACK ';' '}' %prec '(' /* { } (';' by tokener) */
{ $$ = newANONHASH(Nullop); }
| ANONSUB startanonsub proto subattrlist block %prec '('
{ $$ = $1; }
| amper /* &foo; */
{ $$ = newUNOP(OP_ENTERSUB, 0, scalar($1)); }
- | amper '(' ')' /* &foo() */
+ | amper '(' ')' /* &foo() */
{ $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar($1)); }
| amper '(' expr ')' /* &foo(@args) */
{ $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,