groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 02/32: [troff]: Apply consistent terminology.


From: G. Branden Robinson
Subject: [groff] 02/32: [troff]: Apply consistent terminology.
Date: Thu, 6 Oct 2022 09:11:21 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 2680e11fa951de63c44b5f17bbaad1f613b25a11
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Oct 3 18:01:57 2022 -0500

    [troff]: Apply consistent terminology.
    
    * src/roff/troff/input.cpp: Rename functions to better align with our
      documentation, and decouple their names from an assumption of
      diagnostic severity.  Also give them imperative names since they are
      called for their side effects, not their return values.
        - empty_name_warning -> diagnose_missing_identifier
        - non_empty_name_warning -> diagnose_invalid_identifier
    
      (diagnose_missing_identifier): Refer to absent operand as
      "identifier", not "name", in diagnostic messages since the latter
      (strictly) refers to the request/macro/string/diversion name space,
      and this function is also used to gather register identifiers.
---
 ChangeLog                | 17 +++++++++++++++++
 src/roff/troff/input.cpp | 20 ++++++++++----------
 2 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 46f56919a..d0e4ed88b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2022-10-03  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [troff]: Apply consistent terminology.
+
+       * src/roff/troff/input.cpp: Rename functions to better align
+       with our documentation, and decouple their names from an
+       assumption of diagnostic severity.  Also give them imperative
+       names since they are called for their side effects, not their
+       return values.
+       - empty_name_warning -> diagnose_missing_identifier
+       - non_empty_name_warning -> diagnose_invalid_identifier
+       (diagnose_missing_identifier): Refer to absent operand as
+       "identifier", not "name", in diagnostic messages since the
+       latter (strictly) refers to the request/macro/string/diversion
+       name space, and this function is also used to gather register
+       identifiers.
+
 2022-10-02  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [tmac]: Fix Savannah #63112 (3/3).
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 1553bb9b6..4797a9a55 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2482,11 +2482,11 @@ void compatible()
   skip_line();
 }
 
-static void empty_name_warning(bool required)
+static void diagnose_missing_identifier(bool required)
 {
   if (tok.is_newline() || tok.is_eof()) {
     if (required)
-      warning(WARN_MISSING, "missing name");
+      warning(WARN_MISSING, "missing identifier");
   }
   else if (tok.is_right_brace() || tok.is_tab()) {
     const char *start = tok.description();
@@ -2496,16 +2496,16 @@ static void empty_name_warning(bool required)
     if (!tok.is_newline() && !tok.is_eof())
       error("%1 is not allowed before an argument", start);
     else if (required)
-      warning(WARN_MISSING, "missing name");
+      warning(WARN_MISSING, "missing identifier");
   }
   else if (required)
-    error("expected name, got %1", tok.description());
+    error("expected identifier, got %1", tok.description());
   else
-    error("expected name, got %1; treated as missing",
+    error("expected identifier, got %1; treated as missing",
          tok.description());
 }
 
-static void non_empty_name_warning()
+static void diagnose_invalid_identifier()
 {
   if (!tok.is_newline() && !tok.is_eof() && !tok.is_space()
       && !tok.is_tab() && !tok.is_right_brace()
@@ -2526,11 +2526,11 @@ symbol get_name(bool required)
        tok.make_space();
       }
       else
-       non_empty_name_warning();
+       diagnose_invalid_identifier();
       return symbol(buf);
     }
     else {
-      empty_name_warning(required);
+      diagnose_missing_identifier(required);
       return NULL_SYMBOL;
     }
   }
@@ -2573,13 +2573,13 @@ static symbol do_get_long_name(bool required, char end)
     tok.next();
   }
   if (i == 0) {
-    empty_name_warning(required);
+    diagnose_missing_identifier(required);
     return NULL_SYMBOL;
   }
   if (end && buf[i] == end)
     buf[i+1] = '\0';
   else
-    non_empty_name_warning();
+    diagnose_invalid_identifier();
   if (buf == abuf)
     return symbol(buf);
   else {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]