gbranden pushed a commit to branch master in repository groff. commit 5e13a5d9f951fbd212bd7531a0a7390843277b4a Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Mon Mar 3 01:33:58 2025 -0600
[troff]: Implement recursive node dumping (5c/9). * src/roff/troff/node.h (class diverted_copy_file_node): Specialize (override) `dump_properties()` for this class. * src/roff/troff/node.cpp (diverted_copy_file_node::dump_properties): New member function reports value of `filename` property. At present I don't know of a way to get a diverted copy file node to report itself in debugging output; the `pline` request works only on nodes that are in a pending output line, and nodes of this type are added only to a `macro_diversion` object, not an output line node list. Nevertheless this plants a tree today whose shade we might enjoy later. Here's an example of what its output would look like: {"type": "diverted_copy_file_node", "diversion level": 0, "is_special_node": false, "filename": "ATTIC/trf-fodder"} --- ChangeLog | 8 ++++++++ src/roff/troff/node.cpp | 8 ++++++++ src/roff/troff/node.h | 1 + 3 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index e3c46daba..b6e6af3f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2025-03-03 G. Branden Robinson <g.branden.robin...@gmail.com> + + * src/roff/troff/node.h (class diverted_copy_file_node): + Specialize (override) `dump_properties()` for this class. + * src/roff/troff/node.cpp + (diverted_copy_file_node::dump_properties): New member function + reports value of `filename` property. + 2025-03-02 G. Branden Robinson <g.branden.robin...@gmail.com> * src/roff/troff/node.h (class diverted_space_node): Specialize diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp index b50a7095d..f538344e2 100644 --- a/src/roff/troff/node.cpp +++ b/src/roff/troff/node.cpp @@ -3416,6 +3416,14 @@ diverted_copy_file_node::diverted_copy_file_node(symbol s, node *p) { } +void diverted_copy_file_node::dump_properties() +{ + node::dump_properties(); + fputs(", \"filename\": ", stderr); + filename.json_dump(); + fflush(stderr); +} + node *diverted_copy_file_node::copy() { return new diverted_copy_file_node(filename, state, div_nest_level); diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h index 7045b4acc..0c5d176d0 100644 --- a/src/roff/troff/node.h +++ b/src/roff/troff/node.h @@ -308,6 +308,7 @@ public: const char *type(); bool causes_tprint(); bool is_tag(); + void dump_properties(); }; class extra_size_node : public node { _______________________________________________ groff-commit mailing list groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit