Am 08.03.2018 um 16:52 schrieb Urs Liska:
@Urs
Great! I tested it a bit and it seems to be working as intended.
I have forgotten one thing that I've only halfway completed by now:
"accepted" properties without type checking. Currently, if the
"strict" flag is set, only keys present in the rules are accepted. But
these are also expected, so what's still missing is a way to specify
rules as optional so we can filter unknown properties but still have
optional ones. I've started on it and I think I know how to do it but
I had to leave the computer.
I've pushed another commit to allow "accepted" but "optional" arguments.
Now with the "strict" option unknown properties are still rejected, but
if a rule has 'opt as its last element the argument is ignored if it is
not supplied.
This is something to test with:
\version "2.19.80"
\include "oll-core/package.ily"
#(define rules
`((ind ,number? 5)
(target ,symbol?)
(payload)
(accepted-arg ,fraction? opt)
(accepted-without-type opt)
(msg ,string? "No message given")))
testRules =
#(define-void-function (opts) (ly:context-mod?)
(let ((props (context-mod->props rules #t opts)))
(pretty-print props)))
\testRules \with {
msg = "Something"
unk = "Unknown option"
target = something
% accepted-arg = 7/4
% accepted-without-type = #(ly:make-moment 3/16)
}
Best
Urs
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user