This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add standard core test header to Test::Builder::Tester tests.
[perl5.git] / perly.y
diff --git a/perly.y b/perly.y
index 37503ba..1d20b04 100644 (file)
--- a/perly.y
+++ b/perly.y
@@ -45,7 +45,7 @@
 %token <ival> FUNC0 FUNC1 FUNC UNIOP LSTOP
 %token <ival> RELOP EQOP MULOP ADDOP
 %token <ival> DOLSHARP DO HASHBRACK NOAMP
-%token <ival> LOCAL MY MYSUB
+%token <ival> LOCAL MY MYSUB REQUIRE
 %token COLONATTR
 
 %type <ival> prog decl format startsub startanonsub startformsub mintro
@@ -566,7 +566,7 @@ anonymous:  '[' expr ']'
 
 /* Things called with "do" */
 termdo :       DO term %prec UNIOP                     /* do $filename */
-                       { $$ = dofile($2); }
+                       { $$ = dofile($2, $1); }
        |       DO block        %prec '('               /* do { code */
                        { $$ = newUNOP(OP_NULL, OPf_SPECIAL, scope($2)); }
        |       DO WORD '(' ')'                         /* do somesub() */
@@ -664,6 +664,10 @@ term       :       termbinop
                        { $$ = newUNOP($1, 0, $2); }
        |       UNIOP term                           /* Unary op */
                        { $$ = newUNOP($1, 0, $2); }
+       |       REQUIRE                              /* require, $_ implied */
+                       { $$ = newOP(OP_REQUIRE, $1 ? OPf_SPECIAL : 0); }
+       |       REQUIRE term                         /* require Foo */
+                       { $$ = newUNOP(OP_REQUIRE, $1 ? OPf_SPECIAL : 0, $2); }
        |       UNIOPSUB term                        /* Sub treated as unop */
                        { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
                            append_elem(OP_LIST, $2, scalar($1))); }