All pastes #1817854 Raw Edit

Emerald Shell

public python v1 · immutable
#1817854 ·published 2010-03-01 21:18 UTC
rendered paste body
def replacebuffers(string):    s = string    s = s.replace('str',str)    s = s.replace('int1',int1)    s = s.replace('int2',int2)    s = s.replace('ax',ax)    return sdef sw(str,what):    if str.startswith(what):        return True    else:        return Falsedef trim(str):    def run(cmd):    if sw(cmd,'print'):        if cmd.count(':') < 1:            sys.stderr.write('Syntax Error: double dots are needed.')            sys.exit(2)        elif cmd.count(':') > 1:            sys.stderr.write('Syntax Error: there are too many ":"')            sys.exit(2)        else:            tmp = cmd.split(":")	    tmp = tmp[1]	    tmp = replacebuffers(tmp)            print tmp    if sw(cmd,'input'):        if cmd.count(':') < 1:            sys.stderr.write('Syntax Error: double dots are needed.')            sys.exit(2)        elif cmd.count(':') > 1:            sys.stderr.write('Syntax Error: there are too many ":"')            sys.exit(2)        else:            tmp = cmd.split(":")            tmp = tmp[1]            tmp = tmp.split(",")            if tmp[1] == 'str':                str = raw_input(tmp[0])            elif tmp[1] == 'int1':                int1 = input(tmp[0])            elif tmp[1] == 'int2':                int2 = input(tmp[0])    if cmd == 'add':        ax = int1 + int2    if cmd == 'sub':        ax = int1 - int2    if cmd == 'mul':        ax = int1 * int2    if cmd == 'div':        if int2 != 0:            ax = int1 / int2        else:            sys.stderr.write("Math Error: Can't divide by zero")    if sw(cmd,'str'):        tmp = cmd.split("=")        tmp[0].lstrip(rstrip())        tmp[1].lstrip(rstrip())