summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorLysandros Nikolaou <lisandrosnik@gmail.com>2020-06-20 18:07:25 (GMT)
committerGitHub <noreply@github.com>2020-06-20 18:07:25 (GMT)
commit314858e2763e76e77029ea0b691d749c32939087 (patch)
tree697996061fc2d8b019306ddd02b4ea21fbdd2cb2 /Tools
parent55460ee6dc9a4f16bd68d6b6be3a8398c7d4a596 (diff)
downloadcpython-314858e2763e76e77029ea0b691d749c32939087.zip
cpython-314858e2763e76e77029ea0b691d749c32939087.tar.gz
cpython-314858e2763e76e77029ea0b691d749c32939087.tar.bz2
bpo-40939: Remove the old parser (Part 2) (GH-21005)
Remove some remaining files and Makefile targets for the old parser
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/scripts/generate_symbol_py.py53
1 files changed, 0 insertions, 53 deletions
diff --git a/Tools/scripts/generate_symbol_py.py b/Tools/scripts/generate_symbol_py.py
deleted file mode 100755
index 9219b09..0000000
--- a/Tools/scripts/generate_symbol_py.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#! /usr/bin/env python3
-# This script generates the symbol.py source file.
-
-import sys
-import re
-
-def main(inFileName="Include/graminit.h", outFileName="Lib/symbol.py"):
- try:
- fp = open(inFileName)
- except OSError as err:
- sys.stderr.write("I/O error: %s\n" % str(err))
- sys.exit(1)
- with fp:
- lines = fp.read().split("\n")
- prog = re.compile(
- "#define[ \t][ \t]*([A-Z0-9][A-Z0-9_]*)[ \t][ \t]*([0-9][0-9]*)",
- re.IGNORECASE)
- tokens = {}
- for line in lines:
- match = prog.match(line)
- if match:
- name, val = match.group(1, 2)
- val = int(val)
- tokens[val] = name # reverse so we can sort them...
- keys = sorted(tokens.keys())
- # load the output skeleton from the target:
- try:
- fp = open(outFileName)
- except OSError as err:
- sys.stderr.write("I/O error: %s\n" % str(err))
- sys.exit(2)
- with fp:
- format = fp.read().split("\n")
- try:
- start = format.index("#--start constants--") + 1
- end = format.index("#--end constants--")
- except ValueError:
- sys.stderr.write("target does not contain format markers")
- sys.exit(3)
- lines = []
- for val in keys:
- lines.append("%s = %d" % (tokens[val], val))
- format[start:end] = lines
- try:
- fp = open(outFileName, 'w')
- except OSError as err:
- sys.stderr.write("I/O error: %s\n" % str(err))
- sys.exit(4)
- with fp:
- fp.write("\n".join(format))
-
-if __name__ == '__main__':
- main(*sys.argv[1:])