public abstract class Forest<T> {
/** assume that this forest contains exactly one tree and return it; otherwise throw an exception */
- public final Tree<T> expand1() throws Parser.Ambiguous, Parser.Failed {
+ public final Tree<T> expand1() throws Ambiguous, ParseFailed {
Iterator<Tree<T>> it = expand(true).iterator();
- if (!it.hasNext()) throw new Parser.Failed();
+ if (!it.hasNext()) throw new ParseFailed();
return it.next();
}
HashSet<Tree<T>> ret = new HashSet<Tree<T>>();
for(Body<T> b : results)
ret.addAll(b.expand(toss, new ArrayList<Tree<T>>(), 0, new HashSet<Tree<T>>()));
- if (toss && ret.size() > 1) throw new Parser.Ambiguous(this);
+ if (toss && ret.size() > 1) throw new Ambiguous(this);
return ret;
}