diff options
author | Carsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben> | 2018-03-24 01:48:56 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-03-29 08:54:35 +0800 |
commit | 256e2d885b053a6c6a04bf3b3eaffe128c023ba7 (patch) | |
tree | 9e350964d8166f4d40a13b66850335607b074779 /BaseTools/Source/Python/Common | |
parent | cd67d66484e44af587183d52f0affa9105547518 (diff) | |
download | edk2-256e2d885b053a6c6a04bf3b3eaffe128c023ba7.tar.gz edk2-256e2d885b053a6c6a04bf3b3eaffe128c023ba7.tar.bz2 edk2-256e2d885b053a6c6a04bf3b3eaffe128c023ba7.zip |
BaseTools: Regular Expressions refactor out the hex char for later reuse
move hex character info from GUID expressions into seperate variable to
facilitate reuse.
I had a type with insufficient {} in the first version.
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@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/Common')
-rw-r--r-- | BaseTools/Source/Python/Common/GlobalData.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Source/Python/Common/GlobalData.py index 4a85a8e0db..3933e86cb9 100644 --- a/BaseTools/Source/Python/Common/GlobalData.py +++ b/BaseTools/Source/Python/Common/GlobalData.py @@ -52,7 +52,8 @@ gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+") gMacroNamePattern = re.compile("^{}$".format(_MacroNamePattern))
# definition for a GUID. used to create regular expressions below.
-_GuidPattern = r"[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"
+_HexChar = r"[0-9a-fA-F]"
+_GuidPattern = r"{Hex}{{8}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{12}}".format(Hex=_HexChar)
## Regular expressions for GUID matching
gGuidPattern = re.compile(r'{}'.format(_GuidPattern))
|