diff options
Diffstat (limited to 'gcc/ada/par-ch9.adb')
-rw-r--r-- | gcc/ada/par-ch9.adb | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/gcc/ada/par-ch9.adb b/gcc/ada/par-ch9.adb index 5b1d6c7..8914a2f 100644 --- a/gcc/ada/par-ch9.adb +++ b/gcc/ada/par-ch9.adb @@ -40,23 +40,33 @@ package body Ch9 is function P_Entry_Body_Formal_Part return Node_Id; function P_Entry_Declaration return Node_Id; function P_Entry_Index_Specification return Node_Id; - function P_Protected_Definition return Node_Id; function P_Protected_Operation_Declaration_Opt return Node_Id; function P_Protected_Operation_Items return List_Id; - function P_Task_Definition return Node_Id; function P_Task_Items return List_Id; + function P_Protected_Definition (Decl : Node_Id) return Node_Id; + -- Parses protected definition and following aspect specifications if + -- present. The argument is the declaration node to which the aspect + -- specifications are to be attached. + + function P_Task_Definition (Decl : Node_Id) return Node_Id; + -- Parses task definition and following aspect specifications if present. + -- The argument is the declaration node to which the aspect specifications + -- are to be attached. + ----------------------------- -- 9.1 Task (also 10.1.3) -- ----------------------------- -- TASK_TYPE_DECLARATION ::= -- task type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] - -- [is [new INTERFACE_LIST with] TASK_DEFINITION]; + -- [is [new INTERFACE_LIST with] TASK_DEFINITION] + -- [ASPECT_SPECIFICATIONS]; -- SINGLE_TASK_DECLARATION ::= -- task DEFINING_IDENTIFIER - -- [is [new INTERFACE_LIST with] TASK_DEFINITION]; + -- [is [new INTERFACE_LIST with] TASK_DEFINITION] + -- [ASPECT_SPECIFICATIONS]; -- TASK_BODY ::= -- task body DEFINING_IDENTIFIER is @@ -143,10 +153,17 @@ package body Ch9 is end if; end if; + -- If we have aspect definitions present here, then we do not have + -- a task definition present. + + if Aspect_Specifications_Present then + P_Aspect_Specifications (Task_Node); + -- Parse optional task definition. Note that P_Task_Definition scans - -- out the semicolon as well as the task definition itself. + -- out the semicolon and possible aspect specifications as well as + -- the task definition itself. - if Token = Tok_Semicolon then + elsif Token = Tok_Semicolon then -- A little check, if the next token after semicolon is -- Entry, then surely the semicolon should really be IS @@ -156,10 +173,13 @@ package body Ch9 is if Token = Tok_Entry then Error_Msg_SP -- CODEFIX ("|"";"" should be IS"); - Set_Task_Definition (Task_Node, P_Task_Definition); + Set_Task_Definition (Task_Node, P_Task_Definition (Task_Node)); else Pop_Scope_Stack; -- Remove unused entry end if; + + -- Here we have a task definition + else TF_Is; -- must have IS if no semicolon @@ -194,7 +214,7 @@ package body Ch9 is end if; end if; - Set_Task_Definition (Task_Node, P_Task_Definition); + Set_Task_Definition (Task_Node, P_Task_Definition (Task_Node)); end if; return Task_Node; @@ -233,7 +253,7 @@ package body Ch9 is -- Error recovery: cannot raise Error_Resync - function P_Task_Definition return Node_Id is + function P_Task_Definition (Decl : Node_Id) return Node_Id is Def_Node : Node_Id; begin @@ -253,7 +273,7 @@ package body Ch9 is end loop; end if; - End_Statements (Def_Node); + End_Statements (Def_Node, Decl); return Def_Node; end P_Task_Definition; @@ -347,11 +367,13 @@ package body Ch9 is -- PROTECTED_TYPE_DECLARATION ::= -- protected type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] - -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION; + -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION + -- [ASPECT_SPECIFICATIONS]; -- SINGLE_PROTECTED_DECLARATION ::= -- protected DEFINING_IDENTIFIER -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION; + -- [ASPECT_SPECIFICATIONS]; -- PROTECTED_BODY ::= -- protected body DEFINING_IDENTIFIER is @@ -464,8 +486,8 @@ package body Ch9 is End_Label => Empty)); SIS_Entry_Active := False; - End_Statements (Protected_Definition (Protected_Node)); - Scan; -- past semicolon + End_Statements + (Protected_Definition (Protected_Node), Protected_Node); return Protected_Node; end if; @@ -503,7 +525,8 @@ package body Ch9 is Scan; -- past WITH end if; - Set_Protected_Definition (Protected_Node, P_Protected_Definition); + Set_Protected_Definition + (Protected_Node, P_Protected_Definition (Protected_Node)); return Protected_Node; end if; end P_Protected; @@ -538,7 +561,7 @@ package body Ch9 is -- Error recovery: cannot raise Error_Resync - function P_Protected_Definition return Node_Id is + function P_Protected_Definition (Decl : Node_Id) return Node_Id is Def_Node : Node_Id; Item_Node : Node_Id; @@ -584,7 +607,7 @@ package body Ch9 is end loop Declaration_Loop; end loop Private_Loop; - End_Statements (Def_Node); + End_Statements (Def_Node, Decl); return Def_Node; end P_Protected_Definition; |