use the same MACRO name definition across shared regular expression patterns.
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
## @file\r
# This file is used to define common static strings used by INF/DEC/DSC files\r
#\r
## @file\r
# This file is used to define common static strings used by INF/DEC/DSC files\r
#\r
-# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
gSkuids = []\r
gDefaultStores = []\r
\r
gSkuids = []\r
gDefaultStores = []\r
\r
+# definition for a MACRO name. used to create regular expressions below.\r
+_MacroNamePattern = "[A-Z][A-Z0-9_]*"\r
+\r
## Regular expression for matching macro used in DSC/DEC/INF file inclusion\r
## Regular expression for matching macro used in DSC/DEC/INF file inclusion\r
-gMacroRefPattern = re.compile("\$\(([A-Z][_A-Z0-9]*)\)", re.UNICODE)\r
+gMacroRefPattern = re.compile("\$\(({})\)".format(_MacroNamePattern), re.UNICODE)\r
gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+")\r
gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+")\r
-gMacroNamePattern = re.compile("^[A-Z][A-Z0-9_]*$")\r
+gMacroNamePattern = re.compile("^{}$".format(_MacroNamePattern))\r
\r
#\r
# A global variable for whether current build in AutoGen phase or not.\r
\r
#\r
# A global variable for whether current build in AutoGen phase or not.\r