use yml data structures with python parser
This commit is contained in:
22
scm/resolve_inherits.scm
Normal file
22
scm/resolve_inherits.scm
Normal file
@ -0,0 +1,22 @@
|
||||
(define (resolve-inherit-entry-in-list alist entry)
|
||||
(let* ((key (car entry))
|
||||
(attributes (cdr entry))
|
||||
(inherits (assoc-ref attributes "inherits")))
|
||||
(if inherits
|
||||
(let* ((alist-without-entry (alist-delete key alist))
|
||||
(inherit-entry (assoc inherits alist-without-entry))
|
||||
(inherits-attributes (if inherit-entry (alist-copy (cdr (resolve-inherit-entry-in-list alist-without-entry inherit-entry)))))
|
||||
(override-attributes (alist-delete "inherits" attributes)))
|
||||
(if inherit-entry
|
||||
(begin
|
||||
(for-each (lambda (attribute) (assoc-set! inherits-attributes (car attribute) (cdr attribute))) override-attributes)
|
||||
(cons key inherits-attributes)
|
||||
)
|
||||
(ly:error "~a can not inherit from ~a" key inherits))
|
||||
)
|
||||
entry
|
||||
)))
|
||||
|
||||
(define (resolve-inherits alist)
|
||||
(map (lambda (entry) (resolve-inherit-entry-in-list alist entry)) alist)
|
||||
)
|
Reference in New Issue
Block a user