equal
deleted
inserted
replaced
89 insert_noduplicate(name->value, new_value); |
89 insert_noduplicate(name->value, new_value); |
90 } |
90 } |
91 #endif |
91 #endif |
92 |
92 |
93 |
93 |
|
94 |
|
95 /* Determine how many entries are associated to key identifier_str */ |
|
96 /* returns: |
|
97 * 0: if no entry is found |
|
98 * 1: if 1 entry is found |
|
99 * 2: if more than 1 entry is found |
|
100 */ |
|
101 template<typename value_type, value_type null_value> |
|
102 int dsymtable_c<value_type, null_value>::multiplicity(const char *identifier_str) { |
|
103 iterator lower = _base.lower_bound(identifier_str); |
|
104 if (lower == _base.end()) return 0; |
|
105 |
|
106 iterator upper = _base.upper_bound(identifier_str); |
|
107 iterator second = lower; |
|
108 second++; |
|
109 |
|
110 if (second == upper) return 1; |
|
111 |
|
112 return 2; |
|
113 } |
|
114 |
|
115 |
94 /* returns null_value if not found! */ |
116 /* returns null_value if not found! */ |
95 template<typename value_type, value_type null_value> |
117 template<typename value_type, value_type null_value> |
96 value_type dsymtable_c<value_type, null_value>::find_value(const char *identifier_str) { |
118 value_type dsymtable_c<value_type, null_value>::find_value(const char *identifier_str) { |
97 iterator i = _base.find(identifier_str); |
119 iterator i = _base.find(identifier_str); |
98 |
120 |
102 return i->second; |
124 return i->second; |
103 } |
125 } |
104 |
126 |
105 |
127 |
106 template<typename value_type, value_type null_value> |
128 template<typename value_type, value_type null_value> |
107 value_type dsymtable_c<value_type, null_value>::find_value(const symbol_c *symbol) { |
129 const char * dsymtable_c<value_type, null_value>::symbol_to_string(const symbol_c *symbol) { |
108 const token_c *name = dynamic_cast<const token_c *>(symbol); |
130 const token_c *name = dynamic_cast<const token_c *>(symbol); |
109 if (name == NULL) |
131 if (name == NULL) |
110 ERROR; |
132 ERROR; |
111 return find_value(name->value); |
133 return name->value; |
112 } |
134 } |
113 |
135 |
114 |
136 |
115 /* debuging function... */ |
137 /* debuging function... */ |
116 template<typename value_type, value_type null_value> |
138 template<typename value_type, value_type null_value> |