Changeset c8ffe20b for translator/Parser/TypedefTable.h
- Timestamp:
- Nov 15, 2014, 10:46:42 PM (10 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 1ead581
- Parents:
- 8c17ab0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/Parser/TypedefTable.h
r8c17ab0 rc8ffe20b 1 /*2 * This file is part of the Cforall project3 *4 * $Id: TypedefTable.h,v 1.5 2003/05/11 15:24:05 rcbilson Exp $5 *6 */7 8 1 #ifndef TYPEDEFTABLE_H 9 2 #define TYPEDEFTABLE_H … … 14 7 #include <stack> 15 8 16 class TypedefTable 17 { 9 class TypedefTable { 18 10 public: 19 11 enum kind_t { ID, TD, TG }; 20 12 private: 21 struct Entry 22 { 13 struct Entry { 23 14 int scope; 24 15 kind_t kind; 25 16 }; 26 17 27 struct DeferredEntry 28 { 29 std::string identifier; 30 kind_t kind; 18 struct DeferredEntry { 19 std::string identifier; 20 kind_t kind; 31 21 }; 32 22 … … 44 34 std::stack< std::string > nextIdentifiers; 45 35 46 bool isKind( std::string identifier, kind_t kind) const;47 void addToScope( const std::string &identifier, kind_t kind, int scope);36 bool isKind( std::string identifier, kind_t kind ) const; 37 void addToScope( const std::string &identifier, kind_t kind, int scope ); 48 38 public: 49 39 TypedefTable(); 50 40 51 bool isIdentifier( std::string identifier) const;52 bool isTypedef( std::string identifier) const;53 bool isTypegen( std::string identifier) const;41 bool isIdentifier( std::string identifier ) const; 42 bool isTypedef( std::string identifier ) const; 43 bool isTypegen( std::string identifier ) const; 54 44 55 // "addToCurrentScope" adds the identifier/type pair to the current scope This does less 56 // than you think it does, since each declaration is within its own scope. Mostly useful for 57 // type parameters. 58 void addToCurrentScope(const std::string &identifier, kind_t kind); 59 void addToCurrentScope(kind_t kind); // use nextIdentifiers.top() 45 // "addToCurrentScope" adds the identifier/type pair to the current scope This does less than you think it does, 46 // since each declaration is within its own scope. Mostly useful for type parameters. 47 void addToCurrentScope( const std::string &identifier, kind_t kind ); 48 void addToCurrentScope( kind_t kind ); // use nextIdentifiers.top() 60 49 61 // "addToEnclosingScope" adds the identifier/type pair to the scope that encloses the current 62 // one. This is theright way to handle type and typedef names63 void addToEnclosingScope( const std::string &identifier, kind_t kind);64 void addToEnclosingScope( kind_t kind);// use nextIdentifiers.top()50 // "addToEnclosingScope" adds the identifier/type pair to the scope that encloses the current one. This is the 51 // right way to handle type and typedef names 52 void addToEnclosingScope( const std::string &identifier, kind_t kind ); 53 void addToEnclosingScope( kind_t kind ); // use nextIdentifiers.top() 65 54 66 // "addToEnclosingScope2" adds the identifier/type pair to the scope that encloses the scope 67 // enclosing the thecurrent one. This is the right way to handle assertion names68 void addToEnclosingScope2( const std::string &identifier, kind_t kind);69 void addToEnclosingScope2( kind_t kind);// use nextIdentifiers.top()55 // "addToEnclosingScope2" adds the identifier/type pair to the scope that encloses the scope enclosing the the 56 // current one. This is the right way to handle assertion names 57 void addToEnclosingScope2( const std::string &identifier, kind_t kind ); 58 void addToEnclosingScope2( kind_t kind ); // use nextIdentifiers.top() 70 59 71 // set the next identifier to be used by an "add" operation without an identifier parameter 72 // within the current scope 60 // set the next identifier to be used by an "add" operation without an identifier parameter within the current scope 73 61 void setNextIdentifier( const std::string &identifier ); 74 62 … … 76 64 void openContext( std::string contextName ); 77 65 78 void enterScope( void);79 void leaveScope( void);66 void enterScope( void ); 67 void leaveScope( void ); 80 68 void enterContext( std::string contextName ); 81 void leaveContext( void);69 void leaveContext( void ); 82 70 83 void print( void) const;71 void print( void ) const; 84 72 }; 85 73 86 #endif / * ifndef TYPEDEFTABLE_H */74 #endif // TYPEDEFTABLE_H
Note: See TracChangeset
for help on using the changeset viewer.