parse: add classes for sequence traversal

Of dubious utility
parent edf8187a
......@@ -58,6 +58,28 @@ def p_error(p):
parser = yacc.yacc()
class Sequence(object):
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):
class Range(Sequence):
def traverse(self):
for i in range(self.fro,
print i
if __name__ == '__main__':
result = parser.parse(sys.argv[1])
print result
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