since the first character of the string cannot be found by multiple if
statements, use elif to optomize the behavior.
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@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>
for i, ch in enumerate(String):\r
if ch == '(':\r
InParenthesis += 1\r
- if ch == ')':\r
+ elif ch == ')':\r
if InParenthesis:\r
InParenthesis -= 1\r
else:\r
raise BadExpression(ERR_STRING_TOKEN % Item)\r
- if ch == '"' and not InSingleQuote:\r
+ elif ch == '"' and not InSingleQuote:\r
if String[i-1] != '\\':\r
InDoubleQuote = not InDoubleQuote\r
- if ch == "'" and not InDoubleQuote:\r
+ elif ch == "'" and not InDoubleQuote:\r
if String[i-1] != '\\':\r
InSingleQuote = not InSingleQuote\r
- if ch == ',':\r
+ elif ch == ',':\r
if InParenthesis or InSingleQuote or InDoubleQuote:\r
Item += String[i]\r
continue\r