00001
00002
00003 #ifndef namespace_h
00004 #define namespace_h
00005
00006 #include <string>
00007 #include "symbol_table.h"
00008 #include "scope.h"
00009
00010
00011
00012
00013
00014
00015 class Namespace_symbol;
00016 class Function_body_queue;
00024 class Namespace_scope : public Abstract_scope {
00025 std::string prefix;
00026 Namespace_symbol* sym;
00027 Function_body_queue* fbqueue;
00028 public:
00029
00030 public:
00031
00032 Namespace_scope(Namespace_scope* parent, std::string prefix);
00033
00034 Namespace_scope(Namespace_scope* parent, Namespace_symbol* sym);
00035
00036 std::string get_unique_name(std::string name);
00037
00038 Type get_this_type() const;
00039
00041 Symbol_pair lookup_here(std::string name, bool for_decl);
00042
00043 void add_symbol(std::string name, Symbol* sym);
00044
00046 Variable_symbol* add_variable(Storage_class_specifier storage, Type type, Ptree* name, Ptree* init, Ptree* bitsize);
00047
00048 Function_signature* add_function_decl(Storage_class_specifier storage, Function_specifier_set fspec, Type type, const Symbol_name& sym_name);
00049
00050 void add_function_implementation(Function_signature* fsig, Block_scope* scope, Ptree* tree, Ptree* initializer);
00051
00052 void process_pending();
00053 };
00054
00055 class Namespace_symbol : public Symbol {
00056
00057 public:
00058
00059 Namespace_symbol();
00060
00061 Symbol::Kind get_kind() const;
00062
00063 Namespace_scope* get_scope();
00064 };
00065
00066 #endif // namespace_h