[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 09:56:16 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 |
On 07/26/2013 06:39 AM, Markus Armbruster wrote:
> Fixes at least the following parser bugs:
>
> * accepts any token in place of a colon
>
> * treats comma as optional
>
> * crashes when closing braces or brackets are missing
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> scripts/qapi.py | 40
> ++++++++++++++++++++++++++---------
> tests/qapi-schema/missing-colon.err | 1 +
> tests/qapi-schema/missing-colon.exit | 2 +-
> tests/qapi-schema/missing-colon.out | 3 ---
> tests/qapi-schema/missing-comma.err | 1 +
> tests/qapi-schema/missing-comma.exit | 2 +-
> tests/qapi-schema/missing-comma.out | 3 ---
> tests/qapi-schema/unclosed-object.err | 2 +-
> 8 files changed, 35 insertions(+), 19 deletions(-)
>
>
> def get_values(self):
> expr = []
> - while self.tok != ']':
> + if self.tok == ']':
> + self.accept()
> + return expr
> + 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.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH 4/9] qapi.py: Decent syntax error reporting, (continued)
- [Qemu-devel] [PATCH 5/9] qapi.py: Reject invalid characters in schema file, Markus Armbruster, 2013/07/26
- [Qemu-devel] [PATCH 8/9] qapi.py: Rename expr_eval to expr in parse_schema(), Markus Armbruster, 2013/07/26
- [Qemu-devel] [PATCH 9/9] qapi.py: Permit comments starting anywhere on the line, Markus Armbruster, 2013/07/26
- [Qemu-devel] [PATCH 7/9] qapi.py: Fix diagnosing non-objects at a schema's top-level, Markus Armbruster, 2013/07/26
- [Qemu-devel] [PATCH 6/9] qapi.py: Fix schema parser to check syntax systematically, Markus Armbruster, 2013/07/26
- Re: [Qemu-devel] [PATCH 6/9] qapi.py: Fix schema parser to check syntax systematically,
Eric Blake <=
- [Qemu-devel] [PATCH 1/9] tests: QAPI schema parser tests, Markus Armbruster, 2013/07/26
[Qemu-devel] [PATCH 3/9] qapi.py: Restructure lexer and parser, Markus Armbruster, 2013/07/26
[Qemu-devel] [PATCH 2/9] tests: Use qapi-schema-test.json as schema parser test, Markus Armbruster, 2013/07/26