}
private boolean newNode2(Node p, Node parent, Forest pending, State state, boolean fromEmptyReduction) {
- //if (p.parents().contains(parent)) return true;
if (p.merge(parent, pending)) return true;
p.parents().add(parent, true);
if (p!=parent && !fromEmptyReduction && reducing) p.performReductions(parent);
final class Node implements Invokable<Position, Node, Node>, IntegerMappable, GraphViz.ToGraphViz {
public FastSet<Node> set = new FastSet<Node>();
- public GraphViz.Node toGraphViz(GraphViz gv) {
- if (gv.hasNode(this)) return gv.createNode(this);
- GraphViz.Node n = gv.createNode(this);
- n.label = ""+state.toStringx();
- n.shape = "rectangle";
- n.fill = "green";
- //GraphViz.Node f = pending().toGraphViz(gv);
- //n.add(f);
- for(Forest result : results()) n.edge(result, "");
- for(Node parent : parents()) n.edge(parent, "");
- ((GraphViz.Group)phase().toGraphViz(gv)).add(n);
- return n;
- }
- public boolean isTransparent() { return false; }
- public boolean isHidden() { return false; }
-
+
private boolean allqueued = false;
/** what state this node is in */
}
public void reduce(Position r, int pos, Phase target, Forest[] holder, Node only) {
+ holder = r.holder;
Forest old = holder[pos];
for(Forest result : results())
if (only != null && child!=only) continue;
holder[pos] = result;
if (pos==0) {
- System.arraycopy(holder, 0, r.holder, 0, holder.length);
+ //System.arraycopy(holder, 0, r.holder, 0, holder.length);
for(int i=0; i<r.pos; i++) if (r.holder[i]==null) throw new Error("realbad");
child.finish(r, r.rewrite(phase().getLocation()), target, holder);
} else {
}
public int toInt() { return idx; }
private final int idx = node_idx++;
+
+ // GraphViz //////////////////////////////////////////////////////////////////////////////
+
+ public GraphViz.Node toGraphViz(GraphViz gv) {
+ if (gv.hasNode(this)) return gv.createNode(this);
+ GraphViz.Node n = gv.createNode(this);
+ n.label = ""+state.toStringx();
+ n.shape = "rectangle";
+ n.fill = "green";
+ for(Forest result : results()) n.edge(result, "");
+ for(Node parent : parents()) n.edge(parent, "");
+ ((GraphViz.Group)phase().toGraphViz(gv)).add(n);
+ return n;
+ }
+ public boolean isTransparent() { return false; }
+ public boolean isHidden() { return false; }
+
}
private int node_idx = 0;