lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Flag an error for isolated post-events occuring in music lists (issu


From: dak
Subject: Re: Flag an error for isolated post-events occuring in music lists (issue 6929046)
Date: Wed, 19 Dec 2012 02:52:12 +0000

Reviewers: thomasmorley65,

Message:
On 2012/12/13 01:05:28, thomasmorley65 wrote:
Can't review parser-code, but from description:
LGTM

For the sake of easier understanding I'd have given these
examples,though, to
show that printing yes/no is more a matter of accident:

% fingering is printed
%\displayMusic
{ \tweak #'color #red -3 c }

% fingering is not printed      
%\displayMusic
{ c \tweak #'color #red -3 }

Sorry, I just noticed after pushing that I had not addressed this
comment.  I don't quite agree with its sentiment: in either case, the
fingering gets to be printed basically (if there are other music events
simultaneously, which does not happen in the second example just because
the -3 comes last).  But in either case, the timing is quite weird, and
the resulting music list defective.

Now this should have been discussed and consent reached before pushing.
I am sorry that I bungled this, but as it only concerns the commit
message, it would seem exaggerated to try rewinding staging just for the
chance that we would arrive at a different opinion about the commit
message text.

Description:
Flag an error for isolated post-events occuring in music lists

These can happen when writing things like

c \tweak #'color #red -3

since at the current point of time a tweaked post-event is not
syntactically recognized as a post-event without leading -, like

c -\tweak #'color #red -3

While this restriction will at some time be removed, in the mean time
we want to have this problem flagged.

Please review this at https://codereview.appspot.com/6929046/

Affected files:
  M lily/parser.yy


Index: lily/parser.yy
diff --git a/lily/parser.yy b/lily/parser.yy
index d6a7beac926c46f61f0d037a52c3663bf3ff3071..77075a2882f75eeeee2656217b8337aedd2560a7 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -1017,13 +1017,24 @@ music:  music_arg

 music_embedded:
        music
+       {
+               if (unsmob_music ($1)->is_mus_type ("post-event")) {
+                       parser->parser_error (@1, _ ("unexpected post-event"));
+                       $$ = SCM_UNSPECIFIED;
+               }
+       }
        | embedded_scm
        {
-               if (unsmob_music ($1)
-                   || scm_is_eq ($1, SCM_UNSPECIFIED))
+               if (scm_is_eq ($1, SCM_UNSPECIFIED))
                        $$ = $1;
-               else
-               {
+               else if (Music *m = unsmob_music ($1)) {
+                       if (m->is_mus_type ("post-event")) {
+                               parser->parser_error
+                                       (@1, _ ("unexpected post-event"));
+                               $$ = SCM_UNSPECIFIED;
+                       } else
+                               $$ = $1;
+               } else {
                        @$.warning (_ ("Ignoring non-music expression"));
                        $$ = SCM_UNSPECIFIED;
                }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]