summaryrefslogtreecommitdiff
path: root/src/packrat-lexer.ads
diff options
context:
space:
mode:
Diffstat (limited to 'src/packrat-lexer.ads')
-rw-r--r--src/packrat-lexer.ads54
1 files changed, 49 insertions, 5 deletions
diff --git a/src/packrat-lexer.ads b/src/packrat-lexer.ads
index 611a407..81c9d2a 100644
--- a/src/packrat-lexer.ads
+++ b/src/packrat-lexer.ads
@@ -11,20 +11,64 @@ generic
package Packrat.Lexer is
+ type Combinator_Result is private;
+
type Combinator is access function
(Input : in Element_Array;
- Start : in Positive;
- Length : out Natural;
- Value : out Element_Array)
- return Result;
-
+ Start : in Positive)
+ return Combinator_Result;
type Combinator_Array is array (Positive range <>) of Combinator;
+ Fail_Result : constant Combinator_Result;
+
+
+ function Create_Result
+ (Length : in Natural;
+ Status : in Result_Status;
+ Value : in Element_Array)
+ return Combinator_Result;
+
+ function Join
+ (Left, Right : in Combinator_Result)
+ return Combinator_Result;
+
+ function Is_Failure
+ (This : in Combinator_Result)
+ return Boolean;
+
+
private
+ type Element_Array_Access is access Element_Array;
+
+
+ type Combinator_Result is new Ada.Finalization.Controlled with record
+ Length : Natural;
+ Status : Result_Status;
+ Value : Element_Array_Access;
+ end record;
+
+
+ overriding procedure Initialize
+ (This : in out Combinator_Result);
+
+ overriding procedure Adjust
+ (This : in out Combinator_Result);
+
+ overriding procedure Finalize
+ (This : in out Combinator_Result);
+
+
+ Fail_Result : constant Combinator_Result :=
+ (Ada.Finalization.Controlled with
+ Length => 0,
+ Status => Failure,
+ Value => null);
+
+
end Packrat.Lexer;