Add support for closing a procedural begin/fork block with a name

This commit is contained in:
Cary R 2013-05-08 18:32:05 -07:00
parent 1b1aa06dee
commit 7c1638652a
1 changed files with 12 additions and 4 deletions

16
parse.y
View File

@ -5435,14 +5435,18 @@ statement_item /* This is roughly statement_item in the LRM */
current_block_stack.push(tmp); current_block_stack.push(tmp);
} }
block_item_decls_opt block_item_decls_opt
statement_or_null_list_opt K_end statement_or_null_list_opt K_end endname_opt
{ pform_pop_scope(); { pform_pop_scope();
assert(! current_block_stack.empty()); assert(! current_block_stack.empty());
PBlock*tmp = current_block_stack.top(); PBlock*tmp = current_block_stack.top();
current_block_stack.pop(); current_block_stack.pop();
if ($6) tmp->set_statement(*$6); if ($6) tmp->set_statement(*$6);
delete[]$3;
delete $6; delete $6;
if ($8 && (strcmp($3,$8) != 0)) {
yyerror(@8, "error: End name doesn't match begin name");
}
if ($8) delete[]$8;
delete[]$3;
$$ = tmp; $$ = tmp;
} }
@ -5469,15 +5473,19 @@ statement_item /* This is roughly statement_item in the LRM */
current_block_stack.push(tmp); current_block_stack.push(tmp);
} }
block_item_decls_opt block_item_decls_opt
statement_or_null_list_opt join_keyword statement_or_null_list_opt join_keyword endname_opt
{ pform_pop_scope(); { pform_pop_scope();
assert(! current_block_stack.empty()); assert(! current_block_stack.empty());
PBlock*tmp = current_block_stack.top(); PBlock*tmp = current_block_stack.top();
current_block_stack.pop(); current_block_stack.pop();
tmp->set_join_type($7); tmp->set_join_type($7);
if ($6) tmp->set_statement(*$6); if ($6) tmp->set_statement(*$6);
delete[]$3;
delete $6; delete $6;
if ($8 && (strcmp($3,$8) != 0)) {
yyerror(@8, "error: End name doesn't match fork name");
}
if ($8) delete[]$8;
delete[]$3;
$$ = tmp; $$ = tmp;
} }