X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2Fbertos_utils.py;h=a50df0f49e0eb5ac49288d6e2dbfcf2fc3dc06f6;hb=a32c2b3896360b7d3ed8360c3fc49c96c37ebc5a;hp=8f91878d151a71fceea48b00f71494eeb9141741;hpb=b5eaec9ae59579faf3d2facea7ede3fb8ef64032;p=bertos.git diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 8f91878d..a50df0f4 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -93,3 +93,21 @@ def getInfos(definition): D["DEFINITION_PATH"] = definition[1] + "/" + definition[0] del D["include"] return D + +def getDefinitionBlocks(text): + block = [] + block_tmp = re.findall(r"/\*{2}\s*([^*]*\*(?:[^/*][^*]*\*+)*)/\s*#define\s+(.*?)\s*?$", text, re.MULTILINE) + for comment, define in block_tmp: + block.append((" ".join(re.findall(r"^\s*\*?\s*(.*?)\s*?$", comment, re.MULTILINE)), define)) + block += re.findall(r"/{3}