From patchwork Tue Jul 24 17:20:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 172992 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 745D22C0088 for ; Wed, 25 Jul 2012 04:01:18 +1000 (EST) Received: from localhost ([::1]:38957 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StioN-000589-R9 for incoming@patchwork.ozlabs.org; Tue, 24 Jul 2012 13:22:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Stinq-0003uC-P6 for qemu-devel@nongnu.org; Tue, 24 Jul 2012 13:21:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Stinp-0000U4-P9 for qemu-devel@nongnu.org; Tue, 24 Jul 2012 13:21:46 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:53639) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Stinp-0000Fl-J1 for qemu-devel@nongnu.org; Tue, 24 Jul 2012 13:21:45 -0400 Received: by mail-pb0-f45.google.com with SMTP id ro12so12773613pbb.4 for ; Tue, 24 Jul 2012 10:21:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=NU/ZpvcDQ2p2sxUXdyUW/y8JnuqiwQ7WKsMDjtDwpB8=; b=xXY+9zcZJ+gWX5D8N0G7wNqeuMImx6jjnNNXrVRWDfJ2bdy6xnyCK+hTHX0kvTgD3R gNgCNbhIFmFw83QZ3cp3c9lz7E8UXIt86j0GIN3Z2dsIl9Tqy3hB/zbc1bTEoEDyylMz 8egPdBArrV8hRp8T8NXvaV7EqlQzGdN5loUsmAFK/2doS9vgMFxpJOp5cf4yQjJ35/L8 wyyXmP25jNaQPhaao1bMl3+b1jKWYQNJa94A6lYo35bU/J6zqyED18z/06aJB8pWJOeN 7unDJbJaVMs0omaurwjziqp1uM6kneS/Xo2LGPn3Ao/nGkrZtaMnMXS0d94F66ziFm3f PVaQ== Received: by 10.68.136.68 with SMTP id py4mr42924331pbb.151.1343150505174; Tue, 24 Jul 2012 10:21:45 -0700 (PDT) Received: from loki.morrigu.org (cpe-72-179-62-111.austin.res.rr.com. [72.179.62.111]) by mx.google.com with ESMTPS id nh8sm12522083pbc.60.2012.07.24.10.21.42 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 Jul 2012 10:21:44 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Tue, 24 Jul 2012 12:20:42 -0500 Message-Id: <1343150454-4677-11-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1343150454-4677-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1343150454-4677-1-git-send-email-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: aliguori@us.ibm.com, quintela@redhat.com, owasserm@redhat.com, yamahata@valinux.co.jp, pbonzini@redhat.com, akong@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH 10/22] qapi: qapi.py, make json parser more robust X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Currently the QAPI JSON parser expects a very particular style of code indentation, the major one being that terminating curly/square brackets are not on placed on a seperate line. This is incompatible with most pretty-print formats, so make it a little more robust by supporting these cases. Signed-off-by: Michael Roth --- scripts/qapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qapi.py b/scripts/qapi.py index 39bb74e..e0c694d 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -70,7 +70,7 @@ def parse_schema(fp): if line.startswith('#') or line == '\n': continue - if line.startswith(' '): + if line[0] in ['}', ']', ' ', '\t']: expr += line elif expr: expr_eval = evaluate(expr)