Definition at line 85 of file token.py.
References dospath.join(), aifc.open(), dospath.split(), and locale.str().
90 inFileName = args
and args[0]
or "Include/token.h"
91 outFileName =
"Lib/token.py"
97 sys.stdout.write(
"I/O error: %s\n" %
str(err))
99 lines = fp.read().
split(
"\n")
102 "#define[ \t][ \t]*([A-Z][A-Z_]*)[ \t][ \t]*([0-9][0-9]*)",
106 match = prog.match(line)
108 name, val = match.group(1, 2)
115 fp =
open(outFileName)
117 sys.stderr.write(
"I/O error: %s\n" %
str(err))
119 format = fp.read().
split(
"\n")
122 start = format.index(
"#--start constants--") + 1
123 end = format.index(
"#--end constants--")
125 sys.stderr.write(
"target does not contain format markers")
129 lines.append(
"%s = %d" % (tokens[val], val))
130 format[start:end] = lines
132 fp =
open(outFileName,
'w')
134 sys.stderr.write(
"I/O error: %s\n" %
str(err))
136 fp.write(
"\n".
join(format))