gbranden pushed a commit to branch master
in repository groff.
commit 818a47f6881debe0f6b447f25f49a64eb348f083
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Nov 23 15:47:43 2025 -0600
src/roff/troff/input.cpp: Improve diagnostic.
...when user fumbles escape character selection.
* src/roff/troff/input.cpp (assign_escape_character): Do it.
Before:
$ printf '.ec \\`\n.ec \\~\n.ec \\|\n' | groff
troff:<standard input>:1: error: cannot select invalid escape character;
using '\'
troff:<standard input>:2: error: cannot select invalid escape character;
using '\'
troff:<standard input>:3: error: cannot select invalid escape character;
using '\'
After:
$ printf '.ec \\`\n.ec \\~\n.ec \\|\n' | ./build/test-groff
troff:<standard input>:1: error: cannot select special character 'ga' as
escape character; using '\'
troff:<standard input>:2: error: cannot select an escaped '~' as escape
character; using '\'
troff:<standard input>:3: error: cannot select a horizontal motion as
escape character; using '\'
---
ChangeLog | 5 +++++
src/roff/troff/input.cpp | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index bfcc2028e..4a730f06d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2025-11-23 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/input.cpp (assign_escape_character): Improve
+ diagnostic when user fumbles escape character selection.
+
2025-11-23 G. Branden Robinson <[email protected]>
* src/roff/troff/env.cpp (environment::add_node): Add assertion.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 946ca3d36..931e4b089 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -220,7 +220,8 @@ static void assign_escape_character()
is_invalid ? "cannot select invalid escape character, and"
: "", already_message, input_char_description(ec));
else if (is_invalid) {
- error("cannot select invalid escape character; using '\\'");
+ error("cannot select %1 as escape character; using '\\'",
+ tok.description());
escape_char = '\\';
}
else
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit