]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qapi: Use quotes more consistently in frontend error messages
authorMarkus Armbruster <armbru@redhat.com>
Sat, 14 Sep 2019 15:34:54 +0000 (17:34 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Tue, 24 Sep 2019 12:07:23 +0000 (14:07 +0200)
Consistently enclose error messages in double quotes.  Use single
quotes within, except for one case of "'".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190914153506.2151-8-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
20 files changed:
scripts/qapi/common.py
tests/qapi-schema/bad-type-int.err
tests/qapi-schema/doc-missing-colon.err
tests/qapi-schema/duplicate-key.err
tests/qapi-schema/enum-int-member.err
tests/qapi-schema/escape-outside-string.err [new file with mode: 0644]
tests/qapi-schema/funny-char.err
tests/qapi-schema/funny-word.err
tests/qapi-schema/include-before-err.err
tests/qapi-schema/include-nested-err.err
tests/qapi-schema/leading-comma-list.err
tests/qapi-schema/leading-comma-object.err
tests/qapi-schema/missing-colon.err
tests/qapi-schema/missing-comma-list.err
tests/qapi-schema/missing-comma-object.err
tests/qapi-schema/non-objects.err
tests/qapi-schema/quoted-structural-chars.err
tests/qapi-schema/trailing-comma-list.err
tests/qapi-schema/unclosed-list.err
tests/qapi-schema/unclosed-object.err

index f27860540b39f468deefd9f1d273f5e0f511803d..142ab276ffb69df15b5bf28817db0a07faf37caf 100644 (file)
@@ -214,7 +214,7 @@ class QAPIDoc(object):
         # recognized, and get silently treated as ordinary text
         if not self.symbol and not self.body.text and line.startswith('@'):
             if not line.endswith(':'):
-                raise QAPIParseError(self._parser, "Line should end with :")
+                raise QAPIParseError(self._parser, "Line should end with ':'")
             self.symbol = line[1:-1]
             # FIXME invalid names other than the empty string aren't flagged
             if not self.symbol:
@@ -470,7 +470,7 @@ class QAPISchemaParser(object):
             else:
                 fobj = open(incl_fname, 'r')
         except IOError as e:
-            raise QAPISemError(info, '%s: %s' % (e.strerror, incl_fname))
+            raise QAPISemError(info, "%s: %s" % (e.strerror, incl_fname))
         return QAPISchemaParser(fobj, previously_included, info)
 
     def _pragma(self, name, value, info):
@@ -522,7 +522,7 @@ class QAPISchemaParser(object):
                     ch = self.src[self.cursor]
                     self.cursor += 1
                     if ch == '\n':
-                        raise QAPIParseError(self, 'Missing terminating "\'"')
+                        raise QAPIParseError(self, "Missing terminating \"'\"")
                     if esc:
                         # Note: we recognize only \\ because we have
                         # no use for funny characters in strings
@@ -559,7 +559,7 @@ class QAPISchemaParser(object):
                 self.line += 1
                 self.line_pos = self.cursor
             elif not self.tok.isspace():
-                raise QAPIParseError(self, 'Stray "%s"' % self.tok)
+                raise QAPIParseError(self, "Stray '%s'" % self.tok)
 
     def get_members(self):
         expr = OrderedDict()
@@ -567,24 +567,24 @@ class QAPISchemaParser(object):
             self.accept()
             return expr
         if self.tok != "'":
-            raise QAPIParseError(self, 'Expected string or "}"')
+            raise QAPIParseError(self, "Expected string or '}'")
         while True:
             key = self.val
             self.accept()
             if self.tok != ':':
-                raise QAPIParseError(self, 'Expected ":"')
+                raise QAPIParseError(self, "Expected ':'")
             self.accept()
             if key in expr:
-                raise QAPIParseError(self, 'Duplicate key "%s"' % key)
+                raise QAPIParseError(self, "Duplicate key '%s'" % key)
             expr[key] = self.get_expr(True)
             if self.tok == '}':
                 self.accept()
                 return expr
             if self.tok != ',':
-                raise QAPIParseError(self, 'Expected "," or "}"')
+                raise QAPIParseError(self, "Expected ',' or '}'")
             self.accept()
             if self.tok != "'":
-                raise QAPIParseError(self, 'Expected string')
+                raise QAPIParseError(self, "Expected string")
 
     def get_values(self):
         expr = []
@@ -592,20 +592,20 @@ class QAPISchemaParser(object):
             self.accept()
             return expr
         if self.tok not in "{['tfn":
-            raise QAPIParseError(self, 'Expected "{", "[", "]", string, '
-                                 'boolean or "null"')
+            raise QAPIParseError(
+                self, "Expected '{', '[', ']', string, boolean or 'null'")
         while True:
             expr.append(self.get_expr(True))
             if self.tok == ']':
                 self.accept()
                 return expr
             if self.tok != ',':
-                raise QAPIParseError(self, 'Expected "," or "]"')
+                raise QAPIParseError(self, "Expected ',' or ']'")
             self.accept()
 
     def get_expr(self, nested):
         if self.tok != '{' and not nested:
-            raise QAPIParseError(self, 'Expected "{"')
+            raise QAPIParseError(self, "Expected '{'")
         if self.tok == '{':
             self.accept()
             expr = self.get_members()
@@ -616,8 +616,8 @@ class QAPISchemaParser(object):
             expr = self.val
             self.accept()
         else:
-            raise QAPIParseError(self, 'Expected "{", "[", string, '
-                                 'boolean or "null"')
+            raise QAPIParseError(
+                self, "Expected '{', '[', string, boolean or 'null'")
         return expr
 
     def get_doc(self, info):
@@ -881,9 +881,10 @@ def check_union(expr, info):
                                "struct '%s'"
                                % (discriminator, base))
         if discriminator_value.get('if'):
