[Parse alternative subschools properly clinton@unknownlamer.org**20080427042703] { hunk ./src/srd-import.lisp 51 - (:register (:greedy-repetition 1 nil :word-char-class)) + (:register (:greedy-repetition 1 nil + (:char-class :word-char-class + #\space))) hunk ./src/srd-import.lisp 72 - + + (defparameter *spell-subschool-scanner* + (cl-ppcre:create-scanner + '(:sequence + (:register (:greedy-repetition 1 nil :word-char-class)) + (:alternation + :end-anchor + (:sequence " or " + (:register (:greedy-repetition 1 nil :word-char-class))))))) + + hunk ./src/srd-import.lisp 190 - (let ((local-intern (compose (rcurry #'intern - :org.unknownlamer.dnd-tools.db.symbols) - #'string-upcase))) + (flet ((local-intern (n) + (if n (intern (string-upcase n) + :org.unknownlamer.dnd-tools.db.symbols)))) hunk ./src/srd-import.lisp 194 - (string (funcall local-intern component)) + (string (local-intern component)) hunk ./src/srd-import.lisp 196 - local-intern component))))) - (list school subschool + #'local-intern component))))) + (list school + (if subschool + (multiple-value-bind (s groups) + (ppcre:scan-to-strings *spell-subschool-scanner* + subschool) + (declare (ignore s)) + (coerce groups 'list))) hunk ./src/srd-import.lisp 208 - ,@(if subschool `((:subschool . ,subschool))) - ,@(cond (modifiers - (let ((alignments '(good chaotic lawful evil))) - (list - (if-bind alignment - (remove-if-not (lambda (item) (member item alignments)) - modifiers) - `(:alignment . ,(car alignment))) - (if-bind other - (remove-if (lambda (item) (member item alignments)) - modifiers) - `(:modifiers . ,other)))))) + ,@(if subschool + `((:subschool . ,(car subschool)) + ,(if (cadr subschool) `(:alternative-subschool . ,(cadr subschool))))) + ,@(let ((modifiers (remove-if (rcurry #'member '(or)) modifiers ))) + (cond (modifiers + (let ((alignments '(good chaotic lawful evil))) + (list + (if-bind alignment + (remove-if-not (lambda (item) (member item alignments)) + modifiers) + `(:alignment . ,(car alignment))) + (if-bind other + (remove-if (lambda (item) (member item alignments)) + modifiers) + `(:modifiers . ,other))))))) }