From 68f8314e1fbc8c3e01a6a5426ea291fa1007b48f Mon Sep 17 00:00:00 2001 From: avish68710 Date: Sun, 16 Aug 2020 20:58:12 +0530 Subject: [PATCH] Updated the code --- pb.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/pb.py b/pb.py index 26a41e3..bf332fc 100644 --- a/pb.py +++ b/pb.py @@ -30,30 +30,30 @@ def startRead(filepath): for line in fileHandle: line = line.replace("/n", "").strip() if ";" in line: - print ".", + print(".") else: - print "ERROR: missing semicolon" + print("ERROR: missing semicolon") line = line.replace(";", "") if line.startswith("//"): # Do nothing, this is a comment - print "Comment found" + print("Comment found") elif line.startswith("PRINT"): line = line.replace("PRINT", "").replace('"',"").strip() - print line + print(line) elif line.startswith("NEWPRINT"): - print '\n' + print('\n') elif line.startswith("WAIT"): time.sleep(int(line.split(" ")[1]) / 1000) elif line.startswith("CREATESWAP"): - print "Initialized SWAP space" + print("Initialized SWAP space") elif line.startswith("IO"): cmds = line.split() - print "IO port " + cmds[1] + " has a status of " + cmds[2] + print("IO port " + cmds[1] + " has a status of " + cmds[2]) elif line.startswith("NEW"): cmds = line.split() try: varstore[cmds[1].replace("$","")] - print "ERROR: variable " + cmds[1] + " already exists." + print("ERROR: variable " + cmds[1] + " already exists.") errorcount += 1 except: varstore[cmds[1].replace("$","")] = str(line.replace("NEW","").replace(cmds[1],"").strip()) @@ -62,14 +62,14 @@ def startRead(filepath): try: del varstore[line.split()[1].replace("$","").strip()] except: - print "ERROR: variable " + line.split()[1] + " is not defined." + print("ERROR: variable " + line.split()[1] + " is not defined.") errorcount += 1 pass elif line.startswith("SET"): try: varstore[line.split()[1].replace("$","").strip()] = line.replace("SET","").replace(line.split()[1],"").strip() except: - print "ERROR: variable " + line.split()[1] + " is not defined." + print("ERROR: variable " + line.split()[1] + " is not defined.") errorcount += 1 pass elif line.startswith("EXTLOAD"): @@ -87,20 +87,20 @@ def startRead(filepath): try: varstore[cmd2[2].replace("$","").strip()] = text except: - print "ERROR: variable " + cmd2[2] + " is not defined." + print("ERROR: variable " + cmd2[2] + " is not defined.") errorcount += 1 pass elif line.startswith("FILERM"): - print "ERROR: Not supported yet" + print("ERROR: Not supported yet") elif line.startswith("END"): - print "Program has quit. Exiting." + print("Program has quit. Exiting.") fileHandle.close #print "Errors: " + str(errorcount) #print "Warnings: " + str(warningcount) #sys.exit(errorcount) sys.exit(0) else: - print "ERROR: Unknown command in file " + filepath + print("ERROR: Unknown command in file " + filepath) errorcount += 1 fileHandle.close