/** if ambiguity checking is enabled, this exception is thrown to signal that the parse was ambiguous */
public class Ambiguous extends RuntimeException {
- 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() {
StringBuffer sb = new StringBuffer();
sb.append("unresolved ambiguity "/*"at " + ambiguity.getLocation() + ":"*/);
- for(Object result : ambiguity.expand(false))
- sb.append("\n " + result);
+ for(Tree<?> result : ambiguity.expand(false))
+ sb.append("\n\n" + result.toPrettyString());
return sb.toString();
}
}