]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/RangeExpression.py
BaseTools: move RegEx to root of file and share it
[mirror_edk2.git] / BaseTools / Source / Python / Common / RangeExpression.py
index 5fcc8a432a565a2bc88947175fc03769f45ff60c..5ee59184e66e2d1329967ec4921d5ce152731195 100644 (file)
@@ -16,6 +16,7 @@ from Common.GlobalData import *
 from CommonDataClass.Exceptions import BadExpression\r
 from CommonDataClass.Exceptions import WrnExpression\r
 import uuid\r
+from Common.Expression import PcdPattern\r
 \r
 ERR_STRING_EXPR = 'This operator cannot be used in string expression: [%s].'\r
 ERR_SNYTAX = 'Syntax error, the rest of expression cannot be evaluated: [%s].'\r
@@ -209,8 +210,6 @@ class RangeExpression(object):
 \r
     NonLetterOpLst = ['+', '-', '&', '|', '^', '!', '=', '>', '<']\r
 \r
-    PcdPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*\.[_a-zA-Z][0-9A-Za-z_]*$')\r
-    \r
     RangePattern = re.compile(r'[0-9]+ - [0-9]+')\r
 \r
     def preProcessRangeExpr(self, expr):\r
@@ -573,7 +572,7 @@ class RangeExpression(object):
             raise BadExpression(ERR_EMPTY_TOKEN)\r
 \r
         # PCD token\r
-        if self.PcdPattern.match(self._Token):\r
+        if PcdPattern.match(self._Token):\r
             if self._Token not in self._Symb:\r
                 Ex = BadExpression(ERR_PCD_RESOLVE % self._Token)\r
                 Ex.Pcd = self._Token\r