-            raise QAPISemError(info, 'The discriminator %s.%s for union %s '
-                               'must not be conditional' %
-                               (base, discriminator, name))
+            raise QAPISemError(
+                info,
+                "The discriminator %s.%s for union %s must not be conditional"
+                % (base, discriminator, name))
         enum_define = enum_types.get(discriminator_value['type'])
         # Do not allow string discriminator
         if not enum_define:
index da8989540464397e55f0961b12637e8499c02029..2021fda5d142dacf2fda63bfeae7d01f42655995 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/bad-type-int.json:3:13: Stray "1"
+tests/qapi-schema/bad-type-int.json:3:13: Stray '1'
index 817398b8e420b760170f15d9defd85360cd522b4..b41d5078b0d804ed9c7886c862a5cd273c9901b5 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/doc-missing-colon.json:4:1: Line should end with :
+tests/qapi-schema/doc-missing-colon.json:4:1: Line should end with ':'
index 6d02f83538865f9a56fedab66be768295774f19e..3af2f55174feb0f83ec1851b190a930c5fc23db4 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/duplicate-key.json:3:10: Duplicate key "key"
+tests/qapi-schema/duplicate-key.json:3:10: Duplicate key 'key'
index 071c5213d8e3ce5b5db8b63d3987b132cc548c93..3f8d7b5b712e3b655638b4a6738d1b65877cefea 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/enum-int-member.json:3:31: Stray "1"
+tests/qapi-schema/enum-int-member.json:3:31: Stray '1'
diff --git a/tests/qapi-schema/escape-outside-string.err b/tests/qapi-schema/escape-outside-string.err
new file mode 100644 (file)
index 0000000..efee335
--- /dev/null
@@ -0,0 +1 @@
+tests/qapi-schema/escape-outside-string.json:3:27: Stray '\'
index bfc890cd9f25e208b7471fb70a203e8c3c7830dd..139ecf4eb845988eaa68c074692943d7677c0632 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/funny-char.json:2:36: Stray ";"
+tests/qapi-schema/funny-char.json:2:36: Stray ';'
index 0a440574bd5e1c875f348985bd2e3c7123596417..18aedb4a99806bd9a7f3aea03be6a79e37f29f0e 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/funny-word.json:1:3: Stray "c"
+tests/qapi-schema/funny-word.json:1:3: Stray 'c'
index 55652751e10a230083d6cabf4c65376edf903686..2b26322170c264cfdd905de7cc68173190894647 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/include-before-err.json:2:13: Expected ":"
+tests/qapi-schema/include-before-err.json:2:13: Expected ':'
index 1b7b22706bec9533082ca8a4d226b7135b8f7a53..aec6207eb047f6cd3254542272071d19ea05201f 100644 (file)
@@ -1,2 +1,2 @@
 In file included from tests/qapi-schema/include-nested-err.json:1:
