INNER CODE UNIT · Python

gen_h_file

stp/stp · lib/AST/genkinds.py:127

def gen_h_file(now, kindnames, category_names, cat_index):
    try:
        hfile = open("ASTKind.h", "w", encoding="utf-8",
                     errors="surrogateescape", newline="\n")
    except OSError as e:
        sys.exit("Cannot open .h file: %s\n" % e.strerror)

    with hfile:
        hfile.write(
            "#ifndef TESTKINDS_H\n"
            "#define TESTKINDS_H\n"
            "// Generated automatically by genkinds.py from ASTKind.kinds%s.\n"
            "// Do not edit\n"
            "#include <iostream>\n"
            "namespace stp {\n  typedef enum {\n" % now
        )

        last = len(kindnames) - 1

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…