X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FParseFailed.java;h=316caafe6bc6d284fdb83da30792f5ad9ba26426;hp=619bf65f88ae2465a6b3e9ce49c71a73c04d2324;hb=b8a597c8d1a29afc24f9b89f726d5b1a9b9aeec1;hpb=0ab024f487647f99eb000345c29c2f8e9b52a200 diff --git a/src/edu/berkeley/sbp/ParseFailed.java b/src/edu/berkeley/sbp/ParseFailed.java index 619bf65..316caaf 100644 --- a/src/edu/berkeley/sbp/ParseFailed.java +++ b/src/edu/berkeley/sbp/ParseFailed.java @@ -12,14 +12,14 @@ public class ParseFailed extends Exception { private final Input.Location location; private final String message; - public ParseFailed() { this("", null); } - public ParseFailed(String message, Input.Location loc) { this.location = loc; this.message = message; } + ParseFailed() { this("", null); } + ParseFailed(String message, Input.Location loc) { this.location = loc; this.message = message; } public Input.Location getLocation() { return location; } public String toString() { return message/* + (location==null ? "" : (" at " + location))*/; } // FIXME private static HashSet touched = new HashSet(); - public static void complain(GSS.Phase.Node n, HashMap> errors, boolean force) { + static void complain(GSS.Phase.Node n, HashMap> errors, boolean force) { if (touched.contains(n)) return; touched.add(n); for(Position p : n.state) { @@ -35,9 +35,9 @@ public class ParseFailed extends Exception { } } - public static String el(Object e) { + static String el(Object e) { String s = e.toString(); - if (s.length()==0 || s.charAt(0)!='\"' || s.charAt(s.length()-1)!='\"') return ANSI.yellow(s); + if (s.length()==0 || s.charAt(0)!='\"' || s.charAt(s.length()-1)!='\"') return /*ANSI.yellow(s)*/s; s = s.substring(1); s = s.substring(0, s.length()-1); StringBuffer ret = new StringBuffer(); @@ -45,13 +45,14 @@ public class ParseFailed extends Exception { if (s.charAt(i)=='\\' && i nodes) { + static String error(String message, Object token, Iterable nodes) { String lookAhead = token==null ? "" : token.toString(); StringBuffer ret = new StringBuffer(); ret.append("\n "); ret.append(message); + /* HashMap> errors = new HashMap>(); for(Node n : nodes) { //System.out.println(n.state); @@ -72,6 +73,7 @@ public class ParseFailed extends Exception { ret.append("\n"); } } + */ return ret.toString(); }