Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
peephole
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
peephole
Commits
2f461f59
Commit
2f461f59
authored
Dec 29, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added string representation to Block class.
parent
caf3ff63
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
16 deletions
+28
-16
src/statement.py
src/statement.py
+28
-16
No files found.
src/statement.py
View file @
2f461f59
...
...
@@ -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 s
t
atement
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)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment