Higher-level handler for parse2

This commit is contained in:
Justin Ethier 2017-08-16 11:04:52 +00:00
parent 94f15d699e
commit 4b7386dedf

View file

@ -702,7 +702,7 @@
" return_closcall1(data, k, equalp( opaque_ptr(opq), obj ));") " return_closcall1(data, k, equalp( opaque_ptr(opq), obj ));")
(write (write
(parse2 (open-input-file "test.scm"))) (call-parse2 (open-input-file "test.scm")))
;(read-token (open-input-file "test.scm"))) ;(read-token (open-input-file "test.scm")))
;TODO: getting there, but still not parsed correctly: ;TODO: getting there, but still not parsed correctly:
@ -735,6 +735,12 @@
))) )))
(define (call-parse2 fp)
(let ((result (parse2 fp)))
(if (Cyc-opaque? result)
(error "unexpected closing parenthesis")
result)))
(define (parse2 fp) (define (parse2 fp)
(let ((token (read-token fp))) ;; TODO: this will be a C call (let ((token (read-token fp))) ;; TODO: this will be a C call
;(write `(token ,token)) ;(write `(token ,token))