[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 10/22] qapi: qapi.py, make json parser more robu
From: |
Michael Roth |
Subject: |
Re: [Qemu-devel] [PATCH 10/22] qapi: qapi.py, make json parser more robust |
Date: |
Tue, 24 Jul 2012 17:59:45 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Tue, Jul 24, 2012 at 05:23:33PM -0500, Anthony Liguori wrote:
> Michael Roth <address@hidden> writes:
>
> > Currently the QAPI JSON parser expects a very particular style of code
> > indentation, the major one being that terminating curly/square brackets are
> > not on placed on a seperate line. This is incompatible with most
> > pretty-print formats, so make it a little more robust by supporting
> > these cases.
>
> The code was supposed to just expect that all subsequent lines are
> indented. This was to simplify the parser. Can you provide an
> problematic example?
The main one was cases like this:
address@hidden:~/w/qemu3.git$ cat example.json
{
'a': 'test'
}
address@hidden:~/w/qemu3.git$ python scripts/qapi-types.py -o /tmp
<example.json
Traceback (most recent call last):
File "scripts/qapi-types.py", line 260, in <module>
exprs = parse_schema(sys.stdin)
File "/home/mdroth/dev/kvm/qemu3.git/scripts/qapi.py", line 76, in
parse_schema
expr_eval = evaluate(expr)
File "/home/mdroth/dev/kvm/qemu3.git/scripts/qapi.py", line 62, in
evaluate
return parse(map(lambda x: x, tokenize(string)))[0]
File "/home/mdroth/dev/kvm/qemu3.git/scripts/qapi.py", line 42, in parse
if tokens[0] == ',':
IndexError: list index out of range
I had it in my queue because it was what was preventing me from pretty-printing
the QIDL-generated schemas in V1, since python's pretty print stuff generally
puts the opening/closing braces at the same indent level. But now we store them
in the binary, and don't pretty-print those, so I don't think this is an issue
WRT this series anymore. Might still make sense to add it for future use-cases
though.
>
> Regards,
>
> Anthony Liguori
> [...]
>
- [Qemu-devel] [PATCH 03/22] qapi: qapi-commands.py -> qapi_commands.py, (continued)
- [Qemu-devel] [PATCH 03/22] qapi: qapi-commands.py -> qapi_commands.py, Michael Roth, 2012/07/24
- [Qemu-devel] [PATCH 07/22] qapi: qapi_visit.py, support generating static functions, Michael Roth, 2012/07/24
- [Qemu-devel] [PATCH 06/22] qapi: add visitor interfaces for arrays, Michael Roth, 2012/07/24
- [Qemu-devel] [PATCH 08/22] qapi: qapi_visit.py, support for visiting non-pointer/embedded structs, Michael Roth, 2012/07/24
- [Qemu-devel] [PATCH 09/22] qapi: QmpOutputVisitor, implement array handling, Michael Roth, 2012/07/24
- [Qemu-devel] [PATCH 10/22] qapi: qapi.py, make json parser more robust, Michael Roth, 2012/07/24
- [Qemu-devel] [PATCH 12/22] qom-fuse: workaround for truncated properties > 4096, Michael Roth, 2012/07/24
- [Qemu-devel] [PATCH 11/22] qapi: add open-coded visitor for struct tm types, Michael Roth, 2012/07/24
- [Qemu-devel] [PATCH 13/22] module additions for schema registration, Michael Roth, 2012/07/24
- [Qemu-devel] [PATCH 15/22] qidl: Add documentation, Michael Roth, 2012/07/24
- [Qemu-devel] [PATCH 14/22] qdev: move Property-related declarations to qdev-properties.h, Michael Roth, 2012/07/24
- [Qemu-devel] [PATCH 20/22] qemu-timer: add visit_type_QEMUTimer, Michael Roth, 2012/07/24
- [Qemu-devel] [PATCH 19/22] qidl: unit tests, Michael Roth, 2012/07/24