[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 4/9] qapi.py: Decent syntax error reporting
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 4/9] qapi.py: Decent syntax error reporting |
Date: |
Fri, 26 Jul 2013 09:30:40 -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:
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> scripts/qapi.py | 29 +++++++++++++++++++++++++++--
> tests/qapi-schema/test-qapi.py | 2 ++
> tests/qapi-schema/unclosed-string.err | 2 +-
> 3 files changed, 30 insertions(+), 3 deletions(-)
>
> +class QAPISchemaError(Exception):
> + def __init__(self, schema, msg):
> + self.fp = schema.fp
> + self.msg = msg
> + self.line = self.col = 1
> + for ch in schema.src[0:schema.pos]:
> + if ch == '\n':
> + self.line += 1
> + self.col = 1
> + elif ch == '\t':
> + self.col = (self.col + 7) % 8 + 1
Do we even want to allow TABs in the schema files? Right now, they are
tab-free; if you error out here instead of futzing with tab width, we
could forcefully maintain that property.
> + else:
> + self.col += 1
Does python support ++ as shorthand for += 1?
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
[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