Mon Nov 23 10:24:02 UTC 2009 pix@kepibu.org
* Status commit; fix unification
hunk ./tests.lisp 45
- ("i" . ?i);#t(list ?j ?i))
+ ("i" . #t(list ?j ?i))
hunk ./traversal/dom.lisp 10
+
hunk ./traversal/dom.lisp 15
-#+(or)
-(defmethod element-attribute (attribute (element dom:node))
- (declare (ignore attribute element))
- nil)
+
hunk ./traversal/dom.lisp 20
-#+(or)
-(defmethod element-type ((element dom:node))
- (declare (ignore element))
- nil)
+
hunk ./traversal/dom.lisp 25
-#+(or)
-(defmethod element-id ((element dom:node))
- (declare (ignore element))
- nil)
hunk ./traversal/lhtml.lisp 13
-#+FIXME
-(defmethod element-parent ((element list))
- (let ((parent (car *ancestors*)))
- (if (some (alexandria:curry #'eq element) (element-children parent))
- parent
- (error "unable to determine parent"))))
hunk ./traversal/lhtml.lisp 15
-#+FIXME
-(defmethod element-ancestors ((element list))
- *ancestors*)
+
hunk ./unify.lisp 28
- :do
- (let ((val (find-matching-elements css-specifier document)))
- (cond
- ;; FIXME: make possible to say things like ("div" . #t(list ?first-div &rest))
- #+(or)
- ((typep template 'css-selector-template)
- (format t "hey! ~s~%" template)
- (let ((menv (reduce #'merge-environments
- (mapcar (curry #'unify template)
- val))))
- (unify::fill-environment (unify::environment-variables menv)
- (unify::environment-values menv)
- env)))
- ((unify::template-p template)
- (let ((menv (reduce #'merge-environments
- (mapcar (curry #'unify template)
- val))))
- (unify::fill-environment (unify::environment-variables menv)
- (unify::environment-values menv)
- env))
- #+(or)
- (unify template val env)
- #+(or)
- (loop :for element :in val
- :do (unify template element env)))
- ((unify::variablep template)
- ;; *ahem* FIXME: this makes ("a" ("b" . ?b)) possible,
- ;; but will cause the wrong thing to happen for [_$_]
- ;; ("a" ("b" . ?b) ("#b" . ?b))
- ;(alexandria:if-let ((varval (find-variable-value template env)))
- ; (nconc varval val)
- (unify::var-unify template val env)
- #+(or)
- (unify::extend-environment template val env));)
- (t (error "whoops: ~s, ~s" css-specifier template)))))
+ :do (typecase template
+ ;; CSS selectors work backwards, not forwards
+ (css-selector-template
+ (unify template document env))
+ (t
+ (let ((val (find-matching-elements css-specifier document)))
+ (cond
+ ((unify::template-p template)
+ (unify template val env))
+ ((unify::variablep template)
+ (unify::var-unify template val env))
+ (t (error "Don't know what to do with ~s and ~s." css-specifier template)))))))