checkpoint harmony
[sbp.git] / src / edu / berkeley / sbp / GSS.java
index cff543d..b98d077 100644 (file)
@@ -154,10 +154,10 @@ class GSS {
             return ret.toString();
         }
         
-        public boolean isDone() throws Parser.Failed {
+        public boolean isDone() throws ParseFailed {
             if (token != null) return false;
             if (token==null && finalResult==null)
-                throw new Parser.Failed(error(red("unexpected end of file\n")),
+                throw new ParseFailed(error(red("unexpected end of file\n")),
                                         getLocation());
             return true;
         }
@@ -296,15 +296,11 @@ class GSS {
         class Reset extends RuntimeException { }
 
         public void invoke(State st, Forest result, Node n) {
-            boolean ok = next.newNode(n, result, st, false);
-            if (ok && !good) {
-                good = !st.lame();
-                //if (good) System.out.println(st);
-            }
+            good |= next.newNode(n, result, st, false);
         }
 
         /** perform all shift operations, adding promoted nodes to <tt>next</tt> */
-        public void shift(Phase next, Forest result) throws Parser.Failed {
+        public void shift(Phase next, Forest result) throws ParseFailed {
             if (prev!=null) prev.hash = null;
             this.next = next;
             closed = true;
@@ -320,10 +316,10 @@ class GSS {
             }
 
             if (!good && token!=null)
-                throw new Parser.Failed(error(red("unexpected character")+" "+purple(token)+" encountered at "+green(getLocation())+"\n"),
+                throw new ParseFailed(error(red("unexpected character")+" "+purple(token)+" encountered at "+green(getLocation())+"\n"),
                                         getLocation());
             if (token==null && finalResult==null)
-                throw new Parser.Failed(error(red("unexpected end of file\n")),
+                throw new ParseFailed(error(red("unexpected end of file\n")),
                                         getLocation());
 
             // this massively improves GC performance
@@ -385,10 +381,10 @@ class GSS {
 
             public final void invoke(Reduction r, Node n, Node n2) {
                 if (n==null) {
-                    if (r.numPop==0) r.reduce(this);
+                    if (r.position.pos==0) r.reduce(this);
                     return;
                 }
-                if (r.numPop==0) return;
+                if (r.position.pos==0) return;
                 if (n2==null) r.reduce(n);
                 else          r.reduce(n, n2);
             }