From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 548EA202E53E8 for ; Thu, 28 Jun 2018 13:48:20 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jun 2018 13:48:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,284,1526367600"; d="scan'208";a="67201002" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga004.fm.intel.com with ESMTP; 28 Jun 2018 13:48:20 -0700 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 28 Jun 2018 13:48:19 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.125]) by fmsmsx118.amr.corp.intel.com ([169.254.1.173]) with mapi id 14.03.0319.002; Thu, 28 Jun 2018 13:48:18 -0700 From: "Carsey, Jaben" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" CC: "Feng, YunhuaX" , "Gao, Liming" Thread-Topic: [edk2] [Patch V2] BaseTools: Fix parsing multiple nest !include issue Thread-Index: AQHUDqknM8AWrRk7akil2pWVODoCW6R2JRPQ Date: Thu, 28 Jun 2018 20:48:16 +0000 Message-ID: References: <1530167244-27416-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1530167244-27416-1-git-send-email-yonghong.zhu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTdiOGRjZjctZGM3NS00ZTNkLWExYTktMTMxNmZiNWJmYTNkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiUEJKUnM2bkQ4bzFJRjRxdWJVTmdXbU9LcjBGMEhES2Z1WDJacUV1QTNsZVFkN25EVWg3M29CZXdRSmlRQjdBcSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [10.1.200.108] MIME-Version: 1.0 Subject: Re: [Patch V2] BaseTools: Fix parsing multiple nest !include issue X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2018 20:48:20 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable If you change the raw string ("!INCLUDE) to use the one defined in DataType= .py (TAB_INCLUDE), then I like it. Note that you will need to lower() inst= ead of upper() to support this change. Reviewed-by: Jaben Carsey > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Yonghong Zhu > Sent: Wednesday, June 27, 2018 11:27 PM > To: edk2-devel@lists.01.org > Cc: Feng, YunhuaX ; Gao, Liming > > Subject: [edk2] [Patch V2] BaseTools: Fix parsing multiple nest !include = issue >=20 > From: Yunhua Feng >=20 > Fix the bug !include file in Components subsection meet syntax error. >=20 > Case example: > DSC components: > !include Test1.txt >=20 > Test1.txt: > TestPkg/TestDriver.inf { > > PcdToken.PcdTest1 | "A" > !include Test2.txt > } >=20 > Test2.txt: > !include Test3.txt >=20 > Test3.txt: > PcdToken.PcdTest2 | "B" >=20 > Cc: Liming Gao > Cc: Yonghong Zhu > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Yunhua Feng > --- > .../Source/Python/Workspace/MetaFileParser.py | 28 ++++++++++------= -- > ---- > 1 file changed, 13 insertions(+), 15 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py > b/BaseTools/Source/Python/Workspace/MetaFileParser.py > index 8c860d594b..75ca630806 100644 > --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py > +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py > @@ -942,11 +942,18 @@ class DscParser(MetaFileParser): > # subsection header > elif Line[0] =3D=3D TAB_OPTION_START and Line[-1] =3D=3D TAB= _OPTION_END: > self._SubsectionType =3D MODEL_META_DATA_SUBSECTION_HEAD= ER > # directive line > elif Line[0] =3D=3D '!': > - self._DirectiveParser() > + TokenList =3D GetSplitValueList(Line, ' ', 1) > + if TokenList[0].upper() =3D=3D "!INCLUDE": > + for Arch, ModuleType, DefaultStore in self._Scope: > + if self._SubsectionType !=3D MODEL_UNKNOWN and A= rch in > OwnerId: > + self._Owner[-1] =3D OwnerId[Arch] > + self._DirectiveParser() > + else: > + self._DirectiveParser() > continue > if Line[0] =3D=3D TAB_OPTION_START and not self._InSubsectio= n: > EdkLogger.error("Parser", FILE_READ_FAILURE, "Missing th= e '{' > before %s in Line %s" % (Line, Index+1), ExtraData=3Dself.MetaFile) >=20 > if self._InSubsection: > @@ -963,11 +970,11 @@ class DscParser(MetaFileParser): > # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsTo= Item=3D- > 1, BelongsToFile=3D-1, > # LineBegin=3D-1, ColumnBegin=3D-1, LineEnd=3D-1, ColumnEnd= =3D-1, > Enabled=3D-1 > # > for Arch, ModuleType, DefaultStore in self._Scope: > Owner =3D self._Owner[-1] > - if self._SubsectionType !=3D MODEL_UNKNOWN: > + if self._SubsectionType !=3D MODEL_UNKNOWN and Arch in > OwnerId: > Owner =3D OwnerId[Arch] > self._LastItem =3D self._Store( > self._ItemType, > self._ValueList[0], > self._ValueList[1], > @@ -1188,10 +1195,11 @@ class DscParser(MetaFileParser): > @ParseMacro > def _ComponentParser(self): > if self._CurrentLine[-1] =3D=3D '{': > self._ValueList[0] =3D self._CurrentLine[0:-1].strip() > self._InSubsection =3D True > + self._SubsectionType =3D MODEL_UNKNOWN > else: > self._ValueList[0] =3D self._CurrentLine >=20 > ## [LibraryClasses] section > @ParseMacro > @@ -1560,28 +1568,18 @@ class DscParser(MetaFileParser): >=20 > self.IncludedFiles.add (IncludedFile1) >=20 > # set the parser status with current status > Parser._SectionName =3D self._SectionName > - if self._InSubsection: > - Parser._SectionType =3D self._SubsectionType > - else: > - Parser._SectionType =3D self._SectionType > + Parser._SubsectionType =3D self._SubsectionType > + Parser._InSubsection =3D self._InSubsection > + Parser._SectionType =3D self._SectionType > Parser._Scope =3D self._Scope > Parser._Enabled =3D self._Enabled > # Parse the included file > Parser.Start() >=20 > - # update current status with sub-parser's status > - self._SectionName =3D Parser._SectionName > - if not self._InSubsection: > - self._SectionType =3D Parser._SectionType > - self._SubsectionType =3D Parser._SubsectionType > - self._InSubsection =3D Parser._InSubsection > - > - self._Scope =3D Parser._Scope > - self._Enabled =3D Parser._Enabled >=20 > # Insert all records in the table for the included file into= dsc file table > Records =3D IncludedFileTable.GetAll() > if Records: > self._Content[self._ContentIndex:self._ContentIndex] =3D= Records > -- > 2.12.2.windows.2 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel