From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.107]) by mx.groups.io with SMTP id smtpd.web08.3100.1617295408279767470 for ; Thu, 01 Apr 2021 09:43:28 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=Nr/4afau; spf=pass (domain: microsoft.com, ip: 40.107.93.107, mailfrom: bret.barkelew@microsoft.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MIqxoFtGg+vH7J8ruUVBsklUE8jIgKiVwR8VYOMt4h+1Agl04U+eVuFv3cXZDugm9yBM1g/CxUoUGIInQv6Ag75RYBMgTbM0AeyivwrqKQuR525cvyGcNI80wWNAlYy7DtXInpxM6JoQdXFay/GQ+mYbAnBMhCTFc6Y/m8DzJpVQMEJdR4AKxnvCEBtwGNQwJFUBhmgVWVIg7bqGtFkWRVtWTd5OkXTrmyEwZNbUHQlBckToe56xcqJ/O4r+xP69RqM6pa/DLHQcmM61wurj9ljf+eB0GS7jUvNMTkNxoNMsUYhELtl3kvmlVpCbrZ/Og0TuyMJqGjUqE3l6FJNzBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o6Iwo/psOjXq2WIG7dyg0sJfZQkxTmoTsZweWUksDCA=; b=ZUEfrarrMWDvqxB/JwD/J/vuLhdYJ42X+JJef4KzkZTwmOrfcpDWMmfu8NdsWMfpCT8rDJ+nfgjcsASWrKfrqHTBvU1fF95uyHAT+0emMDPA2v0sI1o0wLEFr2VAT0p3YWHcftKP6mWTGMvFoz9qPKRWwlfsUJO5Vlity0ssZqHtPuScKZjrmz+UL7o3elnPh8RtgHN8EmlEtp1+bAyVvHaHwW+CUr73sW9a1dwjj9dszdSAtbYYDsy3axziBhy3UZHA73kuZaHm/be8JzaZmpRRglEXnXrMrw2rqphSo3bAC0chDcW6z6Ei7SMTljj7q6aSdh0PcpkR4ZGg4boNGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o6Iwo/psOjXq2WIG7dyg0sJfZQkxTmoTsZweWUksDCA=; b=Nr/4afauL5ONPjtf7SZcmVBwkYQTwC0ffrErmYF3Ox4S4R7O7AvxJP/SS4jHRF6zeM7pRc3UtibFWKIE6Jpjh7ox9KGdrF9M8iafZ/bLB6lmt+Mhti1FSXrtkMLNN0/n8Qytq0nyvYhsraHeDgmo5WVLGMVDCLoh6OeqFUIxntY= Received: from MW4PR21MB1907.namprd21.prod.outlook.com (2603:10b6:303:71::8) by MW4PR21MB1857.namprd21.prod.outlook.com (2603:10b6:303:74::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.0; Thu, 1 Apr 2021 16:43:23 +0000 Received: from MW4PR21MB1907.namprd21.prod.outlook.com ([fe80::adcb:b821:ee26:3348]) by MW4PR21MB1907.namprd21.prod.outlook.com ([fe80::adcb:b821:ee26:3348%8]) with mapi id 15.20.4020.009; Thu, 1 Apr 2021 16:43:23 +0000 From: "Bret Barkelew" To: "devel@edk2.groups.io" , "Chen, Yuwei" CC: mliang2x , "Feng, Bob C" , Liming Gao Subject: Re: [EXTERNAL] [edk2-devel] [PATCH 1/1] BaseTools/Ecc: Update structpcd parsing method. Thread-Topic: [EXTERNAL] [edk2-devel] [PATCH 1/1] BaseTools/Ecc: Update structpcd parsing method. Thread-Index: AQHXJsUz2RCERSIT3kaLyOYWA1O7NKqf3qVH Date: Thu, 1 Apr 2021 16:43:23 +0000 Message-ID: References: <20210401070352.1743-1-yuwei.chen@intel.com> In-Reply-To: <20210401070352.1743-1-yuwei.chen@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2021-04-01T16:43:07.3182999Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Privileged authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [71.212.153.143] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0812d0c7-a2c2-42d9-bca1-08d8f52d43b6 x-ms-traffictypediagnostic: MW4PR21MB1857: x-ld-processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:651; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ku7EdMy/vawgykn9RiK5gnMrpooFGO2s5Pf8kwpx8RpP7S64CzLIB4jEzQ6+2QtZZx7hGO9KPjlPTCzDlpgBJ0VyraZIL+JdPNGl8ge4faVuxHL5wSgmrkOXtdRdUZXgXCRD+JUJWqWu2lVwu8YIWUL2Mhet9+TFbYSTUmGavt0PiXVzxIo5VGWRZHtHRngQ5ZcOvzfHPONO5GC2SkRwUTu6fShqZoF7AVGi0xiSbMLsxv+0WKM9vQrWOtuaWWktq8CM7eOIbClGpo4aatmz4pR2ffAVnXkrRgWrjcQ/FWuiRAQKK+Ce25IiJ/0i93Y0MSIKZfkVXb1UTNszTvBzHzRHgQ09Jo6HujaJ7g1tCn0t+6MSNQSt1r0ZXk/itnLhIaa6qY6MATsMKPEJE4ueYV2APlGyQrHxMlCltF6CYD6SaiVM0XXeCOsuOqjCz5qxD+U9GDqgbJ3RdO/UgoyG2ieX9sWqbBV+b6oRwsrQSf13uGJnZUveOt8/V92mJiPElUf6ZDtdrjSdSjns6TwF+jRZWl9qOwVo+TNKP6dG10NxYp/lnNGbT33vKtyrEpQPybfbBI5y3MXzUZUAZFdk6Zs042Jrc6Bx1FcOquLvCBCU0R+bLEnz86Cl91M3ywro2NaJ75emA1YzKwf3lT2dOZqCbw6Rbf7fIAAXaG1z6+61bbfpfcH5njq0e5MMXzE6X9OsnncF0WPI8tI7wdk75sQUB1YZi3UVpvrTLlFO1qk= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR21MB1907.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(366004)(396003)(346002)(39860400002)(136003)(26005)(71200400001)(53546011)(6506007)(33656002)(186003)(166002)(83380400001)(966005)(38100700001)(7696005)(54906003)(110136005)(316002)(66446008)(66946007)(66476007)(66556008)(86362001)(64756008)(76116006)(30864003)(52536014)(82960400001)(5660300002)(82950400001)(8676002)(55016002)(9686003)(15650500001)(8936002)(8990500004)(4326008)(478600001)(10290500003)(2906002)(559001)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?Windows-1252?Q?FvMjW8StXPOnHQHks+rR8w5GmUSm/AB07XUe9yQ2Id7j4/ygxnPzL5On?= =?Windows-1252?Q?3xKBCDF6vkSIFfxsMPcF/QArdnKmWWkoZ1tXkAWNmM8JBUHLuZHprK9/?= =?Windows-1252?Q?fyjLdGXSyzv0PoeXZSK2b1kHbaLuNA/YEqDByhO/LB073BGshl+cEyn9?= =?Windows-1252?Q?N35Fg5EiXZ8C9EXEqDyjvhfERZvSL5Hin578MXuei4nvmb3wqNEbX05t?= =?Windows-1252?Q?LWJDQC7hnokIRi0fSNEx2p/LZFVHkY5nLul5i1jw/y8HXxvmtUYmpe3G?= =?Windows-1252?Q?wofCdAJ0zHiFva/dQ8Qnb8m/72cKz/i4oTqJdYwsqiLGkmR1xcxAKtiM?= =?Windows-1252?Q?ANZiRGgBOc8jWzoCBvG80o9XSmCnNkgM7n8xpDngn6IvQf56TmhRDWiO?= =?Windows-1252?Q?oVCpNmvduIA9VMuHY/urEMT4XYL3KOEUJ/et5e5ZSyGpifhm15FykoXp?= =?Windows-1252?Q?dyuoYPTaCScffJXDB+ONo39clnZhjdhzwEZyz3YvB/OWP8NDNwayexGu?= =?Windows-1252?Q?gtxaIb1hZdEDw/VYYyGGrvz5IfoHjPrIwy+QWfX+nMaa48BUmlhcl7hX?= =?Windows-1252?Q?+utJnIZ5+nk2n7nI2VFmy6hfOjokkbGtYHKM2RVlYnuajE4Fjt54WItM?= =?Windows-1252?Q?AvlfiLj/Y0e86+lLaLZacERL7M6PmUurhW/xKUfiMzlOD5u8iPxPrO7n?= =?Windows-1252?Q?yA9AeqVZ7vU4rfbWu9AuMsIAv1U3PiA3+ISweXuj+98KNA9hBsJq3X3i?= =?Windows-1252?Q?W5TNc7/EraLCna5s1Uib8SzRl2WC1BxVejWtQX4BvKEFRKOpeVwXAmEh?= =?Windows-1252?Q?vPeqwXbOnIT9Dr4w3h7OLX6Qz5ncoLGL4WYpzeLWDoC+Y/asuV3zieKK?= =?Windows-1252?Q?kcvfag7pdKrae42dkHM68ckLQ6b28pWSX3uBcsPPyVLyXEijUBiGN4og?= =?Windows-1252?Q?ai1OjGRefPCryuP6vG/GY18vtW8sBgvlVr8SZj8ntVkCCwvC7hqIq4hZ?= =?Windows-1252?Q?WB9fi8fEa57rwcwx01Au/UvKxdDMB8czS5y8+6hwkP4Fl4lbuP31ls0O?= =?Windows-1252?Q?CBXFmGxs0jssBoavjELMJv9mHLa+xJ69tgQUnvsQJ4J6+84dTIEDaEOp?= =?Windows-1252?Q?yIyIF3MYd8yWsajXhrsvJL7qrc4dZTII0/9Dh9WMVMKdq9cmKLtvlZxw?= =?Windows-1252?Q?gDH5BHgz+qXGUZCnuqlLUg9huzdrm1ADcO2A+z+iEJHLa4/Qdpcxscx2?= =?Windows-1252?Q?8SoM7c12xVQ+UEHnZf0wwssV6lHO82skUhHsVqs6Gm6zaEXYEKqJQUjf?= =?Windows-1252?Q?iBIhPgwiAesi6iXBiv3R6HkqRTe7Uyb5MpHzLwooLFVrfocB4lxWSHBV?= =?Windows-1252?Q?UjTuEMrRnBYSNPZaK/xJgCY/mfvz+8WSXROsJUametViCqIR9cZOMx4e?= =?Windows-1252?Q?DmCH9cZLyd4poElmN8FUjA=3D=3D?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR21MB1907.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0812d0c7-a2c2-42d9-bca1-08d8f52d43b6 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Apr 2021 16:43:23.0690 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: PQm3+7qmxwQcWDXNG0/nYM1r/aNcOyl3MTHBawFRUK2z7apm77hYy6EyMwOz471QgX/CMN+KQYnTSQdLSqRtJw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR21MB1857 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MW4PR21MB190714F1689BD80D7A8D8BFEEF7B9MW4PR21MB1907namp_" --_000_MW4PR21MB190714F1689BD80D7A8D8BFEEF7B9MW4PR21MB1907namp_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable What does =93update=94 mean in this context? What behavior is changing? - Bret From: Yuwei Chen via groups.io Sent: Thursday, April 1, 2021 12:04 AM To: devel@edk2.groups.io Cc: mliang2x; Feng, Bob C; Liming Gao Subject: [EXTERNAL] [edk2-devel] [PATCH 1/1] BaseTools/Ecc: Update structp= cd parsing method. From: mliang2x Update the pcdparser method in Dec and DSC files. Signed-off-by: Mingyue Liang Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen --- .../Ecc/MetaFileWorkspace/MetaFileParser.py | 464 ++++++++++-------- 1 file changed, 265 insertions(+), 199 deletions(-) diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.= py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py index 9c27c8e16a05..588d3dbe6ed5 100644 --- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py @@ -22,7 +22,7 @@ import Ecc.EccToolError as EccToolError from CommonDataClass.DataClass import * from Common.DataType import * from Common.StringUtils import * -from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, P= athClass, AnalyzePcdData +from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, P= athClass, AnalyzePcdData, AnalyzeDscPcd, AnalyzePcdExpression, ParseFieldVa= lue, StructPattern from Common.Expression import * from CommonDataClass.Exceptions import * @@ -31,6 +31,8 @@ from GenFds.FdfParser import FdfParser from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import CodecOpenLongFilePath +CODEPattern =3D re.compile(r"{CODE\([a-fA-F0-9Xx\{\},\s]*\)}") + ## A decorator used to parse macro definition def ParseMacro(Parser): def MacroParser(self): @@ -174,6 +176,11 @@ class MetaFileParser(object): # UNI object and extra UNI object self._UniObj =3D None self._UniExtraObj =3D None + # StructPcd var + self._PcdCodeValue =3D "" + self._PcdDataTypeCODE =3D False + self._CurrentPcdName =3D "" + self._GuidDict =3D {} # for Parser PCD value {GUID(gTokeSpaceGui= dName)} ## Store the parsed data in table def _Store(self, *Args): @@ -395,6 +402,40 @@ class MetaFileParser(object): Macros.update(self._SectionsMacroDict[(self._SectionType,= Scope1, Scope2)]) return Macros + def ProcessMultipleLineCODEValue(self, Content): + CODEBegin =3D False + CODELine =3D "" + continuelinecount =3D 0 + newContent =3D [] + for Index in range(0, len(Content)): + Line =3D Content[Index] + if CODEBegin: + CODELine =3D CODELine + Line + continuelinecount +=3D1 + if ")}" in Line: + newContent.append(CODELine) + for _ in range(continuelinecount): + newContent.append("") + CODEBegin =3D False + CODELine =3D "" + continuelinecount =3D 0 + else: + if not Line: + newContent.append(Line) + continue + if "{CODE(" not in Line: + newContent.append(Line) + continue + elif CODEPattern.findall(Line): + newContent.append(Line) + continue + else: + CODEBegin =3D True + CODELine =3D Line + + return newContent + + _SectionParser =3D {} Finished =3D property(_GetFinished, _SetFinished) _Macros =3D property(_GetMacros) @@ -812,6 +853,8 @@ class DscParser(MetaFileParser): Content =3D open(str(self.MetaFile.Path), 'r').readlines() except: EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=3Dself= .MetaFile) + + Content =3D self.ProcessMultipleLineCODEValue(Content) # # Insert a record for file # @@ -1018,24 +1061,71 @@ class DscParser(MetaFileParser): # @ParseMacro def _PcdParser(self): + if self._PcdDataTypeCODE: + self._PcdCodeValue =3D self._PcdCodeValue + "\n " + self._Cur= rentLine + if self._CurrentLine.endswith(")}"): + self._CurrentLine =3D "|".join((self._CurrentPcdName, sel= f._PcdCodeValue)) + self._PcdDataTypeCODE =3D False + self._PcdCodeValue =3D "" + else: + self._ValueList =3D None + return TokenList =3D GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLI= T, 1) + self._CurrentPcdName =3D TokenList[0] + if len(TokenList) =3D=3D 2 and TokenList[1].strip().startswith("{= CODE"): + self._PcdDataTypeCODE =3D True + self._PcdCodeValue =3D TokenList[1].strip() + + if self._PcdDataTypeCODE: + if self._CurrentLine.endswith(")}"): + self._PcdDataTypeCODE =3D False + self._PcdCodeValue =3D "" + else: + self._ValueList =3D None + return self._ValueList[0:1] =3D GetSplitValueList(TokenList[0], TAB_SPLI= T) + PcdNameTockens =3D GetSplitValueList(TokenList[0], TAB_SPLIT) + if len(PcdNameTockens) =3D=3D 2: + self._ValueList[0], self._ValueList[1] =3D PcdNameTockens[0],= PcdNameTockens[1] + elif len(PcdNameTockens) =3D=3D 3: + self._ValueList[0], self._ValueList[1] =3D ".".join((PcdNameT= ockens[0], PcdNameTockens[1])), PcdNameTockens[2] + elif len(PcdNameTockens) > 3: + self._ValueList[0], self._ValueList[1] =3D ".".join((PcdNameT= ockens[0], PcdNameTockens[1])), ".".join(PcdNameTockens[2:]) if len(TokenList) =3D=3D 2: self._ValueList[2] =3D TokenList[1] if self._ValueList[0] =3D=3D '' or self._ValueList[1] =3D=3D '': EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUI= D or PCD name specified", ExtraData=3Dself._CurrentLine + " (.|)", - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) + File=3Dself.MetaFile, Line=3Dself._LineIndex = + 1) if self._ValueList[2] =3D=3D '': + # + # The PCD values are optional for FIXEDATBUILD, PATCHABLEINMO= DULE, Dynamic/DynamicEx default + # + if self._SectionType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_= PATCHABLE_IN_MODULE, MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAUL= T): + return EdkLogger.error('Parser', FORMAT_INVALID, "No PCD value given= ", ExtraData=3Dself._CurrentLine + " (.|)", - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) + File=3Dself.MetaFile, Line=3Dself._LineIndex = + 1) + + # Validate the datum type of Dynamic Defaul PCD and DynamicEx Def= ault PCD + ValueList =3D GetSplitValueList(self._ValueList[2]) + if len(ValueList) > 1 and ValueList[1] in [TAB_UINT8, TAB_UINT16,= TAB_UINT32, TAB_UINT64] \ + and self._ItemType in [MODEL_PCD_DYNAMIC_DE= FAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT]: + EdkLogger.error('Parser', FORMAT_INVALID, "The datum type '%s= ' of PCD is wrong" % ValueList[1], + ExtraData=3Dself._CurrentLine, File=3Dself.Me= taFile, Line=3Dself._LineIndex + 1) + + # Validate the VariableName of DynamicHii and DynamicExHii for PC= D Entry must not be an empty string + if self._ItemType in [MODEL_PCD_DYNAMIC_HII, MODEL_PCD_DYNAMIC_EX= _HII]: + DscPcdValueList =3D GetSplitValueList(TokenList[1], TAB_VALUE= _SPLIT, 1) + if len(DscPcdValueList[0].replace('L', '').replace('"', '').s= trip()) =3D=3D 0: + EdkLogger.error('Parser', FORMAT_INVALID, "The VariableNa= me field in the HII format PCD entry must not be an empty string", + ExtraData=3Dself._CurrentLine, File=3Dself.Me= taFile, Line=3Dself._LineIndex + 1) # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE= ', replace with integer 1 or 0. DscPcdValueList =3D GetSplitValueList(TokenList[1], TAB_VALUE_SPL= IT, 1) if DscPcdValueList[0] in ['True', 'true', 'TRUE']: - self._ValueList[2] =3D TokenList[1].replace(DscPcdValueList[0= ], '1', 1); + self._ValueList[2] =3D TokenList[1].replace(DscPcdValueList[0= ], '1', 1) elif DscPcdValueList[0] in ['False', 'false', 'FALSE']: - self._ValueList[2] =3D TokenList[1].replace(DscPcdValueList[0= ], '0', 1); + self._ValueList[2] =3D TokenList[1].replace(DscPcdValueList[0= ], '0', 1) ## [components] section parser @ParseMacro @@ -1502,6 +1592,10 @@ class DecParser(MetaFileParser): self._include_flag =3D False self._package_flag =3D False + self._AllPCDs =3D [] # Only for check duplicate PCD + self._AllPcdDict =3D {} + + ## Parser starter def Start(self): Content =3D '' @@ -1510,6 +1604,7 @@ class DecParser(MetaFileParser): except: EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=3Dself= .MetaFile) + Content =3D self.ProcessMultipleLineCODEValue(Content) # # Insert a record for file # @@ -1707,51 +1802,6 @@ class DecParser(MetaFileParser): namelist[2] =3D ".".join((arrayindex,namelist[2])) return namelist - def StructPcdParser(self): - self._ValueList[0] =3D self._CurrentStructurePcdName - - if "|" not in self._CurrentLine: - if "" =3D=3D self._CurrentLine: - self._include_flag =3D True - self._package_flag =3D False - self._ValueList =3D None - return - if "" =3D=3D self._CurrentLine: - self._package_flag =3D True - self._ValueList =3D None - self._include_flag =3D False - return - - if self._include_flag: - self._ValueList[1] =3D "_" + md5(self._Curre= ntLine.encode('utf-8')).hexdigest() - self._ValueList[2] =3D self._CurrentLine - if self._package_flag and "}" !=3D self._CurrentLine: - self._ValueList[1] =3D "_" + md5(self._CurrentL= ine.encode('utf-8')).hexdigest() - self._ValueList[2] =3D self._CurrentLine - if self._CurrentLine =3D=3D "}": - self._package_flag =3D False - self._include_flag =3D False - self._ValueList =3D None - else: - PcdTockens =3D self._CurrentLine.split(TAB_VALUE_SPLIT) - PcdNames =3D self.ParsePcdName(PcdTockens[0].split(TAB_SPLIT)= ) - if len(PcdNames) =3D=3D 2: - if PcdNames[1].strip().endswith("]"): - PcdName =3D PcdNames[1][:PcdNames[1].index('[')] - Index =3D PcdNames[1][PcdNames[1].index('['):] - self._ValueList[0] =3D TAB_SPLIT.join((PcdNames[0], P= cdName)) - self._ValueList[1] =3D Index - self._ValueList[2] =3D PcdTockens[1] - else: - self._CurrentStructurePcdName =3D "" - else: - if self._CurrentStructurePcdName !=3D TAB_SPLIT.join(PcdN= ames[:2]): - EdkLogger.error('Parser', FORMAT_INVALID, "Pcd Name d= oes not match: %s and %s " % ( - self._CurrentStructurePcdName, TAB_SPLIT.join(PcdName= s[:2])), - File=3Dself.MetaFile, Line=3Dself._Li= neIndex + 1) - self._ValueList[1] =3D TAB_SPLIT.join(PcdNames[2:]) - self._ValueList[2] =3D PcdTockens[1] - ## PCD sections parser # # [PcdsFixedAtBuild] @@ -1763,159 +1813,175 @@ class DecParser(MetaFileParser): @ParseMacro def _PcdParser(self): if self._CurrentStructurePcdName: - self.StructPcdParser() - return - TokenList =3D GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLI= T, 1) - self._ValueList[0:1] =3D GetSplitValueList(TokenList[0], TAB_SPLI= T) - # check PCD information - if self._ValueList[0] =3D=3D '' or self._ValueList[1] =3D=3D '': - EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUI= D or PCD name specified", - ExtraData=3Dself._CurrentLine + \ - " (.= |||)", - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) - # check PCD datum information - if len(TokenList) < 2 or TokenList[1] =3D=3D '': - EdkLogger.error('Parser', FORMAT_INVALID, "No PCD Datum infor= mation given", - ExtraData=3Dself._CurrentLine + \ - " (.= |||)", - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) - - - ValueRe =3D re.compile(r'^\s*L?\".*\|.*\"') - PtrValue =3D ValueRe.findall(TokenList[1]) - - # Has VOID* type string, may contain "|" character in the string. - if len(PtrValue) !=3D 0: - ptrValueList =3D re.sub(ValueRe, '', TokenList[1]) - ValueList =3D GetSplitValueList(ptrValueList) - ValueList[0] =3D PtrValue[0] - else: - ValueList =3D GetSplitValueList(TokenList[1]) - - - # check if there's enough datum information given - if len(ValueList) !=3D 3: - EdkLogger.error('Parser', FORMAT_INVALID, "Invalid PCD Datum = information given", - ExtraData=3Dself._CurrentLine + \ - " (.= |||)", - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) - # check default value - if ValueList[0] =3D=3D '': - EdkLogger.error('Parser', FORMAT_INVALID, "Missing DefaultVal= ue in PCD Datum information", - ExtraData=3Dself._CurrentLine + \ - " (.= |||)", - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) - # check datum type - if ValueList[1] =3D=3D '': - EdkLogger.error('Parser', FORMAT_INVALID, "Missing DatumType = in PCD Datum information", - ExtraData=3Dself._CurrentLine + \ - " (.= |||)", - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) - # check token of the PCD - if ValueList[2] =3D=3D '': - EdkLogger.error('Parser', FORMAT_INVALID, "Missing Token in P= CD Datum information", - ExtraData=3Dself._CurrentLine + \ - " (.= |||)", - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) - # check format of default value against the datum type - IsValid, Cause =3D CheckPcdDatum(ValueList[1], ValueList[0]) - if not IsValid: - EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraData=3D= self._CurrentLine, - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) - if Cause =3D=3D "StructurePcd": - self._CurrentStructurePcdName =3D TAB_SPLIT.join(self._ValueL= ist[0:2]) self._ValueList[0] =3D self._CurrentStructurePcdName - self._ValueList[1] =3D ValueList[1].strip() - if EccGlobalData.gConfig.UniCheckPCDInfo =3D=3D '1' or EccGlobalD= ata.gConfig.UniCheckAll =3D=3D '1' or EccGlobalData.gConfig.CheckAll =3D=3D= '1': - # check Description, Prompt information - PatternDesc =3D re.compile('##\s*([\x21-\x7E\s]*)', re.S) - PatternPrompt =3D re.compile('#\s+@Prompt\s+([\x21-\x7E\s]*)'= , re.S) - Description =3D None - Prompt =3D None - # check @ValidRange, @ValidList and @Expression format valid - ErrorCodeValid =3D '0x0 <=3D %s <=3D 0xFFFFFFFF' - PatternValidRangeIn =3D '(NOT)?\s*(\d+\s*-\s*\d+|0[xX][a-fA-F= 0-9]+\s*-\s*0[xX][a-fA-F0-9]+|LT\s*\d+|LT\s*0[xX][a-fA-F0-9]+|GT\s*\d+|GT\s= *0[xX][a-fA-F0-9]+|LE\s*\d+|LE\s*0[xX][a-fA-F0-9]+|GE\s*\d+|GE\s*0[xX][a-fA= -F0-9]+|XOR\s*\d+|XOR\s*0[xX][a-fA-F0-9]+|EQ\s*\d+|EQ\s*0[xX][a-fA-F0-9]+)' - PatternValidRng =3D re.compile('^' + '(NOT)?\s*' + PatternVal= idRangeIn + '$') - for Comment in self._Comments: - Comm =3D Comment[0].strip() - if not Comm: - continue - if not Description: - Description =3D PatternDesc.findall(Comm) - if not Prompt: - Prompt =3D PatternPrompt.findall(Comm) - if Comm[0] =3D=3D '#': - ValidFormt =3D Comm.lstrip('#') - ValidFormt =3D ValidFormt.lstrip() - if ValidFormt[0:11] =3D=3D '@ValidRange': - ValidFormt =3D ValidFormt[11:] - ValidFormt =3D ValidFormt.lstrip() - try: - ErrorCode, Expression =3D ValidFormt.split('|= ', 1) - except ValueError: - ErrorCode =3D '0x0' - Expression =3D ValidFormt - ErrorCode, Expression =3D ErrorCode.strip(), Expr= ession.strip() - try: - if not eval(ErrorCodeValid % ErrorCode): - EdkLogger.warn('Parser', '@ValidRange Err= orCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0]= )) - except: - EdkLogger.warn('Parser', '@ValidRange ErrorCo= de(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0])) - if not PatternValidRng.search(Expression): - EdkLogger.warn('Parser', '@ValidRange Express= ion(%s) of PCD %s is incorrect format.' % (Expression, TokenList[0])) - if ValidFormt[0:10] =3D=3D '@ValidList': - ValidFormt =3D ValidFormt[10:] - ValidFormt =3D ValidFormt.lstrip() - try: - ErrorCode, Expression =3D ValidFormt.split('|= ', 1) - except ValueError: - ErrorCode =3D '0x0' - Expression =3D ValidFormt - ErrorCode, Expression =3D ErrorCode.strip(), Expr= ession.strip() - try: - if not eval(ErrorCodeValid % ErrorCode): - EdkLogger.warn('Parser', '@ValidList Erro= rCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0])= ) - except: - EdkLogger.warn('Parser', '@ValidList ErrorCod= e(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0])) - Values =3D Expression.split(',') - for Value in Values: - Value =3D Value.strip() - try: - eval(Value) - except: - EdkLogger.warn('Parser', '@ValidList Expr= ession of PCD %s include a invalid value(%s).' % (TokenList[0], Value)) - break - if ValidFormt[0:11] =3D=3D '@Expression': - ValidFormt =3D ValidFormt[11:] - ValidFormt =3D ValidFormt.lstrip() - try: - ErrorCode, Expression =3D ValidFormt.split('|= ', 1) - except ValueError: - ErrorCode =3D '0x0' - Expression =3D ValidFormt - ErrorCode, Expression =3D ErrorCode.strip(), Expr= ession.strip() - try: - if not eval(ErrorCodeValid % ErrorCode): - EdkLogger.warn('Parser', '@Expression Err= orCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0]= )) - except: - EdkLogger.warn('Parser', '@Expression ErrorCo= de(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0])) - if not Expression: - EdkLogger.warn('Parser', '@Expression Express= ion of PCD %s is incorrect format.' % TokenList[0]) - if not Description: - EdkLogger.warn('Parser', 'PCD %s Description information = is not provided.' % TokenList[0]) - if not Prompt: - EdkLogger.warn('Parser', 'PCD %s Prompt information is no= t provided.' % TokenList[0]) - # check Description, Prompt localization information - if self._UniObj: - self._UniObj.CheckPcdInfo(TokenList[0]) + if "|" not in self._CurrentLine: + if "" =3D=3D self._CurrentLine: + self._include_flag =3D True + self._package_flag =3D False + self._ValueList =3D None + return + if "" =3D=3D self._CurrentLine: + self._package_flag =3D True + self._ValueList =3D None + self._include_flag =3D False + return - if ValueList[0] in ['True', 'true', 'TRUE']: - ValueList[0] =3D '1' - elif ValueList[0] in ['False', 'false', 'FALSE']: - ValueList[0] =3D '0' + if self._include_flag: + self._ValueList[1] =3D "_" + md5(self._C= urrentLine.encode('utf-8')).hexdigest() + self._ValueList[2] =3D self._CurrentLine + if self._package_flag and "}" !=3D self._CurrentLine: + self._ValueList[1] =3D "_" + md5(self._Curr= entLine.encode('utf-8')).hexdigest() + self._ValueList[2] =3D self._CurrentLine + if self._CurrentLine =3D=3D "}": + self._package_flag =3D False + self._include_flag =3D False + self._ValueList =3D None + return + else: + PcdTockens =3D self._CurrentLine.split(TAB_VALUE_SPLIT) + PcdNames =3D self.ParsePcdName(PcdTockens[0].split(TAB_SP= LIT)) + if len(PcdNames) =3D=3D 2: + if PcdNames[1].strip().endswith("]"): + PcdName =3D PcdNames[1][:PcdNames[1].index('[')] + Index =3D PcdNames[1][PcdNames[1].index('['):] + self._ValueList[0] =3D TAB_SPLIT.join((PcdNames[0= ],PcdName)) + self._ValueList[1] =3D Index + self._ValueList[2] =3D PcdTockens[1] + else: + self._CurrentStructurePcdName =3D "" + else: + if self._CurrentStructurePcdName !=3D TAB_SPLIT.join(= PcdNames[:2]): + EdkLogger.error('Parser', FORMAT_INVALID, "Pcd Na= me does not match: %s and %s " % (self._CurrentStructurePcdName, TAB_SPLIT.= join(PcdNames[:2])), + File=3Dself.MetaFile, Line=3Dself._LineIn= dex + 1) + self._ValueList[1] =3D TAB_SPLIT.join(PcdNames[2:]) + self._ValueList[2] =3D PcdTockens[1] - self._ValueList[2] =3D ValueList[0].strip() + '|' + ValueList[1].= strip() + '|' + ValueList[2].strip() + if not self._CurrentStructurePcdName: + if self._PcdDataTypeCODE: + if ")}" in self._CurrentLine: + ValuePart, RestofValue =3D self._CurrentLine.split(")= }") + self._PcdCodeValue =3D self._PcdCodeValue + "\n " + V= aluePart + self._CurrentLine =3D "|".join((self._CurrentPcdName,= self._PcdCodeValue, RestofValue)) + self._PcdDataTypeCODE =3D False + self._PcdCodeValue =3D "" + else: + self._PcdCodeValue =3D self._PcdCodeValue + "\n " + s= elf._CurrentLine + self._ValueList =3D None + return + TokenList =3D GetSplitValueList(self._CurrentLine, TAB_VALUE_= SPLIT, 1) + self._CurrentPcdName =3D TokenList[0] + if len(TokenList) =3D=3D 2 and TokenList[1].strip().startswit= h("{CODE"): + if ")}" in self._CurrentLine: + self._PcdDataTypeCODE =3D False + self._PcdCodeValue =3D "" + else: + self._PcdDataTypeCODE =3D True + self._PcdCodeValue =3D TokenList[1].strip() + self._ValueList =3D None + return + + self._ValueList[0:1] =3D GetSplitValueList(TokenList[0], TAB_= SPLIT) + ValueRe =3D re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*') + # check PCD information + if self._ValueList[0] =3D=3D '' or self._ValueList[1] =3D=3D = '': + EdkLogger.error('Parser', FORMAT_INVALID, "No token space= GUID or PCD name specified", + ExtraData=3Dself._CurrentLine + \ + " (.|||)", + File=3Dself.MetaFile, Line=3Dself._LineIn= dex+1) + # check format of token space GUID CName + if not ValueRe.match(self._ValueList[0]): + EdkLogger.error('Parser', FORMAT_INVALID, + "The format of the token space GUID CName= is invalid. The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'", + ExtraData=3Dself._CurrentLine + \ + " (.|||)", + File=3Dself.MetaFile, Line=3Dself._LineIn= dex + 1) + # check format of PCD CName + if not ValueRe.match(self._ValueList[1]): + EdkLogger.error('Parser', FORMAT_INVALID, + "The format of the PCD CName is invalid. = The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'", + ExtraData=3Dself._CurrentLine + \ + " (.|||)", + File=3Dself.MetaFile, Line=3Dself._LineIn= dex + 1) + + # check PCD datum information + if len(TokenList) < 2 or TokenList[1] =3D=3D '': + EdkLogger.error('Parser', FORMAT_INVALID, "No PCD Datum i= nformation given", + ExtraData=3Dself._CurrentLine + \ + " (.|||)", + File=3Dself.MetaFile, Line=3Dself._LineIn= dex+1) + + + ValueRe =3D re.compile(r'^\s*L?\".*\|.*\"') + PtrValue =3D ValueRe.findall(TokenList[1]) + + # Has VOID* type string, may contain "|" character in the str= ing. + if len(PtrValue) !=3D 0: + ptrValueList =3D re.sub(ValueRe, '', TokenList[1]) + ValueList =3D AnalyzePcdExpression(ptrValueList) + ValueList[0] =3D PtrValue[0] + else: + ValueList =3D AnalyzePcdExpression(TokenList[1]) + + + # check if there's enough datum information given + if len(ValueList) !=3D 3: + EdkLogger.error('Parser', FORMAT_INVALID, "Invalid PCD Da= tum information given", + ExtraData=3Dself._CurrentLine + \ + " (.|||)", + File=3Dself.MetaFile, Line=3Dself._LineIn= dex + 1) + # check default value + if ValueList[0] =3D=3D '': + EdkLogger.error('Parser', FORMAT_INVALID, "Missing Defaul= tValue in PCD Datum information", + ExtraData=3Dself._CurrentLine + \ + " (.|||)", + File=3Dself.MetaFile, Line=3Dself._LineIn= dex + 1) + # check datum type + if ValueList[1] =3D=3D '': + EdkLogger.error('Parser', FORMAT_INVALID, "Missing DatumT= ype in PCD Datum information", + ExtraData=3Dself._CurrentLine + \ + " (.|||)", + File=3Dself.MetaFile, Line=3Dself._LineIn= dex + 1) + # check token of the PCD + if ValueList[2] =3D=3D '': + EdkLogger.error('Parser', FORMAT_INVALID, "Missing Token = in PCD Datum information", + ExtraData=3Dself._CurrentLine + \ + " (.|||)", + File=3Dself.MetaFile, Line=3Dself._LineIn= dex + 1) + + PcdValue =3D ValueList[0] + if PcdValue: + try: + self._GuidDict.update(self._AllPcdDict) + ValueList[0] =3D ValueExpressionEx(ValueList[0], Valu= eList[1], self._GuidDict)(True) + except BadExpression as Value: + EdkLogger.error('Parser', FORMAT_INVALID, Value, Extr= aData=3Dself._CurrentLine, File=3Dself.MetaFile, Line=3Dself._LineIndex + 1= ) + # check format of default value against the datum type + IsValid, Cause =3D CheckPcdDatum(ValueList[1], ValueList[0]) + if not IsValid: + EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraDat= a=3Dself._CurrentLine, + File=3Dself.MetaFile, Line=3Dself._LineIn= dex + 1) + + if Cause =3D=3D "StructurePcd": + self._CurrentStructurePcdName =3D TAB_SPLIT.join(self._Va= lueList[0:2]) + self._ValueList[0] =3D self._CurrentStructurePcdName + self._ValueList[1] =3D ValueList[1].strip() + + if ValueList[0] in ['True', 'true', 'TRUE']: + ValueList[0] =3D '1' + elif ValueList[0] in ['False', 'false', 'FALSE']: + ValueList[0] =3D '0' + + # check for duplicate PCD definition + if (self._Scope[0], self._ValueList[0], self._ValueList[1]) i= n self._AllPCDs: + EdkLogger.error('Parser', FORMAT_INVALID, + "The same PCD name and GUID have been alr= eady defined", + ExtraData=3Dself._CurrentLine, File=3Dsel= f.MetaFile, Line=3Dself._LineIndex + 1) + else: + self._AllPCDs.append((self._Scope[0], self._ValueList[0],= self._ValueList[1])) + self._AllPcdDict[TAB_SPLIT.join(self._ValueList[0:2])] = =3D ValueList[0] + + self._ValueList[2] =3D ValueList[0].strip() + '|' + ValueList= [1].strip() + '|' + ValueList[2].strip() _SectionParser =3D { MODEL_META_DATA_HEADER : MetaFileParser._DefineParser, -- 2.26.2.windows.1 --_000_MW4PR21MB190714F1689BD80D7A8D8BFEEF7B9MW4PR21MB1907namp_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

What does =93update=94 mean in this context? What b= ehavior is changing?

 

- Bret

 

 

From: mliang2x <m= ingyuex.liang@intel.com>

Update the pcdparser method in Dec and DSC files.

Signed-off-by: Mingyue Liang <mingyuex.liang@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
---
 .../Ecc/MetaFileWorkspace/MetaFileParser.py   | 464 ++++++= ++++--------
 1 file changed, 265 insertions(+), 199 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.= py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
index 9c27c8e16a05..588d3dbe6ed5 100644
--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
@@ -22,7 +22,7 @@ import Ecc.EccToolError as EccToolError
 from CommonDataClass.DataClass import *
 from Common.DataType import *
 from Common.StringUtils import *
-from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, P= athClass, AnalyzePcdData
+from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, P= athClass, AnalyzePcdData, AnalyzeDscPcd, AnalyzePcdExpression, ParseFieldVa= lue, StructPattern
 from Common.Expression import *
 from CommonDataClass.Exceptions import *
 
@@ -31,6 +31,8 @@ from GenFds.FdfParser import FdfParser
 from Common.LongFilePathSupport import OpenLongFilePath as open
 from Common.LongFilePathSupport import CodecOpenLongFilePath
 
+CODEPattern =3D re.compile(r"{CODE\([a-fA-F0-9Xx\{\},\s]*\)}")<= br> +
 ## A decorator used to parse macro definition
 def ParseMacro(Parser):
     def MacroParser(self):
@@ -174,6 +176,11 @@ class MetaFileParser(object):
         # UNI object and extra UN= I object
         self._UniObj =3D None
         self._UniExtraObj =3D Non= e
+        # StructPcd var
+        self._PcdCodeValue =3D "&= quot;
+        self._PcdDataTypeCODE =3D Fals= e
+        self._CurrentPcdName =3D "= ;"
+        self._GuidDict =3D {}  # = for Parser PCD value {GUID(gTokeSpaceGuidName)}
 
     ## Store the parsed data in table
     def _Store(self, *Args):
@@ -395,6 +402,40 @@ class MetaFileParser(object):
            &n= bsp;    Macros.update(self._SectionsMacroDict[(self._Section= Type, Scope1, Scope2)])
         return Macros
 
+    def ProcessMultipleLineCODEValue(self, Content):
+        CODEBegin =3D False
+        CODELine =3D ""
+        continuelinecount =3D 0
+        newContent =3D []
+        for Index in range(0, len(Cont= ent)):
+            Line = =3D Content[Index]
+            if COD= EBegin:
+            &= nbsp;   CODELine =3D CODELine + Line
+            &= nbsp;   continuelinecount +=3D1
+            &= nbsp;   if ")}" in Line:
+            &= nbsp;       newContent.append(CODELine)
+            &= nbsp;       for _ in range(continuelinecount)= :
+            &= nbsp;           newConten= t.append("")
+            &= nbsp;       CODEBegin =3D False
+            &= nbsp;       CODELine =3D ""
+            &= nbsp;       continuelinecount =3D 0
+            else:<= br> +            &= nbsp;   if not Line:
+            &= nbsp;       newContent.append(Line)
+            &= nbsp;       continue
+            &= nbsp;   if "{CODE(" not in Line:
+            &= nbsp;       newContent.append(Line)
+            &= nbsp;       continue
+            &= nbsp;   elif CODEPattern.findall(Line):
+            &= nbsp;       newContent.append(Line)
+            &= nbsp;       continue
+            &= nbsp;   else:
+            &= nbsp;       CODEBegin =3D True
+            &= nbsp;       CODELine =3D Line
+
+        return newContent
+
+
     _SectionParser  =3D {}
     Finished       = ; =3D property(_GetFinished, _SetFinished)
     _Macros       =   =3D property(_GetMacros)
@@ -812,6 +853,8 @@ class DscParser(MetaFileParser):
             C= ontent =3D open(str(self.MetaFile.Path), 'r').readlines()
         except:
             E= dkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=3Dself.Meta= File)
+
+        Content =3D self.ProcessMultip= leLineCODEValue(Content)
         #
         # Insert a record for fil= e
         #
@@ -1018,24 +1061,71 @@ class DscParser(MetaFileParser):
     #
     @ParseMacro
     def _PcdParser(self):
+        if self._PcdDataTypeCODE:
+            self._= PcdCodeValue =3D self._PcdCodeValue + "\n " + self._CurrentLine +            if sel= f._CurrentLine.endswith(")}"):
+            &= nbsp;   self._CurrentLine =3D "|".join((self._CurrentPc= dName, self._PcdCodeValue))
+            &= nbsp;   self._PcdDataTypeCODE =3D False
+            &= nbsp;   self._PcdCodeValue =3D ""
+            else:<= br> +            &= nbsp;   self._ValueList =3D None
+            &= nbsp;   return
         TokenList =3D GetSplitVal= ueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
+        self._CurrentPcdName =3D Token= List[0]
+        if len(TokenList) =3D=3D 2 and= TokenList[1].strip().startswith("{CODE"):
+            self._= PcdDataTypeCODE =3D True
+            self._= PcdCodeValue =3D TokenList[1].strip()
+
+        if self._PcdDataTypeCODE:
+            if sel= f._CurrentLine.endswith(")}"):
+            &= nbsp;   self._PcdDataTypeCODE =3D False
+            &= nbsp;   self._PcdCodeValue =3D ""
+            else:<= br> +            &= nbsp;   self._ValueList =3D None
+            &= nbsp;   return
         self._ValueList[0:1] =3D = GetSplitValueList(TokenList[0], TAB_SPLIT)
+        PcdNameTockens =3D GetSplitVal= ueList(TokenList[0], TAB_SPLIT)
+        if len(PcdNameTockens) =3D=3D = 2:
+            self._= ValueList[0], self._ValueList[1] =3D PcdNameTockens[0], PcdNameTockens[1] +        elif len(PcdNameTockens) =3D= =3D 3:
+            self._= ValueList[0], self._ValueList[1] =3D ".".join((PcdNameTockens[0],= PcdNameTockens[1])), PcdNameTockens[2]
+        elif len(PcdNameTockens) > = 3:
+            self._= ValueList[0], self._ValueList[1] =3D ".".join((PcdNameTockens[0],= PcdNameTockens[1])), ".".join(PcdNameTockens[2:])
         if len(TokenList) =3D=3D = 2:
             s= elf._ValueList[2] =3D TokenList[1]
         if self._ValueList[0] =3D= = =3D '' or self._ValueList[1] =3D=3D '':
             E= dkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD n= ame specified",
            &n= bsp;            = ;    ExtraData=3Dself._CurrentLine + " (<TokenSpaceG= uidCName>.<TokenCName>|<PcdValue>)",
-            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
+            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex + 1)
         if self._ValueList[2] =3D= = =3D '':
+            #
+            # The = PCD values are optional for FIXEDATBUILD, PATCHABLEINMODULE, Dynamic/Dynami= cEx default
+            #
+            if sel= f._SectionType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE,= MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT):
+            &= nbsp;   return
             E= dkLogger.error('Parser', FORMAT_INVALID, "No PCD value given",             &n= bsp;            = ;    ExtraData=3Dself._CurrentLine + " (<TokenSpaceG= uidCName>.<TokenCName>|<PcdValue>)",
-            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
+            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex + 1)
+
+        # Validate the datum type of D= ynamic Defaul PCD and DynamicEx Default PCD
+        ValueList =3D GetSplitValueLis= t(self._ValueList[2])
+        if len(ValueList) > 1 and V= alueList[1] in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64] \
+            &= nbsp;           &nbs= p;     and self._ItemType in [MODEL_PCD_DYNAMIC_DEFAULT= , MODEL_PCD_DYNAMIC_EX_DEFAULT]:
+            EdkLog= ger.error('Parser', FORMAT_INVALID, "The datum type '%s' of PCD is wro= ng" % ValueList[1],
+            &= nbsp;           &nbs= p;   ExtraData=3Dself._CurrentLine, File=3Dself.MetaFile, Line=3D= self._LineIndex + 1)
+
+        # Validate the VariableName of= DynamicHii and DynamicExHii for PCD Entry must not be an empty string
+        if self._ItemType in [MODEL_PC= D_DYNAMIC_HII, MODEL_PCD_DYNAMIC_EX_HII]:
+            DscPcd= ValueList =3D GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
+            if len= (DscPcdValueList[0].replace('L', '').replace('"', '').strip()) =3D=3D = 0:
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID, "The Varia= bleName field in the HII format PCD entry must not be an empty string"= ,
+            &= nbsp;           &nbs= p;   ExtraData=3Dself._CurrentLine, File=3Dself.MetaFile, Line=3D= self._LineIndex + 1)
         # if value are 'True', 't= rue', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0.
         DscPcdValueList =3D GetSp= litValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
         if DscPcdValueList[0] in = ['True', 'true', 'TRUE']:
-            self._= ValueList[2] =3D TokenList[1].replace(DscPcdValueList[0], '1', 1);
+            self._= ValueList[2] =3D TokenList[1].replace(DscPcdValueList[0], '1', 1)
         elif DscPcdValueList[0] i= n ['False', 'false', 'FALSE']:
-            self._= ValueList[2] =3D TokenList[1].replace(DscPcdValueList[0], '0', 1);
+            self._= ValueList[2] =3D TokenList[1].replace(DscPcdValueList[0], '0', 1)
 
     ## [components] section parser
     @ParseMacro
@@ -1502,6 +1592,10 @@ class DecParser(MetaFileParser):
         self._include_flag =3D Fa= lse
         self._package_flag =3D Fa= lse
 
+        self._AllPCDs =3D [] # Only fo= r check duplicate PCD
+        self._AllPcdDict =3D {}
+
+
     ## Parser starter
     def Start(self):
         Content =3D ''
@@ -1510,6 +1604,7 @@ class DecParser(MetaFileParser):
         except:
             E= dkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=3Dself.Meta= File)
 
+        Content =3D self.ProcessMultip= leLineCODEValue(Content)
         #
         # Insert a record for fil= e
         #
@@ -1707,51 +1802,6 @@ class DecParser(MetaFileParser):
            &n= bsp;    namelist[2] =3D ".".join((arrayindex,namel= ist[2]))
         return namelist
 
-    def StructPcdParser(self):
-        self._ValueList[0] =3D self._C= urrentStructurePcdName
-
-        if "|" not in self._= CurrentLine:
-            if &qu= ot;<HeaderFiles>" =3D=3D self._CurrentLine:
-            &= nbsp;   self._include_flag =3D True
-            &= nbsp;   self._package_flag =3D False
-            &= nbsp;   self._ValueList =3D None
-            &= nbsp;   return
-            if &qu= ot;<Packages>" =3D=3D self._CurrentLine:
-            &= nbsp;   self._package_flag =3D True
-            &= nbsp;   self._ValueList =3D None
-            &= nbsp;   self._include_flag =3D False
-            &= nbsp;   return
-
-            if sel= f._include_flag:
-            &= nbsp;   self._ValueList[1] =3D "<HeaderFiles>_" += md5(self._CurrentLine.encode('utf-8')).hexdigest()
-            &= nbsp;   self._ValueList[2] =3D self._CurrentLine
-            if sel= f._package_flag and "}" !=3D self._CurrentLine:
-            &= nbsp;   self._ValueList[1] =3D "<Packages>_" + md= 5(self._CurrentLine.encode('utf-8')).hexdigest()
-            &= nbsp;   self._ValueList[2] =3D self._CurrentLine
-            if sel= f._CurrentLine =3D=3D "}":
-            &= nbsp;   self._package_flag =3D False
-            &= nbsp;   self._include_flag =3D False
-            &= nbsp;   self._ValueList =3D None
-        else:
-            PcdToc= kens =3D self._CurrentLine.split(TAB_VALUE_SPLIT)
-            PcdNam= es =3D self.ParsePcdName(PcdTockens[0].split(TAB_SPLIT))
-            if len= (PcdNames) =3D=3D 2:
-            &= nbsp;   if PcdNames[1].strip().endswith("]"):
-            &= nbsp;       PcdName =3D PcdNames[1][:PcdNames= [1].index('[')]
-            &= nbsp;       Index =3D PcdNames[1][PcdNames[1]= .index('['):]
-            &= nbsp;       self._ValueList[0] =3D TAB_SPLIT.= join((PcdNames[0], PcdName))
-            &= nbsp;       self._ValueList[1] =3D Index
-            &= nbsp;       self._ValueList[2] =3D PcdTockens= [1]
-            &= nbsp;   else:
-            &= nbsp;       self._CurrentStructurePcdName =3D= ""
-            else:<= br> -            &= nbsp;   if self._CurrentStructurePcdName !=3D TAB_SPLIT.join(PcdN= ames[:2]):
-            &= nbsp;       EdkLogger.error('Parser', FORMAT_= INVALID, "Pcd Name does not match: %s and %s " % (
-            &= nbsp;       self._CurrentStructurePcdName, TA= B_SPLIT.join(PcdNames[:2])),
-            &= nbsp;           &nbs= p;           File=3Dself.= MetaFile, Line=3Dself._LineIndex + 1)
-            &= nbsp;   self._ValueList[1] =3D TAB_SPLIT.join(PcdNames[2:])
-            &= nbsp;   self._ValueList[2] =3D PcdTockens[1]
-
     ## PCD sections parser
     #
     #   [PcdsFixedAtBuild]
@@ -1763,159 +1813,175 @@ class DecParser(MetaFileParser):
     @ParseMacro
     def _PcdParser(self):
         if self._CurrentStructure= PcdName:
-            self.S= tructPcdParser()
-            return=
-        TokenList =3D GetSplitValueLis= t(self._CurrentLine, TAB_VALUE_SPLIT, 1)
-        self._ValueList[0:1] =3D GetSp= litValueList(TokenList[0], TAB_SPLIT)
-        # check PCD information
-        if self._ValueList[0] =3D=3D '= ' or self._ValueList[1] =3D=3D '':
-            EdkLog= ger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name s= pecified",
-            &= nbsp;           &nbs= p;   ExtraData=3Dself._CurrentLine + \
-            &= nbsp;           &nbs= p;             = " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|&= lt;DatumType>|<Token>)",
-            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
-        # check PCD datum information<= br> -        if len(TokenList) < 2 or To= kenList[1] =3D=3D '':
-            EdkLog= ger.error('Parser', FORMAT_INVALID, "No PCD Datum information given&qu= ot;,
-            &= nbsp;           &nbs= p;   ExtraData=3Dself._CurrentLine + \
-            &= nbsp;           &nbs= p;             = " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|&= lt;DatumType>|<Token>)",
-            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
-
-
-        ValueRe  =3D re.compile(r= '^\s*L?\".*\|.*\"')
-        PtrValue =3D ValueRe.findall(T= okenList[1])
-
-        # Has VOID* type string, may c= ontain "|" character in the string.
-        if len(PtrValue) !=3D 0:
-            ptrVal= ueList =3D re.sub(ValueRe, '', TokenList[1])
-            ValueL= ist    =3D GetSplitValueList(ptrValueList)
-            ValueL= ist[0] =3D PtrValue[0]
-        else:
-            ValueL= ist =3D GetSplitValueList(TokenList[1])
-
-
-        # check if there's enough datu= m information given
-        if len(ValueList) !=3D 3:
-            EdkLog= ger.error('Parser', FORMAT_INVALID, "Invalid PCD Datum information giv= en",
-            &= nbsp;           &nbs= p;   ExtraData=3Dself._CurrentLine + \
-            &= nbsp;           &nbs= p;             = " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|&= lt;DatumType>|<Token>)",
-            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
-        # check default value
-        if ValueList[0] =3D=3D '':
-            EdkLog= ger.error('Parser', FORMAT_INVALID, "Missing DefaultValue in PCD Datum= information",
-            &= nbsp;           &nbs= p;   ExtraData=3Dself._CurrentLine + \
-            &= nbsp;           &nbs= p;             = " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|&= lt;DatumType>|<Token>)",
-            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
-        # check datum type
-        if ValueList[1] =3D=3D '':
-            EdkLog= ger.error('Parser', FORMAT_INVALID, "Missing DatumType in PCD Datum in= formation",
-            &= nbsp;           &nbs= p;   ExtraData=3Dself._CurrentLine + \
-            &= nbsp;           &nbs= p;             = " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|&= lt;DatumType>|<Token>)",
-            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
-        # check token of the PCD
-        if ValueList[2] =3D=3D '':
-            EdkLog= ger.error('Parser', FORMAT_INVALID, "Missing Token in PCD Datum inform= ation",
-            &= nbsp;           &nbs= p;   ExtraData=3Dself._CurrentLine + \
-            &= nbsp;           &nbs= p;             = " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|&= lt;DatumType>|<Token>)",
-            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
-        # check format of default valu= e against the datum type
-        IsValid, Cause =3D CheckPcdDat= um(ValueList[1], ValueList[0])
-        if not IsValid:
-            EdkLog= ger.error('Parser', FORMAT_INVALID, Cause, ExtraData=3Dself._CurrentLine, -            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
-        if Cause =3D=3D "Structur= ePcd":
-            self._= CurrentStructurePcdName =3D TAB_SPLIT.join(self._ValueList[0:2])
             s= elf._ValueList[0] =3D self._CurrentStructurePcdName
-            self._= ValueList[1] =3D ValueList[1].strip()
 
-        if EccGlobalData.gConfig.UniCh= eckPCDInfo =3D=3D '1' or EccGlobalData.gConfig.UniCheckAll =3D=3D '1' or Ec= cGlobalData.gConfig.CheckAll =3D=3D '1':
-            # chec= k Description, Prompt information
-            Patter= nDesc =3D re.compile('##\s*([\x21-\x7E\s]*)', re.S)
-            Patter= nPrompt =3D re.compile('#\s+@Prompt\s+([\x21-\x7E\s]*)', re.S)
-            Descri= ption =3D None
-            Prompt= =3D None
-            # chec= k @ValidRange, @ValidList and @Expression format valid
-            ErrorC= odeValid =3D '0x0 <=3D %s <=3D 0xFFFFFFFF'
-            Patter= nValidRangeIn =3D '(NOT)?\s*(\d+\s*-\s*\d+|0[xX][a-fA-F0-9]+\s*-\s*0[xX][a-= fA-F0-9]+|LT\s*\d+|LT\s*0[xX][a-fA-F0-9]+|GT\s*\d+|GT\s*0[xX][a-fA-F0-9]+|L= E\s*\d+|LE\s*0[xX][a-fA-F0-9]+|GE\s*\d+|GE\s*0[xX][a-fA-F0-9]+|XOR\s*\d+|XO= R\s*0[xX][a-fA-F0-9]+|EQ\s*\d+|EQ\s*0[xX][a-fA-F0-9]+)'
-            Patter= nValidRng =3D re.compile('^' + '(NOT)?\s*' + PatternValidRangeIn + '$')
-            for Co= mment in self._Comments:
-            &= nbsp;   Comm =3D Comment[0].strip()
-            &= nbsp;   if not Comm:
-            &= nbsp;       continue
-            &= nbsp;   if not Description:
-            &= nbsp;       Description =3D PatternDesc.finda= ll(Comm)
-            &= nbsp;   if not Prompt:
-            &= nbsp;       Prompt =3D PatternPrompt.findall(= Comm)
-            &= nbsp;   if Comm[0] =3D=3D '#':
-            &= nbsp;       ValidFormt =3D Comm.lstrip('#') -            &= nbsp;       ValidFormt =3D ValidFormt.lstrip(= )
-            &= nbsp;       if ValidFormt[0:11] =3D=3D '@Vali= dRange':
-            &= nbsp;           ValidForm= t =3D ValidFormt[11:]
-            &= nbsp;           ValidForm= t =3D ValidFormt.lstrip()
-            &= nbsp;           try:
-            &= nbsp;           &nbs= p;   ErrorCode, Expression =3D ValidFormt.split('|', 1)
-            &= nbsp;           except Va= lueError:
-            &= nbsp;           &nbs= p;   ErrorCode =3D '0x0'
-            &= nbsp;           &nbs= p;   Expression =3D ValidFormt
-            &= nbsp;           ErrorCode= , Expression =3D ErrorCode.strip(), Expression.strip()
-            &= nbsp;           try:
-            &= nbsp;           &nbs= p;   if not eval(ErrorCodeValid % ErrorCode):
-            &= nbsp;           &nbs= p;       EdkLogger.warn('Parser', '@ValidRang= e ErrorCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenLi= st[0]))
-            &= nbsp;           except: -            &= nbsp;           &nbs= p;   EdkLogger.warn('Parser', '@ValidRange ErrorCode(%s) of PCD %= s is not valid UINT32 value.' % (ErrorCode, TokenList[0]))
-            &= nbsp;           if not Pa= tternValidRng.search(Expression):
-            &= nbsp;           &nbs= p;   EdkLogger.warn('Parser', '@ValidRange Expression(%s) of PCD = %s is incorrect format.' % (Expression, TokenList[0]))
-            &= nbsp;       if ValidFormt[0:10] =3D=3D '@Vali= dList':
-            &= nbsp;           ValidForm= t =3D ValidFormt[10:]
-            &= nbsp;           ValidForm= t =3D ValidFormt.lstrip()
-            &= nbsp;           try:
-            &= nbsp;           &nbs= p;   ErrorCode, Expression =3D ValidFormt.split('|', 1)
-            &= nbsp;           except Va= lueError:
-            &= nbsp;           &nbs= p;   ErrorCode =3D '0x0'
-            &= nbsp;           &nbs= p;   Expression =3D ValidFormt
-            &= nbsp;           ErrorCode= , Expression =3D ErrorCode.strip(), Expression.strip()
-            &= nbsp;           try:
-            &= nbsp;           &nbs= p;   if not eval(ErrorCodeValid % ErrorCode):
-            &= nbsp;           &nbs= p;       EdkLogger.warn('Parser', '@ValidList= ErrorCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenLis= t[0]))
-            &= nbsp;           except: -            &= nbsp;           &nbs= p;   EdkLogger.warn('Parser', '@ValidList ErrorCode(%s) of PCD %s= is not valid UINT32 value.' % (ErrorCode, TokenList[0]))
-            &= nbsp;           Values = =3D Expression.split(',')
-            &= nbsp;           for Value= in Values:
-            &= nbsp;           &nbs= p;   Value =3D Value.strip()
-            &= nbsp;           &nbs= p;   try:
-            &= nbsp;           &nbs= p;       eval(Value)
-            &= nbsp;           &nbs= p;   except:
-            &= nbsp;           &nbs= p;       EdkLogger.warn('Parser', '@ValidList= Expression of PCD %s include a invalid value(%s).' % (TokenList[0], Value)= )
-            &= nbsp;           &nbs= p;       break
-            &= nbsp;       if ValidFormt[0:11] =3D=3D '@Expr= ession':
-            &= nbsp;           ValidForm= t =3D ValidFormt[11:]
-            &= nbsp;           ValidForm= t =3D ValidFormt.lstrip()
-            &= nbsp;           try:
-            &= nbsp;           &nbs= p;   ErrorCode, Expression =3D ValidFormt.split('|', 1)
-            &= nbsp;           except Va= lueError:
-            &= nbsp;           &nbs= p;   ErrorCode =3D '0x0'
-            &= nbsp;           &nbs= p;   Expression =3D ValidFormt
-            &= nbsp;           ErrorCode= , Expression =3D ErrorCode.strip(), Expression.strip()
-            &= nbsp;           try:
-            &= nbsp;           &nbs= p;   if not eval(ErrorCodeValid % ErrorCode):
-            &= nbsp;           &nbs= p;       EdkLogger.warn('Parser', '@Expressio= n ErrorCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenLi= st[0]))
-            &= nbsp;           except: -            &= nbsp;           &nbs= p;   EdkLogger.warn('Parser', '@Expression ErrorCode(%s) of PCD %= s is not valid UINT32 value.' % (ErrorCode, TokenList[0]))
-            &= nbsp;           if not Ex= pression:
-            &= nbsp;           &nbs= p;   EdkLogger.warn('Parser', '@Expression Expression of PCD %s i= s incorrect format.' % TokenList[0])
-            if not= Description:
-            &= nbsp;   EdkLogger.warn('Parser', 'PCD %s Description information = is not provided.' % TokenList[0])
-            if not= Prompt:
-            &= nbsp;   EdkLogger.warn('Parser', 'PCD %s Prompt information is no= t provided.' % TokenList[0])
-            # chec= k Description, Prompt localization information
-            if sel= f._UniObj:
-            &= nbsp;   self._UniObj.CheckPcdInfo(TokenList[0])
+            if &qu= ot;|" not in self._CurrentLine:
+            &= nbsp;   if "<HeaderFiles>" =3D=3D self._CurrentLi= ne:
+            &= nbsp;       self._include_flag =3D True
+            &= nbsp;       self._package_flag =3D False
+            &= nbsp;       self._ValueList =3D None
+            &= nbsp;       return
+            &= nbsp;   if "<Packages>" =3D=3D self._CurrentLine:=
+            &= nbsp;       self._package_flag =3D True
+            &= nbsp;       self._ValueList =3D None
+            &= nbsp;       self._include_flag =3D False
+            &= nbsp;       return
 
-        if ValueList[0] in ['True', 't= rue', 'TRUE']:
-            ValueL= ist[0] =3D '1'
-        elif ValueList[0] in ['False',= 'false', 'FALSE']:
-            ValueL= ist[0] =3D '0'
+            &= nbsp;   if self._include_flag:
+            &= nbsp;       self._ValueList[1] =3D "<= HeaderFiles>_" + md5(self._CurrentLine.encode('utf-8')).hexdigest()=
+            &= nbsp;       self._ValueList[2] =3D self._Curr= entLine
+            &= nbsp;   if self._package_flag and "}" !=3D self._Curren= tLine:
+            &= nbsp;       self._ValueList[1] =3D "<= Packages>_" + md5(self._CurrentLine.encode('utf-8')).hexdigest() +            &= nbsp;       self._ValueList[2] =3D self._Curr= entLine
+            &= nbsp;   if self._CurrentLine =3D=3D "}":
+            &= nbsp;       self._package_flag =3D False
+            &= nbsp;       self._include_flag =3D False
+            &= nbsp;       self._ValueList =3D None
+            &= nbsp;       return
+            else:<= br> +            &= nbsp;   PcdTockens =3D self._CurrentLine.split(TAB_VALUE_SPLIT) +            &= nbsp;   PcdNames =3D self.ParsePcdName(PcdTockens[0].split(TAB_SP= LIT))
+            &= nbsp;   if len(PcdNames) =3D=3D 2:
+            &= nbsp;       if PcdNames[1].strip().endswith(&= quot;]"):
+            &= nbsp;           PcdName = =3D PcdNames[1][:PcdNames[1].index('[')]
+            &= nbsp;           Index =3D= PcdNames[1][PcdNames[1].index('['):]
+            &= nbsp;           self._Val= ueList[0] =3D TAB_SPLIT.join((PcdNames[0],PcdName))
+            &= nbsp;           self._Val= ueList[1] =3D Index
+            &= nbsp;           self._Val= ueList[2] =3D PcdTockens[1]
+            &= nbsp;       else:
+            &= nbsp;           self._Cur= rentStructurePcdName =3D ""
+            &= nbsp;   else:
+            &= nbsp;       if self._CurrentStructurePcdName = !=3D TAB_SPLIT.join(PcdNames[:2]):
+            &= nbsp;           EdkLogger= .error('Parser', FORMAT_INVALID, "Pcd Name does not match: %s and %s &= quot; % (self._CurrentStructurePcdName, TAB_SPLIT.join(PcdNames[:2])),
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex + 1)
+            &= nbsp;       self._ValueList[1] =3D TAB_SPLIT.= join(PcdNames[2:])
+            &= nbsp;       self._ValueList[2] =3D PcdTockens= [1]
 
-        self._ValueList[2] =3D ValueLi= st[0].strip() + '|' + ValueList[1].strip() + '|' + ValueList[2].strip()
+        if not self._CurrentStructureP= cdName:
+            if sel= f._PcdDataTypeCODE:
+            &= nbsp;   if ")}" in self._CurrentLine:
+            &= nbsp;       ValuePart, RestofValue =3D self._= CurrentLine.split(")}")
+            &= nbsp;       self._PcdCodeValue =3D self._PcdC= odeValue + "\n " + ValuePart
+            &= nbsp;       self._CurrentLine =3D "|&quo= t;.join((self._CurrentPcdName, self._PcdCodeValue, RestofValue))
+            &= nbsp;       self._PcdDataTypeCODE =3D False +            &= nbsp;       self._PcdCodeValue =3D "&quo= t;
+            &= nbsp;   else:
+            &= nbsp;       self._PcdCodeValue =3D self._PcdC= odeValue + "\n " + self._CurrentLine
+            &= nbsp;       self._ValueList =3D None
+            &= nbsp;       return
+            TokenL= ist =3D GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
+            self._= CurrentPcdName =3D TokenList[0]
+            if len= (TokenList) =3D=3D 2 and TokenList[1].strip().startswith("{CODE")= :
+            &= nbsp;   if ")}" in self._CurrentLine:
+            &= nbsp;       self._PcdDataTypeCODE =3D False +            &= nbsp;       self._PcdCodeValue =3D "&quo= t;
+            &= nbsp;   else:
+            &= nbsp;       self._PcdDataTypeCODE =3D True +            &= nbsp;       self._PcdCodeValue =3D TokenList[= 1].strip()
+            &= nbsp;       self._ValueList =3D None
+            &= nbsp;       return
+
+            self._= ValueList[0:1] =3D GetSplitValueList(TokenList[0], TAB_SPLIT)
+            ValueR= e =3D re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*')
+            # chec= k PCD information
+            if sel= f._ValueList[0] =3D=3D '' or self._ValueList[1] =3D=3D '':
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID, "No token = space GUID or PCD name specified",
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine + \ +            &= nbsp;           &nbs= p;            &= nbsp;    " (<TokenSpaceGuidCName>.<PcdCName>= ;|<DefaultValue>|<DatumType>|<Token>)",
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex+1)
+            # chec= k format of token space GUID CName
+            if not= ValueRe.match(self._ValueList[0]):
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID,
+            &= nbsp;           &nbs= p;       "The format of the token space = GUID CName is invalid. The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'"= ,
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine + \ +            &= nbsp;           &nbs= p;            &= nbsp;    " (<TokenSpaceGuidCName>.<PcdCName>= ;|<DefaultValue>|<DatumType>|<Token>)",
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex + 1)
+            # chec= k format of PCD CName
+            if not= ValueRe.match(self._ValueList[1]):
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID,
+            &= nbsp;           &nbs= p;       "The format of the PCD CName is= invalid. The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'",
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine + \ +            &= nbsp;           &nbs= p;            &= nbsp;    " (<TokenSpaceGuidCName>.<PcdCName>= ;|<DefaultValue>|<DatumType>|<Token>)",
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex + 1)
+
+            # chec= k PCD datum information
+            if len= (TokenList) < 2 or TokenList[1] =3D=3D '':
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID, "No PCD Da= tum information given",
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine + \ +            &= nbsp;           &nbs= p;            &= nbsp;    " (<TokenSpaceGuidCName>.<PcdCName>= ;|<DefaultValue>|<DatumType>|<Token>)",
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex+1)
+
+
+            ValueR= e =3D re.compile(r'^\s*L?\".*\|.*\"')
+            PtrVal= ue =3D ValueRe.findall(TokenList[1])
+
+            # Has = VOID* type string, may contain "|" character in the string.
+            if len= (PtrValue) !=3D 0:
+            &= nbsp;   ptrValueList =3D re.sub(ValueRe, '', TokenList[1])
+            &= nbsp;   ValueList =3D AnalyzePcdExpression(ptrValueList)
+            &= nbsp;   ValueList[0] =3D PtrValue[0]
+            else:<= br> +            &= nbsp;   ValueList =3D AnalyzePcdExpression(TokenList[1])
+
+
+            # chec= k if there's enough datum information given
+            if len= (ValueList) !=3D 3:
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID, "Invalid P= CD Datum information given",
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine + \ +            &= nbsp;           &nbs= p;            &= nbsp;    " (<TokenSpaceGuidCName>.<PcdCName>= ;|<DefaultValue>|<DatumType>|<Token>)",
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex + 1)
+            # chec= k default value
+            if Val= ueList[0] =3D=3D '':
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID, "Missing D= efaultValue in PCD Datum information",
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine + \ +            &= nbsp;           &nbs= p;            &= nbsp;    " (<TokenSpaceGuidCName>.<PcdCName>= ;|<DefaultValue>|<DatumType>|<Token>)",
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex + 1)
+            # chec= k datum type
+            if Val= ueList[1] =3D=3D '':
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID, "Missing D= atumType in PCD Datum information",
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine + \ +            &= nbsp;           &nbs= p;            &= nbsp;    " (<TokenSpaceGuidCName>.<PcdCName>= ;|<DefaultValue>|<DatumType>|<Token>)",
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex + 1)
+            # chec= k token of the PCD
+            if Val= ueList[2] =3D=3D '':
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID, "Missing T= oken in PCD Datum information",
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine + \ +            &= nbsp;           &nbs= p;            &= nbsp;    " (<TokenSpaceGuidCName>.<PcdCName>= ;|<DefaultValue>|<DatumType>|<Token>)",
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex + 1)
+
+            PcdVal= ue =3D ValueList[0]
+            if Pcd= Value:
+            &= nbsp;   try:
+            &= nbsp;       self._GuidDict.update(self._AllPc= dDict)
+            &= nbsp;       ValueList[0] =3D ValueExpressionE= x(ValueList[0], ValueList[1], self._GuidDict)(True)
+            &= nbsp;   except BadExpression as Value:
+            &= nbsp;       EdkLogger.error('Parser', FORMAT_= INVALID, Value, ExtraData=3Dself._CurrentLine, File=3Dself.MetaFile, Line= =3Dself._LineIndex + 1)
+            # chec= k format of default value against the datum type
+            IsVali= d, Cause =3D CheckPcdDatum(ValueList[1], ValueList[0])
+            if not= IsValid:
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraDat= a=3Dself._CurrentLine,
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex + 1)
+
+            if Cau= se =3D=3D "StructurePcd":
+            &= nbsp;   self._CurrentStructurePcdName =3D TAB_SPLIT.join(self._Va= lueList[0:2])
+            &= nbsp;   self._ValueList[0] =3D self._CurrentStructurePcdName
+            &= nbsp;   self._ValueList[1] =3D ValueList[1].strip()
+
+            if Val= ueList[0] in ['True', 'true', 'TRUE']:
+            &= nbsp;   ValueList[0] =3D '1'
+            elif V= alueList[0] in ['False', 'false', 'FALSE']:
+            &= nbsp;   ValueList[0] =3D '0'
+
+            # chec= k for duplicate PCD definition
+            if (se= lf._Scope[0], self._ValueList[0], self._ValueList[1]) in self._AllPCDs:
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID,
+            &= nbsp;           &nbs= p;       "The same PCD name and GUID hav= e been already defined",
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine, File= =3Dself.MetaFile, Line=3Dself._LineIndex + 1)
+            else:<= br> +            &= nbsp;   self._AllPCDs.append((self._Scope[0], self._ValueList[0],= self._ValueList[1]))
+            &= nbsp;   self._AllPcdDict[TAB_SPLIT.join(self._ValueList[0:2])] = =3D ValueList[0]
+
+            self._= ValueList[2] =3D ValueList[0].strip() + '|' + ValueList[1].strip() + '|' + = ValueList[2].strip()
 
     _SectionParser =3D {
         MODEL_META_DATA_HEADER&nb= sp;         :   MetaFileP= arser._DefineParser,
--
2.26.2.windows.1





 

--_000_MW4PR21MB190714F1689BD80D7A8D8BFEEF7B9MW4PR21MB1907namp_--