From dc3078a06b5ee52751cfb6fd6cf13b3790632ac4 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sat, 12 Jan 2019 00:38:45 +1100 Subject: Packrat.Lexer.Combinators specs and tests complete --- src/packrat-tokens.adb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/packrat-tokens.adb') 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; -- cgit