ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
ctor
deferred_resn
demangler
enum
forall-pointer-decay
gc_noraii
jacob/cs343-translation
jenkins-sandbox
memory
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
string
with_gc
|
Last change
on this file since 643a2e1 was ea3eb06, checked in by Peter A. Buhr <pabuhr@…>, 11 years ago |
|
formatting changes
|
-
Property mode
set to
100644
|
|
File size:
732 bytes
|
| Line | |
|---|
| 1 | #ifndef SYMTAB_STACKTABLE_H
|
|---|
| 2 | #define SYMTAB_STACKTABLE_H
|
|---|
| 3 |
|
|---|
| 4 | #include <map>
|
|---|
| 5 | #include <stack>
|
|---|
| 6 | #include <string>
|
|---|
| 7 | #include <functional>
|
|---|
| 8 |
|
|---|
| 9 | namespace SymTab {
|
|---|
| 10 | template< typename Element, typename ConflictFunction >
|
|---|
| 11 | class StackTable {
|
|---|
| 12 | public:
|
|---|
| 13 | StackTable();
|
|---|
| 14 |
|
|---|
| 15 | void enterScope();
|
|---|
| 16 | void leaveScope();
|
|---|
| 17 | void add( Element *type );
|
|---|
| 18 | void add( std::string fwdDeclName );
|
|---|
| 19 | Element *lookup( std::string id ) const;
|
|---|
| 20 |
|
|---|
| 21 | void dump( std::ostream &os ) const; // debugging
|
|---|
| 22 | private:
|
|---|
| 23 | typedef std::pair< Element*, int > Entry;
|
|---|
| 24 | typedef std::map< std::string, std::stack< Entry > > TableType;
|
|---|
| 25 |
|
|---|
| 26 | ConflictFunction conflictFunction;
|
|---|
| 27 | TableType table;
|
|---|
| 28 | int scopeLevel;
|
|---|
| 29 | };
|
|---|
| 30 | } // SymTab
|
|---|
| 31 |
|
|---|
| 32 | #include "StackTable.cc"
|
|---|
| 33 |
|
|---|
| 34 | #endif // SYMTAB_STACKTABLE_H
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.