Loading...
Searching...
No Matches
Go to the documentation of this file.
7 return f
"{prefix}_kw_{tok.name}"
9 return f
"{prefix}_op_{tok.name}"
10 return f
"{prefix}_{tok.name}"
14 header =
"""#pragma once
22 for token
in tokens.tokens:
23 header += f
" {tok_id(token)},\n"
27 header +=
"""constexpr std::string_view spelling(int Kind) {
28 using namespace std::literals;
32 for token
in tokens.tokens:
33 header += f
' case {tok_id(token)}: return R"({token.spelling})"sv;\n'
35 header +=
""" default: return ""sv;
40 header +=
"} // namespace nixf::tok"
45if __name__ ==
"__main__":
48 with open(sys.argv[1],
"w")
as f: