tokenize recognizes #@ as a fasl header and calls $fasl-read (in

libfasl.ss).
This commit is contained in:
Abdulaziz Ghuloum 2006-12-26 06:21:07 +03:00
parent 903023592d
commit 4fa2bdf0d9
4 changed files with 21 additions and 0 deletions

Binary file not shown.

View File

@ -226,3 +226,21 @@
(error 'fasl-write "~s is not an output port" port)) (error 'fasl-write "~s is not an output port" port))
(do-fasl-write x port)]))) (do-fasl-write x port)])))
(let ()
(define who 'fasl-read)
(define (assert-eq? x y)
(unless (eq? x y)
(error who "Expected ~s, got ~s\n" y x)))
(define (do-read p)
(let ([h (read-char p)])
(case h
[else
(error who "Unexpected ~s as a fasl object header" h)])))
(primitive-set! '$fasl-read
(lambda (p)
(assert-eq? (read-char p) #\I)
(assert-eq? (read-char p) #\K)
(assert-eq? (read-char p) #\0)
(assert-eq? (read-char p) #\1)
(do-read p))))

View File

@ -405,6 +405,8 @@
[else [else
(error 'tokenize (error 'tokenize
"invalid char ~a inside gensym" c)])))]))] "invalid char ~a inside gensym" c)])))]))]
[($char= #\@ c)
(cons 'datum ($fasl-read p))]
[else [else
(unread-char c p) (unread-char c p)
(error 'tokenize "invalid syntax #~a" c)]))) (error 'tokenize "invalid syntax #~a" c)])))

View File

@ -115,6 +115,7 @@
trace-symbol! untrace-symbol! make-traced-procedure trace-symbol! untrace-symbol! make-traced-procedure
fixnum->string fixnum->string
$interrupted? $unset-interrupted! $do-event $interrupted? $unset-interrupted! $do-event
$fasl-read
;;; TODO: must open-code ;;; TODO: must open-code
$make-port/input $make-port/output $make-port/both $make-port/input $make-port/output $make-port/both