if debug_find_module:
print("Context.find_module: Parsing %s" % pxd_pathname)
source_desc = FileSourceDescriptor(pxd_pathname)
- pxd_tree = self.parse(source_desc, scope.type_names, pxd = 1,
+ pxd_tree = self.parse(source_desc, scope, pxd = 1,
full_module_name = module_name)
pxd_tree.analyse_declarations(scope)
except CompileError:
self.modules[name] = scope
return scope
- def parse(self, source_desc, type_names, pxd, full_module_name):
+ def parse(self, source_desc, scope, pxd, full_module_name):
if not isinstance(source_desc, FileSourceDescriptor):
raise RuntimeError("Only file sources for code supported")
source_filename = Utils.encode_filename(source_desc.filename)
f = Utils.open_source_file(source_filename, "rU")
try:
s = PyrexScanner(f, source_desc, source_encoding = f.encoding,
- type_names = type_names, context = self)
+ scope = scope, context = self)
tree = Parsing.p_module(s, pxd, full_module_name)
finally:
f.close()
c_suffix = ".cpp"
else:
c_suffix = ".c"
- result.c_file = Utils .replace_suffix(source, c_suffix)
+ result.c_file = Utils.replace_suffix(source, c_suffix)
c_stat = None
if result.c_file:
try:
scope = self.find_module(module_name, pos = initial_pos, need_pxd = 0)
errors_occurred = False
try:
- tree = self.parse(source, scope.type_names, pxd = 0,
+ tree = self.parse(source, scope, pxd = 0,
full_module_name = full_module_name)
tree.process_implementation(scope, options, result)
except CompileError:
class PyrexScanner(Scanner):
# context Context Compilation context
# type_names set Identifiers to be treated as type names
+ # included_files [string] Files included with 'include' statement
# compile_time_env dict Environment for conditional compilation
# compile_time_eval boolean In a true conditional compilation context
# compile_time_expr boolean In a compile-time expression context
resword_dict = build_resword_dict()
def __init__(self, file, filename, parent_scanner = None,
- type_names = None, context = None, source_encoding=None):
+ scope = None, context = None, source_encoding=None):
Scanner.__init__(self, get_lexicon(), file, filename)
if parent_scanner:
self.context = parent_scanner.context
self.type_names = parent_scanner.type_names
+ self.included_files = parent_scanner.included_files
self.compile_time_env = parent_scanner.compile_time_env
self.compile_time_eval = parent_scanner.compile_time_eval
self.compile_time_expr = parent_scanner.compile_time_expr
else:
self.context = context
- self.type_names = type_names
+ self.type_names = scope.type_names
+ self.included_files = scope.included_files
self.compile_time_env = initial_compile_time_env()
self.compile_time_eval = 1
self.compile_time_expr = 0