minor form changes
This commit is contained in:
parent
798efe2048
commit
75969c45ee
@ -27,9 +27,10 @@ class InterfaceParser(FileParser):
|
|||||||
self.start_name_list = []
|
self.start_name_list = []
|
||||||
self.end_name_list = []
|
self.end_name_list = []
|
||||||
|
|
||||||
def _handle_file_parsing_moving_window(self, file_name: str, current_line: int,
|
def _handle_file_parsing_moving_window(
|
||||||
moving_window_size: int, moving_window: list, *args,
|
self, file_name: str, current_line: int, moving_window_size: int, moving_window: list,
|
||||||
**kwargs):
|
*args, **kwargs
|
||||||
|
):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _handle_file_parsing(self, file_name: str, *args, **kwargs):
|
def _handle_file_parsing(self, file_name: str, *args, **kwargs):
|
||||||
@ -61,7 +62,7 @@ class InterfaceParser(FileParser):
|
|||||||
match = re.search(r'[\s]*([\w]*),?(?:[\s]*//)?([^\n]*)?', line)
|
match = re.search(r'[\s]*([\w]*),?(?:[\s]*//)?([^\n]*)?', line)
|
||||||
if match:
|
if match:
|
||||||
count += 1
|
count += 1
|
||||||
if re.search(r"\[EXPORT\][\s]*:[\s]*\[END\]", match.group(2)):
|
if re.search(r"\[EXPORT][\s]*:[\s]*\[END]", match.group(2)):
|
||||||
last_entry_name = match.group(1)
|
last_entry_name = match.group(1)
|
||||||
end_matched = True
|
end_matched = True
|
||||||
self.end_name_list.append([last_entry_name, None])
|
self.end_name_list.append([last_entry_name, None])
|
||||||
@ -75,7 +76,10 @@ class InterfaceParser(FileParser):
|
|||||||
print(f"Current file: {file_name} | Make sure to include a start definition")
|
print(f"Current file: {file_name} | Make sure to include a start definition")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if not end_matched:
|
if not end_matched:
|
||||||
print("No end match detected when parsing interface files. Make sure to use [EXPORT] : [END]")
|
print(
|
||||||
|
"No end match detected when parsing interface files. "
|
||||||
|
"Make sure to use [EXPORT] : [END]"
|
||||||
|
)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
self.start_name_list.append([start_name, target_end_name, None, count])
|
self.start_name_list.append([start_name, target_end_name, None, count])
|
||||||
self.file_name_table.append(file_name)
|
self.file_name_table.append(file_name)
|
||||||
@ -116,7 +120,10 @@ class InterfaceParser(FileParser):
|
|||||||
all_indexes_filled = False
|
all_indexes_filled = False
|
||||||
current_iteration += 1
|
current_iteration += 1
|
||||||
if current_iteration >= max_outer_iterations:
|
if current_iteration >= max_outer_iterations:
|
||||||
print("Could not fill out start and end index list in given number of maximum outer iterations!")
|
print(
|
||||||
|
"Could not fill out start and end index list in "
|
||||||
|
"given number of maximum outer iterations!"
|
||||||
|
)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
return start_list_list_completed, end_list_list_completed
|
return start_list_list_completed, end_list_list_completed
|
||||||
|
|
||||||
@ -124,7 +131,8 @@ class InterfaceParser(FileParser):
|
|||||||
dict_to_build = dict()
|
dict_to_build = dict()
|
||||||
for local_count, interface_name_and_shortname in interface_dict.items():
|
for local_count, interface_name_and_shortname in interface_dict.items():
|
||||||
dict_to_build.update(
|
dict_to_build.update(
|
||||||
{interface_name_and_shortname[0]: [local_count + count_start, interface_name_and_shortname[1]]}
|
{interface_name_and_shortname[0]: [local_count + count_start,
|
||||||
|
interface_name_and_shortname[1]]}
|
||||||
)
|
)
|
||||||
self.mib_table.update(dict_to_build)
|
self.mib_table.update(dict_to_build)
|
||||||
|
|
||||||
@ -240,7 +248,10 @@ class ReturnValueParser(FileParser):
|
|||||||
two_lines
|
two_lines
|
||||||
)
|
)
|
||||||
if returnvalue_match:
|
if returnvalue_match:
|
||||||
self.__handle_returnvalue_match(returnvalue_match, file_name, print_truncated_entries)
|
self.__handle_returnvalue_match(
|
||||||
|
name_match=returnvalue_match.group(1), file_name=file_name, description="",
|
||||||
|
number_match=returnvalue_match.group(2)
|
||||||
|
)
|
||||||
self.last_lines[1] = self.last_lines[0]
|
self.last_lines[1] = self.last_lines[0]
|
||||||
self.last_lines[0] = newline
|
self.last_lines[0] = newline
|
||||||
|
|
||||||
@ -263,13 +274,15 @@ class ReturnValueParser(FileParser):
|
|||||||
self.current_interface_id_entries["Name"], name_match, MAX_STRING_LEN,
|
self.current_interface_id_entries["Name"], name_match, MAX_STRING_LEN,
|
||||||
PRINT_TRUNCATED_ENTRIES
|
PRINT_TRUNCATED_ENTRIES
|
||||||
)
|
)
|
||||||
full_id = (self.current_interface_id_entries["ID"] << 8) + return_number_from_string(number_match)
|
full_id = (self.current_interface_id_entries["ID"] << 8) + \
|
||||||
|
return_number_from_string(number_match)
|
||||||
if full_id in self.return_value_dict:
|
if full_id in self.return_value_dict:
|
||||||
# print('Duplicate returncode ' + hex(full_id) + ' from ' + file_name +
|
# print('Duplicate returncode ' + hex(full_id) + ' from ' + file_name +
|
||||||
# ' was already in ' + self.return_value_dict[full_id][3])
|
# ' was already in ' + self.return_value_dict[full_id][3])
|
||||||
pass
|
pass
|
||||||
dict_tuple = (
|
dict_tuple = (
|
||||||
string_to_add, description, number_match, file_name, self.current_interface_id_entries["FullName"]
|
string_to_add, description, number_match, file_name,
|
||||||
|
self.current_interface_id_entries["FullName"]
|
||||||
)
|
)
|
||||||
self.return_value_dict.update({
|
self.return_value_dict.update({
|
||||||
full_id: dict_tuple
|
full_id: dict_tuple
|
||||||
|
Loading…
x
Reference in New Issue
Block a user