c4db6c511af0f490f1083de4dca2c39da665ae2c
"""Token constants (from "token.h")."""
# This file is automatically generated; please don't muck it up!
# To update the symbols in this file, 'cd' to the top directory of
# the python source tree after building the interpreter and run:
for _name
, _value
in globals().items():
if type(_value
) is type(0):
inFileName
= args
and args
[0] or "Include/token.h"
outFileName
= "Lib/token.py"
sys
.stdout
.write("I/O error: %s\n" % str(err
))
lines
= fp
.read().split("\n")
"#define[ \t][ \t]*([A-Z0-9][A-Z0-9_]*)[ \t][ \t]*([0-9][0-9]*)",
name
, val
= match
.group(1, 2)
tokens
[val
] = name
# reverse so we can sort them...
# load the output skeleton from the target:
sys
.stderr
.write("I/O error: %s\n" % str(err
))
format
= fp
.read().split("\n")
start
= format
.index("#--start constants--") + 1
end
= format
.index("#--end constants--")
sys
.stderr
.write("target does not contain format markers")
lines
.append("%s = %d" % (tokens
[val
], val
))
format
[start
:end
] = lines
fp
= open(outFileName
, 'w')
sys
.stderr
.write("I/O error: %s\n" % str(err
))
fp
.write("\n".join(format
))
if __name__
== "__main__":