First page Back Continue Last page Summary Graphic
Scanner Framework (3)
void error(String message) {
try {
close();
} catch (IOException e) {}
throw new Error(message);
}
void close() throws IOException {
in.close();
}
public String representation() {
return tokenClass(token) +
((token == NUM) ? "(" + chars + ")" : "");
}
public static String tokenClass(int token) {
switch (token) {
case EOF: return "<eof>";
case NUM: return "number";
case LT: return "<";
case LTEQ: return "<=";
case EQ: return "==";
case NEQ: return "/=";
default: return "<unknown>";
}
}
}