summaryrefslogtreecommitdiff
path: root/src/packrat-errors.adb
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2021-01-21 16:33:47 +1100
committerJed Barber <jjbarber@y7mail.com>2021-01-21 16:33:47 +1100
commit30d59f09f6908aa0de2ec3a58a0736c8030ffda5 (patch)
treeffbca1ff15ffe02de67374687b7210131cace28e /src/packrat-errors.adb
parentd089edbb61f6bf6b52bc74f7f03f909b8b33b670 (diff)
Piecewise parsing fixed, unit tested
Diffstat (limited to 'src/packrat-errors.adb')
-rw-r--r--src/packrat-errors.adb24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/packrat-errors.adb b/src/packrat-errors.adb
index 3f7c38f..0122b7d 100644
--- a/src/packrat-errors.adb
+++ b/src/packrat-errors.adb
@@ -313,6 +313,30 @@ package body Packrat.Errors is
end Decode;
+
+
+
+ function Equivalent
+ (Left, Right : in Error_Info_Array)
+ return Boolean
+ is
+ Marked : array (Left'Range) of Boolean := (others => False);
+ begin
+ if Left'Length /= Right'Length then
+ return False;
+ end if;
+ for L_Index in Left'Range loop
+ for R of Right loop
+ if Left (L_Index) = R and not Marked (L_Index) then
+ Marked (L_Index) := True;
+ exit;
+ end if;
+ end loop;
+ end loop;
+ return (for all M of Marked => M = True);
+ end Equivalent;
+
+
end Packrat.Errors;