vrq
Public Member Functions

CSymtab< T1 > Class Template Reference

Aux class used to create symbol table scoping. More...

#include <csymtab.h>

List of all members.

Public Member Functions

 CSymtab ()
 Create a symbol table.
void PopScope ()
 Jump back to parent scope.
void PushScope ()
 Create a new scope for table.
void Add (CSymbol *sym, T1 *obj)
 Add a symbol and it's assocated object at the current level.
T1 * LookupTop (CSymbol *sym)
 Lookup symbol only in current scope.
T1 * Lookup (CSymbol *sym)
 Lookup symbol in all scopes starting at the current scope.
void Dump (FILE *f, int recurse)
 Dump all symbols in table to file descriptor.

Detailed Description

template<class T1>
class CSymtab< T1 >

Aux class used to create symbol table scoping.

Class for a type safe hierarchical symbol table. Each level of the table represents a different nested scope. Searches a the leaves of the table seach upward to the table root if needed.


Constructor & Destructor Documentation

template<class T1>
CSymtab< T1 >::CSymtab (  )  [inline]

Create a symbol table.


Member Function Documentation

template<class T1>
void CSymtab< T1 >::Add ( CSymbol sym,
T1 *  obj 
) [inline]

Add a symbol and it's assocated object at the current level.

Create a new level if needed.

Parameters:
sym symbol to add to table.
obj object to associated with symbol.
template<class T1>
void CSymtab< T1 >::Dump ( FILE *  f,
int  recurse 
) [inline]

Dump all symbols in table to file descriptor.

Parameters:
f file descriptor.
recurse zero if only current depth should be dumped.
template<class T1>
T1* CSymtab< T1 >::Lookup ( CSymbol sym  )  [inline]

Lookup symbol in all scopes starting at the current scope.

Parameters:
sym symbol to search for.
Returns:
object associated with symbol. NULL if symbol is not found.
template<class T1>
T1* CSymtab< T1 >::LookupTop ( CSymbol sym  )  [inline]

Lookup symbol only in current scope.

Parameters:
sym symbol to search for.
Returns:
object associated with symbol. NULL if symbol is not found.
template<class T1>
void CSymtab< T1 >::PopScope (  )  [inline]

Jump back to parent scope.

template<class T1>
void CSymtab< T1 >::PushScope (  )  [inline]

Create a new scope for table.


The documentation for this class was generated from the following file: