Updated analyze_typedef

This commit is contained in:
2019-02-21 22:57:38 +01:00
parent b30b368820
commit d5c4030527

View File

@@ -17,14 +17,15 @@ class ANALYZEOBJECT:
self.comment = False self.comment = False
self.typedef = False self.typedef = False
self.members = False self.members = False
self.ts = ''
def analyze(self,l): def analyze(self,l):
if l == '' or l == '\n':
return l
if self.typedef == True: if self.typedef == True:
rv = self.analyze_typedef(l) rv = self.analyze_typedef(l)
if rv != False: if rv != False:
return rv return rv
if l == '' or l == '\n':
return l
rv = self.analyze_comment(l) rv = self.analyze_comment(l)
if rv != False: if rv != False:
return rv return rv
@@ -60,25 +61,32 @@ class ANALYZEOBJECT:
return False return False
def analyze_typedef(self,l): def analyze_typedef(self,l):
ts = '' if self.typedef == False:
ts += l self.ts = ''
self.ts += l
s = l.split() s = l.split()
w = [w for w in s] w = [w for w in s]
if w[0] == 'typedef': if w[0] == 'typedef':
if w[1] == 'struct': if w[1] == 'struct':
if w[-1].endswith(';'): if w[-1].endswith(';'):
self.typedef = False self.typedef = False
return ts return self.ts
else: else:
self.typedef = True self.typedef = True
return 'next' return 'next'
if w[1] == 'enum': if w[1] == 'enum':
if w[-1].endswith(';'): if w[-1].endswith(';'):
self.typedef = False self.typedef = False
return ts return self.ts
else: else:
self.typedef = True self.typedef = True
return 'next' return 'next'
if self.typedef == True:
if w[0].startswith('{'):
return self.ts
if w[0].startswith('}'):
self.typedef = False
return self.ts
return False return False
def analyze_struct(self,l): def analyze_struct(self,l):
@@ -108,6 +116,7 @@ class ANALYZER(ANALYZEOBJECT):
_passes = count(0) _passes = count(0)
def __init__(self): def __init__(self):
ANALYZEOBJECT.__init__(self)
self.id = next(self._ids) self.id = next(self._ids)
self.tupline = [] self.tupline = []
self.tupfile = [] self.tupfile = []