7.5. Documentation generator
The RST module implements the documentation generation pipeline for daslang. It uses RTTI to introspect modules, types, and functions, then produces reStructuredText output suitable for Sphinx documentation builds.
All functions and symbols are in “rst” module, use require to get access to it.
require daslib/rst
7.5.1. Structures
- rst::DocGroup
Group of documentation items.
- Fields
- rst::DocsHook
Hook for RST documentation generation.
- Fields
annotationFilter : lambda<(ann: Annotation):bool> - Filter for the supported annotations.
afterEnums : lambda<(f: FILE?;was_enums:bool):void> - Additional generation hook after the enumerations.
7.5.2. Document writers
- rst::document(name: string; mod: Module?; fname: string; groups: array<DocGroup>; hook: DocsHook = DocsHook())
Generates RST documentation for a single module and writes it to a file.
- rst::document_enumeration(doc_file: file; mod: Module?; value: auto) : auto()
Generates RST documentation for a single enumeration type.
- rst::document_enumerations(doc_file: file; mods: array<Module?>) : bool()
Generates RST documentation for all enumerations in the given modules.
- rst::documents(name: string; mods: array<Module?>; fname: string; groups: array<DocGroup>; hook: DocsHook = DocsHook())
Generates RST documentation for multiple modules and writes them to files.
7.5.3. Descriptions
- rst::describe_short(expr: Expression?|smart_ptr<Expression>) : auto()
Returns a concise one-line description of an expression or type.
- Arguments
expr : option< Expression?| smart_ptr< Expression>&>
7.5.4. Label makers
7.5.4.1. function_label_file
- rst::function_label_file(name: auto; value: smart_ptr<TypeDecl>; drop_args: int = 0) : auto()
Creates a unique, file-name-safe label string for a function.
- Arguments
name : auto
value : smart_ptr< TypeDecl>&
drop_args : int
- rst::function_label_file(value: smart_ptr<Function>|Function?; drop_args: int = 0) : auto()
7.5.5. RST section makers
- rst::make_group(name: string; plus: string = "+") : string()
Creates a named documentation group with a decorative RST section header.
- Arguments
name : string
plus : string
7.5.6. Group operations
- rst::append_to_group_by_regex(group: DocGroup; mod: Module?; reg: Regex) : DocGroup&()
Appends functions whose names match a regex to an existing documentation group.
7.5.6.1. group_by_regex
- rst::group_by_regex(name: string; mod: Module?; reg: Regex) : DocGroup()
Groups module items whose names match the provided regular expression under a documentation section.
- rst::group_by_regex(name: string; mods: array<Module?>; reg: Regex) : DocGroup()
- rst::hide_group(group: DocGroup) : DocGroup()
Marks the specified documentation group as hidden so it is excluded from output.
- Arguments
group : DocGroup