diff python/c3/parser.py @ 254:bd26dc13f270

Added logger
author Windel Bouwman
date Wed, 31 Jul 2013 21:20:58 +0200
parents 6ed3d3a82a63
children e64bae57cda8
line wrap: on
line diff
--- a/python/c3/parser.py	Wed Jul 31 17:57:03 2013 +0200
+++ b/python/c3/parser.py	Wed Jul 31 21:20:58 2013 +0200
@@ -1,18 +1,21 @@
+import logging
 from . import astnodes, lexer
 from ppci import CompilerError
 
 class Parser:
     """ Parses sourcecode into an abstract syntax tree (AST) """
     def __init__(self, diag):
+        self.logger = logging.getLogger('c3')
         self.diag = diag
 
     def parseSource(self, source):
-      self.initLex(source)
-      try:
-         self.parsePackage()
-         return self.mod
-      except CompilerError as e:
-         self.diag.addDiag(e)
+        self.logger.info('Parsing source')
+        self.initLex(source)
+        try:
+            self.parsePackage()
+            return self.mod
+        except CompilerError as e:
+            self.diag.addDiag(e)
 
     def Error(self, msg):
         raise CompilerError(msg, self.token.loc)