Addition by Jack to test for missing type support

This commit is contained in:
Guido van Rossum 1996-07-21 02:49:55 +00:00
parent a3b4b61a74
commit e47d5f9c52
1 changed files with 20 additions and 0 deletions

View File

@ -62,6 +62,25 @@ class Scanner:
modes = self.usedtypes[type].keys() modes = self.usedtypes[type].keys()
modes.sort() modes.sort()
print type, string.join(modes) print type, string.join(modes)
def gentypetest(self, file):
fp = open(file, "w")
fp.write("types=[\n")
types = self.usedtypes.keys()
types.sort()
for type in types:
fp.write("\t'%s',\n"%type)
fp.write("]\n")
fp.write("""missing=0
for t in types:
try:
tt = eval(t)
except NameError:
print "** Missing type:", t
missing = 1
if missing: raise "Missing Types"
""")
fp.close()
def initsilent(self): def initsilent(self):
self.silent = 0 self.silent = 0
@ -365,6 +384,7 @@ class Scanner:
self.report("Bad raw spec: %s", `raw`) self.report("Bad raw spec: %s", `raw`)
return return
type, name, args = self.whole.group('type', 'name', 'args') type, name, args = self.whole.group('type', 'name', 'args')
type = regsub.gsub("[ \t]+", "_", type)
if name in self.alreadydone: if name in self.alreadydone:
self.report("Name has already been defined: %s", `name`) self.report("Name has already been defined: %s", `name`)
return return