]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3049: Parser outputs Lyric events for illegal note names
authorDavid Kastrup <dak@gnu.org>
Wed, 26 Dec 2012 21:09:55 +0000 (22:09 +0100)
committerDavid Kastrup <dak@gnu.org>
Wed, 26 Dec 2012 21:09:55 +0000 (22:09 +0100)
Well, after this patch this is what we still do (using void-music with
duration and post events seems even worse of a followup reaction,
silently dropping duration and post events not much better).

But additionally, an error is flagged.  The complaint is "have to be
in Lyric mode for lyrics" which is accurate since in Lyric mode
arbitrary strings and markups may be accepted.  At the point the error
is flagged, we don't necessarily have encountered an unquoted string,
so "bad note name" might be even more misleading.  Before this issue
originated, the parser likely bombed out with "Unexpected STRING", and
frankly that's not really better than "have to be in Lyric mode".

lily/parser.yy

index 77075a2882f75eeeee2656217b8337aedd2560a7..37d5fa4e770c4d954375bc584b899a75d4f6c499 100644 (file)
@@ -3053,6 +3053,8 @@ lyric_element:
 
 lyric_element_music:
        lyric_element optional_notemode_duration post_events {
+               if (!parser->lexer_->is_lyric_state ())
+                       parser->parser_error (@1, _ ("have to be in Lyric mode for lyrics"));
                $$ = MAKE_SYNTAX ("lyric-event", @$, $1, $2);
                if (scm_is_pair ($3))
                        unsmob_music ($$)->set_property