Mercurial > lcfOS
comparison python/ppci/c3/astnodes.py @ 393:6ae782a085e0
Added init program
author | Windel Bouwman |
---|---|
date | Sat, 17 May 2014 21:17:40 +0200 |
parents | 2ec730e45ea1 |
children | 988f3fb861e4 |
comparison
equal
deleted
inserted
replaced
392:bb4289c84907 | 393:6ae782a085e0 |
---|---|
205 class Expression(Node): | 205 class Expression(Node): |
206 def __init__(self, loc): | 206 def __init__(self, loc): |
207 self.loc = loc | 207 self.loc = loc |
208 | 208 |
209 | 209 |
210 class Sizeof(Expression): | |
211 def __init__(self, typ, loc): | |
212 super().__init__(loc) | |
213 self.query_typ = typ | |
214 | |
215 | |
210 class Deref(Expression): | 216 class Deref(Expression): |
211 def __init__(self, ptr, loc): | 217 def __init__(self, ptr, loc): |
212 super().__init__(loc) | 218 super().__init__(loc) |
213 assert isinstance(ptr, Expression) | 219 assert isinstance(ptr, Expression) |
214 self.ptr = ptr | 220 self.ptr = ptr |
378 | 384 |
379 def __repr__(self): | 385 def __repr__(self): |
380 return 'IF-statement' | 386 return 'IF-statement' |
381 | 387 |
382 | 388 |
389 class Switch(Statement): | |
390 def __init__(self, condition, loc): | |
391 super().__init__(loc) | |
392 self.condition = condition | |
393 | |
394 def __repr__(self): | |
395 return 'Switch on {}'.format(self.condition) | |
396 | |
397 | |
383 class While(Statement): | 398 class While(Statement): |
384 def __init__(self, condition, statement, loc): | 399 def __init__(self, condition, statement, loc): |
385 super().__init__(loc) | 400 super().__init__(loc) |
386 self.condition = condition | 401 self.condition = condition |
387 self.statement = statement | 402 self.statement = statement |