Internals: Simplify parsing of 'fork' blocks

This commit is contained in:
Geza Lore 2025-10-22 08:48:28 +01:00
parent e00403351c
commit d65ba037a8
2 changed files with 11 additions and 20 deletions

View File

@ -128,6 +128,7 @@ struct V3ParseBisonYYSType final {
VFwdType::en fwdtype; VFwdType::en fwdtype;
VLifetime::en lifetime; VLifetime::en lifetime;
VStrength::en strength; VStrength::en strength;
VJoinType::en joinType;
#include "V3Ast__gen_yystype.h" #include "V3Ast__gen_yystype.h"
}; };

View File

@ -3373,32 +3373,22 @@ seq_blockPreId<nodep>: // IEEE: seq_block, but called with leading ID
GRAMMARP->endLabel($<fl>4, $1, $4); } GRAMMARP->endLabel($<fl>4, $1, $4); }
; ;
par_blockJoin<joinType>:
yJOIN { $$ = VJoinType::JOIN; }
| yJOIN_ANY { $$ = VJoinType::JOIN_ANY; }
| yJOIN_NONE { $$ = VJoinType::JOIN_NONE; }
;
par_block<nodep>: // ==IEEE: par_block par_block<nodep>: // ==IEEE: par_block
par_blockFront blockDeclStmtListE yJOIN endLabelE par_blockFront blockDeclStmtListE par_blockJoin endLabelE
{ $$ = $1; $1->joinType(VJoinType::JOIN); { $$ = $1; $1->joinType($3);
V3ParseGrammar::addForkStmtsp($1, $2);
GRAMMARP->endLabel($<fl>4, $1, $4); }
| par_blockFront blockDeclStmtListE yJOIN_ANY endLabelE
{ $$ = $1; $1->joinType(VJoinType::JOIN_ANY);
V3ParseGrammar::addForkStmtsp($1, $2);
GRAMMARP->endLabel($<fl>4, $1, $4); }
| par_blockFront blockDeclStmtListE yJOIN_NONE endLabelE
{ $$ = $1; $1->joinType(VJoinType::JOIN_NONE);
V3ParseGrammar::addForkStmtsp($1, $2); V3ParseGrammar::addForkStmtsp($1, $2);
GRAMMARP->endLabel($<fl>4, $1, $4); } GRAMMARP->endLabel($<fl>4, $1, $4); }
; ;
par_blockPreId<nodep>: // ==IEEE: par_block but called with leading ID par_blockPreId<nodep>: // ==IEEE: par_block but called with leading ID
par_blockFrontPreId blockDeclStmtListE yJOIN endLabelE par_blockFrontPreId blockDeclStmtListE par_blockJoin endLabelE
{ $$ = $1; $1->joinType(VJoinType::JOIN); { $$ = $1; $1->joinType($3);
V3ParseGrammar::addForkStmtsp($1, $2);
GRAMMARP->endLabel($<fl>4, $1, $4); }
| par_blockFrontPreId blockDeclStmtListE yJOIN_ANY endLabelE
{ $$ = $1; $1->joinType(VJoinType::JOIN_ANY);
V3ParseGrammar::addForkStmtsp($1, $2);
GRAMMARP->endLabel($<fl>4, $1, $4); }
| par_blockFrontPreId blockDeclStmtListE yJOIN_NONE endLabelE
{ $$ = $1; $1->joinType(VJoinType::JOIN_NONE);
V3ParseGrammar::addForkStmtsp($1, $2); V3ParseGrammar::addForkStmtsp($1, $2);
GRAMMARP->endLabel($<fl>4, $1, $4); } GRAMMARP->endLabel($<fl>4, $1, $4); }
; ;