mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-07 13:16:34 +02:00
First-cut of quasi-quote parser
This commit is contained in:
parent
12b27ee8f5
commit
a09bf93b5c
1 changed files with 19 additions and 0 deletions
19
parser.scm
19
parser.scm
|
@ -197,6 +197,25 @@
|
||||||
(if all?
|
(if all?
|
||||||
(parse fp '() new-toks all? #f #f parens ptbl)
|
(parse fp '() new-toks all? #f #f parens ptbl)
|
||||||
(car new-toks))))))
|
(car new-toks))))))
|
||||||
|
((eq? c #\`)
|
||||||
|
;; TODO: should consolidate this with above
|
||||||
|
(cond
|
||||||
|
((and (not all?) (not quotes) (not (null? tok)))
|
||||||
|
;; Reached a terminal char, read out previous token
|
||||||
|
(in-port:set-buf! ptbl c)
|
||||||
|
(car (add-tok (->tok tok) toks quotes)))
|
||||||
|
(else
|
||||||
|
;; 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 'quasiquote sub)
|
||||||
|
(get-toks tok toks quotes)
|
||||||
|
quotes))
|
||||||
|
;; Keep going
|
||||||
|
(if all?
|
||||||
|
(parse fp '() new-toks all? #f #f parens ptbl)
|
||||||
|
(car new-toks))))))
|
||||||
((eq? c #\()
|
((eq? c #\()
|
||||||
(cond
|
(cond
|
||||||
((and (not all?) (not (null? tok)))
|
((and (not all?) (not (null? tok)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue