Add better error recovery for failed task/function definition.

This patch does a better job of recovering from an error in a
task or function definition. This prevents the compiler from
printing many irrelevant error messages.
This commit is contained in:
Cary R 2008-04-25 14:26:17 -07:00 committed by Stephen Williams
parent efba4bfd09
commit 603ca0f2de
1 changed files with 12 additions and 0 deletions

12
parse.y
View File

@ -1834,6 +1834,12 @@ module_item
current_task = 0;
delete[]$2;
}
| K_task IDENTIFIER error K_endtask
{
pform_pop_scope();
current_task = 0;
delete[]$2;
}
/* The function declaration rule matches the function declaration
header, then pushes the function scope. This causes the
@ -1871,6 +1877,12 @@ module_item
current_function = 0;
delete[]$3;
}
| K_function function_range_or_type_opt IDENTIFIER error K_endfunction
{
pform_pop_scope();
current_task = 0;
delete[]$3;
}
/* A generate region can contain further module items. Actually, it
is supposed to be limited to certain kinds of module items, but