import java.lang.reflect.*;
import java.lang.ref.*;
import edu.berkeley.sbp.*;
-import edu.berkeley.sbp.*;
+import edu.berkeley.sbp.Token.Location;
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, IntegerMappable {
+public class CharToken implements IntegerMappable {
// Public //////////////////////////////////////////////////////////////////////////////
public static class CharToStringParser extends Parser<CharToken,String> {
public CharToStringParser(Union u) { super(u, new IntegerTopology<CharToken>()); }
- public Forest<String> shiftToken(CharToken ct, Token.Location loc) {
+ public Forest<String> shiftToken(CharToken ct, Location loc) {
return Forest.create(loc, ct.result(), null, false, false);
}
}
}
/** an implementation of Token.Stream for sequences of characters */
- public static class Stream implements Token.Stream {
+ public static class Stream implements Token.Stream<CharToken> {
private final String message;
private final Reader r;
private int line = 1;
}
long then = 0;
- private Token.Location location = new LocWrap(1, 1);
- public Token.Location getLocation() { return location; }
- public Token next(int numstates, int resets, int waits) throws IOException {
+ private Location location = new LocWrap(1, 1);
+ public Location getLocation() { return location; }
+ public CharToken next(int numstates, int resets, int waits) throws IOException {
int i = r.read();
if (i==-1) return null;
char c = (char)i;
location = new LocWrap(line, col);
- Token ret = new CharToken(c);
+ CharToken ret = new CharToken(c);
String s = line + "";
while(s.length() < 4) s = " " + s;
s = "line "+s+", col " + col;