mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-15 16:57:35 +02:00
WIP towards unquote-splicing
This commit is contained in:
parent
0259ee0429
commit
49d6bc3213
2 changed files with 14 additions and 6 deletions
18
parser.scm
18
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)
|
||||
|
|
2
test.scm
2
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)))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue