The class translation is done I think
[fridhskrift.git] / symbol.cpp
blobfc180a6039830c6105761d3ae0c835117b0a8b54
1 #include <frith/symbol_tree_node.hpp>
3 namespace frith
5 symbol_tree_entity::symbol_tree_entity()
9 symbol_tree_entity::symbol_tree_entity(symbol::type type):
10 type(type)
12 switch(type)
14 case variable::variable:
15 variable_pointer = new variable;
16 break;
18 case variable::function:
19 function_pointer = new function;
20 break;
22 case variable::class_symbol:
23 class_pointer = new class_type;
24 break;
28 symbol_tree_node::symbol_tree_node():
29 parent(0)
33 bool symbol_tree_node::exists(std::string const & name)
35 scope_entities::iterator iterator = entities.find(name);
36 return iterator != entities.end();
39 bool symbol_tree_node::find_entity(std::string const & name, symbol_tree_node * & entity_scope_output, symbol_tree_entity * & entity_output)
41 scope_entities::iterator iterator = entities.find(name);
42 if(iterator == entities.end())
44 if(parent == 0)
45 return false;
46 return parent->find_entity(name, entitiy_scope_output, entity_output);
49 entity_scope_output = this;
50 entity_output = &iterator->second;
51 return true;