diff -r bc90dd4bbf4f -r f86d5d6bb04e util/symtable.hh --- a/util/symtable.hh Fri Dec 26 10:09:27 2014 +0000 +++ b/util/symtable.hh Fri Dec 26 12:43:13 2014 +0000 @@ -81,7 +81,7 @@ public: symtable_c(void); - void reset(void); /* clear all entries... */ + void clear(void); /* clear all entries... */ void push(void); /* create new inner scope */ int pop(void); /* clear most inner scope */ @@ -91,10 +91,24 @@ void insert(const char *identifier_str, value_t value); // insert a new (string,value) pair. Give an error if string already in map associated to different value! void insert(const symbol_c *symbol, value_t value); // insert a new (string,value) pair. Give an error if string already in map associated to different value! + value_t operator[](const char *identifier_str); + value_t operator[](const std::string identifier_str); + // value_t operator[](const symbol_c *identifier ); // not yet implemented + + /* Since symtable_c does not allow duplicates in each level, count() will return + * - 0 : if not found in any level + * - n : number of level containing that entry (max is current number of levels!) + */ + int count(const char *identifier_str); + int count(const std::string identifier_str); + // int count(const symbol_c *identifier ); // not yet implemented + /* Search for an entry. Will return end() if not found */ + iterator begin(void); iterator end (void); - iterator find (const char *identifier_str); - iterator find (const symbol_c *symbol ); + iterator find (const char *identifier_str); + iterator find (const std::string identifier_str); + iterator find (const symbol_c *symbol ); /* iterators ... */