BaseTools: use new RegEx from FdfParserLite

FdfParser has identical one.  import and share.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Carsey, Jaben 2018-03-30 05:38:07 +08:00 committed by Yonghong Zhu
parent 4f9e71e1f7
commit 147a656b34
1 changed files with 5 additions and 7 deletions

View File

@ -60,7 +60,7 @@ from Common.LongFilePathSupport import OpenLongFilePath as open
from Capsule import EFI_CERT_TYPE_PKCS7_GUID
from Capsule import EFI_CERT_TYPE_RSA2048_SHA256_GUID
from Common.RangeExpression import RangeExpression
from Common.FdfParserLite import FileExtensionPattern
from Common.FdfParserLite import FileExtensionPattern,TokenFindPattern
##define T_CHAR_SPACE ' '
##define T_CHAR_NULL '\0'
@ -2797,12 +2797,11 @@ class FdfParser:
def __GetFileOpts(self, FfsFileObj):
if self.__GetNextToken():
Pattern = re.compile(r'([a-zA-Z0-9\-]+|\$\(TARGET\)|\*)_([a-zA-Z0-9\-]+|\$\(TOOL_CHAIN_TAG\)|\*)_([a-zA-Z0-9\-]+|\$\(ARCH\)|\*)')
if Pattern.match(self.__Token):
if TokenFindPattern.match(self.__Token):
FfsFileObj.KeyStringList.append(self.__Token)
if self.__IsToken(","):
while self.__GetNextToken():
if not Pattern.match(self.__Token):
if not TokenFindPattern.match(self.__Token):
raise Warning("expected KeyString \"Target_Tag_Arch\"", self.FileName, self.CurrentLineNumber)
FfsFileObj.KeyStringList.append(self.__Token)
@ -3746,12 +3745,11 @@ class FdfParser:
KeyStringList = []
if self.__GetNextToken():
Pattern = re.compile(r'([a-zA-Z0-9\-]+|\$\(TARGET\)|\*)_([a-zA-Z0-9\-]+|\$\(TOOL_CHAIN_TAG\)|\*)_([a-zA-Z0-9\-]+|\$\(ARCH\)|\*)')
if Pattern.match(self.__Token):
if TokenFindPattern.match(self.__Token):
KeyStringList.append(self.__Token)
if self.__IsToken(","):
while self.__GetNextToken():
if not Pattern.match(self.__Token):
if not TokenFindPattern.match(self.__Token):
raise Warning("expected KeyString \"Target_Tag_Arch\"", self.FileName, self.CurrentLineNumber)
KeyStringList.append(self.__Token)