qapi: Fix parse errors for removal of null from schema language
PATCH 1/1 qapi: Fix parse errors for removal of null from schema language
Commit 9d55380b5a "qapi: Remove null from schema language" (v4.2.0) neglected to update two error messages. Do that now.
Signed-off-by Markus Armbruster <[email protected]>
--- scripts/qapi/parser.py | 8 ++++---- tests/qapi-schema/leading-comma-list.err | 2 +- tests/qapi-schema/trailing-comma-list.err | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
scripts/qapi/parser.py +4 -4
@@ -236,9 +236,9 @@ def get_values(self): if self.tok == ']': self.accept() return expr - if self.tok not in "{['tfn": + if self.tok not in "{['tf": raise QAPIParseError( - self, "expected '{', '[', ']', string, boolean or 'null'") + self, "expected '{', '[', ']', string, or boolean") while True: expr.append(self.get_expr(True)) if self.tok == ']':
@@ -257,12 +257,12 @@ def get_expr(self, nested): elif self.tok == '[': self.accept() expr = self.get_values() - elif self.tok in "'tfn": + elif self.tok in "'tf": expr = self.val self.accept() else: raise QAPIParseError( - self, "expected '{', '[', string, boolean or 'null'") + self, "expected '{', '[', string, or boolean") return expr def get_doc(self, info):
tests/qapi-schema/leading-comma-list.err +1 -1
@@ -1 +1 @@ -leading-comma-list.json:2:13: expected '{', '[', ']', string, boolean or 'null' +leading-comma-list.json:2:13: expected '{', '[', ']', string, or boolean
tests/qapi-schema/trailing-comma-list.err +1 -1
@@ -1 +1 @@ -trailing-comma-list.json:2:36: expected '{', '[', string, boolean or 'null' +trailing-comma-list.json:2:36: expected '{', '[', string, or boolean
Signature · 1 line
2.26.2
Quoted 9 lines · Markus Armbruster
Commit
9d55380b5a"qapi: Remove null from schema language" (v4.2.0) neglected to update two error messages. Do that now.Signed-off-by Markus Armbruster <[email protected]>--- scripts/qapi/parser.py | 8 ++++---- tests/qapi-schema/leading-comma-list.err | 2 +- tests/qapi-schema/trailing-comma-list.err | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
My first reaction was "How does our 'StrOrNull' alternate type work? But I see that uses 'null' (that is, a string type name, just like 'str' or 'int'), and not a literal null. At which point this makes total sense.
Reviewed-by Eric Blake <[email protected]>
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 3 lines · Markus Armbruster
Commit
9d55380b5a"qapi: Remove null from schema language" (v4.2.0) neglected to update two error messages. Do that now.
One less patch in part 5.
Reviewed-by John Snow <[email protected]>
Quoted 53 lines
Signed-off-by Markus Armbruster <[email protected]>--- scripts/qapi/parser.py | 8 ++++---- tests/qapi-schema/leading-comma-list.err | 2 +- tests/qapi-schema/trailing-comma-list.err | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)scripts/qapi/parser.py +4
-4@@ -236,9 +236,9 @@ def get_values(self): if self.tok == ']': self.accept() return expr - if self.tok not in "{['tfn": + if self.tok not in "{['tf": raise QAPIParseError( - self, "expected '{', '[', ']', string, boolean or 'null'") + self, "expected '{', '[', ']', string, or boolean") while True: expr.append(self.get_expr(True)) if self.tok == ']':@@ -257,12 +257,12 @@ def get_expr(self, nested): elif self.tok == '[': self.accept() expr = self.get_values() - elif self.tok in "'tfn": + elif self.tok in "'tf": expr = self.val self.accept() else: raise QAPIParseError( - self, "expected '{', '[', string, boolean or 'null'") + self, "expected '{', '[', string, or boolean") return expr def get_doc(self, info):tests/qapi-schema/leading-comma-list.err +1
-1@@ -1 +1 @@ -leading-comma-list.json:2:13: expected '{', '[', ']', string, boolean or 'null' +leading-comma-list.json:2:13: expected '{', '[', ']', string, or booleantests/qapi-schema/trailing-comma-list.err +1
-1@@ -1 +1 @@ -trailing-comma-list.json:2:36: expected '{', '[', string, boolean or 'null' +trailing-comma-list.json:2:36: expected '{', '[', string, or boolean