]> git.donarmstrong.com Git - lilypond.git/commitdiff
parser.yy: split function_arglist_nonbackup rule into closed and open variants
authorDavid Kastrup <dak@gnu.org>
Wed, 16 May 2012 18:32:00 +0000 (20:32 +0200)
committerDavid Kastrup <dak@gnu.org>
Mon, 21 May 2012 04:28:40 +0000 (06:28 +0200)
This allows more cases where optional arguments are not really optional
to accept music arguments not enclosed in braces.

lily/parser.yy

index 49acd012d51ca0820db2b8cdf3a613aedbdcf901..08e3ed7adf25dd424bd4ae5edb1b6e09ccf6930b 100644 (file)
@@ -481,6 +481,8 @@ If we give names, Bison complains.
 %type <scm> function_arglist_optional
 %type <scm> function_arglist_backup
 %type <scm> function_arglist_nonbackup
+%type <scm> function_arglist_nonbackup_common
+%type <scm> function_arglist_closed_nonbackup
 %type <scm> function_arglist_skip
 %type <scm> function_arglist_bare
 %type <scm> function_arglist_closed
@@ -1309,21 +1311,13 @@ function_arglist_skip:
        ;
 
 
-function_arglist_nonbackup:
+function_arglist_nonbackup_common:
        EXPECT_OPTIONAL EXPECT_PITCH function_arglist pitch_also_in_chords {
                $$ = scm_cons ($4, $3);
        }
        | EXPECT_OPTIONAL EXPECT_DURATION function_arglist_closed duration_length {
                $$ = scm_cons ($4, $3);
        }
-       | EXPECT_OPTIONAL EXPECT_SCM function_arglist embedded_scm_arg_closed
-       {
-               $$ = check_scheme_arg (parser, @4, $4, $3, $2);
-       }
-       | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed bare_number_closed
-       {
-               $$ = check_scheme_arg (parser, @4, $4, $3, $2);
-       }
        | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed FRACTION
        {
                $$ = check_scheme_arg (parser, @4, $4, $3, $2);
@@ -1362,6 +1356,29 @@ function_arglist_nonbackup:
        }
        ;
 
+function_arglist_closed_nonbackup:
+       function_arglist_nonbackup_common
+       | EXPECT_OPTIONAL EXPECT_SCM function_arglist embedded_scm_arg_closed
+       {
+               $$ = check_scheme_arg (parser, @4, $4, $3, $2);
+       }
+       | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed bare_number_closed
+       {
+               $$ = check_scheme_arg (parser, @4, $4, $3, $2);
+       }
+       ;
+
+function_arglist_nonbackup:
+       function_arglist_nonbackup_common
+       | EXPECT_OPTIONAL EXPECT_SCM function_arglist embedded_scm_arg
+       {
+               $$ = check_scheme_arg (parser, @4, $4, $3, $2);
+       }
+       | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed bare_number
+       {
+               $$ = check_scheme_arg (parser, @4, $4, $3, $2);
+       }
+       ;
 
 function_arglist_keep:
        function_arglist_common
@@ -1630,7 +1647,7 @@ function_arglist_common_minus:
 
 function_arglist_closed:
        function_arglist_closed_common
-       | function_arglist_nonbackup
+       | function_arglist_closed_nonbackup
        ;
 
 function_arglist_closed_common: