mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-12-21 11:53:32 +01:00
Optimizations
Version:1.1.56
This commit is contained in:
parent
1c5d5caf10
commit
5565591b8f
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python -u
|
#!/usr/bin/python -O
|
||||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||||
# the Implicit Reference to Parameters (IRP) method.
|
# the Implicit Reference to Parameters (IRP) method.
|
||||||
# Copyright (C) 2009 Anthony SCEMAMA
|
# Copyright (C) 2009 Anthony SCEMAMA
|
||||||
|
@ -32,7 +32,7 @@ from util import *
|
|||||||
|
|
||||||
|
|
||||||
def do_print_short(file,var):
|
def do_print_short(file,var):
|
||||||
assert isinstance(var,Variable)
|
assert type(var) == Variable
|
||||||
print >>file, "%s : %s :: %s %s"%( \
|
print >>file, "%s : %s :: %s %s"%( \
|
||||||
var.line.filename[0].ljust(25),
|
var.line.filename[0].ljust(25),
|
||||||
var.type.ljust(25),
|
var.type.ljust(25),
|
||||||
@ -41,7 +41,7 @@ def do_print_short(file,var):
|
|||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
def process_doc(file,line):
|
def process_doc(file,line):
|
||||||
assert isinstance(line,str)
|
assert type(line) == str
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if line == "":
|
if line == "":
|
||||||
line = ".br"
|
line = ".br"
|
||||||
@ -49,24 +49,24 @@ def process_doc(file,line):
|
|||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
def process_deps(file,l):
|
def process_deps(file,l):
|
||||||
assert isinstance(l,list)
|
assert type(l) == list
|
||||||
for v in l:
|
for v in l:
|
||||||
print >>file, "%s\n.br"%(v,)
|
print >>file, "%s\n.br"%(v,)
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
def process_types(file,var):
|
def process_types(file,var):
|
||||||
assert isinstance(var,Variable)
|
assert type(var) == Variable
|
||||||
vars = [var.name] + var.others
|
vars = [var.name] + var.others
|
||||||
for var in vars:
|
for var in vars:
|
||||||
name = var
|
name = var
|
||||||
var = variables[var]
|
var = variables[var]
|
||||||
type = var.type
|
Type = var.type
|
||||||
dim = build_dim(var.dim)
|
dim = build_dim(var.dim)
|
||||||
print >>file, "%s\t:: %s\t%s"%(type,name,dim)
|
print >>file, "%s\t:: %s\t%s"%(Type,name,dim)
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
def do_print(var):
|
def do_print(var):
|
||||||
assert isinstance(var,Variable)
|
assert type(var) == Variable
|
||||||
filename = var.line.filename[0]
|
filename = var.line.filename[0]
|
||||||
name = var.name
|
name = var.name
|
||||||
file = open("%s%s.l"%(mandir,var.name), "w")
|
file = open("%s%s.l"%(mandir,var.name), "w")
|
||||||
|
@ -46,7 +46,7 @@ class Fmodule(object):
|
|||||||
|
|
||||||
def prog_name(self):
|
def prog_name(self):
|
||||||
if '_prog_name' not in self.__dict__:
|
if '_prog_name' not in self.__dict__:
|
||||||
buffer = filter(lambda x: isinstance(x[1],Program),self.text)
|
buffer = filter(lambda x: type(x[1]) == Program,self.text)
|
||||||
if buffer == []:
|
if buffer == []:
|
||||||
self._prog_name = None
|
self._prog_name = None
|
||||||
else:
|
else:
|
||||||
@ -111,11 +111,11 @@ class Fmodule(object):
|
|||||||
result = []
|
result = []
|
||||||
inside = False
|
inside = False
|
||||||
for vars,line in text:
|
for vars,line in text:
|
||||||
if isinstance(line,Begin_provider):
|
if type(line) == Begin_provider:
|
||||||
inside = True
|
inside = True
|
||||||
if not inside:
|
if not inside:
|
||||||
result.append( (vars,line) )
|
result.append( (vars,line) )
|
||||||
if isinstance(line,End_provider):
|
if type(line) == End_provider:
|
||||||
inside = False
|
inside = False
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ class Fmodule(object):
|
|||||||
for vars,line in text:
|
for vars,line in text:
|
||||||
if type(line) in [ Subroutine, Function ]:
|
if type(line) in [ Subroutine, Function ]:
|
||||||
variable_list = list(vars)
|
variable_list = list(vars)
|
||||||
elif isinstance(line,End):
|
elif type(line) == End:
|
||||||
result += map(lambda x: ([],Use(line.i,x,line.filename)), build_use(variable_list))
|
result += map(lambda x: ([],Use(line.i,x,line.filename)), build_use(variable_list))
|
||||||
else:
|
else:
|
||||||
variable_list += vars
|
variable_list += vars
|
||||||
@ -143,11 +143,11 @@ class Fmodule(object):
|
|||||||
if inside:
|
if inside:
|
||||||
result.append( (vars,line) )
|
result.append( (vars,line) )
|
||||||
else:
|
else:
|
||||||
if isinstance(line,Use):
|
if type(line) == Use:
|
||||||
use.append( (vars,line) )
|
use.append( (vars,line) )
|
||||||
elif isinstance(line,Declaration):
|
elif type(line) == Declaration:
|
||||||
dec.append( (vars,line) )
|
dec.append( (vars,line) )
|
||||||
if isinstance(line,End):
|
if type(line) == End:
|
||||||
inside = False
|
inside = False
|
||||||
return use, dec, result
|
return use, dec, result
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ def find_funcs_in_line(line):
|
|||||||
|
|
||||||
|
|
||||||
def find_subroutine_in_line(line):
|
def find_subroutine_in_line(line):
|
||||||
assert isinstance(line,Call)
|
assert type(line) == Call
|
||||||
buffer = line.text.split('(')[0]
|
buffer = line.text.split('(')[0]
|
||||||
buffer = buffer.split()[1]
|
buffer = buffer.split()[1]
|
||||||
return buffer
|
return buffer
|
||||||
@ -102,7 +102,7 @@ def update_variables():
|
|||||||
error.fail(line,"Variable %s unknown"%(v,))
|
error.fail(line,"Variable %s unknown"%(v,))
|
||||||
variables[v]._is_touched = True
|
variables[v]._is_touched = True
|
||||||
|
|
||||||
for line in filter(lambda x: isinstance(x,Free),text):
|
for line in filter(lambda x: type(x) == Free,text):
|
||||||
vars = line.text_lower.split()
|
vars = line.text_lower.split()
|
||||||
if len(vars) < 2:
|
if len(vars) < 2:
|
||||||
error.fail(line,"Syntax error")
|
error.fail(line,"Syntax error")
|
||||||
@ -111,10 +111,10 @@ def update_variables():
|
|||||||
error.fail(line,"Variable %s unknown"%(v,))
|
error.fail(line,"Variable %s unknown"%(v,))
|
||||||
variables[v].is_freed = True
|
variables[v].is_freed = True
|
||||||
|
|
||||||
for line in filter(lambda x: isinstance(x,Irp_read),text):
|
for line in filter(lambda x: type(x) == Irp_read,text):
|
||||||
variables[line.filename]._is_read = True
|
variables[line.filename]._is_read = True
|
||||||
|
|
||||||
for line in filter(lambda x: isinstance(x,Irp_write),text):
|
for line in filter(lambda x: type (x) == Irp_write,text):
|
||||||
variables[line.filename]._is_written = True
|
variables[line.filename]._is_written = True
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -124,9 +124,9 @@ def get_parsed_text():
|
|||||||
varlist = []
|
varlist = []
|
||||||
result = []
|
result = []
|
||||||
append = result.append
|
append = result.append
|
||||||
for line in filter(
|
for line in text: #filter(
|
||||||
lambda x: type(x) not in [ Doc, Begin_doc, End_doc ],
|
# lambda x: type(x) not in [ Doc, Begin_doc, End_doc ],
|
||||||
text):
|
# text):
|
||||||
if type(line) in [ \
|
if type(line) in [ \
|
||||||
Empty_line,
|
Empty_line,
|
||||||
Continue,
|
Continue,
|
||||||
@ -145,42 +145,31 @@ def get_parsed_text():
|
|||||||
End,
|
End,
|
||||||
]:
|
]:
|
||||||
append( ([],line) )
|
append( ([],line) )
|
||||||
elif isinstance(line,End_provider):
|
elif type(line) in [ Begin_provider, Cont_provider ]:
|
||||||
|
if type(line) == Begin_provider:
|
||||||
|
varlist = []
|
||||||
|
buffer = map(strip,line.text_lower.replace(']','').split(','))
|
||||||
|
assert len(buffer) > 1
|
||||||
|
v = buffer[1]
|
||||||
|
varlist.append(v)
|
||||||
|
variable_list = find_variables_in_line(line)
|
||||||
|
try:
|
||||||
|
variable_list.remove(variables[v].same_as)
|
||||||
|
except ValueError:
|
||||||
|
print v, variables[v].same_as
|
||||||
|
raise
|
||||||
|
append( (variable_list,line) )
|
||||||
|
elif type(line) == End_provider:
|
||||||
varlist = []
|
varlist = []
|
||||||
append( ([],line) )
|
append( ([],line) )
|
||||||
elif isinstance(line,Provide):
|
elif type(line) == Provide:
|
||||||
l = line.text_lower.split()[1:]
|
l = line.text_lower.split()[1:]
|
||||||
l = filter(lambda x: x not in varlist, l)
|
l = filter(lambda x: x not in varlist, l)
|
||||||
for v in l:
|
for v in l:
|
||||||
if v not in variables.keys():
|
if v not in variables.keys():
|
||||||
error.fail(line,"Variable %s is unknown"%(v))
|
error.fail(line,"Variable %s is unknown"%(v))
|
||||||
append( (l,Simple_line(line.i,"!%s"%(line.text),line.filename)) )
|
append( (l,Simple_line(line.i,"!%s"%(line.text),line.filename)) )
|
||||||
elif isinstance(line,Call):
|
elif type(line) in [ Touch, SoftTouch ]:
|
||||||
l = find_variables_in_line(line)
|
|
||||||
l = filter(lambda x: x not in varlist, l)
|
|
||||||
sub = find_subroutine_in_line(line)
|
|
||||||
if sub not in subroutines:
|
|
||||||
t = Simple_line
|
|
||||||
append( (l,Simple_line(line.i,line.text,line.filename)) )
|
|
||||||
else:
|
|
||||||
append( (l,line) )
|
|
||||||
if subroutines[sub].touches != []:
|
|
||||||
append( ([],Provide_all(line.i,"",line.filename)) )
|
|
||||||
elif isinstance(line,Free):
|
|
||||||
vars = line.text_lower.split()
|
|
||||||
vars = vars[1:]
|
|
||||||
append( ([],Simple_line(line.i,"!%s"%(line.text),line.filename)) )
|
|
||||||
use = map(lambda x: " use %s"%(variables[x].fmodule),vars)
|
|
||||||
for var in vars:
|
|
||||||
result += map(lambda x: ([],Use(line.i,x,line.filename)),
|
|
||||||
make_single(use))
|
|
||||||
result += map(lambda x: ([],Simple_line(line.i,x,line.filename)),
|
|
||||||
variables[var].free)
|
|
||||||
elif isinstance(line,Irp_read):
|
|
||||||
append( ([],Simple_line(line.i,"!%s"%(line.text),line.filename)) )
|
|
||||||
elif isinstance(line,Irp_write):
|
|
||||||
append( ([],Simple_line(line.i,"!%s"%(line.text),line.filename)) )
|
|
||||||
elif isinstance(line,Touch):
|
|
||||||
vars = line.text_lower.split()
|
vars = line.text_lower.split()
|
||||||
if len(vars) < 2:
|
if len(vars) < 2:
|
||||||
error.fail(line,"Syntax error")
|
error.fail(line,"Syntax error")
|
||||||
@ -204,24 +193,37 @@ def get_parsed_text():
|
|||||||
error.fail(line,"Variable %s unknown"%(x,))
|
error.fail(line,"Variable %s unknown"%(x,))
|
||||||
return ([],Simple_line(line.i," %s_is_built = .True."%(x,),line.filename))
|
return ([],Simple_line(line.i," %s_is_built = .True."%(x,),line.filename))
|
||||||
result += map( fun, main_vars[:-1] )
|
result += map( fun, main_vars[:-1] )
|
||||||
if isinstance(line,SoftTouch):
|
if type(line) == SoftTouch:
|
||||||
append ( ([],Simple_line(line.i,"! <<< END TOUCH (Soft)",line.filename)) )
|
append ( ([],Simple_line(line.i,"! <<< END TOUCH (Soft)",line.filename)) )
|
||||||
else:
|
else:
|
||||||
append ( ([],Provide_all(line.i,"! <<< END TOUCH",line.filename)) )
|
append ( ([],Provide_all(line.i,"! <<< END TOUCH",line.filename)) )
|
||||||
elif type(line) in [ Begin_provider, Cont_provider ]:
|
elif type(line) == Call:
|
||||||
if isinstance(line,Begin_provider):
|
l = find_variables_in_line(line)
|
||||||
varlist = []
|
l = filter(lambda x: x not in varlist, l)
|
||||||
buffer = map(strip,line.text_lower.replace(']','').split(','))
|
sub = find_subroutine_in_line(line)
|
||||||
assert len(buffer) > 1
|
if sub not in subroutines:
|
||||||
v = buffer[1]
|
t = Simple_line
|
||||||
varlist.append(v)
|
append( (l,Simple_line(line.i,line.text,line.filename)) )
|
||||||
variable_list = find_variables_in_line(line)
|
else:
|
||||||
try:
|
append( (l,line) )
|
||||||
variable_list.remove(variables[v].same_as)
|
if subroutines[sub].touches != []:
|
||||||
except ValueError:
|
append( ([],Provide_all(line.i,"",line.filename)) )
|
||||||
print v, variables[v].same_as
|
elif type(line) == Free:
|
||||||
raise
|
vars = line.text_lower.split()
|
||||||
append( (variable_list,line) )
|
vars = vars[1:]
|
||||||
|
append( ([],Simple_line(line.i,"!%s"%(line.text),line.filename)) )
|
||||||
|
use = map(lambda x: " use %s"%(variables[x].fmodule),vars)
|
||||||
|
for var in vars:
|
||||||
|
result += map(lambda x: ([],Use(line.i,x,line.filename)),
|
||||||
|
make_single(use))
|
||||||
|
result += map(lambda x: ([],Simple_line(line.i,x,line.filename)),
|
||||||
|
variables[var].free)
|
||||||
|
elif type(line) == Irp_read:
|
||||||
|
append( ([],Simple_line(line.i,"!%s"%(line.text),line.filename)) )
|
||||||
|
elif type(line) == Irp_write:
|
||||||
|
append( ([],Simple_line(line.i,"!%s"%(line.text),line.filename)) )
|
||||||
|
elif type(line) in [ Begin_doc, End_doc, Doc ]:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
l = find_variables_in_line(line)
|
l = find_variables_in_line(line)
|
||||||
l = filter(lambda x: x not in varlist, l)
|
l = filter(lambda x: x not in varlist, l)
|
||||||
@ -241,7 +243,7 @@ parsed_text = get_parsed_text()
|
|||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
def move_to_top(text,t):
|
def move_to_top(text,t):
|
||||||
assert isinstance(text,list)
|
assert type(text) == list
|
||||||
assert t in [ Declaration, Implicit, Use, Cont_provider ]
|
assert t in [ Declaration, Implicit, Use, Cont_provider ]
|
||||||
|
|
||||||
inside = False
|
inside = False
|
||||||
@ -252,7 +254,7 @@ def move_to_top(text,t):
|
|||||||
inside = True
|
inside = True
|
||||||
elif type(line) in [ End_provider, End ]:
|
elif type(line) in [ End_provider, End ]:
|
||||||
inside = False
|
inside = False
|
||||||
elif isinstance(line,t):
|
elif type(line) == t:
|
||||||
if inside:
|
if inside:
|
||||||
text.pop(i)
|
text.pop(i)
|
||||||
begin += 1
|
begin += 1
|
||||||
@ -322,7 +324,7 @@ def move_variables():
|
|||||||
or old_elsevars != []:
|
or old_elsevars != []:
|
||||||
error.fail(line,"End if missing")
|
error.fail(line,"End if missing")
|
||||||
varlist = []
|
varlist = []
|
||||||
elif isinstance(line,Provide_all):
|
elif type(line) == Provide_all:
|
||||||
append( (vars,line) )
|
append( (vars,line) )
|
||||||
else:
|
else:
|
||||||
varlist += vars
|
varlist += vars
|
||||||
@ -380,7 +382,7 @@ def build_sub_needs():
|
|||||||
sub = subroutines[subname]
|
sub = subroutines[subname]
|
||||||
sub.needs = []
|
sub.needs = []
|
||||||
sub.to_provide = vars
|
sub.to_provide = vars
|
||||||
elif isinstance(line,End):
|
elif type(line) == End:
|
||||||
sub.needs = make_single(sub.needs)
|
sub.needs = make_single(sub.needs)
|
||||||
sub = None
|
sub = None
|
||||||
if sub is not None:
|
if sub is not None:
|
||||||
@ -395,7 +397,7 @@ def add_subroutine_needs():
|
|||||||
result = []
|
result = []
|
||||||
append = result.append
|
append = result.append
|
||||||
for vars,line in text:
|
for vars,line in text:
|
||||||
if isinstance(line,Call):
|
if type(line) == Call:
|
||||||
subname = find_subname(line)
|
subname = find_subname(line)
|
||||||
vars = subroutines[subname].to_provide
|
vars = subroutines[subname].to_provide
|
||||||
append( (vars,line) )
|
append( (vars,line) )
|
||||||
@ -411,18 +413,18 @@ def build_needs():
|
|||||||
for filename, text in parsed_text:
|
for filename, text in parsed_text:
|
||||||
var = None
|
var = None
|
||||||
for vars,line in text:
|
for vars,line in text:
|
||||||
if isinstance(line,Begin_provider):
|
if type(line) == Begin_provider:
|
||||||
buffer = map(strip,line.text_lower.replace(']',',').split(','))
|
buffer = map(strip,line.text_lower.replace(']',',').split(','))
|
||||||
var = variables[buffer[1]]
|
var = variables[buffer[1]]
|
||||||
var.needs = []
|
var.needs = []
|
||||||
var.to_provide = vars
|
var.to_provide = vars
|
||||||
elif isinstance(line,End_provider):
|
elif type(line) == End_provider:
|
||||||
var.needs = make_single(var.needs)
|
var.needs = make_single(var.needs)
|
||||||
var.to_provide = make_single(var.to_provide)
|
var.to_provide = make_single(var.to_provide)
|
||||||
var = None
|
var = None
|
||||||
if var is not None:
|
if var is not None:
|
||||||
var.needs += vars
|
var.needs += vars
|
||||||
if isinstance(line,Call):
|
if type(line) == Call:
|
||||||
subname = find_subname(line)
|
subname = find_subname(line)
|
||||||
var.needs += subroutines[subname].needs
|
var.needs += subroutines[subname].needs
|
||||||
elif type(line) in [ \
|
elif type(line) in [ \
|
||||||
@ -478,14 +480,14 @@ def check_opt():
|
|||||||
for filename, text in parsed_text:
|
for filename, text in parsed_text:
|
||||||
do_level = 0
|
do_level = 0
|
||||||
for vars,line in text:
|
for vars,line in text:
|
||||||
if not isinstance(line,Provide_all):
|
if not type(line) == Provide_all:
|
||||||
if do_level > 0 and vars != []:
|
if do_level > 0 and vars != []:
|
||||||
print "Optimization: %s line %d"%(line.filename,line.i)
|
print "Optimization: %s line %d"%(line.filename,line.i)
|
||||||
for v in vars:
|
for v in vars:
|
||||||
print " PROVIDE ",v
|
print " PROVIDE ",v
|
||||||
if isinstance(line,Do):
|
if type(line) == Do:
|
||||||
do_level += 1
|
do_level += 1
|
||||||
elif isinstance(line,Enddo):
|
elif type(line) == Enddo:
|
||||||
do_level -= 1
|
do_level -= 1
|
||||||
check_opt()
|
check_opt()
|
||||||
|
|
||||||
|
@ -88,10 +88,10 @@ simple_dict_keys = simple_dict.keys()
|
|||||||
|
|
||||||
def get_type (i, filename, line, is_doc):
|
def get_type (i, filename, line, is_doc):
|
||||||
'''Find the type of a text line'''
|
'''Find the type of a text line'''
|
||||||
assert isinstance(i,int)
|
assert type(i) == int
|
||||||
assert isinstance(filename,str)
|
assert type(filename) == str
|
||||||
assert isinstance(line,str)
|
assert type(line) == str
|
||||||
assert isinstance(is_doc,bool)
|
assert type(is_doc) == bool
|
||||||
|
|
||||||
line = line.rstrip()
|
line = line.rstrip()
|
||||||
lower_line0 = line.lstrip().lower()
|
lower_line0 = line.lstrip().lower()
|
||||||
@ -165,8 +165,8 @@ instead of
|
|||||||
######################################################################
|
######################################################################
|
||||||
def get_text(lines,filename):
|
def get_text(lines,filename):
|
||||||
'''Read the input file and transform it to labeled lines'''
|
'''Read the input file and transform it to labeled lines'''
|
||||||
assert isinstance(filename,str)
|
assert type(filename) == str
|
||||||
assert isinstance(lines,list)
|
assert type(lines) == list
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
is_doc = False
|
is_doc = False
|
||||||
@ -183,9 +183,9 @@ def execute_shell(text):
|
|||||||
result = []
|
result = []
|
||||||
for line in text:
|
for line in text:
|
||||||
if inside:
|
if inside:
|
||||||
if isinstance(line,Begin_shell):
|
if type(line) == Begin_shell:
|
||||||
error.fail(line,"Nested Begin_shell")
|
error.fail(line,"Nested Begin_shell")
|
||||||
elif isinstance(line,End_shell):
|
elif type(line) == End_shell:
|
||||||
inside = False
|
inside = False
|
||||||
# Write script file
|
# Write script file
|
||||||
scriptname = "%s%s_shell_%d"%(irpdir,line.filename,line.i)
|
scriptname = "%s%s_shell_%d"%(irpdir,line.filename,line.i)
|
||||||
@ -206,7 +206,7 @@ def execute_shell(text):
|
|||||||
else:
|
else:
|
||||||
script.append(line.text+'\n')
|
script.append(line.text+'\n')
|
||||||
else:
|
else:
|
||||||
if isinstance(line,Begin_shell):
|
if type(line) == Begin_shell:
|
||||||
inside = True
|
inside = True
|
||||||
begin = line.i
|
begin = line.i
|
||||||
script = []
|
script = []
|
||||||
@ -223,7 +223,7 @@ def execute_shell(text):
|
|||||||
elif len(buffer) < 2:
|
elif len(buffer) < 2:
|
||||||
fail(line,"Missing",']')
|
fail(line,"Missing",']')
|
||||||
shell = buffer[0].strip()
|
shell = buffer[0].strip()
|
||||||
elif isinstance(line,End_shell):
|
elif type(line) == End_shell:
|
||||||
error.fail(line,"Begin_shell missing")
|
error.fail(line,"Begin_shell missing")
|
||||||
else:
|
else:
|
||||||
result.append(line)
|
result.append(line)
|
||||||
@ -248,18 +248,18 @@ def execute_templates(text):
|
|||||||
result = []
|
result = []
|
||||||
for line in text:
|
for line in text:
|
||||||
if inside == 0:
|
if inside == 0:
|
||||||
if isinstance(line,Begin_template):
|
if type(line) == Begin_template:
|
||||||
script = []
|
script = []
|
||||||
inside = TEMPLATE
|
inside = TEMPLATE
|
||||||
script = "template = \"\"\"\n"
|
script = "template = \"\"\"\n"
|
||||||
else:
|
else:
|
||||||
result.append(line)
|
result.append(line)
|
||||||
elif inside == TEMPLATE:
|
elif inside == TEMPLATE:
|
||||||
if isinstance(line,Begin_template):
|
if type(line) == Begin_template:
|
||||||
fail(line,"template", "Nested Begin_Template")
|
fail(line,"template", "Nested Begin_Template")
|
||||||
elif isinstance(line,End_template):
|
elif type(line) == End_template:
|
||||||
fail(line,"template","Missing Subst")
|
fail(line,"template","Missing Subst")
|
||||||
elif isinstance(line,Subst):
|
elif type(line) == Subst:
|
||||||
inside = SUBST
|
inside = SUBST
|
||||||
script += "\"\"\"\n"
|
script += "\"\"\"\n"
|
||||||
variables = get_variables(line)
|
variables = get_variables(line)
|
||||||
@ -268,11 +268,11 @@ def execute_templates(text):
|
|||||||
else:
|
else:
|
||||||
script += line.text+"\n"
|
script += line.text+"\n"
|
||||||
else: # inside == SUBST
|
else: # inside == SUBST
|
||||||
if isinstance(line,Begin_template):
|
if type(line) == Begin_template:
|
||||||
fail(line,"subst","Nested Begin_template")
|
fail(line,"subst","Nested Begin_template")
|
||||||
elif isinstance(line,Subst):
|
elif type(line) == Subst:
|
||||||
fail(line,"subst","Subst already defined")
|
fail(line,"subst","Subst already defined")
|
||||||
elif isinstance(line,End_template):
|
elif type(line) == End_template:
|
||||||
inside = 0
|
inside = 0
|
||||||
subst = subst.rstrip()
|
subst = subst.rstrip()
|
||||||
if subst[-2:] == ';;':
|
if subst[-2:] == ';;':
|
||||||
@ -313,7 +313,7 @@ def execute_templates(text):
|
|||||||
######################################################################
|
######################################################################
|
||||||
def form(text):
|
def form(text):
|
||||||
'''Find if the text is in fixed form or in free form'''
|
'''Find if the text is in fixed form or in free form'''
|
||||||
assert isinstance(text,list)
|
assert type(text) == list
|
||||||
if len(text) == 0:
|
if len(text) == 0:
|
||||||
return Free_form
|
return Free_form
|
||||||
assert isinstance(text[0],Line)
|
assert isinstance(text[0],Line)
|
||||||
@ -370,7 +370,7 @@ def remove_comments(text,form):
|
|||||||
for line in text:
|
for line in text:
|
||||||
if type(line) in [ Openmp, Doc] :
|
if type(line) in [ Openmp, Doc] :
|
||||||
result.append(line)
|
result.append(line)
|
||||||
elif isinstance(line,Empty_line):
|
elif type(line) == Empty_line:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
newline = line.text.lstrip()
|
newline = line.text.lstrip()
|
||||||
@ -384,7 +384,7 @@ def remove_comments(text,form):
|
|||||||
for line in text:
|
for line in text:
|
||||||
if type(line) in [ Openmp, Doc ]:
|
if type(line) in [ Openmp, Doc ]:
|
||||||
result.append(line)
|
result.append(line)
|
||||||
elif isinstance(line,Empty_line):
|
elif type(line) == Empty_line:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
newline = line.text.lstrip()
|
newline = line.text.lstrip()
|
||||||
@ -424,7 +424,7 @@ def remove_continuation(text,form):
|
|||||||
rev_text.reverse()
|
rev_text.reverse()
|
||||||
for line in rev_text:
|
for line in rev_text:
|
||||||
is_continuation = False
|
is_continuation = False
|
||||||
if isinstance(line,Simple_line):
|
if type(line) == Simple_line:
|
||||||
if len(line.text) >= 6:
|
if len(line.text) >= 6:
|
||||||
if line.text[5] != ' ':
|
if line.text[5] != ' ':
|
||||||
is_continuation = True
|
is_continuation = True
|
||||||
@ -442,7 +442,7 @@ def irp_simple_statements(text):
|
|||||||
'''Processes simple statements'''
|
'''Processes simple statements'''
|
||||||
|
|
||||||
def process_irp_rw(line,rw,t):
|
def process_irp_rw(line,rw,t):
|
||||||
assert isinstance(line,t)
|
assert type(line) == t
|
||||||
buffer = line.text.split()
|
buffer = line.text.split()
|
||||||
if len(buffer) == 2:
|
if len(buffer) == 2:
|
||||||
dummy, variable = buffer
|
dummy, variable = buffer
|
||||||
@ -465,15 +465,15 @@ def irp_simple_statements(text):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def process_irp_read (line):
|
def process_irp_read (line):
|
||||||
assert isinstance(line,Irp_read)
|
assert type(line) == Irp_read
|
||||||
return process_irp_rw(line,'read' ,Irp_read )
|
return process_irp_rw(line,'read' ,Irp_read )
|
||||||
|
|
||||||
def process_irp_write(line):
|
def process_irp_write(line):
|
||||||
assert isinstance(line,Irp_write)
|
assert type(line) == Irp_write
|
||||||
return process_irp_rw(line,'writ' ,Irp_write)
|
return process_irp_rw(line,'writ' ,Irp_write)
|
||||||
|
|
||||||
def process_return(line):
|
def process_return(line):
|
||||||
assert isinstance(line,Return)
|
assert type(line) == Return
|
||||||
if command_line.do_assert or command_line.do_debug:
|
if command_line.do_assert or command_line.do_debug:
|
||||||
newline = Simple_line(line.i," call irp_leave(irp_here)",line.filename)
|
newline = Simple_line(line.i," call irp_leave(irp_here)",line.filename)
|
||||||
result = [newline, line]
|
result = [newline, line]
|
||||||
@ -483,7 +483,7 @@ def irp_simple_statements(text):
|
|||||||
|
|
||||||
def debug_conditions(line):
|
def debug_conditions(line):
|
||||||
'''Find condition in assert statement for debug'''
|
'''Find condition in assert statement for debug'''
|
||||||
assert isinstance(line,Assert)
|
assert type(line) == Assert
|
||||||
match = re_test.search(line.text)
|
match = re_test.search(line.text)
|
||||||
result = []
|
result = []
|
||||||
if match is not None:
|
if match is not None:
|
||||||
@ -495,7 +495,7 @@ def irp_simple_statements(text):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def process_assert(line):
|
def process_assert(line):
|
||||||
assert isinstance(line,Assert)
|
assert type(line) == Assert
|
||||||
if command_line.do_assert:
|
if command_line.do_assert:
|
||||||
condition = "(%s"%(line.text.split('(',1)[1])
|
condition = "(%s"%(line.text.split('(',1)[1])
|
||||||
if condition == "":
|
if condition == "":
|
||||||
@ -537,7 +537,7 @@ def irp_simple_statements(text):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def process_begin_provider(line):
|
def process_begin_provider(line):
|
||||||
assert isinstance(line,Begin_provider)
|
assert type(line) == Begin_provider
|
||||||
buffer = line.lower.replace('['," ")
|
buffer = line.lower.replace('['," ")
|
||||||
buffer = buffer.replace(']',"")
|
buffer = buffer.replace(']',"")
|
||||||
buffer = buffer.split(',')
|
buffer = buffer.split(',')
|
||||||
@ -556,7 +556,7 @@ def irp_simple_statements(text):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def process_cont_provider(line):
|
def process_cont_provider(line):
|
||||||
assert isinstance(line,Cont_provider)
|
assert type(line) == Cont_provider
|
||||||
buffer = line.lower.replace('['," ")
|
buffer = line.lower.replace('['," ")
|
||||||
buffer = buffer.replace(']',"")
|
buffer = buffer.replace(']',"")
|
||||||
buffer = buffer.split(',')
|
buffer = buffer.split(',')
|
||||||
@ -568,7 +568,7 @@ def irp_simple_statements(text):
|
|||||||
return [ Cont_provider(i,line.text,(f,varname)) ]
|
return [ Cont_provider(i,line.text,(f,varname)) ]
|
||||||
|
|
||||||
def process_subroutine(line):
|
def process_subroutine(line):
|
||||||
assert isinstance(line,Subroutine)
|
assert type(line) == Subroutine
|
||||||
subname = find_subname(line)
|
subname = find_subname(line)
|
||||||
length = len(subname)
|
length = len(subname)
|
||||||
i = line.i
|
i = line.i
|
||||||
@ -582,7 +582,7 @@ def irp_simple_statements(text):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def process_function(line):
|
def process_function(line):
|
||||||
assert isinstance(line,Function)
|
assert type(line) == Function
|
||||||
buffer = line.text.split('(')
|
buffer = line.text.split('(')
|
||||||
subname = find_subname(line)
|
subname = find_subname(line)
|
||||||
length = len(subname)
|
length = len(subname)
|
||||||
@ -598,7 +598,7 @@ def irp_simple_statements(text):
|
|||||||
|
|
||||||
|
|
||||||
def process_program(line):
|
def process_program(line):
|
||||||
assert isinstance(line,Program)
|
assert type(line) == Program
|
||||||
program_name = line.lower.split()[1]
|
program_name = line.lower.split()[1]
|
||||||
result = [ Program(0,"",program_name) ] + \
|
result = [ Program(0,"",program_name) ] + \
|
||||||
process_subroutine( Subroutine(line.i,"subroutine %s"%(program_name,),line.filename) )
|
process_subroutine( Subroutine(line.i,"subroutine %s"%(program_name,),line.filename) )
|
||||||
@ -621,7 +621,7 @@ def irp_simple_statements(text):
|
|||||||
for line in text:
|
for line in text:
|
||||||
buffer = [ line ]
|
buffer = [ line ]
|
||||||
for t in d.keys():
|
for t in d.keys():
|
||||||
if isinstance(line,t):
|
if type(line) == t:
|
||||||
buffer = d[t](line)
|
buffer = d[t](line)
|
||||||
break
|
break
|
||||||
result += buffer
|
result += buffer
|
||||||
@ -633,7 +633,7 @@ def change_includes(text):
|
|||||||
'''Deals with include files'''
|
'''Deals with include files'''
|
||||||
result = []
|
result = []
|
||||||
for line in text:
|
for line in text:
|
||||||
if (isinstance(line,Include)):
|
if type(line) == Include:
|
||||||
txt = line.text.replace('"',"'").split("'")
|
txt = line.text.replace('"',"'").split("'")
|
||||||
if len(txt) != 3:
|
if len(txt) != 3:
|
||||||
print txt
|
print txt
|
||||||
@ -652,7 +652,7 @@ def change_includes(text):
|
|||||||
######################################################################
|
######################################################################
|
||||||
def process_old_style_do(text):
|
def process_old_style_do(text):
|
||||||
'''Changes old-style do loops to new style'''
|
'''Changes old-style do loops to new style'''
|
||||||
assert isinstance(text,list)
|
assert type(text) == list
|
||||||
|
|
||||||
def change_matching_enddo(begin,number):
|
def change_matching_enddo(begin,number):
|
||||||
for i in range(begin+1,len(text)):
|
for i in range(begin+1,len(text)):
|
||||||
@ -667,7 +667,7 @@ def process_old_style_do(text):
|
|||||||
result = []
|
result = []
|
||||||
for i in range(len(text)):
|
for i in range(len(text)):
|
||||||
line = text[i]
|
line = text[i]
|
||||||
if isinstance(line,Do):
|
if type(line) == Do:
|
||||||
buffer = line.text.split()
|
buffer = line.text.split()
|
||||||
if buffer[1].isdigit():
|
if buffer[1].isdigit():
|
||||||
number = buffer.pop(1)
|
number = buffer.pop(1)
|
||||||
@ -687,10 +687,10 @@ if (test) then
|
|||||||
result
|
result
|
||||||
endif'''
|
endif'''
|
||||||
|
|
||||||
assert isinstance(text,list)
|
assert type(text) == list
|
||||||
result = []
|
result = []
|
||||||
for line in text:
|
for line in text:
|
||||||
if isinstance(line,If):
|
if type(line) == If:
|
||||||
if line.lower.endswith("then"):
|
if line.lower.endswith("then"):
|
||||||
result.append(line)
|
result.append(line)
|
||||||
else:
|
else:
|
||||||
@ -737,15 +737,15 @@ def check_begin_end(text):
|
|||||||
d = { 'do' : Do, 'enddo': Enddo,
|
d = { 'do' : Do, 'enddo': Enddo,
|
||||||
'if' : If, 'endif': Endif,
|
'if' : If, 'endif': Endif,
|
||||||
'_doc': Begin_doc, 'end_doc': End_doc}
|
'_doc': Begin_doc, 'end_doc': End_doc}
|
||||||
assert isinstance(text,list)
|
assert type(text) == list
|
||||||
|
|
||||||
def find_matching_end_ifdo(begin,x):
|
def find_matching_end_ifdo(begin,x):
|
||||||
level = 1
|
level = 1
|
||||||
for i in range(begin+1,len(text)):
|
for i in range(begin+1,len(text)):
|
||||||
line = text[i]
|
line = text[i]
|
||||||
if isinstance(line,d[x]):
|
if type(line) == d[x]:
|
||||||
level += 1
|
level += 1
|
||||||
elif isinstance(line,d["end%s"%(x,)]):
|
elif type(line) == d["end%s"%(x,)]:
|
||||||
level -= 1
|
level -= 1
|
||||||
if level == 0:
|
if level == 0:
|
||||||
return True
|
return True
|
||||||
@ -756,7 +756,7 @@ def check_begin_end(text):
|
|||||||
def find_matching_end_subfunpro(begin,x):
|
def find_matching_end_subfunpro(begin,x):
|
||||||
for i in range(begin+1,len(text)):
|
for i in range(begin+1,len(text)):
|
||||||
line = text[i]
|
line = text[i]
|
||||||
if isinstance(line,x):
|
if type(line) == x:
|
||||||
return
|
return
|
||||||
if type(line) in [ Subroutine, Function, Begin_provider ]:
|
if type(line) in [ Subroutine, Function, Begin_provider ]:
|
||||||
error.fail(text[begin],"Subroutine/Function/Provider is not closed")
|
error.fail(text[begin],"Subroutine/Function/Provider is not closed")
|
||||||
@ -765,25 +765,25 @@ def check_begin_end(text):
|
|||||||
|
|
||||||
level = 0
|
level = 0
|
||||||
for i,line in enumerate(text):
|
for i,line in enumerate(text):
|
||||||
if isinstance(line,Begin_doc):
|
if type(line) == Begin_doc:
|
||||||
find_matching_end_ifdo(i,'_doc')
|
find_matching_end_ifdo(i,'_doc')
|
||||||
for i,line in enumerate(text):
|
for i,line in enumerate(text):
|
||||||
if isinstance(line,Do):
|
if type(line) == Do:
|
||||||
find_matching_end_ifdo(i,'do')
|
find_matching_end_ifdo(i,'do')
|
||||||
elif isinstance(line,If):
|
elif type(line) == If:
|
||||||
find_matching_end_ifdo(i,'if')
|
find_matching_end_ifdo(i,'if')
|
||||||
elif isinstance(line,Subroutine):
|
elif type(line) == Subroutine:
|
||||||
level += 1
|
level += 1
|
||||||
find_matching_end_subfunpro(i,End)
|
find_matching_end_subfunpro(i,End)
|
||||||
elif isinstance(line,Function):
|
elif type(line) == Function:
|
||||||
level += 1
|
level += 1
|
||||||
find_matching_end_subfunpro(i,End)
|
find_matching_end_subfunpro(i,End)
|
||||||
elif isinstance(line,Begin_provider):
|
elif type(line) == Begin_provider:
|
||||||
level += 1
|
level += 1
|
||||||
find_matching_end_subfunpro(i,End_provider)
|
find_matching_end_subfunpro(i,End_provider)
|
||||||
elif isinstance(line,End):
|
elif type(line) == End:
|
||||||
level -= 1
|
level -= 1
|
||||||
elif isinstance(line,End_provider):
|
elif type(line) == End_provider:
|
||||||
level -= 1
|
level -= 1
|
||||||
if level < 0:
|
if level < 0:
|
||||||
error.fail(line,"Beginning of block not matched")
|
error.fail(line,"Beginning of block not matched")
|
||||||
@ -792,16 +792,16 @@ def check_begin_end(text):
|
|||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
def remove_ifdefs(text):
|
def remove_ifdefs(text):
|
||||||
assert isinstance(text,list)
|
assert type(text) == list
|
||||||
result = []
|
result = []
|
||||||
do_print = True
|
do_print = True
|
||||||
for line in text:
|
for line in text:
|
||||||
if isinstance(line,Irp_If):
|
if type(line) == Irp_If:
|
||||||
var = line.text.split()[1]
|
var = line.text.split()[1]
|
||||||
do_print = var in command_line.defined
|
do_print = var in command_line.defined
|
||||||
elif isinstance(line,Irp_Else):
|
elif type(line) == Irp_Else:
|
||||||
do_print = not do_print
|
do_print = not do_print
|
||||||
elif isinstance(line,Irp_Endif):
|
elif type(line) == Irp_Endif:
|
||||||
do_print = True
|
do_print = True
|
||||||
else:
|
else:
|
||||||
if do_print:
|
if do_print:
|
||||||
|
@ -33,7 +33,7 @@ class Sub(object):
|
|||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
def __init__(self,text):
|
def __init__(self,text):
|
||||||
assert isinstance(text,list)
|
assert type(text) == list
|
||||||
assert len(text) > 0
|
assert len(text) > 0
|
||||||
assert type(text[0]) in [Subroutine, Function]
|
assert type(text[0]) in [Subroutine, Function]
|
||||||
self.text = text
|
self.text = text
|
||||||
@ -57,7 +57,7 @@ class Sub(object):
|
|||||||
def doc(self):
|
def doc(self):
|
||||||
if '_doc' not in self.__dict__:
|
if '_doc' not in self.__dict__:
|
||||||
def f(l): return
|
def f(l): return
|
||||||
buffer = filter(lambda l:isinstance(l,Doc), self.text)
|
buffer = filter(lambda l:type(l) == Doc, self.text)
|
||||||
self._doc = map(lambda l: l.text[1:], buffer)
|
self._doc = map(lambda l: l.text[1:], buffer)
|
||||||
if buffer == []:
|
if buffer == []:
|
||||||
error.warn(None,"Subroutine %s is not documented"%(self.name))
|
error.warn(None,"Subroutine %s is not documented"%(self.name))
|
||||||
@ -76,7 +76,7 @@ class Sub(object):
|
|||||||
if '_touches' not in self.__dict__:
|
if '_touches' not in self.__dict__:
|
||||||
from subroutines import subroutines
|
from subroutines import subroutines
|
||||||
self._touches = []
|
self._touches = []
|
||||||
for line in filter(lambda x: isinstance(x,Touch),self.text):
|
for line in filter(lambda x: type(x) in [Touch, SoftTouch],self.text):
|
||||||
self._touches += line.text.split()[1:]
|
self._touches += line.text.split()[1:]
|
||||||
for sub in self.calls:
|
for sub in self.calls:
|
||||||
if sub in subroutines:
|
if sub in subroutines:
|
||||||
@ -97,7 +97,7 @@ class Sub(object):
|
|||||||
############################################################
|
############################################################
|
||||||
def calls(self):
|
def calls(self):
|
||||||
if '_calls' not in self.__dict__:
|
if '_calls' not in self.__dict__:
|
||||||
buffer = filter(lambda x: isinstance(x,Call),self.text)
|
buffer = filter(lambda x: type(x) == Call,self.text)
|
||||||
self._calls = []
|
self._calls = []
|
||||||
for line in buffer:
|
for line in buffer:
|
||||||
sub = line.text.split('(',1)[0].split()[1]
|
sub = line.text.split('(',1)[0].split()[1]
|
||||||
|
12
src/util.py
12
src/util.py
@ -35,7 +35,7 @@ def lower(x):
|
|||||||
|
|
||||||
def same_file(filename,txt):
|
def same_file(filename,txt):
|
||||||
assert isinstance(filename,str)
|
assert isinstance(filename,str)
|
||||||
assert isinstance(txt,list)
|
assert type(txt) == list
|
||||||
|
|
||||||
try:
|
try:
|
||||||
file = open(filename,"r")
|
file = open(filename,"r")
|
||||||
@ -85,7 +85,7 @@ def make_single(l):
|
|||||||
return d.keys()
|
return d.keys()
|
||||||
|
|
||||||
def flatten(l):
|
def flatten(l):
|
||||||
if isinstance(l,list):
|
if type(l) == list:
|
||||||
result = []
|
result = []
|
||||||
for i in range(len(l)):
|
for i in range(len(l)):
|
||||||
elem = l[i]
|
elem = l[i]
|
||||||
@ -116,12 +116,12 @@ def dimsize(x):
|
|||||||
return size
|
return size
|
||||||
|
|
||||||
def put_info(text,filename):
|
def put_info(text,filename):
|
||||||
assert isinstance(text,list)
|
assert type(text) == list
|
||||||
if len(text) > 0:
|
if len(text) > 0:
|
||||||
assert isinstance(text[0],tuple)
|
assert type(text[0]) == tuple
|
||||||
from irpf90_t import Line
|
from irpf90_t import Line
|
||||||
assert isinstance(text[0][0],list)
|
assert type(text[0][0]) == list
|
||||||
assert isinstance(text[0][1],Line)
|
assert isinstance(text[0][1], Line)
|
||||||
lenmax = 80 - len(filename)
|
lenmax = 80 - len(filename)
|
||||||
format = "%"+str(lenmax)+"s ! %s:%4s"
|
format = "%"+str(lenmax)+"s ! %s:%4s"
|
||||||
for vars,line in text:
|
for vars,line in text:
|
||||||
|
@ -34,9 +34,9 @@ class Variable(object):
|
|||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
def __init__(self,text,name = None):
|
def __init__(self,text,name = None):
|
||||||
assert isinstance(text,list)
|
assert type(text) == list
|
||||||
assert len(text) > 0
|
assert len(text) > 0
|
||||||
assert isinstance(text[0],Begin_provider)
|
assert type(text[0]) == Begin_provider
|
||||||
self.text = text
|
self.text = text
|
||||||
if name is not None:
|
if name is not None:
|
||||||
self._name = name
|
self._name = name
|
||||||
@ -93,7 +93,7 @@ class Variable(object):
|
|||||||
if '_name' not in self.__dict__:
|
if '_name' not in self.__dict__:
|
||||||
buffer = None
|
buffer = None
|
||||||
for line in self.text:
|
for line in self.text:
|
||||||
if isinstance(line,Begin_provider):
|
if type(line) == Begin_provider:
|
||||||
self._name = line.filename[1]
|
self._name = line.filename[1]
|
||||||
break
|
break
|
||||||
return self._name
|
return self._name
|
||||||
@ -103,7 +103,7 @@ class Variable(object):
|
|||||||
def doc(self):
|
def doc(self):
|
||||||
if '_doc' not in self.__dict__:
|
if '_doc' not in self.__dict__:
|
||||||
def f(l): return
|
def f(l): return
|
||||||
buffer = filter(lambda l:isinstance(l,Doc), self.text)
|
buffer = filter(lambda l:type(l) == Doc, self.text)
|
||||||
self._doc = map(lambda l: l.text[1:], buffer)
|
self._doc = map(lambda l: l.text[1:], buffer)
|
||||||
if buffer == []:
|
if buffer == []:
|
||||||
error.warn(None,"Variable %s is not documented"%(self.name))
|
error.warn(None,"Variable %s is not documented"%(self.name))
|
||||||
@ -134,7 +134,7 @@ class Variable(object):
|
|||||||
############################################################
|
############################################################
|
||||||
def same_as(self):
|
def same_as(self):
|
||||||
if '_same_as' not in self.__dict__:
|
if '_same_as' not in self.__dict__:
|
||||||
if isinstance(self.line,Begin_provider):
|
if type(self.line) == Begin_provider:
|
||||||
result = self.name
|
result = self.name
|
||||||
else:
|
else:
|
||||||
result = self.text[0].filename[1]
|
result = self.text[0].filename[1]
|
||||||
@ -490,14 +490,14 @@ class Variable(object):
|
|||||||
same_as = self.same_as
|
same_as = self.same_as
|
||||||
inside = False
|
inside = False
|
||||||
for vars,line in buffer:
|
for vars,line in buffer:
|
||||||
if isinstance(line,Begin_provider):
|
if type(line) == Begin_provider:
|
||||||
if line.filename[1] == same_as:
|
if line.filename[1] == same_as:
|
||||||
inside = True
|
inside = True
|
||||||
vars = []
|
vars = []
|
||||||
if inside:
|
if inside:
|
||||||
text.append( (vars,line) )
|
text.append( (vars,line) )
|
||||||
text += map( lambda x: ([],Simple_line(line.i,x,line.filename)), call_provides(vars) )
|
text += map( lambda x: ([],Simple_line(line.i,x,line.filename)), call_provides(vars) )
|
||||||
if isinstance(line,End_provider):
|
if type(line) == End_provider:
|
||||||
if inside:
|
if inside:
|
||||||
break
|
break
|
||||||
name = self.name
|
name = self.name
|
||||||
|
@ -38,11 +38,11 @@ def create_variables():
|
|||||||
buffer = []
|
buffer = []
|
||||||
inside = False
|
inside = False
|
||||||
for line in text:
|
for line in text:
|
||||||
if isinstance(line,Begin_provider):
|
if type(line) == Begin_provider:
|
||||||
inside = True
|
inside = True
|
||||||
if inside:
|
if inside:
|
||||||
buffer.append(line)
|
buffer.append(line)
|
||||||
if isinstance(line,End_provider):
|
if type(line) == End_provider:
|
||||||
inside = False
|
inside = False
|
||||||
v = Variable(buffer)
|
v = Variable(buffer)
|
||||||
result[v.name] = v
|
result[v.name] = v
|
||||||
|
@ -1 +1 @@
|
|||||||
version = "1.1.55"
|
version = "1.1.56"
|
||||||
|
Loading…
Reference in New Issue
Block a user