+ | EXPECT_SCM function_arglist_closed_optional post_event
+ {
+ $$ = check_scheme_arg (PARSER, @3, SCM_UNDEFINED,
+ $3, $2, $1);
+ }
+ | function_arglist_common_lyric
+ ;
+
+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, SCM_UNDEFINED, $1, LYRIC_ELEMENT_P, $3);
+ } else {
+ $$ = scm_cons ($3, $2);
+ }
+ else if (scm_is_true (scm_call_1 ($1, lyric_event)))
+ {
+ $$ = $2;
+ MYREPARSE (@3, SCM_UNDEFINED, $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, SCM_UNDEFINED,
+ $3, $2, $1);
+ }
+ }
+ | function_arglist_common_lyric REPARSE lyric_element_arg
+ {
+ // This should never be false
+ $$ = check_scheme_arg (PARSER, @3, SCM_UNDEFINED,
+ $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, SCM_UNDEFINED,
+ $3, $2, $1);
+ }
+ | EXPECT_SCM function_arglist_closed_optional bare_number_closed
+ {
+ $$ = check_scheme_arg (PARSER, @3, SCM_UNDEFINED,
+ $3, $2, $1);
+ }
+ | EXPECT_SCM function_arglist_closed_optional post_event
+ {
+ $$ = check_scheme_arg (PARSER, @3, SCM_UNDEFINED,
+ $3, $2, $1);
+ }
+ | EXPECT_SCM function_arglist_closed_optional FRACTION
+ {
+ $$ = check_scheme_arg (PARSER, @3, SCM_UNDEFINED,
+ $3, $2, $1);
+ }
+ | EXPECT_SCM function_arglist_optional lyric_element
+ {
+ $$ = check_scheme_arg (PARSER, @3, SCM_UNDEFINED,
+ $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);