summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2020-04-19 23:26:59 +1000
committerJed Barber <jjbarber@y7mail.com>2020-04-19 23:26:59 +1000
commitd8e6a2bcf74f1059f83c681e646fd8a22876e737 (patch)
tree97b2ec58ba5b3fef9c8453e03ddce4b0eccaea57 /src
parent4aa7653f76f2223c41debdfdddf6a420d3f0db88 (diff)
Removed Finish field from Tokens for Graph reasons
Diffstat (limited to 'src')
-rw-r--r--src/packrat-lexer.adb1
-rw-r--r--src/packrat-tokens.adb13
-rw-r--r--src/packrat.ads15
3 files changed, 4 insertions, 25 deletions
diff --git a/src/packrat-lexer.adb b/src/packrat-lexer.adb
index 256341e..319e05c 100644
--- a/src/packrat-lexer.adb
+++ b/src/packrat-lexer.adb
@@ -47,7 +47,6 @@ package body Packrat.Lexer is
Context.Result_So_Far.Append (Gen_Tokens.Create
(Label,
Context.Position + Context.Offset,
- Current_Result.Finish + Context.Offset,
Input (Context.Position .. Current_Result.Finish)));
if Current_Result.Finish = 0 then
Context.Empty_Labels.Insert (Label);
diff --git a/src/packrat-tokens.adb b/src/packrat-tokens.adb
index aae0ae6..e0ea10d 100644
--- a/src/packrat-tokens.adb
+++ b/src/packrat-tokens.adb
@@ -19,14 +19,12 @@ package body Tokens is
function Create
(Ident : in Label_Enum;
Start : in Positive;
- Finish : in Natural;
Value : in Element_Array)
return Token is
begin
return This : Token do
This.Identifier := Ident;
This.Start_At := Start;
- This.Finish_At := Finish;
This.Token_Value := Value_Holders.To_Holder (Value);
end return;
end Create;
@@ -42,8 +40,7 @@ package body Tokens is
Result : SU.Unbounded_String := +"";
begin
SU.Append (Result, "Token " & Label_Enum'Image (This.Identifier) &
- " at input position" & Integer'Image (This.Start_At) & " to" &
- Integer'Image (This.Finish_At) & " with value length" &
+ " at input position" & Integer'Image (This.Start_At) & " with value length" &
Integer'Image (This.Token_Value.Constant_Reference.Element'Length) & Latin.LF);
return -Result;
end Debug_String;
@@ -68,14 +65,6 @@ package body Tokens is
end Start;
- function Finish
- (This : in Token)
- return Natural is
- begin
- return This.Finish_At;
- end Finish;
-
-
function Value
(This : in Token)
return Element_Array is
diff --git a/src/packrat.ads b/src/packrat.ads
index b2b0144..365cce5 100644
--- a/src/packrat.ads
+++ b/src/packrat.ads
@@ -113,20 +113,16 @@ package Packrat is
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;
- Finish : in Natural;
Value : in Element_Array)
return Token;
- -- 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.
+ -- Note: The Start index indicate where the token was found
+ -- in whatever array it was lexed from. The Value does *not*
+ -- have to correspond with whatever is found there.
function Debug_String
@@ -142,10 +138,6 @@ package Packrat is
(This : in Token)
return Positive;
- function Finish
- (This : in Token)
- return Natural;
-
function Value
(This : in Token)
return Element_Array;
@@ -160,7 +152,6 @@ package Packrat is
type Token is record
Identifier : Label_Enum;
Start_At : Positive;
- Finish_At : Natural;
Token_Value : Value_Holders.Holder;
end record;