text
stringlengths
0
234
begin
Put (Indent);
Put ("- ");
if Value.Kind in Composite_Node_Kind then
End_Line;
Down;
Dump_Rec (Value);
Up;
else
Dump_Rec (Value);
End_Line;
end if;
Function Definition: procedure Down is
Function Body: begin
Indent_Level := Indent_Level + Indent_Step;
Indent := Indent_String (Indent_Level);
-- Put ("#down (" & Indent_Level'Img & ")#");
end Down;
--------
-- Up --
--------
procedure Up is
begin
Indent_Level := Indent_Level - Indent_Step;
Indent := Indent_String (Indent_Level);
-- Put ("#up (" & Indent_Level'Img & ")#");
end Up;
--------------
-- End_Line --
--------------
procedure End_Line is
begin
if Indent_Step /= 0 then
Put ("" & ASCII.LF);
end if;
end End_Line;
--------------
-- Dump_Rec --
--------------
procedure Dump_Rec (N : Node) is
begin
case N.Kind is
when Map =>
for Ent of N.Iterate_On_Table loop
declare
Name : constant Unbounded_UTF8_String :=
Element_Name (Ent.Key);
begin
Put (Indent);
Put ("<");
Put (Name);
Put (">");
if Ent.Value.Kind in Composite_Node_Kind then
End_Line;
Down;
Dump_Rec (Ent.Value);
Up;
Put (Indent);
else
Dump_Rec (Ent.Value);
end if;
Put ("</");
Put (Name);
Put (">");
End_Line;
Function Definition: procedure Sort_Keys is new Ada.Containers.Generic_Array_Sort
Function Body: (Index_Type => Positive,
Element_Type => Unbounded_UTF8_String,
Array_Type => Key_Array);
package TOML_Maps is new Ada.Containers.Hashed_Maps
(Key_Type => Unbounded_String,
Element_Type => Node,
Hash => Hash,
Equivalent_Keys => "=");
package TOML_Vectors is new Ada.Containers.Vectors (Positive, Node);
type Node_Record (Kind : Any_Node_Kind) is limited record
Ref_Count : Natural;
case Kind is
when Map =>
Map_Value : TOML_Maps.Map;
when Vector =>
Array_Value : TOML_Vectors.Vector;
-- List of values for all items
Array_Implicitly_Created : Boolean;