qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 15/16] docs/devel/qapi-code-gen: Improve QAPI


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 15/16] docs/devel/qapi-code-gen: Improve QAPI schema language doc
Date: Tue, 17 Sep 2019 11:14:50 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

On 9/13/19 10:39 AM, Markus Armbruster wrote:

>>> +  expression A; expression A, ... likewise, but separated by ,
>>
>> worth calling out that trailing , are not allowed?
> 
> Doesn't "separated by" imply that?
> 
>> Is the 'expression A;' a copy-paste from RFC text, irrelevant to our
>> usage here?
> 
> What about
> 
>     * Repetition: Expression A... matches zero or more occurences of
>       expression A
>     * Repetition: Expression A, ... matches zero or more occurences of
>       expression A separated by ,

With the spelling of 'occurrences' fixed, that works.


>>> +The top-level expressions are all JSON objects.  Their order does not
>>> +matter.
>>
>> Is that always true for all directives?
> 
> Yes from a purely semantic point of view.
> 
> No when you look at the generated text: that's in source order.  Should
> not matter for C.  Does matter for documentation.
> 
> See also discussion of previous patch.
> 
>> Would it be worth reformulating as something like:
>>
>> SCHEMA = DIRECTIVE... DEFINITION...
>>
>> allowing zero-or-more of either, but where directives come first?
> 
> Language change.  Not sure anything outside tests would break.  But why
> bother?

Fair enough.


>>> +Each BRANCH of the 'data' object defines a branch of the union.  A
>>> +union must have at least one branch.
>>
>> Is it worth trying to represent one-or-more in the grammar, in a
>> different manner than zero-or-more?
> 
> If we needed it multiple times, then something like
> 
>     * Repetition: Expression A * matches zero or more occurences of
>       expression A
>     * Repetition: Expression A, * matches zero or more occurences of
>       expression A separated by ,
>     * Repetition: Expression A + matches one or more occurences of
>       expression A
>     * Repetition: Expression A, + matches one or more occurences of
>       expression A separated by ,
> 
> could be helpful.  But I can't see the need right now.

Again with the typo. But I also agree that it's not needed right now.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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