diff options
author | Yunhua Feng <yunhuax.feng@intel.com> | 2017-06-20 13:55:53 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2017-06-24 23:03:38 +0800 |
commit | 413d51cc2bcf608844cf5362535bdd2a9a8b2b5b (patch) | |
tree | 3b4ba8bf5f6fccb2a6b4ca9651bc5d8f9e9526ed /BaseTools/Source/Python/Common/String.py | |
parent | c2d0a1f6d22f0c743899d9d98cef41e4a46c5921 (diff) | |
download | edk2-413d51cc2bcf608844cf5362535bdd2a9a8b2b5b.tar.gz edk2-413d51cc2bcf608844cf5362535bdd2a9a8b2b5b.tar.bz2 edk2-413d51cc2bcf608844cf5362535bdd2a9a8b2b5b.zip |
BaseTools: Fix the bug that use '|' or '||' in DSC file's Pcd value
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>
Diffstat (limited to 'BaseTools/Source/Python/Common/String.py')
-rw-r--r-- | BaseTools/Source/Python/Common/String.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Python/Common/String.py index 5c8d1e0ded..81c053df27 100644 --- a/BaseTools/Source/Python/Common/String.py +++ b/BaseTools/Source/Python/Common/String.py @@ -46,12 +46,13 @@ def GetSplitValueList(String, SplitTag=DataType.TAB_VALUE_SPLIT, MaxSplit= -1): Last = 0
Escaped = False
InString = False
+ InParenthesis = 0
for Index in range(0, len(String)):
Char = String[Index]
if not Escaped:
# Found a splitter not in a string, split it
- if not InString and Char == SplitTag:
+ if not InString and InParenthesis == 0 and Char == SplitTag:
ValueList.append(String[Last:Index].strip())
Last = Index + 1
if MaxSplit > 0 and len(ValueList) >= MaxSplit:
@@ -64,6 +65,10 @@ def GetSplitValueList(String, SplitTag=DataType.TAB_VALUE_SPLIT, MaxSplit= -1): InString = True
else:
InString = False
+ elif Char == '(':
+ InParenthesis = InParenthesis + 1
+ elif Char == ')':
+ InParenthesis = InParenthesis - 1
else:
Escaped = False
|