]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/parser.yy
Doc: removing a left over html tag in a snippet
[lilypond.git] / lily / parser.yy
index 29f4f2a1e0fddabd54aebd9cc6e257d014aafd14..08e3ed7adf25dd424bd4ae5edb1b6e09ccf6930b 100644 (file)
@@ -459,6 +459,8 @@ If we give names, Bison complains.
 %type <scm> context_def_spec_block
 %type <scm> context_def_spec_body
 %type <scm> context_mod
+%type <scm> context_mod_arg
+%type <scm> context_mod_embedded
 %type <scm> context_mod_list
 %type <scm> context_prop_spec
 %type <scm> direction_less_char
@@ -479,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
@@ -784,6 +788,9 @@ identifier_init:
        | number_expression {
                $$ = $1;
        }
+       | FRACTION {
+               $$ = $1;
+       }
        | string {
                $$ = $1;
        }
@@ -808,6 +815,27 @@ context_def_spec_block:
        }
        ;
 
+context_mod_arg:
+       embedded_scm
+       | composite_music
+       ;
+
+context_mod_embedded:
+       context_mod_arg
+       {
+               if (unsmob_music ($1)) {
+                       SCM proc = parser->lexer_->lookup_identifier ("context-mod-music-handler");
+                       $1 = scm_call_2 (proc, parser->self_scm (), $1);
+               }
+               if (unsmob_context_mod ($1))
+                       $$ = $1;
+               else {
+                       parser->parser_error (@1, _ ("not a context mod"));
+               }
+       }
+       ;
+
+
 context_def_spec_body:
        /**/ {
                $$ = Context_def::make_scm ();
@@ -817,18 +845,6 @@ context_def_spec_body:
                $$ = $1;
                unsmob_context_def ($$)->origin ()->set_spot (@$);
        }
-       | context_def_spec_body embedded_scm {
-               if (Context_mod *cm = unsmob_context_mod ($2)) {
-                       SCM p = cm->get_mods ();
-                       Context_def*td = unsmob_context_def ($$);
-
-                       for (; scm_is_pair (p); p = scm_cdr (p)) {
-                               td->add_context_mod (scm_car (p));
-                       }
-               } else {
-                       parser->parser_error (@2, _ ("not a context mod"));
-               }
-       }
        | context_def_spec_body context_mod {
                unsmob_context_def ($$)->add_context_mod ($2);
        }
@@ -839,6 +855,13 @@ context_def_spec_body:
                     td->add_context_mod (scm_car (m));
                 }
        }
+       | context_def_spec_body context_mod_embedded {
+                Context_def *td = unsmob_context_def ($$);
+                SCM new_mods = unsmob_context_mod ($2)->get_mods ();
+                for (SCM m = new_mods; scm_is_pair (m); m = scm_cdr (m)) {
+                    td->add_context_mod (scm_car (m));
+                }
+       }
        ;
 
 
@@ -864,8 +887,6 @@ book_body:
                push_paper (parser, $$->paper_);
                $$->header_ = parser->lexer_->lookup_identifier ("$defaultheader");
                parser->lexer_->set_identifier (ly_symbol2scm ("$current-book"), $$->self_scm ());
-               parser->lexer_->set_identifier (ly_symbol2scm ("book-output-suffix"), SCM_BOOL_F);
-               parser->lexer_->set_identifier (ly_symbol2scm ("book-filename"), SCM_BOOL_F);
        }
        | BOOK_IDENTIFIER {
                $$ = unsmob_book ($1);
@@ -1082,6 +1103,10 @@ output_def_body:
        | output_def_body context_def_spec_block        {
                assign_context_def ($$, $2);
        }
+       | output_def_body music_arg {
+               SCM proc = parser->lexer_->lookup_identifier ("output-def-music-handler");
+               scm_call_3 (proc, parser->self_scm (), $1->self_scm (), $2);
+       }
        | output_def_body error {
 
        }
@@ -1234,12 +1259,9 @@ context_mod_list:
                  if (md)
                      unsmob_context_mod ($1)->add_context_mods (md->get_mods ());
         }
-       | context_mod_list embedded_scm {
-               Context_mod *md = unsmob_context_mod ($2);
-               if (md)
-                       unsmob_context_mod ($1)->add_context_mods (md->get_mods ());
-               else
-                       parser->parser_error (@2, _ ("not a context mod"));
+       | context_mod_list context_mod_embedded {
+               unsmob_context_mod ($1)->add_context_mods
+                       (unsmob_context_mod ($2)->get_mods ());
         }
         ;
 
@@ -1289,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);
@@ -1342,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
@@ -1610,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:
@@ -2043,12 +2080,14 @@ simple_string: STRING {
 scalar:
        embedded_scm_arg
        | bare_number
+       | FRACTION
        | lyric_element
        ;
 
 scalar_closed:
        embedded_scm_arg_closed
        | bare_number
+       | FRACTION
        | lyric_element
        ;