BaseTools: use set instead of list
as we only do membership (in) testing for this, set is better 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>
This commit is contained in:
committed by
Yonghong Zhu
parent
b2aeaf573e
commit
4d601fc6b1
@ -416,9 +416,9 @@ class RangeExpression(BaseExpression):
|
||||
|
||||
# Template function to parse binary operators which have same precedence
|
||||
# Expr [Operator Expr]*
|
||||
def _ExprFuncTemplate(self, EvalFunc, OpLst):
|
||||
def _ExprFuncTemplate(self, EvalFunc, OpSet):
|
||||
Val = EvalFunc()
|
||||
while self._IsOperator(OpLst):
|
||||
while self._IsOperator(OpSet):
|
||||
Op = self._Token
|
||||
try:
|
||||
Val = self.Eval(Op, Val, EvalFunc())
|
||||
@ -429,18 +429,18 @@ class RangeExpression(BaseExpression):
|
||||
|
||||
# A [|| B]*
|
||||
def _OrExpr(self):
|
||||
return self._ExprFuncTemplate(self._AndExpr, ["OR", "or"])
|
||||
return self._ExprFuncTemplate(self._AndExpr, {"OR", "or"})
|
||||
|
||||
# A [&& B]*
|
||||
def _AndExpr(self):
|
||||
return self._ExprFuncTemplate(self._NeExpr, ["AND", "and"])
|
||||
return self._ExprFuncTemplate(self._NeExpr, {"AND", "and"})
|
||||
|
||||
def _NeExpr(self):
|
||||
Val = self._RelExpr()
|
||||
while self._IsOperator([ "!=", "NOT", "not"]):
|
||||
while self._IsOperator({"!=", "NOT", "not"}):
|
||||
Op = self._Token
|
||||
if Op in ["!", "NOT", "not"]:
|
||||
if not self._IsOperator(["IN", "in"]):
|
||||
if not self._IsOperator({"IN", "in"}):
|
||||
raise BadExpression(ERR_REL_NOT_IN)
|
||||
Op += ' ' + self._Token
|
||||
try:
|
||||
@ -452,7 +452,7 @@ class RangeExpression(BaseExpression):
|
||||
|
||||
# [!]*A
|
||||
def _RelExpr(self):
|
||||
if self._IsOperator(["NOT" , "LE", "GE", "LT", "GT", "EQ", "XOR"]):
|
||||
if self._IsOperator({"NOT" , "LE", "GE", "LT", "GT", "EQ", "XOR"}):
|
||||
Token = self._Token
|
||||
Val = self._NeExpr()
|
||||
try:
|
||||
|
Reference in New Issue
Block a user