import copy\r
from Common.DataType import *\r
import sys\r
+from random import sample\r
+import string\r
\r
ERR_STRING_EXPR = 'This operator cannot be used in string expression: [%s].'\r
ERR_SNYTAX = 'Syntax error, the rest of expression cannot be evaluated: [%s].'\r
#\r
def SplitString(String):\r
# There might be escaped quote: "abc\"def\\\"ghi", 'abc\'def\\\'ghi'\r
+ RanStr = ''.join(sample(string.ascii_letters + string.digits, 8))\r
+ String = String.replace('\\\\', RanStr).strip()\r
RetList = []\r
InSingleQuote = False\r
InDoubleQuote = False\r
raise BadExpression(ERR_STRING_TOKEN % Item)\r
if Item:\r
RetList.append(Item)\r
+ for i, ch in enumerate(RetList):\r
+ if RanStr in ch:\r
+ RetList[i] = ch.replace(RanStr,'\\\\')\r
return RetList\r
\r
def SplitPcdValueString(String):\r
# There might be escaped comma in GUID() or DEVICE_PATH() or " "\r
# or ' ' or L' ' or L" "\r
+ RanStr = ''.join(sample(string.ascii_letters + string.digits, 8))\r
+ String = String.replace('\\\\', RanStr).strip()\r
RetList = []\r
InParenthesis = 0\r
InSingleQuote = False\r
raise BadExpression(ERR_STRING_TOKEN % Item)\r
if Item:\r
RetList.append(Item)\r
+ for i, ch in enumerate(RetList):\r
+ if RanStr in ch:\r
+ RetList[i] = ch.replace(RanStr,'\\\\')\r
return RetList\r
\r
def IsValidCName(Str):\r
elif not Val:\r
Val = False\r
RealVal = '""'\r
- elif not Val.startswith('L"') and not Val.startswith('{') and not Val.startswith("L'"):\r
+ elif not Val.startswith('L"') and not Val.startswith('{') and not Val.startswith("L'") and not Val.startswith("'"):\r
Val = True\r
RealVal = '"' + RealVal + '"'\r
\r
import pickle\r
import array\r
import shutil\r
+from random import sample\r
from struct import pack\r
from UserDict import IterableUserDict\r
from UserList import UserList\r
return False\r
\r
def AnalyzePcdExpression(Setting):\r
- Setting = Setting.strip()\r
+ RanStr = ''.join(sample(string.ascii_letters + string.digits, 8))\r
+ Setting = Setting.replace('\\\\', RanStr).strip()\r
# There might be escaped quote in a string: \", \\\" , \', \\\'\r
Data = Setting\r
# There might be '|' in string and in ( ... | ... ), replace it with '-'\r
break\r
FieldList.append(Setting[StartPos:Pos].strip())\r
StartPos = Pos + 1\r
-\r
+ for i, ch in enumerate(FieldList):\r
+ if RanStr in ch:\r
+ FieldList[i] = ch.replace(RanStr,'\\\\')\r
return FieldList\r
\r
def ParseDevPathValue (Value):\r