implemented PCLOC annotation.
[IRC.git] / Robust / src / IR / Descriptor.java
1 package IR;
2
3 /**
4  * Descriptor
5  *
6  * represents a symbol in the language (var name, function name, etc).
7  */
8
9 public abstract class Descriptor {
10
11   protected String name;
12   protected String safename;
13   static int count=0;
14   int uniqueid;
15
16   public Descriptor(String name) {
17     this.name = name;
18     this.safename = "___" + name + "___";
19     this.uniqueid=count++;
20   }
21
22   protected Descriptor(String name, String safename) {
23     this.name = name;
24     this.safename = safename;
25     this.uniqueid=count++;
26   }
27
28   public String toString() {
29     return name;
30   }
31
32   public String getSymbol() {
33     return name;
34   }
35
36   //the text replacement is done here because SOMEWHERE someone
37   //modifies safename without going through the constructor...
38   public String getSafeSymbol() {
39     return safename;
40   }
41
42   public int getNum() {
43     return uniqueid;
44   }
45
46   public String getCoreSafeSymbol(int num) {
47     return safename + "core" + num + "___";
48   }
49 }