gbranden pushed a commit to branch master
in repository groff.

commit d30144894f60bcb3f1c88d499e186d17c3a13c58
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Oct 31 22:27:29 2025 -0500

    Revert "[troff]: Allow more delimiters in compat mode."
    
    This reverts commit fb6fdbd9d174262ab57572bf095100459b589a66.
    
    This change begins resolving Savannah #67408.
    
    Tests fail at this commit:
    
    src/roff/groff/tests/check-delimiter-validity.sh
    src/roff/groff/tests/logical-predicates-work.sh
---
 ChangeLog                | 15 ---------------
 NEWS                     |  5 -----
 doc/groff.texi.in        | 19 ++-----------------
 man/groff_diff.7.man     | 12 ------------
 src/roff/troff/input.cpp | 16 ++++++++++------
 5 files changed, 12 insertions(+), 55 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d27894291..cc3613528 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9056,21 +9056,6 @@
        * tmac/tests/doc_vertical-margins-are-correct.sh: Work around
        macOS wc(1)'s right-alignment of its integer output field.
 
-2024-11-25  G. Branden Robinson <[email protected]>
-
-       * src/roff/troff/input.cpp (token::is_usable_as_delimiter): If
-       in compatibility mode, accept any ordinary character as a
-       delimiter.
-
-       * doc/groff.texi.in (Delimiters, Compatibility Mode):
-       * man/groff_diff.7.man (Compatibility mode): Document it.
-
-       * src/roff/groff/tests/\
-       allow-wacky-delimiters-in-compatibility-mode.sh: Test it.
-       * src/roff/groff/groff.am (groff_TESTS): Run test.
-
-       * NEWS: Add item.
-
 2024-11-25  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/input.cpp (is_char_usable_as_delimiter):
diff --git a/NEWS b/NEWS
index b533efb1d..cfb2c8694 100644
--- a/NEWS
+++ b/NEWS
@@ -261,11 +261,6 @@ troff
 *  The `-c` command-line option now also removes the `color` request's
    ability to enable multi-color output.
 
-*  In compatibility mode, GNU troff now accepts delimiters that it
-   rejects when not in compatibility mode--namely, ordinary characters
-   that can validly begin numeric expressions (which are often
-   delimited).  This change improves compatibility with AT&T troff.
-
 eqn
 ---
 
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 9a3be9e6d..1641b44ac 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -7817,14 +7817,10 @@ the numerals @code{0}-@code{9} and the decimal point 
@code{.}
 @ifinfo
 @cindex <colon>, as delimiter
 @end ifinfo
-@c @cindex @code{|}, as delimiter
+@cindex @code{|}, as delimiter
 @cindex @code{(}, as delimiter
 @cindex @code{)}, as delimiter
-the (single-character) operators @samp{+-/*%<>=&:()}@footnote{GNU
-@command{troff} accepts @samp{|} as a delimiter in spite of its
-meaningfulness in numeric expressions because it occasionally sees use
-in man pages.  Future @code{groff} releases may deprecate and
-subsequently withdraw such support.}
+the (single-character) operators @samp{+-/*%<>=&:()|}
 
 @item
 @cindex space character, as delimiter
@@ -19680,17 +19676,6 @@ to those defined by libraries,
 choose a register name that is unlikely to collide with other uses.
 @endDefreq
 
-@cindex additional delimiters accepted by @acronym{AT&T} @code{troff}
-@cindex delimiters, additional, accepted by @acronym{AT&T} @code{troff}
-In compatibility mode,
-GNU
-@command{troff} @c GNU
-accepts several characters as delimiters that it ordinarily rejects
-because they can begin numeric expressions and therefore
-may be ambiguous to the document maintainer.
-This set of additional delimiters comprises
-@samp{0123456789+-(.|}.
-
 @cindex input level
 @cindex level, input
 @cindex interpolation depth
diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man
index a1058a5b4..8953f22d3 100644
--- a/man/groff_diff.7.man
+++ b/man/groff_diff.7.man
@@ -6169,18 +6169,6 @@ turns compatibility mode
 while it interprets its argument list.
 .
 .
-.P
-In compatibility mode,
-GNU
-.I troff \" GNU
-accepts several characters as delimiters that it ordinarily rejects,
-because they can begin numeric expressions and therefore
-may be ambiguous to the document maintainer.
-.
-The set of additional delimiters comprises
-.RB \[lq] 0123456789+\-(.| \[rq].
-.
-.
 .\" ====================================================================
 .SH "Other differences"
 .\" ====================================================================
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 8edaf3607..2167eaf9b 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2644,9 +2644,17 @@ bool token::operator!=(const token &t)
 // doesn't tokenize it) and accepts a user-specified delimiter.
 static bool is_char_usable_as_delimiter(int c)
 {
-  if (csdigit(c))
-    return false;
   switch (c) {
+  case '0':
+  case '1':
+  case '2':
+  case '3':
+  case '4':
+  case '5':
+  case '6':
+  case '7':
+  case '8':
+  case '9':
   case '+':
   case '-':
   // case '/':
@@ -2673,10 +2681,6 @@ bool token::is_usable_as_delimiter(bool report_error)
   bool is_valid = false;
   switch (type) {
   case TOKEN_CHAR:
-    // AT&T troff accepted any character as a delimiter, even perverse
-    // choices in cases like `\l91n+2n\&*9`.  See Savannah #66481.
-    if (want_att_compat)
-      return true;
     is_valid = is_char_usable_as_delimiter(c);
     if (!is_valid && report_error)
       error("character '%1' is not allowed as a delimiter",

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

Reply via email to