summaryrefslogtreecommitdiff
path: root/src/spiglet/spiglet2kanga/SpgSimpExpr.java
blob: eec575da3aa2fc0cfceb7ca1e3403bbf3d0fbcd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package spiglet.spiglet2kanga;

public class SpgSimpExpr extends SpgExpr {
	public enum SExprType { TEMP, INT, LB };
	SExprType type;
	public int num;
	public String s;
	
	public SpgSimpExpr(SExprType t) {
		super(SpgExpr.ExpType.Simple);
		type = t;
	}
	
	public String toString() {
		switch (type) {
		case INT:
			return String.valueOf(num);
		case LB:
			return s;
		case TEMP:
			return ((SpgTemp)this).toString();
		default:
			return null;
		
		}
	}
}