From 66354ace30051b34bcf847e19cadf409b3da678e Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 7 Sep 2017 15:46:07 +1000 Subject: [PATCH] spec-tool: strip comments from pod members --- tools/spec.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/tools/spec.py b/tools/spec.py index 3c8b4cc..05d6275 100755 --- a/tools/spec.py +++ b/tools/spec.py @@ -278,16 +278,24 @@ class pod(type): self._depends += list(e.text for e in node.findall('.//enum')) self._depends += list(t.text for t in node.findall('.//type')) - self._members = list(map( - lambda x: { - 'type': x.find('type').text, - 'name': x.find('name').text, - # we must include a space separator otherwise we get run-on - # types/names in the member definitions. - 'code': " ".join(rename(c) for c in x.itertext()) - }, - node.findall('./member')) - ) + self._members = [] + + for member in node.findall('./member'): + type = member.find('type').text + name = member.find('name').text + + comment = member.find('comment') + if not comment is None: + member.remove(comment) + code = " ".join(member.itertext()) + + #code = member.iter() + #code = filter(lambda x: x.tag != 'comment', code) + #code = map(lambda x: x.itertext(), code) + #code = map(lambda x: "".join(x), code) + #code = "".join(code) + + self._members.append({'code': code, 'type': type, 'name': name}) def depends(self): return self._depends