From 6e239a393e67419a19ec23894f108b6891d5e1ed Mon Sep 17 00:00:00 2001 From: caheckman <48068198+caheckman@users.noreply.github.com> Date: Wed, 8 Mar 2023 12:38:58 -0500 Subject: [PATCH] GP-3029 Treat annotations in comments as a single token --- .../Decompiler/src/decompile/cpp/printlanguage.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.cc index a693042ded..aad62c9f40 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/printlanguage.cc @@ -612,6 +612,19 @@ void PrintLanguage::emitLineComment(int4 indent,const Comment *comm) emit->tagLine(); else if (tok=='\r') { } + else if (tok=='{' && pos < text.size() && text[pos] == '@') { + // Comment annotation + int4 count = 1; + while(pos < text.size()) { + tok = text[pos]; + count += 1; + pos += 1; + if (tok == '}') break; // Search for brace ending the annotation + } + // Treat annotation as one token + string annote = text.substr(pos-count,count); + emit->tagComment(annote,EmitMarkup::comment_color,spc,off); + } else { int4 count = 1; while(pos < text.size()) {