From dd9121ec8d91784e6cea4e71cd1fe5c3735d81d8 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Fri, 25 Dec 2020 22:13:59 +1100 Subject: Parser tests, left recursion test --- src/packrat-parsers.adb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/packrat-parsers.adb') diff --git a/src/packrat-parsers.adb b/src/packrat-parsers.adb index 01c4677..7c89984 100644 --- a/src/packrat-parsers.adb +++ b/src/packrat-parsers.adb @@ -602,12 +602,15 @@ package body Packrat.Parsers is Processed : Result_Sets.Set; begin if Salt.Status = Failure then - Ada.Strings.Unbounded.Append - (Context.Error_String, - Packrat.Errors.Encode (Traits.Label_Enum'Image (Label), Start)); + declare + Error : String := Packrat.Errors.Encode + (Traits.Label_Enum'Image (Label), Start); + begin + if Ada.Strings.Unbounded.Index (Context.Error_String, Error) = 0 then + Ada.Strings.Unbounded.Append (Context.Error_String, Error); + end if; + end; return Salt; - else - Context.Error_String := +""; end if; for R of Salt.Results loop Current := -- cgit