gbranden pushed a commit to branch master
in repository groff.

commit c7d9d93ec56df67c31f03b7a6a07532c34524d8d
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Apr 9 01:40:04 2026 -0500

    [troff]: Trivially refactor for semantic clarity.
    
    The parameter named `required` used by many functions was employed for
    two slightly different purposes.  In some instances, it indicated
    whether emission of a diagnostic message was desired in the event a
    token expected on the input stream (or similar) was absent.  In others,
    it encoded whether the presence of such a token was _optional_, in which
    case both its presence and absence were valid.  The latter tends to be
    the case when a token is present but might or might not have associated
    `charinfo` data.  Detangle these issues by renaming `required` arguments
    to `want_diagnostic` and `is_mandatory` as appropriate.
    
    * src/roff/troff/token.h: Rename `required` argument in declarations.
    
    * src/roff/troff/input.cpp (diagnose_missing_identifier):
      (token::get_charinfo): Rename `required` argument to `is_mandatory` in
      definitions.
    
      (read_identifier, read_long_identifier) (read_input_until_terminator):
      Rename `required` argument to `want_diagnostic` in definitions.
    
    * src/roff/troff/column.cpp (column_justify) [COLUMN]:
    * src/roff/troff/div.cpp (change_trap):
    * src/roff/troff/env.cpp (do_input_trap)
      (add_hyphenation_exception_words_request):
    * src/roff/troff/input.cpp (read_rgb, read_cmy, read_cmyk)
      (read_gray, do_overstrike, do_bracket, token::next)
      (token::description, read_input_until_terminator)
      (do_define_string, define_character, print_character_request)
      (remove_character, do_define_macro, read_line_rule_expression)
      (do_register, encode_special_character_for_device_output)
      (device_request, device_macro_request)
      (is_conditional_expression_true, ps_bbox_request, open_file)
      (do_write_request, stream_write_macro_request, do_translate)
      (set_character_flags_request, define_class_request)
      (vjustify) [COLUMN]:
    * src/roff/troff/node.cpp (translate_font_request)
      (mount_font_at_position_request)
      (associate_style_with_font_position_request)
      (read_font_identifier, remove_font_specific_character_request)
    * src/roff/troff/reg.cpp (inline_define_register): Update annotations at
      call sites and in declarations.
---
 ChangeLog                 |  47 ++++++++++++++++++++
 src/roff/troff/column.cpp |   4 +-
 src/roff/troff/div.cpp    |   2 +-
 src/roff/troff/env.cpp    |   4 +-
 src/roff/troff/input.cpp  | 108 +++++++++++++++++++++++-----------------------
 src/roff/troff/node.cpp   |  12 +++---
 src/roff/troff/reg.cpp    |   2 +-
 src/roff/troff/token.h    |   8 ++--
 8 files changed, 118 insertions(+), 69 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1a3a3de0e..873d43a02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,50 @@
+2026-04-09  G. Branden Robinson <[email protected]>
+
+       [troff]: Trivially refactor for semantic clarity.  The parameter
+       named `required` used by many functions was employed for two
+       slightly different purposes.  In some instances, it indicated
+       whether emission of a diagnostic message was desired in the
+       event a token expected on the input stream (or similar) was
+       absent.  In others, it encoded whether the presence of such a
+       token was _optional_, in which case both its presence and
+       absence were valid.  The latter tends to be the case when a
+       token is present but might or might not have associated
+       `charinfo` data.  Detangle these issues by renaming `required`
+       arguments to `want_diagnostic` and `is_mandatory` as
+       appropriate.
+
+       * src/roff/troff/token.h: Rename `required` argument in
+       declarations.
+
+       * src/roff/troff/input.cpp (diagnose_missing_identifier):
+       (token::get_charinfo): Rename `required` argument to
+       `is_mandatory` in definitions.
+       (read_identifier, read_long_identifier)
+       (read_input_until_terminator): Rename `required` argument to
+       `want_diagnostic` in definitions.
+
+       * src/roff/troff/column.cpp (column_justify) [COLUMN]:
+       * src/roff/troff/div.cpp (change_trap):
+       * src/roff/troff/env.cpp (do_input_trap)
+       (add_hyphenation_exception_words_request):
+       * src/roff/troff/input.cpp (read_rgb, read_cmy, read_cmyk)
+       (read_gray, do_overstrike, do_bracket, token::next)
+       (token::description, read_input_until_terminator)
+       (do_define_string, define_character, print_character_request)
+       (remove_character, do_define_macro, read_line_rule_expression)
+       (do_register, encode_special_character_for_device_output)
+       (device_request, device_macro_request)
+       (is_conditional_expression_true, ps_bbox_request, open_file)
+       (do_write_request, stream_write_macro_request, do_translate)
+       (set_character_flags_request, define_class_request)
+       (vjustify) [COLUMN]:
+       * src/roff/troff/node.cpp (translate_font_request)
+       (mount_font_at_position_request)
+       (associate_style_with_font_position_request)
+       (read_font_identifier, remove_font_specific_character_request)
+       * src/roff/troff/reg.cpp (inline_define_register): Update
+       annotations at call sites and in declarations.
+
 2026-04-09  G. Branden Robinson <[email protected]>
 
        [build]: Drop no longer needed check for `struct exception`.  It
