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"]
50 for keyword
in kwlist
:
53 iskeyword
= kwdict
.has_key
59 iptfile
= args
and args
[0] or "Python/graminit.c"
60 if len(args
) > 1: optfile
= args
[1]
61 else: optfile
= "Lib/keyword.py"
63 # scan the source file for keywords
65 strprog
= re
.compile('"([^"]+)"')
70 if line
.find('{1, "') > -1:
71 match
= strprog
.search(line
)
73 lines
.append(" '" + match
.group(1) + "',\n")
77 # load the output skeleton from the target
79 format
= fp
.readlines()
82 # insert the lines of keywords
84 start
= format
.index("#--start keywords--\n") + 1
85 end
= format
.index("#--end keywords--\n")
86 format
[start
:end
] = lines
88 sys
.stderr
.write("target does not contain format markers\n")
91 # write the output file
92 fp
= open(optfile
, 'w')
93 fp
.write(''.join(format
))
96 if __name__
== "__main__":