vast improvement in error reporting
authoradam <adam@megacz.com>
Sat, 29 Jul 2006 07:35:49 +0000 (03:35 -0400)
committeradam <adam@megacz.com>
Sat, 29 Jul 2006 07:35:49 +0000 (03:35 -0400)
darcs-hash:20060729073549-5007d-138ca871713a9e62c4c44cd4cce6fffd4a1cf83c.gz

src/edu/berkeley/sbp/ParseFailed.java
tests/java15.test

index 547ea95..1fa0b08 100644 (file)
@@ -51,7 +51,7 @@ public class ParseFailed extends Exception {
             barf(sb, n, indent, skip, loc);
         } else {
             for(GSS.Phase<Tok>.Node nn : n.parents())
-                barf(sb, nn, indent, skip, count-1, nn.phase().getPrevLocation());
+                barf(sb, nn, indent, skip, count-1, n.phase().getLocation());
         }
     }
     static <Tok> void barf(HashMap<Element,Input.Location> sb, GSS.Phase<Tok>.Node n, int indent, boolean skip, Input.Location loc) {
@@ -172,7 +172,7 @@ public class ParseFailed extends Exception {
         }
         HashMap<Element,Input.Location> hm = new HashMap<Element,Input.Location>();
         for(Node no : nodes)
-            barf(hm, no, 0, false, /*region.getStart()*/loc);
+            barf(hm, no, 0, false, region.getStart());
         ret.append("\n expected: ");
         Set<Element> hs = hm.keySet();
         if (hs.size() == 1) {
@@ -186,7 +186,7 @@ public class ParseFailed extends Exception {
                 } else {
                     ret.append("\n        or " + ANSI.purple(s));
                 }
-                Input.Region reg = loc2.createRegion(region.getStart());
+                Input.Region reg = loc2.createRegion(region.getEnd());
                 ret.append(" to match \"" + ANSI.cyan(input.showRegion(reg)) + "\" at " + ANSI.yellow(reg));
                 i++;
             }
index a8efc19..f44f333 100644 (file)
@@ -3,7 +3,7 @@ import foo.bar;
 
 public class Baz < A extends Object , Q super Foo<Bar<Baz>,Bop> > {
 
-  public voider adsffbid foo(int x, char y, Bop<Baz<M>> q) {
+  public void foo(int x, char y,Bop<Baz<M> q) {
   }
 
   protected abstract int bar(int c);