(defun verify-next-line (&key optional)
(cond
((and optional (not (more))) t)
- ((not (more)) (fire-error (format nil "Expected line after: ~A" (prev-line))))
((cl-ppcre:scan " $" (peek)) (fire-error (format nil "Can't end line with a space: ~A" (peek))))
((< 120 (length (peek))) (fire-error (format nil "Longer than 120 chars: ~A" (peek))))))
(cons
(format nil "~A~A~A"
(subseq next-line 2 (length next-line))
- (if (and (car rest-of-freeform) (string/= "" (car rest-of-freeform))) " " "")
+ (if (string/= "" (car rest-of-freeform)) " " "")
(car rest-of-freeform))
(cdr rest-of-freeform))))
((string= "" next-line)
(process-examples))))
(defun parse-examples ()
+ ; This shouldn't fire, unless there's a bug in our processing
(when (string/= "EXAMPLES:" (next)) (fire-error (format nil "Expected EXAMPLES: instead of: ~A" (prev-line))))
(expect-blank-line)
(list :examples (process-examples)))
(lambda
(text-item)
(cond
- ((not (stringp text-item)) (list text-item))
((not (cl-ppcre:scan (cl-ppcre:quote-meta-chars (car remaining-keywords)) text-item)) (list text-item))
(t
(let
(mapcar (lambda (ti) (list (list :keyword (car remaining-keywords)) ti)) (cdr split-text)))))))
(inject-keywords text (cdr remaining-keywords)))))))
(list :text (inject-keywords text *keywords*))))
-; (map
-; (list :text text))
(defun parse-header (var)
(verify-next-line)
((var-name (symbol-name var)))
(when (not (string= var-name (peek)))
(fire-error (format nil "First line of ~A did not match: ~A, ~A" var var-name (peek))))
- (when (cl-ppcre:scan "[a-z]" var-name)
- (fire-error (format nil "Variable name should be all uppercase: ~A" var-name)))
(add-keyword var-name)
(next)
(expect-blank-line)
(cond
((stringp text) text)
((and (listp text) (eql :keyword (car text))) (format nil "_~(~A~)_" (cadr text)))
+ ; This should never fire, unless there's a bug in our processor
(t (fire-error (format nil "Don't know how to convert text: ~S" text)))))
(cadr text))))