}
public void reduce(GSS.Phase.Node parent, GSS.Phase.Node onlychild) {
- Forest[] holder = new Forest[position.pos];
- if (position.pos<=0) throw new Error("called wrong form of reduce()");
- int pos = position.pos-1;
- Forest old = holder[pos];
- holder[pos] = parent.pending();
- if (pos==0) {
- System.arraycopy(holder, 0, position.holder, 0, holder.length);
- finish(onlychild, position.rewrite(parent.phase().getLocation()), parent.phase(), holder);
- } else {
- reduce(onlychild, pos-1, parent.phase(), holder);
- }
- holder[pos] = old;
}
// FIXME: this could be more elegant and/or cleaner and/or somewhere else