Commit 0bd2f835 authored by Per Cederqvist's avatar Per Cederqvist

(prot_a_bitstring.__init__): New method.

(prot_a_bitstring.add_field): Store the field, and check for duplicates.
(prot_a_bitstring.check_implemented): New method.
(lexer.__init__): Read conftypes.tmp.
(lexer.toplevel_bye): Check Extended-Conf-Type.
(lexer.__parse_userdefined_bitstring): Be prepared that
	prot_a_bitstring.add_field can return an error message.
parent 460fe803
......@@ -83,8 +83,26 @@ class prot_a_struct(prot_a_type):
defined_types[tn].use()
class prot_a_bitstring(prot_a_type):
def __init__(self, line):
prot_a_type.__init__(self, line)
self.__bits = {}
def add_field(self, field_name):
pass
if self.__bits.has_key(field_name):
return "bit ``%s'' used twice" % field_name
self.__bits[field_name] = None
def check_implemented(self, name, implemented_fields):
res = []
i = {}
for f in implemented_fields:
if not self.__bits.has_key(f):
res.append("%s: bit ``%s'' not documented" % (name, f))
i[f] = None
for f in self.__bits.keys():
if not i.has_key(f):
res.append("%s: bit ``%s'' not implemented" % (name, f))
return res
def use_recurse(self):
pass
......@@ -277,6 +295,13 @@ class lexer:
self.__implemented_miscs[name] = nr
f.close()
self.__implemented_conftypes = {}
f = open("conftypes.tmp", "r")
for line in f.readlines():
name = line.strip()
self.__implemented_conftypes[name] = nr
f.close()
def run(self):
while 1:
c = self.__reader.getc()
......@@ -618,6 +643,12 @@ class lexer:
self.error(self.__reader.line_no(),
"Misc-info ``%s'' not implemented." % name)
# Check bitfields.
for emsg in defined_types['Extended-Conf-Type'].check_implemented(
"conference type", self.__implemented_conftypes):
self.error(self.__reader.line_no(), emsg)
self.__reader.check_paren_null()
# This is the normal exit of the program. It isn't nice to hide
......@@ -805,7 +836,10 @@ class lexer:
return res
name = token
if not self.__bad_arg(name):
res.add_field(name)
ret = res.add_field(name)
if ret:
self.error(self.__reader.line_no(), ret)
token = self.__get_token()
if token != ';':
self.error(self.__reader.line_no(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment