def package_begin(self, name, is_external): package = Package.get_instance(name, package = self._get_package(), is_external = is_external ) self._package_stack.append(package)
def process_file(self, file_name): self._reader.readFile(file_name) self._reader.walk(VisitorStep1()) self._reader.walk(VisitorStep2()) self._reader.walk(VisitorStep3()) return Package.get_top()
def gtypename(self, typename_or_type, current_package=None): if isinstance(typename_or_type, types.Type): type = typename_or_type else: if not current_package: current_package = Package.get_top() type = current_package[typename_or_type] return util.gtypename(type)
def _get_parent(self, cls): idx = len(self._stack) - 1 while idx >= 0: parent = self._stack[idx] if isinstance(parent, cls): return parent else: idx -= 1 if not cls == Package: return None else: return Package.get_top()