Commit 3196a364 authored by sparonuz's avatar sparonuz
Browse files

[otinto/AutoRPE#117]: This need a regex in case variables have "contains" in the name

parent 29d73397
......@@ -30,7 +30,7 @@ def parse_sources(path_to_model_sources, vault):
for index, module in enumerate(vault.modules):
find_interfaces(module, vault)
# # Fill vault variable list:
# Fill vault variable list:
for procedures in vault.procedures_dictionary.values():
for proc in procedures:
if not isinstance(proc, BasicStructures.Interface):
......@@ -130,7 +130,7 @@ def find_subprogram_declaration(module, _subprogram_start, _subprogram_end, obj_
# TODO: manage cases in which a routine contains other functions declarations.
stop_index = [index
for index, line in enumerate(module.lines[_subprogram_start:_subprogram_end + 1])
if line.count("contains") or line.count("interface")]
if re.match(r"\bcontains\b", line, re.I) or re.match(r"\binterface\b", line, re.I)]
# A declaration found stop the search there
if stop_index:
_subprogram_end = _subprogram_start - 1 + stop_index[0]
......@@ -403,6 +403,7 @@ def find_module_variables(module):
if line.lower().count("contains"):
# print("here: "+ line)
if line.lower().count("end program"):
......@@ -446,8 +447,11 @@ def find_functions(module, vault):
# Find name and dummy arguments
function_name, dummy_arguments = get_dummy_arguments(module, _index)
# Find declarations
variables_declarations = find_subprogram_declaration(module, function_start, function_end, obj_to_find="::")
used_modules = find_subprogram_declaration(module, function_start, function_end, obj_to_find="^use\s")
variables_declarations = find_subprogram_declaration(module, function_start, function_end,
used_modules = find_subprogram_declaration(module, function_start, function_end,
# Parse everything and store
header = module.lines[function_start]
function = create_subprogram(module, header, function_name, dummy_arguments, variables_declarations,
Markdown is supported
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