From: Joe Neeman Date: Wed, 23 Dec 2009 05:44:56 +0000 (-0800) Subject: Add nested properties setting to \paper blocks. X-Git-Tag: release/2.13.11-1~56 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=59d1c295b6c6ebe9410362cc365349bd458b0bcf;p=lilypond.git Add nested properties setting to \paper blocks. --- diff --git a/input/regression/paper-nested-override.ly b/input/regression/paper-nested-override.ly new file mode 100644 index 0000000000..67ca6796b1 --- /dev/null +++ b/input/regression/paper-nested-override.ly @@ -0,0 +1,11 @@ +\version "2.13.9" + +\header { + texidoc = "Nested properties can be set in the paper block." +} + +\paper { + between-system-spacing #'minimum-distance = #0.0 +} + +{ c1 \break c1 } diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc index 0adee98fec..3d51d54903 100644 --- a/lily/lily-lexer.cc +++ b/lily/lily-lexer.cc @@ -23,6 +23,7 @@ #include using namespace std; +#include "context.hh" // for nested_property_alist #include "international.hh" #include "interval.hh" #include "keyword.hh" @@ -270,11 +271,17 @@ Lily_lexer::new_input (string str, Sources *ss) } void -Lily_lexer::set_identifier (SCM name, SCM s) +Lily_lexer::set_identifier (SCM path, SCM s) { - SCM sym = name; - if (scm_is_string (name)) - sym = scm_string_to_symbol (name); + SCM sym = path; + SCM val = s; + if (scm_is_string (path)) + sym = scm_string_to_symbol (path); + else if (scm_is_pair (path)) + { + sym = scm_car (path); + path = scm_cdr (path); + } if (scm_is_symbol (sym)) { @@ -286,7 +293,13 @@ Lily_lexer::set_identifier (SCM name, SCM s) SCM mod = scm_car (scopes_); - scm_module_define (mod, sym, s); + if (scm_is_pair (path)) + { + SCM prev = scm_module_lookup (mod, sym); + if (prev != SCM_UNDEFINED) + val = nested_property_alist (prev, path, s); + } + scm_module_define (mod, sym, val); } else programming_error ("identifier is not a symbol"); diff --git a/lily/parser.yy b/lily/parser.yy index a4ac1ec035..979ab2c261 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -564,7 +564,11 @@ assignment_id: assignment: assignment_id '=' identifier_init { PARSER->lexer_->set_identifier ($1, $3); - + } + | assignment_id property_path '=' identifier_init { + SCM path = scm_cons (scm_string_to_symbol ($1), $2); + PARSER->lexer_->set_identifier (path, $4); + ; /* TODO: devise standard for protection in parser.