-
Notifications
You must be signed in to change notification settings - Fork 0
/
ScopeTable.h
50 lines (42 loc) · 1.18 KB
/
ScopeTable.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* File: ScopeTable.h
* Author: daniel
*
* Created on October 27, 2013, 11:41 PM
*/
#ifndef SCOPETABLE_H
#define SCOPETABLE_H
#include <vector>
#include "EncounteredError.h"
#include "IdentificationTableItem.h"
#include "Admin.h"
class ASTDeclarationNode;
/* This class handles the access and identification tables for the scope
* analyzer. At any level of scope, this class can produce the set of
* available identifiers and their respective AST nodes
*/
class ScopeTable {
public:
ScopeTable();
ScopeTable(Admin * adminRef);
ScopeTable(const ScopeTable& orig);
virtual ~ScopeTable();
// Not using this function in the current implementation
void initAccessTable(int length);
// Scope/declaration-related functions
bool isInScope(int id);
void insertDeclaration(int id, ASTDeclarationNode * decNode);
ASTDeclarationNode * getDeclaration(int id, int lineNumber);
void enterBlock();
void exitBlock();
private:
int blockLevel;
vector<int> accessTable;
vector<EncounteredError> errEnc;
vector<IdentificationTableItem> identificationTable;
Admin * admin;
bool isInErrEnc(int id);
void addToErrEnc(int id);
void removeBlockFromErrEnc();
};
#endif /* SCOPETABLE_H */