diff options
author | John Snow | 2021-05-19 20:39:42 +0200 |
---|---|---|
committer | Markus Armbruster | 2021-05-20 11:28:28 +0200 |
commit | 9cd0205d553bc27a66454782dfc5d7e8d2324e34 (patch) | |
tree | f5465aeacfc9aab0130e399bc4645679245daf9e /scripts/qapi/__init__.py | |
parent | qapi/parser: Assert lexer value is a string (diff) | |
download | qemu-9cd0205d553bc27a66454782dfc5d7e8d2324e34.tar.gz qemu-9cd0205d553bc27a66454782dfc5d7e8d2324e34.tar.xz qemu-9cd0205d553bc27a66454782dfc5d7e8d2324e34.zip |
qapi/parser: enforce all top-level expressions must be dict in _parse()
Instead of using get_expr nested=False, allow get_expr to always return
any expression. In exchange, add a new error message to the top-level
parser that explains the semantic error: Top-level expressions must
always be JSON objects.
This helps mypy understand the rest of this function which assumes that
get_expr did indeed return a dict.
The exception type changes from QAPIParseError to QAPISemError as a
result, and the error message in two tests now changes.
Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210519183951.3946870-7-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi/__init__.py')
0 files changed, 0 insertions, 0 deletions