-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.py
43 lines (36 loc) · 828 Bytes
/
settings.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
from constants import subInit, label, iSwitchStack
# This is called only once in main
def init():
global stack
global debug
global point
global sub
global callstack
global substack
global gotoMap
global dictOfStacks
stack = []
dictOfStacks = {}
substack = []
sub = {}
gotoMap = {}
callstack = []
debug = False
point = 0
def cleanCode(code):
cleanedCode = []
for line in code:
if line.split() != []:
cleanedCode.append(line)
return cleanedCode
def mapCode(code):
i = 0
for line in code:
l = line.split()
if l[0] == subInit:
sub[l[1]] = i+1
if l[0] == label:
gotoMap[l[1]] = i+1
if l[0] == iSwitchStack:
dictOfStacks[l[1]] = []
i += 1