1 package java_cup; 2 3 16 public abstract class symbol { 17 18 19 20 21 25 public symbol(String nm, String tp) 26 { 27 28 if (nm == null) nm = ""; 29 30 31 if (tp == null) tp = "Object"; 32 33 _name = nm; 34 _stack_type = tp; 35 } 36 37 38 39 42 public symbol(String nm) 43 { 44 this(nm, null); 45 } 46 47 48 49 50 51 52 protected String _name; 53 54 55 public String name() {return _name;} 56 57 58 59 60 protected String _stack_type; 61 62 63 public String stack_type() {return _stack_type;} 64 65 66 67 68 protected int _use_count = 0; 69 70 71 public int use_count() {return _use_count;} 72 73 74 public void note_use() {_use_count++;} 75 76 77 78 82 protected int _index; 83 84 88 public int index() {return _index;} 89 90 91 92 95 public abstract boolean is_non_term(); 96 97 98 99 100 public String toString() 101 { 102 return name(); 103 } 104 105 106 107 } 108 | Popular Tags |