gbranden pushed a commit to branch master
in repository groff.
commit 9153ecc584fa7619d61193fc0ea24d58d43a0052
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Jul 11 21:15:55 2026 -0500
[troff]: Refactor `rchar` request handler.
* src/roff/troff/input.cpp (remove_character): Refactor to use new
`read_any_character()` function. Drop now unreachable diagnostic;
`read_any_character()` complains if the token on the input stream is
not a character.
---
ChangeLog | 7 +++++++
src/roff/troff/input.cpp | 27 +++++++++------------------
2 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f1c7a53bd..c628e5564 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-07-12 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/input.cpp (remove_character): Refactor to use
+ new `read_any_character()` function. Drop now unreachable
+ diagnostic; `read_any_character()` complains if the token on the
+ input stream is not a character.
+
2026-07-11 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp (set_character_flags_request): Change
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 5c6dc868b..ee2e0200d 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -5395,24 +5395,15 @@ static void remove_character() // .rchar
skip_line();
return;
}
- while (!tok.is_terminator()) {
- if (!tok.is_space() && !tok.is_tab()) {
- if (tok.is_any_character()) {
- charinfo *ci = tok.get_charinfo(true /* is_mandatory */,
- true /* suppress creation */);
- if (0 /* nullptr */ == ci)
- warning(WARN_CHAR, "%1 is not defined", tok.description());
- else {
- macro *m = ci->set_macro(0 /* nullptr */);
- if (m != 0 /* nullptr */)
- delete m;
- }
- }
- else {
- error("cannot remove character; %1 is not a character",
- tok.description());
- break;
- }
+ while (read_any_character()) {
+ charinfo *ci = tok.get_charinfo(true /* is_mandatory */,
+ true /* suppress creation */);
+ if (0 /* nullptr */ == ci)
+ warning(WARN_CHAR, "%1 is not defined", tok.description());
+ else {
+ macro *m = ci->set_macro(0 /* nullptr */);
+ if (m != 0 /* nullptr */)
+ delete m;
}
tok.next();
}
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit