Exemplo n.º 1
0
def main():
    try:
        input_path = sys.argv[1]
        generatorType = sys.argv[2]
    except:
        print("// Please input correct command. \n// You should input the command like: python3 generate.py $INPUT_FILE \"source\"")
        return

    filerReader = FileReader(input_path)

    try:
        fullWidth, halfWidth, wide, narrow, ambiguous, neutral = filerReader.parseFile()

        if generatorType == "source":
            generator = SwiftGenerator(fullWidth, halfWidth, wide, narrow, ambiguous, neutral)
        elif generatorType == "test":
            generator = TestGenerator(fullWidth, halfWidth, wide, narrow, ambiguous, neutral)
        else:
            raise Exception("Please append correct generatorType(source OR test) after INPUT_FILE.")

        generator.generate()
    except Exception as e:
        print("Read Text File Failed: ", e)
        return