Message handler: add quote_begin, quote_end commands#5696
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #5696 +/- ##
===========================================
- Coverage 80.55% 80.54% -0.02%
===========================================
Files 1707 1707
Lines 189051 189101 +50
Branches 73 73
===========================================
+ Hits 152298 152315 +17
- Misses 36753 36786 +33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
32acae2 to
3604763
Compare
martin-cs
left a comment
There was a problem hiding this comment.
Seems good. It would be nice if this also had the implementation of this for XML so that it was clear why it was valueable and no-one will accidentally 'simplify' it out.
402b16a to
e423424
Compare
e423424 to
3bcd0c6
Compare
3bcd0c6 to
99e7c06
Compare
99e7c06 to
5b56934
Compare
5b56934 to
4429ed9
Compare
4429ed9 to
90be428
Compare
90be428 to
ff0b549
Compare
ff0b549 to
de2a0c5
Compare
de2a0c5 to
01e7746
Compare
4dcfcd6 to
fcacae2
Compare
fcacae2 to
476ebc2
Compare
476ebc2 to
7202a18
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds explicit quote delimiter commands to the messaging subsystem so message handlers can render quoted fragments consistently across UIs (plain/XML/JSON), and updates various diagnostics to use the new quote delimiters.
Changes:
- Introduce
messaget::quote_begin/messaget::quote_endcommands and map them in message handlers. - Update many user-facing messages to use the new quote commands instead of hardcoded backticks/quotes.
- Update regression expectations to match the new quote rendering.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/util/ui_message.h | Intercepts new quote commands (and some styling commands) depending on UI mode before delegating to underlying handler |
| src/util/message.h | Declares new quote commands on messaget |
| src/util/message.cpp | Defines the new quote command values ('<' and '>') |
| src/util/cout_message.cpp | Renders quote commands in the console handler |
| src/statement-list/statement_list_entry_point.cpp | Uses quote commands in “main symbol …” diagnostics |
| src/solvers/strings/string_refinement.cpp | Uses quote commands in debug rendering of concretized strings |
| src/solvers/smt2/smt2_dec.cpp | Uses quote commands around returned solver error message text |
| src/linking/linking_diagnostics.cpp | Uses quote commands for symbol/module names in diagnostics |
| src/linking/linking.cpp | Uses quote commands for quoted variable name in warning |
| src/goto-cc/compile.cpp | Uses quote commands around deprecated flag names |
| src/goto-analyzer/taint_parser.cpp | Uses quote commands around JSON field/key values in diagnostics |
| src/cpp/cpp_typecheck_function.cpp | Uses quote commands in internal error message |
| src/cpp/cpp_typecheck_expr.cpp | Uses quote commands for “this” keyword |
| src/cpp/cpp_instantiate_template.cpp | Uses quote commands for “virtual” keyword |
| src/ansi-c/c_typecheck_expr.cpp | Uses quote commands around identifiers in error message |
| src/ansi-c/c_typecheck_code.cpp | Uses quote commands around “case” keyword in error message |
| src/ansi-c/c_typecheck_base.cpp | Uses quote commands for “extern” and symbol name in warning message |
| regression/goto-cc-file-local/old-flag-name/test.desc | Updates expected output for deprecated flag warning to use single quotes |
| jbmc/src/java_bytecode/java_class_loader_base.cpp | Uses quote commands around filesystem paths in warnings |
| jbmc/src/java_bytecode/java_bytecode_parser.cpp | Uses quote commands around class name in debug output |
| jbmc/regression/jbmc/lambda2/test.desc | Updates expected output to single-quote class name |
| jbmc/regression/jbmc/lambda1/test_goto_functions.desc | Updates expected output to single-quote class names |
| jbmc/regression/jbmc/classpath-invalid/test_path_warning.desc | Updates expected output to single-quote path |
| jbmc/regression/jbmc/classpath-invalid/test_jar_warning.desc | Updates expected output to single-quote path |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| case uit::XML_UI: | ||
| switch(c) | ||
| { | ||
| case 0: // reset | ||
| case 1: // bold | ||
| case 2: // faint | ||
| case 3: // italic | ||
| case 4: // underline | ||
| case 31: // red | ||
| case 32: // green | ||
| case 33: // yellow | ||
| case 34: // blue | ||
| case 35: // magenta | ||
| case 36: // cyan | ||
| case 91: // bright_red | ||
| case 92: // bright_green | ||
| case 93: // bright_yellow | ||
| case 94: // bright_blue | ||
| case 95: // bright_magenta | ||
| case 96: // bright_cyan | ||
| return std::string(); | ||
| case '<': // quote_begin | ||
| return "'"; // could use something like <quote> here | ||
| case '>': // quote_end | ||
| return "'"; // could use something like </quote> here | ||
| } |
These will permit custom formatting of quoting for each message handler, See diffblue#4875 for discussion.
This continues the work of diffblue#4875, but now using quote_begin/quote_end stream modifiers.
This is in the spirit of diffblue#4875, but now using quote_begin/quote_end stream modifiers.
The XML_UI and JSON_UI cases in ui_message_handlert::command() duplicated the same 17-entry switch/fallthrough list of SGR codes to suppress. This meant any future addition or removal of a formatting command had to be made in two places. Extract a static helper is_sgr_style_command(unsigned c) that returns true for the SGR parameter values used by messaget (0..4 for reset/bold/faint/italic/underline, 31..36 and 91..96 for foreground colours and their bright variants). The two duplicated lists are replaced by a single early-return guarded by the helper, keeping the quote_begin / quote_end handling per-UI as before. Behaviour-preserving: the same set of codes is suppressed on the same UIs; the quote commands still render as single-quote on all three UIs. Verified by comparing PLAIN, XML, and JSON output of a diagnostic that exercises both quoting and colour before and after this change. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
These will permit custom formatting of quoting for each message handler, and for a start introduce tags for XML. See #4875 for discussion.
Please review commit-by-commit.