added decent error reporting
[sbp.git] / src / edu / berkeley / sbp / Parser.java
index 1a0d307..ddee582 100644 (file)
@@ -41,12 +41,12 @@ public abstract class Parser<T extends Token, R> {
         int count = 1;
         for(;;) {
             loc = input.getLocation();
+            //current.checkFailure();
             GSS.Phase next = gss.new Phase(current, input.next(count), loc);
             current.reduce();
             Forest forest = current.token==null ? null : shiftedToken((T)current.token, loc);
             current.shift(next, forest);
             count = next.hash.size();
-            current.checkFailure();
             if (current.isDone()) return (Forest<R>)current.finalResult;
             current = next;
         }
@@ -61,7 +61,7 @@ public abstract class Parser<T extends Token, R> {
         public Failed() { this("", null); }
         public Failed(String message, Token.Location loc) { this.location = loc; this.message = message; }
         public Token.Location getLocation() { return location; }
-        public String toString() { return message + (location==null ? "" : (" at " + location)); }
+        public String toString() { return message/* + (location==null ? "" : (" at " + location))*/; }
     }
 
     public static class Ambiguous extends RuntimeException {