Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3704)

Issue 182042: Add nested properties setting to \paper blocks. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 4 months ago by joeneeman
Modified:
13 years, 8 months ago
Reviewers:
hanwenn
CC:
lilypond-devel_gnu.org
Visibility:
Public.

Description

Add nested properties setting to \paper blocks.

Patch Set 1 #

Patch Set 2 : Formatting. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+34 lines, -6 lines) Patch
A input/regression/paper-nested-override.ly View 1 chunk +11 lines, -0 lines 0 comments Download
M lily/lily-lexer.cc View 1 3 chunks +18 lines, -5 lines 2 comments Download
M lily/parser.yy View 1 chunk +5 lines, -1 line 0 comments Download

Messages

Total messages: 3
hanwenn
http://codereview.appspot.com/182042/diff/1004/6 File lily/lily-lexer.cc (right): http://codereview.appspot.com/182042/diff/1004/6#newcode274 lily/lily-lexer.cc:274: Lily_lexer::set_identifier (SCM path, SCM s) can you update the ...
14 years, 3 months ago (2010-01-03 06:39:30 UTC) #1
joeneeman
http://codereview.appspot.com/182042/diff/1004/6 File lily/lily-lexer.cc (right): http://codereview.appspot.com/182042/diff/1004/6#newcode274 lily/lily-lexer.cc:274: Lily_lexer::set_identifier (SCM path, SCM s) On 2010/01/03 06:39:30, hanwenn ...
14 years, 3 months ago (2010-01-03 07:49:08 UTC) #2
hanwenn
14 years, 3 months ago (2010-01-09 03:10:30 UTC) #3
Oh sorry - just add the calling convention to an appropriate place,
maybe the .cc


On Sun, Jan 3, 2010 at 5:49 AM,  <joeneeman@gmail.com> wrote:
> Reviewers: hanwenn,
>
>
> http://codereview.appspot.com/182042/diff/1004/6
> File lily/lily-lexer.cc (right):
>
> http://codereview.appspot.com/182042/diff/1004/6#newcode274
> lily/lily-lexer.cc:274: Lily_lexer::set_identifier (SCM path, SCM s)
> On 2010/01/03 06:39:30, hanwenn wrote:
>>
>> can you update the comment that explains the calling convention.
>
> (Possibly you
>>
>> should update the .h)
>
> I can update the .h but I can't find any comment explaining the calling
> convention...
>
> Description:
> Add nested properties setting to \paper blocks.
>
> Please review this at http://codereview.appspot.com/182042
>
> Affected files:
>  A input/regression/paper-nested-override.ly
>  M lily/lily-lexer.cc
>  M lily/parser.yy
>
>
> Index: input/regression/paper-nested-override.ly
> diff --git a/input/regression/paper-nested-override.ly
> b/input/regression/paper-nested-override.ly
> new file mode 100644
> index
>
0000000000000000000000000000000000000000..67ca6796b1c662309e6a7bce80a70092f1f4e8aa
> --- /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 }
> Index: lily/lily-lexer.cc
> diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc
> index
>
0adee98fec480614e90665289bb05a40897bb352..3d51d54903c8a29f553eb3271c5421ce3927a14d
> 100644
> --- a/lily/lily-lexer.cc
> +++ b/lily/lily-lexer.cc
> @@ -23,6 +23,7 @@
>  #include <sstream>
>  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");
> Index: lily/parser.yy
> diff --git a/lily/parser.yy b/lily/parser.yy
> index
>
d2f3a8c4dc9e9f0eae7f1512c673fbeabadcdf6d..001c461834f891546c2cad68df39c8aedb0579ab
> 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.
>
>
>
>



-- 
Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b