summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kastrup <dak@gnu.org>2016-06-28 10:19:00 +0200
committerDavid Kastrup <dak@gnu.org>2016-07-07 17:57:28 +0200
commitd5400b90987288185c5cbff9257c3a215ea84811 (patch)
tree72c4d6b64f201d73ddf9cb7bdc0c29f41fc70cfb
parent92aa1b833f93c4daab52a547ff09cf9fee648ce4 (diff)
Issue 4908/2: Admit \header-like expressions at top levels
\header-like expressions are allowed at \book, \bookpart, and top level.
-rw-r--r--lily/parser.yy14
1 files changed, 14 insertions, 0 deletions
diff --git a/lily/parser.yy b/lily/parser.yy
index 34d834e2b9..fa729ad9ef 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -473,6 +473,12 @@ toplevel_expression:
id = ly_symbol2scm ("$defaultlayout");
parser->lexer_->set_identifier (id, $1);
+ } else if (ly_is_module ($1))
+ {
+ SCM module = get_header (parser);
+ ly_module_copy (module, $1);
+ parser->lexer_->set_identifier
+ (ly_symbol2scm ("$defaultheader"), module);
} else if (!scm_is_eq ($1, SCM_UNSPECIFIED))
parser->parser_error (@1, _("bad expression type"));
}
@@ -973,6 +979,9 @@ book_body:
id = ly_symbol2scm ("$defaultlayout");
parser->lexer_->set_identifier (id, $2);
+ } else if (ly_is_module ($2))
+ {
+ ly_module_copy (unsmob<Book> ($1)->header_, $2);
} else if (!scm_is_eq ($2, SCM_UNSPECIFIED))
parser->parser_error (@2, _("bad expression type"));
}
@@ -1054,6 +1063,11 @@ bookpart_body:
id = ly_symbol2scm ("$defaultlayout");
parser->lexer_->set_identifier (id, $2);
+ } else if (ly_is_module ($2)) {
+ Book *book = unsmob<Book> ($1);
+ if (!ly_is_module (book->header_))
+ book->header_ = ly_make_module (false);
+ ly_module_copy (book->header_, $2);
} else if (!scm_is_eq ($2, SCM_UNSPECIFIED))
parser->parser_error (@2, _("bad expression type"));
}