/* perly.y
*
- * Copyright (c) 1991-1997, Larry Wall
+ * Copyright (c) 1991-2001, 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.
#include "EXTERN.h"
#define PERL_IN_PERLY_C
#include "perl.h"
-
+#ifdef EBCDIC
+#undef YYDEBUG
+#endif
#define dep() deprecate("\"do\" to call subroutines")
/* stuff included here to make perly_c.diff apply better */
#ifdef USE_PURE_BISON
#define YYLEX_PARAM (&yychar)
+#define yylex yylex_r
#endif
%}
prog : /* NULL */
{
#if defined(YYDEBUG) && defined(DEBUGGING)
- yydebug = (PL_debug & 1);
+ yydebug = (DEBUG_p_TEST);
#endif
PL_expect = XSTATE;
}
else : /* NULL */
{ $$ = Nullop; }
| ELSE mblock
- { $$ = scope($2); }
+ { ($2)->op_flags |= OPf_PARENS; $$ = scope($2); }
| ELSIF '(' mexpr ')' mblock else
{ PL_copline = $1;
$$ = newCONDOP(0, $3, scope($5), $6);
newFOROP(0, $1, $2, Nullop, $5, $7, $8)); }
| label FOR '(' remember mnexpr ';' mtexpr ';' mnexpr ')' mblock
/* basically fake up an initialize-while lineseq */
- { OP *forop = append_elem(OP_LINESEQ,
- scalar($5),
- newWHILEOP(0, 1, (LOOP*)Nullop,
- $2, scalar($7),
- $11, scalar($9)));
+ { OP *forop;
PL_copline = $2;
- $$ = block_end($4, newSTATEOP(0, $1, forop)); }
+ forop = newSTATEOP(0, $1,
+ newWHILEOP(0, 1, (LOOP*)Nullop,
+ $2, scalar($7),
+ $11, $9));
+ if ($5) {
+ forop = append_elem(OP_LINESEQ,
+ newSTATEOP(0, ($1?savepv($1):Nullch),
+ $5),
+ forop);
+ }
+
+ $$ = block_end($4, forop); }
| label block cont /* a block is a loop that happens once */
{ $$ = newSTATEOP(0, $1,
newWHILEOP(0, 1, (LOOP*)Nullop,
;
texpr : /* NULL means true */
- { (void)scan_num("1"); $$ = yylval.opval; }
+ { (void)scan_num("1", &yylval); $$ = yylval.opval; }
| expr
;
subname : WORD { STRLEN n_a; char *name = SvPV(((SVOP*)$1)->op_sv,n_a);
if (strEQ(name, "BEGIN") || strEQ(name, "END")
- || strEQ(name, "INIT"))
+ || strEQ(name, "INIT") || strEQ(name, "CHECK"))
CvSPECIAL_on(PL_compcv);
$$ = $1; }
;