Follow-up Comment #5, bug #66700 (group groff):

At 2025-01-23T08:32:23-0500, Deri James wrote:
> Follow-up Comment #4, bug #66700 (group groff):
>
> Does this mean that adding a valid unit specifier to a valid single
> character named register is no longer accepted?

It's "accepted", but warned about.  The (non-)interpretaton of excess
scaling units has not changed.  You will notice that the commit did not
change the _semantics_ of numeric expression interpretation.


diff --git a/src/roff/troff/reg.cpp b/src/roff/troff/reg.cpp
index 7daf30912..57f10b5a7 100644
--- a/src/roff/troff/reg.cpp
+++ b/src/roff/troff/reg.cpp
@@ -323,8 +323,14 @@ void define_register()
       register_dictionary.define(nm, r);
     }
     r->set_value(v);
-    if (tok.is_space() && has_arg() && read_measurement(&v, 'u'))
-      r->set_increment(v);
+    if (tok.is_space()) {
+      if (has_arg() && read_measurement(&v, 'u'))
+       r->set_increment(v);
+    }
+    else if (has_arg() && !tok.is_tab())
+      warning(WARN_SYNTAX, "expected end of line or an auto-increment"
+             " argument in register definition request; got %1",
+             tok.description());
   }
   skip_line();
 }


This change was proposed on the mailing list last April.

https://lists.gnu.org/archive/html/groff/2023-04/msg00307.html

I observe (I had forgotten) that Doug McIlroy proposed making this "a
hard error", which might have meant a mere promotion of the diagnostic
severity, or might have meant aborting interpretation of the numeric
expression (so the meaning of "3mn+2i" _would_ change).

"[N]ot necessarily one that stops groff in its tracks" means, I assume,
that he didn't advise making it a _fatal_ error.

In the end I decided on a warning _because_ I didn't have to change the
control flow of the numeric expression interpreter (with respect to
_parsing_, obviously I did split a conditional) to get the diagnostic
that was suggested.  So what this does is warn the user that they're
saying nothing when they might think they're saying something.

Similarly:


commit 1222385e42032dea31fb1eb893653de5ae8cae05
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
Date:   Fri Jan 17 20:03:54 2025 -0600

    [troff]: More requests warn of missing arguments.

    Make more requests that take mandatory arguments--specifically `char`,
    `fchar`, and `schar`--throw warning diagnostics in category "missing"
    when they aren't given any.

    * src/roff/troff/input.cpp (define_character_request)
      (define_fallback_character_request)
      (define_special_character_request): Do it.


> Or am I reading too much into this patch?

Possibly.



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?66700>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to