put consts into python submodules
maintain set of visited namespaces in CppHeaderParser WARNING: REMOVED const name conversion (SomeConstName -> SOME_CONST_NAME), discussion needed
This commit is contained in:
@@ -38,6 +38,8 @@ class CppHeaderParser(object):
|
||||
self.PUBLIC_SECTION = 3
|
||||
self.CLASS_DECL = 4
|
||||
|
||||
self.namespaces = set()
|
||||
|
||||
def batch_replace(self, s, pairs):
|
||||
for before, after in pairs:
|
||||
s = s.replace(before, after)
|
||||
@@ -833,6 +835,9 @@ class CppHeaderParser(object):
|
||||
decls.append(d)
|
||||
else:
|
||||
decls.append(decl)
|
||||
if stmt_type == "namespace":
|
||||
chunks = [block[1] for block in self.block_stack if block[0] == 'namespace'] + [name]
|
||||
self.namespaces.add('.'.join(chunks))
|
||||
else:
|
||||
stmt_type, name, parse_flag = "block", "", False
|
||||
|
||||
@@ -877,3 +882,5 @@ if __name__ == '__main__':
|
||||
#decls += parser.parse(hname, wmode=False)
|
||||
parser.print_decls(decls)
|
||||
print(len(decls))
|
||||
print("namespaces:", " ".join(sorted(parser.namespaces)))
|
||||
|
||||
|
Reference in New Issue
Block a user