gbranden pushed a commit to branch master
in repository groff.
commit 50b74c70f45d0eb21ca38c715282130bd2648562
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Dec 5 04:30:54 2025 -0600
[troff]: Fix blunder in `pchar`'s lexing.
* src/roff/troff/input.cpp (print_character_request): Fix blunder in
lexical analysis. We were skipping over spaces _prior_ to arguments,
but not _after_ them, just before we hit the end of the line, and
issuing a spurious error diagnostic. Fix it by moving the condition
that terminates the input reading loop, making it formally infinite
(but with a conditional `break` in the middle--we'll read a newline or
EOF eventually).
---
ChangeLog | 10 ++++++++++
src/roff/troff/input.cpp | 4 +++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 9dfb92c69..937aaf6ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2025-12-05 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/input.cpp (print_character_request): Fix
+ blunder in lexical analysis. We were skipping over spaces
+ _prior_ to arguments, but not _after_ them, just before we hit
+ the end of the line, and issuing a spurious error diagnostic.
+ Fix it by moving the condition that terminates the input reading
+ loop, making it formally infinite (but with a conditional
+ `break` in the middle--we'll read a newline or EOF eventually).
+
2025-12-05 G. Branden Robinson <[email protected]>
[groff]: Add unit test for new `pchar` request.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index bef185ea1..15ace1988 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -5092,6 +5092,8 @@ static void print_character_request()
charinfo *ci;
do {
tok.skip_spaces();
+ if (tok.is_newline() || tok.is_eof())
+ break;
if (!tok.is_any_character()) {
error("character report request expects characters or character"
" classes as arguments; got %1", tok.description());
@@ -5107,7 +5109,7 @@ static void print_character_request()
ci->dump();
}
tok.next();
- } while (!tok.is_newline() && !tok.is_eof());
+ } while (true);
skip_line();
}
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit