# This file is used to define common parsing related functions used in parsing \r
# INF/DEC/DSC process\r
#\r
-# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials are licensed and made available \r
# under the terms and conditions of the BSD License which accompanies this \r
import os.path\r
import re\r
\r
-from Library.String import RaiseParserError\r
-from Library.String import GetSplitValueList\r
-from Library.String import CheckFileType\r
-from Library.String import CheckFileExist\r
-from Library.String import CleanString\r
-from Library.String import NormPath\r
+from Library.StringUtils import RaiseParserError\r
+from Library.StringUtils import GetSplitValueList\r
+from Library.StringUtils import CheckFileType\r
+from Library.StringUtils import CheckFileExist\r
+from Library.StringUtils import CleanString\r
+from Library.StringUtils import NormPath\r
\r
from Logger.ToolError import FILE_NOT_FOUND\r
from Logger.ToolError import FatalError\r
#\r
def CheckPcdTokenInfo(TokenInfoString, Section, File, LineNo= -1):\r
Format = '<TokenSpaceGuidCName>.<PcdCName>'\r
- if TokenInfoString != '' and TokenInfoString != None:\r
+ if TokenInfoString != '' and TokenInfoString is not None:\r
TokenInfoList = GetSplitValueList(TokenInfoString, DataType.TAB_SPLIT)\r
if len(TokenInfoList) == 2:\r
return True\r
LineList = Lines.split('\n')\r
for Line in LineList:\r
Line = CleanString(Line, CommentCharacter)\r
- if Line == None or Line == '':\r
+ if Line is None or Line == '':\r
continue\r
\r
if FindBlock == False:\r
FileLocalMacros[Name] = Value\r
\r
ReIsValidMacroName = re.compile(r"^[A-Z][A-Z0-9_]*$", re.DOTALL)\r
- if ReIsValidMacroName.match(Name) == None:\r
+ if ReIsValidMacroName.match(Name) is None:\r
Logger.Error('Parser',\r
FORMAT_INVALID,\r
ST.ERR_MACRONAME_INVALID % (Name),\r
# <UnicodeString>, <CArray> are subset of <AsciiString>.\r
#\r
ReIsValidMacroValue = re.compile(r"^[\x20-\x7e]*$", re.DOTALL)\r
- if ReIsValidMacroValue.match(Value) == None:\r
+ if ReIsValidMacroValue.match(Value) is None:\r
Logger.Error('Parser',\r
FORMAT_INVALID,\r
ST.ERR_MACROVALUE_INVALID % (Value),\r
else:\r
Section = '[' + SectionName + ']'\r
Content += '\n' + Section + '\n'\r
- if StatementList != None:\r
+ if StatementList is not None:\r
for Statement in StatementList:\r
LineList = Statement.split('\n')\r
NewStatement = ""\r