1. Add a checkpoint to ignore commented "[]" section
authorhche10x <hche10x@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 12 Dec 2007 03:29:54 +0000 (03:29 +0000)
committerhche10x <hche10x@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 12 Dec 2007 03:29:54 +0000 (03:29 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@921 7335b38e-4728-0410-8992-fb3ffe349368

Source/Python/Common/DecClassObject.py
Source/Python/Common/DscClassObject.py
Source/Python/Common/InfClassObject.py
Source/Python/Common/String.py

index 4337f78..2b51658 100644 (file)
@@ -181,7 +181,7 @@ class Dec(DecObject):
         self.Identification.FileRelativePath = Filepath\r
         \r
         F = open(Filename, 'r').read()\r
-        PreCheck(Filename, F, self.KeyList)\r
+        F = PreCheck(Filename, F, self.KeyList)\r
         Sects = F.split(DataType.TAB_SECTION_START)\r
         for Sect in Sects:\r
             TabList = GetSplitValueList(Sect.split(TAB_SECTION_END, 1)[0], DataType.TAB_COMMA_SPLIT)\r
index 01f095c..82c2806 100755 (executable)
@@ -224,7 +224,7 @@ class Dsc(DscObject):
         self.Identification.FileRelativePath = Filepath\r
 \r
         F = open(Filename, 'r').read()\r
-        PreCheck(Filename, F, self.KeyList)\r
+        F = PreCheck(Filename, F, self.KeyList)\r
         Sects = F.split(DataType.TAB_SECTION_START)\r
         for Sect in Sects:\r
             TabList = GetSplitValueList(Sect.split(TAB_SECTION_END, 1)[0], DataType.TAB_COMMA_SPLIT)\r
index d423fca..ae944c2 100755 (executable)
@@ -673,7 +673,7 @@ class Inf(InfObject):
         self.Identification.FileRelativePath = Filepath\r
         \r
         F = open(Filename, 'r').read()\r
-        PreCheck(Filename, F, self.KeyList)\r
+        F = PreCheck(Filename, F, self.KeyList)\r
         Sects = F.split(DataType.TAB_SECTION_START)\r
         for Sect in Sects:\r
             TabList = GetSplitValueList(Sect.split(TAB_SECTION_END, 1)[0], DataType.TAB_COMMA_SPLIT)\r
index f34e217..94b2400 100644 (file)
@@ -495,9 +495,19 @@ def GetSingleValueOfKeyFromLines(Lines, Dictionary, CommentCharacter, KeySplitCh
 def PreCheck(FileName, FileContent, SupSectionTag):\r
     LineNo = 0\r
     IsFailed = False\r
+    NewFileContent = ''\r
     for Line in FileContent.splitlines():\r
         LineNo = LineNo + 1\r
+        #\r
+        # Clean current line\r
+        #\r
         Line = CleanString(Line)\r
+        \r
+        #\r
+        # Remove commented line\r
+        #\r
+        if Line.find(DataType.TAB_COMMA_SPLIT) == 0:\r
+            Line = ''\r
         #\r
         # Check $()\r
         #\r
@@ -528,9 +538,16 @@ def PreCheck(FileName, FileContent, SupSectionTag):
                 if Tag.upper() not in map(lambda s: s.upper(), SupSectionTag):\r
                     ErrorMsg = "'%s' is not a supportted section name." % Tag\r
                     EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=FileName, Line=LineNo)\r
+        \r
+        #\r
+        # Regenerate FileContent\r
+        #\r
+        NewFileContent = NewFileContent + Line + '\r\n'\r
 \r
     if IsFailed:\r
        EdkLogger.error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName)\r
+    \r
+    return NewFileContent\r
 \r
 ## CheckFileType\r
 #\r