79 symtable_c *inner_scope; |
79 symtable_c *inner_scope; |
80 |
80 |
81 public: |
81 public: |
82 symtable_c(void); |
82 symtable_c(void); |
83 |
83 |
84 void reset(void); /* clear all entries... */ |
84 void clear(void); /* clear all entries... */ |
85 |
85 |
86 void push(void); /* create new inner scope */ |
86 void push(void); /* create new inner scope */ |
87 int pop(void); /* clear most inner scope */ |
87 int pop(void); /* clear most inner scope */ |
88 |
88 |
89 void set(const char *identifier_str, value_t value); // Will change value associated to string if already in map. Will create new entry if string not in map. |
89 void set(const char *identifier_str, value_t value); // Will change value associated to string if already in map. Will create new entry if string not in map. |
90 void set(const symbol_c *symbol, value_t value); // Will change value associated to string if already in map. Will create new entry if string not in map. |
90 void set(const symbol_c *symbol, value_t value); // Will change value associated to string if already in map. Will create new entry if string not in map. |
91 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! |
91 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! |
92 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! |
92 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! |
93 |
93 |
|
94 value_t operator[](const char *identifier_str); |
|
95 value_t operator[](const std::string identifier_str); |
|
96 // value_t operator[](const symbol_c *identifier ); // not yet implemented |
|
97 |
|
98 /* Since symtable_c does not allow duplicates in each level, count() will return |
|
99 * - 0 : if not found in any level |
|
100 * - n : number of level containing that entry (max is current number of levels!) |
|
101 */ |
|
102 int count(const char *identifier_str); |
|
103 int count(const std::string identifier_str); |
|
104 // int count(const symbol_c *identifier ); // not yet implemented |
|
105 |
94 /* Search for an entry. Will return end() if not found */ |
106 /* Search for an entry. Will return end() if not found */ |
|
107 iterator begin(void); |
95 iterator end (void); |
108 iterator end (void); |
96 iterator find (const char *identifier_str); |
109 iterator find (const char *identifier_str); |
97 iterator find (const symbol_c *symbol ); |
110 iterator find (const std::string identifier_str); |
|
111 iterator find (const symbol_c *symbol ); |
98 |
112 |
99 |
113 |
100 /* iterators ... */ |
114 /* iterators ... */ |
101 /* NOTE: These member functions are incorrect, as the returned iterator will not iterate through the inner_scopes!! */ |
115 /* NOTE: These member functions are incorrect, as the returned iterator will not iterate through the inner_scopes!! */ |
102 /* We simply comment it all out, as they are not currently needed! */ |
116 /* We simply comment it all out, as they are not currently needed! */ |