def from_string(s): if s is None: return None f = None sl = 0 el = 0 sc = 0 ec = 0 info_available = False di = None m = re.search("file: (\w+)", s) if m is not None: info_available = True f = sl = m.group(1) m = re.search("from line: (\d+)", s) if m is not None: sl = m.group(1) el = sl info_available = True m = re.search("to line: (\d+)", s) if m is not None: el = m.group(1) info_available = True m = re.search("from col: (\d+)", s) if m is not None: sc = m.group(1) ec = sc info_available = True m = re.search("to col: (\d+)", s) if m is not None: ec = m.group(1) info_available = True if info_available: di = DebugInfo(f, sl, sc, el, ec) return di
def __init__(self, **kwargs): if 'default' not in kwargs: kwargs['default'] = DebugInfo(0, 0, 0, 0) super().__init__(dtype=DebugInfo, **kwargs)
def from_json(self, s, sdfg=None): if s is None: return None return DebugInfo(s['start_line'], s['start_col'], s['end_line'], s['end_col'], s['filename'])