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

Function extract_cpp

graphify/extract.py:4223–4244  ·  view source on GitHub ↗

Extract functions, classes, and includes from a .cpp/.cc/.cxx/.hpp file. C++/CLI sources are normalized to standard C++ first (#2876); see :func:`_normalize_cpp_cli`. Recovers doctest/Catch2 ``TEST_CASE("name")`` test cases that tree-sitter-cpp drops as ERROR nodes (issue #2594), m

(path: Path)

Source from the content-addressed store, hash-verified

4221
4222
4223def extract_cpp(path: Path) -> dict:
4224 """Extract functions, classes, and includes from a .cpp/.cc/.cxx/.hpp file.
4225
4226 C++/CLI sources are normalized to standard C++ first (#2876); see
4227 :func:`_normalize_cpp_cli`.
4228
4229 Recovers doctest/Catch2 ``TEST_CASE("name")`` test cases that tree-sitter-cpp
4230 drops as ERROR nodes (issue #2594), mirroring the Spock fallback for Groovy.
4231 """
4232 try:
4233 source = _read_source_bytes(path)
4234 except OSError:
4235 # Let _extract_generic report the read failure in its usual shape.
4236 return _augment_cpp_string_tests(path, _extract_generic(path, _CPP_CONFIG))
4237 source_override = _normalize_cpp_cli(source) or source
4238 source_override = _normalize_cpp_export_macros(source_override)
4239 source_override = _normalize_cpp_directive_comments(source_override)
4240 result = _extract_generic(
4241 path, _CPP_CONFIG, source_override=source_override
4242 )
4243 result = _recover_cpp_conditional_initializers(path, source_override, result)
4244 return _augment_cpp_string_tests(path, result)
4245
4246
4247def extract_ruby(path: Path) -> dict:

Calls 7

_read_source_bytesFunction · 0.90
_extract_genericFunction · 0.90
_normalize_cpp_cliFunction · 0.85