<32252@debbugs.gnu.org>. Because '%o' and '%x' can now format signed
integers, they now support the '+' and space flags.
-** To avoid confusion caused by "smart quotes", the reader signals an
-error when reading Lisp symbols which begin with one of the following
-quotation characters: ‘’‛“”‟〞"'. A symbol beginning with such a
-character can be written by escaping the quotation character with a
-backslash. For example:
-
- (read "‘smart") => (invalid-read-syntax "strange quote" "‘")
- (read "\\‘smart") == (intern "‘smart")
-
+++
** Omitting variables after '&optional' and '&rest' is now allowed.
For example '(defun foo (&optional))' is no longer an error. This is
return XFIXNUM (category) == UNICODE_CATEGORY_Zs; /* separator, space */
}
-
-/* Return true for characters that would read as symbol characters,
- but graphically may be confused with some kind of punctuation. We
- require an escaping backslash, when such characters begin a
- symbol. */
-bool
-confusable_symbol_character_p (int ch)
-{
- switch (ch)
- {
- case 0x2018: /* LEFT SINGLE QUOTATION MARK */
- case 0x2019: /* RIGHT SINGLE QUOTATION MARK */
- case 0x201B: /* SINGLE HIGH-REVERSED-9 QUOTATION MARK */
- case 0x201C: /* LEFT DOUBLE QUOTATION MARK */
- case 0x201D: /* RIGHT DOUBLE QUOTATION MARK */
- case 0x201F: /* DOUBLE HIGH-REVERSED-9 QUOTATION MARK */
- case 0x301E: /* DOUBLE PRIME QUOTATION MARK */
- case 0xFF02: /* FULLWIDTH QUOTATION MARK */
- case 0xFF07: /* FULLWIDTH APOSTROPHE */
- return true;
-
- default:
- return false;
- }
-}
-
/* hexdigit[C] is one greater than C's numeric value if C is a
hexadecimal digit, zero otherwise. */
signed char const hexdigit[UCHAR_MAX + 1] =
extern bool printablep (int);
extern bool blankp (int);
-extern bool confusable_symbol_character_p (int ch);
-
/* Return a translation table of id number ID. */
#define GET_TRANSLATION_TABLE(id) \
(XCDR (XVECTOR (Vtranslation_table_vector)->contents[(id)]))
if (! NILP (result) && len == nbytes)
return unbind_to (count, result);
}
- if (!quoted && multibyte)
- {
- int ch = STRING_CHAR ((unsigned char *) read_buffer);
- if (confusable_symbol_character_p (ch))
- xsignal2 (Qinvalid_read_syntax, build_string ("strange quote"),
- CALLN (Fstring, make_fixnum (ch)));
- }
{
Lisp_Object result;
ptrdiff_t nchars
|| c == ',' || c == '.' || c == '`'
|| c == '[' || c == ']' || c == '?' || c <= 040
|| c == NO_BREAK_SPACE
- || confusing
- || (i == 1 && confusable_symbol_character_p (c)))
+ || confusing)
{
printchar ('\\', printcharfun);
confusing = false;
"`?\\\"', `?\\(', `?\\)', `?\\;', `?\\[', `?\\]' "
"expected!")))))
-(ert-deftest lread-tests--funny-quote-symbols ()
- "Check that `smart quotes' or similar trigger errors in symbol names."
- (dolist (quote-char
- '(#x2018 ;; LEFT SINGLE QUOTATION MARK
- #x2019 ;; RIGHT SINGLE QUOTATION MARK
- #x201B ;; SINGLE HIGH-REVERSED-9 QUOTATION MARK
- #x201C ;; LEFT DOUBLE QUOTATION MARK
- #x201D ;; RIGHT DOUBLE QUOTATION MARK
- #x201F ;; DOUBLE HIGH-REVERSED-9 QUOTATION MARK
- #x301E ;; DOUBLE PRIME QUOTATION MARK
- #xFF02 ;; FULLWIDTH QUOTATION MARK
- #xFF07 ;; FULLWIDTH APOSTROPHE
- ))
- (let ((str (format "%cfoo" quote-char)))
- (should-error (read str) :type 'invalid-read-syntax)
- (should (eq (read (concat "\\" str)) (intern str))))))
-
(ert-deftest lread-test-bug26837 ()
"Test for https://debbugs.gnu.org/26837 ."
(let ((load-path (cons