50 class CSymtabEntry :
public map<CSymbol*,T1*>
53 CSymtabEntry* previous;
59 CSymtabEntry( CSymtabEntry* parent )
68 CSymtabEntry* GetPrevious() {
77 T1* Lookup(
CSymbol* key,
int skip=0 )
80 typename map<CSymbol*,T1*>::iterator ptr;
83 ptr = this->find( key );
84 if( skip==0 && ptr != this->end() ) {
88 result = previous->Lookup( key, skip>0 ? skip-1 : 0 );
101 typename map<CSymbol*,T1*>::iterator ptr;
104 ptr = this->find( key );
105 if( ptr != this->end() ) {
106 result = ptr->second;
111 void Dump( FILE *f,
int recurse,
int level = 0 )
113 typename map<CSymbol*,T1*>::iterator ptr;
115 for( ptr = this->begin(); ptr != this->end(); ++ptr) {
116 printf(
"\t%d::%s => ", level, ptr->first->GetName() );
117 ptr->second->DumpDeclInfo( f );
119 if( recurse && previous != NULL ) {
120 previous->Dump( f, recurse, level+1 );
139 CSymtabEntry<T1>* table;
140 list<CSymtab<T1> > importPath;
146 static T1* Resolve(
CSymbol* sym );
153 table =
new CSymtabEntry<T1>( NULL );
160 MASSERT( table != NULL );
162 table = table->GetPrevious();
169 table =
new CSymtabEntry<T1>( table );
192 return table->LookupTop( sym );
202 T1* Lookup(
CSymbol* sym,
int skip = 0 )
204 T1* result = table->Lookup( sym, skip );
206 typename list<CSymtab<T1> >::iterator ptr;
207 for( ptr = importPath.begin(); ptr != importPath.end(); ++ptr ) {
208 result = ptr->Lookup( sym );
219 result = Resolve( sym );
233 importPath.push_back( table );
241 void Dump( FILE *f,
int recurse )
243 table->
Dump( f, recurse );
248 #endif // CSYMTAB_HPP
void Add(double *r, double *a, double *b)
Definition: cnode.h:682
Aux class used to create symbol table scoping.
Definition: csymtab.h:135
Holder for character strings.
Definition: csymbol.h:44
void Dump(FILE *f, int recurse)
Dump all symbols in table to file descriptor.
Definition: csymtab.h:240