checkpoint harmony
[sbp.git] / src / edu / berkeley / sbp / misc / CharToken.java
index 8804fee..87be340 100644 (file)
@@ -9,15 +9,14 @@ import edu.berkeley.sbp.util.*;
 import edu.berkeley.sbp.*;
 
 /** an implementation of Token for streams of Java <tt>char</tt> values */
-public class CharToken implements Token, IntegerTopology.IntegerMappable {
+public class CharToken implements Token, IntegerMappable {
 
     // Public //////////////////////////////////////////////////////////////////////////////
 
     public static class CharToStringParser extends Parser<CharToken,String> {
-        public CharToStringParser(Union u) { super(u); }
-        public Topology<CharToken> top() { return new IntegerTopology<CharToken>(); }
+        public CharToStringParser(Union u) { super(u, new IntegerTopology<CharToken>()); }
         public Forest<String> shiftedToken(CharToken ct, Token.Location loc) {
-            return Forest.create(loc, ct.result(), null, null, false, false);
+            return Forest.create(loc, ct.result(), null, false, false);
         }
     }
 
@@ -154,7 +153,7 @@ public class CharToken implements Token, IntegerTopology.IntegerMappable {
         long then = 0;
         private Token.Location location = new LocWrap(1, 1);
         public Token.Location getLocation() { return location; }
-        public Token next() throws IOException {
+        public Token next(int numstates, int resets, int waits) throws IOException {
             int i = r.read();
             if (i==-1) return null;
             char c = (char)i;
@@ -163,10 +162,12 @@ public class CharToken implements Token, IntegerTopology.IntegerMappable {
             String s = line + "";
             while(s.length() < 4) s = " " + s;
             s = "line "+s+", col " + col;
+            while(s.length() < 20) s += " ";
+            s += "[ambiguity level: " + (numstates-1) + "] [resets: " + resets + "] [waits: " + waits + "]";
             long now = System.currentTimeMillis();
             if (now-then > 10) {
                 then = now;
-                System.out.print("  "+(message==null?"":message)+" " + s + "                                                                      \r");
+                System.out.print("  "+(message==null?"":message)+" " + s + "                                \r");
             }
             if (c=='\n') { 
                 currentLine = new Line();