summaryrefslogtreecommitdiff
path: root/AsmParser.py
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2011-12-02 20:28:29 +0000
committerPeter Wu <lekensteyn@gmail.com>2011-12-02 20:28:29 +0000
commitd48fb25678e10c79bf8971892b8573fb7cb9e247 (patch)
tree61138630c541427793ff40bbc1c1e342539f7328 /AsmParser.py
parenta6f9617bd891074bba20cc1fc220e60a226e7fb4 (diff)
downloadpp2cc-d48fb25678e10c79bf8971892b8573fb7cb9e247.tar.gz
Use DW instead of DS, add ASM source, fix some coding errors
Diffstat (limited to 'AsmParser.py')
-rw-r--r--AsmParser.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/AsmParser.py b/AsmParser.py
index 4ab25ed..24755f6 100644
--- a/AsmParser.py
+++ b/AsmParser.py
@@ -29,7 +29,7 @@ class AsmParser(object):
self.defined_names = parent.defined_names
else:
self.parent = None
- self.data = []
+ self.data = {}
self.code = []
# defined labels for the assembly files
self.labels = []
@@ -99,7 +99,7 @@ class AsmParser(object):
if what == "DS":
# DS initializes names with zero, let's convert it to
# DW to make it compatible with the Parser
- self.addData(name, [0 for x in range(0, int(data))])
+ self.addData(name, ["0"] * int(data))
else:
self.addData(name, data.split(","))
line = ""
@@ -166,4 +166,7 @@ class AsmParser(object):
if self.parent:
raise RuntimeError("You can only get the lines for @CODE from the"
" root node")
- return [elm for elm in self.code]
+ return [str(elm) for elm in self.code]
+ def getDataDefinitions(self):
+ """Returns the data section as a dictionary"""
+ return self.data \ No newline at end of file