Commit 2f461f59 authored by Taddeus Kroes's avatar Taddeus Kroes

Added string representation to Block class.

parent caf3ff63
......@@ -10,7 +10,7 @@ class Statement:
self.args = list(args)
self.options = kwargs
# Assign a unique ID to each satement
# Assign a unique ID to each statement
self.sid = Statement.sid
Statement.sid += 1
......@@ -208,10 +208,22 @@ class Statement:
class Block:
bid = 1
def __init__(self, statements=[]):
self.statements = statements
self.pointer = 0
# Assign a unique ID to each block for printing purposes
self.bid = Block.bid
Block.bid += 1
def __str__(self):
return '<Block bid=%d statements=%d>' % (self.bid, len(self))
def __repr__(self):
return str(self)
def __iter__(self):
return iter(self.statements)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment