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 d4778a6 was bdd516a, checked in by Peter A. Buhr <pabuhr@…>, 11 years ago |
|
fixed sizeof type variable, find lowest cost alternative for sizeof expression, removed unused classes, added compiler flag, remove temporary file for -CFA, formatting
|
-
Property mode
set to
100644
|
|
File size:
821 bytes
|
| Line | |
|---|
| 1 | #ifndef SYMTAB_IDTABLE_H
|
|---|
| 2 | #define SYMTAB_IDTABLE_H
|
|---|
| 3 |
|
|---|
| 4 | #include <iostream>
|
|---|
| 5 | #include <map>
|
|---|
| 6 | #include <string>
|
|---|
| 7 | #include <stack>
|
|---|
| 8 |
|
|---|
| 9 | #include "SynTree/SynTree.h"
|
|---|
| 10 |
|
|---|
| 11 | namespace SymTab {
|
|---|
| 12 | class IdTable {
|
|---|
| 13 | public:
|
|---|
| 14 | IdTable();
|
|---|
| 15 |
|
|---|
| 16 | void enterScope();
|
|---|
| 17 | void leaveScope();
|
|---|
| 18 | void addDecl( DeclarationWithType *decl );
|
|---|
| 19 | void lookupId( const std::string &id, std::list< DeclarationWithType* >& decls ) const;
|
|---|
| 20 | DeclarationWithType* lookupId( const std::string &id) const;
|
|---|
| 21 |
|
|---|
| 22 | void dump( std::ostream &os ) const; // debugging
|
|---|
| 23 |
|
|---|
| 24 | private:
|
|---|
| 25 | typedef std::pair< DeclarationWithType*, int > DeclEntry;
|
|---|
| 26 | typedef std::map< std::string, std::stack< DeclEntry > > InnerTableType;
|
|---|
| 27 | typedef std::map< std::string, InnerTableType > OuterTableType;
|
|---|
| 28 |
|
|---|
| 29 | OuterTableType table;
|
|---|
| 30 | int scopeLevel;
|
|---|
| 31 | };
|
|---|
| 32 | } // namespace SymTab
|
|---|
| 33 |
|
|---|
| 34 | #endif // SYMTAB_IDTABLE_H
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.