From 93406e9b26f9e4439a8e4d57659489323a4e57b4 Mon Sep 17 00:00:00 2001
From: Jed Barber <jjbarber@y7mail.com>
Date: Sun, 13 Jan 2019 23:19:19 +1100
Subject: Spec for Packrat.Lexer Stamp, Scan, and derivative functions and
 procedures

---
 src/packrat-lexer.adb | 80 ++++++++++++++++++++++++++++++++++++++++++++++
 src/packrat-lexer.ads | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 166 insertions(+), 1 deletion(-)

diff --git a/src/packrat-lexer.adb b/src/packrat-lexer.adb
index ce793a5..614452b 100644
--- a/src/packrat-lexer.adb
+++ b/src/packrat-lexer.adb
@@ -153,6 +153,86 @@ package body Packrat.Lexer is
     end Debug_String;
 
 
+
+
+
+    procedure Stamp
+           (Context : in out Lexer_Context) is
+    begin
+        null;
+    end Stamp;
+
+
+    procedure Ignore
+           (Context : in out Lexer_Context) is
+    begin
+        null;
+    end Ignore;
+
+
+
+
+
+    function Scan
+           (Input   : in     Element_Array;
+            Context : in out Lexer_Context)
+        return Gen_Tokens.Token_Array
+    is
+        Result : Gen_Tokens.Token_Array (1 .. 0);
+    begin
+        return Result;
+    end Scan;
+
+
+    procedure Scan_Set
+           (Input   : in     Element_Array;
+            Context : in out Lexer_Context;
+            Output  :    out Gen_Tokens.Token_Array) is
+    begin
+        null;
+    end Scan_Set;
+
+
+    function Scan_Only
+           (Input   : in     Element_Array;
+            Context : in out Lexer_Context)
+        return Gen_Tokens.Token_Array
+    is
+        Result : Gen_Tokens.Token_Array (1 .. 0);
+    begin
+        return Result;
+    end Scan_Only;
+
+
+    procedure Scan_Set_Only
+           (Input   : in     Element_Array;
+            Context : in out Lexer_Context;
+            Output  :    out Gen_Tokens.Token_Array) is
+    begin
+        null;
+    end Scan_Set_Only;
+
+
+    function Scan_With
+           (Input   : in     Element_Array;
+            Context : in out Lexer_Context)
+        return Gen_Tokens.Token_Array
+    is
+        Result : Gen_Tokens.Token_Array (1 .. 0);
+    begin
+        return Result;
+    end Scan_With;
+
+
+    procedure Scan_Set_With
+           (Input   : in     Element_Array;
+            Context : in out Lexer_Context;
+            Output  :    out Gen_Tokens.Token_Array) is
+    begin
+        null;
+    end Scan_Set_With;
+
+
 end Packrat.Lexer;
 
 
diff --git a/src/packrat-lexer.ads b/src/packrat-lexer.ads
index 6c28bf8..d331645 100644
--- a/src/packrat-lexer.ads
+++ b/src/packrat-lexer.ads
@@ -20,7 +20,6 @@ package Packrat.Lexer is
 
     type Combinator_Array is array (Positive range <>) of Combinator;
 
-
     Empty_Fail : constant Combinator_Result;
 
 
@@ -47,6 +46,84 @@ package Packrat.Lexer is
         return String;
 
 
+
+
+    type Lexer_Context is new Ada.Finalization.Controlled with private;
+
+    Empty_Context : constant Lexer_Context;
+
+
+
+
+    type Lexer_Component is access procedure
+           (Context : in out Lexer_Context);
+
+    type Component_Array is array (Positive range <>) of Lexer_Component;
+
+    generic
+        Label : in Label_Enum;
+        Combo : in Combinator;
+    procedure Stamp
+           (Context : in out Lexer_Context);
+
+    generic
+        Combo : in Combinator;
+    procedure Ignore
+           (Context : in out Lexer_Context);
+
+
+
+
+    generic
+        Components : in Component_Array;
+    function Scan
+           (Input   : in     Element_Array;
+            Context : in out Lexer_Context)
+        return Gen_Tokens.Token_Array;
+
+    generic
+        Components : in Component_Array;
+        Padding    : in Gen_Tokens.Token;
+    procedure Scan_Set
+           (Input   : in     Element_Array;
+            Context : in out Lexer_Context;
+            Output  :    out Gen_Tokens.Token_Array);
+
+    generic
+        Components : in Component_Array;
+    function Scan_Only
+           (Input   : in     Element_Array;
+            Context : in out Lexer_Context)
+        return Gen_Tokens.Token_Array;
+
+    generic
+        Gomponents : in Component_Array;
+        Padding    : in Gen_Tokens.Token;
+    procedure Scan_Set_Only
+           (Input   : in     Element_Array;
+            Context : in out Lexer_Context;
+            Output  :    out Gen_Tokens.Token_Array);
+
+    generic
+        Components : in Component_Array;
+        with function More
+            return Element_Array;
+    function Scan_With
+           (Input   : in     Element_Array;
+            Context : in out Lexer_Context)
+        return Gen_Tokens.Token_Array;
+
+    generic
+        Components : in Component_Array;
+        Padding    : in Gen_Tokens.Token;
+        with function More
+            return Element_Array;
+    procedure Scan_Set_With
+           (Input   : in     Element_Array;
+            Context : in out Lexer_Context;
+            Output  :    out Gen_Tokens.Token_Array);
+
+
 private
 
 
@@ -80,6 +157,14 @@ private
         Value  => null);
 
 
+
+
+    type Lexer_Context is new Ada.Finalization.Controlled with null record;
+
+
+    Empty_Context : constant Lexer_Context := (Ada.Finalization.Controlled with null record);
+
+
 end Packrat.Lexer;
 
 
-- 
cgit