summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2019-01-13 23:19:19 +1100
committerJed Barber <jjbarber@y7mail.com>2019-01-13 23:19:19 +1100
commit93406e9b26f9e4439a8e4d57659489323a4e57b4 (patch)
tree101867e1790804885037cf2998a9466532902bc8
parentf8cef7edffc705cc1c168620a6ba0e76a90f6366 (diff)
Spec for Packrat.Lexer Stamp, Scan, and derivative functions and procedures
-rw-r--r--src/packrat-lexer.adb80
-rw-r--r--src/packrat-lexer.ads87
2 files changed, 166 insertions, 1 deletions
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;