(text)
| 349 | return element |
| 350 | |
| 351 | def _parse_comment(text): |
| 352 | text = _strip_comment_stars(text) |
| 353 | # The regexp means match all strings that: |
| 354 | # * begins with line start, possible whitespace and an @ |
| 355 | # * followed by non-white-space (the tag) |
| 356 | # * followed by possible spaces |
| 357 | # * followed by every character that is not an @ or is an @ but not preceded by a new line (the value) |
| 358 | lst = re.findall(r'^\s*@(\S+) *((?:[^@]|(?<!\n)@)*)', text, re.MULTILINE) |
| 359 | tags = { |
| 360 | "path": "", |
| 361 | "language": "", |
| 362 | "param": [], |
| 363 | "tparam": [], |
| 364 | "note": [], |
| 365 | "return": [], |
| 366 | "member": [], |
| 367 | "examples": [], |
| 368 | } |
| 369 | for tag,value in lst: |
| 370 | tag = tag.strip() |
| 371 | value = value.strip() |
| 372 | v = tags.get(tag) |
| 373 | if type(v) is list: |
| 374 | v.append(value) |
| 375 | else: |
| 376 | tags[tag] = value |
| 377 | |
| 378 | # @struct somename |
| 379 | if "struct" in tags and "name" not in tags: |
| 380 | logging.warning('Missing tag @name, using value %s from @struct' % tags["struct"]) |
| 381 | tags["name"] = tags["struct"] |
| 382 | |
| 383 | if "name" not in tags: |
| 384 | logging.warning('Missing tag @name in "%s"' % text) |
| 385 | return None |
| 386 | |
| 387 | element = None |
| 388 | if "document" in tags: |
| 389 | element = _create_doc_info(tags) |
| 390 | else: |
| 391 | element = _create_doc_element(tags) |
| 392 | |
| 393 | element.description, element.brief = _parse_description(text) |
| 394 | element.name = tags["name"] |
| 395 | element.language = tags["language"] |
| 396 | element.notes.extend(tags["note"]) |
| 397 | |
| 398 | return element |
| 399 | |
| 400 | def extract_type_from_docstr(s): |
| 401 | # try to extract the type information |
no test coverage detected