summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/packrat-parsers.adb20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/packrat-parsers.adb b/src/packrat-parsers.adb
index 4bdbfb4..8533b96 100644
--- a/src/packrat-parsers.adb
+++ b/src/packrat-parsers.adb
@@ -312,9 +312,25 @@ package body Packrat.Parsers is
Start : in Positive)
return Component_Result
is
+ Salt : Combinator_Result := Combo (Input, Context, Start);
+ Index : Positive := 1;
+ Root_Elems : Graphs.Finished_Token_Array (1 .. Integer (Salt.Results.Length));
begin
- -- to-do
- return (Status => Failure);
+ if Salt.Status /= Success then
+ return (Status => Salt.Status);
+ end if;
+ for R of Salt.Results loop
+ Root_Elems (Index) :=
+ (Token => Traits.Tokens.Create (Label, Start, R.Value.Element),
+ Finish => R.Finish);
+ if R.Tokens.Element'Length > 0 then
+ Context.Result_So_Far.Connect (Root_Elems (Index), R.Tokens.Element);
+ else
+ Context.Result_So_Far.Include (Root_Elems (Index).Token);
+ end if;
+ end loop;
+ Context.Result_So_Far.Set_Root (Root_Elems);
+ return (Status => Success);
end Root;