gbranden pushed a commit to branch master
in repository groff.

commit 34cca7469bcf6bc38f31f43bbccb50fb31d0f51d
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Jan 18 00:20:48 2025 -0600

    src/roff/troff/input.cpp: Trivially refactor.
    
    * src/roff/troff/input.cpp (define_character_request): Promote scope of
      grammar computation describing the invoking request.  I'm going to
      need it for further refactoring of this function anticipated to
      resolve Savannah #66675.
---
 ChangeLog                |  7 +++++++
 src/roff/troff/input.cpp | 40 ++++++++++++++++++++--------------------
 2 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 268ae6bd0..f2cba1005 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-01-18  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp (define_character_request): Promote
+       scope of grammar computation describing the invoking request.
+       I'm going to need it for further refactoring of this function
+       anticipated to resolve Savannah #66675.
+
 2025-01-23  G. Branden Robinson <[email protected]>
 
        * tmac/e.tmac (m1, m2, m3, m4, ba, ip, @p, 2c, PS): Migrate from
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 1ec25e9fa..51fd951b0 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -4538,6 +4538,26 @@ void append_nocomp_string()
 
 void define_character(char_mode mode, const char *font_name)
 {
+  // C++11: There may be a better way to do this with an enum class;
+  // we could then store these constants inside `char_mode`.
+  const char *modestr = 0 /* nullptr */;
+  switch (mode) {
+    case CHAR_NORMAL:
+      modestr = "";
+      break;
+    case CHAR_FALLBACK:
+      modestr = " fallback";
+      break;
+    case CHAR_SPECIAL_FALLBACK:
+      modestr = " special fallback";
+      break;
+    case CHAR_FONT_SPECIFIC_FALLBACK:
+      modestr = " font-specific fallback";
+      break;
+    default:
+      assert(0 == "unhandled case of character mode");
+      break;
+  }
   node *n = 0 /* nullptr */;
   int c;
   tok.skip();
@@ -4559,26 +4579,6 @@ void define_character(char_mode mode, const char 
*font_name)
   else if (tok.is_tab())
     c = '\t';
   else if (!tok.is_space()) {
-    // C++11: There may be a better way to do this with an enum class;
-    // we could then store these constants inside `char_mode`.
-    const char *modestr = 0 /* nullptr */;
-    switch (mode) {
-      case CHAR_NORMAL:
-       modestr = "";
-       break;
-      case CHAR_FALLBACK:
-       modestr = " fallback";
-       break;
-      case CHAR_SPECIAL_FALLBACK:
-       modestr = " special fallback";
-       break;
-      case CHAR_FONT_SPECIFIC_FALLBACK:
-       modestr = " font-specific fallback";
-       break;
-      default:
-       assert(0 == "unhandled case of character mode");
-       break;
-    }
     error("ignoring invalid%1 character definition; expected one"
          " ordinary or special character to define, got %2", modestr,
          tok.description());

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

Reply via email to