## @file\r
# This file contained the miscellaneous functions for INF parser \r
#\r
-# Copyright (c) 2011, 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
from Library import DataType as DT\r
\r
\r
-from Library.String import gMACRO_PATTERN\r
-from Library.String import ReplaceMacro\r
+from Library.StringUtils import gMACRO_PATTERN\r
+from Library.StringUtils import ReplaceMacro\r
from Object.Parser.InfMisc import ErrorInInf\r
from Logger.StringTable import ERR_MARCO_DEFINITION_MISS_ERROR\r
\r
# @param Flag If the flag set to True, need to skip macros in a quoted string \r
#\r
def InfExpandMacro(Content, LineInfo, GlobalMacros=None, SectionMacros=None, Flag=False):\r
- if GlobalMacros == None:\r
+ if GlobalMacros is None:\r
GlobalMacros = {}\r
- if SectionMacros == None:\r
+ if SectionMacros is None:\r
SectionMacros = {}\r
\r
FileName = LineInfo[0]\r
LineContent = LineInfo[1]\r
LineNo = LineInfo[2]\r
\r
+ # Don't expand macros in comments\r
+ if LineContent.strip().startswith("#"):\r
+ return Content\r
+\r
NewLineInfo = (FileName, LineNo, LineContent)\r
\r
#\r