On this page
Reading Zig source: the public declarations a file exports, their doc comments and their test blocks, grouped into a reference page by declaration kind.
#internal/extractors/zig
#internal/extractors/zig
Package zig reads Zig source for selfdoc.
It answers directives by scanning source text with regular expressions rather than by parsing it: no Zig toolchain is required, and a file that does not compile still documents. What it reads out of a file is the module's //! documentation, the public declarations -- functions including the extern, export and inline forms, constants whatever their right side is, and variables -- with the /// comment block above each, the fields of a public struct, and the file's test blocks.
#New
func New() extractors.ExtractorNew builds the Zig extractor. It spawns nothing and writes nothing, it only reads source files.
#extractor.Detect
func (e *extractor) Detect(dir string) boolDetect reports whether dir is a Zig project, by its build script or that script's dependency manifest.
#extractor.ResolvePath
func (e *extractor) ResolvePath(pathArg string, sourcePaths []string, baseDir string) stringResolvePath resolves a directive's path argument to a Zig source file or to a directory of them.
#extractor.FileExtensions
func (e *extractor) FileExtensions() []stringFileExtensions lists the extensions the build walks a Zig source tree for.
#extractor.PublicSymbols
func (e *extractor) PublicSymbols(file string) ([]string, error)PublicSymbols lists the public declarations of a Zig source file, in source order.
A private declaration -- one without "pub" -- is not public API and is not reported, and neither is a test block.
#extractor.ModuleDocstring
func (e *extractor) ModuleDocstring(path string) (string, error)ModuleDocstring is a file's //! module documentation.
#extractor.SymbolDetails
func (e *extractor) SymbolDetails(file, symbol string) (*extractors.SymbolDetails, error)SymbolDetails reports what a file says about one function's parameters and return value. A dotted name selects a member of a container type ("Config.init").