gbranden pushed a commit to branch master
in repository groff.
commit eae4ebe2b8daf9e1578758c941ae20e1e40f2d63
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Nov 6 04:21:24 2025 -0600
[troff]: Accept more compat mode delimiters (2/3).
* src/roff/troff/input.cpp (token::is_usable_as_delimter): Accept many
more conditional expression delimiters in compatibility mode, namely
punctuation characters that AT&T troff doesn't reject in that context.
* src/roff/groff/tests/check-delimiter-validity.sh: Test it.
---
ChangeLog | 8 ++++++++
src/roff/groff/tests/check-delimiter-validity.sh | 6 +++++-
src/roff/troff/input.cpp | 22 +++++++++++++++++++++-
3 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ddc424b36..ba6950b65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-11-06 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/input.cpp (token::is_usable_as_delimter):
+ Accept many more conditional expression delimiters in
+ compatibility mode, namely punctuation characters that AT&T
+ troff doesn't reject in that context.
+ * src/roff/groff/tests/check-delimiter-validity.sh: Test it.
+
2025-11-06 G. Branden Robinson <[email protected]>
* src/roff/groff/tests/check-delimiter-validity.sh: Test many
diff --git a/src/roff/groff/tests/check-delimiter-validity.sh
b/src/roff/groff/tests/check-delimiter-validity.sh
index e839e392c..d591718de 100755
--- a/src/roff/groff/tests/check-delimiter-validity.sh
+++ b/src/roff/groff/tests/check-delimiter-validity.sh
@@ -100,8 +100,12 @@ done
# to treat 'v' as an AT&Tism or a GNUism.
#for c in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
# a b c d f g h i j k l m p q r s u v w x y z
+# not tested: '!' (because it's a conditional expression operator)
+# not tested: '@' (because it's part of our delimited expression)
for c in A B C D E G H I J K L M N O P Q R T U V W X Y Z \
- a b f g h i j k l p q s u w x y z
+ a b f g h i j k l p q s u w x y z \
+ '"' '#' '$' "'" ',' ';' '?' \
+ '[' ']' '^' '`' '{' '}' '~'
do
echo "checking validity of '$c' as output comparison delimiter" \
"in compatibility mode" >&2
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index a7a5172f9..74a404b60 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2798,8 +2798,28 @@ bool token::is_usable_as_delimiter(bool report_error,
&& (c != 'e')
&& (c != 'n')
&& (c != 'o')
- && (c != 't')))
+ && (c != 't'))
+ || cspunct(c))
is_valid = true;
+ // AT&T troff doesn't accept as conditional expression
+ // delimiters characters that can validly appear in a numeric
+ // expression, nor `!`. We already excluded numerals above.
+ if (('+' == c)
+ || ('-' == c)
+ || ('/' == c)
+ || ('*' == c)
+ || ('%' == c)
+ || ('<' == c)
+ || ('>' == c)
+ || ('=' == c)
+ || ('&' == c)
+ || (':' == c)
+ || ('(' == c)
+ || (')' == c)
+ || ('|' == c)
+ || ('.' == c)
+ || ('!' == c))
+ is_valid = false;
break;
default:
assert(0 == "unhandled case of `context` (enum dcontext)");
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit