Add prefab structs to match grammar

This commit is contained in:
Asumu Takikawa 2015-08-07 19:08:21 -04:00
parent fe2e480ef1
commit 9f682a3f11
2 changed files with 5 additions and 0 deletions

View File

@ -50,6 +50,7 @@ qp ::= literal @match literal
| (qp ooo . qp) @match qps beginning with repeated qp
| #(qp ...) @match vector of qps
| #&qp @match boxed qp
| #s(prefab-key qp ...) @match prefab struct with qp fields
| ,pat @match pat
| ,@(LIST lvp ...) @match lvps, spliced
| ,@(LIST-REST lvp ... pat) @match lvps plus pat, spliced

View File

@ -58,6 +58,10 @@
(list->vector (map fixup-sexp (vector->list s)))]
[(box? s)
(box (fixup-sexp (unbox s)))]
[(struct? s)
(apply make-prefab-struct
(prefab-struct-key s)
(cdr (map fixup-sexp (vector->list (struct->vector s)))))]
[(symbol? s)
(case s
[(lvp pat qp literal ooo datum struct-id