Fix selectors for new compiler structure.
This commit is contained in:
parent
4baf969f7c
commit
85e7539995
|
@ -128,7 +128,7 @@ See DEFINE-SPECIAL-SELECTOR.")
|
||||||
(loop with result = ()
|
(loop with result = ()
|
||||||
for func in cfunc
|
for func in cfunc
|
||||||
do (loop for arg in cargs
|
do (loop for arg in cargs
|
||||||
do (push (list :constraint :child func arg) result))
|
do (push (list :constraint :combine " " func arg) result))
|
||||||
finally (return (compile-constraint (nreverse result) (cdr args))))))
|
finally (return (compile-constraint (nreverse result) (cdr args))))))
|
||||||
(:method ((func null) (args null))
|
(:method ((func null) (args null))
|
||||||
NIL)
|
NIL)
|
||||||
|
@ -146,7 +146,7 @@ See DEFINE-SPECIAL-SELECTOR.")
|
||||||
(loop with result = ()
|
(loop with result = ()
|
||||||
for func in cfunc
|
for func in cfunc
|
||||||
do (loop for arg in cargs
|
do (loop for arg in cargs
|
||||||
do (push (list :constraint :concat func arg) result))
|
do (push (list :constraint :combine "" func arg) result))
|
||||||
finally (return (compile-constraint :and (cons (cons :OR (nreverse result)) (cddr args))))))
|
finally (return (compile-constraint :and (cons (cons :OR (nreverse result)) (cddr args))))))
|
||||||
(if (and (listp (first args)) (eql (first (first args)) :OR))
|
(if (and (listp (first args)) (eql (first (first args)) :OR))
|
||||||
(rest (first args))
|
(rest (first args))
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
with values = (compile-selector value)
|
with values = (compile-selector value)
|
||||||
for attr in (compile-selector attr)
|
for attr in (compile-selector attr)
|
||||||
do (loop for value in values
|
do (loop for value in values
|
||||||
do (push (format NIL ,"[~a~a\"~a\"]" attr ,(string outcomp) value) out))
|
do (push (list :constraint :attribute attr ,(string outcomp) value) out))
|
||||||
finally (return (nreverse out)))))
|
finally (return (nreverse out)))))
|
||||||
|
|
||||||
(define-attr-comparator =)
|
(define-attr-comparator =)
|
||||||
|
@ -122,7 +122,7 @@
|
||||||
"Helper macro to define a single-argument pseudo-selector like NOT or NTH-CHILD."
|
"Helper macro to define a single-argument pseudo-selector like NOT or NTH-CHILD."
|
||||||
`(define-special-selector ,name (arg)
|
`(define-special-selector ,name (arg)
|
||||||
(loop for arg in (compile-selector arg)
|
(loop for arg in (compile-selector arg)
|
||||||
collect (format NIL ":~a(~a)" ,(string-downcase name) arg))))
|
collect (list :constraint :selector ,(string-downcase name) arg))))
|
||||||
|
|
||||||
(define-single-arg-selector dir)
|
(define-single-arg-selector dir)
|
||||||
(define-single-arg-selector lang)
|
(define-single-arg-selector lang)
|
||||||
|
|
16
writer.lisp
16
writer.lisp
|
@ -68,11 +68,23 @@ if *PRETTY* is non-NIL.")
|
||||||
(:method ((type (eql :constraint)) constraint stream)
|
(:method ((type (eql :constraint)) constraint stream)
|
||||||
(ecase (first constraint)
|
(ecase (first constraint)
|
||||||
((NIL))
|
((NIL))
|
||||||
(:child (format stream "~{~/lass::write-sheet-part/~^ ~}" (rest constraint)))
|
(:combine
|
||||||
(:concat (format stream "~{~/lass::write-sheet-part/~}" (rest constraint)))
|
(destructuring-bind (combiner &rest parts) (rest constraint)
|
||||||
|
(write-sheet-object (car (first parts)) (cdr (first parts)) stream)
|
||||||
|
(dolist (part (rest parts))
|
||||||
|
(format stream combiner)
|
||||||
|
(write-sheet-object (car part) (cdr part) stream))))
|
||||||
|
(:attribute
|
||||||
|
(destructuring-bind (attr comp val) (rest constraint)
|
||||||
|
(format stream "[")
|
||||||
|
(write-sheet-object (car attr) (rest attr) stream)
|
||||||
|
(format stream "~a" comp)
|
||||||
|
(format stream "~s]" (with-output-to-string (out)
|
||||||
|
(write-sheet-object (car val) (rest val) out)))))
|
||||||
(:property (format stream "(~a:~@[~* ~]~a)" (second constraint) *pretty* (third constraint)))
|
(:property (format stream "(~a:~@[~* ~]~a)" (second constraint) *pretty* (third constraint)))
|
||||||
(:and (format stream "~{~/lass::write-sheet-part/~^ and ~}" (rest constraint)))
|
(:and (format stream "~{~/lass::write-sheet-part/~^ and ~}" (rest constraint)))
|
||||||
(:func (format stream "~a(~{~a~^,~})" (second constraint) (cddr constraint)))
|
(:func (format stream "~a(~{~a~^,~})" (second constraint) (cddr constraint)))
|
||||||
|
(:selector (format stream ":~a(~{~/lass::write-sheet-part/~^,~})" (second constraint) (cddr constraint)))
|
||||||
(:literal (format stream "~a" (second constraint)))))
|
(:literal (format stream "~a" (second constraint)))))
|
||||||
|
|
||||||
(:method ((type (eql :text)) block stream)
|
(:method ((type (eql :text)) block stream)
|
||||||
|
|
Loading…
Reference in New Issue