def endloop(lineInfo): # handle if endloop has no corresponding loop if lineInfo["loopDepth"] == 0: sys.exit("Loop error on line {0}. endloop has no corresponding loop to begin from.".format(utils.lines)) # decrease loop depth lineInfo["loopDepth"] -= 1 # parse the loopCode if this is the end of the rootLoop if lineInfo["loopDepth"] == 0: parse.listParse(lineInfo["loopCode"], lineInfo["rootLoopLength"]) # clear the loop variables lineInfo["loopCode"] = [] else: # otherwise add it to the loop code lineInfo["loopCode"].append((lineInfo["lineNumber"], lineInfo["line"])) # return the new lineInfo return lineInfo
def endloop(lineInfo): #handle if endloop has no corresponding loop if lineInfo['loopDepth'] == 0: sys.exit( "Loop error on line {0}. endloop has no corresponding loop to begin from." .format(utils.lines)) #decrease loop depth lineInfo['loopDepth'] -= 1 #parse the loopCode if this is the end of the rootLoop if lineInfo['loopDepth'] == 0: parse.listParse(lineInfo['loopCode'], lineInfo['rootLoopLength']) #clear the loop variables lineInfo['loopCode'] = [] else: #otherwise add it to the loop code lineInfo['loopCode'].append((lineInfo['lineNumber'], lineInfo['line'])) #return the new lineInfo return lineInfo
def run(file_): with open(file_, 'rb') as file: #pass enumerated file so we can get line numbers starting at 1 parse.listParse(enumerate(file,1)) return utils.baseVariables