]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fix the bug that use '|' or '||' in DSC file's Pcd value
authorYunhua Feng <yunhuax.feng@intel.com>
Tue, 20 Jun 2017 05:55:53 +0000 (13:55 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Sat, 24 Jun 2017 15:03:38 +0000 (23:03 +0800)
Fix the bug to support use '|' or '||' in DSC file's Pcd value.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/Common/String.py

index 5c8d1e0ded5b86b0463b0d31a1a7776e9f2a493a..81c053df27cdc8eda177410ad8a77fe744439060 100644 (file)
@@ -46,12 +46,13 @@ def GetSplitValueList(String, SplitTag=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
     Last = 0\r
     Escaped = False\r
     InString = False\r
+    InParenthesis = 0\r
     for Index in range(0, len(String)):\r
         Char = String[Index]\r
 \r
         if not Escaped:\r
             # Found a splitter not in a string, split it\r
-            if not InString and Char == SplitTag:\r
+            if not InString and InParenthesis == 0 and Char == SplitTag:\r
                 ValueList.append(String[Last:Index].strip())\r
                 Last = Index + 1\r
                 if MaxSplit > 0 and len(ValueList) >= MaxSplit:\r
@@ -64,6 +65,10 @@ def GetSplitValueList(String, SplitTag=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
                     InString = True\r
                 else:\r
                     InString = False\r
+            elif Char == '(':\r
+                InParenthesis = InParenthesis + 1\r
+            elif Char == ')':\r
+                InParenthesis = InParenthesis - 1\r
         else:\r
             Escaped = False\r
 \r