diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-11-09 04:32:08 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-11-09 04:32:08 +0000 |
commit | d40b2ee60ef161044bcaf05a8b36aa60eac633cc (patch) | |
tree | 1a74bea930f47fe2bb8f9d07d0151c6c7d9adac3 /BaseTools/Source/Python/GenFds | |
parent | 080681592188f45228616983f9e1610ab9e86615 (diff) | |
download | edk2-platforms-d40b2ee60ef161044bcaf05a8b36aa60eac633cc.tar.xz |
Sync BaseTool trunk (version r2397) into EDKII BaseTools. The change mainly includes
1. Fix the issue that root directory of disk can’t be used as WORKSPACE.
2. Update AutoGen code style to pass C++ compiler.
Signed-off-by: lgao4
Reviewed-by: jsu1
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12676 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/GenFds')
-rw-r--r-- | BaseTools/Source/Python/GenFds/FdfParser.py | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index e3a018c66c..358215d662 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -1118,6 +1118,34 @@ class FdfParser: def SetFileBufferPos(self, Pos):
(self.CurrentLineNumber, self.CurrentOffsetWithinLine) = Pos
+ ## Preprocess() method
+ #
+ # Preprocess comment, conditional directive, include directive, replace macro.
+ # Exception will be raised if syntax error found
+ #
+ # @param self The object pointer
+ #
+ def Preprocess(self):
+ self.__StringToList()
+ self.PreprocessFile()
+ self.PreprocessIncludeFile()
+ self.__StringToList()
+ self.PreprocessFile()
+ self.PreprocessConditionalStatement()
+ self.__StringToList()
+ for Pos in self.__WipeOffArea:
+ self.__ReplaceFragment(Pos[0], Pos[1])
+ self.Profile.FileLinesList = ["".join(list) for list in self.Profile.FileLinesList]
+
+ while self.__GetDefines():
+ pass
+
+ Index = 0
+ while Index < len(self.Profile.FileLinesList):
+ FileLineTuple = GetRealFileLine(self.FileName, Index + 1)
+ self.Profile.FileLinesList[Index] = self.__ReplaceMacros(self.Profile.FileLinesList[Index], FileLineTuple[0], FileLineTuple[1])
+ Index += 1
+
## ParseFile() method
#
# Parse the file profile buffer to extract fd, fv ... information
@@ -1128,26 +1156,7 @@ class FdfParser: def ParseFile(self):
try:
- self.__StringToList()
- self.PreprocessFile()
- self.PreprocessIncludeFile()
- self.__StringToList()
- self.PreprocessFile()
- self.PreprocessConditionalStatement()
- self.__StringToList()
- for Pos in self.__WipeOffArea:
- self.__ReplaceFragment(Pos[0], Pos[1])
- self.Profile.FileLinesList = ["".join(list) for list in self.Profile.FileLinesList]
-
- while self.__GetDefines():
- pass
-
- Index = 0
- while Index < len(self.Profile.FileLinesList):
- FileLineTuple = GetRealFileLine(self.FileName, Index + 1)
- self.Profile.FileLinesList[Index] = self.__ReplaceMacros(self.Profile.FileLinesList[Index], FileLineTuple[0], FileLineTuple[1])
- Index += 1
-
+ self.Preprocess()
while self.__GetFd():
pass
|