def METHOD_NAME(argv):
    argI = 1
    inputName = ""
    inplace = False
    while argI < len(argv):
        if argv[argI] == "-h":
            printHelp()
            sys.exit()
        elif argv[argI] == "-i":
            inplace = True
        elif argv[argI].startswith("-"):
            eprint("Invalid option '%s'. -h for help." % argv[argI])
            sys.exit(1)
        else:
            if inputName:
                eprint("More than one input-file specified")
                sys.exit(1)
            inputName = argv[argI]
        argI += 1
    if not inputName:
        eprint("Input-file not specified. -h for help.")
        sys.exit(1)
    global baseName
    baseName = os.path.basename(inputName)
    # Read the source file
    with open(inputName, "r") as f:
        source = [x.strip("\n") for x in f.readlines()]
    # Read the error output
    errorOutput = [x.strip("\n") for x in sys.stdin.readlines()]
    parseSource(source)
    parseErrors(errorOutput)
    eprint("Scanned %d source lines and %d errors" % (len(sourceLines), len(errors)))
    if inplace:
        with open(inputName, "w") as f:
            generateOutput(f)
    else:
        generateOutput(sys.stdout)