gbranden pushed a commit to branch master
in repository groff.
commit f17667212a98906025a5f8f1f799eaab7b16b112
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Nov 23 17:36:34 2025 -0600
src/roff/troff/input.cpp: Refactor.
* src/roff/troff/input.cpp (token::is_usable_as_delimiter): Use new node
token description member function.
---
ChangeLog | 5 +++++
src/roff/troff/input.cpp | 12 +++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a143ac0d8..31d93bd47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2025-11-23 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/input.cpp (token::is_usable_as_delimiter): Use
+ new node token description member function.
+
2025-11-23 G. Branden Robinson <[email protected]>
[troff]: Refactor new token description logic into its own
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 384171204..86b9e6d0c 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2896,9 +2896,15 @@ bool token::is_usable_as_delimiter(bool report_error,
static_cast<char>(c));
return is_valid;
case TOKEN_NODE:
- // the user doesn't know what a node is
- if (report_error)
- error("missing argument or invalid delimiter");
+ if (report_error) {
+ // Reserve a buffer large enough to handle the lengthiest case.
+ const size_t maxstr
+ = sizeof "space character horizontal motion node token";
+ const size_t bufsz = maxstr + 1; // for trailing '\0'
+ static char buf[bufsz];
+ describe_node(buf, bufsz);
+ error("%1 is not allowed as a delimiter", buf);
+ }
return false;
case TOKEN_SPACE:
case TOKEN_STRETCHABLE_SPACE:
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit