mirror of
https://gitlab.com/scemama/irpf90.git
synced 2025-01-09 04:43:02 +01:00
Better error messages
This commit is contained in:
parent
9c369ef0d0
commit
c1059859be
@ -1,5 +1,6 @@
|
|||||||
include version
|
include version
|
||||||
default:
|
default:
|
||||||
|
set -x
|
||||||
rm *.rpm *.tar.gz *.exe.gz 2> /dev/null ;\
|
rm *.rpm *.tar.gz *.exe.gz 2> /dev/null ;\
|
||||||
VERSION=$(VERSION) epm -f portable -a noarch -m noarch irpf90 irpf90.list ;\
|
VERSION=$(VERSION) epm -f portable -a noarch -m noarch irpf90 irpf90.list ;\
|
||||||
cd noarch ;\
|
cd noarch ;\
|
||||||
|
@ -339,48 +339,52 @@ def move_variables():
|
|||||||
old_elsevars = []
|
old_elsevars = []
|
||||||
revtext = list(text)
|
revtext = list(text)
|
||||||
revtext.reverse()
|
revtext.reverse()
|
||||||
for vars,line in revtext:
|
try:
|
||||||
if type(line) in [ End_provider,End ]:
|
for vars,line in revtext:
|
||||||
varlist = []
|
if type(line) in [ End_provider,End ]:
|
||||||
append( ([],line) )
|
varlist = []
|
||||||
elif type(line) in [ Endif, End_select ]:
|
append( ([],line) )
|
||||||
old_ifvars.append( list(ifvars) )
|
elif type(line) in [ Endif, End_select ]:
|
||||||
old_elsevars.append( list(elsevars) )
|
old_ifvars.append( list(ifvars) )
|
||||||
old_varlist.append( list(varlist) )
|
old_elsevars.append( list(elsevars) )
|
||||||
varlist = []
|
|
||||||
append( ([],line) )
|
|
||||||
elif type(line) == Else:
|
|
||||||
elsevars += list(varlist)
|
|
||||||
append( (varlist,line) )
|
|
||||||
varlist = []
|
|
||||||
elif type(line) in [ Elseif, Case ]:
|
|
||||||
ifvars += list(varlist)
|
|
||||||
append( (varlist,line) )
|
|
||||||
if vars != []:
|
|
||||||
varlist = old_varlist.pop()
|
|
||||||
varlist += vars
|
|
||||||
old_varlist.append( list(varlist) )
|
old_varlist.append( list(varlist) )
|
||||||
varlist = []
|
varlist = []
|
||||||
elif type(line) in [ If, Select ]:
|
append( ([],line) )
|
||||||
ifvars += list(varlist)
|
elif type(line) == Else:
|
||||||
append( (varlist,line) )
|
elsevars += list(varlist)
|
||||||
vars += filter(lambda x: x in elsevars, ifvars)
|
append( (varlist,line) )
|
||||||
ifvars = old_ifvars.pop()
|
varlist = []
|
||||||
elsevars = old_elsevars.pop()
|
elif type(line) in [ Elseif, Case ]:
|
||||||
varlist = old_varlist.pop() + vars
|
ifvars += list(varlist)
|
||||||
elif type(line) in [ Begin_provider, Program, Subroutine, Function ]:
|
append( (varlist,line) )
|
||||||
varlist += vars
|
if vars != []:
|
||||||
append( (varlist,line) )
|
varlist = old_varlist.pop()
|
||||||
if old_varlist != [] \
|
varlist += vars
|
||||||
or old_ifvars != [] \
|
old_varlist.append( list(varlist) )
|
||||||
or old_elsevars != []:
|
varlist = []
|
||||||
error.fail(line,"End if missing")
|
elif type(line) in [ If, Select ]:
|
||||||
varlist = []
|
ifvars += list(varlist)
|
||||||
elif type(line) == Provide_all:
|
append( (varlist,line) )
|
||||||
append( (vars,line) )
|
vars += filter(lambda x: x in elsevars, ifvars)
|
||||||
else:
|
ifvars = old_ifvars.pop()
|
||||||
varlist += vars
|
elsevars = old_elsevars.pop()
|
||||||
append( ([],line) )
|
varlist = old_varlist.pop() + vars
|
||||||
|
elif type(line) in [ Begin_provider, Program, Subroutine, Function ]:
|
||||||
|
varlist += vars
|
||||||
|
append( (varlist,line) )
|
||||||
|
if old_varlist != [] \
|
||||||
|
or old_ifvars != [] \
|
||||||
|
or old_elsevars != []:
|
||||||
|
error.fail(line,"End if missing")
|
||||||
|
varlist = []
|
||||||
|
elif type(line) == Provide_all:
|
||||||
|
append( (vars,line) )
|
||||||
|
else:
|
||||||
|
varlist += vars
|
||||||
|
append( ([],line) )
|
||||||
|
except:
|
||||||
|
error.fail(line,"Unable to parse file")
|
||||||
|
|
||||||
result.reverse()
|
result.reverse()
|
||||||
|
|
||||||
# 2nd pass
|
# 2nd pass
|
||||||
@ -389,34 +393,37 @@ def move_variables():
|
|||||||
append = result.append
|
append = result.append
|
||||||
old_varlist = []
|
old_varlist = []
|
||||||
varlist = []
|
varlist = []
|
||||||
for vars,line in text:
|
try:
|
||||||
if vars != []:
|
for vars,line in text:
|
||||||
vars = make_single(vars)
|
if vars != []:
|
||||||
if type(line) in [ Begin_provider, Program, Subroutine, Function ]:
|
vars = make_single(vars)
|
||||||
varlist = list(vars)
|
if type(line) in [ Begin_provider, Program, Subroutine, Function ]:
|
||||||
elif type(line) in [ If, Select ]:
|
varlist = list(vars)
|
||||||
old_varlist.append(varlist)
|
elif type(line) in [ If, Select ]:
|
||||||
vars = filter(lambda x: x not in varlist,vars)
|
old_varlist.append(varlist)
|
||||||
varlist = make_single(varlist + vars)
|
vars = filter(lambda x: x not in varlist,vars)
|
||||||
assert old_varlist is not varlist
|
varlist = make_single(varlist + vars)
|
||||||
elif type(line) in [ Elseif, Else, Case ]:
|
assert old_varlist is not varlist
|
||||||
varlist = old_varlist.pop()
|
elif type(line) in [ Elseif, Else, Case ]:
|
||||||
old_varlist.append(varlist)
|
varlist = old_varlist.pop()
|
||||||
vars = filter(lambda x: x not in varlist,vars)
|
old_varlist.append(varlist)
|
||||||
varlist = make_single(varlist + vars)
|
vars = filter(lambda x: x not in varlist,vars)
|
||||||
assert old_varlist is not varlist
|
varlist = make_single(varlist + vars)
|
||||||
elif type(line) in [ Endif, End_select ]:
|
assert old_varlist is not varlist
|
||||||
varlist = old_varlist.pop()
|
elif type(line) in [ Endif, End_select ]:
|
||||||
elif type(line) == Provide_all:
|
varlist = old_varlist.pop()
|
||||||
vars += varlist
|
elif type(line) == Provide_all:
|
||||||
elif type(line) in [ End_provider, End ]:
|
vars += varlist
|
||||||
assert old_varlist == []
|
elif type(line) in [ End_provider, End ]:
|
||||||
varlist = []
|
assert old_varlist == []
|
||||||
for v in vars[:]:
|
varlist = []
|
||||||
if v[0] == '-':
|
for v in vars[:]:
|
||||||
vars.remove(v)
|
if v[0] == '-':
|
||||||
vars.remove(v[1:])
|
vars.remove(v)
|
||||||
result.append( (vars,line) )
|
vars.remove(v[1:])
|
||||||
|
result.append( (vars,line) )
|
||||||
|
except:
|
||||||
|
error.fail(line,"Unable to parse file")
|
||||||
return result
|
return result
|
||||||
|
|
||||||
main_result = []
|
main_result = []
|
||||||
|
Loading…
Reference in New Issue
Block a user