aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/qapi.py10
-rw-r--r--tests/qapi-schema/non-objects.err2
-rw-r--r--tests/qapi-schema/quoted-structural-chars.err2
3 files changed, 8 insertions, 6 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 12fb29a047..75fc28252d 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -64,7 +64,7 @@ class QAPISchema:
self.accept()
while self.tok != None:
- self.exprs.append(self.get_expr())
+ self.exprs.append(self.get_expr(False))
def accept(self):
while True:
@@ -117,7 +117,7 @@ class QAPISchema:
if self.tok != ':':
raise QAPISchemaError(self, 'Expected ":"')
self.accept()
- expr[key] = self.get_expr()
+ expr[key] = self.get_expr(True)
if self.tok == '}':
self.accept()
return expr
@@ -135,7 +135,7 @@ class QAPISchema:
if not self.tok in [ '{', '[', "'" ]:
raise QAPISchemaError(self, 'Expected "{", "[", "]" or string')
while True:
- expr.append(self.get_expr())
+ expr.append(self.get_expr(True))
if self.tok == ']':
self.accept()
return expr
@@ -143,7 +143,9 @@ class QAPISchema:
raise QAPISchemaError(self, 'Expected "," or "]"')
self.accept()
- def get_expr(self):
+ def get_expr(self, nested):
+ if self.tok != '{' and not nested:
+ raise QAPISchemaError(self, 'Expected "{"')
if self.tok == '{':
self.accept()
expr = self.get_members()
diff --git a/tests/qapi-schema/non-objects.err b/tests/qapi-schema/non-objects.err
index 48c849d18f..a6c2dc26a6 100644
--- a/tests/qapi-schema/non-objects.err
+++ b/tests/qapi-schema/non-objects.err
@@ -1 +1 @@
-Crashed: <type 'exceptions.AttributeError'>
+<stdin>:1:1: Expected "{"
diff --git a/tests/qapi-schema/quoted-structural-chars.err b/tests/qapi-schema/quoted-structural-chars.err
index 48c849d18f..a6c2dc26a6 100644
--- a/tests/qapi-schema/quoted-structural-chars.err
+++ b/tests/qapi-schema/quoted-structural-chars.err
@@ -1 +1 @@
-Crashed: <type 'exceptions.AttributeError'>
+<stdin>:1:1: Expected "{"