Commit 235f5c9d authored by Stefan Marr's avatar Stefan Marr

Added control flow exceptions to manage non-local returns and block restarts in…

Added control flow exceptions to manage non-local returns and block restarts in this recursively written interpreter
Signed-off-by: 's avatarStefan Marr <git@stefan-marr.de>
parent 8d88b67e
class RestartLoopException(BaseException):
pass
class ReturnException(BaseException):
_immutable_fields_ = ["_result", "_target"]
def __init__(self, result, target):
self._result = result
self._target = target
def get_result(self):
return self._result
def has_reached_target(self, current):
return current is self._target
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