示例#1
0
文件: InfParser.py 项目: lersek/edk2
def _ConvertSecNameToType(SectionName):
    SectionType = ''
    if SectionName.upper() not in gINF_SECTION_DEF.keys():
        SectionType = DT.MODEL_UNKNOWN
    else:
        SectionType = gINF_SECTION_DEF[SectionName.upper()]

    return SectionType
示例#2
0
 def _ProcessLastSection(self, SectionLines, Line, LineNo, CurrentSection):
     #
     # The last line is a section header. will discard it.
     #
     if not (Line.startswith(DT.TAB_SECTION_START) and Line.find(DT.TAB_SECTION_END) > -1):                      
         SectionLines.append((Line, LineNo))
         
     if len(self.SectionHeaderContent) >= 1:
         TemSectionName = self.SectionHeaderContent[0][0].upper()
         if TemSectionName.upper() not in gINF_SECTION_DEF.keys():
             Logger.Error("InfParser", 
                          FORMAT_INVALID, 
                          ST.ERR_INF_PARSER_UNKNOWN_SECTION, 
                          File=self.FullPath, 
                          Line=LineNo, 
                          ExtraData=Line,
                          RaiseError = Logger.IS_RAISE_ERROR
                          ) 
         else:
             CurrentSection = gINF_SECTION_DEF[TemSectionName]
             self.LastSectionHeaderContent = self.SectionHeaderContent
         
     return SectionLines, CurrentSection