diff options
| author | Duncan Ogilvie <mr.exodia.tpodt@gmail.com> | 2026-09-25 13:53:16 +0200 |
|---|---|---|
| committer | Duncan Ogilvie <mr.exodia.tpodt@gmail.com> | 2026-09-25 13:53:16 +0200 |
| commit | 65b57fdd2ebbb4884fc13a81061af60c613cfd16 (patch) | |
| tree | 482d0247a23d8ff896aa90eb38b1faaa53ac3a82 /idatui/domain.py | |
| parent | Bump ida-nexus to 0.13.0 (diff) | |
| download | ida-tui-65b57fdd2ebbb4884fc13a81061af60c613cfd16.tar.gz ida-tui-65b57fdd2ebbb4884fc13a81061af60c613cfd16.tar.xz ida-tui-65b57fdd2ebbb4884fc13a81061af60c613cfd16.zip | |
Fix parsing of pseudocode tags
Diffstat (limited to 'idatui/domain.py')
| -rw-r--r-- | idatui/domain.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/idatui/domain.py b/idatui/domain.py index 1e5a863..941cc59 100644 --- a/idatui/domain.py +++ b/idatui/domain.py @@ -2626,6 +2626,21 @@ def _parse_xrefs(payload) -> list[Xref]: return out +_PSEUDOCODE_ANCHOR_RE = re.compile(r"[ \t]*/\*[ \t]*0x([0-9A-Fa-f]+)[ \t]*\*/[ \t]*$") + + +def split_pseudocode_line(line: str) -> tuple[str, int | None]: + """Separate the legacy trailing address annotation from a pseudocode line. + + Only the final annotation is metadata. Identical text inside a string or an + earlier source comment must survive, both for display and cursor columns. + """ + match = _PSEUDOCODE_ANCHOR_RE.search(line) + if match is None: + return line.rstrip(), None + return line[: match.start()].rstrip(), int(match.group(1), 16) + + def _parse_decompilation(ea: int, payload) -> Decompilation: if not isinstance(payload, dict): return Decompilation(ea, None, True, "unexpected payload", False, None) |
