mirror of
https://gitlab.com/scemama/irpf90.git
synced 2025-01-02 09:35:41 +01:00
Bug in declaration positions
Version:1.1.24
This commit is contained in:
parent
9e5c9830fa
commit
510071f487
@ -185,6 +185,36 @@ def get_parsed_text():
|
|||||||
return main_result
|
return main_result
|
||||||
|
|
||||||
parsed_text = get_parsed_text()
|
parsed_text = get_parsed_text()
|
||||||
|
######################################################################
|
||||||
|
def move_to_top(text,t):
|
||||||
|
assert isinstance(text,list)
|
||||||
|
assert t in [ Declaration, Implicit, Use, Cont_provider ]
|
||||||
|
|
||||||
|
inside = False
|
||||||
|
for i in range(len(text)):
|
||||||
|
vars, line = text[i]
|
||||||
|
if type(line) in [ Begin_provider, Subroutine, Function ]:
|
||||||
|
begin = i
|
||||||
|
inside = True
|
||||||
|
elif type(line) in [ End_provider, End ]:
|
||||||
|
inside = False
|
||||||
|
elif isinstance(line,t):
|
||||||
|
if inside:
|
||||||
|
text.pop(i)
|
||||||
|
begin += 1
|
||||||
|
text.insert(begin,(vars,line))
|
||||||
|
|
||||||
|
return text
|
||||||
|
|
||||||
|
result = []
|
||||||
|
for filename,text in parsed_text:
|
||||||
|
text = move_to_top(text,Declaration)
|
||||||
|
text = move_to_top(text,Implicit)
|
||||||
|
text = move_to_top(text,Use)
|
||||||
|
text = move_to_top(text,Cont_provider)
|
||||||
|
result.append ( (filename,text) )
|
||||||
|
parsed_text = result
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
def move_variables():
|
def move_variables():
|
||||||
|
|
||||||
@ -237,9 +267,10 @@ def move_variables():
|
|||||||
elif type(line) in [ Begin_provider, Subroutine, Function ]:
|
elif type(line) in [ Begin_provider, Subroutine, Function ]:
|
||||||
varlist += vars
|
varlist += vars
|
||||||
result.append( (varlist,line) )
|
result.append( (varlist,line) )
|
||||||
assert old_varlist == []
|
if old_varlist != [] \
|
||||||
assert old_ifvars == []
|
or old_ifvars != [] \
|
||||||
assert old_elsevars == []
|
or old_elsevars != []:
|
||||||
|
error.fail(line,"End if missing")
|
||||||
varlist = []
|
varlist = []
|
||||||
elif isinstance(line,Provide_all):
|
elif isinstance(line,Provide_all):
|
||||||
result.append( (vars,line) )
|
result.append( (vars,line) )
|
||||||
@ -282,28 +313,6 @@ def move_variables():
|
|||||||
|
|
||||||
parsed_text = move_variables()
|
parsed_text = move_variables()
|
||||||
|
|
||||||
######################################################################
|
|
||||||
def move_to_top(text,t):
|
|
||||||
assert isinstance(text,list)
|
|
||||||
assert t in [ Declaration, Implicit, Use, Cont_provider ]
|
|
||||||
|
|
||||||
inside = False
|
|
||||||
for i in range(len(text)):
|
|
||||||
vars, line = text[i]
|
|
||||||
if type(line) in [ Begin_provider, Subroutine, Function ]:
|
|
||||||
begin = i
|
|
||||||
inside = True
|
|
||||||
elif type(line) in [ End_provider, End ]:
|
|
||||||
inside = False
|
|
||||||
elif isinstance(line,t):
|
|
||||||
if inside:
|
|
||||||
text.pop(i)
|
|
||||||
begin += 1
|
|
||||||
text.insert(begin,(vars,line))
|
|
||||||
|
|
||||||
return text
|
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
def build_needs():
|
def build_needs():
|
||||||
# Needs
|
# Needs
|
||||||
|
@ -1 +1 @@
|
|||||||
version = "1.1.23"
|
version = "1.1.24"
|
||||||
|
Loading…
Reference in New Issue
Block a user