The clss Reference Manual

This is the clss Reference Manual, version 0.3.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:43:09 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 clss

A DOM tree searching engine based on CSS selectors.

Maintainer

Yukari Hafner <>

Author

Yukari Hafner <>

Home Page

https://shinmera.github.io/CLSS/

Source Control

(GIT https://github.com/Shinmera/CLSS.git)

Bug Tracker

https://github.com/Shinmera/CLSS/issues

License

zlib

Version

0.3.1

Dependencies
  • array-utils (system).
  • plump (system).
Source

clss.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 clss/clss.asd

Source

clss.asd.

Parent Component

clss (system).

ASDF Systems

clss.


3.1.2 clss/package.lisp

Source

clss.asd.

Parent Component

clss (system).

Packages

clss.


3.1.3 clss/selector.lisp

Dependency

package.lisp (file).

Source

clss.asd.

Parent Component

clss (system).

Public Interface
Internals

make-group (function).


3.1.4 clss/parser.lisp

Dependency

selector.lisp (file).

Source

clss.asd.

Parent Component

clss (system).

Public Interface
Internals

3.1.5 clss/engine.lisp

Dependency

parser.lisp (file).

Source

clss.asd.

Parent Component

clss (system).

Public Interface
Internals

3.1.6 clss/pseudo-selectors.lisp

Dependency

engine.lisp (file).

Source

clss.asd.

Parent Component

clss (system).

Internals

match-nth (function).


4 Packages

Packages are listed by definition order.


4.1 clss

Source

package.lisp.

Nickname

org.shirakumo.clss

Use List
  • common-lisp.
  • plump.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Macros

Macro: define-pseudo-selector (name (nodename &rest args-lambda) &body body)

Define a new pseudo-selector of NAME.

NAME — A symbol or string naming the selector (case insensitive always). NODENAME — A variable symbol the matched node is bound to.
ARGS-LAMBDA — A lambda-list of the expected arguments for the pseudo-selector. Note that keyword arguments make no sense in this context. BODY ::= form*

Package

clss.

Source

engine.lisp.


5.1.2 Compiler macros

Compiler Macro: node-matches-p (selector root-node)
Package

clss.

Source

engine.lisp.

Compiler Macro: ordered-select (selector root-node)
Package

clss.

Source

engine.lisp.

Compiler Macro: select (selector root-node &optional search-type)
Package

clss.

Source

engine.lisp.


5.1.3 Ordinary functions

Function: css-escape (string)

Escape all the invalid CSS characters to their safe counterparts.

Package

clss.

Source

parser.lisp.

Function: css-unescape (string)

Get the original contents of the escaped STRING.

Package

clss.

Source

parser.lisp.

Function: make-any-constraint ()
Package

clss.

Source

selector.lisp.

Function: make-attribute-constraint (attribute &optional value comparator)
Package

clss.

Source

selector.lisp.

Function: make-class-constraint (class)
Package

clss.

Source

selector.lisp.

Function: make-clss-matcher (&rest constraints)
Package

clss.

Source

selector.lisp.

Function: make-id-constraint (id)
Package

clss.

Source

selector.lisp.

Function: make-pseudo-constraint (function &rest args)
Package

clss.

Source

selector.lisp.

Function: make-selector (&rest groups)
Package

clss.

Source

selector.lisp.

Function: make-tag-constraint (tag)
Package

clss.

Source

selector.lisp.

Function: make-type-constraint (name)
Package

clss.

Source

selector.lisp.

Function: match-constraint (constraint node)

Attempts to match the CONSTRAINT form against the node. Returns NIL if it fails to do so, unspecified otherwise.

Package

clss.

Source

engine.lisp.

Function: match-group (group root-node &optional search-type)

Match a matcher group against the root-node and possibly all its children. Returns an array of mached nodes.

Package

clss.

Source

engine.lisp.

Function: match-group-backwards (group node)
Package

clss.

Source

engine.lisp.

Function: match-matcher (matcher node)

Attempts to match a matcher against a node. Returns T if all constraints match, NIL otherwise.

Package

clss.

Source

engine.lisp.

Function: match-selector (selector root-node search-type)

Match a selector against the root-node and possibly all its children. Returns an array of matched nodes.

Package

clss.

Source

engine.lisp.

Function: node-matches-p (selector node)

Tests whether the node matches the selector.

SELECTOR — A CSS-selector string or a compiled selector list. NODE — The node to test.

Package

clss.

Source

engine.lisp.

Function: ordered-select (selector root-node)

Match the given selector against the root-node and possibly all its children. Return an array of matching nodes ordered by their depth-first
traversal appearance in the DOM.

SELECTOR — A CSS-selector string or a compiled selector list. ROOT-NODE — A single node, list or vector of nodes to start matching from.

Package

clss.

Source

engine.lisp.

Function: parse-selector (string)

Parse a selector string into its "compiled" list form.

Package

clss.

Source

parser.lisp.

Function: pseudo-selector (name)

Returns the pseudo-selector function associated with NAME, if any.

Package

clss.

Source

engine.lisp.

Function: (setf pseudo-selector) (name)

Sets FUNCTION as the pseudo-selector for NAME.

Package

clss.

Source

engine.lisp.

Function: remove-pseudo-selector (name)

Removes the pseudo-selector associated with NAME.

Package

clss.

Source

engine.lisp.

Function: select (selector root-node &optional search-type)

Match the given selector against the root-node and possibly all its children.
Returns an array of matched nodes.

SELECTOR — A CSS-selector string or a compiled selector list.
ROOT-NODE — A single node, list or vector of nodes to start matching from. SEARCH-TYPE — Select the search algorithm, options are ":depth-first" and ":breadth-first".

Package

clss.

Source

engine.lisp.


5.1.4 Generic functions

Generic Reader: name (condition)
Generic Writer: (setf name) (condition)
Package

clss.

Methods
Reader Method: name ((condition undefined-pseudo-selector))
Writer Method: (setf name) ((condition undefined-pseudo-selector))
Source

engine.lisp.

Target Slot

%name.

Reader Method: name ((condition pseudo-selector-not-available))
Writer Method: (setf name) ((condition pseudo-selector-not-available))
Source

engine.lisp.

Target Slot

%name.

Generic Reader: selector (condition)
Generic Writer: (setf selector) (condition)
Package

clss.

Methods
Reader Method: selector ((condition selector-malformed))
Writer Method: (setf selector) ((condition selector-malformed))
Source

engine.lisp.

Target Slot

%selector.


5.1.5 Conditions

Condition: pseudo-selector-not-available

Condition signalled when a pseudo selector is defined according to spec, but makes no sense in the context of CLSS and has thus been left unimplemented.

Package

clss.

Source

engine.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: %name
Initform

(quote (error "name required."))

Initargs

:name

Readers

name.

Writers

(setf name).

Condition: selector-malformed

Signalled when a selector or matcher has been found to be malformed. This really shouldn’t happen unless you’re passing raw lists
for the selector to the matcher.

Package

clss.

Source

engine.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: %selector
Initform

(quote (error "selector malformed."))

Initargs

:selector

Readers

selector.

Writers

(setf selector).

Condition: undefined-pseudo-selector

Condition signalled when trying to use a pseudo selector that has not been defined. This is signalled at match-time, rather than at selector-compile-time.

Package

clss.

Source

engine.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: %name
Initform

(quote (error "name required."))

Initargs

:name

Readers

name.

Writers

(setf name).


5.2 Internals


5.2.1 Special variables

Special Variable: *pseudo-selectors*

Hash table for pseudo selector functions.
Links string names to functions of one or more arguments.

Package

clss.

Source

engine.lisp.

Special Variable: *valid-combinators*
Package

clss.

Source

parser.lisp.


5.2.2 Ordinary functions

Function: ensure-selector (thing)
Package

clss.

Source

parser.lisp.

Function: escapable (char)

A helper function to decide whether a part of identifier needs escaping.

Package

clss.

Source

parser.lisp.

Function: find-substring (item string split)

Returns ITEM if it is an element of STRING split by the SPLIT character.

Package

clss.

Source

engine.lisp.

Function: make-group (&rest matches-and-ops)
Package

clss.

Source

selector.lisp.

Function: match-nth (i n)
Package

clss.

Source

pseudo-selectors.lisp.

Function: match-pair-breadth (combinator matcher nodes)

Match a combinator and matcher pair against a list of nodes. Returns a vector of matching nodes.

Package

clss.

Source

engine.lisp.

Function: match-pair-depth (combinator matcher parent matching-nodes-processor)

Match a combinator and matcher pair against a list of nodes. For every match the function specified in "MATCHING-NODES-PROCESSOR" is called with the found match as the only argument.

Package

clss.

Source

engine.lisp.

Function: read-any-constraint ()

Reads an any constraint and returns it.

Package

clss.

Source

parser.lisp.

Function: read-attribute-comparator ()

Reads an attribute comparator string and returns it if found.

Package

clss.

Source

parser.lisp.

Function: read-attribute-constraint ()

Reads a complete attribute constraint and returns it.

Package

clss.

Source

parser.lisp.

Function: read-attribute-value ()

Reads an attribute value and returns it.

Package

clss.

Source

parser.lisp.

Function: read-class-constraint ()

Reads a class constraint and returns it.

Package

clss.

Source

parser.lisp.

Function: read-combinator ()

Reads the combinator between matchers and returns it.

Package

clss.

Source

parser.lisp.

Function: read-constraint ()

Read any constraint. Dispatches depending on the next character consumed.

Package

clss.

Source

parser.lisp.

Function: read-group ()

Reads a selector group and returns it.

Package

clss.

Source

parser.lisp.

Function: read-id-constraint ()

Reads an ID attribute constraint and returns it.

Package

clss.

Source

parser.lisp.

Function: read-matcher ()

Read a matcher (a sequence of constraints) and return it.

Package

clss.

Source

parser.lisp.

Function: read-name ()

Reads a CSS selector name-like string.

Package

clss.

Source

parser.lisp.

Function: read-pseudo-args ()

Reads an arguments list of a pseudo selector.

Package

clss.

Source

parser.lisp.

Function: read-pseudo-constraint ()

Reads a complete pseudo constraint and returns it.

Package

clss.

Source

parser.lisp.

Function: read-selector ()

Reads a complete selector and returns it.

Package

clss.

Source

parser.lisp.

Function: read-tag-constraint ()

Reads a tag constraint and returns it.

Package

clss.

Source

parser.lisp.

Function: read-type-constraint ()

Reads a DOM type constraint and returns it.

Package

clss.

Source

parser.lisp.


5.2.3 Generic functions

Generic Reader: value (condition)
Generic Writer: (setf value) (condition)
Package

clss.

Methods
Reader Method: value ((condition complete-match-pair))
Writer Method: (setf value) ((condition complete-match-pair))
Source

engine.lisp.

Target Slot

%value.


5.2.4 Conditions

Condition: complete-match-pair

Condition signalled to immediately return from MATCH-PAIR.

Package

clss.

Source

engine.lisp.

Direct superclasses

condition.

Direct methods
Direct slots
Slot: %value
Initform

(quote nil)

Initargs

:value

Readers

value.

Writers

(setf value).


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
C   D   E   F   G   M   N   O   P   R   S   V  
Index Entry  Section

(
(setf name): Public generic functions
(setf name): Public generic functions
(setf name): Public generic functions
(setf pseudo-selector): Public ordinary functions
(setf selector): Public generic functions
(setf selector): Public generic functions
(setf value): Private generic functions
(setf value): Private generic functions

C
Compiler Macro, node-matches-p: Public compiler macros
Compiler Macro, ordered-select: Public compiler macros
Compiler Macro, select: Public compiler macros
css-escape: Public ordinary functions
css-unescape: Public ordinary functions

D
define-pseudo-selector: Public macros

E
ensure-selector: Private ordinary functions
escapable: Private ordinary functions

F
find-substring: Private ordinary functions
Function, (setf pseudo-selector): Public ordinary functions
Function, css-escape: Public ordinary functions
Function, css-unescape: Public ordinary functions
Function, ensure-selector: Private ordinary functions
Function, escapable: Private ordinary functions
Function, find-substring: Private ordinary functions
Function, make-any-constraint: Public ordinary functions
Function, make-attribute-constraint: Public ordinary functions
Function, make-class-constraint: Public ordinary functions
Function, make-clss-matcher: Public ordinary functions
Function, make-group: Private ordinary functions
Function, make-id-constraint: Public ordinary functions
Function, make-pseudo-constraint: Public ordinary functions
Function, make-selector: Public ordinary functions
Function, make-tag-constraint: Public ordinary functions
Function, make-type-constraint: Public ordinary functions
Function, match-constraint: Public ordinary functions
Function, match-group: Public ordinary functions
Function, match-group-backwards: Public ordinary functions
Function, match-matcher: Public ordinary functions
Function, match-nth: Private ordinary functions
Function, match-pair-breadth: Private ordinary functions
Function, match-pair-depth: Private ordinary functions
Function, match-selector: Public ordinary functions
Function, node-matches-p: Public ordinary functions
Function, ordered-select: Public ordinary functions
Function, parse-selector: Public ordinary functions
Function, pseudo-selector: Public ordinary functions
Function, read-any-constraint: Private ordinary functions
Function, read-attribute-comparator: Private ordinary functions
Function, read-attribute-constraint: Private ordinary functions
Function, read-attribute-value: Private ordinary functions
Function, read-class-constraint: Private ordinary functions
Function, read-combinator: Private ordinary functions
Function, read-constraint: Private ordinary functions
Function, read-group: Private ordinary functions
Function, read-id-constraint: Private ordinary functions
Function, read-matcher: Private ordinary functions
Function, read-name: Private ordinary functions
Function, read-pseudo-args: Private ordinary functions
Function, read-pseudo-constraint: Private ordinary functions
Function, read-selector: Private ordinary functions
Function, read-tag-constraint: Private ordinary functions
Function, read-type-constraint: Private ordinary functions
Function, remove-pseudo-selector: Public ordinary functions
Function, select: Public ordinary functions

G
Generic Function, (setf name): Public generic functions
Generic Function, (setf selector): Public generic functions
Generic Function, (setf value): Private generic functions
Generic Function, name: Public generic functions
Generic Function, selector: Public generic functions
Generic Function, value: Private generic functions

M
Macro, define-pseudo-selector: Public macros
make-any-constraint: Public ordinary functions
make-attribute-constraint: Public ordinary functions
make-class-constraint: Public ordinary functions
make-clss-matcher: Public ordinary functions
make-group: Private ordinary functions
make-id-constraint: Public ordinary functions
make-pseudo-constraint: Public ordinary functions
make-selector: Public ordinary functions
make-tag-constraint: Public ordinary functions
make-type-constraint: Public ordinary functions
match-constraint: Public ordinary functions
match-group: Public ordinary functions
match-group-backwards: Public ordinary functions
match-matcher: Public ordinary functions
match-nth: Private ordinary functions
match-pair-breadth: Private ordinary functions
match-pair-depth: Private ordinary functions
match-selector: Public ordinary functions
Method, (setf name): Public generic functions
Method, (setf name): Public generic functions
Method, (setf selector): Public generic functions
Method, (setf value): Private generic functions
Method, name: Public generic functions
Method, name: Public generic functions
Method, selector: Public generic functions
Method, value: Private generic functions

N
name: Public generic functions
name: Public generic functions
name: Public generic functions
node-matches-p: Public compiler macros
node-matches-p: Public ordinary functions

O
ordered-select: Public compiler macros
ordered-select: Public ordinary functions

P
parse-selector: Public ordinary functions
pseudo-selector: Public ordinary functions

R
read-any-constraint: Private ordinary functions
read-attribute-comparator: Private ordinary functions
read-attribute-constraint: Private ordinary functions
read-attribute-value: Private ordinary functions
read-class-constraint: Private ordinary functions
read-combinator: Private ordinary functions
read-constraint: Private ordinary functions
read-group: Private ordinary functions
read-id-constraint: Private ordinary functions
read-matcher: Private ordinary functions
read-name: Private ordinary functions
read-pseudo-args: Private ordinary functions
read-pseudo-constraint: Private ordinary functions
read-selector: Private ordinary functions
read-tag-constraint: Private ordinary functions
read-type-constraint: Private ordinary functions
remove-pseudo-selector: Public ordinary functions

S
select: Public compiler macros
select: Public ordinary functions
selector: Public generic functions
selector: Public generic functions

V
value: Private generic functions
value: Private generic functions