1 package edu.berkeley.sbp.misc;
4 import java.lang.reflect.*;
5 import java.lang.ref.*;
6 import edu.berkeley.sbp.*;
7 import edu.berkeley.sbp.Input.Location;
8 import edu.berkeley.sbp.util.*;
10 public abstract class CartesianInput<Token> implements Input<Token> {
12 public abstract Token next() throws IOException;
13 public abstract boolean isCR();
16 private CartesianLocation location = new CartesianLocation(1, 0);
17 public Input.Location getLocation() { return location; }
19 public Token next(int numstates, int resets, int waits) throws IOException {
20 int line = location.line;
21 int col = location.col;
23 if (t==null) return null;
24 String s = " line "+line+", col " + col;
25 while(s.length() < 20) s += " ";
26 s += "[ambiguity level: " + (numstates-1) + "] [resets: " + resets + "] [waits: " + waits + "]";
27 long now = System.currentTimeMillis();
30 System.out.print(s + " \r");
38 location = new CartesianLocation(line, col);