X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FCommon%2FExpression.py;h=7b3030c5fa08f9d1f219dbd83f3a81e338afd5d4;hb=c9da41b235eaf34248c92839924650f071079dc8;hp=80fad7563d17909bcdde8d6b6302ec60142b5493;hpb=25918452ed5e9d12ea56b3bb2193df9ab96666b1;p=mirror_edk2.git
diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py
index 80fad7563d..7b3030c5fa 100644
--- a/BaseTools/Source/Python/Common/Expression.py
+++ b/BaseTools/Source/Python/Common/Expression.py
@@ -1,7 +1,7 @@
## @file
# This file is used to parse and evaluate expression in directive or PCD value.
#
-# Copyright (c) 2011, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -76,6 +76,10 @@ def ReplaceExprMacro(String, Macros, ExceptionList = None):
InQuote = True
MacroStartPos = String.find('$(')
if MacroStartPos < 0:
+ for Pcd in gPlatformPcds.keys():
+ if Pcd in String:
+ if Pcd not in gConditionalPcds:
+ gConditionalPcds.append(Pcd)
continue
RetStr = ''
while MacroStartPos >= 0:
@@ -246,12 +250,14 @@ class ValueExpression(object):
# @return: True or False if RealValue is False
# Evaluated value of string format if RealValue is True
#
- def __call__(self, RealValue=False):
+ def __call__(self, RealValue=False, Depth=0):
if self._NoProcess:
return self._Expr
+ self._Depth = Depth
+
self._Expr = self._Expr.strip()
- if RealValue:
+ if RealValue and Depth == 0:
self._Token = self._Expr
if self.__IsNumberToken():
return self._Expr
@@ -471,7 +477,7 @@ class ValueExpression(object):
Ex = BadExpression(ERR_PCD_RESOLVE % self._Token)
Ex.Pcd = self._Token
raise Ex
- self._Token = ValueExpression(self._Symb[self._Token], self._Symb)(True)
+ self._Token = ValueExpression(self._Symb[self._Token], self._Symb)(True, self._Depth+1)
if type(self._Token) != type(''):
self._LiteralToken = hex(self._Token)
return
@@ -551,7 +557,7 @@ class ValueExpression(object):
if Match and not Expr[Match.end():Match.end()+1].isalnum() \
and Expr[Match.end():Match.end()+1] != '_':
self._Idx += Match.end()
- self._Token = ValueExpression(GuidStringToGuidStructureString(Expr[0:Match.end()]))(True)
+ self._Token = ValueExpression(GuidStringToGuidStructureString(Expr[0:Match.end()]))(True, self._Depth+1)
return self._Token
elif self.__IsIdChar(Ch):
return self.__GetIdToken()