WIP towards unquote-splicing

This commit is contained in:
Justin Ethier 2015-05-29 01:39:26 -04:00
parent 0259ee0429
commit 49d6bc3213
2 changed files with 14 additions and 6 deletions

View file

@ -240,12 +240,18 @@
; back to the buffer
;; Read the next expression and wrap it in a quote
(let ((sub (parse fp '() '() #f #f #f 0 ptbl)))
(define new-toks
(add-tok
(list 'unquote sub)
(get-toks tok toks quotes)
quotes))
(letrec ((sub (parse fp '() '() #f #f #f 0 ptbl))
(next-c (read-char fp))
(unquote-sym (if (equal? next-c #\@) 'unquote-splicing 'unquote))
(new-toks
(add-tok
(list unquote-sym sub)
(get-toks tok toks quotes)
quotes)))
;; Buffer read-ahead char, if unused
(if (not (equal? next-c #\@))
(in-port:set-buf! ptbl next-c))
;; Keep going
(if all?
(parse fp '() new-toks all? #f #f parens ptbl)

View file

@ -2,4 +2,6 @@
(scheme read))
(write `(read ,(+ 1 2 3)))
(write `(read ,(list 1 2 3)))
;(write `(read ,@(list 1 2 3)))