groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 08/17: [troff]: Drop redundant diagnostic.


From: G. Branden Robinson
Subject: [groff] 08/17: [troff]: Drop redundant diagnostic.
Date: Sat, 17 Feb 2024 22:08:43 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 90568dc1afe41c9f909f26e7e3fa6f9d499127bc
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Feb 17 15:12:04 2024 -0600

    [troff]: Drop redundant diagnostic.
    
    * src/roff/troff/input.cpp (do_define_string, length_request): Drop
      redundant diagnostic message on invalid string identifiers.
    
    Tested as follows:
    $ cat bad-string-identifiers.groff
    .ds a\ b
    .ds a\!b
    .ds a\%b
    .ds a\&b
    .ds a\'b
    .ds a\(emb
    .ds a\)b
    .ds a\,b \" "a node is not allowed in an identifier" :-/
    .ds a\-b
    .ds a\/b
    .ds a\0b
    .ds a\:b
    .ds a\?foo\?b \" "a node is not allowed in an identifier" :-/
    .ds a\[a aa]b
    .ds a\[char37]b
    .ds a\[em]b
    .ds a\[u0025]b
    .ds a\[u0061_0301]b
    .ds a\^b
    .ds a\_b
    .ds a\`b
    .ds a\ab \" "a node is not allowed in an identifier" :-/
    .ds a\b'abc'b \" "a node is not allowed in an identifier" :-/
    .ds a\cb
    .ds a\C'em'b
    .ds a\db \" "a node is not allowed in an identifier" :-/
    .ds a\D'l 1 1'b \" "a node is not allowed in an identifier" :-/
    .ds a\eb
    .ds a\h'1m'b
    .ds a\krb
    .ds a\l'1m'b \" "a node is not allowed in an identifier" :-/
    .ds a\L'1v'b \" "a node is not allowed in an identifier" :-/
    .ds a\o'o+'b \" "a node is not allowed in an identifier" :-/
    .ds a\O0b \" "a node is not allowed in an identifier" :-/
    .ds a\pb
    .ds a\rb \" "a node is not allowed in an identifier" :-/
    .ds a\tb \" "a node is not allowed in an identifier" :-/
    .ds a\ub \" "a node is not allowed in an identifier" :-/
    .ds a\v'1v'b \" "a node is not allowed in an identifier" :-/
    .ds a\x'1v'b \" "a node is not allowed in an identifier" :-/
    .ds a\X'device: whatever'b \" "a node is not allowed in an identifier" :-/
    .ds a\Y[macro]b \" "a node is not allowed in an identifier" :-/
    .ds a\zxb \" "a node is not allowed in an identifier" :-/
    .ds a\Z'abc'b \" "a node is not allowed in an identifier" :-/
    .ds a\|b
    .ds a\~b
    .\"ds a\"b \" OK: produces valid empty string named a
    .\"ds a\#b \" valid so far, depends on contents of next input line
    .\"ds a\$1b \" OK
    .\"ds a\*sb \" OK: close to idiomatic for identifier construction
    .\"ds a\+b \" OK: produces valid empty string named a+b
    .\"ds a\.b \" OK (but dubious): produces valid empty string named a.b
    .\"ds a\1b \" OK: produces valid empty string named a1b
    .\"ds a\2b \" OK: produces valid empty string named a2b
    .\"ds a\3b \" OK: produces valid empty string named a3b
    .\" ...
    .\"ds a\9b \" OK: produces valid empty string named a9b
    .\"ds a\;b \" OK: produces valid empty string named a;b
    .\"ds a\<b \" OK: produces valid empty string named a<b
    .\"ds a\=b \" OK: produces valid empty string named a=b
    .\"ds a\>b \" OK: produces valid empty string named a>b
    .\"ds a\@b \" OK: produces valid empty string named a@b
    .\"ds a\Bb \" OK: produces valid a0b or a1b
    .\"ds a\Eb \" XXX: no diagnostic--should we add one?
    .\"ds a\f1b \" valid, but a wack place to do this; creates empty string "ab"
    .\"ds a\FTb \" valid, but a wack place to do this; creates empty string "ab"
    .\"ds a\gab \" OK: produces valid name like a0b, aib, aIb, ...
    .\"ds a\Gb \" OK: produces valid empty string named aGb
    .\"ds a\H'12'b \" valid, but a wack place to do this; creates empty string 
"ab"
    .\"ds a\ib \" OK: produces valid empty string named aib
    .\"ds a\Ib \" OK: produces valid empty string named aIb
    .\"ds a\jb \" OK: produces valid empty string named ajb
    .\"ds a\Jb \" OK: produces valid empty string named aJb
    .\"ds a\Kb \" OK: produces valid empty string named aKb
    .\"ds a\m[default]b \" valid, but a wack place to do this; creates empty 
string "ab"
    .\"ds a\M[default]b \" valid, but a wack place to do this; creates empty 
string "ab"
    .\"ds a\nrb \" OK: close to idiomatic for identifier construction
    .\"ds a\Nb \" OK: produces valid empty string named aNb
    .\"ds a\Pb \" OK: produces valid empty string named aPb
    .\"ds a\qb \" OK: produces valid empty string named aqb
    .\"ds a\Qb \" OK: produces valid empty string named aQb
    .\"ds a\R'a 5'b \" valid, but a wack place to do this; creates empty string 
"ab" and register "a" with value 5
    .\"ds a\s'8'b \" valid, but a wack place to do this; creates empty string 
"ab"
    .\"ds a\S'8'b \" valid, but a wack place to do this; creates empty string 
"ab"
    .\"ds a\Tb \" OK: produces valid empty string named aTb
    .\"ds a\Ub \" OK: produces valid empty string named aUb
    .\"ds a\Vb \" OK: produces valid empty string named aVb
    .\"ds a\w'hello'b \" OK: produces valid name like a12345b
    .\"ds a\Wb \" OK: produces valid empty string named aWb
    .\"ds a\yb \" OK: produces valid empty string named ayb
    .\"ds a\{b \" XXX: no diagnostic--can we add one?
    .\"ds a\}b \" XXX: no diagnostic--can we add one?
    $ ./build/test-groff bad-string-identifiers.groff 2>&1 | cat -n
         1  troff:bad-string-identifiers.groff:1: error: an escaped ' ' is not 
allowed in an identifier
         2  troff:bad-string-identifiers.groff:2: error: an escaped '!' is not 
allowed in an identifier
         3  troff:bad-string-identifiers.groff:3: error: an escaped '%' is not 
allowed in an identifier
         4  troff:bad-string-identifiers.groff:4: error: an escaped '&' is not 
allowed in an identifier
         5  troff:bad-string-identifiers.groff:5: error: a special character is 
not allowed in an identifier
         6  troff:bad-string-identifiers.groff:6: error: a special character is 
not allowed in an identifier
         7  troff:bad-string-identifiers.groff:7: error: an escaped ')' is not 
allowed in an identifier
         8  troff:bad-string-identifiers.groff:8: error: a node is not allowed 
in an identifier
         9  troff:bad-string-identifiers.groff:9: error: a special character is 
not allowed in an identifier
        10  troff:bad-string-identifiers.groff:10: error: an escaped '/' is not 
allowed in an identifier
        11  troff:bad-string-identifiers.groff:11: error: a horizontal motion 
is not allowed in an identifier
        12  troff:bad-string-identifiers.groff:12: error: an escaped ':' is not 
allowed in an identifier
        13  troff:bad-string-identifiers.groff:13: error: a node is not allowed 
in an identifier
        14  troff:bad-string-identifiers.groff:14: error: a special character 
is not allowed in an identifier
        15  troff:bad-string-identifiers.groff:15: error: a special character 
is not allowed in an identifier
        16  troff:bad-string-identifiers.groff:16: error: a special character 
is not allowed in an identifier
        17  troff:bad-string-identifiers.groff:17: error: a special character 
is not allowed in an identifier
        18  troff:bad-string-identifiers.groff:18: error: a special character 
is not allowed in an identifier
        19  troff:bad-string-identifiers.groff:19: error: a horizontal motion 
is not allowed in an identifier
        20  troff:bad-string-identifiers.groff:20: error: a special character 
is not allowed in an identifier
        21  troff:bad-string-identifiers.groff:21: error: a special character 
is not allowed in an identifier
        22  troff:bad-string-identifiers.groff:22: error: a node is not allowed 
in an identifier
        23  troff:bad-string-identifiers.groff:23: error: a node is not allowed 
in an identifier
        24  troff:bad-string-identifiers.groff:24: error: an escaped 'c' is not 
allowed in an identifier
        25  troff:bad-string-identifiers.groff:25: error: a special character 
is not allowed in an identifier
        26  troff:bad-string-identifiers.groff:26: error: a node is not allowed 
in an identifier
        27  troff:bad-string-identifiers.groff:27: error: a node is not allowed 
in an identifier
        28  troff:bad-string-identifiers.groff:28: error: an escaped 'e' is not 
allowed in an identifier
        29  troff:bad-string-identifiers.groff:29: error: a horizontal motion 
is not allowed in an identifier
        30  troff:bad-string-identifiers.groff:30: error: an escaped 'k' is not 
allowed in an identifier
        31  troff:bad-string-identifiers.groff:31: error: a node is not allowed 
in an identifier
        32  troff:bad-string-identifiers.groff:32: error: a node is not allowed 
in an identifier
        33  troff:bad-string-identifiers.groff:33: error: a node is not allowed 
in an identifier
        34  troff:bad-string-identifiers.groff:34: error: a node is not allowed 
in an identifier
        35  troff:bad-string-identifiers.groff:35: error: an escaped 'p' is not 
allowed in an identifier
        36  troff:bad-string-identifiers.groff:36: error: a node is not allowed 
in an identifier
        37  troff:bad-string-identifiers.groff:37: error: a node is not allowed 
in an identifier
        38  troff:bad-string-identifiers.groff:38: error: a node is not allowed 
in an identifier
        39  troff:bad-string-identifiers.groff:39: error: a node is not allowed 
in an identifier
        40  troff:bad-string-identifiers.groff:40: error: a node is not allowed 
in an identifier
        41  troff:bad-string-identifiers.groff:41: error: a node is not allowed 
in an identifier
        42  troff:bad-string-identifiers.groff:42: error: a node is not allowed 
in an identifier
        43  troff:bad-string-identifiers.groff:43: error: a node is not allowed 
in an identifier
        44  troff:bad-string-identifiers.groff:44: error: a node is not allowed 
in an identifier
        45  troff:bad-string-identifiers.groff:45: error: a horizontal motion 
is not allowed in an identifier
        46  troff:bad-string-identifiers.groff:46: error: an escaped '~' is not 
allowed in an identifier
---
 ChangeLog                | 5 +++++
 src/roff/troff/input.cpp | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f23960c4f..489ddbf6c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-02-17  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/troff/input.cpp (do_define_string, length_request):
+       Drop redundant diagnostic message on invalid string identifiers.
+
 2024-02-16  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [pdf]: Regression-test Savannah #65320.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index b2d54a033..6735b845c 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -4386,7 +4386,7 @@ void do_define_string(define_mode mode, comp_mode comp)
   else if (tok.is_tab())
     c = '\t';
   else if (!tok.is_space()) {
-    error("bad string definition");
+    // get_name() should have thrown a particularized diagnostic
     skip_line();
     return;
   }
@@ -5094,7 +5094,7 @@ void length_request()
   else if (tok.is_tab())
     c = '\t';
   else if (!tok.is_space()) {
-    error("bad string definition");
+    // get_name() should have thrown a particularized diagnostic
     skip_line();
     return;
   }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]