From 0f17c9fef104d5f0eaa382266e0489f1fa0ed986 Mon Sep 17 00:00:00 2001 From: "Carsey, Jaben" Date: Sat, 17 Mar 2018 07:27:39 +0800 Subject: [PATCH] BaseTools: GlobalData share same MACRO name definition use the same MACRO name definition across shared regular expression patterns. Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu --- BaseTools/Source/Python/Common/GlobalData.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Source/Python/Common/GlobalData.py index 8b36a1b773..83ba3d1996 100644 --- a/BaseTools/Source/Python/Common/GlobalData.py +++ b/BaseTools/Source/Python/Common/GlobalData.py @@ -1,7 +1,7 @@ ## @file # This file is used to define common static strings used by INF/DEC/DSC files # -# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -43,10 +43,13 @@ gBuildingModule = '' gSkuids = [] gDefaultStores = [] +# definition for a MACRO name. used to create regular expressions below. +_MacroNamePattern = "[A-Z][A-Z0-9_]*" + ## Regular expression for matching macro used in DSC/DEC/INF file inclusion -gMacroRefPattern = re.compile("\$\(([A-Z][_A-Z0-9]*)\)", re.UNICODE) +gMacroRefPattern = re.compile("\$\(({})\)".format(_MacroNamePattern), re.UNICODE) gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+") -gMacroNamePattern = re.compile("^[A-Z][A-Z0-9_]*$") +gMacroNamePattern = re.compile("^{}$".format(_MacroNamePattern)) # # A global variable for whether current build in AutoGen phase or not. -- 2.39.2