mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-12-21 11:53:32 +01:00
Added +=, -=, *= operators
This commit is contained in:
parent
ef72d18ddd
commit
bc137dc4a1
@ -252,6 +252,24 @@ def form(text):
|
||||
return Free_form
|
||||
return Fixed_form
|
||||
|
||||
######################################################################
|
||||
def add_operators(text):
|
||||
re_incr = re.compile(r"(\s*)(.*)(\+=)(.*$)",re.S)
|
||||
re_decr = re.compile(r"(\s*)(.*)(-=)(.*$)",re.S)
|
||||
re_mult = re.compile(r"(\s*)(.*)(\*=)(.*$)",re.S)
|
||||
'''Change additional operators'''
|
||||
result = []
|
||||
for line in text:
|
||||
buffer = line.text
|
||||
if "+=" in buffer:
|
||||
line.text = re.sub(re_incr,r'\1\2=\2+(\4)', buffer)
|
||||
elif "-=" in buffer:
|
||||
line.text = re.sub(re_decr,r'\1\2=\2-(\4)', buffer)
|
||||
elif "*=" in buffer:
|
||||
line.text = re.sub(re_mult,r'\1\2=\2*(\4)', buffer)
|
||||
result.append(line)
|
||||
return result
|
||||
|
||||
######################################################################
|
||||
def remove_comments(text,form):
|
||||
'''Remove all comments'''
|
||||
@ -717,6 +735,7 @@ def create_preprocessed_text(filename):
|
||||
result = remove_ifdefs(result)
|
||||
result = remove_comments(result,fortran_form)
|
||||
result = remove_continuation(result,fortran_form)
|
||||
result = add_operators(result)
|
||||
result = change_includes(result)
|
||||
result = change_single_line_ifs(result)
|
||||
result = process_old_style_do(result)
|
||||
|
Loading…
Reference in New Issue
Block a user