summaryrefslogtreecommitdiff
path: root/src/packrat-tokens.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/packrat-tokens.adb')
-rw-r--r--src/packrat-tokens.adb18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/packrat-tokens.adb b/src/packrat-tokens.adb
index 70a866a..240ecee 100644
--- a/src/packrat-tokens.adb
+++ b/src/packrat-tokens.adb
@@ -30,13 +30,17 @@ package body Tokens is
procedure Adjust
- (This : in out Token)
- is
- New_Array : Element_Array_Access :=
- new Element_Array (This.Token_Value'Range);
+ (This : in out Token) is
begin
- New_Array.all := This.Token_Value.all;
- This.Token_Value := New_Array;
+ if This.Token_Value /= null then
+ declare
+ New_Array : Element_Array_Access :=
+ new Element_Array (1 .. This.Token_Value'Length);
+ begin
+ New_Array.all := This.Token_Value.all;
+ This.Token_Value := New_Array;
+ end;
+ end if;
end Adjust;
@@ -64,7 +68,7 @@ package body Tokens is
This.Identifier := Ident;
This.Start_At := Start;
This.Finish_At := Finish;
- This.Token_Value := new Element_Array (Value'Range);
+ This.Token_Value := new Element_Array (1 .. Value'Length);
This.Token_Value.all := Value;
return This;
end Create;