diff --git a/parser.scm b/parser.scm index fd7d8d29..208647c2 100644 --- a/parser.scm +++ b/parser.scm @@ -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) diff --git a/test.scm b/test.scm index a516da0e..8bbae156 100644 --- a/test.scm +++ b/test.scm @@ -2,4 +2,6 @@ (scheme read)) (write `(read ,(+ 1 2 3))) +(write `(read ,(list 1 2 3))) +;(write `(read ,@(list 1 2 3)))