]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
BaseTools/ECC: Fix some issues of ECC tool
[mirror_edk2.git] / BaseTools / Source / Python / Ecc / MetaFileWorkspace / MetaFileParser.py
index 1c3e968785adaf55b7352f90eff6a22216f49b10..9f31d4d4de07a7386c2e35c5445467562c621241 100644 (file)
@@ -461,13 +461,14 @@ class InfParser(MetaFileParser):
                                      MODEL_PCD_DYNAMIC_EX,\r
                                      MODEL_PCD_DYNAMIC]:\r
                 Line = Content[Index].strip()\r
-                if Line.startswith(TAB_COMMENT_SPLIT):\r
+                if Line.startswith(TAB_SPECIAL_COMMENT):\r
+                    Usage += ' ' + Line[Line.find(TAB_SPECIAL_COMMENT):]\r
+                    continue\r
+                elif Line.startswith(TAB_COMMENT_SPLIT):\r
                     continue\r
                 elif Line.find(TAB_COMMENT_SPLIT) > 0:\r
-                    Usage = Line[Line.find(TAB_COMMENT_SPLIT):]\r
+                    Usage += ' ' + Line[Line.find(TAB_COMMENT_SPLIT):]\r
                     Line = Line[:Line.find(TAB_COMMENT_SPLIT)]\r
-                else:\r
-                    Usage = ''\r
             else:\r
             # skip empty, commented, block commented lines\r
                 Line = CleanString(Content[Index], AllowCppStyleComment=True)\r
@@ -545,6 +546,7 @@ class InfParser(MetaFileParser):
             # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1\r
             #\r
             self._ValueList[0] = self._ValueList[0].replace('/', '\\')\r
+            Usage = Usage.strip()\r
             for Arch, Platform in self._Scope:\r
                 self._Store(self._SectionType,\r
                             self._ValueList[0],\r
@@ -561,6 +563,7 @@ class InfParser(MetaFileParser):
                             0,\r
                             Usage\r
                             )\r
+            Usage = ''\r
         if IsFindBlockComment:\r
             EdkLogger.error("Parser", FORMAT_INVALID, "Open block comments (starting with /*) are expected to end with */", \r
                             File=self.MetaFile)\r
@@ -731,6 +734,7 @@ class DscParser(MetaFileParser):
         TAB_ELSE_IF.upper()                         :   MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF,\r
         TAB_ELSE.upper()                            :   MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE,\r
         TAB_END_IF.upper()                          :   MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF,\r
+        TAB_ERROR.upper()                           :   MODEL_META_DATA_CONDITIONAL_STATEMENT_ERROR,\r
     }\r
 \r
     # Valid names in define section\r
@@ -1117,6 +1121,7 @@ class DscParser(MetaFileParser):
             MODEL_META_DATA_BUILD_OPTION                    :   self.__ProcessBuildOption,\r
             MODEL_UNKNOWN                                   :   self._Skip,\r
             MODEL_META_DATA_USER_EXTENSION                  :   self._Skip,\r
+            MODEL_META_DATA_CONDITIONAL_STATEMENT_ERROR     :   self._Skip,\r
         }\r
         \r
         self._RawTable = self._Table\r
@@ -1152,9 +1157,10 @@ class DscParser(MetaFileParser):
                 # Only catch expression evaluation error here. We need to report\r
                 # the precise number of line on which the error occurred\r
                 #\r
-                EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt),\r
-                                File=self._FileWithError, ExtraData=' '.join(self._ValueList), \r
-                                Line=self._LineIndex+1)\r
+                pass\r
+#                 EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt),\r
+#                                 File=self._FileWithError, ExtraData=' '.join(self._ValueList),\r
+#                                 Line=self._LineIndex+1)\r
             except MacroException, Excpt:\r
                 EdkLogger.error('Parser', FORMAT_INVALID, str(Excpt),\r
                                 File=self._FileWithError, ExtraData=' '.join(self._ValueList), \r
@@ -1809,7 +1815,10 @@ class Fdf(FdfObject):
         # Load Fdf file if filename is not None\r
         #\r
         if Filename != None:\r
-            self.LoadFdfFile(Filename)\r
+            try:\r
+                self.LoadFdfFile(Filename)\r
+            except Exception:\r
+                pass\r
 \r
     #\r
     # Insert a FDF file record into database\r