[parser] Decompose barestmt -> bare_statement_utilize

This commit is contained in:
Branislav Zahradník 2025-10-02 08:59:45 +02:00 committed by Lukas Mai
parent 703db877f5
commit 192a22b2ce
4 changed files with 1551 additions and 1541 deletions

1154
perly.act generated

File diff suppressed because it is too large Load Diff

2
perly.h generated
View File

@ -246,6 +246,6 @@ int yyparse (void);
/* Generated from:
* 2858aac0b89c5ac32677d74b8b02bbecca0487aabe99ff377516012a01fe999d perly.y
* c835d1efb7e84f8f3ac8fafefe5dffc6d342374ee7f07ec8cbec7b7c9bb6bf9d perly.y
* f13e9c08cea6302f0c1d1f467405bd0e0880d0ea92d0669901017a7f7e94ab28 regen_perly.pl
* ex: set ro ft=c: */

1905
perly.tab generated

File diff suppressed because it is too large Load Diff

31
perly.y
View File

@ -115,6 +115,7 @@
%type <opval> bare_statement_try_catch
%type <opval> bare_statement_unless
%type <opval> bare_statement_until
%type <opval> bare_statement_utilize
%type <ival> startsub startanonsub startanonmethod startformsub
@ -717,6 +718,24 @@ bare_statement_until
}
;
bare_statement_utilize
: KW_USE_or_NO
startsub
{ CvSPECIAL_on(PL_compcv); /* It's a BEGIN {} */ }
BAREWORD[version]
BAREWORD[module]
optlistexpr
PERLY_SEMICOLON
/* version and package appear in reverse order for the same reason as
* KW_PACKAGE; see comment above */
{
SvREFCNT_inc_simple_void(PL_compcv);
utilize($KW_USE_or_NO, $startsub, $version, $module, $optlistexpr);
parser->parsed_sub = 1;
$$ = NULL;
}
;
/* Either a signatured 'sub' or 'method' keyword */
sigsub_or_method_named
: KW_SUB_named_sig
@ -850,17 +869,7 @@ barestmt
| bare_statement_try_catch
| bare_statement_unless
| bare_statement_until
| KW_USE_or_NO startsub
{ CvSPECIAL_on(PL_compcv); /* It's a BEGIN {} */ }
BAREWORD[version] BAREWORD[module] optlistexpr PERLY_SEMICOLON
/* version and package appear in reverse order for the same reason as
* KW_PACKAGE; see comment above */
{
SvREFCNT_inc_simple_void(PL_compcv);
utilize($KW_USE_or_NO, $startsub, $version, $module, $optlistexpr);
parser->parsed_sub = 1;
$$ = NULL;
}
| bare_statement_utilize
| KW_WHEN PERLY_PAREN_OPEN remember mexpr PERLY_PAREN_CLOSE mblock
{ $$ = block_end($remember, newWHENOP($mexpr, op_scope($mblock))); }
| KW_WHILE PERLY_PAREN_OPEN remember texpr PERLY_PAREN_CLOSE mintro mblock cont