From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V38LD-0002e5-7g for qemu-devel@nongnu.org; Sat, 27 Jul 2013 13:31:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V37kg-0007lF-4k for qemu-devel@nongnu.org; Sat, 27 Jul 2013 12:54:00 -0400 Received: from oxygen.pond.sub.org ([2a01:4f8:121:10e4::3]:56012) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V36dD-0006gH-LS for qemu-devel@nongnu.org; Sat, 27 Jul 2013 11:42:07 -0400 From: Markus Armbruster Date: Sat, 27 Jul 2013 17:42:01 +0200 Message-Id: <1374939721-7876-10-git-send-email-armbru@redhat.com> In-Reply-To: <1374939721-7876-1-git-send-email-armbru@redhat.com> References: <1374939721-7876-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH v2 9/9] qapi.py: Permit comments starting anywhere on the line List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, akong@redhat.com, mdroth@linux.vnet.ibm.com Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- scripts/qapi.py | 3 +-- tests/qapi-schema/comments.err | 1 - tests/qapi-schema/comments.exit | 2 +- tests/qapi-schema/comments.out | 3 +++ 4 files changed, 5 insertions(+), 4 deletions(-) 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 @@ -: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