* (ikarus reader) is ok

This commit is contained in:
Abdulaziz Ghuloum 2007-05-05 20:47:31 -04:00
parent 7aa407b6cd
commit 0721283716
3 changed files with 19 additions and 22 deletions

Binary file not shown.

View File

@ -1,7 +1,9 @@
(library (ikarus tokenizer) (library (ikarus reader)
(export) (export read read-token comment-handler load)
(import (scheme)) (import
(only (scheme) $char->fixnum $char= $char<=)
(except (ikarus) read read-token comment-handler load))
(define delimiter? (define delimiter?
(lambda (c) (lambda (c)
@ -555,13 +557,9 @@
(tokenize-hash/c c p)]))] (tokenize-hash/c c p)]))]
[else (tokenize/c c p)])))) [else (tokenize/c c p)]))))
;;;
;;;--------------------------------------------------------------* READ *---
;;;
(define read-list-rest (define read-list-rest
(lambda (p locs k end mis) (lambda (p locs k end mis)
(let ([t (read-token p)]) (let ([t (tokenize p)])
(cond (cond
[(eof-object? t) [(eof-object? t)
(error 'read "end of file encountered while reading list")] (error 'read "end of file encountered while reading list")]
@ -570,7 +568,7 @@
(error 'read "paren mismatch")] (error 'read "paren mismatch")]
[(eq? t 'dot) [(eq? t 'dot)
(let-values ([(d locs k) (read-expr p locs k)]) (let-values ([(d locs k) (read-expr p locs k)])
(let ([t (read-token p)]) (let ([t (tokenize p)])
(cond (cond
[(eq? t end) (values d locs k)] [(eq? t end) (values d locs k)]
[(eq? t mis) [(eq? t mis)
@ -592,7 +590,7 @@
k)))))])))) k)))))]))))
(define read-list-init (define read-list-init
(lambda (p locs k end mis) (lambda (p locs k end mis)
(let ([t (read-token p)]) (let ([t (tokenize p)])
(cond (cond
[(eof-object? t) [(eof-object? t)
(error 'read "end of file encountered while reading list")] (error 'read "end of file encountered while reading list")]
@ -638,7 +636,7 @@
(fxsub1 i) (cdr ls)))]))) (fxsub1 i) (cdr ls)))])))
(define read-vector (define read-vector
(lambda (p locs k count ls) (lambda (p locs k count ls)
(let ([t (read-token p)]) (let ([t (tokenize p)])
(cond (cond
[(eof-object? t) [(eof-object? t)
(error 'read "end of file encountered while reading a vector")] (error 'read "end of file encountered while reading a vector")]
@ -711,7 +709,7 @@
(define read-expr (define read-expr
(lambda (p locs k) (lambda (p locs k)
(parse-token p locs k (read-token p)))) (parse-token p locs k (tokenize p))))
(define read-expr-initial (define read-expr-initial
(lambda (p locs k) (lambda (p locs k)
@ -763,32 +761,31 @@
(loc-value expr) (loc-value expr)
expr)])))) expr)]))))
(define read-token
;;;
;;;--------------------------------------------------------------* INIT *---
;;;
(primitive-set! 'read-token
(case-lambda (case-lambda
[() (tokenize (current-input-port))] [() (tokenize (current-input-port))]
[(p) [(p)
(if (input-port? p) (if (input-port? p)
(tokenize p) (tokenize p)
(error 'read-token "~s is not an input port" p))])) (error 'read-token "~s is not an input port" p))]))
(primitive-set! 'read
(define read
(case-lambda (case-lambda
[() (my-read (current-input-port))] [() (my-read (current-input-port))]
[(p) [(p)
(if (input-port? p) (if (input-port? p)
(my-read p) (my-read p)
(error 'read "~s is not an input port" p))])) (error 'read "~s is not an input port" p))]))
(primitive-set! 'comment-handler
(define comment-handler
(make-parameter (make-parameter
(lambda (x) (void)) (lambda (x) (void))
(lambda (x) (lambda (x)
(unless (procedure? x) (unless (procedure? x)
(error 'comment-handler "~s is not a procedure" x)) (error 'comment-handler "~s is not a procedure" x))
x))) x)))
(let ()
(module (load)
(define load-handler (define load-handler
(lambda (x) (lambda (x)
(eval-top-level x))) (eval-top-level x)))
@ -798,7 +795,7 @@
(unless (eof-object? x) (unless (eof-object? x)
(eval-proc x) (eval-proc x)
(read-and-eval p eval-proc))))) (read-and-eval p eval-proc)))))
(primitive-set! 'load (define load
(case-lambda (case-lambda
[(x) (load x load-handler)] [(x) (load x load-handler)]
[(x eval-proc) [(x eval-proc)

View File

@ -50,8 +50,8 @@
"ikarus.io.output-strings.ss" "ikarus.io.output-strings.ss"
"ikarus.hash-tables.ss" "ikarus.hash-tables.ss"
"ikarus.writer.ss" "ikarus.writer.ss"
"ikarus.reader.ss"
"libtokenizer.ss"
"libassembler.ss" "libassembler.ss"
"libintelasm.ss" "libintelasm.ss"
"libfasl.ss" "libfasl.ss"