- this.merge(parent, pending);
- GSS.Phase start = parent==null ? null : parent.phase();
- if (parent != null) addParent(parent, true);
- if (phase.hash.get(state, start) != null) throw new Error("severe problem!");
- phase.hash.put(state, start, this);
+ this.fromEmptyReduction = fromEmptyReduction;
+ if (phase.hash.get(state, result.phase()) != null) throw new Error("severe problem!");
+ phase.hash.put(state, result.phase(), this);
+ addResult(result);
+ state.invokeEpsilonReductions(phase().token, this);
+ }
+
+ // Add/Remove Children/Results //////////////////////////////////////////////////////////////////////////////
+
+ public void removeChild(Result child) {
+ if (children==null) return;
+ children.remove(child);
+ check();
+ }
+ public void removeResult(Result result) {
+ if (results==null) return;
+ results.remove(result);
+ check();
+ }
+ public void addChild(Result child) {
+ if (children==null) return; // FIXME: this should not happen
+ children.add(child);
+ }
+ public void addResult(Result r) {
+ if (results.contains(r)) return;
+ results.add(r);
+ r.addChild(this);
+ if (!fromEmptyReduction) state.invokeReductions(phase().getToken(), this, r);