-tests/qapi-schema/missing-colon.json:1:10: Expected ":"
+tests/qapi-schema/missing-colon.json:1:10: Expected ':'
index f5c870bb9c4a069521b4403944917012df251e56..e021e42ad96633ab1793047bedbe9dfa6aa74e76 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/leading-comma-list.json:2:13: Expected "{", "[", "]", string, boolean or "null"
+tests/qapi-schema/leading-comma-list.json:2:13: Expected '{', '[', ']', string, boolean or 'null'
index f767b95544ef0e8921e073fddcfda72484808fb1..3852f123d21a6c9de3efc74a55a9c568097e7933 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/leading-comma-object.json:1:3: Expected string or "}"
+tests/qapi-schema/leading-comma-object.json:1:3: Expected string or '}'
index d9d66b377afe7cce7d859ffc07c3236ca2a68835..a255e519189d36af2a6b4836cfc63dce19e24624 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/missing-colon.json:1:10: Expected ":"
+tests/qapi-schema/missing-colon.json:1:10: Expected ':'
index e73d2770d6396b6f10e3eb49eab6115d9fe9d2da..df3f553f394c5d7857ae71d30e846dd089bbff2f 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/missing-comma-list.json:2:20: Expected "," or "]"
+tests/qapi-schema/missing-comma-list.json:2:20: Expected ',' or ']'
index 52b3a8a1ec86bae6c789e20534223b5b64fd9418..0f691b8ddd3bd29e5ea89ebf7f84c2cee44d25cd 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/missing-comma-object.json:2:3: Expected "," or "}"
+tests/qapi-schema/missing-comma-object.json:2:3: Expected ',' or '}'
index 334f0c91aea0b60ff5ca57b330300ae1dafe441e..a972abd937d002d129595e298af6203c99f44457 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/non-objects.json:1:1: Expected "{"
+tests/qapi-schema/non-objects.json:1:1: Expected '{'
index 9b183841ddda459eebc840c6f306d78546925080..6e036c8044f56aac7ebcbd0ebc70b428e2d7832d 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/quoted-structural-chars.json:1:1: Expected "{"
+tests/qapi-schema/quoted-structural-chars.json:1:1: Expected '{'
index 212e14ae28efbdf4089082841294cfb526f63ab3..601c4537c3c90c14d4c60d3a0a2adaf673326b62 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/trailing-comma-list.json:2:36: Expected "{", "[", string, boolean or "null"
+tests/qapi-schema/trailing-comma-list.json:2:36: Expected '{', '[', string, boolean or 'null'
index fb41a86abd09f694376f969872b1a45ede2991af..1cc3a094fea5c2b183666dd87f09cf23284f7d79 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/unclosed-list.json:1:20: Expected "," or "]"
+tests/qapi-schema/unclosed-list.json:1:20: Expected ',' or ']'
index db3deedd63d4f5bc031fea93b9f49ca73673abb2..fd1a86b70440fdd4a20e9bd7a189d0f4f14a4245 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/unclosed-object.json:1:21: Expected "," or "}"
+tests/qapi-schema/unclosed-object.json:1:21: Expected ',' or '}'