Skip to content

Commit

Permalink
Change the syntax so that options go in the bindings form.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevinpgalligan committed Jan 28, 2024
1 parent 54c554d commit f57a658
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/sketch.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,22 @@
collect `(,(binding-accessor b) *sketch*)
collect (binding-name b)))))

(defmacro defsketchx (sketch-name superclasses binding-forms &body body)
(make-defsketch sketch-name superclasses binding-forms body))

(defmacro defsketch (sketch-name binding-forms &body body)
(make-defsketch sketch-name (list) binding-forms body))
(multiple-value-bind (options binding-forms)
(extract-options binding-forms)
(make-defsketch sketch-name
(getf options :mixins)
binding-forms
body)))

(defun extract-options (binding-forms)
(let (options)
(loop while (and binding-forms (keywordp (caar binding-forms)))
do (progn
(push (cadar binding-forms) options)
(push (caar binding-forms) options)
(pop binding-forms)))
(values options binding-forms)))

(defun make-defsketch (sketch-name superclasses binding-forms body)
(let ((bindings (parse-bindings sketch-name binding-forms
Expand Down

0 comments on commit f57a658

Please sign in to comment.