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('"([^"]+)"')
69 match
= strprog
.search(line
)
71 lines
.append(" '" + match
.group(1) + "',\n")
75 # load the output skeleton from the target
77 format
= fp
.readlines()
80 # insert the lines of keywords
82 start
= format
.index("#--start keywords--\n") + 1
83 end
= format
.index("#--end keywords--\n")
84 format
[start
:end
] = lines
86 sys
.stderr
.write("target does not contain format markers\n")
89 # write the output file
90 fp
= open(optfile
, 'w')
91 fp
.write(''.join(format
))
94 if __name__
== "__main__":