projects
/
sv2nmigen.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6a8eb41
)
do not create output files on error
author
Tobias Platen
<tplaten@posteo.de>
Thu, 23 Jan 2020 12:12:48 +0000
(13:12 +0100)
committer
Tobias Platen
<tplaten@posteo.de>
Thu, 23 Jan 2020 12:12:48 +0000
(13:12 +0100)
absyn.py
patch
|
blob
|
history
diff --git
a/absyn.py
b/absyn.py
index 60a87ba077da641885a424a0b3b50903a9b11a01..e81e429510dd504feb19c6aa8921b23ff7b68c9a 100644
(file)
--- a/
absyn.py
+++ b/
absyn.py
@@
-46,12
+46,18
@@
class Assignment:
class Absyn:
def __init__(self, outputfn):
class Absyn:
def __init__(self, outputfn):
- self.outputf
ile = open(outputfn, "w")
- self.outputfile
.write(preamble)
+ self.outputf
n = outputfn
+ self.outputfile
= None
self.assign = []
self.ports = []
self.assign = []
self.ports = []
+ def open(self):
+ if(self.outputfile is None):
+ self.outputfile = open(self.outputfn, "w")
+ self.outputfile.write(preamble)
+
def printpy(self, p):
def printpy(self, p):
+ self.open()
self.outputfile.write(str(p)+"\n")
def assign(self, p):
self.outputfile.write(str(p)+"\n")
def assign(self, p):
@@
-159,6
+165,7
@@
class Absyn:
return clsdecl
def appendComments(self, data):
return clsdecl
def appendComments(self, data):
+ self.open()
self.outputfile.write(data)
#lines = data.split("\n")
# for line in lines:
self.outputfile.write(data)
#lines = data.split("\n")
# for line in lines: