def getenv(frame, args): key = args[0] assert isinstance(key, String) try: frame.put([String(os.environ[key.value])]) frame.set_status(Success()) except KeyError: frame.set_status(Fail(String('no-key')))
def pop(self): if not self.stack: raise Crash(Fail(String('empty-stack'))) val = self.stack.pop() assert isinstance(val, Value) return val
def fail_str(self, reason_str): raise Crash(Fail(String(reason_str)))
def fail(self, reason): raise Crash(Fail(reason))
def crash(frame, args): frame.crash(Fail(args[0]))
def fail(frame, args): frame.set_status(Fail(args[0])) frame.proc.pop()
def boolify(b, frame, msg): if b: frame.set_status(Success()) else: frame.set_status(Fail(String(msg)))
def eq(frame, args): if args[0].eq(args[1]): frame.set_status(Success()) else: frame.set_status(Fail(String('not-eq')))