+(define-access-wrapper p-type p-%type :read-only t)
+
+(export 'decode-property)
+(defgeneric decode-property (raw)
+ (:documentation "Decode a RAW value into a TYPE, VALUE pair.")
+ (:method ((raw symbol)) (values :symbol raw))
+ (:method ((raw integer)) (values :int raw))
+ (:method ((raw string)) (values :string raw))
+ (:method ((raw character)) (values :char raw))
+ (:method ((raw property)) (values (p-type raw) (p-value raw)))
+ (:method ((raw cons)) (values (car raw) (cdr raw)))
+ (:method ((raw function)) (values :func raw))
+ (:method ((raw c-type)) (values :type raw)))
+
+(export 'make-property)
+(defun make-property (name raw-value &key type location seenp)
+ (multiple-value-bind (type value)
+ (if type
+ (values type raw-value)
+ (decode-property raw-value))
+ (%make-property name value
+ :type type
+ :location (file-location location)
+ :seenp seenp)))