diff options
Diffstat (limited to 'src/packrat.ads')
-rw-r--r-- | src/packrat.ads | 341 |
1 files changed, 0 insertions, 341 deletions
diff --git a/src/packrat.ads b/src/packrat.ads index d1fc9a0..4abdaec 100644 --- a/src/packrat.ads +++ b/src/packrat.ads @@ -184,347 +184,6 @@ package Packrat is - generic - type Label_Enum is (<>); - type Element is private; - type Element_Array is array (Positive range <>) of Element; - package Interfaces is - - - type Node is interface; - - - function Leaf - (New_Item : in Element_Array; - Start : in Positive; - Finish : in Natural) - return Node is abstract - with Pre'Class => - Finish + 1 >= Start, - Post'Class => - Is_Leaf (Leaf'Result); - - function Branch - (Label : in Label_Enum; - Start : in Positive; - Finish : in Natural) - return Node is abstract - with Pre'Class => - Finish + 1 >= Start, - Post'Class => - Is_Branch (Branch'Result); - - - function Is_Leaf - (This : in Node) - return Boolean is abstract; - - function Is_Branch - (This : in Node) - return Boolean is abstract; - - - function Label - (This : in Node) - return Label_Enum is abstract - with Pre'Class => - This.Is_Branch; - - function Elements - (This : in Node) - return Element_Array is abstract - with Pre'Class => - This.Is_Leaf; - - function Start - (This : in Node) - return Positive is abstract; - - function Finish - (This : in Node) - return Natural is abstract; - - - - - type Cursor is interface; - - - function Is_Nothing - (Position : in Cursor) - return Boolean is abstract; - - - function Depth - (Position : in Cursor) - return Natural is abstract - with Pre'Class => - not Position.Is_Nothing; - - function Is_Node - (Position : in Cursor) - return Boolean is abstract - with Post'Class => - (if Is_Node'Result then not Position.Is_Nothing); - - function Is_Root - (Position : in Cursor) - return Boolean is abstract - with Post'Class => - (if Is_Root'Result then - not Position.Is_Nothing and - Position.Parent.Is_Nothing and - Position.Depth = 0); - - function Is_Branch - (Position : in Cursor) - return Boolean is abstract - with Post'Class => - (if Is_Branch'Result then not Position.Is_Nothing); - - function Is_Leaf - (Position : in Cursor) - return Boolean is abstract - with Post'Class => - (if Is_Leaf'Result then not Position.Is_Nothing); - - - function Label - (Position : in Cursor) - return Label_Enum is abstract - with Pre'Class => - Position.Is_Branch; - - function Elements - (Position : in Cursor) - return Element_Array is abstract - with Pre'Class => - Position.Is_Leaf; - - function Start - (Position : in Cursor) - return Positive is abstract - with Pre'Class => - not Position.Is_Nothing; - - function Finish - (Position : in Cursor) - return Natural is abstract - with Pre'Class => - not Position.Is_Nothing; - - function Choices - (Position : in Cursor) - return Natural is abstract; - - - function Parent - (Position : in Cursor) - return Cursor is abstract; - - function Child_Count - (Position : in Cursor; - Choice : in Positive) - return Natural is abstract - with Pre'Class => - Choice <= Position.Choices; - - function Child_Count - (Position : in Cursor) - return Natural is abstract; - - function All_Child_Count - (Position : in Cursor) - return Natural is abstract; - - function First_Child - (Position : in Cursor; - Choice : in Positive) - return Cursor is abstract - with Pre'Class => - Choice <= Position.Choices, - Post'Class => - First_Child'Result.Is_Nothing or - First_Child'Result.Parent = Position; - - function Last_Child - (Position : in Cursor; - Choice : in Positive) - return Cursor is abstract - with Pre'Class => - Choice <= Position.Choices, - Post'Class => - Last_Child'Result.Is_Nothing or - Last_Child'Result.Parent = Position; - - function First_Child - (Position : in Cursor) - return Cursor is abstract - with Post'Class => - First_Child'Result.Is_Nothing or - First_Child'Result.Parent = Position; - - function Last_Child - (Position : in Cursor) - return Cursor is abstract - with Post'Class => - Last_Child'Result.Is_Nothing or - Last_Child'Result.Parent = Position; - - function Next_Sibling - (Position : in Cursor) - return Cursor is abstract - with Post'Class => - Next_Sibling'Result.Is_Nothing or - Next_Sibling'Result.Parent = Position.Parent; - - function Prev_Sibling - (Position : in Cursor) - return Cursor is abstract - with Post'Class => - Prev_Sibling'Result.Is_Nothing or - Prev_Sibling'Result.Parent = Position.Parent; - - procedure Delete_Children - (Position : in out Cursor; - Choice : in Positive) is abstract - with Pre'Class => - Choice <= Position.Choices, - Post'Class => - Position.Child_Count (Choice) = 0; - - procedure Delete_Children - (Position : in out Cursor) is abstract - with Post'Class => - Position.Child_Count = 0; - - procedure Delete_All_Children - (Position : in out Cursor) is abstract - with Post'Class => - Position.All_Child_Count = 0; - - - function Equal_Subgraph - (Left, Right : in Cursor) - return Boolean is abstract; - - function Subgraph_Node_Count - (Position : in Cursor) - return Natural is abstract; - - function Find_In_Subgraph - (Position : in Cursor; - Item : in Element_Array) - return Cursor is abstract - with Post'Class => - Find_In_Subgraph'Result.Is_Nothing or - Find_In_Subgraph'Result.Is_Leaf; - - - - - type Graph is interface; - - - function Contains - (Container : in Graph; - Position : in Cursor'Class) - return Boolean is abstract - with Post'Class => - (if Contains'Result then not Position.Is_Nothing); - - - function Singleton - (Input : in Node'Class) - return Graph is abstract - with Post'Class => - Singleton'Result.Node_Count = 1; - - - function Is_Empty - (Container : in Graph) - return Boolean is abstract - with Post'Class => - (if Is_Empty'Result then Container.Node_Count = 0 else Container.Node_Count /= 0); - - function Is_Ambiguous - (Container : in Graph) - return Boolean is abstract; - - function Node_Count - (Container : in Graph) - return Natural is abstract; - - - function Root_Count - (Container : in Graph) - return Natural is abstract - with Post'Class => - (if Container.Is_Empty then Root_Count'Result = 0 else Root_Count'Result > 0); - - function Root - (Container : in Graph; - Index : in Positive) - return Cursor'Class is abstract - with Pre'Class => - Index <= Container.Root_Count; - - - procedure Append - (Container : in out Graph; - Addition : in Graph) is abstract - with Pre'Class => - Container.Is_Empty or else Addition.Is_Empty or else - Container.Root (Container.Root_Count).Finish < - Addition.Root (1).Start; - - procedure Prepend - (Container : in out Graph; - Addition : in Graph) is abstract - with Pre'Class => - Container.Is_Empty or else Addition.Is_Empty or else - Container.Root (1).Start > - Addition.Root (Addition.Root_Count).Finish; - - procedure Attach_Choice - (Container : in out Graph; - Position : in Cursor'Class; - Addition : in Graph) is abstract - with Pre'Class => - Container.Contains (Position) and Position.Is_Branch and - (Addition.Is_Empty or else - (Position.Start <= Addition.Root (1).Start and - Position.Finish >= Addition.Root (Addition.Root_Count).Finish)); - - - procedure Clear - (Container : in out Graph) is abstract - with Post'Class => - Container.Is_Empty; - - procedure Delete_Position - (Container : in out Graph; - Position : in out Cursor'Class) is abstract - with Pre'Class => - Container.Contains (Position), - Post'Class => - not Container.Contains (Position); - - - function Find - (Container : in Graph; - Item : in Element_Array) - return Cursor'Class is abstract - with Post'Class => - Find'Result.Is_Leaf or - Find'Result.Is_Nothing; - - - end Interfaces; - - - - private |