MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _pascal_split_bases

Function _pascal_split_bases

graphify/extract.py:13154–13174  ·  view source on GitHub ↗

Split inheritance list, handling generics like TList .

(s: str)

Source from the content-addressed store, hash-verified

13152
13153
13154def _pascal_split_bases(s: str) -> list[str]:
13155 """Split inheritance list, handling generics like TList<T, U>."""
13156 out, depth, buf = [], 0, []
13157 for ch in s:
13158 if ch == "<":
13159 depth += 1
13160 buf.append(ch)
13161 elif ch == ">":
13162 depth -= 1
13163 buf.append(ch)
13164 elif ch == "," and depth == 0:
13165 name = re.sub(r"<.*$", "", "".join(buf).strip())
13166 if name:
13167 out.append(name)
13168 buf = []
13169 else:
13170 buf.append(ch)
13171 name = re.sub(r"<.*$", "", "".join(buf).strip())
13172 if name:
13173 out.append(name)
13174 return [n for n in out if re.match(r"[A-Za-z_]\w*$", n)]
13175
13176
13177def _pascal_find_body(text: str, start: int) -> tuple[int, int]:

Callers 1

_extract_pascal_regexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected