ERR_EMPTY_EXPR = 'Empty expression is not allowed.'\r
ERR_IN_OPERAND = 'Macro after IN operator can only be: $(FAMILY), $(ARCH), $(TOOL_CHAIN_TAG) and $(TARGET).'\r
\r
ERR_EMPTY_EXPR = 'Empty expression is not allowed.'\r
ERR_IN_OPERAND = 'Macro after IN operator can only be: $(FAMILY), $(ARCH), $(TOOL_CHAIN_TAG) and $(TARGET).'\r
\r
## SplitString\r
# Split string to list according double quote\r
# For example: abc"de\"f"ghi"jkl"mn will be: ['abc', '"de\"f"', 'ghi', '"jkl"', 'mn']\r
## SplitString\r
# Split string to list according double quote\r
# For example: abc"de\"f"ghi"jkl"mn will be: ['abc', '"de\"f"', 'ghi', '"jkl"', 'mn']\r
-def IsValidCString(Str):\r
- ValidString = re.compile(r'[_a-zA-Z][_0-9a-zA-Z]*$')\r
- if not ValidString.match(Str):\r
- return False\r
- return True\r
+def IsValidCName(Str):\r
+ return True if __ValidString.match(Str) else False\r
if PcdValue.startswith('H'):\r
InputValue = PcdValue[1:]\r
elif PcdValue.startswith("L'") or PcdValue.startswith("'"):\r
if PcdValue.startswith('H'):\r
InputValue = PcdValue[1:]\r
elif PcdValue.startswith("L'") or PcdValue.startswith("'"):\r
NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<', '?', ':']\r
\r
PcdPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*\.[_a-zA-Z][0-9A-Za-z_]*$')\r
NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<', '?', ':']\r
\r
PcdPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*\.[_a-zA-Z][0-9A-Za-z_]*$')\r
if Match and not Expr[Match.end():Match.end()+1].isalnum() \\r
and Expr[Match.end():Match.end()+1] != '_':\r
self._Idx += Match.end()\r
if Match and not Expr[Match.end():Match.end()+1].isalnum() \\r
and Expr[Match.end():Match.end()+1] != '_':\r
self._Idx += Match.end()\r
raise BadExpression('%s is not a valid c variable name' % Label)\r
if Label not in LabelDict.keys():\r
LabelDict[Label] = str(LabelOffset)\r
raise BadExpression('%s is not a valid c variable name' % Label)\r
if Label not in LabelDict.keys():\r
LabelDict[Label] = str(LabelOffset)\r
Item = '0x%x' % TmpValue if type(TmpValue) != type('') else TmpValue\r
if ItemSize == 0:\r
ItemValue, ItemSize = ParseFieldValue(Item)\r
Item = '0x%x' % TmpValue if type(TmpValue) != type('') else TmpValue\r
if ItemSize == 0:\r
ItemValue, ItemSize = ParseFieldValue(Item)\r
raise BadExpression("Byte array number %s should less than 0xFF." % Item)\r
else:\r
ItemValue = ParseFieldValue(Item)[0]\r
raise BadExpression("Byte array number %s should less than 0xFF." % Item)\r
else:\r
ItemValue = ParseFieldValue(Item)[0]\r