summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan (janneke) Nieuwenhuizen <janneke@gnu.org>2020-06-04 21:26:23 +0200
committerLudovic Courtès <ludo@gnu.org>2020-06-18 00:30:11 +0200
commit52809cc63031d4b83323aa9e3dcb780f02849484 (patch)
tree570c6ee8ff99081f07ba899c347bb35430ff8ebc
parenta15acbb828dd2e75b35bbc76d48858b230591639 (diff)
downloadguile-52809cc63031d4b83323aa9e3dcb780f02849484.tar.gz
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>
-rw-r--r--libguile/read.c2
-rw-r--r--test-suite/tests/reader.test20
-rw-r--r--test-suite/tests/strings.test18
3 files changed, 20 insertions, 20 deletions
diff --git a/libguile/read.c b/libguile/read.c
index 040a17834..122a64301 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 a931f0416..ef11a4abd 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 52b3dd034..7393bc8ec 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"