def getFilesInLanguages(langs, theSyntaxRules): theFileNames = [] for fileName in os.listdir("EngScript_examples"): if fileName.endswith(".txt"): theFileNames += [fileName] for current in langs: for fileName in theFileNames: try: inputFilePath = "EngScript_examples/"+fileName inputText = getFileText(inputFilePath, fileName.replace(".txt", "")) theOutputString = outputString(current, syntaxRules.testMacro(theSyntaxRules,inputText), fileName.replace(".txt", "")) #print(theOutputString) getFileInLanguage( lang = current, theOutputString = theOutputString, outputPath = "EngScript_examples/"+current+"/", outputFile = fileName.replace(".txt", "")+"."+polyglotCodeGenerator.getFileExtension(current), theSyntaxRules = theSyntaxRules ) except Exception as e: pass
def getFileInLanguages(langs, fileName): for current in langs: getFileInLanguage(current, fileName, "EngScript_examples/"+current+"/", fileName.replace(".txt", "")+"."+polyglotCodeGenerator.getFileExtension(current))