projects
/
sbp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vast improvement in error reporting
[sbp.git]
/
src
/
edu
/
berkeley
/
sbp
/
ParseFailed.java
diff --git
a/src/edu/berkeley/sbp/ParseFailed.java
b/src/edu/berkeley/sbp/ParseFailed.java
index
547ea95
..
1fa0b08
100644
(file)
--- a/
src/edu/berkeley/sbp/ParseFailed.java
+++ b/
src/edu/berkeley/sbp/ParseFailed.java
@@
-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, 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) {
}
}
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)
}
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) {
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));
}
} 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++;
}
ret.append(" to match \"" + ANSI.cyan(input.showRegion(reg)) + "\" at " + ANSI.yellow(reg));
i++;
}