Mercurial > lcfOS
diff python/c3/astnodes.py @ 165:598d3888a11c
Added front class and fided AST view
author | Windel Bouwman |
---|---|
date | Fri, 22 Mar 2013 15:12:38 +0100 |
parents | 8104fc8b5e90 |
children | da0087b82fbe |
line wrap: on
line diff
--- a/python/c3/astnodes.py Mon Mar 18 22:15:57 2013 +0100 +++ b/python/c3/astnodes.py Fri Mar 22 15:12:38 2013 +0100 @@ -23,14 +23,15 @@ def __init__(self, name): self.name = name def __repr__(self): - return '[TYPE {0}]'.format(self.name) + return '{0}'.format(self.name) class FunctionType(Type): def __init__(self, parameters, returntype): self.parameters = parameters self.returntype = returntype def __repr__(self): - return '[FUNCTYPE {0} RET {1}]'.format(self.parameters, self.returntype) + params = ','.join([str(v) for v in self.parameters]) + return '{1} f({0})'.format(params, self.returntype) class DefinedType(Type): def __init__(self, name, typ): @@ -67,7 +68,7 @@ self.isReadOnly = False self.isParameter = False def __repr__(self): - return 'VAR {0} : {1} usage: {2}'.format(self.name, self.typ, self.References) + return '{0}'.format(self.name) # Procedure types class Function(Symbol): @@ -77,7 +78,7 @@ self.body = block self.typ = typ def __repr__(self): - return 'PROCEDURE {0} {1}'.format(self.name, self.typ) + return '{0}'.format(self.name) # Operations / Expressions: class Unop(Node):