Commit 5a4b1188 authored by sparonuz's avatar sparonuz
Browse files

[panther_developments]: update of names and add check for square brackets

parent b76b81a3
......@@ -33,9 +33,7 @@ pattern_type = "^ *type[^()]*[ \t](\w+) *$"
# Captures extended types
pattern_extended_type = "^ *type\s*,(\s*public\s*,|)\s*extends *\(\s*(\w*) *\) *:: * (\w*)"
# Captures type with possible public and extended attributes
# pattern_general_type = "^ *type\s*(,(\s*public\s*,|)\s*extends *\(\s*(\w*) *\) *::|) * (\w*)"
pattern_general_type = '^ *type\s*(,|)\s*(public\s*::|public|)\s*(,|)\s*(extends\((\w*)\)\s*::|) * (\w*)'
# pattern_general_type = "^ *type\s*(,(\s*public\s*|)\s*(,\s*extends\s*\(\s*(\w*) *\)|)\s*::|) * (\w*)"
pattern_end_type = "^ *END TYPE"
# Hardcoded list, this should be solved
......@@ -1696,6 +1694,8 @@ def split_hardcoded_array(string):
def split_elements_in_operations(string, routine=None, vault=None):
if not has_operations(string):
return None
operations = ["+", "-", "*", "/"]
exponentials_DPE = re.findall(pattern_exp_DPE_notation, string, re.I)
pattern_pow = r'\*\*\d+\.?'
......@@ -1708,7 +1708,7 @@ def split_elements_in_operations(string, routine=None, vault=None):
for index, exponential_DPE in enumerate(exponentials_DPE):
string = string.replace(exponential_DPE, "EXPONENTIAL_DPE" + str(index))
string = new_purge_parenthesis(string)
string = purge_parenthesis(string)
split_elements = split_elements_by_symbols(string, operations, routine=routine, vault=vault)
......@@ -1728,9 +1728,8 @@ def split_elements_in_operations(string, routine=None, vault=None):
def split_elements_in_comparison(string):
comparison_operators = [">=", "<=", "==", "/=", ">", "<", ".or.", ".and."]
elements_in_comparison = []
string = string.lower()
string = new_purge_parenthesis(string)
string = purge_parenthesis(string.lower())
for operators in comparison_operators:
if string.count(operators):
......@@ -1799,10 +1798,13 @@ def purge_arr_struc(string, ret_rep_list=False):
return string
def new_purge_parenthesis(string):
def purge_parenthesis(string):
replacement_index = 0
arrays = True
replacement_list = []
if string.strip()[0] == "[" and string.strip()[-1] == "]":
string = string.strip()[1:-1]
# Checks for all array pattern, and substitute with string
while arrays:
arrays = re.findall(vec, string)
......
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