## @file
# This file contained the parser for sections in INF file
#
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
# distribution. The full text of the license may be found at
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
'''
InfSectionParser
'''
##
# Import Modules
#
import re
## GetSpecialStr2
#
# GetSpecialStr2
#
Str2 = ''
#
# S2 may be Platform or ModuleType
#
#
# Except [LibraryClass], [Depex]
# section can has more than 2 items in section header string,
# others should report error.
#
#
# Except [UserExtension]
# section can has 4 items in section header string,
# others should report error.
#
if not ItemList[0].upper() == DT.TAB_USER_EXTENSIONS.upper() or ItemList[0].upper() == DT.TAB_DEPEX.upper():
else:
return Str2
## ProcessUseExtHeader
#
#
NewItemList = []
AppendContent = ''
#
# Should not have an userId or IdString not starts with " before but ends with ".
#
if not CompleteFlag:
return False, []
AppendContent = ''
#
# Common item, not need to combine the information
#
else:
if not CompleteFlag:
else:
return False, []
return True, NewItemList
## GetArch
#
# GetArch
#
#
# S1 is always Arch
#
else:
Arch = 'COMMON'
#
# 'COMMON' must not be used with specific ARCHs at the same section
#
## InfSectionParser
#
# Inherit from object
#
#
# Parser objects used to implement singleton
#
MetaFiles = {}
## Factory method
#
# One file, one parser object. This factory method makes sure that there's
# only one object constructed for one meta file.
#
# @param Class class object of real AutoGen class
# (InfParser, DecParser or DscParser)
# @param FilePath The path of meta file
#
if args:
pass
if kwargs:
pass
else:
return ParserObject
#
# Initialize all objects that an INF file will generated.
#
#
# A List for store define section content.
#
self._PcdNameList = []
#
# File Header content parser
#
#
# Not process file name now, for later usage.
#
pass
#
# Insert Abstract, Description, CopyRight, License into header object
#
## Section header parser
#
# The section header is always in following format:
#
# [section_name.arch<.platform|module_type>]
#
# @param String A string contained the content need to be parsed.
#
_Scope = []
_SectionName = ''
_ValueList = []
]
if Item == '':
#
# different section should not mix in one section
# Allow different PCD type sections mixed together
#
else:
#
# Get Arch
#
#
# For [Defines] section, do special check.
#
#
# For [UserExtension] section, do special check.
#
if not RetValue[0]:
else:
#
# For Library classes, need to check module type.
#
for Item in ModuleTypeList:
#
# GetSpecialStr2
#
_NewValueList = []
for ValueItem in _ValueList:
if _AppendFlag:
else:
## GenSpecialSectionList
#
# @param SpecialSectionList: a list of list, of which item's format
# (Comment, LineNum)
# @param ContainerFile: Input value for filename of Inf file
#
def InfSpecialCommentParser (self, SpecialSectionList, InfSectionObject, ContainerFile, SectionType):
pass
SpecialObjectList = []
ArchList = []
else:
for List in SpecialSectionList:
#
# Hob has Arch attribute, need to be handled specially here
#
ArchList = []
CommentSoFar = ''
if HelpText is None:
HelpText = ''
HelpText += '\n'
else:
if HelpText:
else:
CommentSoFar = ''
)