mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-30 06:50:31 +02:00
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>
This commit is contained in:
parent
a15acbb828
commit
52809cc630
3 changed files with 20 additions and 20 deletions
|
@ -704,7 +704,7 @@ scm_read_string_like_syntax (int chr, SCM port, scm_t_read_opts *opts)
|
||||||
break;
|
break;
|
||||||
bad_escaped:
|
bad_escaped:
|
||||||
scm_i_input_error (FUNC_NAME, port,
|
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)));
|
scm_list_1 (SCM_MAKE_CHAR (c)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;;;; reader.test --- Reader test. -*- coding: iso-8859-1; mode: scheme -*-
|
;;;; 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.
|
;;;; Free Software Foundation, Inc.
|
||||||
;;;;
|
;;;;
|
||||||
;;;; Jim Blandy <jimb@red-bean.com>
|
;;;; Jim Blandy <jimb@red-bean.com>
|
||||||
|
@ -40,8 +40,8 @@
|
||||||
(cons 'read-error "end of file in string constant$"))
|
(cons 'read-error "end of file in string constant$"))
|
||||||
(define exception:eof-in-symbol
|
(define exception:eof-in-symbol
|
||||||
(cons 'read-error "end of file while reading symbol$"))
|
(cons 'read-error "end of file while reading symbol$"))
|
||||||
(define exception:illegal-escape
|
(define exception:invalid-escape
|
||||||
(cons 'read-error "illegal character in escape sequence: .*$"))
|
(cons 'read-error "invalid character in escape sequence: .*$"))
|
||||||
(define exception:missing-expression
|
(define exception:missing-expression
|
||||||
(cons 'read-error "no expression after #;"))
|
(cons 'read-error "no expression after #;"))
|
||||||
(define exception:mismatched-paren
|
(define exception:mismatched-paren
|
||||||
|
@ -234,8 +234,8 @@
|
||||||
(pass-if-exception "eof in string"
|
(pass-if-exception "eof in string"
|
||||||
exception:eof-in-string
|
exception:eof-in-string
|
||||||
(read-string "\"the string that never ends"))
|
(read-string "\"the string that never ends"))
|
||||||
(pass-if-exception "illegal escape in string"
|
(pass-if-exception "invalid escape in string"
|
||||||
exception:illegal-escape
|
exception:invalid-escape
|
||||||
(read-string "\"some string \\???\"")))
|
(read-string "\"some string \\???\"")))
|
||||||
|
|
||||||
|
|
||||||
|
@ -304,31 +304,31 @@
|
||||||
|
|
||||||
(with-test-prefix "r6rs-hex-escapes"
|
(with-test-prefix "r6rs-hex-escapes"
|
||||||
(pass-if-exception "non-hex char in two-digit hex-escape"
|
(pass-if-exception "non-hex char in two-digit hex-escape"
|
||||||
exception:illegal-escape
|
exception:invalid-escape
|
||||||
(with-read-options '(r6rs-hex-escapes)
|
(with-read-options '(r6rs-hex-escapes)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(with-input-from-string "\"\\x0g;\"" read))))
|
(with-input-from-string "\"\\x0g;\"" read))))
|
||||||
|
|
||||||
(pass-if-exception "non-hex char in four-digit hex-escape"
|
(pass-if-exception "non-hex char in four-digit hex-escape"
|
||||||
exception:illegal-escape
|
exception:invalid-escape
|
||||||
(with-read-options '(r6rs-hex-escapes)
|
(with-read-options '(r6rs-hex-escapes)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(with-input-from-string "\"\\x000g;\"" read))))
|
(with-input-from-string "\"\\x000g;\"" read))))
|
||||||
|
|
||||||
(pass-if-exception "non-hex char in six-digit hex-escape"
|
(pass-if-exception "non-hex char in six-digit hex-escape"
|
||||||
exception:illegal-escape
|
exception:invalid-escape
|
||||||
(with-read-options '(r6rs-hex-escapes)
|
(with-read-options '(r6rs-hex-escapes)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(with-input-from-string "\"\\x00000g;\"" read))))
|
(with-input-from-string "\"\\x00000g;\"" read))))
|
||||||
|
|
||||||
(pass-if-exception "no semicolon at termination of one-digit hex-escape"
|
(pass-if-exception "no semicolon at termination of one-digit hex-escape"
|
||||||
exception:illegal-escape
|
exception:invalid-escape
|
||||||
(with-read-options '(r6rs-hex-escapes)
|
(with-read-options '(r6rs-hex-escapes)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(with-input-from-string "\"\\x0\"" read))))
|
(with-input-from-string "\"\\x0\"" read))))
|
||||||
|
|
||||||
(pass-if-exception "no semicolon at termination of three-digit hex-escape"
|
(pass-if-exception "no semicolon at termination of three-digit hex-escape"
|
||||||
exception:illegal-escape
|
exception:invalid-escape
|
||||||
(with-read-options '(r6rs-hex-escapes)
|
(with-read-options '(r6rs-hex-escapes)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(with-input-from-string "\"\\x000\"" read))))
|
(with-input-from-string "\"\\x000\"" read))))
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
;;;; strings.test --- test suite for Guile's string functions -*- scheme -*-
|
;;;; strings.test --- test suite for Guile's string functions -*- scheme -*-
|
||||||
;;;; Jim Blandy <jimb@red-bean.com> --- August 1999
|
;;;; 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.
|
;;;; Free Software Foundation, Inc.
|
||||||
;;;;
|
;;;;
|
||||||
;;;; This library is free software; you can redistribute it and/or
|
;;;; This library is free software; you can redistribute it and/or
|
||||||
|
@ -25,8 +25,8 @@
|
||||||
|
|
||||||
(define exception:read-only-string
|
(define exception:read-only-string
|
||||||
(cons 'misc-error "^string is read-only"))
|
(cons 'misc-error "^string is read-only"))
|
||||||
(define exception:illegal-escape
|
(define exception:invalid-escape
|
||||||
(cons 'read-error "illegal character in escape sequence"))
|
(cons 'read-error "invalid character in escape sequence"))
|
||||||
|
|
||||||
;; Create a string from integer char values, eg. (string-ints 65) => "A"
|
;; Create a string from integer char values, eg. (string-ints 65) => "A"
|
||||||
(define (string-ints . args)
|
(define (string-ints . args)
|
||||||
|
@ -197,27 +197,27 @@
|
||||||
(with-test-prefix "escapes"
|
(with-test-prefix "escapes"
|
||||||
|
|
||||||
(pass-if-exception "non-hex char in two-digit hex-escape"
|
(pass-if-exception "non-hex char in two-digit hex-escape"
|
||||||
exception:illegal-escape
|
exception:invalid-escape
|
||||||
(with-input-from-string "\"\\x0g\"" read))
|
(with-input-from-string "\"\\x0g\"" read))
|
||||||
|
|
||||||
(pass-if-exception "non-hex char in four-digit hex-escape"
|
(pass-if-exception "non-hex char in four-digit hex-escape"
|
||||||
exception:illegal-escape
|
exception:invalid-escape
|
||||||
(with-input-from-string "\"\\u000g\"" read))
|
(with-input-from-string "\"\\u000g\"" read))
|
||||||
|
|
||||||
(pass-if-exception "non-hex char in six-digit hex-escape"
|
(pass-if-exception "non-hex char in six-digit hex-escape"
|
||||||
exception:illegal-escape
|
exception:invalid-escape
|
||||||
(with-input-from-string "\"\\U00000g\"" read))
|
(with-input-from-string "\"\\U00000g\"" read))
|
||||||
|
|
||||||
(pass-if-exception "premature termination of two-digit hex-escape"
|
(pass-if-exception "premature termination of two-digit hex-escape"
|
||||||
exception:illegal-escape
|
exception:invalid-escape
|
||||||
(with-input-from-string "\"\\x0\"" read))
|
(with-input-from-string "\"\\x0\"" read))
|
||||||
|
|
||||||
(pass-if-exception "premature termination of four-digit hex-escape"
|
(pass-if-exception "premature termination of four-digit hex-escape"
|
||||||
exception:illegal-escape
|
exception:invalid-escape
|
||||||
(with-input-from-string "\"\\u000\"" read))
|
(with-input-from-string "\"\\u000\"" read))
|
||||||
|
|
||||||
(pass-if-exception "premature termination of six-digit hex-escape"
|
(pass-if-exception "premature termination of six-digit hex-escape"
|
||||||
exception:illegal-escape
|
exception:invalid-escape
|
||||||
(with-input-from-string "\"\\U00000\"" read))
|
(with-input-from-string "\"\\U00000\"" read))
|
||||||
|
|
||||||
(pass-if "extra hex digits ignored for two-digit hex escape"
|
(pass-if "extra hex digits ignored for two-digit hex escape"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue