X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2Fbertos_utils.py;h=bed5493b499ac60984ed3d73205e36e14fe1c685;hb=192bc00a3825229287bcd17de47e38ee0d9018a9;hp=a50df0f49e0eb5ac49288d6e2dbfcf2fc3dc06f6;hpb=a32c2b3896360b7d3ed8360c3fc49c96c37ebc5a;p=bertos.git diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index a50df0f4..bed5493b 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -95,19 +95,110 @@ def getInfos(definition): return D def getDefinitionBlocks(text): + """ + Take a text and return a list of tuple (description, name-value). + """ block = [] - block_tmp = re.findall(r"/\*{2}\s*([^*]*\*(?:[^/*][^*]*\*+)*)/\s*#define\s+(.*?)\s*?$", text, re.MULTILINE) + block_tmp = re.findall(r"/\*{2}\s*([^*]*\*(?:[^/*][^*]*\*+)*)/\s*#define\s+((?:[^/]*?/?)+)\s*?(?:/{2,3}[^<].*?)?$", 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}