[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other f
From: |
Benoît Canet |
Subject: |
Re: [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other files from a QAPI schema file |
Date: |
Mon, 17 Mar 2014 15:20:06 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
The Thursday 13 Mar 2014 à 09:54:15 (-0600), Eric Blake wrote :
> On 03/13/2014 09:33 AM, Benoît Canet wrote:
>
> >> We certainly can't do without comments.
> >>
> >> JSON is designed for easy data exchange, but we use it as programming
> >> language syntax. Its restrictions make sense for easy data exchange,
> >> but hurt our use. We're not the first ones experiencing that pain:
> >> http://json5.org/
> >>
> >> No idea how much momentum this JSON5 thingy has...
>
> If we 's,#,//,', our comments magically fall in line with JSON5 syntax;
> everything else in our files is already compliant with JSON5.
Not really qapi-schema.json is missing comas between types to be a
valid json file.
The fragment:
{ 'type' : 'InputBtnEvent',
'data' : { 'button' : 'InputButton',
'down' : 'bool' } }
{ 'type' : 'InputMoveEvent',
'data' : { 'axis' : 'InputAxis',
'value' : 'int' } }
Should be:
[
{ 'type' : 'InputBtnEvent',
'data' : { 'button' : 'InputButton',
'down' : 'bool' } },
{ 'type' : 'InputMoveEvent',
'data' : { 'axis' : 'InputAxis',
'value' : 'int' } }
]
to hope being a valid json file.
Best regards
Benoît
>
> >>
> >> Switch to JSON5 and call it qapi-schema.json5?
>
> This actually seems like a rather nice idea - but due to our choice of
> comments, it means rewriting the bulk of the file and tweaking our parser.
>
> >>
> >
> > Hmm don't we want something that python and other language know how to
> > parse out
> > of the box ? Or will we write yet another delicate work of art to parse it ?
>
> Our existing parser would only need to learn a new comment syntax to
> parse the subset of JSON5 that we currently actually use. Parsing FULL
> JSON5 would mean also learning about trailing commas, unquoted names in
> name:value pairs, multiline strings, and alternative numeric
> representations. But a point made on the JSON5 page is that ES5
> JavaScript already parses JSON5, just as it already parses original JSON.
>
> --
> Eric Blake eblake redhat com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
- Re: [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other files from a QAPI schema file, (continued)
- Re: [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other files from a QAPI schema file, Markus Armbruster, 2014/03/03
- Re: [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other files from a QAPI schema file, Lluís Vilanova, 2014/03/03
- Re: [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other files from a QAPI schema file, Eric Blake, 2014/03/03
- Re: [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other files from a QAPI schema file, Markus Armbruster, 2014/03/04
- Re: [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other files from a QAPI schema file, Benoît Canet, 2014/03/13
- Re: [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other files from a QAPI schema file, Eric Blake, 2014/03/13
- Re: [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other files from a QAPI schema file, Lluís Vilanova, 2014/03/13
- Re: [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other files from a QAPI schema file, Benoît Canet, 2014/03/14
- Re: [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other files from a QAPI schema file, Lluís Vilanova, 2014/03/14
- Re: [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other files from a QAPI schema file, Benoît Canet, 2014/03/14
- Re: [Qemu-devel] [PATCH v4 2/3] qapi: Add a primitive to include other files from a QAPI schema file,
Benoît Canet <=