Mercurial > lcfOS
comparison python/ppci/c3/codegenerator.py @ 312:2c9768114877
Added cool logging formatter
author | Windel Bouwman |
---|---|
date | Mon, 16 Dec 2013 17:58:15 +0100 |
parents | ff665880a6b0 |
children | 04cf4d26a3bc |
comparison
equal
deleted
inserted
replaced
311:ff665880a6b0 | 312:2c9768114877 |
---|---|
263 expr.lvalue = False | 263 expr.lvalue = False |
264 typemap = {int: 'int', float: 'double', bool: 'bool'} | 264 typemap = {int: 'int', float: 'double', bool: 'bool'} |
265 if type(expr.val) in typemap: | 265 if type(expr.val) in typemap: |
266 expr.typ = self.pkg.scope[typemap[type(expr.val)]] | 266 expr.typ = self.pkg.scope[typemap[type(expr.val)]] |
267 else: | 267 else: |
268 raise SemanticError('Unknown literal type {}'.format(expr.val)) | 268 raise SemanticError('Unknown literal type {}'.format(expr.val), expr.loc) |
269 return ir.Const(expr.val) | 269 return ir.Const(expr.val) |
270 elif type(expr) is ast.TypeCast: | 270 elif type(expr) is ast.TypeCast: |
271 return self.gen_type_cast(expr) | 271 return self.gen_type_cast(expr) |
272 elif type(expr) is ast.FunctionCall: | 272 elif type(expr) is ast.FunctionCall: |
273 return self.gen_function_call(expr) | 273 return self.gen_function_call(expr) |