Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Production Test Suite - base
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Production Test Suite - base
Commits
94bfdd90
Commit
94bfdd90
authored
May 19, 2011
by
Juan David González Cobas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parse: add classes for sequence traversal
Of dubious utility
parent
edf8187a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
parse.py
parse.py
+22
-0
No files found.
parse.py
View file @
94bfdd90
...
@@ -58,6 +58,28 @@ def p_error(p):
...
@@ -58,6 +58,28 @@ def p_error(p):
parser
=
yacc
.
yacc
()
parser
=
yacc
.
yacc
()
class
Sequence
(
object
):
pass
class
Battery
(
Sequence
,
list
):
def
traverse
(
self
):
for
item
in
self
:
print
item
class
Tst
(
Sequence
):
def
traverse
(
self
):
print
self
.
tag
class
Loop
(
Sequence
):
def
traverse
(
self
):
for
i
in
range
(
self
.
number
):
self
.
sequence
.
traverse
()
class
Range
(
Sequence
):
def
traverse
(
self
):
for
i
in
range
(
self
.
fro
,
self
.
to
+
1
):
print
i
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
result
=
parser
.
parse
(
sys
.
argv
[
1
])
result
=
parser
.
parse
(
sys
.
argv
[
1
])
print
result
print
result
...
...
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