diff --git a/src/roff/troff/column.cpp b/src/roff/troff/column.cpp
index 09e9557ee..89fc1a2d3 100644
--- a/src/roff/troff/column.cpp
+++ b/src/roff/troff/column.cpp
@@ -554,14 +554,14 @@ static void column_justify()
     error("can't justify column - column not active");
   else if (read_vunits(&height, 'v')) {
     justification_spec js(height);
-    symbol nm = read_long_identifier(true /* required */);
+    symbol nm = read_long_identifier(true /* want_diagnostic */);
     if (!nm.is_null()) {
       vunits v;
       if (read_vunits(&v, 'v')) {
        js.append(nm, v);
        int err = 0;
        while (has_arg()) {
-         nm = read_long_identifier(true /* required */);
+         nm = read_long_identifier(true /* want_diagnostic */);
          if (nm.is_null()) {
            err = 1;
            break;
diff --git a/src/roff/troff/div.cpp b/src/roff/troff/div.cpp
index 20874474d..6abd7632b 100644
--- a/src/roff/troff/div.cpp
+++ b/src/roff/troff/div.cpp
@@ -1011,7 +1011,7 @@ static void diversion_trap() // .dt
 
 static void change_trap() // .ch
 {
-  symbol s = read_identifier(true /* required */);
+  symbol s = read_identifier(true /* want_diagnostic */);
   if (!s.is_null()) {
     vunits x;
     if (has_arg() && read_vunits(&x, 'v'))
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 4e39490d9..562d014e9 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2860,7 +2860,7 @@ void do_input_trap(bool respect_continuation)
       warning(WARN_RANGE,
              "input trap line count must be greater than zero");
     else {
-      symbol s = read_identifier(true /* required */);
+      symbol s = read_identifier(true /* want_diagnostic */);
       if (!s.is_null()) {
        curenv->input_trap_count = n;
        curenv->input_trap = s;
@@ -3936,7 +3936,7 @@ static void add_hyphenation_exception_words_request() // 
.hw
           && !tok.is_space()
           && !tok.is_newline()
           && !tok.is_eof()) {
-      charinfo *ci = tok.get_charinfo(false /* required */);
+      charinfo *ci = tok.get_charinfo(false /* is_mandatory */);
       if (0 /* nullptr */ == ci) {
        is_word_valid = false;
        if (!was_warned) {
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index d4f369193..1979dc948 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -198,7 +198,7 @@ static bool read_delimited_measurement(units * /* n */,
     unsigned char /* si */);
 static bool read_delimited_measurement(units * /* n */,
     unsigned char /* si */, units /* prev_value */);
-static symbol read_input_until_terminator(bool /* required */,
+static symbol read_input_until_terminator(bool /* want_diagnostic */,
     unsigned char /* end_char */, bool /* want_identifier */ = false);
 static bool read_line_rule_expression(units * /* res */,
     unsigned char /* si */, charinfo ** /* cp */);
@@ -1459,8 +1459,8 @@ static unsigned int read_color_channel_value(const char 
*scheme,
 
 static color *read_rgb(unsigned char end = 0U)
 {
-  symbol component = read_input_until_terminator(false /* required */,
-                                                end);
+  symbol component
+    = read_input_until_terminator(false /* want_diagnostic */, end);
   if (component.is_null()) {
     warning(WARN_COLOR, "missing rgb color values");
     return 0 /* nullptr */;
@@ -1493,8 +1493,8 @@ static color *read_rgb(unsigned char end = 0U)
 
 static color *read_cmy(unsigned char end = 0U)
 {
-  symbol component = read_input_until_terminator(false /* required */,
-                                                end);
+  symbol component
+    = read_input_until_terminator(false /* want_diagnostic */, end);
   if (component.is_null()) {
     warning(WARN_COLOR, "missing cmy color values");
     return 0 /* nullptr */;
@@ -1527,8 +1527,8 @@ static color *read_cmy(unsigned char end = 0U)
 
 static color *read_cmyk(unsigned char end = 0U)
 {
-  symbol component = read_input_until_terminator(false /* required */,
-                                                end);
+  symbol component
+    = read_input_until_terminator(false /* want_diagnostic */, end);
   if (component.is_null()) {
     warning(WARN_COLOR, "missing cmyk color values");
     return 0 /* nullptr */;
@@ -1563,8 +1563,8 @@ static color *read_cmyk(unsigned char end = 0U)
 
 static color *read_gray(unsigned char end = 0U)
 {
-  symbol component = read_input_until_terminator(false /* required */,
-                                                end);
+  symbol component
+    = read_input_until_terminator(false /* want_diagnostic */, end);
   if (component.is_null()) {
     warning(WARN_COLOR, "missing gray value");
     return 0 /* nullptr */;
@@ -1729,7 +1729,7 @@ node *do_overstrike() // \o
     }
     else {
       // TODO: In theory, we could accept spaces and horizontal motions.
-      charinfo *ci = tok.get_charinfo(true /* required */);
+      charinfo *ci = tok.get_charinfo(true /* is_mandatory */);
       if (0 /* nullptr */ == ci) {
        error("%1 is not supported in an overstrike escape sequence"
              " argument", tok.description());
@@ -1788,7 +1788,7 @@ static node *do_bracket() // \b
        && (want_att_compat || input_stack::get_level() == start_level))
       break;
     // TODO: In theory, we could accept spaces and horizontal motions.
-    charinfo *ci = tok.get_charinfo(true /* required */);
+    charinfo *ci = tok.get_charinfo(true /* is_mandatory */);
     if (0 /* nullptr */ == ci) {
       error("%1 is not supported in a bracket-building escape sequence"
            " argument", tok.description());
@@ -2727,7 +2727,7 @@ void token::next()
        else {
          // TODO: In theory, we could accept spaces and horizontal
          // motions.
-         charinfo *ci = get_charinfo(true /* required */);
+         charinfo *ci = get_charinfo(true /* is_mandatory */);
          if (0 /* nullptr */ == ci) {
            error("%1 is not supported in a zero-width character"
                  " escape sequence argument", tok.description());
@@ -3095,7 +3095,7 @@ const char *token::description()
       static const char nonexistent[] = "nonexistent special character"
                                        " or class";
       const char *ctype = special_character;
-      charinfo *ci = get_charinfo(false /* required */,
+      charinfo *ci = get_charinfo(false /* is_mandatory */,
                                  true /* suppress creation */);
       if (0 /* nullptr */ == ci)
        ctype = nonexistent;
@@ -3163,10 +3163,10 @@ void compatible()
   skip_line();
 }
 
-static void diagnose_missing_identifier(bool required)
+static void diagnose_missing_identifier(bool is_mandatory)
 {
   if (tok.is_newline() || tok.is_eof()) {
-    if (required)
+    if (is_mandatory)
       warning(WARN_MISSING, "missing identifier");
   }
   else if (tok.is_right_brace() || tok.is_tab()) {
@@ -3179,11 +3179,11 @@ static void diagnose_missing_identifier(bool required)
     // XXX: unreachable code? --GBR
     if (!tok.is_newline() && !tok.is_eof())
       error("%1 is not allowed before an argument", start);
-    else if (required)
+    else if (is_mandatory)
       warning(WARN_MISSING, "missing identifier");
     free(start);
   }
-  else if (required)
+  else if (is_mandatory)
     error("expected identifier, got %1", tok.description());
   else
     error("expected identifier, got %1; treated as missing",
@@ -3199,7 +3199,7 @@ static void diagnose_invalid_identifier()
     error("%1 is not allowed in an identifier", tok.description());
 }
 
-symbol read_identifier(bool required)
+symbol read_identifier(bool want_diagnostic)
 {
   if (want_att_compat) {
     char buf[3];
@@ -3215,23 +3215,23 @@ symbol read_identifier(bool required)
       return symbol(buf);
     }
     else {
-      diagnose_missing_identifier(required);
+      diagnose_missing_identifier(want_diagnostic);
       return NULL_SYMBOL;
     }
   }
   else
-    return read_long_identifier(required);
+    return read_long_identifier(want_diagnostic);
 }
 
-symbol read_long_identifier(bool required)
+symbol read_long_identifier(bool want_diagnostic)
 {
-  return read_input_until_terminator(required, 0U,
+  return read_input_until_terminator(want_diagnostic, 0U,
                                     true /* want identifier */);
 }
 
 // Read bytes from input until reaching a null byte or the specified
 // `end_char`; construct and return a `symbol` object therefrom.
-static symbol read_input_until_terminator(bool required,
+static symbol read_input_until_terminator(bool want_diagnostic,
                                          unsigned char end_char,
                                          bool want_identifier)
 {
@@ -3282,7 +3282,7 @@ static symbol read_input_until_terminator(bool required,
     tok.next();
   }
   if (0 == i) {
-    diagnose_missing_identifier(required);
+    diagnose_missing_identifier(want_diagnostic /* is_mandatory */);
     delete[] buf;
     return NULL_SYMBOL;
   }
@@ -5062,7 +5062,7 @@ static void do_define_string(define_mode mode, comp_mode 
comp)
   symbol nm;
   node *n = 0 /* nullptr */;
   int c;
-  nm = read_identifier(true /* required */);
+  nm = read_identifier(true /* want_diagnostic */);
   if (nm.is_null()) {
     skip_line();
     return;
@@ -5159,7 +5159,7 @@ void define_character(char_mode mode, const char 
*font_name)
 {
   const char *modestr = character_mode_description(mode);
   tok.skip_spaces();
-  charinfo *ci = tok.get_charinfo(true /* required */);
+  charinfo *ci = tok.get_charinfo(true /* is_mandatory */);
   if (0 /* nullptr */ == ci) {
     assert(0 == "attempted to use token without charinfo in character"
           " definition request");
@@ -5261,7 +5261,7 @@ static void print_character_request()
            " classes as arguments; got %1", tok.description());
       break;
     }
-    ci = tok.get_charinfo(false /* required */,
+    ci = tok.get_charinfo(false /* is_mandatory */,
                          true /* suppress creation */);
     if (ci != 0 /* nullptr */) {
       errprint("%1\n", tok.description());
@@ -5284,7 +5284,7 @@ static void remove_character()
   while (!tok.is_newline() && !tok.is_eof()) {
     if (!tok.is_space() && !tok.is_tab()) {
       if (tok.is_any_character()) {
-       charinfo *ci = tok.get_charinfo(true /* required */,
+       charinfo *ci = tok.get_charinfo(true /* is_mandatory */,
                                        true /* suppress creation */);
        if (0 /* nullptr */ == ci)
           warning(WARN_CHAR, "%1 is not defined", tok.description());
@@ -5473,7 +5473,7 @@ static void do_define_macro(define_mode mode, 
calling_mode calling,
 {
   symbol nm, term, dot_symbol(".");
   if (CALLING_INDIRECT == calling) {
-    symbol temp1 = read_identifier(true /* required */);
+    symbol temp1 = read_identifier(true /* want_diagnostic */);
     if (temp1.is_null()) {
       skip_line();
       return;
@@ -5489,7 +5489,7 @@ static void do_define_macro(define_mode mode, 
calling_mode calling,
     tok.next();
   }
   if ((DEFINE_NORMAL == mode) || (DEFINE_APPEND == mode)) {
-    nm = read_identifier(true /* required */);
+    nm = read_identifier(true /* want_diagnostic */);
     if (nm.is_null()) {
       skip_line();
       return;
@@ -6166,7 +6166,7 @@ static bool read_line_rule_expression(units *n, unsigned 
char si,
       tok.next();
     if (!(start_token == tok
          && input_stack::get_level() == start_level)) {
-      *cip = tok.get_charinfo(true /* required */);
+      *cip = tok.get_charinfo(true /* is_mandatory */);
       if (0 /* nullptr */ == *cip)
        assert(0 == "attempted to use token without charinfo in"
               " line-drawing escape sequence");
@@ -6431,7 +6431,7 @@ static void do_register() // \R
     return;
 #endif
   tok.next();
-  symbol nm = read_long_identifier(true /* required */);
+  symbol nm = read_long_identifier(true /* want_diagnostic */);
   if (nm.is_null())
     return;
   tok.skip_spaces();
@@ -6737,7 +6737,7 @@ static void map_special_character_for_device_output(macro 
*mac,
 static void encode_special_character_for_device_output(macro *mac)
 {
   const char *sc;
-  charinfo *ci = tok.get_charinfo(true /* required */);
+  charinfo *ci = tok.get_charinfo(true /* is_mandatory */);
   if (0 /* nullptr */ == ci) {
     assert(0 == "attempted to encode token without charinfo for"
           " device extension command output");
@@ -6953,7 +6953,7 @@ static void device_request()
 
 static void device_macro_request()
 {
-  symbol s = read_identifier(true /* required */);
+  symbol s = read_identifier(true /* want_diagnostic */);
   if (!(s.is_null() || s.is_empty())) {
     request_or_macro *p = lookup_request(s);
     macro *m = p->to_macro();
@@ -7280,7 +7280,7 @@ static bool is_conditional_expression_true()
   // Check for GNU troff extended conditional expression operators.
   else if ((c == int('d') || (c == int('r')))) { // TODO: grochar
     tok.next();
-    symbol nm = read_identifier(true /* required */);
+    symbol nm = read_identifier(true /* want_diagnostic */);
     if (nm.is_null()) {
       skip_branch();
       return false;
@@ -7291,7 +7291,7 @@ static bool is_conditional_expression_true()
   }
   else if (c == 'm') {
     tok.next();
-    symbol nm = read_long_identifier(true /* required */);
+    symbol nm = read_long_identifier(true /* want_diagnostic */);
     if (nm.is_null()) {
       skip_branch();
       return false;
@@ -7306,7 +7306,7 @@ static bool is_conditional_expression_true()
     // create it if nonexistent even though the default second argument
     // to `token::get_charinfo()` (`suppress_creation`) is `false` (see
     // "token.h").  Why?
-    charinfo *ci = tok.get_charinfo(true /* required */);
+    charinfo *ci = tok.get_charinfo(true /* is_mandatory */);
     if (0 == ci /* nullptr */) {
       skip_branch();
       return false;
@@ -7316,7 +7316,7 @@ static bool is_conditional_expression_true()
   }
   else if (c == 'F') {
     tok.next();
-    symbol nm = read_long_identifier(true /* required */);
+    symbol nm = read_long_identifier(true /* want_diagnostic */);
     if (nm.is_null()) {
       skip_branch();
       return false;
@@ -7325,7 +7325,7 @@ static bool is_conditional_expression_true()
   }
   else if (c == 'S') {
     tok.next();
-    symbol nm = read_long_identifier(true /* required */);
+    symbol nm = read_long_identifier(true /* want_diagnostic */);
     if (nm.is_null()) {
       skip_branch();
       return false;
@@ -8018,7 +8018,7 @@ void ps_bbox_request() // .psbb
   }
   // Parse input line, to extract file name.
   //
-  symbol nm = read_long_identifier(true /* required */);
+  symbol nm = read_long_identifier(true /* want_diagnostic */);
   if (nm.is_null())
     //
     // No file name specified: ignore the entire request.
@@ -8331,7 +8331,7 @@ static void print_stream_request() // .pstream
 
 static void open_file(bool appending)
 {
-  symbol stream = read_identifier(true /* required */);
+  symbol stream = read_identifier(true /* want_diagnostic */);
   if (!stream.is_null()) {
     char *filename = read_rest_of_line_as_argument();
     if (filename != 0 /* nullptr */) {
@@ -8462,7 +8462,7 @@ static void close_request() // .close
 
 static void do_write_request(bool do_append_newline)
 {
-  symbol stream = read_identifier(true /* required */);
+  symbol stream = read_identifier(true /* want_diagnostic */);
   if (stream.is_null()) {
     skip_line();
     return;
@@ -8511,7 +8511,7 @@ static void stream_write_continuation_request() // .writec
 
 static void stream_write_macro_request() // .writem
 {
-  symbol stream = read_identifier(true /* required */);
+  symbol stream = read_identifier(true /* want_diagnostic */);
   if (stream.is_null()) {
     skip_line();
     return;
@@ -8524,7 +8524,7 @@ static void stream_write_macro_request() // .writem
     skip_line();
     return;
   }
-  symbol s = read_identifier(true /* required */);
+  symbol s = read_identifier(true /* want_diagnostic */);
   if (s.is_null()) {
     skip_line();
     return;
@@ -8662,7 +8662,7 @@ static void do_translate(bool transparently, bool 
as_input)
     // distributed with Sixth Edition Unix did things like `.tr ^\|`, so
     // some support should be added, only for those idioms, and only in
     // compatibility mode.
-    charinfo *ci1 = tok.get_charinfo(true /* required */);
+    charinfo *ci1 = tok.get_charinfo(true /* is_mandatory */);
     if (0 /* nullptr */ == ci1) {
       if (!want_att_compat)
        error("cannot perform character translation from %1",
@@ -8688,7 +8688,7 @@ static void do_translate(bool transparently, bool 
as_input)
       ci1->set_special_translation(charinfo::TRANSLATE_HYPHEN_INDICATOR,
                                   transparently);
     else {
-      charinfo *ci2 = tok.get_charinfo(true /* required */);
+      charinfo *ci2 = tok.get_charinfo(true /* is_mandatory */);
       if (0 /* nullptr */ == ci2) {
        if (!want_att_compat)
          error("cannot perform character translation to %1",
@@ -8772,7 +8772,7 @@ static void set_character_flags_request() // .cflags
       return;
     }
     while (has_arg()) {
-      charinfo *ci = tok.get_charinfo(true /* required */);
+      charinfo *ci = tok.get_charinfo(true /* is_mandatory */);
       if (0 /* nullptr */ == ci)
        assert(0 == "attempted to use token without charinfo in"
               " character flags assignment request");
@@ -8889,7 +8889,7 @@ dictionary char_class_dictionary(501);
 static void define_class_request() // .class
 {
   tok.skip_spaces();
-  symbol nm = read_identifier(true /* required */);
+  symbol nm = read_identifier(true /* want_diagnostic */);
   if (nm.is_null()) {
     skip_line();
     return;
@@ -8965,7 +8965,7 @@ static void define_class_request() // .class
       child1 = 0 /* nullptr */;
     }
     if (tok.is_any_character())
-      child1 = tok.get_charinfo(true /* required */);
+      child1 = tok.get_charinfo(true /* is_mandatory */);
     else
       // If we encountered a space or nonsense, we cannot be
       // interpreting a range expression; there should be no "child1".
@@ -9021,7 +9021,7 @@ static void define_class_request() // .class
 static charinfo *get_charinfo_by_index(int n,
                                       bool suppress_creation = false);
 
-charinfo *token::get_charinfo(bool required, bool suppress_creation)
+charinfo *token::get_charinfo(bool is_mandatory, bool suppress_creation)
 {
   if (TOKEN_CHAR == type)
     return charset_table[c];
@@ -9042,7 +9042,7 @@ charinfo *token::get_charinfo(bool required, bool 
suppress_creation)
       return 0 /* nullptr */;
     }
   }
-  if (required) {
+  if (is_mandatory) {
     if (TOKEN_EOF == type || TOKEN_NEWLINE == type)
       warning(WARN_MISSING, "missing ordinary, special, or indexed"
                            " character");
@@ -9053,11 +9053,11 @@ charinfo *token::get_charinfo(bool required, bool 
suppress_creation)
   return 0 /* nullptr */;
 }
 
-charinfo *read_character(/* TODO?: bool required */)
+charinfo *read_character(/* TODO?: bool want_diagnostic */)
 {
   tok.skip_spaces();
   charinfo *ci = tok.get_charinfo();
-  // TODO?: if (required && (0 /* nullptr */ == ci))
+  // TODO?: if (want_diagnostic && (0 /* nullptr */ == ci))
   if (0 /* nullptr */ == ci)
     tok.diagnose_non_character();
   else
@@ -9566,7 +9566,7 @@ void vjustify()
     handle_initial_request(VJUSTIFY_REQUEST);
     return;
   }
-  symbol type = read_long_identifier(true /* required */);
+  symbol type = read_long_identifier(true /* want_diagnostic */);
   if (!type.is_null())
     curdiv->vjustify(type);
   skip_line();
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 099d342bb..ceb7a15e8 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -6784,7 +6784,7 @@ static void translate_font_request() // .ftr
     skip_line();
     return;
   }
-  symbol from = read_identifier(true /* required */);
+  symbol from = read_identifier(true /* want_diagnostic */);
   // has_arg()+read_identifier() should ensure the assertion succeeds.
   assert(!from.is_null());
   if (is_nonnegative_integer(from.contents())) {
@@ -6831,7 +6831,8 @@ static void mount_font_at_position_request() // .fp
     if (n < 0)
       error("font mounting position %1 is negative", n);
     else {
-      symbol internal_name = read_identifier(true /* required */);
+      symbol internal_name
+       = read_identifier(true /* want_diagnostic */);
       if (!internal_name.is_null()) {
        symbol filename = read_long_identifier();
        if (!mount_font(n, internal_name, filename)) {
@@ -6956,7 +6957,8 @@ static void associate_style_with_font_position_request() 
// .sty
        warning(WARN_MISSING, "abstract style configuration request"
                " expects a style name as second argument");
       else {
-       symbol internal_name = read_identifier(true /* required */);
+       symbol internal_name
+         = read_identifier(true /* want_diagnostic */);
        if (!internal_name.is_null())
          (void) mount_style(n, internal_name);
       }
@@ -6998,7 +7000,7 @@ static bool read_font_identifier(font_lookup_info *finfo)
   int n;
   tok.skip_spaces();
   if (tok.is_usable_as_delimiter()) {
-    symbol s = read_identifier(true /* required */);
+    symbol s = read_identifier(true /* want_diagnostic */);
     finfo->requested_name = const_cast<char *>(s.contents());
     if (!s.is_null()) {
       n = symbol_fontno(s);
@@ -7080,7 +7082,7 @@ static void remove_font_specific_character_request() // 
.rfschar
     symbol f = font_table[finfo.position]->get_name();
     while (!tok.is_newline() && !tok.is_eof()) {
       if (!tok.is_space() && !tok.is_tab()) {
-       charinfo *s = tok.get_charinfo(true /* required */);
+       charinfo *s = tok.get_charinfo(true /* is_mandatory */);
        if (0 /* nullptr */ == s)
          assert(0 == "attempted to use token without charinfo in"
                 " font-specific character removal request");
diff --git a/src/roff/troff/reg.cpp b/src/roff/troff/reg.cpp
index 9c0505848..0353fa476 100644
--- a/src/roff/troff/reg.cpp
+++ b/src/roff/troff/reg.cpp
@@ -402,7 +402,7 @@ void inline_define_register()
   if (!start_token.is_usable_as_delimiter(true /* report error */))
     return;
   tok.next();
-  symbol nm = read_identifier(true /* required */);
+  symbol nm = read_identifier(true /* want_diagnostic */);
   if (nm.is_null())
     return;
   reg *r = static_cast<reg *>(register_dictionary.lookup(nm));
diff --git a/src/roff/troff/token.h b/src/roff/troff/token.h
index 93b5548f9..c9798a1fd 100644
--- a/src/roff/troff/token.h
+++ b/src/roff/troff/token.h
@@ -113,7 +113,7 @@ public:
   bool operator!=(const token &); // ditto
   unsigned char ch();
   int character_index();
-  charinfo *get_charinfo(bool /* required */ = false,
+  charinfo *get_charinfo(bool /* is_mandatory */ = false,
                         bool /* suppress_creation */ = false);
   bool add_to_zero_width_node_list(node **);
   void make_space();
@@ -129,10 +129,10 @@ extern token tok;         // the current token
 
 extern bool has_arg(bool /* want_peek */ = false);
 extern void skip_line();
-extern symbol read_identifier(bool /* required */ = false);
-extern symbol read_long_identifier(bool /* required */ = false);
+extern symbol read_identifier(bool /* want_diagnostic */ = false);
+extern symbol read_long_identifier(bool /* want_diagnostic */ = false);
 extern void handle_initial_title();
-extern charinfo *read_character(); // TODO?: bool /* required */ = false
+extern charinfo *read_character(); // TODO?: bool /* want_diagnostic */ = false
 extern char *read_rest_of_line_as_argument();
 
 enum char_mode {

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

Reply via email to