Skip to content

Commit 203d014

Browse files
fixed an issue when enum was the start of an enum variable
1 parent ed6555b commit 203d014

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

generate_icsneo40_structs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def is_line_start_of_object(line):
138138
for regex in _start_of_obj_blacklist:
139139
if bool(regex.search(line)):
140140
return False
141-
return bool(re.search('\btypedef struct$|struct$|struct \S*$|enum|union', line))
141+
return bool(re.search('\btypedef struct$|struct$|struct \S*$|enum$|enum |union$|union ', line))
142142

143143

144144
# This contains all the objects that don't pass convert_to_ctype_object
@@ -162,7 +162,6 @@ def parse_object(f, pos=-1, pack_size=None, is_embedded=False):
162162
"""
163163
start_pos = f.tell()
164164
opening_bracket_count = 0
165-
opening_bracket_count = 0
166165
try:
167166
# Read the first line and make sure we have a C Object
168167
line = f.readline()
@@ -207,6 +206,7 @@ def parse_object(f, pos=-1, pack_size=None, is_embedded=False):
207206
continue
208207
opening_bracket_count += line.count('{')
209208
opening_bracket_count -= line.count('}')
209+
assert(opening_bracket_count >= 0)
210210
# Determine if we are at the end of the struct
211211
if opening_bracket_count == 0 and re.match('}.*;', line):
212212
extra_names = ''.join(line.split()).strip('};').split(',')

0 commit comments

Comments
 (0)