Made #!eof invalid in #!r6rs mode.

This commit is contained in:
Abdulaziz Ghuloum 2007-11-25 16:23:39 -05:00
parent 86d8cd0854
commit e461f4374f
3 changed files with 21 additions and 18 deletions

View File

@ -116,23 +116,6 @@
(void)))))))) (void))))))))
(define unlink!
(lambda (h b)
(let ([vec (hasht-vec h)]
[next ($tcbucket-next b)])
;;; first remove it from its old place
(let ([idx
(if (fixnum? next)
next
(get-bucket-index next))])
(let ([fst ($vector-ref vec idx)])
(cond
[(eq? fst b)
($vector-set! vec idx next)]
[else
(replace! fst b next)])))
;;; set next to be #f, denoting, not in table
($set-tcbucket-next! b #f))))
(define (get-bucket h x) (define (get-bucket h x)
(let ([pv (pointer-value x)] (let ([pv (pointer-value x)]
@ -153,10 +136,28 @@
(and (get-bucket h x) #t)) (and (get-bucket h x) #t))
(define (del-hash h x) (define (del-hash h x)
(define unlink!
(lambda (h b)
(let ([vec (hasht-vec h)]
[next ($tcbucket-next b)])
;;; first remove it from its old place
(let ([idx
(if (fixnum? next)
next
(get-bucket-index next))])
(let ([fst ($vector-ref vec idx)])
(cond
[(eq? fst b)
($vector-set! vec idx next)]
[else
(replace! fst b next)])))
;;; set next to be #f, denoting, not in table
($set-tcbucket-next! b #f))))
(cond (cond
[(get-bucket h x) => [(get-bucket h x) =>
(lambda (b) (lambda (b)
(unlink! h b) (unlink! h b)
;;; don't forget the count.
(set-hasht-count! h (- (hasht-count h) 1)))])) (set-hasht-count! h (- (hasht-count h) 1)))]))
(define put-hash! (define put-hash!

View File

@ -357,6 +357,8 @@
(error 'tokenize "invalid eof near #!")) (error 'tokenize "invalid eof near #!"))
(case e (case e
[(#\e) [(#\e)
(when (eq? (port-mode p) 'r6rs-mode)
(error 'tokenize "invalid syntax: #!e"))
(read-char* p '(#\e) "of" "eof sequence" #f #f) (read-char* p '(#\e) "of" "eof sequence" #f #f)
(cons 'datum (eof-object))] (cons 'datum (eof-object))]
[(#\r) [(#\r)

View File

@ -1 +1 @@
1128 1129