From nobody Mon Feb 9 11:06:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1602401944; cv=none; d=zohomail.com; s=zohoarc; b=RvyriqHFFwUbvGa5nCdY++s/HCvRgv3tGKp8iGVAPIJ6tCTAe7E9j1q5e1BdGpYqBk0pcftzlt+It34iVUxOqz3Y+hZwdA8Sk2XXqA3QfPhbC/8Iz6ypfI6f8pvZmcS1muwequNER1Ogrp3y5PbXp/VQbatBe89U6KTNSITdsJ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602401944; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EiSiGe2Sr1BVyh/nVct1USJZCm5n8JYMclTN1VuwLl8=; b=hGI1OLr5aOBqwZyi8xUeY4h7hRnXD31LBuZvpmNusynml+2RfDCNpy1XgHjQ11CLQ/F05hLBiBR5oX1yn0WcXIlPyGtrKtkU1gZLlCZPHQ7ynIj0XgEQsbeBqG/TaCnhsOPQEREjakK5AfeqeDJnMa65Z5Jagbu+91PRk58kiAE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602401944067451.72150920413253; Sun, 11 Oct 2020 00:39:04 -0700 (PDT) Received: from localhost ([::1]:50008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kRVwc-0003IA-Ol for importer@patchew.org; Sun, 11 Oct 2020 03:39:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRVt2-0006Fh-Df for qemu-devel@nongnu.org; Sun, 11 Oct 2020 03:35:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58205) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kRVsx-0003Gs-Ew for qemu-devel@nongnu.org; Sun, 11 Oct 2020 03:35:20 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-445-1y5CB0R-PSK_jlPu_GSm3A-1; Sun, 11 Oct 2020 03:35:07 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C80F7107ACF5; Sun, 11 Oct 2020 07:35:06 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-182.ams2.redhat.com [10.36.112.182]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9761646; Sun, 11 Oct 2020 07:35:06 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 1537A11329AF; Sun, 11 Oct 2020 09:35:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602401711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EiSiGe2Sr1BVyh/nVct1USJZCm5n8JYMclTN1VuwLl8=; b=QE6pEKpcOievGzHuZdiXZ/VhTO3DRhc6+/SrlQbvJC+QZNjs6qHrBnXFZMKdNkrjlrsAhc lD0qZ8WnZaLErgX1gwCXTwwYsN3up3lRvWoUT3IbmD6XvwKoaRf4e0ne0uzcpxYg8ILXyg cAehSIIhpzJHam9sdox074rD2QWRg1A= X-MC-Unique: 1y5CB0R-PSK_jlPu_GSm3A-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v4 1/7] keyval: Fix and clarify grammar Date: Sun, 11 Oct 2020 09:34:59 +0200 Message-Id: <20201011073505.1185335-2-armbru@redhat.com> In-Reply-To: <20201011073505.1185335-1-armbru@redhat.com> References: <20201011073505.1185335-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/11 02:10:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The grammar has a few issues: * key-fragment =3D / [^=3D,.]* / Prose restricts key fragments: they "must be valid QAPI names or consist only of decimal digits". Technically, '' consists only of decimal digits. The code rejects that. Fix the grammar. * val =3D { / [^,]* / | ',,' } Use + instead of *. Accepts the same language. * val-no-key =3D / [^=3D,]* / The code rejects an empty value. Fix the grammar. * Section "Additional syntax for use with an implied key" is confusing. Rewrite it. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- util/keyval.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/util/keyval.c b/util/keyval.c index 13def4af54..82d8497c71 100644 --- a/util/keyval.c +++ b/util/keyval.c @@ -16,8 +16,8 @@ * key-vals =3D [ key-val { ',' key-val } [ ',' ] ] * key-val =3D key '=3D' val * key =3D key-fragment { '.' key-fragment } - * key-fragment =3D / [^=3D,.]* / - * val =3D { / [^,]* / | ',,' } + * key-fragment =3D / [^=3D,.]+ / + * val =3D { / [^,]+ / | ',,' } * * Semantics defined by reduction to JSON: * @@ -71,12 +71,16 @@ * Awkward. Note that we carefully restrict alternate types to avoid * similar ambiguity. * - * Additional syntax for use with an implied key: + * Alternative syntax for use with an implied key: * - * key-vals-ik =3D val-no-key [ ',' key-vals ] - * val-no-key =3D / [^=3D,]* / + * key-vals =3D [ key-val-1st { ',' key-val } [ ',' ] ] + * key-val-1st =3D val-no-key | key-val + * val-no-key =3D / [^=3D,]+ / * - * where no-key is syntactic sugar for implied-key=3Dval-no-key. + * where val-no-key is syntactic sugar for implied-key=3Dval-no-key. + * + * Note that you can't use the sugared form when the value contains + * '=3D' or ','. */ =20 #include "qemu/osdep.h" --=20 2.26.2