Пример #1
0
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')))
Пример #2
0
 def pop(self):
     if not self.stack: raise Crash(Fail(String('empty-stack')))
     val = self.stack.pop()
     assert isinstance(val, Value)
     return val
Пример #3
0
 def fail_str(self, reason_str):
     raise Crash(Fail(String(reason_str)))
Пример #4
0
 def fail(self, reason):
     raise Crash(Fail(reason))
Пример #5
0
def crash(frame, args):
    frame.crash(Fail(args[0]))
Пример #6
0
def fail(frame, args):
    frame.set_status(Fail(args[0]))
    frame.proc.pop()
Пример #7
0
def boolify(b, frame, msg):
    if b:
        frame.set_status(Success())
    else:
        frame.set_status(Fail(String(msg)))
Пример #8
0
def eq(frame, args):
    if args[0].eq(args[1]):
        frame.set_status(Success())
    else:
        frame.set_status(Fail(String('not-eq')))