summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/packrat-parse_graphs.adb16
-rw-r--r--src/packrat-parse_graphs.ads10
2 files changed, 21 insertions, 5 deletions
diff --git a/src/packrat-parse_graphs.adb b/src/packrat-parse_graphs.adb
index 16b74dc..c911fb4 100644
--- a/src/packrat-parse_graphs.adb
+++ b/src/packrat-parse_graphs.adb
@@ -232,6 +232,22 @@ package body Packrat.Parse_Graphs is
+ function Is_Ambiguous
+ (Container : in Parse_Graph)
+ return Boolean is
+ begin
+ for N of Container.Nodes loop
+ if Finish_List (Container, N)'Length > 1 then
+ return True;
+ end if;
+ end loop;
+ return False;
+ end Is_Ambiguous;
+
+
+
+
+
function Vector_To_Array
(Input : in Type_Vectors.Vector)
return Array_Type is
diff --git a/src/packrat-parse_graphs.ads b/src/packrat-parse_graphs.ads
index d9cde0b..5663bcf 100644
--- a/src/packrat-parse_graphs.ads
+++ b/src/packrat-parse_graphs.ads
@@ -180,11 +180,11 @@ package Packrat.Parse_Graphs is
- -- Other things needed here...
- -- Equal_Subgraph? (in Directed_Graph lib)
- -- Is_Ambiguous?
- -- Iterate_Short, Iterate_Long, Iterate_By
- -- Choosing and Filtering functions for Iterate_By
+ -- Tests whether there are multiple potential finish points for any
+ -- of the nodes in the graph, and hence whether the parse was ambiguous.
+ function Is_Ambiguous
+ (Container : in Parse_Graph)
+ return Boolean;