groff-commit
[Top][All Lists]
Advanced

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

[groff] 07/10: [troff]: Boolify members of `token` class.


From: G. Branden Robinson
Subject: [groff] 07/10: [troff]: Boolify members of `token` class.
Date: Mon, 6 Sep 2021 15:01:25 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 9aa4cae7b32f10792287f1b215ea2d8c40d87b88
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Sep 6 04:30:55 2021 +1000

    [troff]: Boolify members of `token` class.
    
    * src/roff/troff/token.h (class token): Demote return type of several
      member functions from `int` to `bool` and rename them.
      - `backspace` -> `is_backspace`
      - `delimiter` -> `usable_as_delimiter`
      - `dummy` -> `is_dummy`
      - `eof` -> `is_eof`
      - `horizontal_space` -> `is_horizontal_space`
      - `hyphen_indicator` -> `is_hyphen_indicator`
      - `leader` -> `is_leader`
      - `left_brace` -> `is_left_brace`
      - `newline` -> `is_newline`
      - `page_ejector` -> `is_page_ejector`
      - `right_brace` -> `is_right_brace`
      - `space` -> `is_space`
      - `special` -> `is_special`
      - `stretchable_space` -> `is_stretchable_space`
      - `tab` -> `is_tab`
      - `transparent_dummy` -> `is_transparent_dummy`
      - `transparent` -> `is_transparent`
      - `unstretchable_space` -> `is_unstretchable_space`
      - `white_space` -> `is_white_space`
      - `zero_width_break` -> `is_zero_width_break`
    
      (class token): Drop 1991 comment anticipating that member function
      `nspaces` could return "2" for a "double space"; this was apparently
      never implemented.
    
      (class token): Drop parameter names from declarations; the prevailing
      style (familiar from Stroustrup) is not to use them.
      (token::is_special): Simplify implementation.
    
    * src/roff/troff/input.cpp (has_arg, token::usable_as_delimiter): Update
      definitions of above member functions not defined in token.h.
    
    * src/roff/troff/div.cpp (begin_page, space_request, need_space,
      output_saved_vertical_space, flush_output):
    * src/roff/troff/env.cpp (fill, no_fill, center, right_justify, indent,
      temporary_indent, margin_character, number_lines, do_break_request,
      hyphen_word):
    * src/roff/troff/input.cpp (next_file, do_overstrike, do_bracket,
      do_name_test, do_expr_test, do_zero_width, token::skip, has_arg,
      skip_line, empty_name_warning, non_empty_name_warning,
      do_get_long_name, process_input_stack, flush_pending_lines,
      decode_args, read_request, do_define_string, do_define_character,
      remove_character, do_define_macro, length_request, get_delim_number,
      get_line_arg, read_size, get_delim_name, do_register, do_width,
      read_title_parts, encode_char, do_special, device_request,
      output_request, skip_alternative, begin_alternative, nop_request,
      do_if_request, do_source, pipe_source, ps_bbox_request, tag, taga,
      do_terminal, do_translate, hyphenation_code,
      hyphenation_patterns_file_code, define_class, get_optional_char,
      check_missing_character, abort_request, copy_file, transparent_file,
      do_macro_source, charinfo_to_node_list, read_draw_node,
      read_color_draw_node):
    * src/roff/troff/node.cpp (get_fontno, remove_font_special_character,
      bold_font):
    * src/roff/troff/number.cpp (start_number, parse_term):
    * src/roff/troff/reg.cpp (define_number_reg, alter_format): Update call
      sites to use new names.
    
    * src/roff/troff/input.cpp (token::usable_as_delimiter, read_draw_node):
      Return Boolean, not integer, literals.
    
    Also add editor aid comments to ends of files lacking them.  Remove
    old-style Emacs file-local local variable at file beginnings.
    
    Also fix white space nits.
---
 ChangeLog                 |  67 +++++++++++++
 src/roff/troff/div.cpp    |  24 ++---
 src/roff/troff/env.cpp    |  49 ++++-----
 src/roff/troff/input.cpp  | 249 +++++++++++++++++++++++-----------------------
 src/roff/troff/node.cpp   |  10 +-
 src/roff/troff/number.cpp |  17 ++--
 src/roff/troff/reg.cpp    |  11 +-
 src/roff/troff/token.h    | 110 ++++++++++----------
 8 files changed, 309 insertions(+), 228 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3ec8a2b..1a5eedb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,72 @@
 2021-09-06  G. Branden Robinson <g.branden.robinson@gmail.com>
 
+       [troff]: Boolify members of `token` class.
+
+       * src/roff/troff/token.h (class token): Demote return type of
+       several member functions from `int` to `bool` and rename them.
+         - `backspace` -> `is_backspace`
+         - `delimiter` -> `usable_as_delimiter`
+         - `dummy` -> `is_dummy`
+         - `eof` -> `is_eof`
+         - `horizontal_space` -> `is_horizontal_space`
+         - `hyphen_indicator` -> `is_hyphen_indicator`
+         - `leader` -> `is_leader`
+         - `left_brace` -> `is_left_brace`
+         - `newline` -> `is_newline`
+         - `page_ejector` -> `is_page_ejector`
+         - `right_brace` -> `is_right_brace`
+         - `space` -> `is_space`
+         - `special` -> `is_special`
+         - `stretchable_space` -> `is_stretchable_space`
+         - `tab` -> `is_tab`
+         - `transparent_dummy` -> `is_transparent_dummy`
+         - `transparent` -> `is_transparent`
+         - `unstretchable_space` -> `is_unstretchable_space`
+         - `white_space` -> `is_white_space`
+         - `zero_width_break` -> `is_zero_width_break`
+       (class token): Drop 1991 comment anticipating that member
+       function `nspaces` could return "2" for a "double space"; this
+       was apparently never implemented.
+       (class token): Drop parameter names from declarations; the
+       prevailing style (familiar from Stroustrup) is not to use them.
+       (token::is_special): Simplify implementation.
+
+       * src/roff/troff/input.cpp (has_arg,
+       token::usable_as_delimiter): Update definitions of above member
+       functions not defined in token.h.
+
+       * src/roff/troff/div.cpp (begin_page, space_request, need_space,
+       output_saved_vertical_space, flush_output):
+       * src/roff/troff/env.cpp (fill, no_fill, center,
+       right_justify, indent, temporary_indent, margin_character,
+       number_lines, do_break_request, hyphen_word):
+       * src/roff/troff/input.cpp (next_file, do_overstrike,
+       do_bracket, do_name_test, do_expr_test, do_zero_width,
+       token::skip, has_arg, skip_line, empty_name_warning,
+       non_empty_name_warning, do_get_long_name, process_input_stack,
+       flush_pending_lines, decode_args, read_request,
+       do_define_string, do_define_character, remove_character,
+       do_define_macro, length_request, get_delim_number, get_line_arg,
+       read_size, get_delim_name, do_register, do_width,
+       read_title_parts, encode_char, do_special, device_request,
+       output_request, skip_alternative, begin_alternative,
+       nop_request, do_if_request, do_source, pipe_source,
+       ps_bbox_request, tag, taga, do_terminal, do_translate,
+       hyphenation_code, hyphenation_patterns_file_code, define_class,
+       get_optional_char, check_missing_character, abort_request,
+       copy_file, transparent_file, do_macro_source,
+       charinfo_to_node_list, read_draw_node, read_color_draw_node):
+       * src/roff/troff/node.cpp (get_fontno,
+       remove_font_special_character, bold_font):
+       * src/roff/troff/number.cpp (start_number, parse_term):
+       * src/roff/troff/reg.cpp (define_number_reg, alter_format):
+       Update call sites to use new names.
+
+       * src/roff/troff/input.cpp (token::usable_as_delimiter,
+       read_draw_node): Return Boolean, not integer, literals.
+
+2021-09-06  G. Branden Robinson <g.branden.robinson@gmail.com>
+
        [troff]: Clamp line and title lengths to device horizontal
        resolution.
 
diff --git a/src/roff/troff/div.cpp b/src/roff/troff/div.cpp
index 88d0d1a..b826c89 100644
--- a/src/roff/troff/div.cpp
+++ b/src/roff/troff/div.cpp
@@ -48,7 +48,7 @@ static int vertical_position_traps_flag = 1;
 static vunits truncated_space;
 static vunits needed_space;
 
-diversion::diversion(symbol s) 
+diversion::diversion(symbol s)
 : prev(0), nm(s), vertical_position(V0), high_water_mark(V0),
   any_chars_added(0), no_space_mode(0), needs_push(0), saved_seen_break(0),
   saved_seen_space(0), saved_seen_eol(0), saved_suppress_next_eol(0),
@@ -151,7 +151,7 @@ void divert_append()
 {
   do_divert(1, 0);
 }
-  
+
 void box()
 {
   do_divert(0, 1);
@@ -342,7 +342,7 @@ trap *top_level_diversion::find_next_trap(vunits 
*next_trap_pos)
   for (trap *pt = page_trap_list; pt != 0; pt = pt->next)
     if (!pt->nm.is_null()) {
       if (pt->position >= V0) {
-       if (pt->position > vertical_position 
+       if (pt->position > vertical_position
            && pt->position < page_length
            && (next_trap == 0 || pt->position < *next_trap_pos)) {
          next_trap = pt;
@@ -378,7 +378,7 @@ void top_level_diversion::output(node *nd, int retain_size,
   no_space_mode = 0;
   vunits next_trap_pos;
   trap *next_trap = find_next_trap(&next_trap_pos);
-  if (before_first_page && begin_page()) 
+  if (before_first_page && begin_page())
     fatal("sorry, I didn't manage to begin the first page in time: use an 
explicit .br request");
   vertical_size v(vs, post_vs);
   for (node *tem = nd; tem != 0; tem = tem->next)
@@ -504,7 +504,7 @@ void top_level_diversion::add_trap(symbol nam, vunits pos)
   }
   else
     *p = new trap(nam, pos, 0);
-}  
+}
 
 void top_level_diversion::remove_trap(symbol nam)
 {
@@ -693,7 +693,7 @@ void begin_page()
   int n = 0;           /* pacify compiler */
   if (has_arg() && get_integer(&n, topdiv->get_page_number()))
     got_arg = 1;
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   if (curdiv == topdiv) {
     if (topdiv->before_first_page) {
@@ -772,14 +772,14 @@ void space_request()
   vunits n;
   if (!has_arg() || !get_vunits(&n, 'v'))
     n = curenv->get_vertical_spacing();
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   if (!unpostpone_traps() && !curdiv->no_space_mode)
     curdiv->space(n);
   else
     // The line might have had line spacing that was truncated.
     truncated_space += n;
-  
+
   tok.next();
 }
 
@@ -800,7 +800,7 @@ void need_space()
   vunits n;
   if (!has_arg() || !get_vunits(&n, 'v'))
     n = curenv->get_vertical_spacing();
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   curdiv->need(n);
   tok.next();
@@ -835,7 +835,7 @@ void save_vertical_space()
 
 void output_saved_vertical_space()
 {
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   if (saved_space > V0)
     curdiv->space(saved_space, 1);
@@ -845,7 +845,7 @@ void output_saved_vertical_space()
 
 void flush_output()
 {
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   if (break_flag)
     curenv->do_break();
@@ -1192,7 +1192,7 @@ void init_div_requests()
   number_reg_dictionary.define(".t", new distance_to_next_trap_reg);
   number_reg_dictionary.define(".trunc",
                               new constant_vunits_reg(&truncated_space));
-  number_reg_dictionary.define(".vpt", 
+  number_reg_dictionary.define(".vpt",
                       new constant_int_reg(&vertical_position_traps_flag));
   number_reg_dictionary.define(".z", new diversion_name_reg);
   number_reg_dictionary.define("dl", new variable_reg(&dl_reg_contents));
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index f918c57..7370de7 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -956,7 +956,7 @@ int environment::get_bold()
 hunits environment::get_digit_width()
 {
   return env_digit_width(this);
-} 
+}
 
 int environment::get_adjust_mode()
 {
@@ -1287,7 +1287,7 @@ void space_size()
 
 void fill()
 {
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   if (break_flag)
     curenv->do_break();
@@ -1297,7 +1297,7 @@ void fill()
 
 void no_fill()
 {
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   if (break_flag)
     curenv->do_break();
@@ -1313,7 +1313,7 @@ void center()
     n = 1;
   else if (n < 0)
     n = 0;
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   if (break_flag)
     curenv->do_break();
@@ -1330,7 +1330,7 @@ void right_justify()
     n = 1;
   else if (n < 0)
     n = 0;
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   if (break_flag)
     curenv->do_break();
@@ -1437,7 +1437,7 @@ void indent()
   }
   else
     temp = curenv->prev_indent;
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   if (break_flag)
     curenv->do_break();
@@ -1454,7 +1454,7 @@ void temporary_indent()
   hunits temp;
   if (!get_hunits(&temp, 'm', curenv->get_indent()))
     err = 1;
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   if (break_flag)
     curenv->do_break();
@@ -1534,7 +1534,7 @@ void no_break_control_char()
 
 void margin_character()
 {
-  while (tok.space())
+  while (tok.is_space())
     tok.next();
   charinfo *ci = tok.get_char();
   if (ci) {
@@ -1581,7 +1581,7 @@ void number_lines()
     curenv->numbering_nodes = nd;
     curenv->line_number_digit_width = env_digit_width(curenv);
     int n;
-    if (!tok.delimiter()) {
+    if (!tok.usable_as_delimiter()) {
       if (get_integer(&n, next_line_number)) {
        next_line_number = n;
        if (next_line_number < 0) {
@@ -1591,10 +1591,10 @@ void number_lines()
       }
     }
     else
-      while (!tok.space() && !tok.newline() && !tok.eof())
+      while (!tok.is_space() && !tok.is_newline() && !tok.is_eof())
        tok.next();
     if (has_arg()) {
-      if (!tok.delimiter()) {
+      if (!tok.usable_as_delimiter()) {
        if (get_integer(&n)) {
          if (n <= 0) {
            warning(WARN_RANGE, "negative or zero line number multiple");
@@ -1604,17 +1604,17 @@ void number_lines()
        }
       }
       else
-       while (!tok.space() && !tok.newline() && !tok.eof())
+       while (!tok.is_space() && !tok.is_newline() && !tok.is_eof())
          tok.next();
       if (has_arg()) {
-       if (!tok.delimiter()) {
+       if (!tok.usable_as_delimiter()) {
          if (get_integer(&n))
            curenv->number_text_separation = n;
        }
        else
-         while (!tok.space() && !tok.newline() && !tok.eof())
+         while (!tok.is_space() && !tok.is_newline() && !tok.is_eof())
            tok.next();
-       if (has_arg() && !tok.delimiter() && get_integer(&n))
+       if (has_arg() && !tok.usable_as_delimiter() && get_integer(&n))
          curenv->line_number_indent = n;
       }
     }
@@ -2410,7 +2410,7 @@ int environment::is_empty()
 
 void do_break_request(int spread)
 {
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   if (break_flag)
     curenv->do_break(spread);
@@ -2484,7 +2484,7 @@ void title()
                       curenv->total_post_vertical_spacing(), length_title);
   curenv->hyphen_line_count = 0;
   tok.next();
-}  
+}
 
 void adjust()
 {
@@ -2576,7 +2576,7 @@ tab::tab(hunits x, tab_type t) : next(0), pos(x), type(t)
 {
 }
 
-tab_stops::tab_stops(hunits distance, tab_type type) 
+tab_stops::tab_stops(hunits distance, tab_type type)
 : initial_list(0)
 {
   repeated_list = new tab(distance, type);
@@ -2691,7 +2691,7 @@ tab_stops::tab_stops() : initial_list(0), repeated_list(0)
 {
 }
 
-tab_stops::tab_stops(const tab_stops &ts) 
+tab_stops::tab_stops(const tab_stops &ts)
 : initial_list(0), repeated_list(0)
 {
   tab **p = &initial_list;
@@ -2751,7 +2751,7 @@ void tab_stops::operator=(const tab_stops &ts)
     p = &(*p)->next;
   }
 }
-    
+
 void set_tabs()
 {
   hunits pos;
@@ -3067,7 +3067,7 @@ const char *int_env_reg::get_string()
 {
   return i_to_a((curenv->*func)());
 }
- 
+
 vunits_env_reg::vunits_env_reg(VUNITS_FUNCP f) : func(f)
 {
 }
@@ -3564,11 +3564,12 @@ static void hyphen_word()
   unsigned char pos[WORD_MAX + 2];
   for (;;) {
     tok.skip();
-    if (tok.newline() || tok.eof())
+    if (tok.is_newline() || tok.is_eof())
       break;
     int i = 0;
     int npos = 0;
-    while (i < WORD_MAX && !tok.space() && !tok.newline() && !tok.eof()) {
+    while (i < WORD_MAX && !tok.is_space() && !tok.is_newline()
+          && !tok.is_eof()) {
       charinfo *ci = tok.get_char(true /* required */);
       if (ci == 0) {
        skip_line();
@@ -3608,7 +3609,7 @@ struct trie_node {
   trie_node(char, trie_node *);
 };
 
-trie_node::trie_node(char ch, trie_node *p) 
+trie_node::trie_node(char ch, trie_node *p)
 : c(ch), down(0), right(p), val(0)
 {
 }
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 6cfa03d..ec8782f 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -795,7 +795,7 @@ void backtrace_request()
 void next_file()
 {
   symbol nm = get_long_name();
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   if (nm.is_null())
     input_stack::end_file();
@@ -1133,7 +1133,7 @@ static int get_copy(node **nd, bool is_defining, bool 
handle_escape_E)
       return ESCAPE_RIGHT_PARENTHESIS;
     case '.':
       (void)input_stack::get(0);
-      return c;                        
+      return c;
     case '%':
       (void)input_stack::get(0);
       return ESCAPE_PERCENT;
@@ -1443,7 +1443,7 @@ node *do_overstrike()
   start.next();
   for (;;) {
     tok.next();
-    if (tok.newline() || tok.eof()) {
+    if (tok.is_newline() || tok.is_eof()) {
       warning(WARN_DELIM, "missing closing delimiter in"
              " overstrike escape (got %1)", tok.description());
       input_stack::push(make_temp_iterator("\n"));
@@ -1452,9 +1452,9 @@ node *do_overstrike()
     if (tok == start
        && (compatible_flag || input_stack::get_level() == start_level))
       break;
-    if (tok.horizontal_space())
+    if (tok.is_horizontal_space())
       on->overstrike(tok.nd->copy());
-    else if (tok.unstretchable_space())
+    else if (tok.is_unstretchable_space())
     {
       node *n = new hmotion_node(curenv->get_space_width(),
                                 curenv->get_fill_color());
@@ -1480,13 +1480,13 @@ static node *do_bracket()
   int start_level = input_stack::get_level();
   for (;;) {
     tok.next();
-    if (tok.eof() || tok.newline()) {
+    if (tok.is_eof() || tok.is_newline()) {
       warning(WARN_DELIM, "missing closing delimiter in"
              " bracket-building escape (got %1)", tok.description());
       // XXX: Most other places we miss a closing delimiter, we push a
       // temp iterator for the EOF case too.  What's special about \b?
       // Exceptions: \w, \X are like this too.
-      if (tok.newline())
+      if (tok.is_newline())
        input_stack::push(make_temp_iterator("\n"));
       break;
     }
@@ -1512,7 +1512,7 @@ static int do_name_test()
   int some_char = 0;
   for (;;) {
     tok.next();
-    if (tok.newline() || tok.eof()) {
+    if (tok.is_newline() || tok.is_eof()) {
       warning(WARN_DELIM, "missing closing delimiter in"
              " name test escape (got %1)", tok.description());
       input_stack::push(make_temp_iterator("\n"));
@@ -1533,7 +1533,7 @@ static int do_expr_test()
   token start;
   start.next();
   int start_level = input_stack::get_level();
-  if (!start.delimiter(true /* report error */))
+  if (!start.usable_as_delimiter(true /* report error */))
     return 0;
   tok.next();
   // disable all warning and error messages temporarily
@@ -1550,7 +1550,7 @@ static int do_expr_test()
   // ignore everything up to the delimiter in case we aren't right there
   for (;;) {
     tok.next();
-    if (tok.newline() || tok.eof()) {
+    if (tok.is_newline() || tok.is_eof()) {
       warning(WARN_DELIM, "missing closing delimiter in"
              " expression test escape (got %1)", tok.description());
       input_stack::push(make_temp_iterator("\n"));
@@ -1573,7 +1573,7 @@ static node *do_zero_width()
   curenv = &env;
   for (;;) {
     tok.next();
-    if (tok.newline() || tok.eof()) {
+    if (tok.is_newline() || tok.is_eof()) {
       error("missing closing delimiter");
       break;
     }
@@ -1607,7 +1607,7 @@ static node *do_zero_width()
   int start_level = input_stack::get_level();
   for (;;) {
     tok.next();
-    if (tok.newline() || tok.eof()) {
+    if (tok.is_newline() || tok.is_eof()) {
       warning(WARN_DELIM, "missing closing delimiter in"
              " zero-width escape (got %1)", tok.description());
       input_stack::push(make_temp_iterator("\n"));
@@ -1714,15 +1714,15 @@ void token::operator=(const token &t)
 
 void token::skip()
 {
-  while (space())
+  while (is_space())
     next();
 }
 
-int has_arg()
+bool has_arg()
 {
-  while (tok.space())
+  while (tok.is_space())
     tok.next();
-  return !tok.newline();
+  return !tok.is_newline();
 }
 
 void token::make_space()
@@ -2324,7 +2324,7 @@ int token::operator!=(const token &t)
 
 // is token a suitable delimiter (like ')?
 
-int token::delimiter(bool err)
+bool token::usable_as_delimiter(bool err)
 {
   switch(type) {
   case TOKEN_CHAR:
@@ -2354,15 +2354,15 @@ int token::delimiter(bool err)
     case '.':
       if (err)
         error("cannot use character '%1' as a starting delimiter", char(c));
-      return 0;
+      return false;
     default:
-      return 1;
+      return true;
     }
   case TOKEN_NODE:
     // the user doesn't know what a node is
     if (err)
       error("missing argument or invalid starting delimiter");
-    return 0;
+    return false;
   case TOKEN_SPACE:
   case TOKEN_STRETCHABLE_SPACE:
   case TOKEN_UNSTRETCHABLE_SPACE:
@@ -2371,9 +2371,9 @@ int token::delimiter(bool err)
   case TOKEN_NEWLINE:
     if (err)
       error("cannot use %1 as a starting delimiter", description());
-    return 0;
+    return false;
   default:
-    return 1;
+    return true;
   }
 }
 
@@ -2443,8 +2443,8 @@ const char *token::description()
 
 void skip_line()
 {
-  while (!tok.newline())
-    if (tok.eof())
+  while (!tok.is_newline())
+    if (tok.is_eof())
       return;
     else
       tok.next();
@@ -2463,16 +2463,16 @@ void compatible()
 
 static void empty_name_warning(bool required)
 {
-  if (tok.newline() || tok.eof()) {
+  if (tok.is_newline() || tok.is_eof()) {
     if (required)
       warning(WARN_MISSING, "missing name");
   }
-  else if (tok.right_brace() || tok.tab()) {
+  else if (tok.is_right_brace() || tok.is_tab()) {
     const char *start = tok.description();
     do {
       tok.next();
-    } while (tok.space() || tok.right_brace() || tok.tab());
-    if (!tok.newline() && !tok.eof())
+    } while (tok.is_space() || tok.is_right_brace() || tok.is_tab());
+    if (!tok.is_newline() && !tok.is_eof())
       error("%1 is not allowed before an argument", start);
     else if (required)
       warning(WARN_MISSING, "missing name");
@@ -2485,10 +2485,10 @@ static void empty_name_warning(bool required)
 
 static void non_empty_name_warning()
 {
-  if (!tok.newline() && !tok.eof() && !tok.space() && !tok.tab()
-      && !tok.right_brace()
+  if (!tok.is_newline() && !tok.is_eof() && !tok.is_space()
+      && !tok.is_tab() && !tok.is_right_brace()
       // We don't want to give a warning for .el\{
-      && !tok.left_brace())
+      && !tok.is_left_brace())
     error("%1 is not allowed in a name", tok.description());
 }
 
@@ -2523,7 +2523,7 @@ symbol get_long_name(bool required)
 
 static symbol do_get_long_name(bool required, char end)
 {
-  while (tok.space())
+  while (tok.is_space())
     tok.next();
   char abuf[ABUF_SIZE];
   char *buf = abuf;
@@ -2825,7 +2825,7 @@ void process_input_stack()
          // skip tabs as well as spaces here
          do {
            tok.next();
-         } while (tok.white_space());
+         } while (tok.is_white_space());
          symbol nm = get_name();
 #if defined(DEBUGGING)
          if (debug_state) {
@@ -2950,8 +2950,8 @@ void process_input_stack()
          do {
            nspaces += tok.nspaces();
            tok.next();
-         } while (tok.space());
-         if (tok.newline())
+         } while (tok.is_space());
+         if (tok.is_newline())
            trapping_blank_line();
          else {
            push_token(tok);
@@ -3055,7 +3055,7 @@ void process_input_stack()
 
 void flush_pending_lines()
 {
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   curenv->output_pending_lines();
   tok.next();
@@ -3813,7 +3813,7 @@ static void interpolate_macro(symbol nm, int no_next)
 
 static void decode_args(macro_iterator *mi)
 {
-  if (!tok.newline() && !tok.eof()) {
+  if (!tok.is_newline() && !tok.is_eof()) {
     node *n;
     int c = get_copy(&n);
     for (;;) {
@@ -4102,7 +4102,7 @@ void read_request()
   macro_iterator *mi = new macro_iterator;
   int reading_from_terminal = isatty(fileno(stdin));
   int had_prompt = 0;
-  if (!tok.newline() && !tok.eof()) {
+  if (!tok.is_newline() && !tok.is_eof()) {
     int c = get_copy(0);
     while (c == ' ')
       c = get_copy(0);
@@ -4162,11 +4162,11 @@ void do_define_string(define_mode mode, comp_mode comp)
     skip_line();
     return;
   }
-  if (tok.newline())
+  if (tok.is_newline())
     c = '\n';
-  else if (tok.tab())
+  else if (tok.is_tab())
     c = '\t';
-  else if (!tok.space()) {
+  else if (!tok.is_space()) {
     error("bad string definition");
     skip_line();
     return;
@@ -4243,11 +4243,11 @@ void do_define_character(char_mode mode, const char 
*font_name)
     ci = get_charinfo(symbol(s.contents()));
   }
   tok.next();
-  if (tok.newline())
+  if (tok.is_newline())
     c = '\n';
-  else if (tok.tab())
+  else if (tok.is_tab())
     c = '\t';
-  else if (!tok.space()) {
+  else if (!tok.is_space()) {
     error("bad character definition");
     skip_line();
     return;
@@ -4290,8 +4290,8 @@ void define_special_character()
 static void remove_character()
 {
   tok.skip();
-  while (!tok.newline() && !tok.eof()) {
-    if (!tok.space() && !tok.tab()) {
+  while (!tok.is_newline() && !tok.is_eof()) {
+    if (!tok.is_space() && !tok.is_tab()) {
       charinfo *ci = tok.get_char(true /* required */);
       if (!ci)
        break;
@@ -4487,7 +4487,7 @@ void do_define_macro(define_mode mode, calling_mode 
calling, comp_mode comp)
   term = get_name();   // the request that terminates the definition
   if (term.is_null())
     term = dot_symbol;
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   const char *start_filename;
   int start_lineno;
@@ -4873,11 +4873,11 @@ void length_request()
   }
   int c;
   node *n;
-  if (tok.newline())
+  if (tok.is_newline())
     c = '\n';
-  else if (tok.tab())
+  else if (tok.is_tab())
     c = '\t';
-  else if (!tok.space()) {
+  else if (!tok.is_space()) {
     error("bad string definition");
     skip_line();
     return;
@@ -4985,7 +4985,7 @@ static int get_delim_number(units *n, unsigned char si, 
int prev_value)
 {
   token start;
   start.next();
-  if (start.delimiter(true /* report error */)) {
+  if (start.usable_as_delimiter(true /* report error */)) {
     tok.next();
     if (get_number(n, si, prev_value)) {
       if (start != tok)
@@ -5000,7 +5000,7 @@ static int get_delim_number(units *n, unsigned char si)
 {
   token start;
   start.next();
-  if (start.delimiter(true /* report error */)) {
+  if (start.usable_as_delimiter(true /* report error */)) {
     tok.next();
     if (get_number(n, si)) {
       if (start != tok)
@@ -5016,11 +5016,11 @@ static int get_line_arg(units *n, unsigned char si, 
charinfo **cp)
   token start;
   start.next();
   int start_level = input_stack::get_level();
-  if (!start.delimiter(true /* report error */))
+  if (!start.usable_as_delimiter(true /* report error */))
     return 0;
   tok.next();
   if (get_number(n, si)) {
-    if (tok.dummy() || tok.transparent_dummy())
+    if (tok.is_dummy() || tok.is_transparent_dummy())
       tok.next();
     if (!(start == tok && input_stack::get_level() == start_level)) {
       *cp = tok.get_char(true /* required */);
@@ -5096,7 +5096,7 @@ static int read_size(int *x)
     }
     val *= sizescale;
   }
-  else if (!tok.delimiter(true /* report error */))
+  else if (!tok.usable_as_delimiter(true /* report error */))
     return 0;
   else {
     token start(tok);
@@ -5157,11 +5157,11 @@ static symbol get_delim_name()
 {
   token start;
   start.next();
-  if (start.eof()) {
+  if (start.is_eof()) {
     error("end of input at start of delimited name");
     return NULL_SYMBOL;
   }
-  if (start.newline()) {
+  if (start.is_newline()) {
     error("can't delimit name with a newline");
     return NULL_SYMBOL;
   }
@@ -5219,13 +5219,13 @@ static void do_register()
 {
   token start;
   start.next();
-  if (!start.delimiter(true /* report error */))
+  if (!start.usable_as_delimiter(true /* report error */))
     return;
   tok.next();
   symbol nm = get_long_name(true /* required */);
   if (nm.is_null())
     return;
-  while (tok.space())
+  while (tok.is_space())
     tok.next();
   reg *r = (reg *)number_reg_dictionary.lookup(nm);
   int prev_value;
@@ -5254,13 +5254,13 @@ static void do_width()
   curenv = &env;
   for (;;) {
     tok.next();
-    if (tok.eof() || tok.newline()) {
+    if (tok.is_eof() || tok.is_newline()) {
       warning(WARN_DELIM, "missing closing delimiter in"
              " width escape (got %1)", tok.description());
       // XXX: Most other places we miss a closing delimiter, we push a
       // temp iterator for the EOF case too.  What's special about \w?
       // Exception: \b, \X are like this too.
-      if (tok.newline())
+      if (tok.is_newline())
        input_stack::push(make_temp_iterator("\n"));
       break;
     }
@@ -5290,13 +5290,13 @@ static const symbol percent_symbol("%");
 void read_title_parts(node **part, hunits *part_width)
 {
   tok.skip();
-  if (tok.newline() || tok.eof())
+  if (tok.is_newline() || tok.is_eof())
     return;
   token start(tok);
   int start_level = input_stack::get_level();
   tok.next();
   for (int i = 0; i < 3; i++) {
-    while (!tok.newline() && !tok.eof()) {
+    while (!tok.is_newline() && !tok.is_eof()) {
       if (tok == start
          && (compatible_flag || input_stack::get_level() == start_level)) {
        tok.next();
@@ -5312,7 +5312,7 @@ void read_title_parts(node **part, hunits *part_width)
     part_width[i] = curenv->get_input_line_position();
     part[i] = curenv->extract_output_line();
   }
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
 }
 
@@ -5399,7 +5399,7 @@ static node *do_non_interpreted()
 static void encode_char(macro *mac, char c)
 {
   if (c == '\0') {
-    if ((font::use_charnames_in_special) && tok.special()) {
+    if ((font::use_charnames_in_special) && tok.is_special()) {
       charinfo *ci = tok.get_char(true /* required */);
       const char *s = ci->get_symbol()->contents();
       if (s[0] != (char)0) {
@@ -5413,13 +5413,13 @@ static void encode_char(macro *mac, char c)
        mac->append(']');
       }
     }
-    else if (tok.stretchable_space()
-            || tok.unstretchable_space())
+    else if (tok.is_stretchable_space()
+            || tok.is_unstretchable_space())
       mac->append(' ');
-    else if (!(tok.hyphen_indicator()
-              || tok.dummy()
-              || tok.transparent_dummy()
-              || tok.zero_width_break()))
+    else if (!(tok.is_hyphen_indicator()
+              || tok.is_dummy()
+              || tok.is_transparent_dummy()
+              || tok.is_zero_width_break()))
       error("%1 is invalid within \\X", tok.description());
   }
   else {
@@ -5442,24 +5442,24 @@ node *do_special()
   for (tok.next();
        tok != start || input_stack::get_level() != start_level;
        tok.next()) {
-    if (tok.eof() || tok.newline()) {
+    if (tok.is_eof() || tok.is_newline()) {
       warning(WARN_DELIM, "missing closing delimiter in"
              " device special escape (got %1)", tok.description());
       // XXX: Most other places we miss a closing delimiter, we push a
       // temp iterator for the EOF case too.  What's special about \X?
       // Exceptions: \b, \w are like this too.
-      if (tok.newline())
+      if (tok.is_newline())
        input_stack::push(make_temp_iterator("\n"));
       break;
     }
     unsigned char c;
-    if (tok.space())
+    if (tok.is_space())
       c = ' ';
-    else if (tok.tab())
+    else if (tok.is_tab())
       c = '\t';
-    else if (tok.leader())
+    else if (tok.is_leader())
       c = '\001';
-    else if (tok.backspace())
+    else if (tok.is_backspace())
       c = '\b';
     else
       c = tok.ch();
@@ -5470,7 +5470,7 @@ node *do_special()
 
 void device_request()
 {
-  if (!tok.newline() && !tok.eof()) {
+  if (!tok.is_newline() && !tok.is_eof()) {
     int c;
     macro mac;
     for (;;) {
@@ -5497,7 +5497,7 @@ void device_macro_request()
     macro *m = p->to_macro();
     if (m)
       curenv->add_node(new special_node(*m));
-    else 
+    else
       error("can't transparently throughput a request");
   }
   skip_line();
@@ -5505,7 +5505,7 @@ void device_macro_request()
 
 void output_request()
 {
-  if (!tok.newline() && !tok.eof()) {
+  if (!tok.is_newline() && !tok.is_eof()) {
     int c;
     for (;;) {
       c = get_copy(0);
@@ -5643,7 +5643,7 @@ static void skip_alternative()
 {
   int level = 0;
   // ensure that ".if 0\{" works as expected
-  if (tok.left_brace())
+  if (tok.is_left_brace())
     level++;
   int c;
   for (;;) {
@@ -5668,7 +5668,7 @@ static void skip_alternative()
       }
     /*
       Note that the level can properly be < 0, e.g.
-       
+
        .if 1 \{\
        .if 0 \{\
        .\}\}
@@ -5683,13 +5683,13 @@ static void skip_alternative()
 
 static void begin_alternative()
 {
-  while (tok.space() || tok.left_brace())
+  while (tok.is_space() || tok.is_left_brace())
     tok.next();
 }
 
 void nop_request()
 {
-  while (tok.space())
+  while (tok.is_space())
     tok.next();
 }
 
@@ -5698,7 +5698,7 @@ static int_stack if_else_stack;
 int do_if_request()
 {
   int invert = 0;
-  while (tok.space())
+  while (tok.is_space())
     tok.next();
   while (tok.ch() == '!') {
     tok.next();
@@ -5791,9 +5791,9 @@ int do_if_request()
     }
     result = check_style(nm);
   }
-  else if (tok.space())
+  else if (tok.is_space())
     result = 0;
-  else if (tok.delimiter()) {
+  else if (tok.usable_as_delimiter()) {
     token delim = tok;
     int delim_level = input_stack::get_level();
     environment env1(curenv);
@@ -5804,7 +5804,7 @@ int do_if_request()
     for (int i = 0; i < 2; i++) {
       for (;;) {
        tok.next();
-       if (tok.newline() || tok.eof()) {
+       if (tok.is_newline() || tok.is_eof()) {
          warning(WARN_DELIM, "missing closing delimiter in conditional"
                  " expression (got %1)", tok.description());
          tok.next();
@@ -5966,7 +5966,7 @@ void do_source(bool quietly)
   if (nm.is_null())
     skip_line();
   else {
-    while (!tok.newline() && !tok.eof())
+    while (!tok.is_newline() && !tok.is_eof())
       tok.next();
     errno = 0;
     FILE *fp = include_search_path.open_file_cautious(nm.contents());
@@ -6009,7 +6009,7 @@ void pipe_source()
     error("pipes not available on this system");
     skip_line();
 #else /* not POPEN_MISSING */
-    if (tok.newline() || tok.eof())
+    if (tok.is_newline() || tok.is_eof())
       error("missing command");
     else {
       int c;
@@ -6504,7 +6504,7 @@ void ps_bbox_request()
   else {
     // File name acquired: swallow the rest of the line.
     //
-    while (!tok.newline() && !tok.eof())
+    while (!tok.is_newline() && !tok.is_eof())
       tok.next();
     errno = 0;
 
@@ -6639,7 +6639,7 @@ const char *input_char_description(int c)
 
 void tag()
 {
-  if (!tok.newline() && !tok.eof()) {
+  if (!tok.is_newline() && !tok.is_eof()) {
     string s;
     int c;
     for (;;) {
@@ -6662,7 +6662,7 @@ void tag()
 
 void taga()
 {
-  if (!tok.newline() && !tok.eof()) {
+  if (!tok.is_newline() && !tok.is_eof()) {
     string s;
     int c;
     for (;;) {
@@ -6687,7 +6687,7 @@ void taga()
 
 void do_terminal(int newline, int string_like)
 {
-  if (!tok.newline() && !tok.eof()) {
+  if (!tok.is_newline() && !tok.is_eof()) {
     int c;
     for (;;) {
       c = get_copy(0);
@@ -6939,12 +6939,12 @@ static void init_hpf_code_table()
 static void do_translate(int translate_transparent, int translate_input)
 {
   tok.skip();
-  while (!tok.newline() && !tok.eof()) {
-    if (tok.space()) {
+  while (!tok.is_newline() && !tok.is_eof()) {
+    if (tok.is_space()) {
       // This is a really bizarre troff feature.
       tok.next();
-      translate_space_to_dummy = tok.dummy();
-      if (tok.newline() || tok.eof())
+      translate_space_to_dummy = tok.is_dummy();
+      if (tok.is_newline() || tok.is_eof())
        break;
       tok.next();
       continue;
@@ -6953,21 +6953,21 @@ static void do_translate(int translate_transparent, int 
translate_input)
     if (ci1 == 0)
       break;
     tok.next();
-    if (tok.newline() || tok.eof()) {
+    if (tok.is_newline() || tok.is_eof()) {
       ci1->set_special_translation(charinfo::TRANSLATE_SPACE,
                                   translate_transparent);
       break;
     }
-    if (tok.space())
+    if (tok.is_space())
       ci1->set_special_translation(charinfo::TRANSLATE_SPACE,
                                   translate_transparent);
-    else if (tok.stretchable_space())
+    else if (tok.is_stretchable_space())
       ci1->set_special_translation(charinfo::TRANSLATE_STRETCHABLE_SPACE,
                                   translate_transparent);
-    else if (tok.dummy())
+    else if (tok.is_dummy())
       ci1->set_special_translation(charinfo::TRANSLATE_DUMMY,
                                   translate_transparent);
-    else if (tok.hyphen_indicator())
+    else if (tok.is_hyphen_indicator())
       ci1->set_special_translation(charinfo::TRANSLATE_HYPHEN_INDICATOR,
                                   translate_transparent);
     else {
@@ -7019,7 +7019,7 @@ void char_flags()
 void hyphenation_code()
 {
   tok.skip();
-  while (!tok.newline() && !tok.eof()) {
+  while (!tok.is_newline() && !tok.is_eof()) {
     charinfo *ci = tok.get_char(true /* required */);
     if (ci == 0)
       break;
@@ -7047,7 +7047,7 @@ void hyphenation_code()
 void hyphenation_patterns_file_code()
 {
   tok.skip();
-  while (!tok.newline() && !tok.eof()) {
+  while (!tok.is_newline() && !tok.is_eof()) {
     int n1, n2;
     if (get_integer(&n1) && (0 <= n1 && n1 <= 255)) {
       if (!has_arg()) {
@@ -7083,7 +7083,7 @@ void define_class()
   }
   charinfo *ci = get_charinfo(nm);
   charinfo *child1 = 0, *child2 = 0;
-  while (!tok.newline() && !tok.eof()) {
+  while (!tok.is_newline() && !tok.is_eof()) {
     tok.skip();
     if (child1 != 0 && tok.ch() == '-') {
       tok.next();
@@ -7143,7 +7143,7 @@ void define_class()
     child1 = tok.get_char(true /* required */);
     tok.next();
     if (!child1) {
-      if (!tok.newline())
+      if (!tok.is_newline())
        skip_line();
       break;
     }
@@ -7208,7 +7208,7 @@ charinfo *token::get_char(bool required)
 
 charinfo *get_optional_char()
 {
-  while (tok.space())
+  while (tok.is_space())
     tok.next();
   charinfo *ci = tok.get_char();
   if (!ci)
@@ -7220,7 +7220,8 @@ charinfo *get_optional_char()
 
 void check_missing_character()
 {
-  if (!tok.newline() && !tok.eof() && !tok.right_brace() && !tok.tab())
+  if (!tok.is_newline() && !tok.is_eof() && !tok.is_right_brace()
+      && !tok.is_tab())
     error("normal or special character expected (got %1): "
          "treated as missing",
          tok.description());
@@ -7502,9 +7503,9 @@ const char *constant_int_reg::get_string()
 void abort_request()
 {
   int c;
-  if (tok.eof())
+  if (tok.is_eof())
     c = EOF;
-  else if (tok.newline())
+  else if (tok.is_newline())
     c = '\n';
   else {
     while ((c = get_copy(0)) == ' ')
@@ -7611,7 +7612,7 @@ void copy_file()
     return;
   }
   symbol filename = get_long_name(true /* required */);
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   if (break_flag)
     curenv->do_break();
@@ -7643,7 +7644,7 @@ void transparent_file()
     return;
   }
   symbol filename = get_long_name(true /* required */);
-  while (!tok.newline() && !tok.eof())
+  while (!tok.is_newline() && !tok.is_eof())
     tok.next();
   if (break_flag)
     curenv->do_break();
@@ -7801,7 +7802,7 @@ void do_macro_source(bool quietly)
   if (nm.is_null())
     skip_line();
   else {
-    while (!tok.newline() && !tok.eof())
+    while (!tok.is_newline() && !tok.is_eof())
       tok.next();
     char *path;
     FILE *fp = mac_path->open_file(nm.contents(), &path);
@@ -8456,11 +8457,11 @@ node *charinfo_to_node_list(charinfo *ci, const 
environment *envp)
   // requests
   for (;;) {
     tok.next();
-    if (tok.eof())
+    if (tok.is_eof())
       break;
-    if (tok.newline()) {
+    if (tok.is_newline()) {
       error("composite character mustn't contain newline");
-      while (!tok.eof())
+      while (!tok.is_eof())
        tok.next();
       break;
     }
@@ -8482,10 +8483,10 @@ static node *read_draw_node()
 {
   token start;
   start.next();
-  if (!start.delimiter(true /* report error */)){
+  if (!start.usable_as_delimiter(true /* report error */)){
     do {
       tok.next();
-    } while (tok != start && !tok.newline() && !tok.eof());
+    } while (tok != start && !tok.is_newline() && !tok.is_eof());
   }
   else {
     tok.next();
@@ -8502,7 +8503,7 @@ static node *read_draw_node()
       hvpair *point = new hvpair[maxpoints];
       int npoints = 0;
       int no_last_v = 0;
-      int err = 0;
+      bool err = false;
       int i;
       for (i = 0; tok != start; i++) {
        if (i == maxpoints) {
@@ -8515,7 +8516,7 @@ static node *read_draw_node()
        }
        if (!get_hunits(&point[i].h,
                        type == 'f' || type == 't' ? 'u' : 'm')) {
-         err = 1;
+         err = true;
          break;
        }
        ++npoints;
@@ -8526,12 +8527,12 @@ static node *read_draw_node()
          break;
        }
        if (!get_vunits(&point[i].v, 'v')) {
-         err = 1;
+         err = false;
          break;
        }
        tok.skip();
       }
-      while (tok != start && !tok.newline() && !tok.eof())
+      while (tok != start && !tok.is_newline() && !tok.is_eof())
        tok.next();
       if (!err) {
        switch (type) {
@@ -8620,7 +8621,7 @@ static void read_color_draw_node(token &start)
   if (col)
     curenv->set_fill_color(col);
   while (tok != start) {
-    if (tok.newline() || tok.eof()) {
+    if (tok.is_newline() || tok.is_eof()) {
       warning(WARN_DELIM, "missing closing delimiter in color drawing"
              " device command (got %1)", tok.description());
       input_stack::push(make_temp_iterator("\n"));
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 3dbc573..39a2502 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -4426,7 +4426,7 @@ int word_space_node::merge_space(hunits h, hunits sw, 
hunits ssw)
 {
   n += h;
   assert(orig_width != 0);
-  width_list *w = orig_width; 
+  width_list *w = orig_width;
   for (; w->next; w = w->next)
     ;
   w->next = new width_list(sw, ssw);
@@ -6155,7 +6155,7 @@ static int get_fontno()
 {
   int n;
   tok.skip();
-  if (tok.delimiter()) {
+  if (tok.usable_as_delimiter()) {
     symbol s = get_name(true /* required */);
     if (!s.is_null()) {
       n = symbol_fontno(s);
@@ -6210,8 +6210,8 @@ void remove_font_special_character()
     return;
   }
   symbol f = font_table[n]->get_name();
-  while (!tok.newline() && !tok.eof()) {
-    if (!tok.space() && !tok.tab()) {
+  while (!tok.is_newline() && !tok.is_eof()) {
+    if (!tok.is_space() && !tok.is_tab()) {
       charinfo *s = tok.get_char(true /* required */);
       string gl(f.contents());
       gl += ' ';
@@ -6378,7 +6378,7 @@ void bold_font()
   int n = get_fontno();
   if (n >= 0) {
     if (has_arg()) {
-      if (tok.delimiter()) {
+      if (tok.usable_as_delimiter()) {
        int f = get_fontno();
        if (f >= 0) {
          units offset;
diff --git a/src/roff/troff/number.cpp b/src/roff/troff/number.cpp
index b11c13c..8e99991 100644
--- a/src/roff/troff/number.cpp
+++ b/src/roff/troff/number.cpp
@@ -1,4 +1,3 @@
-// -*- C++ -*-
 /* Copyright (C) 1989-2020 Free Software Foundation, Inc.
      Written by James Clark (jjc@jclark.com)
 
@@ -215,17 +214,17 @@ static incr_number_result get_incr_number(units *res, 
unsigned char si)
 
 static int start_number()
 {
-  while (tok.space())
+  while (tok.is_space())
     tok.next();
-  if (tok.newline()) {
+  if (tok.is_newline()) {
     warning(WARN_MISSING, "missing number");
     return 0;
   }
-  if (tok.tab()) {
+  if (tok.is_tab()) {
     warning(WARN_TAB, "tab character where number expected");
     return 0;
   }
-  if (tok.right_brace()) {
+  if (tok.is_right_brace()) {
     warning(WARN_RIGHT_BRACE, "'\\}' where number expected");
     return 0;
   }
@@ -400,7 +399,7 @@ static int parse_term(units *v, int scaling_indicator,
 {
   int negative = 0;
   for (;;)
-    if (parenthesised && tok.space())
+    if (parenthesised && tok.is_space())
       tok.next();
     else if (tok.ch() == '+')
       tok.next();
@@ -694,3 +693,9 @@ hunits::hunits(units x)
         ? -((-x + hresolution/2 - 1)/hresolution)
         : (x + hresolution/2 - 1)/hresolution);
 }
+
+// Local Variables:
+// fill-column: 72
+// mode: C++
+// End:
+// vim: set cindent noexpandtab shiftwidth=2 textwidth=72:
diff --git a/src/roff/troff/reg.cpp b/src/roff/troff/reg.cpp
index 39c5f6f..a3139f4 100644
--- a/src/roff/troff/reg.cpp
+++ b/src/roff/troff/reg.cpp
@@ -1,4 +1,3 @@
-// -*- C++ -*-
 /* Copyright (C) 1989-2020 Free Software Foundation, Inc.
      Written by James Clark (jjc@jclark.com)
 
@@ -317,7 +316,7 @@ void define_number_reg()
       number_reg_dictionary.define(nm, r);
     }
     r->set_value(v);
-    if (tok.space() && has_arg() && get_number(&v, 'u'))
+    if (tok.is_space() && has_arg() && get_number(&v, 'u'))
       r->set_increment(v);
   }
   skip_line();
@@ -401,7 +400,7 @@ void alter_format()
   }
   else if (c == 'i' || c == 'I' || c == 'a' || c == 'A')
     r->alter_format(c);
-  else if (tok.newline() || tok.eof())
+  else if (tok.is_newline() || tok.is_eof())
     warning(WARN_MISSING, "missing register format");
   else
     error("bad register format (got %1)", tok.description());
@@ -469,3 +468,9 @@ void init_reg_requests()
   init_request("rnn", rename_reg);
   init_request("pnr", print_number_regs);
 }
+
+// Local Variables:
+// fill-column: 72
+// mode: C++
+// End:
+// vim: set cindent noexpandtab shiftwidth=2 textwidth=72:
diff --git a/src/roff/troff/token.h b/src/roff/troff/token.h
index f3d9e39..f6dd8d9 100644
--- a/src/roff/troff/token.h
+++ b/src/roff/troff/token.h
@@ -1,4 +1,3 @@
-// -*- C++ -*-
 /* Copyright (C) 1989-2020 Free Software Foundation, Inc.
      Written by James Clark (jjc@jclark.com)
 
@@ -68,31 +67,31 @@ public:
   void next();
   void process();
   void skip();
-  int eof();
-  int nspaces();               // 1 if space, 2 if double space, 0 otherwise
-  int space();                 // is the current token a space?
-  int stretchable_space();     // is the current token a stretchable space?
-  int unstretchable_space();   // is the current token an unstretchable space?
-  int horizontal_space();      // is the current token a horizontal space?
-  int white_space();           // is the current token space or tab?
-  int special();               // is the current token a special character?
-  int newline();               // is the current token a newline?
-  int tab();                   // is the current token a tab?
-  int leader();
-  int backspace();
-  int delimiter(bool err = false);     // usable as a delimiter?
-  int dummy();
-  int transparent_dummy();
-  int transparent();
-  int left_brace();
-  int right_brace();
-  int page_ejector();
-  int hyphen_indicator();
-  int zero_width_break();
+  int nspaces();               // 1 if space, 0 otherwise
+  bool is_eof();
+  bool is_space();
+  bool is_stretchable_space();
+  bool is_unstretchable_space();
+  bool is_horizontal_space();
+  bool is_white_space();
+  bool is_special();
+  bool is_newline();
+  bool is_tab();
+  bool is_leader();
+  bool is_backspace();
+  bool usable_as_delimiter(bool = false);
+  bool is_dummy();
+  bool is_transparent_dummy();
+  bool is_transparent();
+  bool is_left_brace();
+  bool is_right_brace();
+  bool is_page_ejector();
+  bool is_hyphen_indicator();
+  bool is_zero_width_break();
   int operator==(const token &); // need this for delimiters, and for 
conditions
   int operator!=(const token &); // ditto
   unsigned char ch();
-  charinfo *get_char(bool required = false);
+  charinfo *get_char(bool = false);
   int add_to_node_list(node **);
   int title();
   void make_space();
@@ -105,8 +104,8 @@ public:
 
 extern token tok;              // the current token
 
-extern symbol get_name(bool required = false);
-extern symbol get_long_name(bool required = false);
+extern symbol get_name(bool = false);
+extern symbol get_long_name(bool = false);
 extern charinfo *get_optional_char();
 extern char *read_string();
 extern void check_missing_character();
@@ -137,55 +136,52 @@ void interpolate_number_reg(symbol, int);
 
 const char *asciify(int c);
 
-inline int token::newline()
-{ 
-  return type == TOKEN_NEWLINE; 
+inline bool token::is_newline()
+{
+  return type == TOKEN_NEWLINE;
 }
 
-inline int token::space()
-{ 
+inline bool token::is_space()
+{
   return type == TOKEN_SPACE;
 }
 
-inline int token::stretchable_space()
+inline bool token::is_stretchable_space()
 {
   return type == TOKEN_STRETCHABLE_SPACE;
 }
 
-inline int token::unstretchable_space()
+inline bool token::is_unstretchable_space()
 {
   return type == TOKEN_UNSTRETCHABLE_SPACE;
 }
 
-inline int token::horizontal_space()
+inline bool token::is_horizontal_space()
 {
   return type == TOKEN_HORIZONTAL_SPACE;
 }
 
-inline int token::special()
-{ 
+inline bool token::is_special()
+{
   return type == TOKEN_SPECIAL;
 }
 
 inline int token::nspaces()
 {
-  if (type == TOKEN_SPACE)
-    return 1;
-  else
-    return 0;
+  return (int)(type == TOKEN_SPACE);
 }
 
-inline int token::white_space()
+inline bool token::is_white_space()
 {
   return type == TOKEN_SPACE || type == TOKEN_TAB;
 }
 
-inline int token::transparent()
+inline bool token::is_transparent()
 {
   return type == TOKEN_TRANSPARENT;
 }
 
-inline int token::page_ejector()
+inline bool token::is_page_ejector()
 {
   return type == TOKEN_PAGE_EJECTOR;
 }
@@ -193,56 +189,62 @@ inline int token::page_ejector()
 inline unsigned char token::ch()
 {
   return type == TOKEN_CHAR ? c : 0;
-} 
+}
 
-inline int token::eof()
+inline bool token::is_eof()
 {
   return type == TOKEN_EOF;
 }
 
-inline int token::dummy()
+inline bool token::is_dummy()
 {
   return type == TOKEN_DUMMY;
 }
 
-inline int token::transparent_dummy()
+inline bool token::is_transparent_dummy()
 {
   return type == TOKEN_TRANSPARENT_DUMMY;
 }
 
-inline int token::left_brace()
+inline bool token::is_left_brace()
 {
   return type == TOKEN_LEFT_BRACE;
 }
 
-inline int token::right_brace()
+inline bool token::is_right_brace()
 {
   return type == TOKEN_RIGHT_BRACE;
 }
 
-inline int token::tab()
+inline bool token::is_tab()
 {
   return type == TOKEN_TAB;
 }
 
-inline int token::leader()
+inline bool token::is_leader()
 {
   return type == TOKEN_LEADER;
 }
 
-inline int token::backspace()
+inline bool token::is_backspace()
 {
   return type == TOKEN_BACKSPACE;
 }
 
-inline int token::hyphen_indicator()
+inline bool token::is_hyphen_indicator()
 {
   return type == TOKEN_HYPHEN_INDICATOR;
 }
 
-inline int token::zero_width_break()
+inline bool token::is_zero_width_break()
 {
   return type == TOKEN_ZERO_WIDTH_BREAK;
 }
 
-int has_arg();
+bool has_arg();
+
+// Local Variables:
+// fill-column: 72
+// mode: C++
+// End:
+// vim: set cindent noexpandtab shiftwidth=2 textwidth=72:



reply via email to

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