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.
6 # These paths are relative to flang/docs in the build directory, not source, as that's where this tool is executed.
7 HEADER_PATH
= os
.path
.join("Source", "FIR", "FIRLangRef_Header.md")
8 DOCS_PATH
= os
.path
.join("Dialect", "FIRLangRef.md")
9 OUTPUT_PATH
= os
.path
.join("Source", "FIRLangRef.md")
11 # 1. Writes line 1 from docs to output, (comment line that the file is autogenerated)
13 # 3. Writes the entire header to the output file
14 # 4. Writes the remainder of docs to the output file
15 with
open(OUTPUT_PATH
, "w") as output
:
16 with
open(HEADER_PATH
, "r") as header
, open(DOCS_PATH
, "r") as docs
:
17 output
.write(docs
.readline())
19 output
.write(header
.read())
20 output
.write(docs
.read())