Mercurial > lcfOS
diff python/ppci/c3/astnodes.py @ 354:5477e499b039
Added some sort of string functionality
author | Windel Bouwman |
---|---|
date | Thu, 13 Mar 2014 18:59:06 +0100 |
parents | d1ecc493384e |
children | 2ec730e45ea1 |
line wrap: on
line diff
--- a/python/ppci/c3/astnodes.py Sun Mar 09 18:49:10 2014 +0100 +++ b/python/ppci/c3/astnodes.py Thu Mar 13 18:59:06 2014 +0100 @@ -125,6 +125,16 @@ return 'STRUCT' +class ArrayType(Type): + """ Array type """ + def __init__(self, element_type, size): + self.element_type = element_type + self.size = size + + def __repr__(self): + return 'ARRAY {}'.format(self.size) + + class DefinedType(NamedType): """ A named type indicating another type """ def __init__(self, name, typ, loc): @@ -225,6 +235,17 @@ return 'MEMBER {}.{}'.format(self.base, self.field) +class Index(Expression): + """ Index something, for example an array """ + def __init__(self, base, i, loc): + super().__init__(loc) + self.base = base + self.i = i + + def __repr__(self): + return 'Index {}'.format(self.i) + + class Unop(Expression): """ Operation on one operand """ def __init__(self, op, a, loc):