From: Carsey, Jaben Date: Tue, 13 Mar 2018 23:11:33 +0000 (+0800) Subject: BaseTools: Expression - change from series of if to elif X-Git-Tag: edk2-stable201903~2089 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=3e8bab960eca8464ab1d0f2ad3f06a2ccc925f95 BaseTools: Expression - change from series of if to elif since the first character of the string cannot be found by multiple if statements, use elif to optomize the behavior. Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu --- diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py index c7037dd0d0..85c1ce9bbc 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -93,18 +93,18 @@ def SplitPcdValueString(String): for i, ch in enumerate(String): if ch == '(': InParenthesis += 1 - if ch == ')': + elif ch == ')': if InParenthesis: InParenthesis -= 1 else: raise BadExpression(ERR_STRING_TOKEN % Item) - if ch == '"' and not InSingleQuote: + elif ch == '"' and not InSingleQuote: if String[i-1] != '\\': InDoubleQuote = not InDoubleQuote - if ch == "'" and not InDoubleQuote: + elif ch == "'" and not InDoubleQuote: if String[i-1] != '\\': InSingleQuote = not InSingleQuote - if ch == ',': + elif ch == ',': if InParenthesis or InSingleQuote or InDoubleQuote: Item += String[i] continue