## @file\r
-# This file contained the parser for define sections in INF file \r
+# This file contained the parser for define sections in INF file\r
#\r
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
-# This program and the accompanying materials are licensed and made available \r
-# under the terms and conditions of the BSD License which accompanies this \r
-# distribution. The full text of the license may be found at \r
+# This program and the accompanying materials are licensed and made available\r
+# under the terms and conditions of the BSD License which accompanies this\r
+# distribution. The full text of the license may be found at\r
# http://opensource.org/licenses/bsd-license.php\r
#\r
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
from Parser.InfParserMisc import InfParserSectionRoot\r
\r
## __GetValidateArchList\r
-# \r
+#\r
#\r
def GetValidateArchList(LineContent):\r
- \r
+\r
TempArch = ''\r
ArchList = []\r
ValidateAcrhPatten = re.compile(r"^\s*#\s*VALID_ARCHITECTURES\s*=\s*.*$", re.DOTALL)\r
- \r
+\r
if ValidateAcrhPatten.match(LineContent):\r
TempArch = GetSplitValueList(LineContent, DT.TAB_EQUAL_SPLIT, 1)[1]\r
- \r
+\r
TempArch = GetSplitValueList(TempArch, '(', 1)[0]\r
- \r
+\r
ArchList = re.split('\s+', TempArch)\r
NewArchList = []\r
for Arch in ArchList:\r
if IsValidArch(Arch):\r
NewArchList.append(Arch)\r
- \r
+\r
ArchList = NewArchList\r
- \r
- return ArchList \r
+\r
+ return ArchList\r
\r
class InfDefinSectionParser(InfParserSectionRoot):\r
def InfDefineParser(self, SectionString, InfSectionObject, FileName, SectionComment):\r
- \r
+\r
if SectionComment:\r
pass\r
#\r
# Add WORKSPACE to global Marco dict.\r
#\r
self.FileLocalMacros['WORKSPACE'] = GlobalData.gWORKSPACE\r
- \r
+\r
for Line in SectionString:\r
LineContent = Line[0]\r
LineNo = Line[1]\r
TailComments = ''\r
LineComment = None\r
- \r
+\r
LineInfo = ['', -1, '']\r
LineInfo[0] = FileName\r
LineInfo[1] = LineNo\r
LineInfo[2] = LineContent\r
- \r
+\r
if LineContent.strip() == '':\r
continue\r
#\r
SectionContent += LineContent + DT.END_OF_LINE\r
continue\r
#\r
- # First time encounter comment \r
+ # First time encounter comment\r
#\r
else:\r
#\r
continue\r
else:\r
StillCommentFalg = False\r
- \r
+\r
if len(HeaderComments) >= 1:\r
LineComment = InfLineCommentObject()\r
LineCommentContent = ''\r
for Item in HeaderComments:\r
LineCommentContent += Item[0] + DT.END_OF_LINE\r
LineComment.SetHeaderComments(LineCommentContent)\r
- \r
+\r
#\r
# Find Tail comment.\r
#\r
if LineComment is None:\r
LineComment = InfLineCommentObject()\r
LineComment.SetTailComments(TailComments)\r
- \r
+\r
#\r
# Find Macro\r
#\r
- Name, Value = MacroParser((LineContent, LineNo), \r
- FileName, \r
- DT.MODEL_META_DATA_HEADER, \r
+ Name, Value = MacroParser((LineContent, LineNo),\r
+ FileName,\r
+ DT.MODEL_META_DATA_HEADER,\r
self.FileLocalMacros)\r
if Name is not None:\r
self.FileLocalMacros[Name] = Value\r
- continue \r
+ continue\r
\r
#\r
# Replace with [Defines] section Macro\r
#\r
- LineContent = InfExpandMacro(LineContent, \r
- (FileName, LineContent, LineNo), \r
- self.FileLocalMacros, \r
+ LineContent = InfExpandMacro(LineContent,\r
+ (FileName, LineContent, LineNo),\r
+ self.FileLocalMacros,\r
None, True)\r
- \r
+\r
SectionContent += LineContent + DT.END_OF_LINE\r
- \r
+\r
TokenList = GetSplitValueList(LineContent, DT.TAB_EQUAL_SPLIT, 1)\r
if len(TokenList) < 2:\r
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_NO_VALUE,\r
- LineInfo=LineInfo) \r
+ LineInfo=LineInfo)\r
_ValueList[0:len(TokenList)] = TokenList\r
if not _ValueList[0]:\r
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_NO_NAME,\r
LineInfo=LineInfo)\r
if not _ValueList[1]:\r
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_NO_VALUE,\r
- LineInfo=LineInfo) \r
- \r
- Name, Value = _ValueList[0], _ValueList[1] \r
- \r
+ LineInfo=LineInfo)\r
+\r
+ Name, Value = _ValueList[0], _ValueList[1]\r
+\r
InfDefMemberObj = InfDefMember(Name, Value)\r
if (LineComment is not None):\r
InfDefMemberObj.Comments.SetHeaderComments(LineComment.GetHeaderComments())\r
InfDefMemberObj.Comments.SetTailComments(LineComment.GetTailComments())\r
- \r
+\r
InfDefMemberObj.CurrentLine.SetFileName(self.FullPath)\r
InfDefMemberObj.CurrentLine.SetLineString(LineContent)\r
InfDefMemberObj.CurrentLine.SetLineNo(LineNo)\r
- \r
+\r
_ContentList.append(InfDefMemberObj)\r
HeaderComments = []\r
TailComments = ''\r
- \r
+\r
#\r
# Current Define section archs\r
#\r
if not ArchList:\r
ArchList = ['COMMON']\r
- \r
- InfSectionObject.SetAllContent(SectionContent) \r
- \r
+\r
+ InfSectionObject.SetAllContent(SectionContent)\r
+\r
InfSectionObject.SetDefines(_ContentList, Arch=ArchList)\r
-
\ No newline at end of file
+\r