+function_arglist_common_lyric:
+ EXPECT_SCM function_arglist_optional lyric_element
+ {
+ // We check how the predicate thinks about a lyrics
+ // event or about a markup. If it accepts neither, we
+ // backup the original token. Otherwise we commit to
+ // taking the token. Depending on what the predicate
+ // is willing to accept, we interpret as a string, as
+ // a lyric event, or ambiguously (meaning that if
+ // something looking like a duration or post event
+ // follows, we take the event, otherwise the string).
+ SCM lyric_event = MAKE_SYNTAX ("lyric-event", @3, $3,
+ parser->default_duration_.smobbed_copy ());
+ if (scm_is_true (scm_call_1 ($1, $3)))
+ if (scm_is_true (scm_call_1 ($1, lyric_event)))
+ {
+ $$ = $2;
+ MYREPARSE (@3, $1, LYRICS_STRING, $3);
+ } else {
+ $$ = scm_cons ($3, $2);
+ }
+ else if (scm_is_true (scm_call_1 ($1, lyric_event)))
+ {
+ $$ = $2;
+ MYREPARSE (@3, $1, LYRIC_ELEMENT, $3);
+ } else {
+ // This is going to flag a syntax error, we
+ // know the predicate to be false.
+ check_scheme_arg (parser, @3,
+ $3, $2, $1);
+ }
+ }
+ | function_arglist_common_lyric REPARSE lyric_element_arg
+ {
+ // This should never be false
+ $$ = check_scheme_arg (parser, @3,
+ $3, $1, $2);
+ }
+ ;
+
+function_arglist_common_minus:
+ EXPECT_SCM function_arglist_closed_optional '-' UNSIGNED
+ {
+ SCM n = scm_difference ($4, SCM_UNDEFINED);
+ if (scm_is_true (scm_call_1 ($1, n))) {
+ $$ = $2;
+ MYREPARSE (@4, $1, REAL, n);
+ } else {
+ Music *t = MY_MAKE_MUSIC ("FingeringEvent", @4);
+ t->set_property ("digit", $4);
+ $$ = t->unprotect ();
+ if (scm_is_true (scm_call_1 ($1, $$)))
+ $$ = scm_cons ($$, $2);
+ else
+ $$ = check_scheme_arg (parser, @3, n, $2, $1);
+ }
+
+ }
+ | EXPECT_SCM function_arglist_closed_optional '-' REAL
+ {
+ $$ = $2;
+ SCM n = scm_difference ($4, SCM_UNDEFINED);
+ MYREPARSE (@4, $1, REAL, n);
+ }
+ | EXPECT_SCM function_arglist_closed_optional '-' NUMBER_IDENTIFIER
+ {
+ SCM n = scm_difference ($4, SCM_UNDEFINED);
+ $$ = check_scheme_arg (parser, @4, n, $2, $1);
+ }
+ | function_arglist_common_minus REPARSE bare_number
+ {
+ $$ = check_scheme_arg (parser, @3, $3, $1, $2);
+ }
+ ;
+
+function_arglist_closed:
+ function_arglist_closed_common
+ | function_arglist_nonbackup
+ ;
+
+function_arglist_closed_common:
+ function_arglist_bare
+ | EXPECT_SCM function_arglist_optional embedded_scm_arg_closed
+ {
+ $$ = check_scheme_arg (parser, @3,
+ $3, $2, $1);
+ }
+ | EXPECT_SCM function_arglist_closed_optional bare_number
+ {
+ $$ = check_scheme_arg (parser, @3,
+ $3, $2, $1);
+ }
+ | EXPECT_SCM function_arglist_closed_optional '-' UNSIGNED
+ {
+ SCM n = scm_difference ($4, SCM_UNDEFINED);
+ if (scm_is_true (scm_call_1 ($1, n))) {
+ $$ = scm_cons (n, $2);
+ } else {
+ Music *t = MY_MAKE_MUSIC ("FingeringEvent", @4);
+ t->set_property ("digit", $4);
+ $$ = t->unprotect ();
+ if (scm_is_true (scm_call_1 ($1, $$)))
+ $$ = scm_cons ($$, $2);
+ else
+ $$ = check_scheme_arg (parser, @3, n, $2, $1);
+ }
+
+ }
+ | EXPECT_SCM function_arglist_closed_optional '-' REAL
+ {
+ $$ = check_scheme_arg (parser, @3,
+ scm_difference ($4, SCM_UNDEFINED),
+ $2, $1);
+ }
+ | EXPECT_SCM function_arglist_closed_optional '-' NUMBER_IDENTIFIER
+ {
+ $$ = check_scheme_arg (parser, @3,
+ scm_difference ($4, SCM_UNDEFINED),
+ $2, $1);
+ }
+ | EXPECT_SCM function_arglist_closed_optional post_event_nofinger
+ {
+ $$ = check_scheme_arg (parser, @3,
+ $3, $2, $1);
+ }
+ | EXPECT_SCM function_arglist_closed_optional fraction
+ {
+ $$ = check_scheme_arg (parser, @3,
+ $3, $2, $1);
+ }
+ | EXPECT_SCM function_arglist_optional lyric_element
+ {
+ $$ = check_scheme_arg (parser, @3,
+ $3, $2, $1);
+ }
+ ;
+
+function_arglist_optional:
+ function_arglist_keep %prec FUNCTION_ARGLIST
+ | function_arglist_backup BACKUP
+ | EXPECT_OPTIONAL EXPECT_PITCH function_arglist_optional
+ {
+ $$ = scm_cons ($1, $3);
+ }
+ | EXPECT_OPTIONAL EXPECT_DURATION function_arglist_optional
+ {
+ $$ = scm_cons ($1, $3);
+ }
+ ;
+
+function_arglist_closed_optional:
+ function_arglist_closed_keep %prec FUNCTION_ARGLIST
+ | function_arglist_backup BACKUP
+ | EXPECT_OPTIONAL EXPECT_PITCH function_arglist_closed_optional
+ {
+ $$ = scm_cons ($1, $3);
+ }
+ | EXPECT_OPTIONAL EXPECT_DURATION function_arglist_closed_optional
+ {
+ $$ = scm_cons ($1, $3);
+ }
+ ;
+
+embedded_scm_closed:
+ embedded_scm_bare
+ | scm_function_call_closed
+ ;
+
+embedded_scm_arg_closed:
+ embedded_scm_bare_arg
+ | scm_function_call_closed
+ | closed_music
+ ;
+
+scm_function_call_closed:
+ SCM_FUNCTION function_arglist_closed {
+ $$ = MAKE_SYNTAX ("music-function", @$,
+ $1, $2);
+ } %prec FUNCTION_ARGLIST
+ ;
+
+function_arglist_bare:
+ EXPECT_NO_MORE_ARGS {