checkpoint
authoradam <adam@megacz.com>
Sat, 15 Jul 2006 06:33:14 +0000 (02:33 -0400)
committeradam <adam@megacz.com>
Sat, 15 Jul 2006 06:33:14 +0000 (02:33 -0400)
darcs-hash:20060715063314-5007d-4dc6e2bef200ee7ed89e7bde3e612fb3a38d043e.gz

src/edu/berkeley/sbp/Ambiguous.java

index 1f7cc38..394aab6 100644 (file)
@@ -7,13 +7,19 @@ import java.util.*;
 
 /** if ambiguity checking is enabled, this exception is thrown to signal that the parse was ambiguous */
 public class Ambiguous extends Exception {
 
 /** if ambiguity checking is enabled, this exception is thrown to signal that the parse was ambiguous */
 public class Ambiguous extends Exception {
-    public final Forest<?> ambiguity;
-    public Ambiguous(Forest<?> ambiguity) { this.ambiguity = ambiguity; }
+    public final Forest ambiguity;
+    public Ambiguous(Forest ambiguity) {
+        this.ambiguity = ambiguity;
+    }
     public String toString() {
         // FEATURE: more legible printout desperately needed
         StringBuffer sb = new StringBuffer();
         sb.append("unresolved ambiguity ");
     public String toString() {
         // FEATURE: more legible printout desperately needed
         StringBuffer sb = new StringBuffer();
         sb.append("unresolved ambiguity ");
-        for(Tree<?> result : ambiguity.expand(false)) {
+        HashSet<Forest> hf = new HashSet<Forest>();
+        ambiguity.gather(hf);
+        HashSet<Tree> ht = new HashSet<Tree>();
+        ambiguity.expand(ht, hf, new Tree(null, "...", null, false));
+        for(Tree<?> result : ht) {
             sb.append("\n\n");
             result.toPrettyString(sb);
         }
             sb.append("\n\n");
             result.toPrettyString(sb);
         }