Unverified Commit e21e5b53 authored by Robin Mueller's avatar Robin Mueller
Browse files

increasing program robustness

parent d28855d1
......@@ -62,8 +62,10 @@ def write_translation_header_file(filename: str = "translateObjects.h"):
def sql_object_exporter(object_table: list, delete_cmd: str, create_cmd: str, insert_cmd: str, sql_table: str):
sql_writer = SqlWriter(sql_table)
def sql_object_exporter(
object_table: list, db_filename: str, delete_cmd: str, create_cmd: str, insert_cmd: str
sql_writer = SqlWriter(db_filename=db_filename)
for entry in object_table:
......@@ -46,6 +46,7 @@ class InterfaceParser(FileParser):
count = 0
current_file_table = dict()
start_matched = False
end_matched = False
start_name = ""
target_end_name = ""
for line in all_lines:
......@@ -62,13 +63,16 @@ class InterfaceParser(FileParser):
count += 1
if re.search(r"\[EXPORT\][\s]*:[\s]*\[END\]", match.group(2)):
last_entry_name = match.group(1)
end_matched = True
self.end_name_list.append([last_entry_name, None])
current_file_table.update({count: [match.group(1), match.group(2)]})
if not start_matched:
print("No start match detected when parsing interface files..")
if not end_matched:
print("No end match detected when parsing interface files. Make sure to use [EXPORT] : [END]")
self.start_name_list.append([start_name, target_end_name, None, count])
import sqlite3
SQL_DATABASE_NAME = "obsw_mib.db"
class SqlWriter:
def __init__(self, filename: str = SQL_DATABASE_NAME):
self.filename = filename
def __init__(self, db_filename: str):
self.filename = db_filename
self.conn = sqlite3.connect(self.filename)
def open(self, sql_creation_command: str):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment