mirror of https://github.com/acidanthera/audk.git
BaseTools: Fix parsing multiple nest !include issue
Fix the bug !include file in Components subsection meet syntax error. Case example: DSC components: !include Test1.txt Test1.txt: TestPkg/TestDriver.inf { <PcdsFixedAtBuild> PcdToken.PcdTest1 | "A" !include Test2.txt } Test2.txt: !include Test3.txt Test3.txt: PcdToken.PcdTest2 | "B" Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
This commit is contained in:
parent
1e2bf55e09
commit
cd7bd491f3
|
@ -944,6 +944,13 @@ class DscParser(MetaFileParser):
|
||||||
self._SubsectionType = MODEL_META_DATA_SUBSECTION_HEADER
|
self._SubsectionType = MODEL_META_DATA_SUBSECTION_HEADER
|
||||||
# directive line
|
# directive line
|
||||||
elif Line[0] == '!':
|
elif Line[0] == '!':
|
||||||
|
TokenList = GetSplitValueList(Line, ' ', 1)
|
||||||
|
if TokenList[0] == TAB_INCLUDE:
|
||||||
|
for Arch, ModuleType, DefaultStore in self._Scope:
|
||||||
|
if self._SubsectionType != MODEL_UNKNOWN and Arch in OwnerId:
|
||||||
|
self._Owner[-1] = OwnerId[Arch]
|
||||||
|
self._DirectiveParser()
|
||||||
|
else:
|
||||||
self._DirectiveParser()
|
self._DirectiveParser()
|
||||||
continue
|
continue
|
||||||
if Line[0] == TAB_OPTION_START and not self._InSubsection:
|
if Line[0] == TAB_OPTION_START and not self._InSubsection:
|
||||||
|
@ -965,7 +972,7 @@ class DscParser(MetaFileParser):
|
||||||
#
|
#
|
||||||
for Arch, ModuleType, DefaultStore in self._Scope:
|
for Arch, ModuleType, DefaultStore in self._Scope:
|
||||||
Owner = self._Owner[-1]
|
Owner = self._Owner[-1]
|
||||||
if self._SubsectionType != MODEL_UNKNOWN:
|
if self._SubsectionType != MODEL_UNKNOWN and Arch in OwnerId:
|
||||||
Owner = OwnerId[Arch]
|
Owner = OwnerId[Arch]
|
||||||
self._LastItem = self._Store(
|
self._LastItem = self._Store(
|
||||||
self._ItemType,
|
self._ItemType,
|
||||||
|
@ -1190,6 +1197,7 @@ class DscParser(MetaFileParser):
|
||||||
if self._CurrentLine[-1] == '{':
|
if self._CurrentLine[-1] == '{':
|
||||||
self._ValueList[0] = self._CurrentLine[0:-1].strip()
|
self._ValueList[0] = self._CurrentLine[0:-1].strip()
|
||||||
self._InSubsection = True
|
self._InSubsection = True
|
||||||
|
self._SubsectionType = MODEL_UNKNOWN
|
||||||
else:
|
else:
|
||||||
self._ValueList[0] = self._CurrentLine
|
self._ValueList[0] = self._CurrentLine
|
||||||
|
|
||||||
|
@ -1562,24 +1570,14 @@ class DscParser(MetaFileParser):
|
||||||
|
|
||||||
# set the parser status with current status
|
# set the parser status with current status
|
||||||
Parser._SectionName = self._SectionName
|
Parser._SectionName = self._SectionName
|
||||||
if self._InSubsection:
|
Parser._SubsectionType = self._SubsectionType
|
||||||
Parser._SectionType = self._SubsectionType
|
Parser._InSubsection = self._InSubsection
|
||||||
else:
|
|
||||||
Parser._SectionType = self._SectionType
|
Parser._SectionType = self._SectionType
|
||||||
Parser._Scope = self._Scope
|
Parser._Scope = self._Scope
|
||||||
Parser._Enabled = self._Enabled
|
Parser._Enabled = self._Enabled
|
||||||
# Parse the included file
|
# Parse the included file
|
||||||
Parser.Start()
|
Parser.Start()
|
||||||
|
|
||||||
# update current status with sub-parser's status
|
|
||||||
self._SectionName = Parser._SectionName
|
|
||||||
if not self._InSubsection:
|
|
||||||
self._SectionType = Parser._SectionType
|
|
||||||
self._SubsectionType = Parser._SubsectionType
|
|
||||||
self._InSubsection = Parser._InSubsection
|
|
||||||
|
|
||||||
self._Scope = Parser._Scope
|
|
||||||
self._Enabled = Parser._Enabled
|
|
||||||
|
|
||||||
# Insert all records in the table for the included file into dsc file table
|
# Insert all records in the table for the included file into dsc file table
|
||||||
Records = IncludedFileTable.GetAll()
|
Records = IncludedFileTable.GetAll()
|
||||||
|
|
Loading…
Reference in New Issue