.. ---------------------------------------------------------------------------------------------- Copyright (c) The Einsums Developers. All rights reserved. Licensed under the MIT License. See LICENSE.txt in the project root for license information. ---------------------------------------------------------------------------------------------- .. _cppapi_AnnotationParser: ================ AnnotationParser ================ .. note:: Generated from the C++ headers by ``apiary --emit-cpp-docs-json``. .. cpp:namespace:: apiary .. cpp:function:: std::optional parse_annotation(llvm::StringRef payload) Parses an annotation payload of the form "apiary:[:[:...]]" into a Directive. Special cases: - "doc:" — the text contains arbitrary characters including ':', so the directive name is split off and the remainder is one args[0]. - "instantiate:" / "instantiate_as::" — 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. :param payload: The annotation payload to parse. :returns: The parsed Directive, or nullopt if the prefix doesn't match.