summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2019-01-15 19:34:37 +1100
committerJed Barber <jjbarber@y7mail.com>2019-01-15 19:34:37 +1100
commit4e42761354c2de557c0166d46aabe9dcd9b77073 (patch)
treeed940eb95e476048b7d68fc49e4edd12eb444b16 /src
parentb60f27407c20344f5d48fa7d6f3efe5f9d4e87fb (diff)
Redesigned Lexer Scan functions slightly, added tests for them
Diffstat (limited to 'src')
-rw-r--r--src/packrat-lexer.adb31
-rw-r--r--src/packrat-lexer.ads41
2 files changed, 30 insertions, 42 deletions
diff --git a/src/packrat-lexer.adb b/src/packrat-lexer.adb
index a563f69..7cbd527 100644
--- a/src/packrat-lexer.adb
+++ b/src/packrat-lexer.adb
@@ -164,15 +164,6 @@ package body Packrat.Lexer is
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)
@@ -184,17 +175,8 @@ package body Packrat.Lexer is
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;
+ (Input : in Lexer_With_Input;
Context : in out Lexer_Context)
return Gen_Tokens.Token_Array
is
@@ -204,12 +186,21 @@ package body Packrat.Lexer is
end Scan_With;
- procedure Scan_Set_With
+ procedure Scan_Set
(Input : in Element_Array;
Context : in out Lexer_Context;
Output : out Gen_Tokens.Token_Array) is
begin
null;
+ end Scan_Set;
+
+
+ procedure Scan_Set_With
+ (Input : in Lexer_With_Input;
+ Context : in out Lexer_Context;
+ Output : out Gen_Tokens.Token_Array) is
+ begin
+ null;
end Scan_Set_With;
diff --git a/src/packrat-lexer.ads b/src/packrat-lexer.ads
index 1da9662..2d152bf 100644
--- a/src/packrat-lexer.ads
+++ b/src/packrat-lexer.ads
@@ -48,6 +48,12 @@ package Packrat.Lexer is
+ type Lexer_With_Input is access function
+ return Element_Array;
+
+
+
+
generic
Label : in Label_Enum;
with function Combo
@@ -59,6 +65,7 @@ package Packrat.Lexer is
Context : in out Lexer_Context);
generic
+ Label : in Label_Enum;
with function Combo
(Input : in Element_Array;
Start : in Positive)
@@ -79,43 +86,33 @@ package Packrat.Lexer is
generic
Components : in Component_Array;
- Padding : in Gen_Tokens.Token;
- procedure Scan_Set
+ function Scan_Only
(Input : in Element_Array;
- Context : in out Lexer_Context;
- Output : out Gen_Tokens.Token_Array);
+ Context : in out Lexer_Context)
+ return Gen_Tokens.Token_Array;
generic
Components : in Component_Array;
- function Scan_Only
- (Input : in Element_Array;
+ function Scan_With
+ (Input : in Lexer_With_Input;
Context : in out Lexer_Context)
return Gen_Tokens.Token_Array;
generic
- Gomponents : in Component_Array;
- Padding : in Gen_Tokens.Token;
- procedure Scan_Set_Only
+ Components : in Component_Array;
+ Pad_In : in Element;
+ Pad_Out : 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;
- 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;
+ Pad_In : in Element;
+ Pad_Out : in Gen_Tokens.Token;
procedure Scan_Set_With
- (Input : in Element_Array;
+ (Input : in Lexer_With_Input;
Context : in out Lexer_Context;
Output : out Gen_Tokens.Token_Array);