From nobody Wed May 1 03:12:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1521242903190304.4971615996036; Fri, 16 Mar 2018 16:28:23 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4BD0E22489CB0; Fri, 16 Mar 2018 16:21:25 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6546D22489C92 for ; Fri, 16 Mar 2018 16:21:23 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Mar 2018 16:27:48 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 16 Mar 2018 16:27:48 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,318,1517904000"; d="scan'208";a="39650821" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 16 Mar 2018 16:27:38 -0700 Message-Id: <6fb495a81dfe4fb8d9cf1b6072607364a416639e.1521242771.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 1/9] BaseTools: FdfParser and FdfParserLite share reg exp X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" FdfParser can share regular expression from FdfParserLite. reduce overlap and reduce recompile of the same expression. Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Common/FdfParserLite.py | 5 +++-- BaseTools/Source/Python/GenFds/FdfParser.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Common/FdfParserLite.py b/BaseTools/So= urce/Python/Common/FdfParserLite.py index 7d129bfcab59..330422ad59d2 100644 --- a/BaseTools/Source/Python/Common/FdfParserLite.py +++ b/BaseTools/Source/Python/Common/FdfParserLite.py @@ -46,6 +46,8 @@ InputMacroDict =3D {} # All Macro values when parsing file, not replace existing Macro AllMacroList =3D [] =20 +FileExtensionPattern =3D re.compile(r'([a-zA-Z][a-zA-Z0-9]*)') + def GetRealFileLine (File, Line): =20 InsertedLines =3D 0 @@ -2842,8 +2844,7 @@ class FdfParser(object): =20 Ext =3D "" if self.__GetNextToken(): - Pattern =3D re.compile(r'([a-zA-Z][a-zA-Z0-9]*)') - if Pattern.match(self.__Token): + if FileExtensionPattern.match(self.__Token): Ext =3D self.__Token =20 return '.' + Ext =20 else: diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index dda7ed4ce798..03183e398bdb 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -59,6 +59,7 @@ import Common.LongFilePathOs as os from Common.LongFilePathSupport import OpenLongFilePath as open from Capsule import EFI_CERT_TYPE_PKCS7_GUID from Capsule import EFI_CERT_TYPE_RSA2048_SHA256_GUID +from Common.FdfParserLite import FileExtensionPattern =20 ##define T_CHAR_SPACE ' ' ##define T_CHAR_NULL '\0' @@ -3706,7 +3707,6 @@ class FdfParser: =20 Ext =3D "" if self.__GetNextToken(): - Pattern =3D re.compile(r'([a-zA-Z][a-zA-Z0-9]*)') if Pattern.match(self.__Token): Ext =3D self.__Token return '.' + Ext --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed May 1 03:12:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1521242906575654.0811949146108; Fri, 16 Mar 2018 16:28:26 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A631022571B21; Fri, 16 Mar 2018 16:21:25 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8E0C822489C93 for ; Fri, 16 Mar 2018 16:21:23 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Mar 2018 16:27:48 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 16 Mar 2018 16:27:48 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,318,1517904000"; d="scan'208";a="39650824" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 16 Mar 2018 16:27:39 -0700 Message-Id: <56cae5c5823ecf8f7c21faf536c86d31d4cd70e3.1521242771.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 2/9] BaseTools: GlobalData share same MACRO name definition X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" use the same MACRO name definition across shared regular expression pattern= s. Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Common/GlobalData.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Sourc= e/Python/Common/GlobalData.py index 8b36a1b77366..83ba3d19961a 100644 --- a/BaseTools/Source/Python/Common/GlobalData.py +++ b/BaseTools/Source/Python/Common/GlobalData.py @@ -1,7 +1,7 @@ ## @file # This file is used to define common static strings used by INF/DEC/DSC fi= les # -# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BS= D License # which accompanies this distribution. The full text of the license may b= e found at @@ -43,10 +43,13 @@ gBuildingModule =3D '' gSkuids =3D [] gDefaultStores =3D [] =20 +# definition for a MACRO name. used to create regular expressions below. +_MacroNamePattern =3D "[A-Z][A-Z0-9_]*" + ## Regular expression for matching macro used in DSC/DEC/INF file inclusion -gMacroRefPattern =3D re.compile("\$\(([A-Z][_A-Z0-9]*)\)", re.UNICODE) +gMacroRefPattern =3D re.compile("\$\(({})\)".format(_MacroNamePattern), re= .UNICODE) gMacroDefPattern =3D re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+") -gMacroNamePattern =3D re.compile("^[A-Z][A-Z0-9_]*$") +gMacroNamePattern =3D re.compile("^{}$".format(_MacroNamePattern)) =20 # # A global variable for whether current build in AutoGen phase or not. --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed May 1 03:12:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1521242881668960.2464193396954; Fri, 16 Mar 2018 16:28:01 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0B6E922571B24; Fri, 16 Mar 2018 16:21:26 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B6E4422489C9F for ; Fri, 16 Mar 2018 16:21:23 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Mar 2018 16:27:48 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 16 Mar 2018 16:27:48 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,318,1517904000"; d="scan'208";a="39650827" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 16 Mar 2018 16:27:40 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 3/9] BaseTools: add GUID pattern to global data X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" add a shared global regular expression for GUID matching Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Common/GlobalData.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Sourc= e/Python/Common/GlobalData.py index 83ba3d19961a..4a85a8e0db63 100644 --- a/BaseTools/Source/Python/Common/GlobalData.py +++ b/BaseTools/Source/Python/Common/GlobalData.py @@ -51,6 +51,13 @@ gMacroRefPattern =3D re.compile("\$\(({})\)".format(_Mac= roNamePattern), re.UNICODE gMacroDefPattern =3D re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+") gMacroNamePattern =3D re.compile("^{}$".format(_MacroNamePattern)) =20 +# definition for a GUID. used to create regular expressions below. +_GuidPattern =3D r"[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F= ]{4}-[0-9a-fA-F]{12}" + +## Regular expressions for GUID matching +gGuidPattern =3D re.compile(r'{}'.format(_GuidPattern)) +gGuidPatternEnd =3D re.compile(r'{}$'.format(_GuidPattern)) + # # A global variable for whether current build in AutoGen phase or not. # --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed May 1 03:12:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1521242882502512.6731033643246; Fri, 16 Mar 2018 16:28:02 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5A9A222571B2E; Fri, 16 Mar 2018 16:21:27 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D74FA22468034 for ; Fri, 16 Mar 2018 16:21:23 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Mar 2018 16:27:48 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 16 Mar 2018 16:27:48 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,318,1517904000"; d="scan'208";a="39650830" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 16 Mar 2018 16:27:41 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 4/9] BaseTools: use new shared GUID regular expressions X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" remove local variables that are GUID matching and replace with shared expression. Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Common/Expression.py | 3 +-- BaseTools/Source/Python/Common/FdfParserLite.py | 5 ++--- BaseTools/Source/Python/Common/RangeExpression.py | 14 ++++++-------- BaseTools/Source/Python/GenFds/FdfParser.py | 3 +-- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Sourc= e/Python/Common/Expression.py index e76f09c367c1..c69c3cb1e84a 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -220,7 +220,6 @@ class ValueExpression(object): =20 PcdPattern =3D re.compile(r'[_a-zA-Z][0-9A-Za-z_]*\.[_a-zA-Z][0-9A-Za-= z_]*$') HexPattern =3D re.compile(r'0[xX][0-9a-fA-F]+$') - RegGuidPattern =3D re.compile(r'[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA= -F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}') =20 SymbolPattern =3D re.compile("(" "\$\([A-Z][A-Z0-9_]*\)|\$\(\w+\.\w+\)|\w+= \.\w+|" @@ -731,7 +730,7 @@ class ValueExpression(object): self._Token =3D '' if Expr: Ch =3D Expr[0] - Match =3D self.RegGuidPattern.match(Expr) + Match =3D gGuidPattern.match(Expr) if Match and not Expr[Match.end():Match.end()+1].isalnum() \ and Expr[Match.end():Match.end()+1] !=3D '_': self._Idx +=3D Match.end() diff --git a/BaseTools/Source/Python/Common/FdfParserLite.py b/BaseTools/So= urce/Python/Common/FdfParserLite.py index 330422ad59d2..773f3b1a708f 100644 --- a/BaseTools/Source/Python/Common/FdfParserLite.py +++ b/BaseTools/Source/Python/Common/FdfParserLite.py @@ -1,7 +1,7 @@ ## @file # parse FDF file # -# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD License @@ -933,8 +933,7 @@ class FdfParser(object): =20 if not self.__GetNextToken(): return False - p =3D re.compile('[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-= fA-F0-9]{4}-[a-fA-F0-9]{12}') - if p.match(self.__Token) !=3D None: + if gGuidPattern.match(self.__Token) !=3D None: return True else: self.__UndoToken() diff --git a/BaseTools/Source/Python/Common/RangeExpression.py b/BaseTools/= Source/Python/Common/RangeExpression.py index b6c929fd885b..bbcbd6b767e0 100644 --- a/BaseTools/Source/Python/Common/RangeExpression.py +++ b/BaseTools/Source/Python/Common/RangeExpression.py @@ -1,7 +1,7 @@ # # @file # This file is used to parse and evaluate range expression in Pcd declarat= ion. # -# Copyright (c) 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BS= D License # which accompanies this distribution. The full text of the license may= be found at @@ -211,8 +211,6 @@ class RangeExpression(object): =20 PcdPattern =3D re.compile(r'[_a-zA-Z][0-9A-Za-z_]*\.[_a-zA-Z][0-9A-Za-= z_]*$') HexPattern =3D re.compile(r'0[xX][0-9a-fA-F]+') - RegGuidPattern =3D re.compile(r'[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA= -F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}') - ExRegGuidPattern =3D re.compile(r'[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-= fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$') =20 SymbolPattern =3D re.compile("(" "\$\([A-Z][A-Z0-9_]*\)|\$\(\w+\.\w+\)|\w+= \.\w+|" @@ -348,18 +346,18 @@ class RangeExpression(object): def Eval(self, Operator, Oprand1, Oprand2 =3D None): =20 if Operator in ["!", "NOT", "not"]: - if not self.RegGuidPattern.match(Oprand1.strip()): + if not gGuidPattern.match(Oprand1.strip()): raise BadExpression(ERR_STRING_EXPR % Operator) return self.NegtiveRange(Oprand1) else: if Operator in ["=3D=3D", ">=3D", "<=3D", ">", "<", '^']: return self.EvalRange(Operator, Oprand1) elif Operator =3D=3D 'and' : - if not self.ExRegGuidPattern.match(Oprand1.strip()) or not= self.ExRegGuidPattern.match(Oprand2.strip()): + if not gGuidPatternEnd.match(Oprand1.strip()) or not gGuid= PatternEnd.match(Oprand2.strip()): raise BadExpression(ERR_STRING_EXPR % Operator) return self.Rangeintersection(Oprand1, Oprand2) =20 elif Operator =3D=3D 'or': - if not self.ExRegGuidPattern.match(Oprand1.strip()) or not= self.ExRegGuidPattern.match(Oprand2.strip()): + if not gGuidPatternEnd.match(Oprand1.strip()) or not gGuid= PatternEnd.match(Oprand2.strip()): raise BadExpression(ERR_STRING_EXPR % Operator) return self.Rangecollections(Oprand1, Oprand2) else: @@ -417,7 +415,7 @@ class RangeExpression(object): # check if the expression does not need to evaluate if RealValue and Depth =3D=3D 0: self._Token =3D self._Expr - if self.ExRegGuidPattern.match(self._Expr): + if gGuidPatternEnd.match(self._Expr): return [self.operanddict[self._Expr] ] =20 self._Idx =3D 0 @@ -664,7 +662,7 @@ class RangeExpression(object): self._Token =3D '' if Expr: Ch =3D Expr[0] - Match =3D self.RegGuidPattern.match(Expr) + Match =3D gGuidPattern.match(Expr) if Match and not Expr[Match.end():Match.end() + 1].isalnum() \ and Expr[Match.end():Match.end() + 1] !=3D '_': self._Idx +=3D Match.end() diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index 03183e398bdb..b8be1251ef52 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -1150,8 +1150,7 @@ class FdfParser: =20 if not self.__GetNextToken(): return False - p =3D re.compile('[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-= fA-F0-9]{4}-[a-fA-F0-9]{12}') - if p.match(self.__Token) !=3D None: + if gGuidPattern.match(self.__Token) !=3D None: return True else: self.__UndoToken() --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed May 1 03:12:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1521242885185581.6852030774834; Fri, 16 Mar 2018 16:28:05 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A8F5F22571B33; Fri, 16 Mar 2018 16:21:27 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0BABB2246803D for ; Fri, 16 Mar 2018 16:21:24 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Mar 2018 16:27:49 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 16 Mar 2018 16:27:48 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,318,1517904000"; d="scan'208";a="39650833" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 16 Mar 2018 16:27:42 -0700 Message-Id: <8f8a78774a56bc5797ab05dacdcce33cd48f6ad9.1521242771.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 5/9] BaseTools: Regular Expressions refactor out the hex char for later reuse X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" move hex character info from GUID expressions into seperate variable to fac= ilitate reuse. Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Common/GlobalData.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Sourc= e/Python/Common/GlobalData.py index 4a85a8e0db63..4d0833a55b52 100644 --- a/BaseTools/Source/Python/Common/GlobalData.py +++ b/BaseTools/Source/Python/Common/GlobalData.py @@ -52,7 +52,8 @@ gMacroDefPattern =3D re.compile("^(DEFINE|EDK_GLOBAL)[ \t= ]+") gMacroNamePattern =3D re.compile("^{}$".format(_MacroNamePattern)) =20 # definition for a GUID. used to create regular expressions below. -_GuidPattern =3D r"[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F= ]{4}-[0-9a-fA-F]{12}" +_HexChar =3D r"[0-9a-fA-F]" +_GuidPattern =3D r"{Hex}{8}-{Hex}{4}-{Hex}{4}-{Hex}{4}-{Hex}{12}".format(H= ex=3D_HexChar) =20 ## Regular expressions for GUID matching gGuidPattern =3D re.compile(r'{}'.format(_GuidPattern)) --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed May 1 03:12:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1521242887827994.6050115094187; Fri, 16 Mar 2018 16:28:07 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 04F9D22571B39; Fri, 16 Mar 2018 16:21:28 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3211A22489C93 for ; Fri, 16 Mar 2018 16:21:24 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Mar 2018 16:27:49 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 16 Mar 2018 16:27:48 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,318,1517904000"; d="scan'208";a="39650839" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 16 Mar 2018 16:27:43 -0700 Message-Id: <961f7c841f117e8bea1f8d3415f96a15ae9b0fd6.1521242771.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 6/9] BaseTools: Add new RegExp for future use X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add a precompiled RegExp for 4 hex chars. Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Common/GlobalData.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Sourc= e/Python/Common/GlobalData.py index 4d0833a55b52..972ae3e2253c 100644 --- a/BaseTools/Source/Python/Common/GlobalData.py +++ b/BaseTools/Source/Python/Common/GlobalData.py @@ -59,6 +59,8 @@ _GuidPattern =3D r"{Hex}{8}-{Hex}{4}-{Hex}{4}-{Hex}{4}-{H= ex}{12}".format(Hex=3D_HexC gGuidPattern =3D re.compile(r'{}'.format(_GuidPattern)) gGuidPatternEnd =3D re.compile(r'{}$'.format(_GuidPattern)) =20 +g4HexChar =3D re.compile(r'{}{4}'.format(_HexChar)) + # # A global variable for whether current build in AutoGen phase or not. # --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed May 1 03:12:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1521242890329475.190915142936; Fri, 16 Mar 2018 16:28:10 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 656D122489CA9; Fri, 16 Mar 2018 16:21:28 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2ACA322489C92 for ; Fri, 16 Mar 2018 16:21:24 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Mar 2018 16:27:49 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 16 Mar 2018 16:27:48 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,318,1517904000"; d="scan'208";a="39650842" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 16 Mar 2018 16:27:44 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 7/9] BaseTools: Use precompiled RegExp X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" avoid recompiling the regular expression for each use in a while loop Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/UniClassObject.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/= Source/Python/AutoGen/UniClassObject.py index 856d19cda270..5c653f58e4ff 100644 --- a/BaseTools/Source/Python/AutoGen/UniClassObject.py +++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py @@ -436,11 +436,11 @@ class UniFileClassObject(object): while (StartPos !=3D -1): EndPos =3D Line.find(u'\\', StartPos + 1, StartPos + 7) if EndPos !=3D -1 and EndPos - StartPos =3D=3D 6 : - if re.match('[a-fA-F0-9]{4}', Line[StartPos + 2 : EndP= os], re.UNICODE): + if g4HexChar.match(Line[StartPos + 2 : EndPos], re.UNI= CODE): EndStr =3D Line[EndPos: ] UniStr =3D ('\u' + (Line[StartPos + 2 : EndPos])).= decode('unicode_escape') if EndStr.startswith(u'\\x') and len(EndStr) >=3D = 7: - if EndStr[6] =3D=3D u'\\' and re.match('[a-fA-= F0-9]{4}', EndStr[2 : 6], re.UNICODE): + if EndStr[6] =3D=3D u'\\' and g4HexChar.match(= EndStr[2 : 6], re.UNICODE): Line =3D Line[0 : StartPos] + UniStr + End= Str else: Line =3D Line[0 : StartPos] + UniStr + EndStr[= 1:] --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed May 1 03:12:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 152124289463699.17964437456124; Fri, 16 Mar 2018 16:28:14 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 222D822571B42; Fri, 16 Mar 2018 16:21:29 -0700 (PDT) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5E2B422489CB9 for ; Fri, 16 Mar 2018 16:21:24 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Mar 2018 16:27:49 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 16 Mar 2018 16:27:48 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,318,1517904000"; d="scan'208";a="39650845" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 16 Mar 2018 16:27:45 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 8/9] BaseTools: GlobalData Add a regular expression for a hex number X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" add a shared precompiled regular expression Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Common/GlobalData.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Sourc= e/Python/Common/GlobalData.py index 972ae3e2253c..eb1626bc151b 100644 --- a/BaseTools/Source/Python/Common/GlobalData.py +++ b/BaseTools/Source/Python/Common/GlobalData.py @@ -59,7 +59,9 @@ _GuidPattern =3D r"{Hex}{8}-{Hex}{4}-{Hex}{4}-{Hex}{4}-{H= ex}{12}".format(Hex=3D_HexC gGuidPattern =3D re.compile(r'{}'.format(_GuidPattern)) gGuidPatternEnd =3D re.compile(r'{}$'.format(_GuidPattern)) =20 +## Regular expressions for HEX matching g4HexChar =3D re.compile(r'{}{4}'.format(_HexChar)) +gHexPattern =3D re.compile(r'0[xX]{}+'.format(_HexChar)) =20 # # A global variable for whether current build in AutoGen phase or not. --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed May 1 03:12:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1521242892401214.09980946769883; Fri, 16 Mar 2018 16:28:12 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C01F422571B3D; Fri, 16 Mar 2018 16:21:28 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5217F22489CB0 for ; Fri, 16 Mar 2018 16:21:24 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Mar 2018 16:27:49 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 16 Mar 2018 16:27:48 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,318,1517904000"; d="scan'208";a="39650848" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 16 Mar 2018 16:27:46 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 9/9] BaseTools: remove local hex number regular expression X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Change to using the new shared hex number regular expression Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Common/Expression.py | 3 +-- BaseTools/Source/Python/Common/RangeExpression.py | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Sourc= e/Python/Common/Expression.py index c69c3cb1e84a..43ef586050e7 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -219,7 +219,6 @@ class ValueExpression(object): NonLetterOpLst =3D ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<',= '>>', '!', '=3D', '>', '<', '?', ':'] =20 PcdPattern =3D re.compile(r'[_a-zA-Z][0-9A-Za-z_]*\.[_a-zA-Z][0-9A-Za-= z_]*$') - HexPattern =3D re.compile(r'0[xX][0-9a-fA-F]+$') =20 SymbolPattern =3D re.compile("(" "\$\([A-Z][A-Z0-9_]*\)|\$\(\w+\.\w+\)|\w+= \.\w+|" @@ -671,7 +670,7 @@ class ValueExpression(object): self._LiteralToken.endswith('}'): return True =20 - if self.HexPattern.match(self._LiteralToken): + if gHexPattern.match(self._LiteralToken): Token =3D self._LiteralToken[2:] if not Token: self._LiteralToken =3D '0x0' diff --git a/BaseTools/Source/Python/Common/RangeExpression.py b/BaseTools/= Source/Python/Common/RangeExpression.py index bbcbd6b767e0..2fdb99688557 100644 --- a/BaseTools/Source/Python/Common/RangeExpression.py +++ b/BaseTools/Source/Python/Common/RangeExpression.py @@ -210,7 +210,6 @@ class RangeExpression(object): NonLetterOpLst =3D ['+', '-', '&', '|', '^', '!', '=3D', '>', '<'] =20 PcdPattern =3D re.compile(r'[_a-zA-Z][0-9A-Za-z_]*\.[_a-zA-Z][0-9A-Za-= z_]*$') - HexPattern =3D re.compile(r'0[xX][0-9a-fA-F]+') =20 SymbolPattern =3D re.compile("(" "\$\([A-Z][A-Z0-9_]*\)|\$\(\w+\.\w+\)|\w+= \.\w+|" @@ -226,7 +225,7 @@ class RangeExpression(object): # convert interval to object index. ex. 1 - 10 to a GUID expr =3D expr.strip() NumberDict =3D {} - for HexNumber in self.HexPattern.findall(expr): + for HexNumber in gHexPattern.findall(expr): Number =3D str(int(HexNumber, 16)) NumberDict[HexNumber] =3D Number for HexNum in NumberDict: @@ -631,7 +630,7 @@ class RangeExpression(object): self._LiteralToken.endswith('}'): return True =20 - if self.HexPattern.match(self._LiteralToken): + if gHexPattern.match(self._LiteralToken): Token =3D self._LiteralToken[2:] Token =3D Token.lstrip('0') if not Token: --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel