Skip to content

Commit

Permalink
fixes & cleanup for release
Browse files Browse the repository at this point in the history
  • Loading branch information
phantomics committed Dec 16, 2018
1 parent 44e1f75 commit fb35cab
Showing 1 changed file with 32 additions and 29 deletions.
61 changes: 32 additions & 29 deletions vex/vex.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -196,32 +196,37 @@
(options &optional input-string)
;; this macro is the point of contact between users and the language, used to
;; evaluate expressions and control properties of the language instance
(cond ((and options (listp options)
(string= "TEST" (string-upcase (first options))))
(let ((all-tests ',(append function-tests operator-tests general-tests)))
`(progn (setq prove:*enable-colors* nil)
(plan ,(loop :for exp :in all-tests :counting (eql 'is (first exp))))
,@all-tests (finalize)
(setq prove:*enable-colors* t))))
;; the (test) setting is used to run tests
((and options (listp options)
(string= "RESTORE-DEFAULTS" (string-upcase (first options))))
`(setf (idiom-state ,,idiom-symbol)
(copy-alist (idiom-base-state ,,idiom-symbol))))
;; the (restore-defaults) setting is used to restore the workspace settings
;; to the defaults from the spec
(t `(progn ,@(if (and (listp options)
(string= "SET" (string (first options)))
(assoc :space (rest options))
(not (boundp (second (assoc :space (rest options))))))
`((defvar ,(second (assoc :space (rest options)))
(make-hash-table :test #'eq))))
,(vex-program ,idiom-symbol
(if input-string
(if (string= "SET" (string (first options)))
(rest options)
(error "Incorrect option syntax.")))
(if input-string input-string options)))))))))))
(let* ((local-idiom (intern ,(format nil "*~a-IDIOM*" (string-upcase symbol)))))
(cond ((and options (listp options)
(string= "TEST" (string-upcase (first options))))
(let ((all-tests ',(append function-tests operator-tests general-tests)))
`(progn (if (not (boundp ',local-idiom))
(defvar ,local-idiom ,,idiom-symbol))
(setq prove:*enable-colors* nil)
(plan ,(loop :for exp :in all-tests :counting (eql 'is (first exp))))
,@all-tests (finalize)
(setq prove:*enable-colors* t))))
;; the (test) setting is used to run tests
((and options (listp options)
(string= "RESTORE-DEFAULTS" (string-upcase (first options))))
`(setf (idiom-state ,,idiom-symbol)
(copy-alist (idiom-base-state ,,idiom-symbol))))
;; the (restore-defaults) setting is used to restore the workspace settings
;; to the defaults from the spec
(t `(progn (if (not (boundp ',local-idiom))
(defvar ,local-idiom ,,idiom-symbol))
,@(if (and (listp options)
(string= "SET" (string (first options)))
(assoc :space (rest options))
(not (boundp (second (assoc :space (rest options))))))
`((defvar ,(second (assoc :space (rest options)))
(make-hash-table :test #'eq))))
,(vex-program ,idiom-symbol
(if input-string
(if (string= "SET" (string (first options)))
(rest options)
(error "Incorrect option syntax.")))
(if input-string input-string options))))))))))))

(defun derive-opglyphs (glyph-list &optional output)
"Extract a list of function/operator glyphs from part of a Vex language specification."
Expand Down Expand Up @@ -522,14 +527,12 @@
(labels ((assign-from (source dest)
(if source (progn (setf (getf dest (first source))
(second source))
(assign-from (cddr source)
dest))
(assign-from (cddr source) dest))
dest))
(process-lines (lines &optional output)
(if (= 0 (length lines))
output (destructuring-bind (out remaining)
(parse lines (=vex-lines idiom meta))
;;(print (list :oo out remaining))
(process-lines remaining (append output (list (composer idiom meta out))))))))

(if (not (gethash :variables meta))
Expand Down

0 comments on commit fb35cab

Please sign in to comment.