X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2Fmisc%2FCharToken.java;h=8efdb0497d06ae7714a777af8f2a76222d78c8fe;hp=2042145e68de43cce3b8b49737c82d2aceb1e24f;hb=d684010debf9069af108981d9451932c15b1ec75;hpb=3473141880127c6aa52d094d51739e5eb67f1703
diff --git a/src/edu/berkeley/sbp/misc/CharToken.java b/src/edu/berkeley/sbp/misc/CharToken.java
index 2042145..8efdb04 100644
--- a/src/edu/berkeley/sbp/misc/CharToken.java
+++ b/src/edu/berkeley/sbp/misc/CharToken.java
@@ -4,18 +4,17 @@ import java.util.*;
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 char values */
-public class CharToken implements Token, IntegerMappable {
+public class CharToken implements IntegerMappable {
// Public //////////////////////////////////////////////////////////////////////////////
public static class CharToStringParser extends Parser {
public CharToStringParser(Union u) { super(u, new IntegerTopology()); }
- public Forest shiftToken(CharToken ct, Token.Location loc) {
+ public Forest shiftToken(CharToken ct, Location loc) {
return Forest.create(loc, ct.result(), null, false, false);
}
}
@@ -117,7 +116,7 @@ public class CharToken implements Token, IntegerMappable {
}
/** an implementation of Token.Stream for sequences of characters */
- public static class Stream implements Token.Stream {
+ public static class Stream implements Token.Stream {
private final String message;
private final Reader r;
private int line = 1;
@@ -151,14 +150,14 @@ public class CharToken implements Token, IntegerMappable {
}
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;