+ private int _last = -1;
+ private String buf = "";
+ private void debug(Object t, GSS gss, Input input) {
+ //FIXME
+ int c = t==null ? -1 : ((t+"").charAt(0));
+ int last = _last;
+ _last = c;
+ switch(c) {
+ case edu.berkeley.sbp.chr.CharAtom.left:
+ buf += "\033[31m{\033[0m";
+ break;
+ case edu.berkeley.sbp.chr.CharAtom.right:
+ buf += "\033[31m}\033[0m";
+ break;
+ case -1: // FIXME
+ case '\n':
+ if (verbose) {
+ if (last==' ') buf += ANSI.blue("\\n");
+ System.err.println("\r"+ANSI.clreol()+"\r"+buf);
+ buf = "";
+ }
+ break;
+ default:
+ buf += ANSI.cyan(""+((char)c));
+ break;
+ }
+ if (t==null) return;
+
+ // FIXME: clean this up
+ String s;
+ s = " " + spin[spinpos++ % (spin.length)]+" parsing ";
+ s += input.getName();
+ s += " "+input.getLocation();
+ while(s.indexOf(':') != -1 && s.indexOf(':') < 8) s = " " + s;
+ String y = "@"+gss.viewPos+" ";
+ while(y.length() < 9) y = " " + y;
+ s += y;
+ s += " nodes="+gss.numOldNodes;
+ while(s.length() < 50) s = s + " ";
+ s += " shifted="+gss.numNewNodes;
+ while(s.length() < 60) s = s + " ";
+ s += " reductions="+gss.numReductions;
+ while(s.length() < 78) s = s + " ";
+ System.err.print("\r"+ANSI.invert(s+ANSI.clreol())+"\r");
+ }
+