[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/26] qapi/parser.py: fully remove 'null' constant
From: |
John Snow |
Subject: |
[PATCH 07/26] qapi/parser.py: fully remove 'null' constant |
Date: |
Tue, 22 Sep 2020 18:35:06 -0400 |
Based on the docs, we don't support the null constant, and the code
agrees. There's a few remnants where callers check .tok for 'n', and
these can be removed.
Signed-off-by: John Snow <jsnow@redhat.com>
---
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(-)
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index 5a7233bc76..78355ca93f 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -274,9 +274,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 self._parse_error(
- "expected '{', '[', ']', string, boolean or 'null'")
+ "expected '{', '[', ']', string, or boolean")
while True:
expr.append(self.get_expr(True))
if self.tok == ']':
@@ -295,12 +295,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 self._parse_error(
- "expected '{', '[', string, boolean or 'null'")
+ "expected '{', '[', string, or boolean")
return expr
def _get_doc(self, info):
diff --git a/tests/qapi-schema/leading-comma-list.err
b/tests/qapi-schema/leading-comma-list.err
index 76eed2b5b3..0725d6529f 100644
--- a/tests/qapi-schema/leading-comma-list.err
+++ b/tests/qapi-schema/leading-comma-list.err
@@ -1 +1 @@
-leading-comma-list.json:2:13: expected '{', '[', ']', string, boolean or 'null'
+leading-comma-list.json:2:13: expected '{', '[', ']', string, or boolean
diff --git a/tests/qapi-schema/trailing-comma-list.err
b/tests/qapi-schema/trailing-comma-list.err
index ad2f2d7c97..bb5f8c3c90 100644
--- a/tests/qapi-schema/trailing-comma-list.err
+++ b/tests/qapi-schema/trailing-comma-list.err
@@ -1 +1 @@
-trailing-comma-list.json:2:36: expected '{', '[', string, boolean or 'null'
+trailing-comma-list.json:2:36: expected '{', '[', string, or boolean
--
2.26.2
- [PATCH 00/26] qapi: static typing conversion, pt5, John Snow, 2020/09/22
- [PATCH 03/26] qapi/parser.py: use 'with' statement for opening files, John Snow, 2020/09/22
- [PATCH 02/26] qapi/parser.py: group variable declarations in __init__, John Snow, 2020/09/22
- [PATCH 04/26] qapi/source.py: Add default arguments to QAPISourceInfo, John Snow, 2020/09/22
- [PATCH 01/26] qapi/parser.py: refactor parsing routine into method, John Snow, 2020/09/22
- [PATCH 05/26] qapi/parser.py: start source info at line 0, John Snow, 2020/09/22
- [PATCH 07/26] qapi/parser.py: fully remove 'null' constant,
John Snow <=
- [PATCH 08/26] qapi/parser.py: Assert lexer value is a string, John Snow, 2020/09/22
- [PATCH 06/26] qapi/parser.py: raise QAPIParseError during file opening, John Snow, 2020/09/22
- [PATCH 09/26] qapi/parser.py: assert get_expr returns object in outer loop, John Snow, 2020/09/22
- [PATCH 10/26] qapi/parser.py: assert object keys are strings, John Snow, 2020/09/22
- [PATCH 11/26] qapi/parser.py: Convert several methods to @classmethod, John Snow, 2020/09/22
- [PATCH 12/26] qapi/parser.py: add casts to pragma checks, John Snow, 2020/09/22
- [PATCH 13/26] qapi/parser.py: add type hint annotations, John Snow, 2020/09/22
- [PATCH 14/26] qapi/parser.py: add docstrings, John Snow, 2020/09/22
- [PATCH 15/26] qapi/parser.py: add ParsedExpression type, John Snow, 2020/09/22
- [PATCH 16/26] qapi/pragma.py: Move QAPISchemaPragma into its own module, John Snow, 2020/09/22