From: adam Date: Sat, 15 Jul 2006 06:33:14 +0000 (-0400) Subject: checkpoint X-Git-Tag: tag_for_25-Mar~133 X-Git-Url: http://git.megacz.com/?p=sbp.git;a=commitdiff_plain;h=1b5d6cf8ab6963d50c168c9daeb7887b45a343ea checkpoint darcs-hash:20060715063314-5007d-4dc6e2bef200ee7ed89e7bde3e612fb3a38d043e.gz --- diff --git a/src/edu/berkeley/sbp/Ambiguous.java b/src/edu/berkeley/sbp/Ambiguous.java index 1f7cc38..394aab6 100644 --- a/src/edu/berkeley/sbp/Ambiguous.java +++ b/src/edu/berkeley/sbp/Ambiguous.java @@ -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 { - 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 "); - for(Tree result : ambiguity.expand(false)) { + HashSet hf = new HashSet(); + ambiguity.gather(hf); + HashSet ht = new HashSet(); + ambiguity.expand(ht, hf, new Tree(null, "...", null, false)); + for(Tree result : ht) { sb.append("\n\n"); result.toPrettyString(sb); }