MCPcopy Create free account
hub / github.com/BasisResearch/lean.py / _extract_struct

Function _extract_struct

lean_py/_parse.py:220–232  ·  view source on GitHub ↗
(node: c_ast.Struct)

Source from the content-addressed store, hash-verified

218
219
220def _decl_type_to_str(decl) -> str:
221 if isinstance(decl, (c_ast.PtrDecl, c_ast.ArrayDecl)):
222 return _type_to_str(decl)
223 if isinstance(decl, c_ast.TypeDecl):
224 return _type_to_str(decl.type)
225 if isinstance(decl, c_ast.FuncDecl):
226 return "void *"
227 return _type_to_str(decl)
228
229
230def _extract_struct(node: c_ast.Struct) -> StructDef | None:
231 if not node.decls:
232 return None
233 fields = []
234 for decl in node.decls:
235 fname = decl.name or ""

Callers 1

_classifyFunction · 0.85

Calls 3

_decl_type_to_strFunction · 0.85
StructFieldClass · 0.85
StructDefClass · 0.85

Tested by

no test coverage detected