equal
deleted
inserted
replaced
114 inner_scope->insert(identifier_str, new_value); |
114 inner_scope->insert(identifier_str, new_value); |
115 return; |
115 return; |
116 } |
116 } |
117 |
117 |
118 // std::cout << "store_identifier(" << identifier_str << "): \n"; |
118 // std::cout << "store_identifier(" << identifier_str << "): \n"; |
|
119 iterator i = _base.find(identifier_str); |
|
120 if ((i != _base.end()) && (i->second != new_value)) {ERROR;} /* error inserting new identifier: identifier already in map associated to a different value */ |
|
121 if ((i != _base.end()) && (i->second == new_value)) {return;} /* identifier already in map associated with the same value */ |
|
122 |
119 std::pair<const char *, value_t> new_element(identifier_str, new_value); |
123 std::pair<const char *, value_t> new_element(identifier_str, new_value); |
120 std::pair<iterator, bool> res = _base.insert(new_element); |
124 std::pair<iterator, bool> res = _base.insert(new_element); |
121 if (!res.second) |
125 if (!res.second) {ERROR;} /* unknown error inserting new identifier */ |
122 /* error inserting new identifier... */ |
|
123 /* identifier already in map? */ |
|
124 ERROR; |
|
125 } |
126 } |
126 |
127 |
127 template<typename value_type, value_type null_value> |
128 template<typename value_type, value_type null_value> |
128 void symtable_c<value_type, null_value>::insert(const symbol_c *symbol, value_t new_value) { |
129 void symtable_c<value_type, null_value>::insert(const symbol_c *symbol, value_t new_value) { |
129 /* |
130 /* |