gbranden pushed a commit to branch master
in repository groff.
commit 37c405903b6e4440c34bb46d5176741604042921
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Nov 6 03:55:40 2025 -0600
[troff]: Accept more compat mode delimiters (1/3).
* src/roff/troff/input.cpp (token::is_usable_as_delimiter): Accept many
more numeric 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 | 9 ++++++++-
src/roff/groff/tests/check-delimiter-validity.sh | 4 +++-
src/roff/troff/input.cpp | 18 +++++++++++++++++-
3 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fb91096f3..ddc424b36 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,14 @@
2025-11-06 G. Branden Robinson <[email protected]>
* src/roff/groff/tests/check-delimiter-validity.sh: Test many
- more string expression delimiters in compatibility mode,
+ more numeric expression delimiters in compatibility mode,
+ namely punctuation characters that AT&T troff doesn't reject in
+ that context.
+
+2025-11-06 G. Branden Robinson <[email protected]>
+
+ * src/roff/groff/tests/check-delimiter-validity.sh: Test many
+ more string expression delimiters in compatibility mode),
including numerals and punctuation characters.
2025-11-06 G. Branden Robinson <[email protected]>
diff --git a/src/roff/groff/tests/check-delimiter-validity.sh
b/src/roff/groff/tests/check-delimiter-validity.sh
index 8bb8f187c..e839e392c 100755
--- a/src/roff/groff/tests/check-delimiter-validity.sh
+++ b/src/roff/groff/tests/check-delimiter-validity.sh
@@ -75,7 +75,9 @@ done
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 e f g h i j k l m n o p q r s t u v w x y z \
- 0 1 2 3 4 5 6 7 8 9 . '|'
+ 0 1 2 3 4 5 6 7 8 9 . '|' \
+ '!' '"' '#' '$' "'" ',' ';' '?' \
+ '@' '[' ']' '^' '`' '{' '}' '~'
do
echo "checking validity of '$c' as numeric expression delimiter" \
"in compatibility mode" >&2
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index ca66dad6c..a7a5172f9 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2773,8 +2773,24 @@ bool token::is_usable_as_delimiter(bool report_error,
is_valid = true;
break;
case DELIMITER_ATT_NUMERIC_EXPRESSION:
- if (csalnum(c) || ('.' == c) || ('|' == c))
+ if (csgraph(c))
is_valid = true;
+ // AT&T troff doesn't accept as numeric expression delimiters
+ // characters that validly appear in a numeric expression,
+ // _except_ for numerals, `|`, and `.`.
+ if (('+' == c)
+ || ('-' == c)
+ || ('/' == c)
+ || ('*' == c)
+ || ('%' == c)
+ || ('<' == c)
+ || ('>' == c)
+ || ('=' == c)
+ || ('&' == c)
+ || (':' == c)
+ || ('(' == c)
+ || (')' == c))
+ is_valid = false;
break;
case DELIMITER_ATT_OUTPUT_COMPARISON_EXPRESSION:
if (csupper(c)
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit