diff options
-rw-r--r-- | scripts/qapi/parser.py | 5 | ||||
-rw-r--r-- | tests/qapi-schema/meson.build | 2 | ||||
-rw-r--r-- | tests/qapi-schema/missing-array-rsqb.err | 1 | ||||
-rw-r--r-- | tests/qapi-schema/missing-array-rsqb.json | 1 | ||||
-rw-r--r-- | tests/qapi-schema/missing-array-rsqb.out | 0 | ||||
-rw-r--r-- | tests/qapi-schema/missing-object-member-element.err | 1 | ||||
-rw-r--r-- | tests/qapi-schema/missing-object-member-element.json | 1 | ||||
-rw-r--r-- | tests/qapi-schema/missing-object-member-element.out | 0 |
8 files changed, 9 insertions, 2 deletions
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 48137d3fbe..9f980f7513 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -275,7 +275,7 @@ class QAPISchemaParser: if self.tok == ']': self.accept() return expr - if self.tok not in "{['tf": + if self.tok not in tuple("{['tf"): raise QAPIParseError( self, "expected '{', '[', ']', string, or boolean") while True: @@ -294,7 +294,8 @@ class QAPISchemaParser: elif self.tok == '[': self.accept() expr = self.get_values() - elif self.tok in "'tf": + elif self.tok in tuple("'tf"): + assert isinstance(self.val, (str, bool)) expr = self.val self.accept() else: diff --git a/tests/qapi-schema/meson.build b/tests/qapi-schema/meson.build index dc448e8f74..9e8f658ce3 100644 --- a/tests/qapi-schema/meson.build +++ b/tests/qapi-schema/meson.build @@ -134,9 +134,11 @@ schemas = [ 'indented-expr.json', 'leading-comma-list.json', 'leading-comma-object.json', + 'missing-array-rsqb.json', 'missing-colon.json', 'missing-comma-list.json', 'missing-comma-object.json', + 'missing-object-member-element.json', 'missing-type.json', 'nested-struct-data.json', 'nested-struct-data-invalid-dict.json', diff --git a/tests/qapi-schema/missing-array-rsqb.err b/tests/qapi-schema/missing-array-rsqb.err new file mode 100644 index 0000000000..b5f58b8c12 --- /dev/null +++ b/tests/qapi-schema/missing-array-rsqb.err @@ -0,0 +1 @@ +missing-array-rsqb.json:1:44: expected '{', '[', string, or boolean diff --git a/tests/qapi-schema/missing-array-rsqb.json b/tests/qapi-schema/missing-array-rsqb.json new file mode 100644 index 0000000000..7fca1df923 --- /dev/null +++ b/tests/qapi-schema/missing-array-rsqb.json @@ -0,0 +1 @@ +['Daisy,', 'Daisy,', 'Give me your answer', diff --git a/tests/qapi-schema/missing-array-rsqb.out b/tests/qapi-schema/missing-array-rsqb.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/missing-array-rsqb.out diff --git a/tests/qapi-schema/missing-object-member-element.err b/tests/qapi-schema/missing-object-member-element.err new file mode 100644 index 0000000000..c08a3dc307 --- /dev/null +++ b/tests/qapi-schema/missing-object-member-element.err @@ -0,0 +1 @@ +missing-object-member-element.json:1:8: expected '{', '[', string, or boolean diff --git a/tests/qapi-schema/missing-object-member-element.json b/tests/qapi-schema/missing-object-member-element.json new file mode 100644 index 0000000000..f52d0106f3 --- /dev/null +++ b/tests/qapi-schema/missing-object-member-element.json @@ -0,0 +1 @@ +{'key': diff --git a/tests/qapi-schema/missing-object-member-element.out b/tests/qapi-schema/missing-object-member-element.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/qapi-schema/missing-object-member-element.out |