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

Function _pascal_split_sections

graphify/extract.py:13125–13140  ·  view source on GitHub ↗

Split into (iface_text, iface_offset, impl_text, impl_offset). Files without interface/implementation sections (dpr/lpr/inc) return the whole text as impl with offset 0.

(text: str)

Source from the content-addressed store, hash-verified

13123
13124
13125def _pascal_split_sections(text: str) -> tuple[str, int, str, int]:
13126 """Split into (iface_text, iface_offset, impl_text, impl_offset).
13127 Files without interface/implementation sections (dpr/lpr/inc) return
13128 the whole text as impl with offset 0.
13129 """
13130 iface_m = re.search(r"\binterface\b", text, re.IGNORECASE)
13131 impl_m = re.search(r"\bimplementation\b", text, re.IGNORECASE)
13132 if iface_m and impl_m:
13133 iface_off = iface_m.end()
13134 impl_off = impl_m.end()
13135 end_m = re.search(
13136 r"\b(initialization|finalization)\b", text[impl_off:], re.IGNORECASE
13137 )
13138 impl_end = impl_off + end_m.start() if end_m else len(text)
13139 return text[iface_off:impl_m.start()], iface_off, text[impl_off:impl_end], impl_off
13140 return "", 0, text, 0
13141
13142
13143def _pascal_split_uses(s: str) -> list[str]:

Callers 1

_extract_pascal_regexFunction · 0.85

Calls 1

startMethod · 0.80

Tested by

no test coverage detected