- //////////////////////////////////////////////////////////////////////
-
- private static int node_idx = 0;
- private final int idx = node_idx++;
-
- private final GSS.Phase phase;
- private final Parser.Table.State state;
- private final boolean fromEmptyReduction;
- //private FastSet<Result> results = new FastSet<Result>();
- private HashSet<Result> results = new HashSet<Result>();
- private HashSet<Result> successors = new HashSet<Result>();
-
- public final void invoke(Pos r, Result only) {
- boolean emptyProductions = only==null;
- if (emptyProductions != (r.numPops()==0)) return;
- if (r.numPops()!=0) reduce(r, r.numPops()-1, phase(), only);
- else {
- Input.Region region = phase().getLocation().createRegion(phase().getLocation());
- Result.newResult(r.rewrite(region), this, r, phase());
- }
+ /**
+ * Every Node has a phase; StateNodes belong to the phase in
+ * which they were shifted, ResultNodes belong to the phase of
+ * their predecessors. All of the predecessors of a given node
+ * must belong to the same phase
+ */
+ public Node(GSS.Phase phase, GSS.Phase predecessorPhase) {
+ this.phase = phase;
+ this.predecessorPhase = predecessorPhase;