gbranden pushed a commit to branch master
in repository groff.
commit cc71da27d2bfbaf6a971f8fa8be105e3fe8dc7d1
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Oct 18 09:08:39 2026 -0500
[troff]: Improve error diagnostics.
* src/roff/troff/input.cpp (diagnose_invalid_identifier)
(read_input_until_terminator): When squawking about an invalid input
token in an identifier, articulate the consequence: the identifier is
ignored, as if it were not present. That is uniformly how the
formatter's request and escape sequence handlers deal with them.
While `read_input_until_terminator()` is a more general function used
to collect language tokens other than identifiers (like names of color
spaces), the diagnostic message changed here is only reachable if the
function parameter `want_identifier` is `true`.
---
ChangeLog | 15 +++++++++++++++
src/roff/troff/input.cpp | 4 ++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 48c7a3f16..55dbe8549 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2026-10-18 G. Branden Robinson <[email protected]>
+
+ [troff]: Improve error diagnostics.
+
+ * src/roff/troff/input.cpp (diagnose_invalid_identifier)
+ (read_input_until_terminator): When squawking about an invalid
+ input token in an identifier, articulate the consequence: the
+ identifier is ignored, as if it were not present. That is
+ uniformly how the formatter's request and escape sequence
+ handlers deal with them. While `read_input_until_terminator()`
+ is a more general function used to collect language tokens other
+ than identifiers (like names of color spaces), the diagnostic
+ message changed here is only reachable if the function parameter
+ `want_identifier` is `true`.
+
2026-10-17 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp (read_line_rule_expression): Throw
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index d4eca32cb..a3f5c4c2c 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -3305,7 +3305,7 @@ static void diagnose_invalid_identifier()
&& !tok.is_tab() && !tok.is_right_brace()
// We don't want to give a warning for .el\{
&& !tok.is_left_brace())
- error("%1 is not allowed in an identifier", tok.description());
+ error("ignoring identifier containing %1", tok.description());
}
symbol read_identifier(bool want_diagnostic)
@@ -3382,7 +3382,7 @@ static symbol read_input_until_terminator(bool
want_diagnostic,
// Of C0 controls, Solaris, Heirloom, and Plan 9 troff support
// ^[BCEFG] (only) in identifiers. DWB 3.3 supports none.
assert(buf[i] != ' '); // ensure caller handled spaces
- error("character code %1 is not allowed in an identifier",
+ error("ignoring identifier containing invalid character code %1",
static_cast<int>(buf[i]));
delete[] buf;
return NULL_SYMBOL;
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit