text stringlengths 0 234 |
|---|
Base_Init : constant Ada_Pretty.Node_Access := |
F.New_Subprogram_Body |
(Specification => F.New_Subprogram_Specification |
(Name => F.New_Name (+"Initialize"), |
Parameters => F.New_Parameter |
(Name => F.New_Name (+"Self"), |
Type_Definition => F.New_Name |
("Base_" & Item.Name & "'Class"), |
Is_Aliased => True, |
Is_In => True, |
Is_Out => True)), |
Statements => F.New_List |
(Prop_Set_Enclosings (Only_Objects (Item.Properties)), |
F.New_Statement)); |
function Base_Getters is new Generic_List_Reduce |
(Classes.Property, Classes.Property_Array, Base_Getter, F); |
BG : constant Ada_Pretty.Node_Access := Base_Getters |
(Only_Objects (Item.Properties) & Only_Booleans (Parent_Props)); |
function Node_Getters is new Generic_List_Reduce |
(Classes.Property, Classes.Property_Array, Node_Getter, F); |
NG : constant Ada_Pretty.Node_Access := Node_Getters |
(Only_Tokens (Item.Properties) |
& Only_Booleans (Item.Properties) |
& Only_Texts (Item.Properties & Parent_Props)); |
function Impl_Getters is new Generic_List_Reduce |
(Classes.Property, Classes.Property_Array, Impl_Getter, F); |
IG : constant Ada_Pretty.Node_Access := Impl_Getters |
(Bool_Props & Only_Texts (Item.Properties & Parent_Props)); |
Visit : constant Ada_Pretty.Node_Access := |
F.New_Subprogram_Body |
(Visit_Spec (F, Base_Name, False), |
Statements => F.New_Statement |
(F.New_Apply |
(F.New_Selected_Name (F.New_Name (+"Visitor"), Node_Name), |
F.New_Name (+"Self")))); |
Node_To_Text : constant Ada_Pretty.Node_Access := |
F.New_Subprogram_Body |
(Specification => To_Text_Spec (F, Item, Node_Name), |
Statements => F.New_Return |
(F.New_Name (+"Self'Unchecked_Access"))); |
Implicit_To_Text : constant Ada_Pretty.Node_Access := |
F.New_Subprogram_Body |
(Specification => To_Text_Spec (F, Item, Implicit_Name), |
Declarations => Unreferenced, |
Statements => F.New_Return |
(F.New_Name (+"null"))); |
List : constant Ada_Pretty.Node_Access_Array := |
(Create_Node, Create_Implicit, |
F.New_List (BG, |
F.New_List (NG, |
F.New_List (IG, Base_Init))), |
Prop_Checks (All_Parents (Item, Vector)), |
Visit, |
Node_To_Text, |
Implicit_To_Text); |
Root : constant Ada_Pretty.Node_Access := |
F.New_Package_Body |
(F.New_Selected_Name (Package_Name), F.New_List (List)); |
Unit : constant Ada_Pretty.Node_Access := |
F.New_Compilation_Unit (Root); |
Output : Ada.Wide_Wide_Text_IO.File_Type; |
begin |
Open_File (Output, Package_Name, "nodes/", Spec => False); |
Ada.Wide_Wide_Text_IO.Put_Line |
(Output, |
F.To_Text (Unit).Join (Ada.Characters.Wide_Wide_Latin_1.LF) |
.To_Wide_Wide_String); |
Ada.Wide_Wide_Text_IO.Close (Output); |
end Write_One_Node_Body; |
-------------------- |
-- Write_Visitors -- |
-------------------- |
procedure Write_Visitors (Vector : Meta.Read.Class_Vectors.Vector) is |
function Methods return Ada_Pretty.Node_Access; |
Package_Name : constant League.Strings.Universal_String := |
Get_Package_Name (Element_Visitor); |
F : aliased Ada_Pretty.Factory; |
Pure : constant Ada_Pretty.Node_Access := |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.