]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: FdfParser & FdfParserLite refactor regular expression for GUIDs
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>
Thu, 15 Mar 2018 21:39:07 +0000 (05:39 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Wed, 21 Mar 2018 05:40:15 +0000 (13:40 +0800)
Instead of recompiling it each time the API is called, just use
the global one that exists.

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>
BaseTools/Source/Python/Common/FdfParserLite.py
BaseTools/Source/Python/GenFds/FdfParser.py

index 7d129bfcab5909d77e4bd81918e5beea89580f62..df287414db6f6c847669001ff47eae27a79218d6 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # parse FDF file\r
 #\r
-#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -21,6 +21,7 @@ import Common.LongFilePathOs as os
 import CommonDataClass.FdfClass\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
 from Common.MultipleWorkspace import MultipleWorkspace as mws\r
+from Common.RangeExpression import RangeExpression\r
 \r
 ##define T_CHAR_SPACE                ' '\r
 ##define T_CHAR_NULL                 '\0'\r
@@ -931,8 +932,7 @@ class FdfParser(object):
         \r
         if not self.__GetNextToken():\r
             return False\r
-        p = re.compile('[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}')\r
-        if p.match(self.__Token) != None:\r
+        if RangeExpression.RegGuidPattern.match(self.__Token) != None:\r
             return True\r
         else:\r
             self.__UndoToken()\r
index dda7ed4ce79867d9131aa13930f4ec5fe7b10a9e..19c1ad372c4cdbba69e0d987c2ba3d8502eed4ed 100644 (file)
@@ -59,6 +59,7 @@ import Common.LongFilePathOs as os
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
 from Capsule import EFI_CERT_TYPE_PKCS7_GUID\r
 from Capsule import EFI_CERT_TYPE_RSA2048_SHA256_GUID\r
+from Common.RangeExpression import RangeExpression\r
 \r
 ##define T_CHAR_SPACE                ' '\r
 ##define T_CHAR_NULL                 '\0'\r
@@ -1149,8 +1150,7 @@ class FdfParser:
 \r
         if not self.__GetNextToken():\r
             return False\r
-        p = re.compile('[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}')\r
-        if p.match(self.__Token) != None:\r
+        if RangeExpression.RegGuidPattern.match(self.__Token) != None:\r
             return True\r
         else:\r
             self.__UndoToken()\r