guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 04/10: read: Use "invalid" rather than "illegal".


From: Ludovic Courtès
Subject: [Guile-commits] 04/10: read: Use "invalid" rather than "illegal".
Date: Wed, 17 Jun 2020 18:32:11 -0400 (EDT)

civodul pushed a commit to branch master
in repository guile.

commit 52809cc63031d4b83323aa9e3dcb780f02849484
Author: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
AuthorDate: Thu Jun 4 21:26:23 2020 +0200

    read: Use "invalid" rather than "illegal".
    
    * libguile/read.c (scm_read_string_like_syntax): All characters are
    permitted by law; some aren't valid in certain contexts.
    * test-suite/tests/reader.test: Replace occurrences of "illegal" by
    "invalid".
    * test-suite/tests/strings.test: Likewise.
    
    Co-authored-by: Ludovic Courtès <ludo@gnu.org>
---
 libguile/read.c               |  2 +-
 test-suite/tests/reader.test  | 20 ++++++++++----------
 test-suite/tests/strings.test | 18 +++++++++---------
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/libguile/read.c b/libguile/read.c
index 040a178..122a643 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -704,7 +704,7 @@ scm_read_string_like_syntax (int chr, SCM port, 
scm_t_read_opts *opts)
                 break;
             bad_escaped:
               scm_i_input_error (FUNC_NAME, port,
-                                 "illegal character in escape sequence: ~S",
+                                 "invalid character in escape sequence: ~S",
                                  scm_list_1 (SCM_MAKE_CHAR (c)));
             }
         }
diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test
index a931f04..ef11a4a 100644
--- a/test-suite/tests/reader.test
+++ b/test-suite/tests/reader.test
@@ -1,6 +1,6 @@
 ;;;; reader.test --- Reader test.    -*- coding: iso-8859-1; mode: scheme -*-
 ;;;;
-;;;; Copyright (C) 1999, 2001-2003, 2007-2011, 2013-2015
+;;;; Copyright (C) 1999, 2001-2003, 2007-2011, 2013-2015, 2020
 ;;;;   Free Software Foundation, Inc.
 ;;;;
 ;;;; Jim Blandy <jimb@red-bean.com>
@@ -40,8 +40,8 @@
   (cons 'read-error "end of file in string constant$"))
 (define exception:eof-in-symbol
   (cons 'read-error "end of file while reading symbol$"))
-(define exception:illegal-escape
-  (cons 'read-error "illegal character in escape sequence: .*$"))
+(define exception:invalid-escape
+  (cons 'read-error "invalid character in escape sequence: .*$"))
 (define exception:missing-expression
   (cons 'read-error "no expression after #;"))
 (define exception:mismatched-paren
@@ -234,8 +234,8 @@
   (pass-if-exception "eof in string"
     exception:eof-in-string
     (read-string "\"the string that never ends"))
-  (pass-if-exception "illegal escape in string"
-    exception:illegal-escape
+  (pass-if-exception "invalid escape in string"
+    exception:invalid-escape
     (read-string "\"some string \\???\"")))
 
 
@@ -304,31 +304,31 @@
 
   (with-test-prefix "r6rs-hex-escapes"
       (pass-if-exception "non-hex char in two-digit hex-escape"
-      exception:illegal-escape
+      exception:invalid-escape
       (with-read-options '(r6rs-hex-escapes)
         (lambda ()
           (with-input-from-string "\"\\x0g;\"" read))))
 
     (pass-if-exception "non-hex char in four-digit hex-escape"
-      exception:illegal-escape
+      exception:invalid-escape
       (with-read-options '(r6rs-hex-escapes)
         (lambda ()
           (with-input-from-string "\"\\x000g;\"" read))))
 
     (pass-if-exception "non-hex char in six-digit hex-escape"
-      exception:illegal-escape
+      exception:invalid-escape
       (with-read-options '(r6rs-hex-escapes)
         (lambda ()
           (with-input-from-string "\"\\x00000g;\"" read))))
 
     (pass-if-exception "no semicolon at termination of one-digit hex-escape"
-      exception:illegal-escape
+      exception:invalid-escape
       (with-read-options '(r6rs-hex-escapes)
         (lambda ()
           (with-input-from-string "\"\\x0\"" read))))
 
     (pass-if-exception "no semicolon at termination of three-digit hex-escape"
-      exception:illegal-escape
+      exception:invalid-escape
       (with-read-options '(r6rs-hex-escapes)
         (lambda ()
           (with-input-from-string "\"\\x000\"" read))))
diff --git a/test-suite/tests/strings.test b/test-suite/tests/strings.test
index 52b3dd0..7393bc8 100644
--- a/test-suite/tests/strings.test
+++ b/test-suite/tests/strings.test
@@ -1,7 +1,7 @@
 ;;;; strings.test --- test suite for Guile's string functions    -*- scheme -*-
 ;;;; Jim Blandy <jimb@red-bean.com> --- August 1999
 ;;;;
-;;;; Copyright (C) 1999,2001,2004-2006,2008-2011,2013,2015,2018
+;;;; Copyright (C) 1999,2001,2004-2006,2008-2011,2013,2015,2018,2020
 ;;;;   Free Software Foundation, Inc.
 ;;;;
 ;;;; This library is free software; you can redistribute it and/or
@@ -25,8 +25,8 @@
 
 (define exception:read-only-string
   (cons 'misc-error "^string is read-only"))
-(define exception:illegal-escape
-  (cons 'read-error "illegal character in escape sequence"))
+(define exception:invalid-escape
+  (cons 'read-error "invalid character in escape sequence"))
 
 ;; Create a string from integer char values, eg. (string-ints 65) => "A"
 (define (string-ints . args)
@@ -197,27 +197,27 @@
 (with-test-prefix "escapes"
 
   (pass-if-exception "non-hex char in two-digit hex-escape"
-    exception:illegal-escape                     
+    exception:invalid-escape                     
     (with-input-from-string "\"\\x0g\"" read))
 
   (pass-if-exception "non-hex char in four-digit hex-escape"
-    exception:illegal-escape                     
+    exception:invalid-escape                     
     (with-input-from-string "\"\\u000g\"" read))
 
   (pass-if-exception "non-hex char in six-digit hex-escape"
-    exception:illegal-escape                     
+    exception:invalid-escape                     
     (with-input-from-string "\"\\U00000g\"" read))
 
   (pass-if-exception "premature termination of two-digit hex-escape"
-    exception:illegal-escape                     
+    exception:invalid-escape                     
     (with-input-from-string "\"\\x0\"" read))
 
   (pass-if-exception "premature termination of four-digit hex-escape"
-    exception:illegal-escape                     
+    exception:invalid-escape                     
     (with-input-from-string "\"\\u000\"" read))
 
   (pass-if-exception "premature termination of six-digit hex-escape"
-    exception:illegal-escape                     
+    exception:invalid-escape                     
     (with-input-from-string "\"\\U00000\"" read))
 
   (pass-if "extra hex digits ignored for two-digit hex escape"



reply via email to

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