gbranden pushed a commit to branch master
in repository groff.

commit 173e9849f34f57cd3f52df841dd6103ce65365a6
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Aug 19 15:14:05 2024 -0500

    [troff]: Fix Savannah #63202 (3/3).
    
    * src/roff/troff/input.cpp (do_expr_test): When throwing a warning
      diagnostic about a mismatched escape sequence delimiter (in an escape
      sequence that accepts a newline as a delimiter(!)), say what what we
      were expecting and what we got instead.
    
    $ printf '\\Babc\n' | build/test-groff -a -ww
    troff:<standard input>:1: warning: missing closing delimiter in numeric 
expression validation escape sequence; expected character 'a', got a newline
    <beginning of page>
    0
---
 ChangeLog                | 3 ++-
 src/roff/troff/input.cpp | 8 +++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index db721ffad..5c47423f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,7 +6,8 @@
 
        * src/roff/troff/input.cpp (do_overstrike, do_bracket)
        (do_name_test, do_zero_width, do_width, do_device_control)
-       (read_delimited_number, get_line_arg, do_register):
+       (read_delimited_number, get_line_arg, do_register)
+       (do_expr_test):
        * src/roff/troff/reg.cpp (inline_define_register [0]): Do it.
 
        Fixes <https://savannah.gnu.org/bugs/?63202>.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index b8dc125aa..a8afd925b 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -1704,9 +1704,11 @@ static int do_expr_test()
   for (;;) {
     tok.next();
     if (tok.is_newline() || tok.is_eof()) {
-      warning(WARN_DELIM, "missing closing delimiter in"
-             " expression test escape sequence (got %1)",
-             tok.description());
+      char *delimdesc = strdup(start_token.description());
+      warning(WARN_DELIM, "missing closing delimiter in numeric"
+             " expression validation escape sequence; expected %1,"
+             " got %2", delimdesc, tok.description());
+      free(delimdesc);
       input_stack::push(make_temp_iterator("\n"));
       break;
     }

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

Reply via email to