X-Git-Url: https://git.yukkurigames.com/?p=python-bulletml.git;a=blobdiff_plain;f=bulletml%2Fparser.py;h=aee4f90024b034de12ee656895b10fbb7aef6aa6;hp=2075ac961ae06715a4ffe899541667053fa8e563;hb=4aea8f4247626c42d3ca429f97aa1e23c3aa3f74;hpb=2af7a59592e4774c3fc9be7202285c44ba9a5c6f diff --git a/bulletml/parser.py b/bulletml/parser.py index 2075ac9..aee4f90 100644 --- a/bulletml/parser.py +++ b/bulletml/parser.py @@ -367,9 +367,7 @@ class Repeat(object): def __call__(self, owner, action, params, rank, created): repeat = self.times(params, rank) - actions, params = self.action(params, rank) - child = action.__class__( - owner, action, actions, params, rank, repeat) + child = action.Child(self.action, params, rank, repeat) owner.replace(action, child) child.step(owner, created) return True @@ -423,11 +421,18 @@ class If(object): branch = self.else_ if branch: - actions, params = branch(params, rank) - child = action.__class__(owner, action, actions, params, rank) + child = action.Child(branch, params, rank) owner.replace(action, child) child.step(owner, created) return True + + def __repr__(self): + if self.else_: + return "%s(%r, then=%r, else_=%r)" % ( + type(self).__name__, self.cond, self.then, self.else_) + else: + return "%s(%r, then=%r)" % ( + type(self).__name__, self.cond, self.then) class Accel(object): """Accelerate over some time."""