X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/48eb81ca02d7e618ecc474f73ef948b023586857..d5fdd49e70b734b791eb907706f92da5775e2a8b:/src/pset-impl.lisp diff --git a/src/pset-impl.lisp b/src/pset-impl.lisp index 8e1743f..42049db 100644 --- a/src/pset-impl.lisp +++ b/src/pset-impl.lisp @@ -74,13 +74,16 @@ (error "Symbol `~A' not external in package `~A'" name (package-name package))))))))) -(let ((truish '("true" "t" "yes" "on" "verily")) - (falsish '("false" "nil" "no" "off" "nowise"))) +(let ((truth-map (make-hash-table :test #'equalp))) + (dolist (string '("true" "t" "yes" "on" "yup" "verily")) + (setf (gethash string truth-map) t)) + (dolist (string '("false" "nil" "no" "off" "nope" "nowise")) + (setf (gethash string truth-map) nil)) (defun truishp (string) "Convert STRING to a boolean." - (cond ((member string truish :test #'string-equal) t) - ((member string falsish :test #'string-equal) nil) - (t (error "Unrecognized boolean value `~A'" string))))) + (multiple-value-bind (val foundp) (gethash string truth-map) + (if foundp val + (error "Unrecognized boolean value `~A'" string))))) ;;;-------------------------------------------------------------------------- ;;; Property representation. @@ -96,6 +99,7 @@ (defmethod decode-property ((raw character)) (values :char raw)) (defmethod decode-property ((raw function)) (values :func raw)) (defmethod decode-property ((raw c-type)) (values :type raw)) +(defmethod decode-property ((raw c-fragment)) (values :c-fragment raw)) ;;; Keywords.