-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDirectory.py
58 lines (46 loc) · 1.15 KB
/
Directory.py
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
55
56
57
58
class DirFunc:
def __init__(self):
self.dirFunc = {}
def addFunc(self,item):
self.dirFunc[item["name"]] = item
def getFuncByName(self,name):
if(name in self.dirFunc):
return self.dirFunc[name]
else:
return None
def addVarsTable(self,name, item):
if (name in self.dirFunc):
self.dirFunc[name]["table"] = item
return self.dirFunc[name]["table"]
else:
return None
def addParamsTable(self,name, item):
if (name in self.dirFunc):
self.dirFunc[name]["paramsTable"] = item
return self.dirFunc[name]["paramsTable"]
else:
return None
def addVar(self, name, type):
print('Add var')
class Vars:
def __init__(self):
self.data = {}
def addVar(self,item):
self.data[item["name"]] = item
def getVarByName(self,name):
if(name in self.data):
return self.data[name]
else:
return None
class ConstantsTable:
def __init__(self):
self.constants = {}
def addConstant(self, value, address):
self.constants[value] = {'name': value, 'address': address}
def getConstants(self):
return self.constants
def getConstantByValue(self,value):
if(value in self.constants):
return self.constants[value]
else:
return None