"""Token constants (from "token.h")."""
__all__ = ['tok_name', 'ISTERMINAL', 'ISNONTERMINAL', 'ISEOF']
# 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 isinstance(value, int) and not name.startswith('_')}
__all__.extend(tok_name.values())
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...
keys = sorted(tokens.keys())
# 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__":