BaseTools: Clean up source files
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
## @file
|
||||
# This file contained the parser for [Pcds] sections in INF file
|
||||
# This file contained the parser for [Pcds] sections in INF file
|
||||
#
|
||||
# Copyright (c) 2011 - 2018, 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
|
||||
# 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
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@ -31,49 +31,49 @@ from Parser.InfParserMisc import InfParserSectionRoot
|
||||
|
||||
class InfPcdSectionParser(InfParserSectionRoot):
|
||||
## Section PCD related parser
|
||||
#
|
||||
#
|
||||
# For 5 types of PCD list below, all use this function.
|
||||
# 'FixedPcd', 'FeaturePcd', 'PatchPcd', 'Pcd', 'PcdEx'
|
||||
#
|
||||
# This is a INF independent parser, the validation in this parser only
|
||||
# This is a INF independent parser, the validation in this parser only
|
||||
# cover
|
||||
# INF spec scope, will not cross DEC/DSC to check pcd value
|
||||
#
|
||||
def InfPcdParser(self, SectionString, InfSectionObject, FileName):
|
||||
KeysList = []
|
||||
PcdList = []
|
||||
CommentsList = []
|
||||
ValueList = []
|
||||
CommentsList = []
|
||||
ValueList = []
|
||||
#
|
||||
# Current section archs
|
||||
#
|
||||
#
|
||||
LineIndex = -1
|
||||
for Item in self.LastSectionHeaderContent:
|
||||
if (Item[0], Item[1], Item[3]) not in KeysList:
|
||||
KeysList.append((Item[0], Item[1], Item[3]))
|
||||
LineIndex = Item[3]
|
||||
|
||||
|
||||
if (Item[0].upper() == DT.TAB_INF_FIXED_PCD.upper() or \
|
||||
Item[0].upper() == DT.TAB_INF_FEATURE_PCD.upper() or \
|
||||
Item[0].upper() == DT.TAB_INF_PCD.upper()) and GlobalData.gIS_BINARY_INF:
|
||||
Logger.Error('InfParser', FORMAT_INVALID, ST.ERR_ASBUILD_PCD_SECTION_TYPE%("\"" + Item[0] + "\""),
|
||||
File=FileName, Line=LineIndex)
|
||||
|
||||
File=FileName, Line=LineIndex)
|
||||
|
||||
#
|
||||
# For Common INF file
|
||||
#
|
||||
if not GlobalData.gIS_BINARY_INF:
|
||||
if not GlobalData.gIS_BINARY_INF:
|
||||
#
|
||||
# Macro defined in this section
|
||||
# Macro defined in this section
|
||||
#
|
||||
SectionMacros = {}
|
||||
SectionMacros = {}
|
||||
for Line in SectionString:
|
||||
PcdLineContent = Line[0]
|
||||
PcdLineNo = Line[1]
|
||||
if PcdLineContent.strip() == '':
|
||||
CommentsList = []
|
||||
continue
|
||||
|
||||
continue
|
||||
|
||||
if PcdLineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
|
||||
CommentsList.append(Line)
|
||||
continue
|
||||
@ -83,10 +83,10 @@ class InfPcdSectionParser(InfParserSectionRoot):
|
||||
#
|
||||
if PcdLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
|
||||
CommentsList.append((
|
||||
PcdLineContent[PcdLineContent.find(DT.TAB_COMMENT_SPLIT):],
|
||||
PcdLineContent[PcdLineContent.find(DT.TAB_COMMENT_SPLIT):],
|
||||
PcdLineNo))
|
||||
PcdLineContent = PcdLineContent[:PcdLineContent.find(DT.TAB_COMMENT_SPLIT)]
|
||||
|
||||
PcdLineContent = PcdLineContent[:PcdLineContent.find(DT.TAB_COMMENT_SPLIT)]
|
||||
|
||||
if PcdLineContent != '':
|
||||
#
|
||||
# Find Macro
|
||||
@ -100,23 +100,23 @@ class InfPcdSectionParser(InfParserSectionRoot):
|
||||
ValueList = []
|
||||
CommentsList = []
|
||||
continue
|
||||
|
||||
|
||||
PcdEntryReturn = SplitPcdEntry(PcdLineContent)
|
||||
|
||||
|
||||
if not PcdEntryReturn[1]:
|
||||
TokenList = ['']
|
||||
TokenList = ['']
|
||||
else:
|
||||
TokenList = PcdEntryReturn[0]
|
||||
|
||||
|
||||
ValueList[0:len(TokenList)] = TokenList
|
||||
|
||||
|
||||
#
|
||||
# Replace with Local section Macro and [Defines] section Macro.
|
||||
#
|
||||
ValueList = [InfExpandMacro(Value, (FileName, PcdLineContent, PcdLineNo),
|
||||
#
|
||||
ValueList = [InfExpandMacro(Value, (FileName, PcdLineContent, PcdLineNo),
|
||||
self.FileLocalMacros, SectionMacros, True)
|
||||
for Value in ValueList]
|
||||
|
||||
|
||||
if len(ValueList) >= 1:
|
||||
PcdList.append((ValueList, CommentsList, (PcdLineContent, PcdLineNo, FileName)))
|
||||
ValueList = []
|
||||
@ -129,11 +129,11 @@ class InfPcdSectionParser(InfParserSectionRoot):
|
||||
for Line in SectionString:
|
||||
LineContent = Line[0].strip()
|
||||
LineNo = Line[1]
|
||||
|
||||
|
||||
if LineContent == '':
|
||||
CommentsList = []
|
||||
continue
|
||||
|
||||
|
||||
if LineContent.startswith(DT.TAB_COMMENT_SPLIT):
|
||||
CommentsList.append(LineContent)
|
||||
continue
|
||||
@ -144,7 +144,7 @@ class InfPcdSectionParser(InfParserSectionRoot):
|
||||
if CommentIndex > -1:
|
||||
CommentsList.append(LineContent[CommentIndex+1:])
|
||||
LineContent = LineContent[:CommentIndex]
|
||||
|
||||
|
||||
TokenList = GetSplitValueList(LineContent, DT.TAB_VALUE_SPLIT)
|
||||
#
|
||||
# PatchablePcd
|
||||
@ -152,33 +152,33 @@ class InfPcdSectionParser(InfParserSectionRoot):
|
||||
#
|
||||
if KeysList[0][0].upper() == DT.TAB_INF_PATCH_PCD.upper():
|
||||
if len(TokenList) != 3:
|
||||
Logger.Error('InfParser',
|
||||
FORMAT_INVALID,
|
||||
Logger.Error('InfParser',
|
||||
FORMAT_INVALID,
|
||||
ST.ERR_ASBUILD_PATCHPCD_FORMAT_INVALID,
|
||||
File=FileName,
|
||||
Line=LineNo,
|
||||
ExtraData=LineContent)
|
||||
#
|
||||
#
|
||||
elif KeysList[0][0].upper() == DT.TAB_INF_PCD_EX.upper():
|
||||
if len(TokenList) != 1:
|
||||
Logger.Error('InfParser',
|
||||
FORMAT_INVALID,
|
||||
Logger.Error('InfParser',
|
||||
FORMAT_INVALID,
|
||||
ST.ERR_ASBUILD_PCDEX_FORMAT_INVALID,
|
||||
File=FileName,
|
||||
Line=LineNo,
|
||||
ExtraData=LineContent)
|
||||
ValueList[0:len(TokenList)] = TokenList
|
||||
if len(ValueList) >= 1:
|
||||
PcdList.append((ValueList, CommentsList, (LineContent, LineNo, FileName)))
|
||||
if len(ValueList) >= 1:
|
||||
PcdList.append((ValueList, CommentsList, (LineContent, LineNo, FileName)))
|
||||
ValueList = []
|
||||
CommentsList = []
|
||||
continue
|
||||
|
||||
if not InfSectionObject.SetPcds(PcdList, KeysList = KeysList,
|
||||
continue
|
||||
|
||||
if not InfSectionObject.SetPcds(PcdList, KeysList = KeysList,
|
||||
PackageInfo = self.InfPackageSection.GetPackages()):
|
||||
Logger.Error('InfParser',
|
||||
FORMAT_INVALID,
|
||||
Logger.Error('InfParser',
|
||||
FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR%("[PCD]"),
|
||||
File=FileName,
|
||||
Line=LineIndex)
|
||||
|
||||
Line=LineIndex)
|
||||
|
||||
|
Reference in New Issue
Block a user