forked from Shinmera/CLSS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselector.lisp
More file actions
38 lines (28 loc) · 1.05 KB
/
selector.lisp
File metadata and controls
38 lines (28 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
(in-package #:org.shirakumo.clss)
(defun make-selector (&rest groups)
`(:selector ,@groups))
(defun make-group (&rest matches-and-ops)
`(:group ,@matches-and-ops))
(defun make-clss-matcher (&rest constraints)
`(:matcher ,@constraints))
(defun make-any-constraint ()
`(:c-any))
(defun make-tag-constraint (tag)
`(:c-tag ,tag))
(defun make-type-constraint (name)
(let ((type (or (find-symbol (string-upcase name) "PLUMP-DOM")
(find-symbol (string-upcase name))
(error "No such PLUMP-DOM class: ~s" name))))
(or (subtypep type 'plump-dom:node)
(error "~s is not a PLUMP-DOM:NODE subclass." name))
`(:c-type ,type)))
(defun make-id-constraint (id)
`(:c-id ,id))
(defun make-class-constraint (class)
`(:c-class ,class))
(defun make-attribute-constraint (attribute &optional value (comparator :=))
(if (and value comparator)
`(:c-attr-equals ,comparator ,attribute ,value)
`(:c-attr-exists ,attribute)))
(defun make-pseudo-constraint (function &rest args)
`(:c-pseudo ,function ,@args))