3 """Keywords (from "graminit.c")
5 This file is automatically generated; please don't muck it up!
7 To update the symbols in this file, 'cd' to the top directory of
8 the python source tree after building the interpreter and run:
13 __all__
= ["iskeyword", "kwlist"]
51 iskeyword
= frozenset(kwlist
).__contains
__
57 iptfile
= args
and args
[0] or "Python/graminit.c"
58 if len(args
) > 1: optfile
= args
[1]
59 else: optfile
= "Lib/keyword.py"
61 # scan the source file for keywords
63 strprog
= re
.compile('"([^"]+)"')
67 match
= strprog
.search(line
)
69 lines
.append(" '" + match
.group(1) + "',\n")
73 # load the output skeleton from the target
75 format
= fp
.readlines()
78 # insert the lines of keywords
80 start
= format
.index("#--start keywords--\n") + 1
81 end
= format
.index("#--end keywords--\n")
82 format
[start
:end
] = lines
84 sys
.stderr
.write("target does not contain format markers\n")
87 # write the output file
88 fp
= open(optfile
, 'w')
89 fp
.write(''.join(format
))
92 if __name__
== "__main__":