From nobody Fri Dec 19 20:13:12 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1591142612; cv=none; d=zohomail.com; s=zohoarc; b=SNjJRQnNHSCETIhRWYonrM3aJ3KcZYMH35rMWo10x7wOrm8kAfgvrw3qPsX3z7F8Tveir9Wfih+xPBQnEzE20h60bZVj9qQWwo8egvKOpyFnv2tKpAsrspURj8GggGiPSKSjqlYguhX5goXtHg+wripcfKFmCkiLkU1kPwIwZkI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591142612; 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=T9g/1bYL5AF8SWtZFiFU5ixPPASa6ChAdx/2pCnn8+k=; b=g5wVc//nyMPg9cNbUgy5M0xS0y8gYde0iskgk90QTRuSEi3rKOZts/JP67q1+b6pUJwbzbGoUnsp3ZKnrVKplTuQHTj9IP0+F2teeOmUZHJ3X37D8PuRIWbfDu7M2Ggnk7fSvh6H5JI5A3UPhjGjSHXQ423+IBv1DFHwPjpkGLM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1591142612227750.9218883330807; Tue, 2 Jun 2020 17:03:32 -0700 (PDT) Received: from localhost ([::1]:57730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgGsU-0003NT-Sr for importer@patchew.org; Tue, 02 Jun 2020 20:03:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgGnv-0004uM-9z for qemu-devel@nongnu.org; Tue, 02 Jun 2020 19:58:47 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:40715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jgGnu-00024y-FV for qemu-devel@nongnu.org; Tue, 02 Jun 2020 19:58:47 -0400 Received: by mail-pf1-x429.google.com with SMTP id v2so294117pfv.7 for ; Tue, 02 Jun 2020 16:58:46 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id k101sm182201pjb.26.2020.06.02.16.58.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2020 16:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=T9g/1bYL5AF8SWtZFiFU5ixPPASa6ChAdx/2pCnn8+k=; b=qZJBNhgobPOrNgGlxq5XE+HbFruffBAbh+WUkUA+QIHdbWHFD4FGbbeRb4SUax5YzT rYwh6A95BJlleTrEpkr9E1jsV+fJZgHZwPCkW79IumzvMO2bHvBTaf0CQFGeSjnYTJ1q BpzjLNtZTNq5JICPOZpQx9tExo4JdNm+oOjQFILoM1RJ6SwZU6DpPQmq6MoAyoBVky+/ 7rba46wOzG3rt0ImrQQs6YGEgvRMncdd+0cEQvrDtEf/QV2uCU8i4r+YxHfANmYbKNl6 dWNBKx3muSfLRlcpCa1CQe5hB5hZIUq4aFMiLt8vbLCOrnyFqWxEaMz47/lDjn6Oo6v9 2InQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T9g/1bYL5AF8SWtZFiFU5ixPPASa6ChAdx/2pCnn8+k=; b=j85uPZB35zFIDxEgCy9k0zQaQj6742B7OpsJwCjOYs/1D2sJ9cX9xCRlzh8+awssiG kX5u3xaVyOAvGv5npkmpXkJCHU/nuORKwE/d/yBBUgB8hHj04CcJ4iiAtXEE4fSyA/43 S/nv/l59RtrpLXsW7aty8Cdnya0Gxbv39Ytyz8a7gDPJdwcDhKN2rLiQGO/OazGRXIun PCpkpvd+2XOip4ovsqRTuLYyCwbVxBXlDntTPNFm4N/ZUB7U7dp4qnlBVfPBZTD5sXjU L3a/duPfWMS/WkUncAoK+xEEx+fPeRq38OIWxvCLFgFWz9caEhT0e9o77HzMgnZkMe+g e0GQ== X-Gm-Message-State: AOAM533Cn0jzfaP66uPuS2uKxTKcLaOTf553PR6vJiQQ62U8o29IZqo9 Es+yyJtkpivf9qNIsDSpbbPefbdQwzo= X-Google-Smtp-Source: ABdhPJzNrMBAQZSmgPPw+hqTah32yVrErsorwcPaaQ5AeElV7faPbu8UDh5UE1tzTOPbnlGFixY9wA== X-Received: by 2002:aa7:93ac:: with SMTP id x12mr29950554pff.143.1591142324732; Tue, 02 Jun 2020 16:58:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 6/8] decodetree: Implement non-overlapping groups Date: Tue, 2 Jun 2020 16:58:32 -0700 Message-Id: <20200602235834.470345-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200602235834.470345-1-richard.henderson@linaro.org> References: <20200602235834.470345-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: peter.maydell@linaro.org, philmd@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Intended to be nested within overlapping groups. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Suggested-by: Peter Maydell Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- scripts/decodetree.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 0ba01e049c..7e3b1d1399 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -1021,16 +1021,20 @@ def parse_file(f, parent_pat): del toks[0] =20 # End nesting? - if name =3D=3D '}': + if name =3D=3D '}' or name =3D=3D ']': if len(toks) !=3D 0: error(start_lineno, 'extra tokens after close brace') if len(parent_pat.pats) < 2: error(lineno, 'less than two patterns within braces') =20 + # Make sure { } and [ ] nest properly. + if (name =3D=3D '}') !=3D isinstance(parent_pat, IncMultiPatte= rn): + error(lineno, 'mismatched close brace') + try: parent_pat =3D nesting_pats.pop() except: - error(lineno, 'mismatched close brace') + error(lineno, 'extra close brace') =20 nesting -=3D 2 if indent !=3D nesting: @@ -1044,11 +1048,14 @@ def parse_file(f, parent_pat): error(start_lineno, 'indentation ', indent, ' !=3D ', nesting) =20 # Start nesting? - if name =3D=3D '{': + if name =3D=3D '{' or name =3D=3D '[': if len(toks) !=3D 0: error(start_lineno, 'extra tokens after open brace') =20 - nested_pat =3D IncMultiPattern(start_lineno) + if name =3D=3D '{': + nested_pat =3D IncMultiPattern(start_lineno) + else: + nested_pat =3D ExcMultiPattern(start_lineno) parent_pat.pats.append(nested_pat) nesting_pats.append(parent_pat) parent_pat =3D nested_pat @@ -1067,6 +1074,9 @@ def parse_file(f, parent_pat): else: parse_generic(start_lineno, parent_pat, name, toks) toks =3D [] + + if nesting !=3D 0: + error(lineno, 'missing close brace') # end parse_file =20 =20 --=20 2.25.1