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:
10 # python Lib/keyword.py
46 for keyword
in kwlist
:
49 iskeyword
= kwdict
.has_key
52 import sys
, re
, string
55 iptfile
= args
and args
[0] or "Python/graminit.c"
56 if len(args
) > 1: optfile
= args
[1]
57 else: optfile
= "Lib/keyword.py"
59 # scan the source file for keywords
61 strprog
= re
.compile('"([^"]+)"')
66 if string
.find(line
, '{1, "') > -1:
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(string
.join(format
, ''))
92 if __name__
== "__main__":