def read_info(fname): all = bindery.parse(fname.read()).vector info = [v for v in all.xml_children if v.xml_type == "element"] def setImplements(fcns): for fcn in fcns: fcn.name = str(fcn.nameStr) fcn.impl = getattr(fcn, "implName", None) fcn.impl = (str(fcn.impl) if fcn.impl else fcn.impl) fcn.line_idx = int(str(fcn.lineNum)) - 1 fcn.is_generator = str(fcn.isGenerator) == "true" for fcn in fcns: fcn.is_toplevel = getattr(fcn, "is_toplevel", False) or bool( fcn.impl) if fcn.impl: try: get_singleton(v for v in fcns if v.name == fcn.impl).is_toplevel = True except GetSingletonEmptyException: global couldntfindexception couldntfindexception = True print("couldn't find function %s for file %s" % (fcn.impl, fcn.srcFile)) return fcns return dict(list(info).equiv_classes( lambda a: Path(str(a.srcFile)))).map_values(setImplements)
def print_pragmas(): lines = [line.strip() for file in files for line in open(file).readlines()] lines = [v.lstrip('pragma options ') for v in lines if v.startswith('pragma options ') and v.endswith(';')] result = defaultdict(lambda: 0) for flag in [v.strip() for line in lines for v in flagre.findall(line)]: result[flag] += 1 print("=== flags and counts ===") result = dict(result) pprint(result) print("flags not in map: %s" %("\n".join(v for v in result if not v in pragma_map and not v in pragma_map.values())))
def print_pragmas(): lines = [line.strip() for file in files for line in open(file).readlines()] lines = [ v.lstrip('pragma options ') for v in lines if v.startswith('pragma options ') and v.endswith(';') ] result = defaultdict(lambda: 0) for flag in [v.strip() for line in lines for v in flagre.findall(line)]: result[flag] += 1 print("=== flags and counts ===") result = dict(result) pprint(result) print("flags not in map: %s" % ("\n".join(v for v in result if not v in pragma_map and not v in pragma_map.values())))
def read_info(fname): all = bindery.parse(fname.read()).vector info = [v for v in all.xml_children if v.xml_type == "element"] def setImplements(fcns): for fcn in fcns: fcn.name = str(fcn.nameStr) fcn.impl = getattr(fcn, "implName", None) fcn.impl = (str(fcn.impl) if fcn.impl else fcn.impl) fcn.line_idx = int(str(fcn.lineNum)) - 1 fcn.is_generator = str(fcn.isGenerator) == "true" for fcn in fcns: fcn.is_toplevel = getattr(fcn, "is_toplevel", False) or bool(fcn.impl) if fcn.impl: try: get_singleton(v for v in fcns if v.name == fcn.impl).is_toplevel = True except GetSingletonEmptyException: global couldntfindexception couldntfindexception = True print("couldn't find function %s for file %s" %(fcn.impl, fcn.srcFile)) return fcns return dict(list(info).equiv_classes(lambda a: Path(str(a.srcFile)))).map_values(setImplements)