Commit 543888f2 authored by jhugues's avatar jhugues

* Allow annex subclause at package level, per AADL syntax

	rules	



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@5020 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 031190df
...@@ -68,14 +68,15 @@ package body Ocarina.Builder.AADL.Annexes is ...@@ -68,14 +68,15 @@ package body Ocarina.Builder.AADL.Annexes is
pragma Assert (Annex_Name /= No_Node pragma Assert (Annex_Name /= No_Node
and then Kind (Annex_Name) = K_Identifier); and then Kind (Annex_Name) = K_Identifier);
pragma Assert (Namespace /= No_Node); pragma Assert (Namespace /= No_Node);
pragma Assert ((Annex_Kind = K_Annex_Subclause pragma Assert
and then (Kind (Namespace) = K_Component_Implementation ((Annex_Kind = K_Annex_Subclause
or else Kind (Namespace) = K_Component_Type and then (Kind (Namespace) = K_Component_Implementation
or else Kind (Namespace) = or else Kind (Namespace) = K_Package_Specification
K_Feature_Group_Type)) or else Kind (Namespace) = K_Component_Type
or else (Annex_Kind = K_Annex_Library or else Kind (Namespace) = K_Feature_Group_Type))
or else (Annex_Kind = K_Annex_Library
and then (Kind (Namespace) = K_Package_Specification and then (Kind (Namespace) = K_Package_Specification
or else Kind (Namespace) = K_AADL_Specification))); or else Kind (Namespace) = K_AADL_Specification)));
Node : constant Node_Id := New_Node (Annex_Kind, Loc); Node : constant Node_Id := New_Node (Annex_Kind, Loc);
Success : Boolean := True; Success : Boolean := True;
...@@ -83,18 +84,17 @@ package body Ocarina.Builder.AADL.Annexes is ...@@ -83,18 +84,17 @@ package body Ocarina.Builder.AADL.Annexes is
Set_Identifier (Node, Annex_Name); Set_Identifier (Node, Annex_Name);
Set_Corresponding_Entity (Annex_Name, Node); Set_Corresponding_Entity (Annex_Name, Node);
Set_Annex_Content (Node, No_Node); Set_Annex_Content (Node, No_Node);
Set_In_Modes (Node, In_Modes);
if Kind (Namespace) = K_AADL_Specification if Kind (Namespace) = K_AADL_Specification then
or else Kind (Namespace) = K_Package_Specification
then
Set_Container_Package (Node, Namespace); Set_Container_Package (Node, Namespace);
Success := Add_Declaration (Namespace, Node); Success := Add_Declaration (Namespace, Node);
elsif Kind (Namespace) = K_Component_Type elsif Kind (Namespace) = K_Component_Type
or else Kind (Namespace) = K_Package_Specification
or else Kind (Namespace) = K_Component_Implementation or else Kind (Namespace) = K_Component_Implementation
or else Kind (Namespace) = K_Feature_Group_Type or else Kind (Namespace) = K_Feature_Group_Type
then then
Set_In_Modes (Node, In_Modes);
Set_Container_Component (Node, Namespace); Set_Container_Component (Node, Namespace);
Success := Add_Annex (Namespace, Node); Success := Add_Annex (Namespace, Node);
end if; end if;
......
...@@ -51,6 +51,7 @@ package body Ocarina.Builder.AADL.Components is ...@@ -51,6 +51,7 @@ package body Ocarina.Builder.AADL.Components is
use Ocarina.ME_AADL.AADL_Tree.Nutils; use Ocarina.ME_AADL.AADL_Tree.Nutils;
pragma Assert (Kind (Component) = K_Component_Implementation pragma Assert (Kind (Component) = K_Component_Implementation
or else Kind (Component) = K_Package_Specification
or else Kind (Component) = K_Component_Type or else Kind (Component) = K_Component_Type
or else Kind (Component) = K_Feature_Group_Type); or else Kind (Component) = K_Feature_Group_Type);
pragma Assert (Present (Annex)); pragma Assert (Present (Annex));
......
...@@ -202,6 +202,8 @@ module Ocarina::ME_AADL::AADL_Tree::Nodes { ...@@ -202,6 +202,8 @@ module Ocarina::ME_AADL::AADL_Tree::Nodes {
Node_Id Package_Name; Node_Id Package_Name;
Node_Id Parent; Node_Id Parent;
List_Id Annexes;
}; };
// AADL_V2 // AADL_V2
......
...@@ -391,8 +391,7 @@ package body Ocarina.FE_AADL.Parser.Namespaces is ...@@ -391,8 +391,7 @@ package body Ocarina.FE_AADL.Parser.Namespaces is
end if; end if;
when T_Annex => when T_Annex =>
Declaration := P_Annex_Library Declaration := P_Annex_Subclause (Package_Spec);
(Package_Spec, Private_Declaration => Private_Declarations);
when others => when others =>
Restore_Lexer (Loc); Restore_Lexer (Loc);
...@@ -400,7 +399,9 @@ package body Ocarina.FE_AADL.Parser.Namespaces is ...@@ -400,7 +399,9 @@ package body Ocarina.FE_AADL.Parser.Namespaces is
end case; end case;
if Present (Declaration) then if Present (Declaration) then
Set_Is_Private (Declaration, Private_Declarations); if Kind (Declaration) /= K_Annex_Subclause then
Set_Is_Private (Declaration, Private_Declarations);
end if;
Nb_Items := Nb_Items + 1; Nb_Items := Nb_Items + 1;
else else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment