source: translator/SymTab/StackTable.h @ 1db2c5be

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 1db2c5be was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

initial commit

  • Property mode set to 100644
File size: 869 bytes
Line 
1/*
2 * This file is part of the Cforall project
3 *
4 * $Id: StackTable.h,v 1.2 2002/09/19 21:02:44 rcbilson Exp $
5 *
6 */
7
8#ifndef SYMTAB_STACKTABLE_H
9#define SYMTAB_STACKTABLE_H
10
11#include <map>
12#include <stack>
13#include <string>
14#include <functional>
15
16namespace SymTab {
17
18template< typename Element, typename ConflictFunction >
19class StackTable
20{
21public:
22  StackTable();
23
24  void enterScope();
25  void leaveScope();
26  void add( Element *type );
27  void add( std::string fwdDeclName );
28  Element *lookup( std::string id ) const;
29
30  void dump( std::ostream &os ) const; // debugging
31 
32private:
33  typedef std::pair< Element*, int > Entry;
34  typedef std::map< std::string, std::stack< Entry > > TableType;
35 
36  ConflictFunction conflictFunction;
37  TableType table;
38  int scopeLevel;
39};
40
41} // namespace SymTab
42
43#include "StackTable.cc"
44
45#endif /* #ifndef SYMTAB_STACKTABLE_H */
Note: See TracBrowser for help on using the repository browser.