add working preprocessor (creates docstrings)
[sv2nmigen.git] / absyn.py
index d52250206719fbefcd53b2dba3c660b529f8ef9a..7d54d6e3e76092384e6c00ff19e03f6cb0b2ddc3 100644 (file)
--- a/absyn.py
+++ b/absyn.py
@@ -39,8 +39,8 @@ class Assignment:
         self.right = right
 
 class Absyn:
-    def __init__(self):
-        self.outputfile = open("output.py","w")
+    def __init__(self,outputfn):
+        self.outputfile = open(outputfn,"w")
         self.outputfile.write(preamble)
         self.assign = []
         self.ports = []
@@ -147,7 +147,13 @@ class Absyn:
         print(str(clsdecl))
         return clsdecl
 
+    def appendComments(self,data):
+        self.outputfile.write(data)
+        #lines = data.split("\n")
+        #for line in lines:
+        #    self.printpy("#"+line)
+
     # combinatorical assign
     def cont_assign_1(self,p):
-       print("#ASSIGN:BROKEN"+str(list(p)))
+       print("#ASSIGN:BROKEN"+str(list(p)))
        self.assign += [Assignment(p[1],p[2],p[3])]