AnnotationParser

Note

Generated from the C++ headers by apiary --emit-cpp-docs-json.

std::optional<Directive> parse_annotation(llvm::StringRef payload)

Parses an annotation payload of the form “apiary:<name>[:<arg>[:<arg>…]]” into a Directive.

Special cases: - “doc:<text>” — the text contains arbitrary characters including ‘:’, so the directive name is split off and the remainder is one args[0]. - “instantiate:<list>” / “instantiate_as:<py>:<type>” — same: the rest after the directive name (or the first ‘:’ for instantiate_as) is left intact as a single arg, since the inner payload contains commas and parentheses that the codegen tool will parse later.

Parameters:

payload – The annotation payload to parse.

Returns:

The parsed Directive, or nullopt if the prefix doesn’t match.