]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4908/1: Allow \header blocks in expressions
authorDavid Kastrup <dak@gnu.org>
Tue, 28 Jun 2016 07:11:45 +0000 (09:11 +0200)
committerDavid Kastrup <dak@gnu.org>
Thu, 7 Jul 2016 15:57:28 +0000 (17:57 +0200)
This allows creating modules for further programmatic manipulation.

lily/parser.yy

index 741aee7d73c32f5b23d2a1cfcbc2ae07eb196115..34d834e2b9095d4a46f0e268556b1a3c78d6fdb3 100644 (file)
@@ -409,10 +409,8 @@ lilypond:  /* empty */ { $$ = SCM_UNSPECIFIED; }
 
 
 toplevel_expression:
-       {
-               parser->lexer_->add_scope (get_header (parser));
-       } lilypond_header {
-               parser->lexer_->set_identifier (ly_symbol2scm ("$defaultheader"), $2);
+       header_block {
+               parser->lexer_->set_identifier (ly_symbol2scm ("$defaultheader"), $1);
        }
        | book_block {
                SCM proc = parser->lexer_->lookup_identifier ("toplevel-book-handler");
@@ -526,6 +524,7 @@ embedded_scm_bare_arg:
        | partial_markup
        | full_markup_list
        | context_modification
+       | header_block
        | score_block
        | context_def_spec_block
        | book_block
@@ -645,6 +644,14 @@ lilypond_header:
        }
        ;
 
+header_block:
+       {
+               parser->lexer_->add_scope (get_header (parser));
+       } lilypond_header {
+               $$ = $2;
+       }
+       ;
+
 /*
        DECLARATIONS
 */
@@ -706,7 +713,8 @@ identifier_init:
        ;
 
 identifier_init_nonumber:
-       score_block
+       header_block
+       | score_block
        | book_block
        | bookpart_block
        | output_def