gbranden pushed a commit to branch master
in repository groff.
commit 65353df92983543d13c9fb1c237402b1501cd132
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Sep 11 11:09:05 2025 -0500
[troff]: Revise source annotations.
---
src/roff/troff/input.cpp | 2 ++
src/roff/troff/node.cpp | 15 +++++----------
src/roff/troff/node.h | 1 +
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 8310a6e93..bceb41dba 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -1285,6 +1285,7 @@ static int get_copy(node **nd, bool is_defining, bool
handle_escape_E)
}
}
+// \a or \t
class non_interpreted_char_node : public node {
unsigned char c;
public:
@@ -5999,6 +6000,7 @@ void read_title_parts(node **part, hunits *part_width)
tok.next();
}
+// contents of `\?...\?`
class non_interpreted_node : public node {
macro mac;
public:
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 512a6f68d..d3ade0bf6 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -3814,7 +3814,7 @@ void vline_node::vertical_extent(vunits *min, vunits *max)
}
}
-/* ascii_print methods */
+// `ascii_print()` represents a node for `troff -a`
static void ascii_print_node_list(ascii_output_file *ascii, node *n)
{
@@ -3882,7 +3882,10 @@ void zero_width_node::ascii_print(ascii_output_file *out)
ascii_print_node_list(out, nodes);
}
-/* asciify methods */
+// `asciify()` extracts the simple character content of a node; this is
+// a plain text (but not necessarily plain "ASCII") representation
+// suitable for storage in a groff string or embedding in a device
+// extension command escape sequence (as for PDF metadata).
void node::asciify(macro *m)
{
@@ -4016,7 +4019,6 @@ void line_start_node::asciify(macro *)
delete this;
}
-// TODO: If we chose a delimiter, we could undivert these.
void vertical_size_node::asciify(macro *)
{
delete this;
@@ -4024,31 +4026,24 @@ void vertical_size_node::asciify(macro *)
void dummy_node::asciify(macro *)
{
- // TODO: m->append(ESCAPE_AMPERSAND); ?
delete this;
}
void transparent_dummy_node::asciify(macro *)
{
- // TODO: m->append(ESCAPE_c); ?
delete this;
}
-// XXX: Could tag_node justify itself as a kind of device_extension_node
-// that can't be undiverted?
void tag_node::asciify(macro *)
{
delete this;
}
-// TODO: If we knew what delimiter to select, we could undivert these,
-// but the macro's character list could contain anything.
void device_extension_node::asciify(macro *)
{
delete this;
}
-// TODO: If we chose a delimiter, we could undivert these.
void vmotion_node::asciify(macro *)
{
delete this;
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index 1fc905314..391a4c4b1 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -188,6 +188,7 @@ public:
const char *type();
};
+// Represent a space of any width, including zero.
class space_node : public node {
private:
protected:
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit