1# This script combines FIRLangRef_Header.md with the auto-generated Dialect/FIRLangRef.md 2# for the purpose of creating an introduction header/paragraph for FIRLangRef.html 3 4# These paths are relative from the build directroy, not source, as that's where this tool is exectued. 5header_path = 'Source/FIR/FIRLangRef_Header.md' 6docs_path = 'Dialect/FIRLangRef.md' 7output_path = 'Source/FIRLangRef.md' 8 9# 1. Writes line 1 from docs to output, (comment line that the file is autogenerated) 10# 2. Adds a new line 11# 3. Writes the entire header to the output file 12# 4. Writes the remainder of docs to the output file 13with open(output_path, 'w') as output: 14 with open(header_path, 'r') as header, open(docs_path, 'r') as docs: 15 output.write(docs.readline()) 16 output.write("\n") 17 output.write(header.read()) 18 output.write(docs.read()) 19