Coverage report: /home/ellis/comp/core/lib/organ/proto.lisp
Kind | Covered | All | % |
expression | 0 | 47 | 0.0 |
branch | 0 | 10 | 0.0 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;; lib/organ/proto.lisp --- Organ Protocol
8
(defclass org-stream (fundamental-stream)
9
((stream :initarg :stream :reader stream-of)))
11
(defclass org-element () ())
13
(defclass org-lesser-element (org-element) ())
15
(defclass org-greater-element (org-element)
16
((contents :initarg :contents :type (vector org-element))))
18
(defclass org-object () ())
20
(defgeneric org-parse (type input)
21
(:documentation "Parse string INPUT as an org element of type TYPE."))
23
(defgeneric org-parse-lines (type input)
24
(:documentation "Convenience method. Parse INPUT as a vector
25
of lines, returning it. Each line object is a cons cell where car is a
26
keyword and cdr is the raw text parsed.")
27
(:method ((type (eql t)) (input string))
28
(let ((lines (read-org-lines-from-string input)))
29
(loop for x across lines
32
((scan org-headline-rx x) (cons :headline x))
33
((scan org-file-property-rx x) (cons :file-property x))
34
((scan org-property-start-rx x) (continue))
35
((scan org-property-rx x) (cons :node-property x))
36
((scan org-end-rx x) (continue))
37
(t (cons :text x)))))))
39
(defgeneric org-create (type &rest initargs)
40
(:documentation "Create a new org-element of type TYPE."))
42
(defgeneric org-push (elt place)
43
(:documentation "Add org-element ELT to object PLACE.")
44
(:method ((elt org-element) (place sequence))
47
(defgeneric org-write (elt stream)
48
(:documentation "Write org-element ELT to output STREAM.")
49
(:method ((elt org-element) stream))) ;; no-op
51
(defgeneric org-contents (elt)
52
(:documentation "Extract contents from org-element ELT."))
54
(defgeneric (setf org-contents) (elt contents)
55
(:documentation "Set ELT's contents to CONTENTS. Return ELT."))
57
(defgeneric org-property (elt prop)
58
(:documentation "Extract the value from property PROP of org-element ELT."))
60
(defgeneric (setf org-property) (elt prop val)
61
(:documentation "In org-element ELT set PROP to VAL. Return modified org-element."))
63
(defgeneric org-get-element (elt place)
64
(:documentation "Extract org-element ELT from sequence PLACE."))
66
(defgeneric (setf org-get-element) (old new place)
67
(:documentation "Replace OLD with NEW in sequence of org-elements at PLACE."))
69
(defgeneric org-insert-before (elt location place)
70
(:documentation "Insert org-element ELT before LOCATION in sequence PLACE. Modify PLACE
73
(defgeneric org-parse-minimal (input)
74
(:documentation "Parse the minimal set of objects as defined by Org syntax.
76
The minimal set includes the symbols defined in +ORG-MINIMAL-OBJECTS+."))
78
(defgeneric org-parse-standard (input)
79
(:documentation "Parse the standard set of object as define by Org syntax.
81
The standard set includes the symbols defined in +ORG-STANDARD-OBJECTS+."))