Fri Nov 13 08:32:55 UTC 2009 pix@kepibu.org * Status checkin diff -rN -u old-Oh, Ducks!/regexp-template.lisp new-Oh, Ducks!/regexp-template.lisp --- old-Oh, Ducks!/regexp-template.lisp 2015-10-03 01:16:52.000000000 +0000 +++ new-Oh, Ducks!/regexp-template.lisp 2015-10-03 01:16:52.000000000 +0000 @@ -6,8 +6,9 @@ (defmethod make-template ((kind (eql 'regexp+)) (spec cons)) (destructuring-bind (re-kwd regexp &optional vars &rest keys) spec + (declare (ignore re-kwd)) (make-instance 'unify::regular-expression-template - :spec (list* re-kwd + :spec (list* 'unify::regexp (concatenate 'string regexp "(.*)$") (append vars '(?&rest)) keys)))) diff -rN -u old-Oh, Ducks!/tests.lisp new-Oh, Ducks!/tests.lisp --- old-Oh, Ducks!/tests.lisp 2015-10-03 01:16:52.000000000 +0000 +++ new-Oh, Ducks!/tests.lisp 2015-10-03 01:16:52.000000000 +0000 @@ -33,3 +33,8 @@ (match (#T(lhtml ("div" ("> i" . ?i))) "
I do not like cheese.
I like cheese.
") i)) + +#+LATER +(match (#t(lhtml ("div::content" . #t(regexp+ "^f(o+)" (?o)))) + "
barbaz
fooooooobar
") + (values o &rest)) diff -rN -u old-Oh, Ducks!/unification-templates.lisp new-Oh, Ducks!/unification-templates.lisp --- old-Oh, Ducks!/unification-templates.lisp 2015-10-03 01:16:52.000000000 +0000 +++ new-Oh, Ducks!/unification-templates.lisp 2015-10-03 01:16:52.000000000 +0000 @@ -63,6 +63,7 @@ +;; FIXME: rename to selector (defclass css-specifier (unify::string-template) ((matcher :reader matcher :initarg :matcher))) @@ -70,9 +71,18 @@ (:method ((ob css-specifier)) t) (:method ((ob t)) nil)) +;; FIXME: rename to simple-selector (defclass css-selector (unify::template) ((arg :reader selector-arg :initarg :arg))) +#|| TODO + (defclass combinator (selector) ()) + (defclass child-combinator (combinator) ()) + (defclass descendant-combinator (combinator) ()) + (defclass adjacent-combinator (combinator) ()) + (defclass sibling-combinator (combinator) ()) +||# + (defmethod print-object ((selector css-selector) stream) (format stream "#" (selector-arg selector))) @@ -97,6 +107,8 @@ (#T(regexp+ "^[#](\\w+)" (?id)) (cons (make-instance 'css-id-selector :arg id) (parse-css-specifier &rest))) (#T(regexp+ "^[\\.](\\w+)" (?class)) (cons (make-instance 'css-class-selector :arg class) (parse-css-specifier &rest))))) +;; FIXME: rename to select-subject? +;; FIXME: make css-select methods use functions defined in traversal/implementation.lisp (defgeneric css-select (specifier document)) ;; FIXME?: move to within (css-select css-specifier cons) @@ -154,20 +166,3 @@ :when (all-match element) :collect element)) (t (css-collect-elements selector elements)))))) - - - -;; type-defines-selectors -;; Under this implementation strategy, CSS selectors themselves would be -;; implemented for elements. -#| -(defgeneric css-combinator:child (a b)) -(defgeneric css-combinator:descendant (a b)) -(defgeneric css-combinator:adjacent (a b)) -(defgeneric css-combinator:sibling (a b)) - -(defgeneric css-selector:element-type (element element-type)) -(defgeneric css-selector:class (element class)) -(defgeneric css-selector:id (element id)) -|# -