1 package edu.berkeley.sbp;
2 import edu.berkeley.sbp.*;
3 import edu.berkeley.sbp.util.*;
4 import edu.berkeley.sbp.Sequence.Position;
8 /** if ambiguity checking is enabled, this exception is thrown to signal that the parse was ambiguous */
9 public class Ambiguous extends RuntimeException {
10 public final Forest ambiguity;
11 public Ambiguous(Forest ambiguity) { this.ambiguity = ambiguity; }
12 public String toString() {
13 StringBuffer sb = new StringBuffer();
14 sb.append("unresolved ambiguity "/*"at " + ambiguity.getLocation() + ":"*/);
15 for(Object result : ambiguity.expand(false))
16 sb.append("\n " + result);