5 public class TokenLiteralExpr extends LiteralExpr {
10 static int count = 100;
11 static Hashtable tokens = new Hashtable();
13 public TokenLiteralExpr(String token) {
15 td = ReservedTypeDescriptor.INT;
17 if (tokens.contains(token)) {
18 num = (Integer) tokens.get(token);
20 num = new Integer(count++);
21 tokens.put(token, num);
25 public String getValue() {
29 public void generate(CodeWriter writer, VarDescriptor dest) {
30 writer.outputline("int " + dest.getSafeSymbol() + " = " + num.toString().toString() + ";");
33 public void prettyPrint(PrettyPrinter pp) {
34 pp.output("{" + token + " = " + num + "}");
37 public TypeDescriptor typecheck(SemanticAnalyzer sa) {
38 td = ReservedTypeDescriptor.INT;