10
0
mirror of https://gitlab.com/scemama/irpf90.git synced 2024-11-12 17:13:42 +01:00

Bug in declaration positions

Version:1.1.24
This commit is contained in:
Anthony Scemama 2009-09-24 22:44:46 +02:00
parent 9e5c9830fa
commit 510071f487
2 changed files with 35 additions and 26 deletions

View File

@ -185,6 +185,36 @@ def get_parsed_text():
return main_result
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():
@ -237,9 +267,10 @@ def move_variables():
elif type(line) in [ Begin_provider, Subroutine, Function ]:
varlist += vars
result.append( (varlist,line) )
assert old_varlist == []
assert old_ifvars == []
assert old_elsevars == []
if old_varlist != [] \
or old_ifvars != [] \
or old_elsevars != []:
error.fail(line,"End if missing")
varlist = []
elif isinstance(line,Provide_all):
result.append( (vars,line) )
@ -282,28 +313,6 @@ def 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():
# Needs

View File

@ -1 +1 @@
version = "1.1.23"
version = "1.1.24"