From nobody Fri Nov 14 19:24:25 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=1589820683; cv=none; d=zohomail.com; s=zohoarc; b=BxxGZLaN+Ma1cU+bYI+eSm2yDOD4RrGfjJEnPZyFpjUDva1UyZUmdmOCo1h+8282H/RbLdCLk7WQL4ESjLJZ3+8pp8AEn3SHNWYHnu0jxo4lcwS1/wm5d8NQkNw61kOQcR0C93iByCyn0l3tADmY/YCI0L/f2t25+HOiK0ycbcE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589820683; h=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=PDxSs9xf1b7EFL4pA0grZqMFDbD8BMz/GvRTlqeyA2I=; b=MM7FDsjRBevn2PcqkLYAgOlkSVv5NrXjEQ5cmId/AF8cNudX2Cc1Sc0E8HJedj7z6Zp4+M39PVWTFik3CCuwGfCBdR8hteNkQplgnIR7du9RV63I9iUKscPEoOlJ5xTudotXtD4zjXsWKkRL7gpa3vVaP3nwsIJDo+riFGC3Nak= 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 1589820683357822.1272241347737; Mon, 18 May 2020 09:51:23 -0700 (PDT) Received: from localhost ([::1]:53798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jaiz4-00014t-5o for importer@patchew.org; Mon, 18 May 2020 12:51:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jaip9-0002CR-SE for qemu-devel@nongnu.org; Mon, 18 May 2020 12:41:07 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:33996) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jaip8-0005s9-PQ for qemu-devel@nongnu.org; Mon, 18 May 2020 12:41:07 -0400 Received: by mail-pf1-x42f.google.com with SMTP id x15so5222551pfa.1 for ; Mon, 18 May 2020 09:41:06 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id x132sm5790610pfd.214.2020.05.18.09.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 09:41:04 -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=PDxSs9xf1b7EFL4pA0grZqMFDbD8BMz/GvRTlqeyA2I=; b=e2AxxJupJagi8K3bYFhRin1ja+XNx7qEOSklYn7bX3V3sasqPk3DKCZ7y4K6VoFE/l PAKSQlGoY4mJDxOTXf5daCf8qEmo/vQmJTxqljcHaAbTURf/cwidT9AvTUQdeP9NjEUK G0dRiJs0EvWeqi3ajkRobYvC8+oyFJ3+DVkI6j2SR7VReEnMXGlh9uNTkxewEQ0JghSt LlaqmccdYMeQwqDGO3sLFLvm8sc1S0pKfEHKc/NFSPAb2VABOgb8WQHqoobpfr0FJSAR 18yUyegB6NxX2vl4s63VPid8OXZfelZmswCxBkukTs6RqL5ZKr1WGvSaBF2Ublw5DcBo eXmw== 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=PDxSs9xf1b7EFL4pA0grZqMFDbD8BMz/GvRTlqeyA2I=; b=LeVMy7V4AOQkz8ny5dH+ozh3pv8jajEJfCgh4crH8+tYuGqFfU3q/+zbaZCXX2zsva rkFVlH/1zEmHApXEno9ntfov+Kyvx5oTJ4t9D7mpj0laelsxYzJ6Png/8RCQXbRyno42 Kq6a73gEEIUSPdzZUbf6ZpJc1rKCSgBrH4qw+XV77XcQRnOrhuTDitTeUhitKzeXdXHv jJStOUc78oIoZ+XJgRiwcRKW0qc7dDntYhez+OTXh0CKSCcN3ppaM/oJgBRVU+JOgROg s0E9bPhCbjP+4+NtXXyE0YWW/+bL+GMIae+0Hhgrv5RlbHRAJfUdUEtRwIlb/Cwgknl/ B9fA== X-Gm-Message-State: AOAM5318rGv5dCdvUKyr/UlFAKhTJ/UprEvh9uWqN7LgraG2x9IXhymR fCJ8qXc2PhLxUTIE/vTX/NHfDpBaxyQ= X-Google-Smtp-Source: ABdhPJz2mNM3Vx1I4JTL/IA+nLTzTH0DX3NuB5L1MrwaoOxh80fouh+qK87vSy+osu8KmCf9NNnTEQ== X-Received: by 2002:a62:cd4a:: with SMTP id o71mr17915345pfg.115.1589820064970; Mon, 18 May 2020 09:41:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 7/8] decodetree: Implement non-overlapping groups Date: Mon, 18 May 2020 09:40:51 -0700 Message-Id: <20200518164052.18689-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518164052.18689-1-richard.henderson@linaro.org> References: <20200518164052.18689-1-richard.henderson@linaro.org> MIME-Version: 1.0 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::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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 Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Intended to be nested within overlapping groups. Suggested-by: Peter Maydell Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- scripts/decodetree.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 0ba01e049c..a9739f671d 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -1021,21 +1021,22 @@ 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: - error(lineno, 'indentation ', indent, ' !=3D ', nesting) - toks =3D [] continue =20 @@ -1044,11 +1045,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 +1071,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.20.1