From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (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 199EB21157421 for ; Tue, 25 Sep 2018 06:45:04 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Sep 2018 06:45:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,302,1534834800"; d="scan'208";a="265563747" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga005.fm.intel.com with ESMTP; 25 Sep 2018 06:45:04 -0700 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 25 Sep 2018 06:45:03 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 25 Sep 2018 06:45:03 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.220]) by shsmsx102.ccr.corp.intel.com ([169.254.2.140]) with mapi id 14.03.0319.002; Tue, 25 Sep 2018 21:45:01 +0800 From: "Feng, Bob C" To: "Carsey, Jaben" , "edk2-devel@lists.01.org" CC: "Zhu, Yonghong" , "Gao, Liming" Thread-Topic: [PATCH v1 7/7] BaseTools/GenFds: create and use new variable in FdfParser Thread-Index: AQHUVBMkxIuhMjMW4UuNowtaASpJr6UBA3sQ Date: Tue, 25 Sep 2018 13:45:00 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D155514BA3@SHSMSX101.ccr.corp.intel.com> References: <85eb337312ca224aa98c9963e42b9d347f3cc2eb.1537799017.git.jaben.carsey@intel.com> In-Reply-To: <85eb337312ca224aa98c9963e42b9d347f3cc2eb.1537799017.git.jaben.carsey@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNmYxMGYyOTMtMWEzNy00MDY1LWIxYTEtZjllNzcwNTcyOGIzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiRVMzcHVTeDJsVjdqY1wvMUlxMDZOVjV5U2ROT3p2cVhpUEc5UVVQMVBYS3U1XC9uZ3pUd3R4MElEbEdjcDF3UGltIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v1 7/7] BaseTools/GenFds: create and use new variable in FdfParser X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2018 13:45:05 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bob Feng -----Original Message----- From: Carsey, Jaben=20 Sent: Monday, September 24, 2018 10:28 PM To: edk2-devel@lists.01.org Cc: Feng, Bob C ; Zhu, Yonghong ; Gao, Liming Subject: [PATCH v1 7/7] BaseTools/GenFds: create and use new variable in Fd= fParser replace lots of '}' and "}" with a shared new consistent variable. Cc: Bob Feng Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/GenFds/FdfParser.py | 45 ++++++++++---------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index f6b79764b2a0..bd3e8f5b8fb7 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -64,8 +64,9 @@ T_CHAR_TAB =3D '\t' T_CHAR_DOUBLE_QUOTE =3D '\"' T_CHAR_SINGLE_QUOTE =3D '\'' T_CHAR_STAR =3D '*' +T_CHAR_BRACE_R =3D '}' =20 -SEPARATORS =3D {TAB_EQUAL_SPLIT, TAB_VALUE_SPLIT, TAB_COMMA_SPLIT, '{', '}= '} +SEPARATORS =3D {TAB_EQUAL_SPLIT, TAB_VALUE_SPLIT, TAB_COMMA_SPLIT, '{',=20 +T_CHAR_BRACE_R} ALIGNMENTS =3D {"Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "= 32K", "64K", "128K", "256K", "512K", "1M", "2M", "4M", "8M"= , "16M"} ALIGNMENT_NOAUTO =3D ALIGNMENTS - {"Auto"} @@ -2020,7 +2021,7 @@ = class FdfParser: DataString +=3D self._Token DataString +=3D TAB_COMMA_SPLIT =20 - if not self._IsToken("}"): + if not self._IsToken(T_CHAR_BRACE_R): raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLi= neNumber) =20 DataString =3D DataString.rstrip(TAB_COMMA_SPLIT) @@ -2060,7 +2061,7 @@ class FdfParser: DataString +=3D self._Token DataString +=3D TAB_COMMA_SPLIT =20 - if not self._IsToken("}"): + if not self._IsToken(T_CHAR_BRACE_R): raise Warning.ExpectedCurlyClose(self.FileName, self.Curre= ntLineNumber) =20 DataString =3D DataString.rstrip(TAB_COMMA_SPLIT) @@ -2328,10 +2329,10 @@ class FdfParser: DataString +=3D self._Token DataString +=3D TAB_COMMA_SPLIT =20 - if not self._IsToken("}"): + if not self._IsToken(T_CHAR_BRACE_R): raise Warning.ExpectedCurlyClose(self.FileName, self.Curre= ntLineNumber) =20 - if not self._IsToken("}"): + if not self._IsToken(T_CHAR_BRACE_R): raise Warning.ExpectedCurlyClose(self.FileName, self.Curre= ntLineNumber) =20 DataString =3D DataString.rstrip(TAB_COMMA_SPLIT) @@ -2346,7 +2347,7 @@ class FdfParser: =20 FvObj.FvExtEntryData.append(self._Token) =20 - if not self._IsToken("}"): + if not self._IsToken(T_CHAR_BRACE_R): raise Warning.ExpectedCurlyClose(self.FileName, self.Curre= ntLineNumber) =20 return True @@ -2382,7 +2383,7 @@ class FdfParser: if not IsInf and not IsFile: break =20 - if not self._IsToken("}"): + if not self._IsToken(T_CHAR_BRACE_R): raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLi= neNumber) =20 FvObj.AprioriSectionList.append(AprSectionObj) @@ -2657,7 +2658,7 @@ class FdfParser: FfsFileObj.FileName =3D self._Token.replace('$(SPACE)', ' ') self._VerifyFile(FfsFileObj.FileName) =20 - if not self._IsToken("}"): + if not self._IsToken(T_CHAR_BRACE_R): raise Warning.ExpectedCurlyClose(self.FileName, self.CurrentLi= neNumber) =20 ## _GetRAWData() method @@ -2682,7 +2683,7 @@ class FdfParser: raise Warning.Expected("Filename value", self.FileName, se= lf.CurrentLineNumber) =20 FileName =3D self._Token.replace('$(SPACE)', ' ') - if FileName =3D=3D '}': + if FileName =3D=3D T_CHAR_BRACE_R: self._UndoToken() raise Warning.Expected("Filename value", self.FileName, se= lf.CurrentLineNumber) =20 @@ -2691,7 +2692,7 @@ class FdfParser: FfsFileObj.FileName.append(File.Path) FfsFileObj.SubAlignment.append(AlignValue) =20 - if self._IsToken("}"): + if self._IsToken(T_CHAR_BRACE_R): self._UndoToken() break =20 @@ -2863,7 +2864,7 @@ class FdfParser: if not IsInf and not IsFile: break =20 - if not self._IsToken("}"): + if not self._IsToken(T_CHAR_BRACE_R): raise Warning.ExpectedCurlyClose(self.FileName, self.C= urrentLineNumber) =20 FvImageSectionObj =3D FvImageSection() @@ -2888,10 +2889,10 @@= class FdfParser: raise Warning.ExpectedEquals(self.FileName, self.CurrentLi= neNumber) if not self._IsToken("{"): raise Warning.ExpectedCurlyOpen(self.FileName, self.Curren= tLineNumber) - if not self._SkipToToken("}"): + if not self._SkipToToken(T_CHAR_BRACE_R): raise Warning.Expected("Depex expression ending '}'", self= .FileName, self.CurrentLineNumber) =20 - DepexSectionObj.Expression =3D self._SkippedChars.rstrip('}') + DepexSectionObj.Expression =3D=20 + self._SkippedChars.rstrip(T_CHAR_BRACE_R) Obj.SectionList.append(DepexSectionObj) =20 else: @@ -2982,7 +2983,7 @@ class FdfParser: break =20 =20 - if not self._IsToken("}"): + if not self._IsToken(T_CHAR_BRACE_R): raise Warning.ExpectedCurlyClose(self.FileName, self.Curre= ntLineNumber) Obj.SectionList.append(CompressSectionObj) return True @@ -3009,7 +3010,7 @@ class FdfParser: if not IsLeafSection and not IsEncapSection: break =20 - if not self._IsToken("}"): + if not self._IsToken(T_CHAR_BRACE_R): raise Warning.ExpectedCurlyClose(self.FileName, self.Curre= ntLineNumber) Obj.SectionList.append(GuidSectionObj) =20 @@ -3687,7 +3688,7 @@ class FdfParser: if not IsEncapsulate and not IsLeaf: break =20 - if not self._IsToken("}"): + if not self._IsToken(T_CHAR_BRACE_R): raise Warning.ExpectedCurlyClose(self.FileName, self.Curre= ntLineNumber) =20 return NewRule @@ -3786,7 +3787,7 @@ class FdfParser: if not IsInf and not IsFile: break =20 - if not self._IsToken("}"): + if not self._IsToken(T_CHAR_BRACE_R): raise Warning.ExpectedCurlyClose(self.FileName, self.C= urrentLineNumber) FvImageSectionObj.Fv =3D FvObj FvImageSectionObj.FvName =3D None @@ -3805,7 +3806,7 @@ cl= ass FdfParser: FvImageSectionObj.FvFileExtension =3D self._GetFileExt= ension() elif self._GetNextToken(): if self._Token not in { - "}", "COMPAT16", BINARY_FILE_TYPE_PE32, + T_CHAR_BRACE_R, "COMPAT16",=20 + BINARY_FILE_TYPE_PE32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX, BINARY_FILE_TYPE_UI, "VERSION", @@ -3891,7 +38= 92,7 @@ class FdfParser: EfiSectionObj.FileExtension =3D self._GetFileExtension() elif self._GetNextToken(): if self._Token not in { - "}", "COMPAT16", BINARY_FILE_TYPE_PE32, + T_CHAR_BRACE_R, "COMPAT16", BINARY_FILE_TYPE_PE32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX, BINARY_FILE_TYPE_UI, "VERSION", @@ -4034,7 +4035,7 @@ = class FdfParser: if not IsEncapsulate and not IsLeaf: break =20 - if not self._IsToken("}"): + if not self._IsToken(T_CHAR_BRACE_R): raise Warning.ExpectedCurlyClose(self.FileName, self.Curre= ntLineNumber) theRule.SectionList.append(CompressSectionObj) =20 @@ -4066,7 +4067,7 @@ class FdfParser: if not IsEncapsulate and not IsLeaf: break =20 - if not self._IsToken("}"): + if not self._IsToken(T_CHAR_BRACE_R): raise Warning.ExpectedCurlyClose(self.FileName, self.Curre= ntLineNumber) theRule.SectionList.append(GuidSectionObj) =20 @@ -4412,7 +4413,7 @@ class FdfParser: Overrides.NeedCompress =3D self._Token.upper() =3D=3D = 'TRUE' continue =20 - if self._IsToken("}"): + if self._IsToken(T_CHAR_BRACE_R): break else: EdkLogger.error("FdfParser", FORMAT_INVALID, File=3Dse= lf.FileName, Line=3Dself.CurrentLineNumber) -- 2.16.2.windows.1