Esempio n. 1
0
def run_console(i, glob):
    import lexer
    import analyze
    import_readline()
    i.consolelevel += 1

    try:
        t = ""
        while True:
            t = raw_input("oranj> ") + "\n"
            while not lexer.isdone(t):
                t += raw_input("     > ") + "\n"

            try:
                r = intp.run(t, i)
            except intp.PyDropI: raise
            except intp.DropI: raise EOFError
            except parser.ParseError: pass
            except Exception, e:
                libintp.print_exception(e, i)
            else:
                if hasattr(r, "isnil") and not r.isnil():
                    print repr(r)
    except EOFError, e:
        print
Esempio n. 2
0
def wrap(fn, i, glob):
    try:
        fn()
    except intp.PyDropI:
        print "Dropping down to python console. Call undrop() to return."
        pydrop(i, glob)
    except intp.DropI:
        run_console(i, glob)
    except Exception, e:
        libintp.print_exception(e, i)