summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Common/RangeExpression.py
diff options
context:
space:
mode:
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>2018-04-05 04:56:55 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-04-08 16:33:03 +0800
commite6c2468a9e6158b6bf669f05129a1dd362d52753 (patch)
tree32e1c1e5247261cd6e2d89650b82d6a443b09708 /BaseTools/Source/Python/Common/RangeExpression.py
parentbfc8f5667a68071e7f12a9ba2a0cf076b1285107 (diff)
downloadedk2-e6c2468a9e6158b6bf669f05129a1dd362d52753.tar.gz
edk2-e6c2468a9e6158b6bf669f05129a1dd362d52753.tar.bz2
edk2-e6c2468a9e6158b6bf669f05129a1dd362d52753.zip
BaseTools: move RegEx to root of file and share it
make it easy to import and use by others 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/Common/RangeExpression.py')
-rw-r--r--BaseTools/Source/Python/Common/RangeExpression.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/BaseTools/Source/Python/Common/RangeExpression.py b/BaseTools/Source/Python/Common/RangeExpression.py
index 5fcc8a432a..5ee59184e6 100644
--- a/BaseTools/Source/Python/Common/RangeExpression.py
+++ b/BaseTools/Source/Python/Common/RangeExpression.py
@@ -16,6 +16,7 @@ from Common.GlobalData import *
from CommonDataClass.Exceptions import BadExpression
from CommonDataClass.Exceptions import WrnExpression
import uuid
+from Common.Expression import PcdPattern
ERR_STRING_EXPR = 'This operator cannot be used in string expression: [%s].'
ERR_SNYTAX = 'Syntax error, the rest of expression cannot be evaluated: [%s].'
@@ -209,8 +210,6 @@ class RangeExpression(object):
NonLetterOpLst = ['+', '-', '&', '|', '^', '!', '=', '>', '<']
- PcdPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*\.[_a-zA-Z][0-9A-Za-z_]*$')
-
RangePattern = re.compile(r'[0-9]+ - [0-9]+')
def preProcessRangeExpr(self, expr):
@@ -573,7 +572,7 @@ class RangeExpression(object):
raise BadExpression(ERR_EMPTY_TOKEN)
# PCD token
- if self.PcdPattern.match(self._Token):
+ if PcdPattern.match(self._Token):
if self._Token not in self._Symb:
Ex = BadExpression(ERR_PCD_RESOLVE % self._Token)
Ex.Pcd = self._Token