gbranden pushed a commit to branch master
in repository groff.

commit 64a21429b2e7cbcd71b9e3f78e22008176f25729
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun May 24 22:37:00 2026 -0500

    [troff]: Annotate unusual request handlers.
    
    The syntax of a handful of requests is such that their operands are
    individual charcters, and therefore those individual characters
    _can_[1], but _need not_ be separated by spaces as request arguments
    normally must be.
    
    [1] Except for `tr`, which was a toybox of unspecified, undocumented
        behaviors drafted into service as clever tricks by AT&T troff users.
        See Savannah #68133.
---
 src/roff/troff/input.cpp | 12 ++++++++++++
 src/roff/troff/node.cpp  |  3 +++
 2 files changed, 15 insertions(+)

diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 425822936..8a7c74e4b 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -5315,6 +5315,9 @@ static void define_special_character_request() // .schar
   define_character(CHAR_SPECIAL_FALLBACK);
 }
 
+// Because `pchar` doesn't require spaces separating its "arguments",
+// we don't use `has_arg()` except initially to determine whether we
+// have any arguments at all.
 static void print_character_request() // .pchar
 {
   if (!has_arg()) {
@@ -5345,6 +5348,9 @@ static void print_character_request() // .pchar
 }
 
 
+// Because `rchar` doesn't require spaces separating its "arguments",
+// we don't use `has_arg()` except initially to determine whether we
+// have any arguments at all.
 static void remove_character() // .rchar
 {
   if (!has_arg()) {
@@ -8816,6 +8822,9 @@ static void translate_input() // .trin
   do_translate(true /* transparently */, true /* as_input */);
 }
 
+// Because `cflags` doesn't require spaces separating its "arguments"
+// (after the first), we don't use `has_arg()` except to determine
+// whether we have a first argument, and any beyond the first.
 static void set_character_flags_request() // .cflags
 {
   if (!has_arg()) {
@@ -8866,6 +8875,9 @@ static void set_character_flags_request() // .cflags
   skip_line();
 }
 
+// Because `hcode` doesn't require spaces separating its "arguments",
+// we don't use `has_arg()` except initially to determine whether we
+// have any arguments at all.
 static void set_hyphenation_codes() // .hcode
 {
   if (!has_arg()) {
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 9d3fe7bbe..0cdb52b22 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -7133,6 +7133,9 @@ static void define_font_specific_character_request() // 
.fschar
   // eats the rest of it for us.
 }
 
+// Because `rfschar` doesn't require spaces separating its "arguments"
+// (after the first), we don't use `has_arg()` except to determine
+// whether we have a first argument, and any beyond the first.
 static void remove_font_specific_character_request() // .rfschar
 {
   if (!has_arg()) {

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to