summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);