comparison man/lispref/objects.texi @ 5247:02d875ebd1ea

Make Lisp reader errors more informative with over-long hex, octal characters src/ChangeLog addition: 2010-08-21 Aidan Kehoe <kehoea@parhasard.net> * lread.c (read_escape): Make error messages better reflect the text that was encountered, when overlong hex character escapes or non-Latin-1 octal character escapes are encountered. man/ChangeLog addition: 2010-08-21 Aidan Kehoe <kehoea@parhasard.net> * lispref/objects.texi (Character Type): Go into more detail here on the specific type of error provoked on overlong hex character escapes and non-Latin-1 octal character escapes; give details of why the latter may be encountered, and what to do with such code.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 21 Aug 2010 19:02:44 +0100
parents 755ae5b97edb
children f5a5501814f5
comparison
equal deleted inserted replaced
5244:04811a268716 5247:02d875ebd1ea
621 @cindex question mark in character constant 621 @cindex question mark in character constant
622 @cindex @samp{\} in character constant 622 @cindex @samp{\} in character constant
623 @cindex backslash in character constant 623 @cindex backslash in character constant
624 @cindex octal character code 624 @cindex octal character code
625 @cindex hexadecimal character code 625 @cindex hexadecimal character code
626 @cindex Overlong hex character escape
627 @cindex Non-ISO-8859-1 octal character escape
626 628
627 Finally, there are two read syntaxes involving character codes. 629 Finally, there are two read syntaxes involving character codes.
628 It is not possible to represent multibyte or wide characters in this 630 It is not possible to represent multibyte or wide characters in this
629 way; the permissible range of codes is from 0 to 255 (@emph{i.e.}, 631 way; the permissible range of codes is from 0 to 255 (@emph{i.e.},
630 @samp{0377} octal or @samp{0xFF} hexadecimal). If you wish to convert 632 @samp{0377} octal or @samp{0xFF} hexadecimal). If you wish to convert
641 followed by a backslash and the character code in octal (up to three 643 followed by a backslash and the character code in octal (up to three
642 octal digits); thus, @samp{?\101} for the character @kbd{A}, 644 octal digits); thus, @samp{?\101} for the character @kbd{A},
643 @samp{?\001} for the character @kbd{C-a}, and @code{?\002} for the 645 @samp{?\001} for the character @kbd{C-a}, and @code{?\002} for the
644 character @kbd{C-b}. The reader will finalize the character and start 646 character @kbd{C-b}. The reader will finalize the character and start
645 reading the next token when a non-octal-digit is encountered or three 647 reading the next token when a non-octal-digit is encountered or three
646 octal digits are read. 648 octal digits are read. When a given character code is above
649 @code{#o377}, the Lisp reader signals an @code{invalid-read-syntax}
650 error. Such errors are typically provoked by code written for older
651 versions of GNU Emacs, where the absence of the #o octal syntax for
652 integers made the character syntax convenient for non-character
653 values. Those older versions of GNU Emacs are long obsolete, so
654 changing the code to use the #o integer escape is the best
655 solution. @pxref{Numbers}.
647 656
648 The second consists of a question mark followed by a backslash, the 657 The second consists of a question mark followed by a backslash, the
649 character @samp{x}, and the character code in hexadecimal (up to two 658 character @samp{x}, and the character code in hexadecimal (up to two
650 hexadecimal digits); thus, @samp{?\x41} for the character @kbd{A}, 659 hexadecimal digits); thus, @samp{?\x41} for the character @kbd{A},
651 @samp{?\x1} for the character @kbd{C-a}, and @code{?\x2} for the 660 @samp{?\x1} for the character @kbd{C-a}, and @code{?\x2} for the
652 character @kbd{C-b}. If more than two hexadecimal codes are given, the 661 character @kbd{C-b}. If more than two hexadecimal codes are given, the
653 reader signals an error. 662 reader signals an @code{invalid-read-syntax} error.
654 663
655 @example 664 @example
656 @group 665 @group
657 ;; @r{Under XEmacs 20:} 666 ;; @r{Under XEmacs 20:}
658 ?\012 @result{} ?\n ?\n @result{} ?\n ?\C-j @result{} ?\n 667 ?\012 @result{} ?\n ?\n @result{} ?\n ?\C-j @result{} ?\n