abort if only remaining nodes are doomed
authoradam <adam@megacz.com>
Fri, 20 Apr 2007 03:19:58 +0000 (23:19 -0400)
committeradam <adam@megacz.com>
Fri, 20 Apr 2007 03:19:58 +0000 (23:19 -0400)
darcs-hash:20070420031958-5007d-bcba9daa363062ba4c756dd0b5f6231856322930.gz

src/edu/berkeley/sbp/GSS.java

index 5c1b92f..3c6beac 100644 (file)
@@ -185,7 +185,7 @@ class GSS {
          */
         private boolean newNode(Result result, State state, boolean fromEmptyReduction) {
             Node p = hash.get(state, result.phase());
          */
         private boolean newNode(Result result, State state, boolean fromEmptyReduction) {
             Node p = hash.get(state, result.phase());
-            if (p != null) { p.addResult(result); return true; }
+            if (p != null) { p.addResult(result); return !state.doomed(); }
             do {
                 if (token != null && state.canShift(token)) break;
                 if (state.isAccepting()) break;
             do {
                 if (token != null && state.canShift(token)) break;
                 if (state.isAccepting()) break;
@@ -195,7 +195,7 @@ class GSS {
             Node n = new Node(Phase.this, result, state, fromEmptyReduction);  // ALLOC
             for(Object s : state.conjunctStates)
                 newNode(new Result(null, n, null), (State)s, fromEmptyReduction);
             Node n = new Node(Phase.this, result, state, fromEmptyReduction);  // ALLOC
             for(Object s : state.conjunctStates)
                 newNode(new Result(null, n, null), (State)s, fromEmptyReduction);
-            return true;
+            return !n.state().doomed();
         }
 
         public int toInt() { return pos+1; }
         }
 
         public int toInt() { return pos+1; }