From c5f78d029ff16b8ee0f92186c0bfe6304a53d968 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Wed, 13 Jan 2021 19:15:56 +1100 Subject: Lexer now is sure to slide input arrays to start with 1 --- src/packrat-lexers.adb | 6 +++--- src/packrat-parsers.ads | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/packrat-lexers.adb b/src/packrat-lexers.adb index cd81635..b09b6eb 100644 --- a/src/packrat-lexers.adb +++ b/src/packrat-lexers.adb @@ -133,7 +133,7 @@ package body Packrat.Lexers is if not Context.Pass_Forward.Is_Empty then Real_Input.Replace_Element (Slide (Context.Pass_Forward.Element) & Input); else - Real_Input.Replace_Element (Input); + Real_Input.Replace_Element (Slide (Input)); end if; Tidy_Context (Context, Components'Length); Context.Result_So_Far.Clear; @@ -165,7 +165,7 @@ package body Packrat.Lexers is if not Context.Pass_Forward.Is_Empty then Real_Input.Replace_Element (Slide (Context.Pass_Forward.Element) & Input); else - Real_Input.Replace_Element (Input); + Real_Input.Replace_Element (Slide (Input)); end if; Tidy_Context (Context, Components'Length); Context.Result_So_Far.Clear; @@ -197,7 +197,7 @@ package body Packrat.Lexers is begin Context.Result_So_Far.Clear; loop - Real_Input.Replace_Element (Input.all); + Real_Input.Replace_Element (Slide (Input.all)); Empty_Input := Real_Input.Element'Length = 0; if not Context.Pass_Forward.Is_Empty then Real_Input.Replace_Element diff --git a/src/packrat-parsers.ads b/src/packrat-parsers.ads index 1e058dc..7edddb7 100644 --- a/src/packrat-parsers.ads +++ b/src/packrat-parsers.ads @@ -468,11 +468,6 @@ package Packrat.Parsers is private - -- refactor Finish_Type from Parse_Graphs into Packrat and use here and in Lexers - - -- does the lexer handle input that doesn't start from 1 at the beginning? - - package Elem_Holds is new Ada.Containers.Indefinite_Holders (Element_Type => Traits.Element_Array, "=" => Traits."="); -- cgit