summaryrefslogtreecommitdiff
path: root/src/packrat.ads
diff options
context:
space:
mode:
Diffstat (limited to 'src/packrat.ads')
-rw-r--r--src/packrat.ads42
1 files changed, 14 insertions, 28 deletions
diff --git a/src/packrat.ads b/src/packrat.ads
index 4abdaec..b2b0144 100644
--- a/src/packrat.ads
+++ b/src/packrat.ads
@@ -2,8 +2,11 @@
with
- Ada.Strings.Unbounded,
- Ada.Finalization;
+ Ada.Strings.Unbounded;
+
+private with
+
+ Ada.Containers.Indefinite_Holders;
package Packrat is
@@ -106,10 +109,13 @@ package Packrat is
package Tokens is
- type Token is new Ada.Finalization.Controlled with private;
+ type Token is private;
type Token_Array is array (Positive range <>) of Token;
+ -- will probably have to remove the Finish field to accommodate graphs properly
+
+
function Create
(Ident : in Label_Enum;
Start : in Positive;
@@ -117,20 +123,12 @@ package Packrat is
Value : in Element_Array)
return Token;
- function "="
- (Left, Right : in Token)
- return Boolean;
-
-- Note: The Start and Finish indices indicate where the token was found
-- in whatever array it was lexed from. The Value does *not* have
-- to correspond with whatever is found in the Start .. Finish range.
- function Initialized
- (This : in Token)
- return Boolean;
-
function Debug_String
(This : in Token)
return String;
@@ -138,8 +136,7 @@ package Packrat is
function Label
(This : in Token)
- return Label_Enum
- with Pre => Initialized (This);
+ return Label_Enum;
function Start
(This : in Token)
@@ -151,34 +148,23 @@ package Packrat is
function Value
(This : in Token)
- return Element_Array
- with Pre => Initialized (This);
+ return Element_Array;
private
- type Element_Array_Access is access Element_Array;
+ package Value_Holders is new Ada.Containers.Indefinite_Holders (Element_Array);
- type Token is new Ada.Finalization.Controlled with record
+ type Token is record
Identifier : Label_Enum;
Start_At : Positive;
Finish_At : Natural;
- Token_Value : Element_Array_Access;
+ Token_Value : Value_Holders.Holder;
end record;
- overriding procedure Initialize
- (This : in out Token);
-
- overriding procedure Adjust
- (This : in out Token);
-
- overriding procedure Finalize
- (This : in out Token);
-
-
end Tokens;