summaryrefslogtreecommitdiff
path: root/lily
diff options
context:
space:
mode:
authorDavid Kastrup <dak@gnu.org>2016-06-28 09:11:45 +0200
committerDavid Kastrup <dak@gnu.org>2016-07-07 17:57:28 +0200
commit92aa1b833f93c4daab52a547ff09cf9fee648ce4 (patch)
treeea72e54a661428f38a21fbffa39f6abddcd18d89 /lily
parenteda66de049d33031a3230dfbf5735399bf2c1d60 (diff)
Issue 4908/1: Allow \header blocks in expressions
This allows creating modules for further programmatic manipulation.
Diffstat (limited to 'lily')
-rw-r--r--lily/parser.yy18
1 files changed, 13 insertions, 5 deletions
diff --git a/lily/parser.yy b/lily/parser.yy
index 741aee7d73..34d834e2b9 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -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