X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FParseFailed.java;h=80007124687172f0974c228b172e8309a0c31729;hp=8e759a88a8b65d8ae88d21fb59ddb527c37939fe;hb=2afdfe14e78fa0597186614937c679a09d74ecdf;hpb=eef891a53c43901acccac0dead16a79dbdb34c77 diff --git a/src/edu/berkeley/sbp/ParseFailed.java b/src/edu/berkeley/sbp/ParseFailed.java index 8e759a8..8000712 100644 --- a/src/edu/berkeley/sbp/ParseFailed.java +++ b/src/edu/berkeley/sbp/ParseFailed.java @@ -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) {