From patchwork Thu Oct 4 17:33:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 189254 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 0C6022C03A9 for ; Fri, 5 Oct 2012 05:12:29 +1000 (EST) Received: from localhost ([::1]:55237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJpKD-0008Iv-PU for incoming@patchwork.ozlabs.org; Thu, 04 Oct 2012 13:35:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49301) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJpJP-0007AK-R2 for qemu-devel@nongnu.org; Thu, 04 Oct 2012 13:34:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJpJJ-0000pr-WB for qemu-devel@nongnu.org; Thu, 04 Oct 2012 13:34:15 -0400 Received: from mail-oa0-f45.google.com ([209.85.219.45]:46731) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJpJJ-0000hT-Qj for qemu-devel@nongnu.org; Thu, 04 Oct 2012 13:34:09 -0400 Received: by mail-oa0-f45.google.com with SMTP id i18so707994oag.4 for ; Thu, 04 Oct 2012 10:34:09 -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=mUzPa0p5dxFg7mXVRkXQlbuqNsmndSLuStzTJ1nKbFI=; b=sKRSU+r76qNcy4fJ1NOXewIUylrkZtUgO3I+AnvwKUptS++vmEzXfoP6AWfJJWx9VO jN7uqFgh4k7XkurHRmMknfN03mzyhx1AwBY0XdwapN89n9WCy6CN31j1uvnkLKT+uyBR lLyHt06FjebWq+ZwhGiR1tPK4Ah6N2jkki4anFy4m1eu6mVCNOmHfyv1zc4Xb4dwfZdK rnwD7j4pXnb9YeSf75QLovRjjf45H0aEFGDyBGA9RIf9rh+fmkaIJmPW1DE/nv+gH7ci CfX4aJKLihMb82sgC27nSW2+UYP9jun9GeyRHKZ29bES5NmBqxf16JkrnMetfE6+OVRf qCEw== Received: by 10.182.157.45 with SMTP id wj13mr4998577obb.58.1349372049569; Thu, 04 Oct 2012 10:34:09 -0700 (PDT) Received: from loki.austin.ibm.com ([32.97.110.59]) by mx.google.com with ESMTPS id h2sm7131923obn.11.2012.10.04.10.34.07 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 04 Oct 2012 10:34:08 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Thu, 4 Oct 2012 12:33:30 -0500 Message-Id: <1349372021-31212-12-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1349372021-31212-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1349372021-31212-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.219.45 Cc: kwolf@redhat.com, peter.maydell@linaro.org, aliguori@us.ibm.com, blauwirbel@gmail.com, pbonzini@redhat.com, eblake@redhat.com Subject: [Qemu-devel] [PATCH v3 11/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 a347203..47cd672 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -81,7 +81,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)