gbranden pushed a commit to branch master
in repository groff.
commit 84a10f2eeb643e6ee4406085ca248b659f959b3d
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Sep 11 11:17:23 2025 -0500
[troff]: "Asciify" token nodes as nothing.
Token nodes are used only internally to manipulate the input stream;
they don't directly correspond to any sort of document feature.
* src/roff/troff/node.h (class token_node): Declare `asciify` member
function, thus overriding base class.
* src/roff/troff/node.cpp (token_node::asciify): Plant land mine with
`assert()`. Delete the `this` object and return.
---
ChangeLog | 11 +++++++++++
src/roff/troff/input.cpp | 7 +++++++
2 files changed, 18 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index f56909cc0..b01220604 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2025-09-11 G. Branden Robinson <[email protected]>
+
+ [troff]: "Asciify" token nodes as nothing. Token nodes are used
+ only internally to manipulate the input stream; they don't
+ directly correspond to any sort of document feature.
+
+ * src/roff/troff/node.h (class token_node): Declare `asciify`
+ member function, thus overriding base class.
+ * src/roff/troff/node.cpp (token_node::asciify): Plant land mine
+ with `assert()`. Delete the `this` object and return.
+
2025-09-11 G. Branden Robinson <[email protected]>
[troff]: "Asciify" (plain) space nodes as nothing. (Plain space
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index bceb41dba..ce67bc7e1 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -1881,6 +1881,7 @@ class token_node : public node {
public:
token tk;
token_node(const token &t);
+ void asciify(macro *);
node *copy();
token_node *get_token_node();
bool is_same_as(node *);
@@ -1893,6 +1894,12 @@ token_node::token_node(const token &t) : tk(t)
{
}
+void token_node::asciify(macro *)
+{
+ assert(0 == "attempting to 'asciify' a `token_node`");
+ delete this;
+}
+
node *token_node::copy()
{
return new token_node(tk);
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit