4 texidoc= "Test backup of predicate-based optional music function arguments.
6 Unit expressions like @code{3\cm} can't be parsed as optional
7 arguments since they would require lookahead after @code{3}. However,
8 if @code{3} gets rejected as an optional argument based on evaluating
9 its predicate, it should still be able to participate as part of a unit
10 expression in a following mandatory argument."
13 \layout { ragged-right = ##t }
15 test=#(define-void-function (parser location expect . rest)
16 (list? (string? "def1") (integer? "def2") (number-pair? "def3") integer?)
17 (if (not (equal? expect rest))
18 (ly:parser-error parser
19 (format #f "Expected ~a, got ~a.\n" expect rest)
24 \test #'("a" 3 (3 . 4) 8) "a" 3 3/4 4\twice
25 \test #'("a" 3 "def3" 8) "a" 3 4\twice
26 \test #'("a" 4 "def3" 2) "a" 4\twice
27 \test #'("def1" "def2" "def3" 8) 4\twice