BaseTools/Ecc: Fix a bug in parser
Fix a bug to not break when parsing a macro and not find its value Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: YangX Li <yangx.li@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17709 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# This file is used to define common string related functions used in parsing process
|
# This file is used to define common string related functions used in parsing process
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -272,7 +272,8 @@ def ReplaceMacro(String, MacroDefinitions={}, SelfReplacement=False, RaiseError=
|
|||||||
if SelfReplacement:
|
if SelfReplacement:
|
||||||
String = String.replace("$(%s)" % Macro, '')
|
String = String.replace("$(%s)" % Macro, '')
|
||||||
continue
|
continue
|
||||||
String = String.replace("$(%s)" % Macro, MacroDefinitions[Macro])
|
if "$(%s)" % Macro not in MacroDefinitions[Macro]:
|
||||||
|
String = String.replace("$(%s)" % Macro, MacroDefinitions[Macro])
|
||||||
# in case there's macro not defined
|
# in case there's macro not defined
|
||||||
if String == LastString:
|
if String == LastString:
|
||||||
break
|
break
|
||||||
|
@ -1312,6 +1312,9 @@ class DscParser(MetaFileParser):
|
|||||||
File=self._FileWithError, ExtraData=' '.join(self._ValueList),
|
File=self._FileWithError, ExtraData=' '.join(self._ValueList),
|
||||||
Line=self._LineIndex+1)
|
Line=self._LineIndex+1)
|
||||||
Result = Excpt.result
|
Result = Excpt.result
|
||||||
|
except BadExpression, Exc:
|
||||||
|
EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc), self._ValueList[1])
|
||||||
|
Result = False
|
||||||
|
|
||||||
if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
|
if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
|
||||||
MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
|
MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
|
||||||
|
Reference in New Issue
Block a user