gbranden pushed a commit to branch master
in repository groff.
commit 8e786951cd5a2be923fb1f3f7fae3ff4d5b888bd
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Dec 13 13:45:05 2025 -0600
[troff]: Warn on `\[h0|^]` after `\c`.
* src/roff/troff/input.cpp (process_input_stack): Emit warning in
category "syntax", and otherwise ignore, horizontal space tokens
(including `\h`, `\0`, `\|`, and `\^) after `\c` on an input line.
---
ChangeLog | 7 +++++++
src/roff/troff/input.cpp | 11 ++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 4a86b719d..545398083 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-12-13 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/input.cpp (process_input_stack): Emit warning
+ in category "syntax", and otherwise ignore, horizontal space
+ tokens (including `\h`, `\0`, `\|`, and `\^) after `\c` on an
+ input line.
+
2025-12-13 G. Branden Robinson <[email protected]>
* src/roff/troff/input.cpp (token::next): Reject `\s` escape
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index d08dfda3b..2a6f51577 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -3608,7 +3608,16 @@ void process_input_stack()
return;
case token::TOKEN_NODE:
case token::TOKEN_HORIZONTAL_SPACE:
- if (possibly_handle_first_page_transition())
+ if (curenv->get_was_line_interrupted()) {
+ // We don't want to warn about node types. They might have been
+ // interpolated into the input by the formatter itself, as with
+ // the extra vertical space nodes appended to diversions.
+ if (token::TOKEN_HORIZONTAL_SPACE == tok.type)
+ warning(WARN_SYNTAX, "ignoring %1 on input line after"
+ " output line continuation escape sequence",
+ tok.description());
+ }
+ else if (possibly_handle_first_page_transition())
;
else if (tok.nd->need_reread(&reading_beginning_of_input_line)) {
delete tok.nd;
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit