summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2020-12-05 12:50:22 +1100
committerJed Barber <jjbarber@y7mail.com>2020-12-05 12:50:22 +1100
commit170ca0a62968e78ead08b21bc5304b766fa63eb5 (patch)
tree82f152e65c32e23a9b2f5a0db751e292bd61c835
parente57fd65cfd740f992324e7b7c23b0d6656e8cb77 (diff)
More precise Merge function, does it do anything?
-rw-r--r--src/packrat-parsers.adb33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/packrat-parsers.adb b/src/packrat-parsers.adb
index 1a3935c..60102f4 100644
--- a/src/packrat-parsers.adb
+++ b/src/packrat-parsers.adb
@@ -262,17 +262,32 @@ package body Packrat.Parsers is
begin
case Target.Status is
when Success =>
- Target.Results.Union (Add.Results);
- if Add.Status = Optional_More or Add.Status = Needs_More then
- Target.Status := Optional_More;
- end if;
+ case Add.Status is
+ when Success =>
+ Target.Results.Union (Add.Results);
+ when Optional_More =>
+ Target.Results.Union (Add.Results);
+ Target.Status := Optional_More;
+ when Needs_More | Failure =>
+ null;
+ end case;
when Optional_More =>
- Target.Results.Union (Add.Results);
+ case Add.Status is
+ when Success | Optional_More =>
+ Target.Results.Union (Add.Results);
+ when Needs_More | Failure =>
+ null;
+ end case;
when Needs_More =>
- if Add.Status = Success or Add.Status = Optional_More then
- Target.Results.Union (Add.Results);
- Target.Status := Optional_More;
- end if;
+ case Add.Status is
+ when Success | Optional_More =>
+ Target := Add;
+ Target.Status := Optional_More;
+ when Needs_More =>
+ Target.Results.Union (Add.Results);
+ when Failure =>
+ null;
+ end case;
when Failure =>
if Add.Status = Failure then
Merge (Target.Curtails, Add.Curtails);