diff options
author | Carsey, Jaben <jaben.carsey@intel.com> | 2018-04-20 23:51:24 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-04-26 14:35:36 +0800 |
commit | 3e4faa268e2fafb119fdf5f48a9fcc111f9dc62e (patch) | |
tree | 51114fbe63388fa5b2dc1ccf31f0d9e25484ea12 /BaseTools/Source/Python/Workspace/DscBuildData.py | |
parent | ef42ef7e6dd70112ce2af1757e765b7bcde7a70a (diff) | |
download | edk2-3e4faa268e2fafb119fdf5f48a9fcc111f9dc62e.tar.gz edk2-3e4faa268e2fafb119fdf5f48a9fcc111f9dc62e.tar.bz2 edk2-3e4faa268e2fafb119fdf5f48a9fcc111f9dc62e.zip |
BaseTools: Workspace - refactor RegEx to minimize multiple compiling
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>
Diffstat (limited to 'BaseTools/Source/Python/Workspace/DscBuildData.py')
-rw-r--r-- | BaseTools/Source/Python/Workspace/DscBuildData.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 7e3187fb5d..e335b3df85 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -89,6 +89,8 @@ MAKEROOT ?= $(EDK_TOOLS_PATH)/Source/C LIBS = -lCommon
'''
+variablePattern = re.compile(r'[\t\s]*0[xX][a-fA-F0-9]+$')
+
## regular expressions for finding decimal and hex numbers
Pattern = re.compile('^[1-9]\d*|0$')
HexPattern = re.compile(r'0[xX][0-9a-fA-F]+$')
@@ -2415,7 +2417,7 @@ class DscBuildData(PlatformBuildClassObject): if VariableOffset.isdigit():
if int(VariableOffset, 10) > 0xFFFF:
ExceedMax = True
- elif re.match(r'[\t\s]*0[xX][a-fA-F0-9]+$', VariableOffset):
+ elif variablePattern.match(VariableOffset):
if int(VariableOffset, 16) > 0xFFFF:
ExceedMax = True
# For Offset written in "A.B"
|