diff options
author | Feng, Bob C <bob.c.feng@intel.com> | 2018-12-15 00:15:21 +0800 |
---|---|---|
committer | BobCF <bob.c.feng@intel.com> | 2018-12-18 10:15:50 +0800 |
commit | 4c6e6f9f75a7b86d7760f5409a24b3c20759ccb9 (patch) | |
tree | 9cd4b8bdd536f7160ea2e78893994186eba8fe03 /BaseTools/Source/Python/Common | |
parent | 778c7640505aafa0bfde1b084ba870d361cacaef (diff) | |
download | edk2-4c6e6f9f75a7b86d7760f5409a24b3c20759ccb9.zip edk2-4c6e6f9f75a7b86d7760f5409a24b3c20759ccb9.tar.gz edk2-4c6e6f9f75a7b86d7760f5409a24b3c20759ccb9.tar.bz2 |
BaseTools: Fix PcdArray issue
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 <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Philippe Mathieu-Daud? <philmd@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Common')
-rw-r--r-- | BaseTools/Source/Python/Common/Misc.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index 6a22d01..76a73d1 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
|