X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FParseFailed.java;h=80007124687172f0974c228b172e8309a0c31729;hb=61a0c83fd40b98292b2dfe1eaba237eb804b2cb4;hp=b6a05e0bd3b356b9754629b6ecce77304bf40a20;hpb=dc9bb3a45ed306e2e35549076842b3e74efecb48;p=sbp.git diff --git a/src/edu/berkeley/sbp/ParseFailed.java b/src/edu/berkeley/sbp/ParseFailed.java index b6a05e0..8000712 100644 --- a/src/edu/berkeley/sbp/ParseFailed.java +++ b/src/edu/berkeley/sbp/ParseFailed.java @@ -83,7 +83,7 @@ public class ParseFailed extends Exception { /* else if (p.pos-raise > 0) barf(sb, n, indent, false, 1); - if (!new Cache(null, null).possiblyEpsilon(p.element())) + if (!new Grammar(null, null).possiblyEpsilon(p.element())) break; */ p = p.next(); @@ -138,25 +138,24 @@ public class ParseFailed extends Exception { return ANSI.purple(ret.toString()); } - static void error(String message, GSS.Phase phase) throws ParseFailed { - error(message, phase.getLocation(), phase.getToken(), - phase, phase.getRegion(), phase.getGSS().getInput(), phase.getGSS()); + static void error(String message, GSS.Phase phase, Object token, Input.Region region) throws ParseFailed { + error(message, + token, + phase, + region, + phase.getGSS().getInput(), + phase.getGSS()); } - static void error(String message, - Input.Location loc, - Object token, - Iterable nodes, - Input.Region region, - Input input, - GSS gss) throws ParseFailed{ + private static void error(String message, + Object token, + Iterable nodes, + Input.Region region, + Input input, + GSS gss) throws ParseFailed{ String lookAhead = token==null ? "" : token.toString(); StringBuffer ret = new StringBuffer(); ret.append(ANSI.bold(ANSI.red(message))); - if (token != null) { - ret.append(" \'"); - ret.append(ANSI.cyan(StringUtil.escapify(token+"", "\\\'\r\n"))); - ret.append("\'"); - } + String toks = token+""; ret.append(" at "); ret.append(ANSI.yellow(region+"")); if (input != null) {