From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2nuK-0006Ep-SI for qemu-devel@nongnu.org; Fri, 26 Jul 2013 15:42:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2nuJ-0002uw-Qq for qemu-devel@nongnu.org; Fri, 26 Jul 2013 15:42:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60185) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2nuJ-0002uL-H5 for qemu-devel@nongnu.org; Fri, 26 Jul 2013 15:42:31 -0400 Message-ID: <51F2D122.7080902@redhat.com> Date: Fri, 26 Jul 2013 13:42:26 -0600 From: Eric Blake MIME-Version: 1.0 References: <1374842387-17146-1-git-send-email-armbru@redhat.com> <1374842387-17146-7-git-send-email-armbru@redhat.com> <51F29C20.3020006@redhat.com> <87k3kdqfl9.fsf@blackfin.pond.sub.org> In-Reply-To: <87k3kdqfl9.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jqVNb96GC2wuIu36khMxlJQvMe8xwwMew" Subject: Re: [Qemu-devel] [PATCH 6/9] qapi.py: Fix schema parser to check syntax systematically List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: aliguori@us.ibm.com, akong@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --jqVNb96GC2wuIu36khMxlJQvMe8xwwMew Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/26/2013 01:35 PM, Markus Armbruster wrote: >>> + if not self.tok in [ '{', '[', "'" ]: >>> + raise QAPISchemaError(self, 'Expected "{", "[", "]" or s= tring') >> >> 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. >=20 > 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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --jqVNb96GC2wuIu36khMxlJQvMe8xwwMew Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEbBAEBCAAGBQJR8tEiAAoJEKeha0olJ0Nqbj8H9j0n/9eDJ60urWSmm2C/8ezH ShBRofHkCJPWhLVfvNWssdbsFlDJeKV20G/PC+L3F9k/7IC/qxrGayDt35ewcp/C P4q8/gyX5Q79HSHLomdfR8JZfntCHXzNRoiFwEmhNkIR1Ae70Ki5e98PAAlD0GHa 4UtgT3HeSwq4XClMB3YUnG4MHEeBCJO4wK3l/O4Wl1p2+z4d59bTF8I9/G7Wuosq mzrYsuxJhYvy3C5MLb1aYFNQs/q5x9UYgTqzXvEuo79BmHkMOq0WLrx8DvCqWumD t41tZZaDio7HwAVsv4oteXkO4ZDADYnOb8odtSlngMWNkbprp/nSxgdU+UnmPA== =Z/Xl -----END PGP SIGNATURE----- --jqVNb96GC2wuIu36khMxlJQvMe8xwwMew--