source:
src/Parser/TypedefTable.h
@
dcf1979
Last change on this file since dcf1979 was 60a8062, checked in by , 5 years ago | |
---|---|
|
|
File size: 1.5 KB |
Rev | Line | |
---|---|---|
[b87a5ed] | 1 | // |
2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo | |
3 | // | |
4 | // The contents of this file are covered under the licence agreement in the | |
5 | // file "LICENCE" distributed with Cforall. | |
6 | // | |
[be9288a] | 7 | // TypedefTable.h -- |
[b87a5ed] | 8 | // |
[7fdb94e] | 9 | // Author : Peter A. Buhr |
[b87a5ed] | 10 | // Created On : Sat May 16 15:24:36 2015 |
11 | // Last Modified By : Peter A. Buhr | |
[60a8062] | 12 | // Last Modified On : Sat Feb 15 08:06:37 2020 |
13 | // Update Count : 117 | |
[b87a5ed] | 14 | // |
15 | ||
[6b0b624] | 16 | #pragma once |
[51b7345] | 17 | |
[7fdb94e] | 18 | #include <string> // for string |
[51b7345] | 19 | |
[7fdb94e] | 20 | #include "Common/ScopedMap.h" // for ScopedMap |
[be9288a] | 21 | #include "ParserTypes.h" |
[7fdb94e] | 22 | #include "parser.hh" // for IDENTIFIER, TYPEDEFname, TYPEGENname |
[984dce6] | 23 | |
[c8ffe20b] | 24 | class TypedefTable { |
[fc20514] | 25 | struct Note { size_t level; bool forall; }; |
26 | typedef ScopedMap< std::string, int, Note > KindTable; | |
[7fdb94e] | 27 | KindTable kindTable; |
[fc20514] | 28 | unsigned int level = 0; |
[51b7345] | 29 | public: |
[7fdb94e] | 30 | ~TypedefTable(); |
[45161b4d] | 31 | |
[60a8062] | 32 | bool exists( const std::string & identifier ) const; |
33 | bool existsCurr( const std::string & identifier ) const; | |
[7fdb94e] | 34 | int isKind( const std::string & identifier ) const; |
[a1c9ddd] | 35 | void makeTypedef( const std::string & name, int kind = TYPEDEFname ); |
[ecae5860] | 36 | void addToScope( const std::string & identifier, int kind, const char * ); |
37 | void addToEnclosingScope( const std::string & identifier, int kind, const char * ); | |
[fc20514] | 38 | bool getEnclForall() { return kindTable.getNote( kindTable.currentScope() - 1 ).forall; } |
[be9288a] | 39 | |
[b87a5ed] | 40 | void enterScope(); |
41 | void leaveScope(); | |
[3d26610] | 42 | |
[fc20514] | 43 | void up( bool ); |
44 | void down(); | |
[3d56d15b] | 45 | |
[3d26610] | 46 | void print( void ) const; |
[7fdb94e] | 47 | }; // TypedefTable |
[51b7345] | 48 | |
[b87a5ed] | 49 | // Local Variables: // |
50 | // tab-width: 4 // | |
51 | // mode: c++ // | |
52 | // compile-command: "make install" // | |
53 | // End: // |
Note: See TracBrowser
for help on using the repository browser.