qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 04/23] qapi: expand tags to all doc sections


From: Markus Armbruster
Subject: Re: [PATCH 04/23] qapi: expand tags to all doc sections
Date: Fri, 20 Dec 2024 14:13:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

John Snow <jsnow@redhat.com> writes:

> This patch adds an explicit section tag to all QAPIDoc
> sections. Members/Features are now explicitly tagged as such, with the
> name now being stored in a dedicated "name" field (which qapidoc.py was
> not actually using anyway.)
>
> WIP: Yeah, the difference between "tagged" and "untagged" sections is
> now pretty poorly named, and explicitly giving "untagged" sections an
> "UNTAGGED" tag is ... well, worse. but mechanically, this accomplishes
> what I need for the series.
>
> Please suggest better naming conventions, keeping in mind that I
> currently have plans for a future patch that splits the "UNTAGGED" tag
> into "INTRO" and "DETAILS" tags. But, we still need a meta-name for the
> category of sections that are "formerly known as untagged" but cannot be
> called "freeform" because that name is used for the category of
> docblocks that are not attached to an entity (but happens to be
> comprised entirely of "formerly known as untagged" sections.)
>
> Signed-off-by: John Snow <jsnow@redhat.com>

A free-form doc comment consists of just one untagged section, actually.
I don't remember whether anything relies on "just one".

The term "tagged" is rooted in doc comment syntax.
docs/devel/qapi-code-gen.rst section "Definition documentation":

    Definition documentation starts with a line naming the definition,
    followed by an optional overview, a description of each argument (for
    commands and events), member (for structs and unions), branch (for
    alternates), or value (for enums), a description of each feature (if
    any), and finally optional tagged sections.

Sadly, this isn't fully accurate anymore.

    Descriptions start with '\@name:'.  The description text must be
    indented [...]

    A tagged section begins with a paragraph that starts with one of the
    following words: "Since:", "Returns:", "Errors:", "TODO:".  It ends with
    the start of a new section.

    The second and subsequent lines of tagged sections must be indented
    [...]

Nothing about untagged sections.  These are sections that aren't
descriptions or tagged.  Example:

    # @Returns: Lorem ipsum dolor sit amet, consectetur adipiscing elit,
    #     sed do eiusmod tempor incididunt ut labore et dolore magna
    #     aliqua.
    #
    # Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
    # nisi ut aliquip ex ea commodo consequat.
    #
    # Duis aute irure dolor in reprehenderit in voluptate velit esse
    # cillum dolore eu fugiat nulla pariatur.
    ##

Here, the tagged "Returns" section ends after "aliqua."  Why?  Because
"Ut enim" isn't indented.  The untagged section ends after "pariatur."

We parse a definition doc comment as a sequence of sections.

The first one is the overview.

Member / argument descriptions, if any, are next.

Then we may have any number of tagged or untagged sections.  If I
remember correctly, you'd like to banish them.  Let's pretend they can't
exist here.

Then we may have a "Features:" line followed by feature descriptions.

Finally, we may have any number of tagged or untagged sections.

Each of these sections is represented as an instance of type Section,
and the entire definition doc as an instance of type QAPIDoc.

Section has a member @tag of type str.

For tagged sections, it's the tag, i.e "Since", "Returns", ...  Obvious
enough.

For overview and other untagged sections, it's None.  Still obvious.

For descriptions, it's the name of the thing being described.  Less than
obvious.  Note that descriptions are actually instances of ArgSection, a
subtype of Section, which prevents confusion with tagged sections.

QAPIDoc has the overview in member @body, member / argument descriptions
in @args, feature descriptions in @features, and the remaining sections
in @sections.

I'm in favor of cleaning this up some.

I think we can keep the Section name.

Moving the name of the thing being described from @tag to @name is good.
What value to put into @tag then?  Whatever suits you.

Perhaps we should rename @tag to avoid undue ties to tagged sections.
@kind would work for me.

Value None for untagged sections is fine with me.  If a string suits you
better, that's fine, too.  "untagged", "plain", I don't know, propose
something.

@body, @args, and so forth aren't exactly great names.  If they truly
annoy or confuse you, feel free to propose better ones.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]