summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Common/String.py
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2010-06-28 09:33:10 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2010-06-28 09:33:10 +0000
commit9053bc517ea77b9780830bf08b966979eff1cb0f (patch)
tree960bef933abdad405b30af68375d4743e98b80c5 /BaseTools/Source/Python/Common/String.py
parent96dd57ee8d5deb549310c4fbd4e4b5c7a810a928 (diff)
downloadedk2-9053bc517ea77b9780830bf08b966979eff1cb0f.tar.gz
edk2-9053bc517ea77b9780830bf08b966979eff1cb0f.tar.bz2
edk2-9053bc517ea77b9780830bf08b966979eff1cb0f.zip
Sync EDKII BaseTools to BaseTools project r1988
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10607 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/Common/String.py')
-rw-r--r--BaseTools/Source/Python/Common/String.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Python/Common/String.py
index 1f199fe2ca..896fb7da0f 100644
--- a/BaseTools/Source/Python/Common/String.py
+++ b/BaseTools/Source/Python/Common/String.py
@@ -279,9 +279,16 @@ def CleanString(Line, CommentCharacter = DataType.TAB_COMMENT_SPLIT, AllowCppSty
if AllowCppStyleComment:
Line = Line.replace(DataType.TAB_COMMENT_R8_SPLIT, CommentCharacter)
#
- # remove comments
+ # remove comments, but we should escape comment character in string
#
- Line = Line.split(CommentCharacter, 1)[0];
+ InString = False
+ for Index in range(0, len(Line)):
+ if Line[Index] == '"':
+ InString = not InString
+ elif Line[Index] == CommentCharacter and not InString:
+ Line = Line[0: Index]
+ break
+
#
# remove whitespace again
#