cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
Blob Blame History Raw
From eee270ab05e29d24d26d8834a00ec0dfcfc99d66 Mon Sep 17 00:00:00 2001
Message-Id: <eee270ab05e29d24d26d8834a00ec0dfcfc99d66.1387369730.git.minovotn@redhat.com>
In-Reply-To: <091eecc4fa42754760dfff393dabcc2b444e9693.1387369730.git.minovotn@redhat.com>
References: <091eecc4fa42754760dfff393dabcc2b444e9693.1387369730.git.minovotn@redhat.com>
From: Markus Armbruster <armbru@redhat.com>
Date: Tue, 10 Dec 2013 15:29:19 +0100
Subject: [PATCH 19/21] qapi.py: Permit comments starting anywhere on the line

RH-Author: Markus Armbruster <armbru@redhat.com>
Message-id: <1386689361-30281-17-git-send-email-armbru@redhat.com>
Patchwork-id: 56128
O-Subject: [PATCH 7.0 qemu-kvm 16/18] qapi.py: Permit comments starting anywhere on the line
Bugzilla: 997915
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>

From: Markus Armbruster <armbru@redhat.com>

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1374939721-7876-10-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit f1a145e154b0a227a1e192009ca30b351de0a8ef)

Backporting hack: now that indented comments work properly, revert the
damage to qapi-schema.json.
---
 qapi-schema.json                | 2 +-
 scripts/qapi.py                 | 3 +--
 tests/qapi-schema/comments.err  | 1 -
 tests/qapi-schema/comments.exit | 2 +-
 tests/qapi-schema/comments.out  | 3 +++
 5 files changed, 6 insertions(+), 5 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 qapi-schema.json                | 2 +-
 scripts/qapi.py                 | 3 +--
 tests/qapi-schema/comments.err  | 1 -
 tests/qapi-schema/comments.exit | 2 +-
 tests/qapi-schema/comments.out  | 3 +++
 5 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/qapi-schema.json b/qapi-schema.json
index 81fe591..b27108f 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3437,7 +3437,7 @@
                                        'spiceport' : 'ChardevSpicePort',
                                        'vc'     : 'ChardevVC',
                                        'ringbuf': 'ChardevRingbuf',
-# next one is just for compatibility
+                                       # next one is just for compatibility
                                        'memory' : 'ChardevRingbuf' } }
 
 ##
diff --git a/scripts/qapi.py b/scripts/qapi.py
index f64b7b2..0ebea94 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -68,13 +68,12 @@ class QAPISchema:
 
     def accept(self):
         while True:
-            bol = self.cursor == 0 or self.src[self.cursor-1] == '\n'
             self.tok = self.src[self.cursor]
             self.pos = self.cursor
             self.cursor += 1
             self.val = None
 
-            if self.tok == '#' and bol:
+            if self.tok == '#':
                 self.cursor = self.src.find('\n', self.cursor)
             elif self.tok in ['{', '}', ':', ',', '[', ']']:
                 return
diff --git a/tests/qapi-schema/comments.err b/tests/qapi-schema/comments.err
index 4a82b26..e69de29 100644
--- a/tests/qapi-schema/comments.err
+++ b/tests/qapi-schema/comments.err
@@ -1 +0,0 @@
-<stdin>:2:33: Stray "#"
diff --git a/tests/qapi-schema/comments.exit b/tests/qapi-schema/comments.exit
index d00491f..573541a 100644
--- a/tests/qapi-schema/comments.exit
+++ b/tests/qapi-schema/comments.exit
@@ -1 +1 @@
-1
+0
diff --git a/tests/qapi-schema/comments.out b/tests/qapi-schema/comments.out
index e69de29..e3bd904 100644
--- a/tests/qapi-schema/comments.out
+++ b/tests/qapi-schema/comments.out
@@ -0,0 +1,3 @@
+[OrderedDict([('enum', 'Status'), ('data', ['good', 'bad', 'ugly'])])]
+['Status']
+[]
-- 
1.7.11.7