ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change
on this file since 48e99f2 was
ea3eb06,
checked in by Peter A. Buhr <pabuhr@…>, 10 years ago
|
formatting changes
|
-
Property mode set to
100644
|
File size:
732 bytes
|
Rev | Line | |
---|
[51b7345] | 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 { |
---|
[ea3eb06] | 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; |
---|
[51b7345] | 25 | |
---|
[ea3eb06] | 26 | ConflictFunction conflictFunction; |
---|
| 27 | TableType table; |
---|
| 28 | int scopeLevel; |
---|
| 29 | }; |
---|
| 30 | } // SymTab |
---|
[51b7345] | 31 | |
---|
| 32 | #include "StackTable.cc" |
---|
| 33 | |
---|
[ea3eb06] | 34 | #endif // SYMTAB_STACKTABLE_H |
---|
Note: See
TracBrowser
for help on using the repository browser.