X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Freadtable.lisp;h=615bc984a37f497b68f5f51291a76687c9ac7247;hb=ad3beba970fab6e451a461c9f9b14faf4ef17718;hp=3764b16bf4196cdb16350fe7e259241e30d0f2ea;hpb=8731c1a7c1a585d190151fa881050fb5e14c0616;p=sbcl.git diff --git a/src/code/readtable.lisp b/src/code/readtable.lisp index 3764b16..615bc98 100644 --- a/src/code/readtable.lisp +++ b/src/code/readtable.lisp @@ -12,23 +12,37 @@ (in-package "SB!IMPL") (sb!xc:deftype attribute-table () - '(simple-array (unsigned-byte 8) (#.sb!xc:char-code-limit))) + '(simple-array (unsigned-byte 8) (#.base-char-code-limit))) ;;; constants for readtable character attributes. These are all as in ;;; the manual. +;;; +;;; FIXME: wait a minute. Firstly, I doubt they're in the manual. +;;; Secondly, the numerical order of these constants is coupled with +;;; code in CHAR-CLASS{,2,3} in the reader implementation, so beware +;;; when changing them. (def!constant +char-attr-whitespace+ 0) (def!constant +char-attr-terminating-macro+ 1) -(def!constant +char-attr-escape+ 2) -(def!constant +char-attr-constituent+ 3) -(def!constant +char-attr-constituent-dot+ 4) -(def!constant +char-attr-constituent-expt+ 5) -(def!constant +char-attr-constituent-slash+ 6) -(def!constant +char-attr-constituent-digit+ 7) -(def!constant +char-attr-constituent-sign+ 8) -;; the "9" entry intentionally left blank for some reason -- WHN 19990806 -(def!constant +char-attr-multiple-escape+ 10) -(def!constant +char-attr-package-delimiter+ 11) -(def!constant +char-attr-delimiter+ 12) ; (a fake for READ-UNQUALIFIED-TOKEN) +(def!constant +char-attr-single-escape+ 2) +(def!constant +char-attr-multiple-escape+ 3) +(def!constant +char-attr-constituent+ 4) +(def!constant +char-attr-constituent-dot+ 5) +(def!constant +char-attr-constituent-expt+ 6) +(def!constant +char-attr-constituent-slash+ 7) +(def!constant +char-attr-constituent-digit+ 8) +(def!constant +char-attr-constituent-sign+ 9) +;;; the following two are not static but depend on *READ-BASE*. +;;; DECIMAL-DIGIT is for characters being digits in base 10 but not in +;;; base *READ-BASE* (which is therefore perforce smaller than 10); +;;; DIGIT-OR-EXPT is for characters being both exponent markers and +;;; digits in base *READ-BASE* (which is therefore perforce larger +;;; than 10). -- CSR, 2004-03-16 +(def!constant +char-attr-constituent-decimal-digit+ 10) +(def!constant +char-attr-constituent-digit-or-expt+ 11) + +(def!constant +char-attr-package-delimiter+ 12) +(def!constant +char-attr-invalid+ 13) +(def!constant +char-attr-delimiter+ 14) ; (a fake for READ-UNQUALIFIED-TOKEN) (sb!xc:defstruct (readtable (:conc-name nil) (:predicate readtablep) @@ -50,20 +64,22 @@ ;; In order to make READ-TOKEN fast, all this information is stored ;; in the character attribute table by having different varieties of ;; constituents. - (character-attribute-table - (make-array sb!xc:char-code-limit + (character-attribute-array + (make-array base-char-code-limit :element-type '(unsigned-byte 8) :initial-element +char-attr-constituent+) :type attribute-table) + (character-attribute-hash-table (make-hash-table) :type hash-table) ;; The CHARACTER-MACRO-TABLE is a vector of CHAR-CODE-LIMIT ;; functions. One of these functions called with appropriate ;; arguments whenever any non-WHITESPACE character is encountered ;; inside READ-PRESERVING-WHITESPACE. These functions are used to ;; implement user-defined read-macros, system read-macros, and the ;; number-symbol reader. - (character-macro-table - (make-array sb!xc:char-code-limit :initial-element #'undefined-macro-char) - :type (simple-vector #.sb!xc:char-code-limit)) + (character-macro-array + (make-array base-char-code-limit :initial-element #'undefined-macro-char) + :type (simple-vector #.base-char-code-limit)) + (character-macro-hash-table (make-hash-table) :type hash-table) ;; an alist from dispatch characters to vectors of CHAR-CODE-LIMIT ;; functions, for use in defining dispatching macros (like #-macro) (dispatch-tables () :type list)