changeset 182:e9b27f7193e3

Replace clear function by function also supported in python 3.2
author Windel Bouwman
date Sat, 18 May 2013 18:24:42 +0200
parents 216da5e46efc
children 4fd075e8259c
files python/ks/parser.py python/ks/symboltable.py python/ppci/errors.py python/testc3.py
diffstat 4 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/python/ks/parser.py	Sat May 18 17:45:26 2013 +0200
+++ b/python/ks/parser.py	Sat May 18 18:24:42 2013 +0200
@@ -2,7 +2,6 @@
 from .nodes import *
 from ...core.errors import CompilerException, Error
 from .builtin import *
-#from . import assembler
 from .lexer import tokenize
 
 class KsParser:
--- a/python/ks/symboltable.py	Sat May 18 17:45:26 2013 +0200
+++ b/python/ks/symboltable.py	Sat May 18 18:24:42 2013 +0200
@@ -1,5 +1,4 @@
 from .nodes import *
-from ...core.errors import Error
 
 class SymbolTable:
   """
@@ -67,7 +66,7 @@
       if self.parent:
         return self.parent.getSymbol(name)
       else:
-         Error('Symbol "{0}" undeclared!'.format(name))
+         raise Exception('Symbol "{0}" undeclared!'.format(name))
 
   def hasSymbol(self, name):
     if name in self.syms.keys():
--- a/python/ppci/errors.py	Sat May 18 17:45:26 2013 +0200
+++ b/python/ppci/errors.py	Sat May 18 18:24:42 2013 +0200
@@ -43,7 +43,7 @@
    def error(self, msg, loc):
       self.addDiag(CompilerError(msg, loc))
    def clear(self):
-      self.diags.clear()
+      del self.diags[:]
    def printErrors(self, src):
       if len(self.diags) > 0:
          print('{0} Errors'.format(len(self.diags)))
--- a/python/testc3.py	Sat May 18 17:45:26 2013 +0200
+++ b/python/testc3.py	Sat May 18 18:24:42 2013 +0200
@@ -84,7 +84,7 @@
    builder = c3.Builder(diag)
    ir = builder.build(src)
    # optional optimize here
-   x86gen = x86.X86CodeGen(diag)
+   x86gen = x86.X86CodeGenSimple(diag)
    ok = len(diag.diags) == 0
    if not ok:
       return