summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorp4bl0 <r _at_ uzy .dot. me>2018-07-04 19:49:08 (CEST)
committerp4bl0 <r _at_ uzy .dot. me>2018-07-04 19:49:08 (CEST)
commitd1ab62dd30456ab40d31e378c2cdbf4eaa2dcc46 (patch)
tree329657534b5ae08c8385e507a7bc8d40a763fd1d
parente7832d330281d5e46bfe4d0480c4b643e907c2cf (diff)
downloadseselab-d1ab62dd30456ab40d31e378c2cdbf4eaa2dcc46.zip
seselab-d1ab62dd30456ab40d31e378c2cdbf4eaa2dcc46.tar.gz
keep both source and target labels
-rw-r--r--compiler.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler.py b/compiler.py
index 9f2b839..abf96a0 100644
--- a/compiler.py
+++ b/compiler.py
@@ -192,7 +192,7 @@ class Compiler:
else:
a = self.instr(l)
if a is not None:
- self._code.append([a, (self._files[-1], self._ln[-1])])
+ self._code.append([a, [self._files[-1], self._ln[-1]]])
self._count += 1
self._ln[-1] += 1
self._files.pop()
@@ -201,7 +201,7 @@ class Compiler:
def compile (self, path):
try:
- self._code.append([['jmp', ('lbl', 'main')], ('_', -1)])
+ self._code.append([['jmp', ('lbl', 'main')], ['_', -1]])
self._count += 1
self.compile_file(os.path.abspath(path))
for instr in self._code:
@@ -210,12 +210,14 @@ class Compiler:
lbl = instr[0][1][1]
if lbl in self._labels:
instr[0][1] = 'imm', self._labels[lbl][0]
- # instr[1] = instr[1][0], instr[1][1], lbl
+ instr[1].append(lbl)
else:
raise LabelNotFound(lbl, instr[1][0], instr[1][1])
for lbl in self._labels:
instr = self._code[self._labels[lbl][0]]
- instr[1] = instr[1][0], instr[1][1], lbl
+ if len(instr[1]) == 2:
+ instr[1].append(None)
+ instr[1].append(lbl)
return self._code
except ParseError as e:
Pablo Rauzy — generated by cgit