groff-commit
[Top][All Lists]
Advanced

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

[groff] 20/24: [troff]: Slightly refactor (drop `tok.skip()`).


From: G. Branden Robinson
Subject: [groff] 20/24: [troff]: Slightly refactor (drop `tok.skip()`).
Date: Sun, 10 Nov 2024 14:56:23 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 558c63bd6d5a30aa84a89ca26c9107067e89c5a7
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Nov 9 14:59:44 2024 -0600

    [troff]: Slightly refactor (drop `tok.skip()`).
    
    * src/roff/troff/env.cpp (add_hyphenation_exceptions):
    * src/roff/troff/input.cpp (remove_character, read_title_parts)
      (set_hyphenation_codes, report_hyphenation_codes)
      (hyphenation_patterns_file_code): Drop unnecessary `tok.skip()` calls
      before `has_arg()`: the latter advances through spaces if needed.
---
 ChangeLog                | 9 +++++++++
 src/roff/troff/env.cpp   | 1 -
 src/roff/troff/input.cpp | 6 ------
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d1a6a7054..9ab6b3286 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-11-09  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/troff/env.cpp (add_hyphenation_exceptions):
+       * src/roff/troff/input.cpp (remove_character, read_title_parts)
+       (set_hyphenation_codes, report_hyphenation_codes)
+       (hyphenation_patterns_file_code): Drop unnecessary `tok.skip()`
+       calls before `has_arg()`: the latter advances through spaces if
+       needed.
+
 2024-11-09  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/input.cpp (pipe_source_request): Drop branch
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 2351e8d7e..82d4c44d4 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -3784,7 +3784,6 @@ static void add_hyphenation_exceptions()
   char buf[WORD_MAX + 1];
   unsigned char pos[WORD_MAX + 2];
   for (;;) {
-    tok.skip();
     if (!has_arg())
       break;
     int i = 0;
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 773ad99b9..cce80ff03 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -4578,7 +4578,6 @@ void define_special_character()
 
 static void remove_character()
 {
-  tok.skip();
   if (!has_arg()) {
     warning(WARN_MISSING, "character definition removal request expects"
            " arguments");
@@ -5708,7 +5707,6 @@ static const symbol percent_symbol("%");
 
 void read_title_parts(node **part, hunits *part_width)
 {
-  tok.skip();
   if (!has_arg())
     return;
   token start(tok);
@@ -7790,7 +7788,6 @@ static void set_character_flags()
 
 static void set_hyphenation_codes()
 {
-  tok.skip();
   if (!has_arg()) {
     warning(WARN_MISSING, "hyphenation code assignment request expects"
            " arguments");
@@ -7812,7 +7809,6 @@ static void set_hyphenation_codes()
       }
     }
     tok.next();
-    tok.skip();
     if (!has_arg()) {
       error("hyphenation codes must be specified in pairs");
       break;
@@ -7854,7 +7850,6 @@ static void set_hyphenation_codes()
 
 static void report_hyphenation_codes()
 {
-  tok.skip();
   if (!has_arg()) {
     warning(WARN_MISSING, "hyphenation code report request expects"
            " arguments");
@@ -7894,7 +7889,6 @@ void hyphenation_patterns_file_code()
 {
   error("hyphenation pattern file code assignment request will be"
        " withdrawn in a future groff release; migrate to 'hcode'");
-  tok.skip();
   if (!has_arg()) {
     warning(WARN_MISSING, "hyphenation pattern file code assignment"
            " request expects arguments");



reply via email to

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