[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #62852] Combination of "eqn" and "tbl" in compatibility mode errors
From: |
G. Branden Robinson |
Subject: |
[bug #62852] Combination of "eqn" and "tbl" in compatibility mode errors |
Date: |
Thu, 4 Aug 2022 01:24:33 -0400 (EDT) |
Update of bug #62852 (project groff):
Category: None => Preprocessor eqn
Status: None => Confirmed
Assigned to: None => gbranden
_______________________________________________________
Follow-up Comment #1:
This affects groff 1.22.4 and, I suspect, every earlier version going back to
groff 1.22.2.
I believe the problem to be this.
The -C flag turns on AT&T compatibility mode in both tbl and eqn. In the
latter, this disables special interpretation of the eqn input "delim on".
Instead of re-enabling delimiters that have been shut off with "delim off", it
assigns opening and closing delimiters of 'o' and 'n' respectively, just as
AT&T eqn would have.
However, even with -C specified, tbl expects "delim on" to work in the GNU eqn
way. GNU tbl brackets portions of the groff input it writes in "delim
off"/"delim on" pairs to avoid interference from eqn with the output of
formatting-time diagnostics.
For example, we have the following in Git HEAD.
$ sed -n '2190,2207p' src/preproc/tbl/table.cpp
if ((!(flags & NOWARN)) && (!(flags & EXPAND))) {
// Protect characters in diagnostic message (especially :, [, ])
// from being interpreted by eqn.
prints(".ig\n"
".EQ\n"
"delim off\n"
".EN\n"
"..\n");
entry_list->set_location();
prints(".tmc \\n[.F]:\\n[.c]: warning:\n"
".tm1 \" table wider than line length minus indentation\n");
prints(".ig\n"
".EQ\n"
"delim on\n"
".EN\n"
"..\n");
prints(".nr " EXPAND_REG " 0\n");
}
I think the discarded special recognition of "delim on" in eqn's compatibility
mode is going to have to go. Even in AT&T documents, I suspect the number of
documents using "o" and "n" as _delimiters_ is low to zero.
So I propose to disable this feature, losing an aspect of AT&T eqn
compatibility that I believe to be negligible.
diff --git a/src/preproc/eqn/lex.cpp b/src/preproc/eqn/lex.cpp
index 115617b1d..51c5af246 100644
--- a/src/preproc/eqn/lex.cpp
+++ b/src/preproc/eqn/lex.cpp
@@ -1079,7 +1079,7 @@ void do_delim()
end_delim_saved = end_delim;
start_delim = end_delim = '\0';
}
- else if (c == 'o' && d == 'n' && !compatible_flag) {
+ else if (c == 'o' && d == 'n') {
start_delim = start_delim_saved;
end_delim = end_delim_saved;
}
Here's a simpler reproducer and its behavior with groff 1.22.4 and a patched
Git HEAD.
$ groff -Cetz EXPERIMENTS/eqn-tbl-compatibility-mode.roff
eqn:EXPERIMENTS/eqn-tbl-compatibility-mode.roff:122: '\' ignored because
followed by newline
eqn:EXPERIMENTS/eqn-tbl-compatibility-mode.roff:123: unquoted escape
eqn:EXPERIMENTS/eqn-tbl-compatibility-mode.roff:36: '\' ignored because
followed by newline
eqn:EXPERIMENTS/eqn-tbl-compatibility-mode.roff:87: '\' ignored because
followed by newline
eqn:EXPERIMENTS/eqn-tbl-compatibility-mode.roff:8: '\' ignored because
followed by newline
eqn:EXPERIMENTS/eqn-tbl-compatibility-mode.roff:8: '\' ignored because
followed by newline
troff: EXPERIMENTS/eqn-tbl-compatibility-mode.roff:36: '\&' is not allowed in
a name
troff: EXPERIMENTS/eqn-tbl-compatibility-mode.roff:82: '\&' is not allowed in
a name
troff: EXPERIMENTS/eqn-tbl-compatibility-mode.roff:82: warning: numeric
expression expected (got '\&')
troff: EXPERIMENTS/eqn-tbl-compatibility-mode.roff:87: '\&' is not allowed in
a name
troff: EXPERIMENTS/eqn-tbl-compatibility-mode.roff:8: '\&' is not allowed in a
name
troff: EXPERIMENTS/eqn-tbl-compatibility-mode.roff:8: warning: numeric
expression expected (got '\&')
$ ./build/test-groff -Cetz EXPERIMENTS/eqn-tbl-compatibility-mode.roff
$
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?62852>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/