6 * represents a symbol in the language (var name, function name, etc).
9 public class TypeDescriptor extends Descriptor {
10 public static final int BYTE=1;
11 public static final int SHORT=2;
12 public static final int INT=3;
13 public static final int LONG=4;
14 public static final int CHAR=5;
15 public static final int BOOLEAN=6;
16 public static final int FLOAT=7;
17 public static final int DOUBLE=8;
18 public static final int VOID=9;
19 public static final int NULL=10;
20 public static final int CLASS=11;
25 ClassDescriptor class_desc;
27 public boolean isNumber() {
28 return (isIntegerType()||isFloat()||isDouble());
31 public boolean isByte() {
34 public boolean isNull() {
37 public boolean isShort() {
40 public boolean isInt() {
43 public boolean isLong() {
46 public boolean isChar() {
49 public boolean isBoolean() {
52 public boolean isFloat() {
55 public boolean isDouble() {
58 public boolean isVoid() {
62 public boolean isPtr() {
63 return (isClass()||isNull());
66 public boolean isIntegerType() {
67 return (isInt()||isLong()||isShort()||isChar()||isByte());
70 public void setClassDescriptor(ClassDescriptor cd) {
74 public boolean isPrimitive() {
75 return ((type>=BYTE)&&(type<=DOUBLE));
78 public boolean isClass() {
82 public TypeDescriptor(NameDescriptor name) {
83 super(name.toString());
88 public ClassDescriptor getClassDesc() {
92 public TypeDescriptor(ClassDescriptor cd) {
93 super(cd.getSymbol());
98 public TypeDescriptor(int t) {
103 public String toString() {
107 return decodeInt(type);
110 private static String decodeInt(int type) {
113 else if (type==BOOLEAN)
115 else if (type==SHORT)
123 else if (type==FLOAT)
125 else if (type==DOUBLE)
131 else throw new Error();