[Top][All Lists]

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

Re: [Qemu-devel] [PATCH 6/9] qapi.py: Fix schema parser to check syntax

From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 6/9] qapi.py: Fix schema parser to check syntax systematically
Date: Fri, 26 Jul 2013 13:42:26 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7

On 07/26/2013 01:35 PM, Markus Armbruster wrote:

>>> +        if not self.tok in [ '{', '[', "'" ]:
>>> +            raise QAPISchemaError(self, 'Expected "{", "[", "]" or string')
>> JSON allows primitives here, as in [ 1 ]; but I agree that for the
>> purposes of our schema we will always be taking a string or complex
>> object whenever we have a list.
> The lexer doesn't recognize any atoms but strings.  If we change that,
> the syntax error messages need to be reviewed (not just this one).

Nah, I'm fine leaving the lexer as-is.  It's okay that we parse only a
subset of JSON, as long as our subset is expressive enough for our needs
in QAPI.

As it is, technically, we aren't QUITE parsing JSON, because our schema
strings are marked with '' instead of "".  And as long as we are
extending our parser to take something slightly different than JSON,
maybe we should teach it to tolerate trailing commas?  On the other
hand, the further we diverge from JSON, the more likely we are to have
to maintain the parser ourselves instead of being able to reuse someone
else's code.

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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