- //////////////////////////////////////////////////////////////////////
-
- private static int node_idx = 0;
- private final int idx = node_idx++;
-
- private final GSS.Phase phase;
- private final GSS.Phase predPhase;
- private final Parser.Table.State state;
- private boolean fromEmptyReduction;
- private FastSet<Result> results = new FastSet<Result>();
- private FastSet<Result> successors = 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, Object o) {
- 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());
- phase().newNodeFromReduction(r.rewrite(region), r, this);
- }
- }
-
- private void reduce(Pos r, int pos, GSS.Phase target, Result only) {
- for(Result res : results)
- if (only == null || res == only)
- for(Node pred : res.getPreds())
- reduce2(r, pos, target, pred, res.getForest());
- }