+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup SYMBOL
+ {
+ SCM res = try_word_variants ($2, $4);
+ if (!SCM_UNBNDP (res))
+ if (scm_is_pair (res)) {
+ $$ = $3;
+ MYREPARSE (@4, $2, SYMBOL_LIST, res);
+ }
+ else
+ $$ = scm_cons (res, $3);
+ else {
+ $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
+ MYBACKUP (STRING, $4, @4);
+ }
+ }
+ | function_arglist_backup REPARSE pitch_or_music
+ {
+ if (scm_is_true (scm_call_1 ($2, $3)))
+ $$ = scm_cons ($3, $1);
+ else
+ $$ = check_scheme_arg (parser, @3,
+ make_music_from_simple
+ (parser, @3, $3),
+ $1, $2);
+ }
+ | function_arglist_backup REPARSE bare_number_common
+ {
+ $$ = check_scheme_arg (parser, @3,
+ $3, $1, $2);
+ }
+ | function_arglist_backup REPARSE multiplied_duration
+ {
+ $$ = check_scheme_arg (parser, @3,
+ $3, $1, $2);
+ }
+ | function_arglist_backup REPARSE reparsed_rhythm
+ {
+ $$ = check_scheme_arg (parser, @3,
+ $3, $1, $2);
+ }
+ | function_arglist_backup REPARSE symbol_list_arg
+ {
+ $$ = check_scheme_arg (parser, @3, $3, $1, $2);
+ }
+ ;
+
+function_arglist:
+ function_arglist_nonbackup
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_skip_nonbackup DEFAULT
+ {
+ $$ = scm_cons (loc_on_copy (parser, @4, $1), $3);
+ }
+ ;
+
+function_arglist_skip_nonbackup:
+ function_arglist_nonbackup
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_skip_nonbackup
+ {
+ $$ = scm_cons (loc_on_copy (parser, @3, $1), $3);
+ }
+ ;
+
+// Partial function arglists are returned just in their incomplete
+// state: when combined with the music function, the missing parts of
+// the signature can be reconstructed
+//
+// To serve as a partial arglist, the argument list must absolutely
+// _not_ be in "skipping optional arguments" mode since then there is
+// some backup token that has nowhere to go before \etc.
+//
+// So we can skim off an arbitrary number of arguments from the end of
+// the argument list. The argument list remaining afterwards has to
+// be in not-skipping-optional-arguments mode.
+
+function_arglist_partial:
+ EXPECT_SCM function_arglist_optional
+ {
+ $$ = $2;
+ }
+ | EXPECT_SCM function_arglist_partial_optional