-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSymbol.cpp
54 lines (43 loc) · 838 Bytes
/
Symbol.cpp
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
50
51
52
53
54
#include "Symbol.hpp"
#include "Computer.hpp"
Symbol::Symbol()
{
}
Symbol::Symbol(Symbol const &rhs)
{
*this = rhs;
}
void* Symbol::operator new(size_t size)
{
void * p = malloc(size);
Computer::init().addAllocatedAddress(p);
return p;
}
void Symbol::operator delete(void* ptr)
{
Computer::init().removeAllocatedAddress(ptr);
std::free(ptr);
}
Symbol::Symbol(int type, int priority, string name) : _type(type), _priority(priority), _name(name)
{
}
int Symbol::getType() const
{
return this->_type;
}
int Symbol::getPriority() const
{
return this->_priority;
}
int Symbol::getTokenIndex() const
{
return this->_tokenIndex;
}
string Symbol::getName() const
{
return this->_name;
}
void Symbol::setTokenIndex(int idx)
{
this->_tokenIndex = idx;
}