diff python/ide.py @ 165:598d3888a11c

Added front class and fided AST view
author Windel Bouwman
date Fri, 22 Mar 2013 15:12:38 +0100
parents e023d3ce1d63
children 0b5b2ee6b435
line wrap: on
line diff
--- a/python/ide.py	Mon Mar 18 22:15:57 2013 +0100
+++ b/python/ide.py	Fri Mar 22 15:12:38 2013 +0100
@@ -14,6 +14,7 @@
 from codeedit import CodeEdit
 stutil = __import__('st-util')
 import testc3
+import c3
 
 lcfospng = base64.decodestring(b'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A\n/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJEhMKBk7B678AAAA/SURBVFjD\n7dbBCQAgDATBi9h/y7EFA4Kf2QLCwH1S6XQu6sqoujublc8BAAAAAAAAAAB8B+zXT6YJAAAAAKYd\nWSgFQNUyijIAAAAASUVORK5CYII=\n')
 
@@ -118,7 +119,6 @@
   def __init__(self, parent=None):
     super(Ide, self).__init__(parent)
     self.setWindowTitle('LCFOS IDE')
-    self.compiler = None # TODO
     icon = QPixmap()
     icon.loadFromData(lcfospng)
     self.setWindowIcon(QIcon(icon))
@@ -201,6 +201,7 @@
     ce.Source = testc3.testsrc
 
     self.diag = ppci.DiagnosticsManager()
+    self.c3front = c3.Builder(self.diag)
 
   # File handling:
   def newProject(self):
@@ -319,9 +320,9 @@
       ce = self.activeMdiChild()
       if not ce:
          return
-      if node.location:
-         row, col = node.location
-         ce.highlightErrorLocation( row, col )
+      if node.loc:
+         row, col = node.loc.row, node.loc.col
+         ce.setRowCol( row, col )
       else:
          ce.clearErrors()
 
@@ -340,9 +341,9 @@
      if ce:
         source = ce.Source
         self.buildOutput.clear()
-        self.buildOutput.append(str(self.compiler))
-        ast = testc3.c3compile(source, self.diag)
-        #ast = self.compiler.compilesource(source)
+        self.buildOutput.append('Starting build')
+        ir = self.c3front.build(source)
+        ast = self.c3front.pkg
         print('setting ast', ast)
         self.astViewer.setAst(ast)
         self.buildOutput.append("Done!")
@@ -351,9 +352,7 @@
      print('BUILD project')
      self.buildOutput.clear()
      self.diag.diags.clear()
-     self.buildOutput.append(str(self.compiler))
      self.buildFile()
-     #mods = self.compiler.compileProject(self.project)
 
      self.builderrors.setErrorList(self.diag.diags)
      #self.astViewer.setAst(mods[0])