(in-package sugar-qsp) (eval-when (:compile-toplevel :load-toplevel :execute) (defun src-file (filename) (uiop/pathname:merge-pathnames* filename (asdf:system-source-directory :sugar-qsp))) (defun read-code-from-string (string) (with-input-from-string (in string) `(progn ,@(loop :for form := (read in nil :eof) :until (eq form :eof) :collect form)))) (defun load-src (filename) (alexandria:read-file-into-string (src-file filename)))) (defclass compiler () ((body :accessor body :initform #.(load-src "extras/body.html")) (css :accessor css :initform (list #.(load-src "extras/default.css"))) (js :accessor js :initform '#.(mapcar #'read-code-from-string (mapcar #'load-src (list "src/intrinsics.ps" "src/api.ps" "src/main.ps")))) (compile :accessor compile-only :initarg :compile) (target :accessor target :initarg :target) (beautify :accessor beautify :initarg :beautify)))