]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/GlobalData.py
BaseTools: GlobalData Add a regular expression for a hex number
[mirror_edk2.git] / BaseTools / Source / Python / Common / GlobalData.py
index 4a85a8e0db63ccf5d26055bc012d0d657abbd156..fab67601a9e5f49c4bdcc023f5caf65805119736 100644 (file)
@@ -52,12 +52,17 @@ gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+")
 gMacroNamePattern = re.compile("^{}$".format(_MacroNamePattern))\r
 \r
 # definition for a GUID.  used to create regular expressions below.\r
-_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}"\r
+_HexChar = r"[0-9a-fA-F]"\r
+_GuidPattern = r"{Hex}{{8}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{12}}".format(Hex=_HexChar)\r
 \r
 ## Regular expressions for GUID matching\r
 gGuidPattern = re.compile(r'{}'.format(_GuidPattern))\r
 gGuidPatternEnd = re.compile(r'{}$'.format(_GuidPattern))\r
 \r
+## Regular expressions for HEX matching\r
+g4HexChar = re.compile(r'{}{{4}}'.format(_HexChar))\r
+gHexPattern = re.compile(r'0[xX]{}+'.format(_HexChar))\r
+\r
 #\r
 # A global variable for whether current build in AutoGen phase or not.\r
 #\r