mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 12:35:05 +02:00
Read vectors
This commit is contained in:
parent
433832b5c8
commit
1305e61558
1 changed files with 18 additions and 0 deletions
18
parser.scm
18
parser.scm
|
@ -293,6 +293,7 @@
|
||||||
(in-port:set-cnum! ptbl
|
(in-port:set-cnum! ptbl
|
||||||
(+ 1 (in-port:get-cnum ptbl)))
|
(+ 1 (in-port:get-cnum ptbl)))
|
||||||
(cond
|
(cond
|
||||||
|
;; Booleans
|
||||||
;; Do not use add-tok below, no need to quote a bool
|
;; Do not use add-tok below, no need to quote a bool
|
||||||
((eq? #\t next-c)
|
((eq? #\t next-c)
|
||||||
(if all?
|
(if all?
|
||||||
|
@ -302,6 +303,23 @@
|
||||||
(if all?
|
(if all?
|
||||||
(parse fp '() (cons #f toks) all? #f parens ptbl)
|
(parse fp '() (cons #f toks) all? #f parens ptbl)
|
||||||
#f))
|
#f))
|
||||||
|
;; Vector
|
||||||
|
((eq? #\( next-c)
|
||||||
|
(let ((sub (parse fp '() '() #t #f (+ parens 1) ptbl))
|
||||||
|
(toks* (get-toks tok toks)))
|
||||||
|
(define new-toks
|
||||||
|
(add-tok
|
||||||
|
(if (and (pair? sub) (dotted? sub))
|
||||||
|
(parse-error
|
||||||
|
"Invalid vector syntax" ;(->dotted-list sub)
|
||||||
|
(in-port:get-lnum ptbl)
|
||||||
|
(in-port:get-cnum ptbl))
|
||||||
|
(list->vector sub))
|
||||||
|
toks*))
|
||||||
|
(if all?
|
||||||
|
(parse fp '() new-toks all? #f parens ptbl)
|
||||||
|
(car new-toks))))
|
||||||
|
;; Character
|
||||||
((eq? #\\ next-c)
|
((eq? #\\ next-c)
|
||||||
(let ((new-toks (cons (read-pound fp ptbl) toks)))
|
(let ((new-toks (cons (read-pound fp ptbl) toks)))
|
||||||
(if all?
|
(if all?
|
||||||
|
|
Loading…
Add table
Reference in a new issue