]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Expression - change from series of if to elif
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>
Tue, 13 Mar 2018 23:11:33 +0000 (07:11 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Mon, 19 Mar 2018 01:25:33 +0000 (09:25 +0800)
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>
BaseTools/Source/Python/Common/Expression.py

index c7037dd0d00bcc27ed31ee2ad896d2ebbddc315d..85c1ce9bbc09b0fb081a61357f8ad44002ff5b3f 100644 (file)
@@ -93,18 +93,18 @@ def SplitPcdValueString(String):
     for i, ch in enumerate(String):\r
         if ch == '(':\r
             InParenthesis += 1\r
     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 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 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 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
             if InParenthesis or InSingleQuote or InDoubleQuote:\r
                 Item += String[i]\r
                 continue\r