diff ide/compiler/compiler.py @ 5:818f80afa78b

Added handy highlighting to IDE
author windel-eee
date Thu, 22 Sep 2011 17:44:31 +0200
parents 92df07bc2081
children 1784af239df4
line wrap: on
line diff
--- a/ide/compiler/compiler.py	Wed Sep 21 19:05:18 2011 +0200
+++ b/ide/compiler/compiler.py	Thu Sep 22 17:44:31 2011 +0200
@@ -1,7 +1,7 @@
 import hashlib
 # Import compiler components:
 from . import lexer
-from . import parser
+from .parser import Parser
 from .codegenerator import CodeGenerator
 from .nodes import ExportedSymbol
 
@@ -16,8 +16,15 @@
 
    def compilesource(self, src):
       """ Front end that handles the stages: """
+      # Pass 1: parsing and type checking
       tokens = lexer.tokenize(src) # Lexical stage
-      ast = parser.Parser(tokens).parseModule() # Parse a module
+      p = Parser(tokens)
+      ast = p.parseModule() # Parse a module
+      print(p.errorlist)
+      if len(p.errorlist) > 0:
+         self.errorlist = p.errorlist
+         return
+      # Pass 2: code generation
       CodeGenerator().generatecode(ast)
       # Attach a signature:
       ast.signature = self.generateSignature(src)