From 4c6e6f9f75a7b86d7760f5409a24b3c20759ccb9 Mon Sep 17 00:00:00 2001 From: "Feng, Bob C" Date: Sat, 15 Dec 2018 00:15:21 +0800 Subject: BaseTools: Fix PcdArray issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://bugzilla.tianocore.org/show_bug.cgi?id=1390 1. support hex number for array index 2. support Non-Dynamic Pcd for array data type 3. support {} and {CODE()} for array data type 4. Change GetStructurePcdMaxSize to be a static function since it need to be called in another static function. And this function does not depend on it's class instance. 5. Add unittest for RemoveCComments function and ArrayIndex regular expression. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng Cc: Liming Gao Cc: Ard Biesheuvel Cc: Philippe Mathieu-Daud? Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Liming Gao --- BaseTools/Source/Python/Common/Misc.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'BaseTools/Source/Python/Common') diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index 6a22d01012..76a73d1c33 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -2148,6 +2148,12 @@ def CopyDict(ori_dict): else: new_dict[key] = ori_dict[key] return new_dict + +# +# Remove the c/c++ comments: // and /* */ +# +def RemoveCComments(ctext): + return re.sub('//.*?\n|/\*.*?\*/', '\n', ctext, flags=re.S) ## # # This acts like the main() function for the script, unless it is 'import'ed into another -- cgit v1.2.3