Mercurial > lcfOS
diff python/c3/astnodes.py @ 212:62386bcee1ba
Added parser combinator lib
author | Windel Bouwman |
---|---|
date | Sun, 30 Jun 2013 19:00:41 +0200 |
parents | 46d62dadd61b |
children | 003c8a976fff |
line wrap: on
line diff
--- a/python/c3/astnodes.py Sat Jun 29 10:10:45 2013 +0200 +++ b/python/c3/astnodes.py Sun Jun 30 19:00:41 2013 +0200 @@ -9,7 +9,7 @@ def __init__(self, tname): self.tname = tname def __repr__(self): - return 'DESIGNATOR {0}'.format(self.tname) + return 'DESIGNATOR {}'.format(self.tname) """ Type classes @@ -23,7 +23,7 @@ def __init__(self, name): self.name = name def __repr__(self): - return '{0}'.format(self.name) + return '{}'.format(self.name) class FunctionType(Type): def __init__(self, parametertypes, returntype): @@ -68,7 +68,7 @@ self.isReadOnly = False self.isParameter = False def __repr__(self): - return '{0}'.format(self.name) + return '{}'.format(self.name) # Procedure types class Function(Symbol): @@ -76,7 +76,7 @@ def __init__(self, name): super().__init__(name) def __repr__(self): - return '{0}'.format(self.name) + return '{}'.format(self.name) # Operations / Expressions: class Unop(Node): @@ -84,7 +84,7 @@ self.a = a self.op = op def __repr__(self): - return 'UNOP {0}'.format(self.op) + return 'UNOP {}'.format(self.op) class Binop(Node): def __init__(self, a, op, b): @@ -92,27 +92,27 @@ self.b = b self.op = op # Operation: '+', '-', '*', '/', 'mod' def __repr__(self): - return 'BINOP {0}'.format(self.op) + return 'BINOP {}'.format(self.op) class VariableUse(Node): def __init__(self, target): self.target = target def __repr__(self): nm = self.target.name if hasattr(self.target, 'name') else '' - return 'VAR USE {0}'.format(nm) + return 'VAR USE {}'.format(nm) class Literal(Node): def __init__(self, val): self.val = val def __repr__(self): - return 'LITERAL {0}'.format(self.val) + return 'LITERAL {}'.format(self.val) # Modules class Package(Node): def __init__(self, name): self.name = name def __repr__(self): - return 'PACKAGE {0}'.format(self.name) + return 'PACKAGE {}'.format(self.name) # Statements class CompoundStatement(Node):