mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-09 22:17:33 +02:00
Handle dotted lists
This commit is contained in:
parent
9226403da9
commit
2d5aa2c3b1
1 changed files with 13 additions and 10 deletions
23
read.scm
23
read.scm
|
@ -672,15 +672,6 @@
|
|||
(parse fp '() '() #f #f 0 (reg-port fp)))))
|
||||
|
||||
|
||||
(define-c reading-from-file?
|
||||
"(void *data, int argc, closure _, object k, object port)"
|
||||
" object result = boolean_f;
|
||||
Cyc_check_port(data, port);
|
||||
if (((port_type *)port)->flags == 1) {
|
||||
result = boolean_t;
|
||||
}
|
||||
return_closcall1(data, k, result);")
|
||||
|
||||
; ;; Test code
|
||||
; ;(let ((fp (open-input-file "tests/begin.scm")))
|
||||
; ;(let ((fp (open-input-file "tests/strings.scm")))
|
||||
|
@ -693,6 +684,15 @@
|
|||
; (repl))
|
||||
;(repl)
|
||||
|
||||
(define-c reading-from-file?
|
||||
"(void *data, int argc, closure _, object k, object port)"
|
||||
" object result = boolean_f;
|
||||
Cyc_check_port(data, port);
|
||||
if (((port_type *)port)->flags == 1) {
|
||||
result = boolean_t;
|
||||
}
|
||||
return_closcall1(data, k, result);")
|
||||
|
||||
(define-c read-token
|
||||
"(void *data, int argc, closure _, object k, object port)"
|
||||
" Cyc_io_read_token(data, k, port);")
|
||||
|
@ -762,7 +762,10 @@
|
|||
((eof-object? t)
|
||||
(error "missing closing parenthesis"))
|
||||
((Cyc-opaque-eq? t #\))
|
||||
(reverse lis))
|
||||
(if (and (> (length lis) 2)
|
||||
(equal? (cadr lis) (string->symbol ".")))
|
||||
(->dotted-list (reverse lis))
|
||||
(reverse lis)))
|
||||
(else
|
||||
(loop (cons t lis) (parse2 fp))))))
|
||||
((Cyc-opaque-unsafe-eq? token #\')
|
||||
|
|
Loading…
Add table
Reference in a new issue