Commit e48b9dce authored by erodrigu's avatar erodrigu
Browse files

Search and remove PURE keyword from function declaration

parent 88457a8e
......@@ -95,6 +95,9 @@ class ImplementRPE:
# Fix all RPE variables declared with assignation
self.fix_parameter_declaration(module)
# Remove keyword PURE from function declarations
self.fix_pure_functions(module)
# Process intrinsic calls
self.fix_intrinsic_functions(module)
......@@ -110,6 +113,11 @@ class ImplementRPE:
# Fix pointer assignations
self.fix_pointer_assignations(module)
def fix_pure_functions(self, module):
for _index, line in enumerate(module.lines):
if re.search(RegexPattern.pure_function_declaration, line, flags=re.IGNORECASE):
module.lines[_index] = re.sub(RegexPattern.pure_function_declaration, "function ", line, flags=re.IGNORECASE)
def fix_parameter_declaration(self, module):
# If there's an assignation whe have to convert everything to an rpe constructor call
for _index, line in enumerate(module.lines):
......
......@@ -107,6 +107,8 @@ allocation_variable_name = r"\ballocate\b\s*\(.*\b%s\b.*"
allocation_member_name = r"\ballocate\b\s*\(.*(?<=%%)\b%s\b.*"
general_allocation = r'\ballocate\b\s*\(.*'
# PURE function
pure_function_declaration = r"\s*(pure)\s+(function)\s*"
# search for occurrence of a name, that can be a subprogram name or a variable name, or whatever
name_occurrence = r"\b%s\b"
......
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